/* 全局样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 确保html和body占满整个屏幕，但允许内容扩展 */
html, body {
  min-height: 100%;
  margin: 0;
  padding: 0;
}

/* 主页hero样式 */
.hero-section {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  text-align: center;
  overflow: hidden;
  z-index: -1;
}

/* 确保header在hero-section上面 */
/* 这个样式定义已合并到下面的完整header样式中 */

/* 背景装饰元素 */
.hero-section::before,
.hero-section::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  opacity: 0.1;
  animation: float 20s infinite ease-in-out;
}

.hero-section::before {
  width: 300px;
  height: 300px;
  background-color: #ffffff;
  top: -100px;
  left: -100px;
  animation-delay: 0s;
}

.hero-section::after {
  width: 400px;
  height: 400px;
  background-color: #ffffff;
  bottom: -150px;
  right: -150px;
  animation-delay: 10s;
}

/* 浮动动画 */
@keyframes float {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(20px, 20px) rotate(90deg);
  }
  50% {
    transform: translate(0, 40px) rotate(180deg);
  }
  75% {
    transform: translate(-20px, 20px) rotate(270deg);
  }
}

/* 添加更多装饰元素 */
.hero-section .decor {
  position: absolute;
  border-radius: 50%;
  opacity: 0.05;
  animation: float 15s infinite ease-in-out;
}

.hero-section .decor:nth-child(1) {
  width: 200px;
  height: 200px;
  background-color: #ffffff;
  top: 20%;
  right: 10%;
  animation-delay: 5s;
}

.hero-section .decor:nth-child(2) {
  width: 150px;
  height: 150px;
  background-color: #ffffff;
  bottom: 20%;
  left: 15%;
  animation-delay: 8s;
}

/* 调整文字颜色以适应渐变背景 */
.hero-name {
  color: #ffffff !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hero-subtitle {
  color: rgba(255, 255, 255, 0.9) !important;
}

.typed-cursor {
  color: var(--text-primary) !important;
  opacity: 0.8;
}

.scroll-indicator {
  color: rgba(255, 255, 255, 0.8) !important;
}

.hero-content {
  max-width: 600px;
  width: 100%;
}

.hero-avatar {
  margin-bottom: var(--spacing-6);
}

.avatar-img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--primary-color);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.avatar-img:hover {
  transform: scale(1.05);
}

.hero-name {
  font-size: var(--font-size-4xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-4);
  line-height: 1.2;
}

.hero-subtitle {
  font-size: var(--font-size-xl);
  color: var(--text-secondary);
  margin-bottom: var(--spacing-8);
  min-height: 1.5em;
}

#typed-subtitle {
  font-weight: 400;
}

.typed-cursor {
  font-weight: bold;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.scroll-indicator {
  position: absolute;
  bottom: var(--spacing-8);
  left: 50%;
  transform: translateX(-50%);
  animation: bounce 2s infinite;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: var(--font-size-2xl);
  transition: color 0.3s ease;
}

.scroll-indicator:hover {
  color: var(--primary-color);
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
  40% { transform: translateX(-50%) translateY(-20px); }
  60% { transform: translateX(-50%) translateY(-10px); }
}

/* 当页面中存在hero-section时，header保持不透明背景 */
body:has(.hero-section) .header {
  transition: opacity 0.5s ease, transform 0.5s ease;
  opacity: 1;
  transform: translateY(0);
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
}

/* 当页面中存在hero-section且header有scrolled类时，保持现有样式 */
body:has(.hero-section) .header.scrolled {
  opacity: 1;
  transform: translateY(0);
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
}

/* 选中文本样式 */
::selection {
  background-color: #a3d5ff;
  color: var(--text-primary);
}

::-moz-selection {
  background-color: #a3d5ff;
  color: var(--text-primary);
}

/* 搜索页面专用样式 */
.search-page {
  min-height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-8) var(--spacing-4);
  animation: fadeIn 0.5s ease-out;
}

.search-page-content {
  max-width: 800px;
  width: 100%;
  text-align: center;
}

.search-page-title {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--spacing-6);
  color: var(--text-primary);
  font-weight: 600;
}

.search-container-full {
  position: relative;
  width: 100%;
  transition: all 0.3s ease;
}

.search-page-mask {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
}

.search-container-full.active .search-page-mask {
  opacity: 1;
  visibility: visible;
}

.search-box-full {
  position: relative;
  z-index: 1000;
  animation: slideUp 0.3s ease-out;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-2) var(--spacing-4);
  margin-bottom: var(--spacing-4);
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.search-input-wrapper:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-input-icon {
  color: var(--text-secondary);
  margin-right: var(--spacing-2);
  font-size: var(--font-size-base);
}

#searchInputFull {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: var(--font-size-lg);
  color: var(--text-primary);
  padding: var(--spacing-1) 0;
}

#searchInputFull::placeholder {
  color: var(--text-secondary);
}

.search-close-full {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--spacing-1);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  font-size: var(--font-size-base);
}

.search-close-full:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.search-results-full {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  max-height: 400px;
  overflow-y: auto;
  animation: slideDown 0.3s ease-out;
}

/* 动画效果 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
    max-height: 0;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 400px;
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .search-page {
    padding: var(--spacing-6) var(--spacing-3);
  }
  
  .search-page-title {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--spacing-4);
  }
  
  #searchInputFull {
    font-size: var(--font-size-base);
  }
}

/* 移动端目录样式优化 - 默认隐藏 */
@media (max-width: 768px) {
  /* 默认隐藏移动端目录 */
  .toc-container {
    display: none;
  }
}
/* 根变量定义 */
:root {
  /* 配色方案 - 简约现代风格 */
  --primary-color: #3b82f6;
  --secondary-color: #64748b;
  --accent-color: #f43f5e;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --bg-primary: #ffffff;
  --bg-primary-rgb: 255, 255, 255;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-code: #f8fafc;
  --border-color: #e2e8f0;
  --shadow-light: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-heavy: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  /* 字体设置 */
  --font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-family-serif: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;
  
  /* 行高设置 */
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
  --line-height-loose: 2;
  
  /* 间距设置 */
  --spacing-05: 0.125rem; /* 添加更小的间距变量 */
  --spacing-1: 0.25rem;
  --spacing-2: 0.5rem;
  --spacing-3: 0.75rem;
  --spacing-4: 1rem;
  --spacing-5: 1.25rem;
  --spacing-6: 1.5rem;
  --spacing-8: 2rem;
  --spacing-10: 2.5rem;
  --spacing-12: 3rem;
  --spacing-16: 4rem;
  --spacing-20: 5rem;
  
  /* 圆角设置 */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-full: 9999px;
  
  /* 过渡效果 */
  --transition-fast: 0.15s ease-in-out;
  --transition-normal: 0.3s ease-in-out;
  --transition-slow: 0.5s ease-in-out;
}

/* 暗黑模式变量定义 */
.dark {
  /* 只修改背景相关颜色，保持其他颜色不变 */
  --bg-primary: #111827;
  --bg-primary-rgb: 17, 24, 39;
  --bg-secondary: #1f2937;
  --bg-tertiary: #374151;
  --bg-code: #2d3748;
  --border-color: #374151;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --shadow-light: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.4);
  --shadow-heavy: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -2px rgba(0, 0, 0, 0.5);
}

/* 媒体查询：系统暗黑模式支持 - 只在用户未手动设置主题时应用 */
@media (prefers-color-scheme: dark) {
  :root:not(.dark):not(.light) {
    /* 只修改背景相关颜色，保持其他颜色不变 */
    --bg-primary: #111827;
    --bg-primary-rgb: 17, 24, 39;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --bg-code: #2d3748;
    --border-color: #374151;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --shadow-light: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.4);
    --shadow-heavy: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -2px rgba(0, 0, 0, 0.5);
  }
}

/* 基础样式 */
body {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-serif);
  font-weight: 700;
  line-height: var(--line-height-tight);
  margin-bottom: var(--spacing-4);
  color: var(--text-primary);
}

h1 {
  font-size: var(--font-size-4xl);
}

h2 {
  font-size: var(--font-size-3xl);
}

h3 {
  font-size: var(--font-size-2xl);
}

h4 {
  font-size: var(--font-size-xl);
}

h5 {
  font-size: var(--font-size-lg);
}

h6 {
  font-size: var(--font-size-base);
}

p {
  margin-bottom: var(--spacing-4);
}

ul, ol {
  margin-bottom: var(--spacing-4);
  padding-left: var(--spacing-8);
}

li {
  margin-bottom: var(--spacing-2);
}

/* 容器样式 */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 var(--spacing-6);
}

/* 头部样式 - 占满整个屏幕宽度 */
.header {
  /* 所有header默认使用scrolled样式 */
  padding: var(--spacing-3) 0;
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  /* 移除默认的container限制，让header占满屏幕 */
  max-width: none;
  transition: all 0.5s ease;
}



/* 所有页面的subtitle都隐藏 */
.header .site-subtitle {
  opacity: 0;
  height: 0;
  margin: 0;
  overflow: hidden;
}

/* 所有页面的标题大小都使用scrolled样式 */
.header .site-title {
  font-size: var(--font-size-xl);
}

/* 头部内容容器 - 保持内容居中，与原container宽度一致 */
.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-4); /* 统一间距 */
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 var(--spacing-6);
  width: 100%;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-3); /* 统一按钮之间的间距 */
  flex-wrap: wrap;
}

.header-left {
  flex: 1;
}

.site-title {
  font-size: var(--font-size-2xl);
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.site-title .logo {
  color: var(--text-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  transition: color var(--transition-fast);
}

.site-title .logo:hover {
  color: var(--primary-color);
  text-decoration: none;
}

.site-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin: var(--spacing-1) 0 0 0;
  font-weight: 400;
  line-height: var(--line-height-normal);
  max-width: 600px;
}

/* 导航菜单 */
.hamburger-btn {
  display: none;
  background-color: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: var(--spacing-2) var(--spacing-3);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-primary);
  font-size: var(--font-size-lg);
  z-index: 100;
  min-width: auto;
  width: auto;
}

.hamburger-btn:hover {
  background-color: var(--bg-secondary);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* 按钮组样式 - 确保按钮之间没有间距且高度一致 */
.header-button-group {
  display: flex;
  align-items: center;
  gap: 0; /* 按钮之间没有间距 */
}

/* 暗黑模式切换按钮样式 - 与搜索按钮一致 */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  border: 1px solid transparent; /* 添加透明边框，避免悬停时尺寸变化 */
  border-radius: var(--radius-md); /* 与搜索按钮一致的圆角 */
  padding: calc(var(--spacing-2) - 1px); /* 微调内边距，适配1px透明边框 */
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-secondary); /* 与搜索按钮一致的文字颜色 */
  font-size: var(--font-size-base); /* 与搜索按钮一致的字体大小 */
  min-width: auto;
  height: 100%; /* 确保高度一致 */
  margin: 0; /* 移除所有margin */
}

/* 搜索按钮样式调整 - 确保与暗黑模式按钮高度一致且无间距 */
.header-button-group .search-btn {
  margin: 0; /* 移除所有margin */
  height: 100%; /* 确保高度一致 */
  padding: calc(var(--spacing-2) - 1px); /* 微调内边距，适配1px透明边框 */
  border: 1px solid transparent; /* 保持与主题切换按钮一致的透明边框 */
  background-color: transparent; /* 确保背景透明 */
  border-radius: var(--radius-md); /* 确保圆角一致 */
  color: var(--text-secondary); /* 确保颜色一致 */
  font-size: var(--font-size-base); /* 确保字体大小一致 */
  text-decoration: none; /* 移除a标签默认下划线 */
  display: flex; /* 确保Flex布局 */
  align-items: center; /* 确保内容居中 */
  justify-content: center; /* 确保内容居中 */
}

.theme-toggle-btn:hover {
  background-color: var(--bg-secondary); /* 与搜索按钮一致的悬停背景 */
  box-shadow: var(--shadow-light); /* 与搜索按钮一致的悬停阴影 */
  color: var(--primary-color); /* 与搜索按钮一致的悬停文字颜色 */
  border: 1px solid var(--border-color); /* 窄窄的灰色边框 */
}

.theme-toggle-btn .dark-icon {
  display: none;
}

/* 暗黑模式下的图标切换 */
.dark .theme-toggle-btn .light-icon {
  display: none;
}

.dark .theme-toggle-btn .dark-icon {
  display: inline;
}

/* 暗黑模式下的hero-section样式 */
.dark .hero-section {
  background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
}

.dark .hero-section::before,
.dark .hero-section::after,
.dark .hero-section .decor {
  background-color: rgba(255, 255, 255, 0.05);
}

.dark .hero-name {
  color: #f1f5f9 !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.dark .hero-subtitle {
  color: rgba(241, 245, 249, 0.9) !important;
}

.dark .typed-cursor {
  color: rgba(241, 245, 249, 0.8) !important;
}

.dark .scroll-indicator {
  color: rgba(241, 245, 249, 0.8) !important;
}

/* 暗黑模式下的引用样式 */
.dark blockquote {
  background-color: var(--bg-secondary);
  border-left-color: var(--primary-color);
  color: var(--text-primary);
  box-shadow: var(--shadow-light);
}

.dark blockquote blockquote {
  background-color: var(--bg-tertiary);
  border-left-color: var(--secondary-color);
}

/* 暗黑模式下的框框样式 */
.dark .box-container {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-primary);
  box-shadow: var(--shadow-light);
}

.dark .box-info {
  background-color: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.5);
  color: var(--text-primary);
}

.dark .box-note {
  background-color: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.5);
  color: var(--text-primary);
}

.dark .box-warning {
  background-color: rgba(249, 115, 22, 0.1);
  border-color: rgba(249, 115, 22, 0.5);
  color: var(--text-primary);
}

.dark .box-error {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.5);
  color: var(--text-primary);
}

.dark .box-success {
  background-color: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.5);
  color: var(--text-primary);
}

.dark .box-info .box-icon,
.dark .box-info .box-title {
  color: #60a5fa;
}

.dark .box-note .box-icon,
.dark .box-note .box-title {
  color: #fbbf24;
}

.dark .box-warning .box-icon,
.dark .box-warning .box-title {
  color: #f97316;
}

.dark .box-error .box-icon,
.dark .box-error .box-title {
  color: #ef4444;
}

.dark .box-success .box-icon,
.dark .box-success .box-title {
  color: #22c55e;
}

/* 暗黑模式下的代码块样式 */
.dark pre {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
}

.dark pre .code-header {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
}

.dark pre .language-label {
  color: var(--text-secondary);
}

/* 暗黑模式下的行号样式 - 调整渐变效果 */
.dark pre .gutter {
  background: linear-gradient(90deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-right-color: var(--border-color);
  color: var(--text-muted);
}

/* 暗黑模式下的代码内容区域 */
.dark pre .code-content {
  background-color: var(--bg-secondary);
}

/* 暗黑模式下的代码区域 - 确保使用正确的背景色 */
.dark pre .code {
  background-color: var(--bg-code);
}

.dark pre .code code,
.dark pre .code pre code,
.dark pre .code code.hljs,
.dark pre .code pre code.hljs {
  background-color: var(--bg-code);
  color: var(--text-primary);
}

/* 确保主题切换时代码块相关元素正确响应 */
pre .code-content,
pre .gutter,
pre .code {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* 确保明亮模式下的样式完整 */
pre .code-content {
  background-color: var(--bg-primary);
}

pre .gutter {
  background: linear-gradient(90deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
  border-right-color: var(--border-color);
  color: var(--text-muted);
}

pre .code {
  background-color: var(--bg-primary);
}

pre .code code,
pre .code pre code,
pre .code code.hljs,
pre .code pre code.hljs {
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

/* 暗黑模式下的表格布局代码块样式 */
.dark figure[class*="highlight"] {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
}

.dark figure[class*="highlight"] .gutter {
  background-color: var(--bg-secondary);
  border-right-color: var(--border-color);
  color: var(--text-muted);
}

.dark figure[class*="highlight"] .code {
  background-color: var(--bg-code);
}

.dark figure[class*="highlight"] pre .line {
  color: var(--text-primary);
}

/* 暗黑模式下的复制按钮样式 - 更协调的背景色 */
.dark pre .copy-btn {
  background-color: transparent;
  color: var(--text-secondary);
  box-shadow: none;
}

.dark pre .copy-btn:hover {
  background-color: var(--bg-secondary);
  color: var(--primary-color);
  box-shadow: var(--shadow-light);
}

.dark pre .copy-btn.copied {
  background-color: var(--bg-secondary);
  color: var(--primary-color);
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--spacing-6);
  flex-wrap: wrap;
  transition: all var(--transition-normal);
}

.nav-list {
  display: flex;
  list-style: none;
  gap: var(--spacing-6);
  margin: 0;
  padding: 0;
  transition: all var(--transition-normal);
}

.nav-item {
  margin: 0;
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  padding: var(--spacing-2) 0;
  position: relative;
  transition: color var(--transition-fast);
  font-size: var(--font-size-base);
  font-family: var(--font-family-serif);
}

.nav-link:hover {
  color: var(--primary-color);
  text-decoration: none;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background-color: var(--primary-color);
  transition: width var(--transition-normal);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

.nav-link.active {
  color: var(--primary-color);
  font-weight: 600;
}

/* 移动端搜索项默认隐藏 */
.mobile-search-item {
  display: none;
}

/* 响应式导航 */
@media (max-width: 768px) {
  /* 显示汉堡按钮 */
  .hamburger-btn {
    display: block;
  }
  
  /* 移动端header布局 */
  .header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    position: relative;
  }
  
  /* 默认隐藏导航菜单 */
  .nav {
    display: flex;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-4);
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-3);
    box-shadow: var(--shadow-medium);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    z-index: 101; /* 比header的z-index更高，确保菜单显示在header之上 */
    min-width: 80px;
    width: auto;
    pointer-events: none;
  }
  
  /* 导航菜单激活状态 */
  .nav.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }
  
  /* 纵向排列导航项 */
  .nav-list {
    flex-direction: column;
    width: 100%;
    gap: var(--spacing-2);
  }
  
  /* 导航项样式 */
  .nav-item {
    width: 100%;
  }
  
  /* 导航链接样式 */
  .nav-link {
    display: block;
    padding: var(--spacing-3);
    width: 100%;
    font-size: var(--font-size-base);
    white-space: normal;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
  }
  
  /* 导航链接悬停样式 */
  .nav-link:hover {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
  }
  
  /* 显示移动端搜索项 */
  .mobile-search-item {
    display: block;
  }
  
  /* 隐藏桌面端搜索按钮 */
  .desktop-search-btn {
    display: none;
  }
  
  /* 移动端搜索按钮样式 */
  .nav-link.search-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    color: var(--primary-color);
  }
  
  .nav-link.search-btn:hover {
    background-color: rgba(59, 130, 246, 0.1);
    border: 1px solid var(--border-color); /* 窄窄的灰色边框 */
  }
  
  .language-switch,
  .language-btn {
    width: auto;
    justify-content: center;
  }
  
  /* 确保导航栏和站点标题在同一行 */
  .header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-4); /* 统一间距 */
    width: 100%;
    flex-wrap: nowrap;
  }
  
  .header-left {
    flex-shrink: 0;
  }
  
  .header-right {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: var(--spacing-3); /* 统一按钮之间的间距 */
    justify-content: flex-end;
  }
  
  .site-title {
    font-size: var(--font-size-lg);
    white-space: nowrap;
  }
  
  /* 搜索按钮样式调整 */
  .search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: var(--spacing-2);
    white-space: nowrap;
  }
  

}

/* 语言切换 */
.language-switch {
  position: relative;
}

.language-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  background-color: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-3) var(--spacing-5);
  font-size: var(--font-size-base);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.language-btn:hover {
  background-color: var(--bg-secondary);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-light);
}

.language-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-medium);
  min-width: 120px;
  padding: var(--spacing-2) 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-var(--spacing-2));
  transition: all var(--transition-normal);
  z-index: 200;
}

.language-dropdown a {
  display: block;
  padding: var(--spacing-2) var(--spacing-4);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  text-decoration: none;
  transition: background-color var(--transition-fast);
}

.language-dropdown a:hover {
  background-color: var(--bg-secondary);
  text-decoration: none;
}

.language-switch:hover .language-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}



/* 主内容区域 */
.main {
  padding: var(--spacing-6) 0 var(--spacing-8) 0;
  min-height: calc(100vh - 200px);
}

/* 首页文章列表 */
.home {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-6);
  position: relative;
  z-index: 1;
  background-color: var(--bg-primary);
  padding: var(--spacing-6) 0 var(--spacing-8) 0;
}

/* 只有当hero-section存在时，才给home添加margin-top */
body:has(.hero-section) .home {
  margin-top: 100vh;
}

.posts {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-6);
}

.post-item {
  background-color: var(--bg-primary);
  padding: var(--spacing-1) 0;
  border-bottom: 1px solid var(--bg-tertiary);
  transition: all var(--transition-fast);
}

.post-item:hover {
  transform: translateY(0);
}

.post-header {
  margin-bottom: var(--spacing-2);
}

.post-title {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-1);
  font-weight: 600;
  line-height: var(--line-height-tight);
}

.post-detail .post-title {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: var(--line-height-tight);
  margin-bottom: var(--spacing-3);
}

.post-link {
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.post-link:hover {
  color: var(--primary-color);
  text-decoration: none;
}

.post-meta {
  display: flex;
  gap: var(--spacing-4);
  flex-wrap: wrap;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin: var(--spacing-2) 0;
  line-height: var(--line-height-normal);
}

.post-meta span {
  display: flex;
  align-items: center;
  gap: var(--spacing-1);
  transition: all var(--transition-fast);
  padding: 0 var(--spacing-2);
  border-radius: var(--radius-md);
  height: 24px;
  line-height: 24px;
  background-color: var(--bg-secondary);
}

.post-date,
.post-reading-time,
.post-category-item,
.post-tag-item {
  color: var(--text-primary);
}

.post-category-item,
.post-tag-item {
  background-color: var(--primary-color-light);
}

.post-category-item:hover,
.post-tag-item:hover {
  background-color: var(--primary-color);
  color: white;
}

.post-meta i {
  font-size: var(--font-size-sm);
  color: var(--primary-color);
}

/* 分类和标签项的图标默认颜色 */
.post-category-item i,
.post-tag-item i {
  color: var(--primary-color);
}

/* 分类和标签项悬停时的图标颜色 */
.post-category-item:hover i,
.post-tag-item:hover i {
  color: white;
}

/* 分类和标签项悬停时，内部链接的颜色 */
.post-category-item:hover .category-link,
.post-tag-item:hover .tag-link {
  color: white;
}

.post-reading-time {
  display: inline-flex;
  align-items: center;
}

/* post-categories and post-tags are no longer used */

.post-category-item,
.post-tag-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-05);
  transition: all var(--transition-fast);
  padding: 0 var(--spacing-2);
  border-radius: var(--radius-md);
  height: 24px;
  line-height: 24px;
}

.category-link,
.tag-link {
  color: var(--text-primary);
  text-decoration: none;
  font-size: var(--font-size-sm);
  transition: color var(--transition-fast);
  font-weight: 400;
  padding: 0;
  margin: 0;
  height: auto;
  line-height: inherit;
  background-color: transparent;
  border-radius: 0;
}

.category-link:first-child, .tag-link:first-child {
  margin-left: 0;
}

.category-link:hover,
.tag-link:hover {
  color: white;
  text-decoration: none;
}



.post-excerpt {
  margin-bottom: var(--spacing-3);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  font-size: var(--font-size-sm);
}

.post-footer {
  display: flex;
  justify-content: flex-start;
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary-color);
  font-weight: 400;
  text-decoration: none;
  transition: all var(--transition-fast);
  font-size: var(--font-size-sm);
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: transparent;
}

.read-more:hover {
  color: var(--primary-color);
  text-decoration: none;
  transform: none;
  border-color: var(--primary-color);
  background-color: transparent;
}

.read-more-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: none;
}

.read-more i {
  transition: none;
  font-size: 12px;
}

/* 文章详情页 */
.post-detail {
  background-color: var(--bg-primary);
}

.post {
  background-color: var(--bg-primary);
}
/* 文章内容容器 */
.post-content-container {
  display: flex;
  flex-direction: row;
  gap: var(--spacing-8);
  margin-top: var(--spacing-6);
  position: relative;
  /* 移除容器的过渡，单独处理文章内容的过渡 */
}

/* 移动端布局 */
@media (max-width: 767px) {
  .post-content-container {
    flex-direction: column;
  }
}

.post-content-wrapper {
  flex: 1;
  transition: width 0.2s ease-out 0.1s; /* 延迟0.1s，让目录动画先完成，减少卡顿 */
  min-width: 0; /* 确保内容不会溢出 */
  will-change: width; /* 告诉浏览器提前优化 */
}

.post-content {
  overflow-anchor: none; /* 防止滚动锚点影响 */
  contain: layout inline-size; /* 优化布局计算 */
  content-visibility: auto; /* 优化渲染性能 */
  word-break: break-word; /* 优化换行处理 */
  /* 使用CSS contain属性隔离布局，减少重排范围 */
}

/* TOC目录容器 */
.toc-container {
  width: fit-content;
  min-width: 200px;
  position: sticky;
  top: 120px;
  align-self: start;
  padding: var(--spacing-3) var(--spacing-4);
  border-left: 3px solid var(--border-color); /* 分割线宽度与蓝色竖杠一致 */
  margin-left: var(--spacing-4);
  overflow: visible;
  flex-shrink: 0;
  flex-basis: auto;
}

/* 列表样式重置 */
.toc-list, .toc-children {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* TOC导航区域 */
.toc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-2);
  padding-bottom: var(--spacing-2);
  border-bottom: 1px solid var(--border-color);
}

.toc-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.toc-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.toc-toggle i {
  transition: all 0.3s ease;
}

.toc-toggle:hover {
  color: var(--primary-color);
  background-color: var(--bg-secondary);
}



.toc-nav {
  overflow-y: hidden;
  max-height: 500px;
  transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
  padding: var(--spacing-4) 0;
  opacity: 1;
}

.toc-container.collapsed .toc-nav {
  max-height: 0;
  overflow-y: hidden;
  padding: 0;
  opacity: 0;
}

.toc-container.collapsed {
  width: auto;
  flex-shrink: 0;
}

/* 响应式设计 */
@media (max-width: 767px) {
  .post-content-container {
    flex-direction: column;
  }
  
  .toc-container {
    position: static;
    width: 100%;
    margin-bottom: var(--spacing-6);
    order: -1; /* 移动端显示在文章内容上方 */
  }
  
  .toc-nav {
    max-height: 300px;
  }
}

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

.toc-item {
  margin-bottom: var(--spacing-05); /* 减小间距 */
}

/* 标题层级字体大小 - 突出不同级别，调整为更小的适中大小 */
.toc-item.level-1 .toc-link {
  font-size: var(--font-size-lg);
  font-weight: 400;
}

.toc-item.level-2 .toc-link {
  font-size: var(--font-size-base);
  font-weight: 400;
}

.toc-item.level-3 .toc-link {
  font-size: var(--font-size-sm);
  font-weight: 400;
}

.toc-item.level-4 .toc-link {
  font-size: var(--font-size-sm);
  font-weight: 400;
}

.toc-item.level-5 .toc-link {
  font-size: var(--font-size-sm);
  font-weight: 300;
}

.toc-item.level-6 .toc-link {
  font-size: var(--font-size-sm);
  font-weight: 300;
}

.toc-link {
  display: block;
  padding: calc(var(--spacing-1) * 0.75) 0; /* 调整左侧内边距，与分割线保持间距 */
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-normal);
  line-height: 1.4; /* 紧凑行高 */
  font-size: var(--font-size-base); /* 基础字体大小，确保所有链接都清晰 */
  position: relative;
  left: 0;
  white-space: nowrap;
  overflow: visible;
}

/* 调整响应式样式 */
@media (min-width: 768px) {
  .toc-item.level-1 .toc-link {
    font-size: var(--font-size-lg); /* 与移动端一致的较大字体 */
  }
  
  .toc-item.level-2 .toc-link {
    font-size: var(--font-size-base); /* 与移动端一致的较大字体 */
  }
  
  .toc-item.level-3 .toc-link {
    font-size: var(--font-size-sm); /* 与移动端一致的较大字体 */
  }
  
  .toc-link {
    padding: calc(var(--spacing-1) * 0.5) 0; /* 调整左侧内边距 */
  }
  
  .toc-children {
    padding-left: var(--spacing-3); /* 调整子列表缩进 */
  }
}

.toc-link:hover {
  color: var(--primary-color);
  text-decoration: none;
}

.toc-link.active {
  color: var(--primary-color);
  font-weight: 600;
  background-color: transparent;
}

.toc-link::before {
  content: '';
  position: absolute;
  left: -12px; /* 与左侧3px宽分割线对齐 */
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px; /* 固定竖杠高度，避免跳动 */
  background-color: transparent;
  border-radius: 3px;
  transition: all 0.15s ease-in-out; /* 更快的过渡，减少视觉跳动 */
  opacity: 0;
  z-index: 1;
}

.toc-link.active::before {
  background-color: var(--primary-color);
  opacity: 1;
  z-index: 1;
}

/* 优化缩进 - 基于实际使用的标题级别动态调整 */
.toc-children {
  list-style: none;
  padding-left: var(--spacing-3); /* 统一缩进量 */
  margin: 0;
}

/* 文章内容样式 */
.post-content {
  font-family: var(--font-family-serif);
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
  color: var(--text-primary);
  margin-bottom: 0;
}

/* 文章信息卡片样式 */
.post-info-card {
  margin-top: 0;
  padding: var(--spacing-4) var(--spacing-6);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.post-info-content {
  width: 100%;
  position: relative;
  z-index: 1;
}

/* 文章许可信息标题 */
.post-info-section-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-3);
  padding-bottom: var(--spacing-2);
  border-bottom: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
}

.post-info-section-title i {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
}

.post-info-text {
  flex: 1;
  margin-right: 0;
  padding-right: 0;
}

.post-info-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-1);
  line-height: 1.4;
}

.post-info-url {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-bottom: var(--spacing-3);
  word-break: break-all;
}

.post-info-meta {
  display: flex;
  gap: var(--spacing-6);
  align-items: center;
  flex-wrap: wrap;
  font-size: var(--font-size-sm);
}

.post-info-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.post-info-label {
  font-weight: 500;
  color: var(--text-primary);
}

.post-info-value {
  color: var(--text-secondary);
}

/* 许可协议文字链接 */
.license-text {
  color: var(--text-secondary);
}

.license-link {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
  font-weight: 500;
}

.license-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* 响应式设计 */
@media (max-width: 767px) {
  .post-info-content {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-3);
  }
  
  .post-info-meta {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--spacing-4);
    overflow-x: auto;
    padding-bottom: var(--spacing-1);
  }
  
  .post-info-main {
    flex-direction: row;
    align-items: center;
    gap: var(--spacing-4);
    width: 100%;
  }
  
  .post-info-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-1);
    width: auto;
    white-space: nowrap;
  }
  
  .post-info-cc {
    font-size: 3rem;
    right: -10px;
    top: 20px;
    transform: none;
  }
}

.post-content h1, .post-content h2, .post-content h3, .post-content h4, .post-content h5, .post-content h6 {
  margin-top: var(--spacing-8);
  margin-bottom: var(--spacing-4);
  padding-bottom: var(--spacing-1);
  border-bottom: 1px solid var(--bg-tertiary);
  font-weight: 600;
  /* 移除默认的scroll-margin-top，因为我们在JavaScript中精确控制滚动位置 */
  scroll-margin-top: 0;
}

.post-content h1 {
  font-size: 1.4rem;
}

.post-content h2 {
  font-size: 1.05rem;
}

.post-content h3 {
  font-size: 0.95rem;
}

.post-content h4 {
  font-size: 0.85rem;
}

.post-content h5 {
  font-size: 0.8rem;
}

.post-content h6 {
  font-size: 0.8rem;
}

/* 英文标题字体稍大，但比文章标题小 */
.post-content h1, .post-content h2, .post-content h3, .post-content h4, .post-content h5, .post-content h6 {
  /* 中文字体默认大小 */
}

/* 使用CSS Unicode范围选择器为英文内容设置稍大字体 */
.post-content h1:lang(en),
.post-content h2:lang(en),
.post-content h3:lang(en),
.post-content h4:lang(en),
.post-content h5:lang(en),
.post-content h6:lang(en),
.post-content h1 span:lang(en),
.post-content h2 span:lang(en),
.post-content h3 span:lang(en),
.post-content h4 span:lang(en),
.post-content h5 span:lang(en),
.post-content h6 span:lang(en) {
  font-size: 1.1em;
}

/* 直接使用Unicode范围匹配英文内容 */
.post-content h1, 
.post-content h2, 
.post-content h3, 
.post-content h4, 
.post-content h5, 
.post-content h6 {
  /* 基本样式 */
}

/* 使用font-size-adjust和unicode-range优化英文显示 */
.post-content h1::first-line, 
.post-content h2::first-line, 
.post-content h3::first-line, 
.post-content h4::first-line, 
.post-content h5::first-line, 
.post-content h6::first-line {
  /* 针对首行的优化 */
}

/* 为英文单词和字符单独设置稍大字体 */
.post-content h1, 
.post-content h2, 
.post-content h3, 
.post-content h4, 
.post-content h5, 
.post-content h6 {
  font-size-adjust: 0.5;
}

/* 针对英文内容的特殊处理 */
@font-face {
  font-family: 'EnglishHeadings';
  src: local('Times New Roman'), local('Georgia'), local('serif');
  unicode-range: U+0041-005A, U+0061-007A, U+0030-0039, U+0020-002F, U+003A-0040, U+005B-0060, U+007B-007E;
}

.post-content h1, 
.post-content h2, 
.post-content h3, 
.post-content h4, 
.post-content h5, 
.post-content h6 {
  font-family: 'EnglishHeadings', var(--font-family-serif);
}

.post-content p {
  margin-bottom: var(--spacing-5);
}

.post-content a {
  color: var(--primary-color);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-content a:hover {
  color: var(--primary-color);
  text-decoration-thickness: 2px;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: var(--spacing-5) 0;
  box-shadow: none;
}

/* 内联代码样式 */
.post-content code:not(pre code) {
  background-color: var(--bg-tertiary);
  padding: var(--spacing-1) var(--spacing-2);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-family: 'Consolas', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* 代码块容器样式 - 现代简约设计 */
/* 初始隐藏所有代码块，避免加载时显示丑陋的表格 */
figure[class*="highlight"] {
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

/* 延迟显示代码块，确保样式加载完成 */
body.loaded figure[class*="highlight"] {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  margin: var(--spacing-5) 0;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-family: 'Consolas', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* 代码块表格样式 */
figure[class*="highlight"] table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  padding: 0;
}

/* 代码块行样式 */
figure[class*="highlight"] tr {
  background-color: transparent;
}

/* 行号单元格样式 */
figure[class*="highlight"] .gutter {
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: calc(var(--spacing-4) * 0.8) var(--spacing-3);
  text-align: right;
  user-select: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
  min-width: 3em;
  width: auto;
}

/* 代码单元格样式 */
figure[class*="highlight"] .code {
  padding: calc(var(--spacing-4) * 0.8) var(--spacing-3);
  background-color: var(--bg-code);
  width: 100%;
}

/* 代码内容样式 */
figure[class*="highlight"] pre {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  transition: none;
  font-family: inherit;
  position: static;
  transform: none;
  max-height: none;
  overflow: visible;
  opacity: 1;
  visibility: visible;
  height: auto;
}

/* 代码行样式 */
figure[class*="highlight"] pre .line {
  display: block;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* 代码块pre和code标签样式 */
figure[class*="highlight"] pre,
figure[class*="highlight"] code {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  display: block;
}

/* 确保代码内容正常换行 */
figure[class*="highlight"] .code {
  overflow-x: auto;
}

figure[class*="highlight"] .code pre {
  overflow: visible;
}

figure[class*="highlight"] .code code {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* 常规pre标签样式 */
pre {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin: var(--spacing-5) 0;
  box-shadow: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Consolas', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  position: relative;
  transform: translateY(0);
  max-height: 500px;
  overflow-x: auto; /* 仅允许水平滚动在容器级别 */
  opacity: 1;
  visibility: visible;
  height: auto;
  padding: calc(var(--spacing-4) * 0.8);
}

/* 代码块悬停效果 */
pre:hover {
  box-shadow: none;
  transform: translateY(0); /* 移除上移效果，保持稳定 */
  /* 移除悬停时的边框颜色变化 */
}

/* 代码块复制成功状态 */
pre.copied {
  /* 移除代码块边框颜色变化 */
}

/* 代码块顶部控制栏 */
pre .code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(var(--spacing-2) * 0.6) calc(var(--spacing-4) * 0.6); /* 调整为原来的3/5 */
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-bottom: 1px solid var(--border-color);
  font-size: var(--font-size-xs);
  min-height: calc(2.25rem * 0.6); /* 调整为原来的3/5 */
  flex-shrink: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  position: sticky; /* 固定在顶部 */
  top: 0;
  z-index: 10; /* 确保在内容之上 */
  width: 100%;
  box-sizing: border-box;
}

/* 语言标签样式 */
pre .language-label {
  color: var(--text-secondary);
  font-weight: 600;
  font-family: var(--font-family-sans);
  display: inline-block;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
}

/* 代码内容区域 - 使用Grid布局 */
pre .code-content {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0;
  overflow-x: auto;
  background-color: var(--bg-primary);
  overflow-y: auto; /* 仅在内容区域允许垂直滚动 */
  max-height: calc(500px - calc(2.25rem * 0.6)); /* 减去header高度 */
  /* 移除min-height，让代码块高度根据内容自动调整 */
}

/* 行号区域 - 确保足够宽度 */
pre .gutter {
  grid-column: 1;
  padding: calc(var(--spacing-4) * 0.8) calc(var(--spacing-3) * 0.8); /* 调整为原来的4/5 */
  color: var(--text-muted);
  background-color: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  text-align: right;
  user-select: none;
  font-size: 0.875rem;
  line-height: 1.5; /* 调大行间距，符合开发者习惯 */
  overflow: hidden;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(90deg, var(--bg-primary) 0%, rgba(241, 245, 249, 0.5) 100%);
  min-width: 3em; /* 确保行号区域有足够宽度 */
  width: auto;
  white-space: pre; /* 关键：保留换行符，使行号纵向排列 */
  align-self: stretch; /* 确保行号区域延伸到整个容器高度，包括横向滚动条下方 */
}

/* 代码区域容器 */
pre .code {
  grid-column: 2;
  background-color: var(--bg-primary);
  overflow-x: auto;
}

/* 代码样式 - pre标签 */
pre .code pre {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  font-family: inherit;
  overflow: visible;
  transform: none;
}

/* 代码样式 - code标签（新结构） */
pre .code code {
  display: block;
  background: transparent;
  border: none;
  padding: calc(var(--spacing-4) * 0.8) calc(var(--spacing-3) * 0.8); /* 调整为原来的4/5 */
  color: var(--text-primary);
  white-space: pre; /* 关键：保留空格和换行，不自动换行 */
  font-size: 0.875rem;
  line-height: 1.5; /* 调大行间距，符合开发者习惯 */
  letter-spacing: 0.02em;
  overflow: visible;
  font-family: 'Consolas', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  transition: color 0.3s ease;
}

/* 确保 highlight.js 样式生效 */
pre .code code.hljs {
  background: transparent;
  padding: calc(var(--spacing-4) * 0.8) calc(var(--spacing-3) * 0.8); /* 调整为原来的4/5 */
  font-family: 'Consolas', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  color: inherit;
  display: block;
  overflow-x: visible;
  transition: color 0.3s ease;
  line-height: 1.5; /* 调大行间距，符合开发者习惯 */
}

/* 兼容旧结构 */
pre .code pre code {
  display: block;
  background: transparent;
  border: none;
  padding: calc(var(--spacing-4) * 0.8) calc(var(--spacing-3) * 0.8); /* 调整为原来的4/5 */
  color: var(--text-primary);
  white-space: pre;
  font-size: 0.875rem;
  line-height: 1.5; /* 调大行间距，符合开发者习惯 */
  letter-spacing: 0.02em;
  overflow: visible;
  font-family: 'Consolas', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  transition: color 0.3s ease;
}

pre .code pre code.hljs {
  background: transparent;
  padding: calc(var(--spacing-4) * 0.8) calc(var(--spacing-3) * 0.8); /* 调整为原来的4/5 */
  font-family: 'Consolas', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  color: inherit;
  display: block;
  overflow-x: visible;
  transition: color 0.3s ease;
  line-height: 1.5; /* 调大行间距，符合开发者习惯 */
}

/* 代码内容区域，禁止换行 */
pre .code-content .code {
  white-space: pre; /* 关键：保留空格和换行，不自动换行 */
  min-width: 0; /* 关键：允许内容区域收缩，以便滚动条正常工作 */
}

/* 确保代码块容器有正确的宽度和溢出处理 */
figure[class*="highlight"],
pre[class*="language-"] {
  width: 100%; /* 确保代码块宽度适应父容器 */
  overflow-x: auto; /* 关键：长代码行时显示水平滚动条 */
  margin: 1em 0;
  padding: 0; /* 由内部元素控制内边距 */
}

/* 代码复制按钮 - 固定在顶部控制栏 */
pre .copy-btn {
  position: static;
  background-color: transparent;
  border: none; /* 移除边框 */
  border-radius: var(--radius-md);
  padding: var(--spacing-1) var(--spacing-2);
  font-size: 0.7rem;
  cursor: pointer;
  opacity: 1;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-secondary);
  box-shadow: none;
  font-family: var(--font-family-sans);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: calc(1.875rem * 0.8); /* 调整为原来的4/5 */
  min-height: calc(1.875rem * 0.8); /* 调整为原来的4/5 */
  gap: 0.25rem;
}

/* 复制按钮悬停效果 */
pre .copy-btn:hover {
  background-color: var(--bg-secondary);
  color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: var(--shadow-light);
}

/* 复制按钮点击状态 */
pre .copy-btn.copied {
  background-color: var(--bg-secondary);
  color: var(--primary-color);
  transform: scale(0.95);
  transition: all 0.1s ease;
  border: 1px solid var(--border-color); /* 添加原来的边框颜色 */
}

/* 复制按钮图标 */
pre .copy-btn i {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

/* 复制按钮悬停时图标效果 */
pre .copy-btn:hover i {
  transform: scale(1.1);
}

/* 代码块滚动条样式 */
pre .code-content::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

pre .code-content::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

pre .code-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
  transition: background 0.3s ease;
}

pre .code-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* 确保pre容器没有多余的滚动条 */
pre::-webkit-scrollbar {
  display: none;
}

/* Firefox滚动条样式 */
pre .code-content {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) var(--bg-secondary);
}

/* 响应式设计 */
@media (max-width: 768px) {
  /* 减小移动端代码块的内边距 */
  pre {
    margin: var(--spacing-4) 0;
    border-radius: var(--radius-md);
  }
  
  /* 减小顶部控制栏的内边距 */
  pre .code-header {
    padding: var(--spacing-1) var(--spacing-3);
    min-height: 2rem;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }
  
  /* 减小语言标签字体大小 */
  pre .language-label {
    font-size: 0.65rem;
    letter-spacing: 0.05em;
  }
  
  /* 减小复制按钮尺寸 */
  pre .copy-btn {
    min-width: 1.75rem;
    min-height: 1.75rem;
    padding: var(--spacing-1) var(--spacing-2);
    font-size: 0.65rem;
  }
  
  /* 调整代码和行号的内边距，保持字体大小与桌面端一致 */
  pre .gutter {
    padding: var(--spacing-3) var(--spacing-2);
    font-size: 0.875rem;
    line-height: 1.5;
  }
  
  /* 修复移动端代码行号和内容对不上的问题 - 统一新旧结构的样式 */
  pre .code code,
  pre .code pre code {
    padding: var(--spacing-3) var(--spacing-2);
    font-size: 0.875rem;
    line-height: 1.5;
  }
  
  pre .code pre code.hljs {
    padding: var(--spacing-3) var(--spacing-2);
    font-size: 0.875rem;
    line-height: 1.5;
  }
}

@media (max-width: 480px) {
  /* 进一步减小小屏幕设备上的代码块样式 */
  pre {
    margin: var(--spacing-3) 0;
  }
  
  /* 减小顶部控制栏的高度 */
  pre .code-header {
    min-height: 1.875rem;
  }
  
  /* 进一步减小代码和行号的内边距 */
  pre .gutter {
    padding: var(--spacing-2) var(--spacing-2);
  }
  
  pre .code pre code {
    padding: var(--spacing-2) var(--spacing-2);
  }
  
  pre .code pre code.hljs {
    padding: var(--spacing-2) var(--spacing-2);
  }
}

/* 修复移动端滚动条样式 */
@media (max-width: 768px) {
  pre .code-content::-webkit-scrollbar {
    height: 6px;
  }
  
  pre .code-content::-webkit-scrollbar-thumb {
    border-radius: 3px;
  }
}

/* 确保代码块在黑暗模式下有良好表现 */
@media (prefers-color-scheme: dark) {
  pre {
    background-color: #1e293b;
    border-color: #334155;
  }
  
  pre .code-header {
    background-color: #0f172a;
    border-bottom-color: #334155;
  }
  
  pre .language-label {
    color: #94a3b8;
  }
  
  pre .gutter {
    background-color: #1e293b;
    border-right-color: #334155;
    color: #64748b;
  }
  
  pre .code {
    background-color: #1e293b;
  }
  
  pre .code pre code {
    color: #e2e8f0;
  }
  
  pre .copy-btn {
    color: #94a3b8;
  }
}

/* 数学公式样式 */
.katex-display {
  margin: var(--spacing-5) 0;
}

.mathjax-equation {
  margin: var(--spacing-5) 0;
  text-align: center;
}

/* 分页样式 */
.pagination {
  margin-top: var(--spacing-8);
  margin-bottom: var(--spacing-12);
  display: flex;
  justify-content: center;
  width: 100%;
}

.pagination-container {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-1) var(--spacing-2);
  box-shadow: var(--shadow-light);
  transition: all var(--transition-fast);
}

.pagination-container:hover {
  box-shadow: var(--shadow-medium);
}

.prev-page, .next-page {
  display: flex;
  align-items: center;
  gap: var(--spacing-1);
  padding: var(--spacing-3) var(--spacing-5);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
  font-weight: 500;
  font-size: var(--font-size-sm);
  border: 1px solid transparent;
  background-color: transparent;
}

.prev-page:hover, .next-page:hover {
  background-color: var(--bg-secondary);
  color: var(--primary-color);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-light);
}

.prev-page:active, .next-page:active {
  transform: translateY(0);
  box-shadow: none;
}

.page-number {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-weight: 500;
  padding: 0 var(--spacing-4);
  user-select: none;
}

/* 暗黑模式下的分页样式 */
.dark .pagination-container {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
  box-shadow: var(--shadow-light);
}

.dark .pagination-container:hover {
  box-shadow: var(--shadow-medium);
}

.dark .prev-page:hover, .dark .next-page:hover {
  background-color: var(--bg-tertiary);
  color: var(--primary-color);
}

/* 归档页面 */
.archive {
  background-color: var(--bg-primary);
}

.archive-header {
  margin-bottom: var(--spacing-8);
}

/* 归档时间轴布局 */
.archive-timeline {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-8);
}

/* 年份分组 */
.archive-year-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-6);
}

.archive-year {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  margin: 0;
  padding-bottom: var(--spacing-2);
  border-bottom: 2px solid var(--bg-tertiary);
  color: var(--text-primary);
}

/* 月份分组 */
.archive-month-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-4);
}

.archive-month {
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
  padding-left: var(--spacing-2);
}

/* 月份文章列表 */
.archive-month-posts {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-3);
  padding-left: var(--spacing-4);
}

/* 文章列表 */
.archive-posts {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-4);
}

.archive-post-item {
  display: flex;
  gap: var(--spacing-6);
  padding: var(--spacing-3) 0;
  border-bottom: 1px solid var(--bg-tertiary);
  transition: all var(--transition-fast);
}

.archive-post-item:hover {
  padding-left: var(--spacing-2);
}

.archive-post-time {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  width: 80px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  font-weight: 500;
}

.archive-post-title {
  flex: 1;
  display: flex;
  align-items: center;
}

.archive-post-link {
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
  font-size: var(--font-size-base);
  font-weight: 500;
}

.archive-post-link:hover {
  color: var(--primary-color);
  text-decoration: none;
}

.archive-post-link:hover {
  color: var(--primary-color);
  text-decoration: none;
}

/* 分类、标签和归档页面 */
.categories, .tags, .category, .tag, .archive {
  background-color: var(--bg-primary);
  font-family: var(--font-family-serif); /* 使用与文章标题相同的字体 */
}

.categories-header, .tags-header, .category-header, .tag-header {
  margin-bottom: var(--spacing-8);
}

/* 分类列表 - 卡片设计 */
.categories-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-5);
}

.category-item {
  background-color: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: var(--spacing-5);
  transition: all var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
}

.category-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  border-color: var(--primary-color);
  padding-left: var(--spacing-5);
}

.category-item .category-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-primary);
  text-decoration: none;
  font-size: var(--font-size-lg);
  font-weight: 500;
  transition: all var(--transition-fast);
  width: 100%;
}

.category-item .category-link:hover {
  text-decoration: none;
  color: var(--primary-color);
}

.category-count {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0;
  border-radius: 0;
}

/* 单个分类页面保持原样 */
.category .category-item {
  background-color: var(--bg-primary);
  border: none;
  border-bottom: 1px solid var(--bg-tertiary);
  border-radius: 0;
  padding: var(--spacing-5) 0;
  transition: all var(--transition-fast);
  box-shadow: none;
}

.category .category-item:hover {
  box-shadow: none;
  transform: translateY(0);
  border-color: var(--bg-tertiary);
  padding-left: var(--spacing-2);
}

.category-count {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
}

/* 分类卡片链接 - 包裹整个卡片 */
.category-item-link {
  display: block;
  text-decoration: none;
  color: inherit;
  width: 100%;
  height: 100%;
}

/* 分类内容容器 */
.category-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-primary);
  font-size: var(--font-size-lg);
  font-weight: 500;
  transition: all var(--transition-fast);
  width: 100%;
}

/* 分类名称和计数样式 */
.category-name {
  color: var(--text-primary);
  transition: color var(--transition-fast);
}

.category-item-link:hover .category-content .category-name {
  color: var(--primary-color);
}

.category-item-link:hover .category-content .category-count {
  color: var(--primary-color);
}

/* 标签云样式 */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-3);
  justify-content: flex-start;
  align-items: center;
  padding: var(--spacing-6) 0;
}

.tag-cloud-item {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-1);
  padding: var(--spacing-2) var(--spacing-4);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-light);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.tag-cloud-item:hover {
  background-color: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
  box-shadow: var(--shadow-medium);
  text-decoration: none;
  transform: translateY(-1px);
}

.tag-count {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  font-weight: 600;
  opacity: 1;
}

/* 确保标签云项目hover时计数器颜色也变白 */
.tag-cloud-item:hover .tag-count {
  color: #ffffff;
}

/* 页脚样式 */
.footer {
  padding: var(--spacing-6) 0;
  border-top: 1px solid var(--bg-tertiary);
  background-color: var(--bg-primary);
  margin-top: var(--spacing-8);
}

.footer-content {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  flex-direction: column;
  flex-wrap: wrap;
  gap: var(--spacing-3);
}

.footer-info {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  line-height: var(--line-height-normal);
}

.footer-info a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-info a:hover {
  color: var(--primary-color);
  text-decoration: none;
}

.social-links {
  display: flex;
  gap: var(--spacing-2);
  margin-top: var(--spacing-1);
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--spacing-8);
  height: var(--spacing-8);
  background-color: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  transition: all var(--transition-fast);
  text-decoration: none;
  box-shadow: none;
  font-size: var(--font-size-xs);
}

.social-link:hover {
  background-color: var(--primary-color);
  color: var(--bg-primary);
  border-color: var(--primary-color);
  box-shadow: none;
  text-decoration: none;
}

/* 回到顶部按钮 */
.back-to-top {
  position: fixed;
  bottom: var(--spacing-6);
  right: var(--spacing-6);
  width: var(--spacing-10);
  height: var(--spacing-10);
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 90;
  font-size: var(--font-size-sm);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background-color: var(--primary-color);
  color: #ffffff;
  transform: translateY(0);
  box-shadow: none;
}

.back-to-top:focus {
  outline: 1px solid var(--primary-color);
  outline-offset: 1px;
}

/* 阅读进度条 */
.reading-progress {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background-color: var(--primary-color);
  z-index: 1000;
  transition: width 0.1s ease-out;
}

/* 评论区样式 */
.post-comments {
  margin-top: var(--spacing-10);
  padding-top: var(--spacing-6);
  border-top: 1px solid var(--border-color);
}

.comments-section {
  width: 100%;
}

.comments-title {
  font-size: var(--font-size-xl);
  margin-bottom: var(--spacing-6);
  color: var(--text-primary);
  font-weight: 600;
}

#gitalk-container,
#vcomments,
#waline,
#artalk-main,
#twikoo {
  margin-top: var(--spacing-4);
  width: 100%;
}

/* 确保评论区在移动端正常显示 */
@media (max-width: 768px) {
  .post-comments {
    margin-top: var(--spacing-8);
    padding-top: var(--spacing-4);
  }
  
  .comments-title {
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-4);
  }
}

/* 引用样式 */
blockquote {
  margin: var(--spacing-5) 0;
  padding: var(--spacing-4) var(--spacing-5);
  border-left: 3px solid var(--primary-color);
  background-color: #f0f7ff;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-primary);
  font-style: normal;
  line-height: var(--line-height-relaxed);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all var(--transition-normal);
}

blockquote p {
  margin: 0;
}

.post-content blockquote p {
  margin-bottom: 0;
}

blockquote blockquote {
  margin: var(--spacing-4) 0;
  padding-left: var(--spacing-4);
  background-color: #e6f2ff;
  box-shadow: none;
}

/* 框框样式 */
.box-container {
  margin: var(--spacing-5) 0;
  padding: var(--spacing-4);
  border-radius: var(--radius-md);
  border: 1.2px solid;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.box-container .box-header {
  display: flex;
  align-items: center;
  margin-bottom: var(--spacing-2);
}

.box-container .box-icon {
  display: inline-block;
  margin-right: var(--spacing-2);
  font-size: 1.25rem;
  vertical-align: middle;
}

.box-container .box-title {
  display: inline-block;
  font-weight: 600;
  font-size: 0.91rem;
  vertical-align: middle;
}

.box-container .box-content {
  margin-top: var(--spacing-2);
  line-height: var(--line-height-relaxed);
  font-size: 0.86rem;
}

.box-container .box-content p {
  margin-bottom: 0;
}

/* 信息框 - 蓝色系 */
.box-info {
  background-color: #f0f7ff;
  border-color: #3b82f6;
  color: #1e40af;
}

.box-info .box-icon {
  color: #3b82f6;
}

.box-info .box-title {
  color: #1e40af;
}

/* 提示框 - 黄色系 */
.box-note {
  background-color: #fef9c3;
  border-color: #fbbf24;
  color: #92400e;
}

.box-note .box-icon {
  color: #fbbf24;
}

.box-note .box-title {
  color: #92400e;
}

/* 警告框 - 橙色系 */
.box-warning {
  background-color: #fff7ed;
  border-color: #f97316;
  color: #9a3412;
}

.box-warning .box-icon {
  color: #f97316;
}

.box-warning .box-title {
  color: #9a3412;
}

/* 错误框 - 红色系 */
.box-error {
  background-color: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

.box-error .box-icon {
  color: #ef4444;
}

.box-error .box-title {
  color: #991b1b;
}

/* 成功框 - 绿色系 */
.box-success {
  background-color: #dcfce7;
  border-color: #22c55e;
  color: #15803d;
}

.box-success .box-icon {
  color: #22c55e;
}

.box-success .box-title {
  color: #15803d;
}

/* 分割线样式 */
hr {
  margin: var(--spacing-6) 0;
  height: 1px;
  background-color: var(--border-color);
  border: none;
}

/* 定义列表样式 */
dl {
  margin: var(--spacing-4) 0;
}

dt {
  margin-top: var(--spacing-3);
  font-weight: 600;
  color: var(--text-primary);
}

dd {
  margin: var(--spacing-1) 0 var(--spacing-2) var(--spacing-4);
  color: var(--text-primary);
  line-height: var(--line-height-normal);
}

dd + dt {
  margin-top: var(--spacing-3);
}

/* 表格样式 */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--spacing-4) 0;
  font-size: var(--font-size-base);
  background-color: var(--bg-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

table th, table td {
  padding: var(--spacing-2) var(--spacing-3);
  text-align: center;
  border: 1px solid var(--border-color);
  vertical-align: middle;
}

table th {
  background-color: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  border-bottom: 2px solid var(--primary-color);
}

table tr:last-child td {
  border-bottom: 1px solid var(--border-color);
}

table tr:hover {
  background-color: var(--bg-secondary);
  transition: background-color var(--transition-fast);
}

table td {
  color: var(--text-primary);
}

/* 合并单元格样式 */
table td[rowspan], table td[colspan] {
  background-color: var(--bg-secondary);
  font-weight: 500;
  text-align: center;
  vertical-align: middle;
}

table th[rowspan], table th[colspan] {
  background-color: var(--bg-secondary);
  border-bottom: 2px solid var(--primary-color);
  font-weight: 600;
  text-align: center;
  vertical-align: middle;
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .post-content-container {
    grid-template-columns: 1fr;
    gap: var(--spacing-8);
  }
  
  .toc-container {
    position: static;
    max-height: none;
  }
  
  /* 确保TOC标题和伸缩按钮正常显示 */
  .toc-header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-2);
    padding-bottom: var(--spacing-2);
    border-bottom: 1px solid var(--border-color);
  }
  
  .toc-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
  }
  
  .toc-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
  }
}

@media (max-width: 576px) {
  .container {
    padding: 0 var(--spacing-4);
  }
  
  .header-content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-3);
  }
  
  /* 导航菜单样式继承自 @media (max-width: 768px)，无需重复定义 */
  
  .post-title {
    font-size: var(--font-size-3xl);
  }
  
  .post-meta {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-2);
  }
  
  .categories-list {
    grid-template-columns: 1fr;
  }
  
  .footer-content {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-4);
  }
  
  .social-links {
    width: 100%;
    justify-content: flex-start;
  }
  
  /* 移动端TOC样式优化 */
  .toc-container {
    position: fixed;
    top: 120px; /* 确保在header下方，不重叠 */
    right: 20px;
    width: 240px;
    max-height: 300px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    padding: var(--spacing-3);
    z-index: 1000;
    margin-left: 0;
    border-left: none;
    margin-top: 0;
  }
  
  /* 确保移动端TOC标题和伸缩按钮正常显示 */
  .toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-2);
    padding-bottom: var(--spacing-2);
    border-bottom: 1px solid var(--border-color);
  }
  
  .toc-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
  }
  
  .toc-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
  }
  
  .toc-toggle:hover {
    color: var(--primary-color);
    background-color: var(--bg-secondary);
  }
  
  .toc-nav {
    max-height: 260px;
    overflow-y: auto;
  }
}

@media (max-width: 480px) {
  .site-title {
    font-size: var(--font-size-xl);
  }
  
  .post-title {
    font-size: var(--font-size-2xl);
  }
  
  .post-content {
    font-size: var(--font-size-base);
  }
  
  .archive-post-item {
    flex-direction: column;
    gap: var(--spacing-1);
    align-items: flex-start;
  }
  
  .archive-post-time {
    width: auto;
  }
  
  /* 小屏移动端TOC优化 */
  .toc-container {
    width: 220px;
    top: 120px; /* 确保在header下方，不重叠 */
    right: 10px;
    padding: var(--spacing-2);
    position: fixed;
  }
  
  /* 确保小屏移动端TOC标题和伸缩按钮正常显示 */
  .toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-2);
    padding-bottom: var(--spacing-2);
    border-bottom: 1px solid var(--border-color);
  }
  
  .toc-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
  }
  
  .toc-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
  }
  
  .toc-toggle:hover {
    color: var(--primary-color);
    background-color: var(--bg-secondary);
  }
  
  .toc-nav {
    max-height: 220px;
  }
}

/* 页面浮动进入动画 */
@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 为所有页面添加浮动进入动画 */
body > div {
  animation: pageFadeIn 0.3s ease-out;
}

/* 搜索功能样式 */
.search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  border: 1px solid transparent; /* 添加透明边框，避免悬停时尺寸变化 */
  border-radius: var(--radius-md);
  padding: calc(var(--spacing-2) - 1px); /* 微调内边距，适配1px透明边框 */
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: auto;
  text-decoration: none;
  color: inherit;
  height: 100%; /* 确保高度一致 */
  font-size: var(--font-size-base); /* 确保字体大小一致 */
  margin: 0; /* 移除所有margin */
}

.search-btn:hover {
  background-color: var(--bg-secondary);
  box-shadow: var(--shadow-light);
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border-color); /* 窄窄的灰色边框 */
}

.search-btn i,
.theme-toggle-btn i {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  display: block;
  line-height: 1;
}

.search-btn:hover i,
.theme-toggle-btn:hover i {
  color: var(--primary-color);
}

/* 搜索容器 */
.search-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(var(--bg-primary-rgb), 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  padding-top: 100px;
}

.search-container.active {
  opacity: 1;
  visibility: visible;
}

/* 搜索框 */
.search-box {
  width: 100%;
  max-width: 700px;
  position: relative;
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-heavy);
  overflow: hidden;
  display: flex;
  align-items: center;
}

.search-box input {
  width: 100%;
  padding: var(--spacing-5) var(--spacing-6);
  border: none;
  outline: none;
  font-size: var(--font-size-lg);
  font-family: var(--font-family-sans);
  color: var(--text-primary);
  background-color: transparent;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-5);
  border: none;
  background-color: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.search-submit:hover {
  color: var(--primary-color);
}

.search-close {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-5);
  border: none;
  background-color: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.search-close:hover {
  color: var(--accent-color);
  background-color: var(--bg-secondary);
}

/* 搜索结果 */
.search-results {
  width: 100%;
  max-width: 700px;
  margin-top: var(--spacing-4);
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-heavy);
  overflow: hidden;
  max-height: 500px;
  overflow-y: auto;
}

.search-result-item {
  padding: var(--spacing-5);
  border-bottom: 1px solid var(--border-color);
  transition: background-color var(--transition-fast);
}

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

.search-result-item:hover {
  background-color: var(--bg-secondary);
}

.search-result-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--spacing-2);
  color: var(--text-primary);
}

.search-result-title a {
  color: var(--text-primary);
  text-decoration: none;
}

.search-result-title a:hover {
  color: var(--primary-color);
  text-decoration: none;
}

.search-result-excerpt {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
}

/* 高亮匹配文本 */
mark {
  background-color: #fef3c7;
  color: var(--text-primary);
  padding: 0.125rem 0.25rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

/* 暗黑模式下的高亮文本 */
.dark mark {
  color: #111827;
}

/* 搜索结果加载状态 */
.search-loading {
  padding: var(--spacing-8);
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--font-size-lg);
}

/* 搜索结果为空状态 */
.search-results:empty {
  display: none;
}

/* 响应式搜索样式 */
@media (max-width: 768px) {
  .search-container {
    padding: 0 var(--spacing-4);
    padding-top: 80px;
  }
  
  .search-box input {
    font-size: var(--font-size-base);
    padding: var(--spacing-4) var(--spacing-5);
  }
  
  .search-results {
    max-height: 400px;
  }
  
  .search-result-item {
    padding: var(--spacing-4);
  }
  
  .search-result-title {
    font-size: var(--font-size-base);
  }
  
  .search-result-excerpt {
    font-size: var(--font-size-sm);
  }
}
