/* ===================================================================
   core.css — 全局设计系统 + 全部可复用组件
   已整合 404/500 错误页面样式（冗余已清理）
   =================================================================== */

/* ---------- 设计令牌 ---------- */
:root {
  --primary-color: #2563eb;
  --secondary-color: #1e40af;
  --accent-color: #3b82f6;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;

  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;

  --bg-primary: #fcfbf8;
  --bg-secondary: #f8f6f2;
  --bg-tertiary: #f5f3ef;
  --bg-card: #ffffff;

  --border-color: #d1d5db;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --transition-fast: 0.15s ease;
  --transition: 0.3s ease;

  --font-family: 'Inter', 'Helvetica Neue', Arial, 'Microsoft YaHei', sans-serif;
  --font-mono: 'Fira Code', 'Courier New', monospace;
  --font-size-base: 1rem;
  --line-height-base: 1.6;

  --content-max-width: 800px;
  --container-max-width: 1200px;

  --card-bg: #ffffff;
  --card-hover-bg: #f8f6f2;
  --tag-bg: #f1f5f9;
  --primary-color-light: rgba(37, 99, 235, 0.1);
  --primary-rgb: 37, 99, 235;

  /* ---- z-index 语义变量（方案 A：具名不改值，2026-10-21） ---- */
  --z-nav: 100;
  --z-sidebar: 100;
  --z-tooltip: 100;
  --z-drawer-overlay: 999;
  --z-drawer: 1000;
  --z-drawer-toggle: 1002;
  --z-modal: 2000;
  --z-toast-bottom: 2100;
  --z-dropdown: 9999;
  --z-overlay: 9999;
  --z-toast-top: 9999;
  --z-notification: 10000;
  --z-share-panel: 10000;
  --z-qr-modal: 10001;
}

/* 暗色主题 */
body.dark-theme {
  --primary-color: #3b82f6;
  --secondary-color: #60a5fa;
  --accent-color: #93c5fd;
  --text-primary: #f3f4f6;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --bg-primary: #2a2c35;
  --bg-secondary: #252730;
  --bg-tertiary: #212229;
  --bg-card: #2a2c35;
  --border-color: #4a4c57;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 8px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.6);
}
body.dark-theme header {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-tertiary));
}

/* ---------- 重置 ---------- */
*,
*::before,
*::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--text-primary);
  background: var(--bg-primary);
  background-image: url("../images/background_desktop.89e24e8a4054.webp");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  min-height: 100vh;
  padding: 20px;
}

@media (max-width: 768px) {
  body {
    background-image: url("../images/background_mobile.7160ac688acc.webp");
    background-attachment: scroll;
  }
}

img { max-width: 100%; height: auto; display: block; }

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

/* ---------- 排版 ---------- */
h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; margin-bottom: 0.5em; color: var(--text-primary); }
h1 { font-size: 2.5rem; } h2 { font-size: 2rem; } h3 { font-size: 1.5rem; } h4 { font-size: 1.25rem; }
p { margin-bottom: 1rem; }

/* ---------- 通用按钮（增强版，整合 404 样式）---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.85rem 1.75rem; border: none; border-radius: 12px;
  font-size: 1rem; font-weight: 500; cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none; font-family: inherit; min-width: 140px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), #667eea);
  color: white; box-shadow: 0 4px 15px rgba(74,108,247,0.2);
}
.btn-primary:hover {
  transform: translateY(-3px); box-shadow: 0 8px 25px rgba(74,108,247,0.3);
}
.btn-secondary {
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border-color); box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.btn-secondary:hover {
  background: var(--bg-secondary); border-color: var(--primary-color);
  transform: translateY(-3px); box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; min-width: auto; }
.btn-icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg);
  padding: 1.5rem; box-shadow: var(--shadow-sm); transition: all var(--transition);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary-color); }

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex; align-items: center; background: var(--bg-secondary); color: var(--text-secondary);
  padding: 0.2rem 0.8rem; border-radius: var(--radius-full); font-size: 0.8rem; font-weight: 500;
  transition: all var(--transition-fast); text-decoration: none;
}
.tag:hover { background: var(--primary-color); color: white; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; }

/* ---------- 元信息 ---------- */
.meta { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.9rem; color: var(--text-secondary); }
.meta-item {
  display: inline-flex; align-items: center; gap: 0.3rem; background: var(--bg-secondary);
  padding: 0.2rem 0.7rem; border-radius: var(--radius-full); font-size: 0.85rem;
}

/* ---------- 文章内容 ---------- */
.article-content {
  max-width: var(--content-max-width); margin: 0 auto; line-height: 1.8; font-size: 1.05rem;
}
.article-content h2 { margin: 2.5rem 0 1.2rem; padding-left: 0.8rem; border-left: 4px solid var(--primary-color); color: var(--text-primary); font-weight: 700; }
.article-content h3 { margin: 2rem 0 1rem; color: var(--secondary-color); font-weight: 600; }
.article-content p { margin-bottom: 1.5rem; line-height: 1.8; text-align: justify; color: var(--text-primary); }
.article-content section p { text-indent: 0 !important; margin-bottom: 0 !important; }
.article-content blockquote {
  border-left: 4px solid var(--primary-color); padding: 1rem 1.5rem; margin: 1.5rem 0;
  background: var(--bg-secondary); border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic; color: var(--text-secondary);
}
.article-content ul, .article-content ol { margin: 1.5rem 0; padding-left: 2rem; }
.article-content li { margin-bottom: 0.5rem; }
.article-content code { background: var(--bg-secondary); padding: 0.15rem 0.4rem; border-radius: 4px; font-family: var(--font-mono); font-size: 0.9em; }
.article-content pre { background: #2d3748; color: #e2e8f0; padding: 1.5rem; border-radius: var(--radius-md); overflow-x: auto; margin: 1.5rem 0; }
.article-content pre code { background: none; padding: 0; color: inherit; }
.article-content table { width: 100%; border-collapse: collapse; margin: 2rem 0; }
.article-content .highlight-box {
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary)); padding: 2rem;
  border-radius: var(--radius-md); border-left: 4px solid var(--primary-color); margin: 2rem 0;
}
.article-content .footnotes { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border-color); font-size: 0.9rem; }

/* 文章内图片 */
.article-content img {
  max-width: 100%; height: auto; display: block; margin: 1.5rem auto;
  border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
}
@media (max-width: 768px) {
  .article-content img { margin: 1rem auto; }
}

/* 特殊图片保护 */
.profile-avatar, .qrcode-img, .modal-qrcode-item img { max-width: none; margin: initial; border-radius: initial; box-shadow: initial; }
.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--bg-primary);
    box-shadow: var(--shadow-sm);
    display: block;
    margin: 0 auto;
}
.qrcode-img, .modal-qrcode-item img { width: 100% !important; max-width: 180px !important; height: auto !important; border-radius: var(--radius-md) !important; box-shadow: var(--shadow-sm) !important; margin: 0 auto !important; }

/* ---------- PWA 安装按钮 ---------- */
.pwa-install-btn {
  background: linear-gradient(135deg, #4f46e5, #7c3aed); color: white; border: none;
  border-radius: var(--radius-md); padding: 0.6rem 1.2rem; font-size: 0.9rem; cursor: pointer; transition: all var(--transition);
}
.pwa-install-btn:hover { background: linear-gradient(135deg, #4338ca, #6d28d9); transform: translateY(-2px); }

/* ---------- 图标尺寸 ---------- */
.icon { display: inline-flex; align-items: center; justify-content: center; width: 1em; height: 1em; fill: currentColor; }
.icon-sm { width: 0.875em; height: 0.875em; }
.icon-lg { width: 1.25em; height: 1.25em; }
.icon-xl { width: 1.5em; height: 1.5em; }

/* ---------- 安装图标和提示 ---------- */
.install-icon { position: relative; cursor: pointer; transition: all 0.3s ease; }
.install-icon:hover { transform: scale(1.1); color: #4f46e5; }
.install-badge {
  position: absolute; top: -5px; right: -5px; background: #ff6b6b; color: white;
  font-size: 10px; width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; animation: pulse 2s infinite;
}
.install-icon.installed { color: #10b981; }
.install-icon.installed:hover { color: #059669; }

/* ---------- nav-link 悬浮提示 ---------- */
.nav-link[data-tip] { position: relative; }
.nav-link[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: -32px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.8); color: white; padding: 4px 10px; border-radius: 6px;
  font-size: 0.7rem; white-space: nowrap; z-index: var(--z-tooltip); pointer-events: none; font-family: inherit;
}
@media (max-width: 768px) {
  .nav-link[data-tip]:hover::after { display: none; }
}

/* ---------- 加载动画 ---------- */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(255,255,255,0.95);
  display: flex; align-items: center; justify-content: center; z-index: var(--z-overlay);
  transition: opacity 0.3s ease;
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 40px; height: 40px; border: 4px solid var(--bg-tertiary);
  border-top: 4px solid var(--primary-color); border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ---------- 应用更新通知 ---------- */
.update-notification {
  position: fixed; bottom: 20px; right: 20px; background: #4f46e5; color: white;
  padding: 15px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: var(--z-notification); animation: slideIn 0.3s ease;
}
.update-content p { margin: 0 0 10px 0; font-weight: 500; }
.update-actions { display: flex; gap: 10px; }
.update-btn {
  background: white; color: #4f46e5; border: none; padding: 6px 12px;
  border-radius: 4px; cursor: pointer; font-weight: 500;
}
.update-btn.secondary { background: transparent; color: white; border: 1px solid rgba(255,255,255,0.3); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---------- 动画集 ---------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}
@keyframes calendarFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ---------- 无障碍偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  .error-image-container,
  .error-content,
  .error-content .btn {
    animation: none;
    transition: none;
  }
  .error-image-container::after { display: none; }
}
@media (prefers-contrast: high) {
  .error-content { border: 2px solid currentColor; }
  .btn-secondary { border: 2px solid currentColor; }
  .image-background { background: white; border: 1px solid currentColor; }
}

/* ---------- 归档页面 ---------- */
.archive-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
}

.archive-year-month {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.archive-year-month:last-child {
  border-bottom: none;
}

.archive-year-month h3 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.5rem;
  font-weight: 600;
  padding-left: 0.5rem;
  border-left: 4px solid var(--primary-color);
}

.archive-post {
  display: flex;
  align-items: center;
  margin-bottom: 0.8rem;
  padding: 0.8rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  background-color: var(--bg-card);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.archive-post:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  background-color: var(--bg-secondary);
}

.archive-date {
  min-width: 100px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

.archive-title {
  flex: 1;
  margin: 0 1rem;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.archive-title:hover {
  color: var(--primary-color);
}

.archive-category {
  min-width: 80px;
  text-align: right;
  color: var(--text-secondary);
  font-size: 0.85rem;
  background: var(--bg-secondary);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-weight: 500;
}

/* 归档页响应式 */
@media (max-width: 768px) {
  .archive-post {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 1rem;
  }
  .archive-date,
  .archive-category {
    min-width: auto;
  }
  .archive-title {
    margin: 0;
    order: -1;
    font-size: 1.1rem;
  }
  .archive-category {
    align-self: flex-end;
  }
}

@media (max-width: 480px) {
  .archive-container {
    padding: 0.5rem;
  }
  .archive-year-month h3 {
    font-size: 1.3rem;
  }
}

/* ---------- 紧凑分页控件（归档页用） ---------- */
.pagination-container.compact {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.pagination-info-small {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.pagination-controls-small {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pagination-btn-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.pagination-btn-small:hover:not(.disabled) {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.pagination-btn-small.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-pages-small {
  display: flex;
  gap: 0.25rem;
}

.pagination-page-small {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.5rem;
  background: var(--bg-card);
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.pagination-page-small:hover {
  background: var(--bg-secondary);
}

.pagination-page-small.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

@media (max-width: 480px) {
  .pagination-controls-small {
    flex-direction: column;
    gap: 0.5rem;
  }
  .pagination-pages-small {
    order: -1;
    margin-bottom: 0.5rem;
  }
}

/* ---------- 分类引导页 ---------- */
.category-guide.optimized-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.category-header-opt {
  margin-bottom: 2rem;
}

.page-title-compact {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin: 0 0 1.5rem 0;
  font-weight: 600;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border-color);
}

.title-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.title-text {
  color: var(--text-primary);
  font-weight: 600;
}

.title-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: normal;
  color: var(--text-secondary);
}

.meta-separator {
  color: var(--text-muted);
  font-weight: 300;
}

.section-header-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.section-header-opt h2 {
  font-size: 1.6rem;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.view-all-opt {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.view-all-opt:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

.hint-opt {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.articles-grid-opt {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.article-opt {
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  height: 100%;
}

.article-opt:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.article-link-opt {
  display: block;
  padding: 1.75rem;
  text-decoration: none;
  color: inherit;
  height: 100%;
  box-sizing: border-box;
}

.article-header-opt {
  margin-bottom: 1rem;
}

.article-header-opt h3 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
  font-weight: 600;
}

.article-date {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.article-tags-opt {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tag-opt {
  background: var(--tag-bg);
  color: var(--text-secondary);
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.article-excerpt-opt {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 1.5rem 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-footer-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.read-time-opt {
  color: var(--text-muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.read-more-opt {
  color: var(--primary-color);
  font-size: 0.9rem;
  font-weight: 500;
}

.secondary-section {
  margin-bottom: 3rem;
}

.tags-cloud-opt {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.8rem;
  justify-items: center;
  align-items: center;
}

.tag-cloud-item {
  min-width: 100px;
  max-width: 120px;
  min-height: 60px;
  width: 100%;
  background: var(--tag-bg);
  color: var(--text-secondary);
  padding: 0.5rem 0.75rem;
  border-radius: 16px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
  box-sizing: border-box;
  word-break: keep-all;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-cloud-item:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.tag-name {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.tag-count-opt {
  font-size: 0.7rem;
  opacity: 0.8;
  font-weight: 400;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.1rem 0.4rem;
  border-radius: 8px;
  margin-top: 0.1rem;
}

.tag-cloud-item.has-posts {
  background: var(--primary-color-light);
  color: var(--primary-color);
  font-weight: 600;
  border-color: var(--primary-color-light);
}

/* 分类页响应式 */
@media (max-width: 1024px) {
  .category-guide.optimized-layout {
    padding: 1.5rem 1rem;
  }

  .articles-grid-opt {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
  }

  .page-title-compact {
    font-size: 1.1rem;
  }

  .tags-cloud-opt {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.7rem;
  }

  .tag-cloud-item {
    min-width: 90px;
    max-width: 110px;
    font-size: 0.85rem;
  }
}

@media (max-width: 900px) {
  .tags-cloud-opt {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
  }

  .tag-cloud-item {
    min-width: 85px;
    max-width: 100px;
  }
}

@media (max-width: 768px) {
  .page-title-compact {
    font-size: 1rem;
    gap: 0.3rem;
    padding: 0.6rem 0;
    margin-bottom: 1.25rem;
  }

  .title-icon {
    font-size: 1rem;
  }

  .title-meta {
    gap: 0.3rem;
  }

  .section-header-opt {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .view-all-opt {
    align-self: flex-start;
  }

  .articles-grid-opt {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .article-opt {
    max-width: 500px;
    margin: 0 auto;
  }

  .tag-name {
    font-size: 0.85rem;
  }

  .tag-count-opt {
    font-size: 0.65rem;
  }
}

@media (max-width: 576px) {
  .tags-cloud-opt {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }

  .tag-cloud-item {
    min-width: 100px;
    max-width: 130px;
    font-size: 0.85rem;
    padding: 0.5rem 0.8rem;
  }

  .category-guide.optimized-layout {
    padding: 1rem;
  }

  .page-title-compact {
    font-size: 0.95rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
  }

  .title-icon {
    margin-bottom: 0.1rem;
  }

  .title-meta {
    margin-top: 0.2rem;
  }

  .section-header-opt h2 {
    font-size: 1.3rem;
  }

  .article-link-opt {
    padding: 1.25rem;
  }

  .article-header-opt h3 {
    font-size: 1.1rem;
  }
}

@media (max-width: 380px) {
  .tags-cloud-opt {
    grid-template-columns: repeat(1, 1fr);
    gap: 0.5rem;
  }

  .tag-cloud-item {
    min-width: 120px;
    max-width: 160px;
    font-size: 0.85rem;
  }
}

/* ---------- 分类按月归档页 ---------- */
.category-archive-container.compact-layout {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.compact-page-header {
  margin-bottom: 1.5rem;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.back-link-small {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  transition: all 0.2s ease;
}

.back-link-small:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.header-title {
  flex: 1;
}

.header-title h1 {
  font-size: 1.8rem;
  color: var(--text-primary);
  margin: 0 0 0.25rem 0;
  font-weight: 700;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
}

/* 月份导航 */
.month-navigator-compact {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

.current-month-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.month-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border-radius: 20px;
  font-weight: 600;
  font-size: 1rem;
}

.month-badge .icon {
  color: white;
}

.action-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.action-button:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.month-picker-compact {
  display: none;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  margin-top: 1rem;
}

.month-picker-compact.active {
  display: block;
}

.picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.picker-header span {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.year-nav {
  display: flex;
  gap: 0.25rem;
}

.nav-button-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.8rem;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.nav-button-small:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.nav-button-small.secondary {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.nav-button-small.secondary:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.months-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.month-cell {
  text-align: center;
  padding: 0.75rem 0.25rem;
  background: var(--bg-secondary);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.month-cell:hover {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

.month-cell.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  font-weight: 500;
}

/* 建议操作 */
.suggested-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
}

/* 归档页响应式 */
@media (max-width: 768px) {
  .category-archive-container.compact-layout {
    padding: 1rem 0.75rem;
  }

  .header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .back-link-small {
    align-self: flex-start;
  }

  .header-title h1 {
    font-size: 1.5rem;
  }

  .month-navigator-compact {
    padding: 0.75rem;
  }

  .current-month-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .months-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .article-compact {
    padding: 1rem;
  }

  .article-header h3 {
    font-size: 1rem;
  }

  .suggested-actions {
    flex-direction: column;
    align-items: center;
  }

  .suggested-actions .nav-button-small {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .month-badge {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
  }

  .months-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .article-meta-small {
    flex-direction: column;
    gap: 0.4rem;
  }
}

/* ---------- 按月浏览入口（分类页升级版）---------- */
.month-browse-section {
  margin: 2.5rem 0 3rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.year-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: center;
  margin-top: 0.5rem;
}

.year-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  padding: 0.55rem 1.2rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 25px;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}

.year-chip:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.year-list-extra {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  width: 100%;
  margin-top: 0.3rem;
}

.year-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.2rem;
  background: transparent;
  color: var(--primary-color);
  border: 2px dashed var(--primary-color);
  border-radius: 25px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  margin-top: 0.3rem;
}

.year-toggle:hover {
  background: rgba(var(--primary-rgb), 0.05);
  border-style: solid;
}

.toggle-arrow {
  transition: transform 0.3s ease;
}

.year-toggle[aria-expanded="true"] .toggle-arrow {
  transform: rotate(180deg);
}

/* 响应式 */
@media (max-width: 768px) {
  .month-browse-section {
    padding: 1rem;
    margin: 2rem 0;
  }
  .year-chip {
    min-width: 70px;
    padding: 0.45rem 1rem;
    font-size: 0.9rem;
  }
}

/* 月份网格文章标记 */
.month-cell.has-posts {
  background: rgba(var(--primary-rgb), 0.08);
  border: 1px solid rgba(var(--primary-rgb), 0.3);
  font-weight: 600;
}

.month-cell.has-posts:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.month-cell.no-posts {
  color: var(--text-muted);
  cursor: default;
  opacity: 0.7;
}

.month-cell.no-posts:hover {
  background: var(--bg-secondary);
  transform: none;
}

.month-post-count {
  display: block;
  font-size: 0.7rem;
  margin-top: 0.2rem;
  font-weight: 400;
  opacity: 0.8;
}

.month-cell.has-posts .month-post-count {
  color: inherit;
}

.month-cell.no-posts .month-post-count {
  opacity: 0.5;
}


/* ---------- 分类标签页 ---------- */
.category-tag-container.compact-layout {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* 标签头部徽章 */
.tag-header-compact {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

.tag-badge-compact {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border-radius: 20px;
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.tag-badge-compact .icon {
  color: white;
}

.post-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

.tag-description-compact {
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.tag-description-compact p {
  color: var(--text-secondary);
  line-height: 1.5;
  font-size: 0.9rem;
  margin: 0;
}

.tag-description-compact strong {
  color: var(--primary-color);
}

/* 标签页中的微标签激活态 */
.tag-micro.active {
  background: var(--primary-color);
  color: white;
}

/* 相关标签建议 */
.related-tags {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.related-tags h4 {
  font-size: 1rem;
  margin: 0 0 1rem 0;
  color: var(--text-primary);
  font-weight: 600;
}

.tags-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-suggestion {
  padding: 0.4rem 0.8rem;
  background: var(--bg-card);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.85rem;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.tag-suggestion:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* 标签页响应式 */
@media (max-width: 768px) {
  .category-tag-container.compact-layout {
    padding: 1rem 0.75rem;
  }

  .tag-badge-compact {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
  }

  .post-count {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
  }

  .tags-suggestions {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .tag-badge-compact {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .tag-badge-compact .post-count {
    align-self: flex-start;
  }
}

/* ---------- 文章详情页补充 ---------- */

/* 文章元信息强化版（带颜色标识） */
.article-meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 1rem 0 2rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.article-meta .meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  background: var(--bg-secondary);
  border-radius: 4px;
}

.article-meta .meta-item svg {
  width: 16px;
  height: 16px;
}

/* 分类色块 */
.article-meta .date {
  background: #fff3e0;
  color: #f57c00;
}

.article-meta .category {
  background: #f3e5f5;
  color: #7b1fa2;
}

.article-meta .read-time {
  background: #e8f5e9;
  color: #388e3c;
}

.article-meta .views-count {
  background: #e3f2fd;
  color: #1976d2;
}

/* 标签链接 */
.tag-link {
  color: #1976d2;
  text-decoration: none;
  margin: 0 2px;
  transition: color 0.2s;
}
.tag-link:hover {
  color: #0d47a1;
  text-decoration: underline;
}

/* 文章导航按钮 */
.navigation {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.nav-button {
  padding: 10px 20px;
  background: #f8f9fa;
  color: #2c3e50;
  text-decoration: none;
  border-radius: 5px;
  transition: all 0.3s;
  border: 1px solid #ddd;
}

.nav-button:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.nav-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.nav-button.disabled:hover {
  background: #f8f9fa;
  color: #2c3e50;
  border-color: #ddd;
}

/* 收藏按钮区域 */
.article-actions {
  position: relative;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

/* 自定义 Toast */
.custom-toast {
  position: fixed;
  top: 80px;
  right: 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 16px 20px;
  min-width: 280px;
  max-width: 350px;
  z-index: var(--z-toast-top);
  border-left: 4px solid #4f46e5;
  animation: slideInRight 0.3s ease-out, fadeOut 0.3s ease-out 2.7s forwards;
  display: flex;
  align-items: center;
  gap: 12px;
}

.custom-toast.success { border-left-color: #10b981; }
.custom-toast.info { border-left-color: #3b82f6; }
.custom-toast.warning { border-left-color: #f59e0b; }

.custom-toast-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.custom-toast-content {
  flex-grow: 1;
}

.custom-toast-title {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
}

.custom-toast-message {
  color: #6b7280;
  font-size: 14px;
}

.custom-toast-close {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
}

.custom-toast-close:hover {
  background: #f3f4f6;
  color: #6b7280;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* 文章页响应式 */
@media (max-width: 768px) {
  .article-meta {
    gap: 0.8rem;
    font-size: 0.85rem;
  }

  .article-meta .meta-item {
    padding: 0.25rem 0.6rem;
  }

  .navigation {
    flex-direction: column;
    gap: 1rem;
  }

  .nav-button {
    text-align: center;
  }
}

/* ---------- 工具类 ---------- */
.text-center { text-align: center; }
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ---------- 打印 ---------- */
@media print {
  body { background: white !important; color: black !important; }
  .no-print { display: none !important; }
  a { color: black !important; }
}

/* ---------- 隐私说明页 ---------- */
.privacy-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.privacy-container h1 {
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.privacy-container h2 {
  color: var(--text-primary);
  margin-top: 2rem;
}

.privacy-container p {
  margin-bottom: 1.5rem;
}

.back-link {
  display: inline-block;
  margin-top: 2rem;
  color: var(--primary-color);
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

/* ---------- 视频扩展通用样式 ---------- */
.video-container {
  position: relative;
  overflow: hidden;
}

video[data-streaming="true"] {
  background: #000;
}

.video-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
  background: rgba(0,0,0,0.7);
  padding: 8px 16px;
  border-radius: 4px;
  z-index: 5;
}

.streaming-status {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0,0,0,0.6);
  color: #4CAF50;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  z-index: 10;
}

video:not([data-loaded="true"]) {
  opacity: 0.9;
}

video[data-loaded="true"] {
  opacity: 1;
  transition: opacity 0.3s;
}

/* 列表卡片封面（2026-10-20，docs/12 C5.5） */
.post-cover-link {
  position: relative;
  display: block;
  margin-bottom: 0.75rem;
  border-radius: 8px;
  overflow: hidden;
}
.post-cover-link .post-cover {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}
.post-cover-link .video-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.4;
}

/* ---------- 基础工具类 ---------- */
.is-hidden { display: none !important; }
.mb-4 { margin-bottom: 1rem; }
.mr-2 { margin-right: 0.5rem; }

.photo-fallback-bg { width: 100%; height: 100%; background: #f0f0f0; display: flex; align-items: center; justify-content: center; }
.text-muted-light { color: #ccc; }
