/**
 * 文章页面基础样式
 * @package Westlife
 * @version 1.0.0
 */

/*--------------------------------------------------------------
>>> 文章页面布局与内容
--------------------------------------------------------------*/
/* 主要布局结构 */
.single-main {
  position: relative;
  width: 100%;
  margin: 0 auto;
  /* 顶部留白统一由 header 的 --header-content-gap 控制，这里取消顶部 padding */
  padding: 0 0 2rem;
}

/* 主容器 */
.main-container {
  width: 100%;
  /* 与全站保持一致：容器宽度 = 1280px 内容宽度 + 两侧 padding */
  max-width: calc(var(--container-width) + var(--container-padding) * 2);
  margin: 0 auto;
  padding: 0 var(--container-padding);
  position: relative;
}

/* 内容区域 */
.main-content {
  width: 100%;
  /* 固定文章内容宽度为 1280px */
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 2rem;
  background: var(--color-card-background, var(--color-background));
  border-radius: var(--border-radius, 8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05), 0 -4px 12px rgba(0, 0, 0, 0.05);
}

/* 文章内容 */
.article-content {
  width: 100%;
  font-weight: normal; /* 修正：正文不加粗 */
  line-height: 1.8; /* 更易读的行高 */
}

/* 文章头部 */
.entry-header {
  position: relative;
  padding-bottom: 0.5rem;
  border-bottom: 1.5px solid var(--color-border);
  padding-right: 200px; /* 为分类预留空间 */
}

/* 分类容器样式 */
.entry-categories {
  position: absolute;
  right: 1rem;
  top: -1rem; /* 稍微向下移动一点 */
  display: flex;
  flex-direction: row; /* 改为横向排列 */
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem; /* 增加间距 */
}

/* 分类名称样式 */
.category-name {
  font-family: "Tencent Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, sans-serif; /* 使用腾讯字体 */
  font-size: 3.5rem; /* 增大字号 */
  color: rgba(var(--color-primary-rgb), 0.25);
  font-weight: 700;
  writing-mode: horizontal-tb; /* 改为横向文字 */
  letter-spacing: 0.05em; /* 调整字间距 */
  user-select: none;
  white-space: nowrap;
  transition: all 0.3s ease;
  border-radius: 4px; /* 添加圆角 */
}

/* 分类悬浮效果 */
.category-name:hover {
  color: rgba(var(--color-primary-rgb), 0.75);
  transform: translateY(-1px); /* 改为向上浮动 */
}

/* 深色模式适配 */
[data-theme="dark"] .category-name {
  color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .category-name:hover {
  color: var(--color-primary);
}

/* 响应式适配 */
@media (max-width: 768px) {
  .entry-header {
    padding-right: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .entry-categories {
    position: relative;
    top: 0;
    right: 0;
    margin-bottom: 0;
    margin-top: 0.5rem;
    order: 3; /* 移动端放到元信息之后，更符合阅读顺序 */
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .category-name {
    font-size: 0.85rem; /* 更小更克制 */
    padding: 0.25rem 0.5rem;
    background: var(--color-background-light);
    color: var(--color-primary);
    border-radius: 999px;
    letter-spacing: 0;
    font-weight: 600;
  }
}

.entry-title {
  font-family: "Source Han Serif CN", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif; /* 使用腾讯字体 */
  font-size: 2rem;
  font-weight: 700; /* 使用粗体 */
  line-height: 1.4;
  margin-bottom: 1rem;
  color: var(--color-text); /* 使用主题文本颜色 */
  transition: color 0.3s ease; /* 添加颜色过渡效果 */
}

/* 深色模式适配 */
[data-theme="dark"] .entry-title {
  color: #fff;
}

/* 文章头部元信息样式 */
.entry-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

/* 移动端简化元信息：放在标题后，收紧间距，隐藏次要信息 */
@media (max-width: 768px) {
  .entry-title {
    order: 1;
  }
  .entry-meta {
    order: 2;
    gap: 0.5rem;
    font-size: 0.86rem;
    margin-top: 0.25rem;
  }
  /* 去掉胶囊底色，简化为纯文本+图标 */
  .entry-meta > span {
    background: transparent;
    padding: 0;
    box-shadow: none;
  }
  /* 隐藏次要字段：字数与预计阅读时长 */
  .entry-meta .post-words,
  .entry-meta .post-reading-time {
    display: none !important;
  }
}
/* 版权信息：移动端纵向堆叠并居中 */
@media (max-width: 768px) {
  .entry-meta-box {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
  }
  .author-avatar {
    margin: 0 0 0.25rem 0;
  }
  .author-avatar img {
    width: 56px;
    height: 56px;
  }
  .copyright-content {
    padding-left: 0;
  }
  .entry-meta-box::before {
    display: none;
  } /* 移动端移除大背景图形避免干扰 */
  .copyright-info p {
    justify-content: center;
    flex-wrap: wrap;
  }
  .article-link {
    justify-content: center;
    flex-wrap: wrap;
  }
  .copy-link-btn {
    padding: 0.2rem;
  }
  .qrcode-box {
    margin-left: 0;
  }
}

@media (max-width: 480px) {
  .author-avatar img {
    width: 52px;
    height: 52px;
  }
  .copyright-info p {
    font-size: 0.92rem;
  }
  .qrcode-box {
    width: 72px;
  }
  .qrcode-content {
    height: 72px;
  }
}

/* 统一项目基础样式 */
.entry-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  background: var(--color-background-light);
  border-radius: 20px;
  transition: all 0.2s ease;
}

/* 统一图标样式 */
.entry-meta i {
  font-size: 0.9em;
  color: var(--color-primary);
  opacity: 1;
  transition: all 0.2s ease;
}

/* 统一文字样式 */
.entry-meta span:not(i) {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* 更新图标样式 */
.modified-icon {
  margin-left: 0.2rem;
  font-size: 0.8em;
  transition: transform 0.3s ease;
}

/* 链接样式 */
.entry-meta a {
  color: inherit;
  text-decoration: none;
  transition: all 0.2s ease;
}

/* 悬停效果 */
.entry-meta > span:hover {
  color: var(--color-primary);
  background: var(--color-background);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.entry-meta > span:hover i {
  opacity: 1;
}

/* 更新图标悬停动画 */
.entry-meta > span:hover .modified-icon {
  transform: rotate(180deg);
}

/* 响应式适配 */
@media (max-width: 768px) {
  .entry-meta {
    gap: 0.5rem;
    margin: 0.75rem 0;
  }

  .entry-meta > span {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
  }

  .entry-meta i {
    font-size: 0.85em;
  }
}

@media (max-width: 480px) {
  .entry-meta {
    justify-content: center;
  }
}

/*--------------------------------------------------------------
>>>  底部功能区：三栏布局（左分享｜中表情｜右关键词）
--------------------------------------------------------------*/

/* 底部功能区：三栏布局（左分享｜中表情｜右关键词） */
.entry-taxonomy {
  position: relative; /* 供中栏绝对居中定位 */
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--color-background-light);
  border-radius: 12px;
  overflow: visible; /* 允许子项可见溢出（右侧标签） */
}
.taxonomy-left {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}
.taxonomy-center {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.taxonomy-right {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: flex-end;
}

/* 移动端：三栏改三行，全部居中 */
@media (max-width: 768px) {
  .entry-taxonomy {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
  }
  .entry-taxonomy .taxonomy-left,
  .entry-taxonomy .taxonomy-center,
  .entry-taxonomy .taxonomy-right {
    width: 100%;
    justify-content: center;
  }
  .entry-taxonomy .taxonomy-right {
    justify-content: center;
  }
  /* 分享按钮更紧凑 */
  .entry-taxonomy .taxonomy-left .post-share .share-icons {
    gap: 8px;
  }
  .entry-taxonomy .taxonomy-left .post-share .share-icon {
    width: 32px;
    height: 32px;
  }
  /* 点赞按钮更紧凑 */
  .reactions {
    gap: 0.5rem;
  }
  .react-btn {
    padding: 5px 9px;
  }
  .react-emoji {
    font-size: 15px;
  }
  .react-count {
    font-size: 11px;
  }
  /* 关键词允许换行并居中 */
  .entry-taxonomy .taxonomy-right {
    justify-content: center;
  }
  .entry-taxonomy .taxonomy-right .single-tags {
    flex-wrap: wrap;
    white-space: normal;
    justify-content: center;
    row-gap: 0.35rem;
    column-gap: 0.5rem;
    max-width: 100%;
  }
}

/* 左侧分享（完全重写）：默认浅色，悬浮仅图标放大+品牌色+轻微阴影 */
.entry-taxonomy .taxonomy-left .post-share {
  display: flex;
  align-items: center;
}
.entry-taxonomy .taxonomy-left .post-share .share-icons {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  white-space: nowrap;
}
.entry-taxonomy .taxonomy-left .post-share .share-icons li {
  list-style: none;
  flex: 0 0 auto;
}

/* 按钮本体：默认跟随主题浅色，禁止任何背景变化 */
.entry-taxonomy .taxonomy-left .post-share .share-icon {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: var(--color-text-light);
  background: transparent !important;
  box-shadow: none !important;
  text-shadow: none !important;
  transform-origin: center;
  transition: transform 0.18s ease, color 0.2s ease, filter 0.2s ease;
  will-change: transform, filter;
}
.entry-taxonomy .taxonomy-left .post-share .share-icon i,
.entry-taxonomy .taxonomy-left .post-share .share-icon svg {
  font-size: 22px;
  line-height: 1;
}
.entry-taxonomy .taxonomy-left .post-share .share-icon i,
.entry-taxonomy .taxonomy-left .post-share .share-icon svg,
.entry-taxonomy .taxonomy-left .post-share .share-icon svg path {
  color: currentColor !important;
  fill: currentColor !important;
}

/* 悬浮/键盘聚焦：仅放大一点并微上浮 */
@media (hover: hover) {
  .entry-taxonomy .taxonomy-left .post-share .share-icon:hover {
    transform: scale(1.5) translateY(-1px) !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  .entry-taxonomy .taxonomy-left .post-share .share-icon {
    transition: none;
  }
  .entry-taxonomy .taxonomy-left .post-share .share-icon:hover {
    transform: none !important;
  }
}

/* 品牌色（悬浮时仅改变图标本身颜色） */
.entry-taxonomy .taxonomy-left .post-share .share-icon.share-icon--x:hover {
  color: #000000 !important;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}
.entry-taxonomy
  .taxonomy-left
  .post-share
  .share-icon.share-icon--mastodon:hover {
  color: #6364ff !important;
  filter: drop-shadow(0 4px 10px rgba(99, 100, 255, 0.35));
}
.entry-taxonomy .taxonomy-left .post-share .share-icon.share-icon--weibo:hover {
  color: #e6162d !important;
  filter: drop-shadow(0 4px 10px rgba(230, 22, 45, 0.35));
}
.entry-taxonomy
  .taxonomy-left
  .post-share
  .share-icon.share-icon--telegram:hover {
  color: #26a4e3 !important;
  filter: drop-shadow(0 4px 10px rgba(38, 164, 227, 0.35));
}
.entry-taxonomy
  .taxonomy-left
  .post-share
  .share-icon.share-icon--bluesky:hover {
  color: #0285ff !important;
  filter: drop-shadow(0 4px 10px rgba(2, 133, 255, 0.35));
}
/* WeChat 品牌色悬浮（新增） */
.entry-taxonomy
  .taxonomy-left
  .post-share
  .share-icon.share-icon--wechat:hover {
  color: #07c160 !important;
  filter: drop-shadow(0 4px 10px rgba(7, 193, 96, 0.35));
}
/* Active/键盘按下时的轻微压暗 */
.entry-taxonomy
  .taxonomy-left
  .post-share
  .share-icon.share-icon--wechat:active {
  color: #06ad54 !important;
  filter: drop-shadow(0 4px 10px rgba(7, 193, 96, 0.28));
}
/* 深色模式下可稍微降低亮度或保持同色 */
[data-theme="dark"]
  .entry-taxonomy
  .taxonomy-left
  .post-share
  .share-icon.share-icon--wechat:hover {
  color: #12d26e !important;
  filter: drop-shadow(0 4px 10px rgba(18, 210, 110, 0.35));
}

/* WeChat 悬浮二维码弹层（优化样式） */
.entry-taxonomy .taxonomy-left .post-share .share-wechat {
  position: relative;
}
.entry-taxonomy .taxonomy-left .post-share .share-wechat .wechat-qr {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translate(-50%, -100%) scale(0.92);
  transform-origin: bottom center;
  background: #fff;
  padding: 8px 10px 6px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 6px 20px -6px rgba(0, 0, 0, 0.18), 0 2px 5px rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: auto;
  min-width: 0;
  opacity: 0;
  pointer-events: none;
  will-change: opacity, transform;
  transition: opacity 0.2s cubic-bezier(0.22, 0.61, 0.36, 1),
    transform 0.2s cubic-bezier(0.22, 0.61, 0.36, 1), box-shadow 0.25s ease;
  z-index: 50;
}
/* 微信二维码弹层（简洁版：无箭头） */
.entry-taxonomy .taxonomy-left .post-share .share-wechat .wechat-qr {
  position: absolute;
}

/* WeChat QR inner sizing overrides */
.entry-taxonomy
  .taxonomy-left
  .post-share
  .share-wechat
  .wechat-qr
  .qrcode-content {
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  width: auto;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.entry-taxonomy
  .taxonomy-left
  .post-share
  .share-wechat
  .wechat-qr
  .qrcode-content
  canvas,
.entry-taxonomy
  .taxonomy-left
  .post-share
  .share-wechat
  .wechat-qr
  .qrcode-content
  img {
  width: 100px !important;
  height: 100px !important;
  display: block;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
.entry-taxonomy .taxonomy-left .post-share .share-wechat .wechat-qr .qr-tip {
  font-size: 11px;
  line-height: 1.2;
  color: #444;
  padding-top: 2px;
  white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
  .entry-taxonomy .taxonomy-left .post-share .share-wechat .wechat-qr {
    background: #1f1f22;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 6px 22px -6px rgba(0, 0, 0, 0.6), 0 2px 5px rgba(0, 0, 0, 0.4);
  }
  /* 暗色模式同样无需箭头 */
  .entry-taxonomy
    .taxonomy-left
    .post-share
    .share-wechat
    .wechat-qr
    .qrcode-content
    canvas,
  .entry-taxonomy
    .taxonomy-left
    .post-share
    .share-wechat
    .wechat-qr
    .qrcode-content
    img {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  }
  .entry-taxonomy .taxonomy-left .post-share .share-wechat .wechat-qr .qr-tip {
    color: #bbb;
  }
}
.entry-taxonomy .taxonomy-left .post-share .share-wechat:hover .wechat-qr,
.entry-taxonomy
  .taxonomy-left
  .post-share
  .share-wechat:focus-within
  .wechat-qr,
.entry-taxonomy .taxonomy-left .post-share .share-wechat.is-open .wechat-qr {
  opacity: 1;
  transform: translate(-50%, -107%) scale(1);
  pointer-events: auto;
}
@media (hover: none) {
  .entry-taxonomy .taxonomy-left .post-share .share-wechat:hover .wechat-qr,
  .entry-taxonomy
    .taxonomy-left
    .post-share
    .share-wechat:focus-within
    .wechat-qr {
    opacity: 0;
    transform: translate(-50%, -100%) scale(0.94);
    pointer-events: none;
  }
}
.entry-taxonomy
  .taxonomy-left
  .post-share
  .share-wechat
  .wechat-qr
  .qrcode-content {
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.entry-taxonomy
  .taxonomy-left
  .post-share
  .share-wechat
  .wechat-qr
  .qrcode-content
  canvas,
.entry-taxonomy
  .taxonomy-left
  .post-share
  .share-wechat
  .wechat-qr
  .qrcode-content
  img {
  width: 120px !important;
  height: 120px !important;
  border-radius: 6px;
  image-rendering: pixelated;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.08);
}
.entry-taxonomy
  .taxonomy-left
  .post-share
  .share-wechat
  .wechat-qr
  .qrcode-tip {
  font-size: 12px;
  color: #555;
  text-align: center;
  line-height: 1.3;
  letter-spacing: 0.5px;
}
[data-theme="dark"]
  .entry-taxonomy
  .taxonomy-left
  .post-share
  .share-wechat
  .wechat-qr {
  background: #1f1f1f;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 28px -6px rgba(0, 0, 0, 0.65), 0 2px 6px rgba(0, 0, 0, 0.6);
}
[data-theme="dark"]
  .entry-taxonomy
  .taxonomy-left
  .post-share
  .share-wechat
  .wechat-qr::after {
  background: #1f1f1f;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.55);
}
[data-theme="dark"]
  .entry-taxonomy
  .taxonomy-left
  .post-share
  .share-wechat
  .wechat-qr
  .qrcode-content
  canvas,
[data-theme="dark"]
  .entry-taxonomy
  .taxonomy-left
  .post-share
  .share-wechat
  .wechat-qr
  .qrcode-content
  img {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 2px 4px rgba(0, 0, 0, 0.6);
}
[data-theme="dark"]
  .entry-taxonomy
  .taxonomy-left
  .post-share
  .share-wechat
  .wechat-qr
  .qrcode-tip {
  color: #bbb;
}
@media (hover: none) {
  /* 触摸设备上依赖点击 .is-open，不用 hover 触发 */
  .entry-taxonomy .taxonomy-left .post-share .share-wechat:hover .wechat-qr,
  .entry-taxonomy
    .taxonomy-left
    .post-share
    .share-wechat:focus-within
    .wechat-qr {
    opacity: 0;
    transform: translate(-50%, -100%) scale(0.9);
    pointer-events: none;
  }
}
.entry-taxonomy
  .taxonomy-left
  .post-share
  .share-wechat
  .wechat-qr
  .qrcode-content
  canvas,
.entry-taxonomy
  .taxonomy-left
  .post-share
  .share-wechat
  .wechat-qr
  .qrcode-content
  img {
  width: 120px !important;
  height: 120px !important;
  display: block;
  margin: 0 auto 6px;
}
.entry-taxonomy
  .taxonomy-left
  .post-share
  .share-wechat
  .wechat-qr
  .qrcode-tip {
  text-align: center;
  font-size: 12px;
  color: #555;
}
[data-theme="dark"]
  .entry-taxonomy
  .taxonomy-left
  .post-share
  .share-wechat
  .wechat-qr {
  background: #1f1f1f;
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.6);
}
[data-theme="dark"]
  .entry-taxonomy
  .taxonomy-left
  .post-share
  .share-wechat
  .wechat-qr::after {
  background: #1f1f1f;
}
/* 暗色：X 悬浮用白色以保证可见度 */
[data-theme="dark"]
  .entry-taxonomy
  .taxonomy-left
  .post-share
  .share-icon.share-icon--x:hover {
  color: #ffffff !important;
  filter: drop-shadow(0 4px 10px rgba(255, 255, 255, 0.25));
}

/* 键盘可访问性 */
.entry-taxonomy .taxonomy-left .post-share .share-icon:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 慢速平滑放大：声明初始 transform + 更柔和缓动 */
.entry-taxonomy .taxonomy-left .post-share .share-icon {
  transform: translateY(0) scale(1);
  transition: transform 0.42s cubic-bezier(0.22, 0.61, 0.36, 1),
    color 0.28s ease, filter 0.28s ease;
}

/* 悬浮/聚焦/触摸：保持原目标尺寸，仅改变动画节奏 */
.entry-taxonomy .taxonomy-left .post-share .share-icon:hover,
.entry-taxonomy .taxonomy-left .post-share .share-icon:focus-visible {
  transform: scale(1.5) translateY(-1px) !important;
}
.entry-taxonomy .taxonomy-left .post-share .share-icon:active {
  transform: scale(1.35) translateY(-1px) !important;
}

/* 中栏：点赞绝对居中，不挡左右点击；小屏回退为正常流居中 */
.entry-taxonomy .taxonomy-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none; /* 不挡左右区域事件 */
}
.entry-taxonomy .taxonomy-center .reactions {
  pointer-events: auto;
} /* 仅按钮可点 */
@media (max-width: 768px) {
  .entry-taxonomy .taxonomy-center {
    position: static;
    transform: none;
    flex: 1 1 auto;
    pointer-events: auto;
  }
}

/* 中栏：表情/点赞（轻量样式） */
.reactions {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.react-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  background: var(--color-background);
  color: var(--color-text);
  border-radius: 999px;
  cursor: pointer;
  line-height: 1;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}
.react-btn:hover {
  border-color: var(--color-primary);
}
.react-btn:active {
  transform: scale(0.98);
}
.react-emoji {
  font-size: 16px;
  line-height: 1;
}
.react-count {
  font-size: 12px;
  color: var(--color-text-light);
}
.react-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Reactions 交互增强 */
.react-btn.active {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.06);
}
.react-btn:active {
  transform: scale(0.98);
}

/* +1/-1 漂浮气泡 - 改为相对定位 */
.react-btn {
  position: relative;
  overflow: visible; /* 确保动画不被裁剪 */
}

/* 最简版：直接用 CSS 类控制 */
.react-btn.animate-plus::after {
  content: "+1";
  position: absolute;
  left: 50%;
  top: -10px;
  transform: translateX(-50%);

  font: 700 14px/1 var(--font-primary, system-ui);
  color: var(--color-primary);
  pointer-events: none;

  animation: plusOneFloat 0.7s ease-out;
}

@keyframes plusOneFloat {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(0) scale(0.9);
  }
  10% {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-35px) scale(0.8);
  }
}

/* 调小右侧关键词字号与计数徽标（稍微小一点） */
.entry-taxonomy .taxonomy-right .single-tags {
  font-size: 0.85rem;
}
.entry-taxonomy .taxonomy-right .single-tags a {
  line-height: 1.1;
}
.entry-taxonomy .taxonomy-right .single-tags .tag-hash {
  font-size: 0.85em;
}
.entry-taxonomy .taxonomy-right .single-tags a .count {
  font-size: 9px;
  top: -0.5em;
  right: -0.4em;
}

/* 小屏再小一档 */
@media (max-width: 480px) {
  .entry-taxonomy .taxonomy-right .single-tags {
    font-size: 0.9rem;
  }
}

.react-btn.active {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.06);
}
/* 深色模式 */
[data-theme="dark"] .react-btn.active {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text);
  border-color: var(--color-border);
}

/* 右侧关键词（单文页专用 single-tags） */

.entry-taxonomy .taxonomy-right {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  overflow: visible;
}
.entry-taxonomy .taxonomy-right .single-tags {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: nowrap;
  white-space: nowrap;
  max-width: none; /* 不限制宽度 */
  overflow: visible; /* 不出现滚动条 */
}
.entry-taxonomy .taxonomy-right .single-tags a {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  padding: 0;
  background: none;
  border-radius: 0;
  color: var(--color-text);
  line-height: 1.2;
  text-decoration: none;
  transition: color 0.2s ease;
}
.entry-taxonomy .taxonomy-right .single-tags a:hover {
  color: var(--color-hover);
}
.entry-taxonomy .taxonomy-right .single-tags .tag-hash {
  color: var(--color-primary); /* # 高亮为主题色 */
  margin-right: 2px;
  font-weight: 600;
}
.entry-taxonomy .taxonomy-right .single-tags a .count {
  position: absolute;
  top: -0.45em;
  right: -0.35em;
  font-size: 10px;
  line-height: 1;
  color: var(--color-text-light);
  font-weight: 600;
  padding: 0;
  background: none;
  border: 0;
  display: inline-block !important;
}

/* 移动端补强：确保关键词在小屏真正居中（覆盖后续基础“右对齐”规则） */
@media (max-width: 768px) {
  .entry-taxonomy .taxonomy-right {
    justify-content: center;
  }
  .entry-taxonomy .taxonomy-right .single-tags {
    justify-content: center;
    flex-wrap: wrap;
    white-space: normal;
    row-gap: 0.35rem;
    column-gap: 0.5rem;
    max-width: 100%;
  }
}

/* 深色模式微调 */
[data-theme="dark"] .entry-taxonomy {
  background: var(--color-background);
}
[data-theme="dark"] .entry-taxonomy .taxonomy-right .single-tags a .count {
  color: #bfbfbf;
}

/*--------------------------------------------------------------
>>> 版权和作者（底部）
--------------------------------------------------------------*/

/* 1) 区块容器 */
.entry-meta-box {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1rem 0;
  padding: 1.2rem;
  background: var(--color-background-light);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* 2) 背景装饰 + 动画 */
.entry-meta-box::before {
  content: "";
  position: absolute;
  right: 140px;
  top: 50%;
  width: 180px;
  height: 180px;
  background-image: url("../images/WTFPL.svg");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.06;
  z-index: 0;
  transform: translateY(-50%) scale(1);
  transform-origin: center center;
  will-change: transform;
}

/* 新增：hover 时替换为内联 SVG 放大淡入 */
.entry-meta-box .entry-meta-svg {
  position: absolute;
  right: 120px;
  top: 50%;
  /* 调整为相对父容器高度，防止溢出被裁剪 */
  height: 90%;
  width: auto; /* 依据 SVG 本身宽高比自动计算宽度 */
  transform: translateY(-50%); /* 去掉缩放，保证完整显示 */
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.55s ease; /* 仅保留透明度过渡，移除 scale 动画避免溢出 */
}
.entry-meta-box .entry-meta-svg svg {
  height: 100%;
  width: auto; /* 按高度自适应 */
  display: block;
}
.entry-meta-box:hover::before {
  opacity: 0;
}
.entry-meta-box:hover .entry-meta-svg {
  opacity: 0.18; /* 仅淡入，不再放大 */
  transform: translateY(-50%);
}

/* 3) 左侧：头像与社交区 */
.author-avatar {
  position: relative;
  z-index: 1;
  margin-left: 16px;
  margin-right: 1rem;
  display: inline-block; /* 确保 hover 区域以内容盒为准 */
  cursor: pointer; /* 提示可交互 */
}

.author-avatar img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid var(--color-background);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  /* 再放缓：0.85s 自定义缓动，平滑上升 */
  transition: transform 0.85s cubic-bezier(0.33, 0.01, 0.18, 1),
    box-shadow 0.6s ease;
  will-change: transform;
  transform: translateY(0) scale(1);
}

/* 若有全局样式覆盖 transform，这里强制保证悬浮上浮存在 */
/* 双定义一次，确保即使上方有冲突也能生效 */
.author-avatar:hover img,
.author-avatar:focus-within img {
  transform: translateY(-12px) scale(1.02) !important;
}

/* 悬浮：先上移头像（丝滑），再出现社交图标（入场延迟） */
/* 提升阴影层级并加 important 防止被通用 img:hover 重置 */
.author-avatar:hover img,
.author-avatar:focus-within img {
  transform: translateY(-10px) scale(1.02) !important;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22) !important;
}

/* 社交按钮容器：默认隐藏 */
.author-social {
  position: absolute;
  left: 50%;
  top: calc(100% - 10px);
  transform: translateX(-50%) translateY(10px);
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s ease, opacity 0.28s ease;
  will-change: transform, opacity;
  z-index: 2;
}

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

/* 兜底去除列表符号 */
.author-social li::marker {
  content: none;
}

/* 社交容器底片 */
.author-social::before {
  content: "";
  position: absolute;
  inset: -6px -10px;
  background: rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* 显示条件：仅入场延迟，离场无延迟 */
.author-avatar:hover .author-social,
.author-avatar:focus-within .author-social,
.author-social:hover {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
  transition-delay: 0.25s; /* 与慢速上浮同步 */
}

.author-avatar:hover .author-social::before,
.author-avatar:focus-within .author-social::before,
.author-social:hover::before {
  opacity: 1;
}

/* 扩展热区，避免移入图标时消失 */
.author-avatar::after {
  content: "";
  position: absolute;
  left: -16px;
  right: -16px;
  top: 100%;
  height: 90px;
}

/* 4) 社交按钮样式 */
.as-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  outline: none;
  color: #fff; /* 基色固定白色 */
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

/* 阻断全局 a:hover 颜色，图标始终白色 */
.author-social .as-btn,
.author-social .as-btn:hover,
.author-social .as-btn:focus {
  color: #fff !important;
}
.author-social .as-btn .as-icon {
  color: #fff !important;
}

.as-btn .as-icon {
  font-size: 14px;
}
.as-btn .text {
  display: none !important;
}

/* 悬浮：仅轻微放大 */
.as-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.16);
}

/* 品牌色 */
.as-btn.twitter {
  background-color: #1da1f2;
}
.as-btn.github {
  background-color: #24292e;
}
.as-btn.youtube {
  /* 保留旧类以防缓存/历史文章 */
  background-color: #ff0000;
}
/* 新：X (Twitter 重命名) */
.as-btn.x {
  background-color: #000; /* 品牌主色黑 */
}
/* 新：Mastodon */
.as-btn.mastodon {
  background-color: #6364ff;
}

/* 深色模式下保持可见对比（若后续有变量系统可用变量替换） */
[data-theme="dark"] .as-btn.x {
  background-color: #111;
}
[data-theme="dark"] .as-btn.mastodon {
  background-color: #5859e6;
}

/* 深色模式阴影微调 */
[data-theme="dark"] .as-btn {
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .as-btn:hover {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.45);
}

/* 小屏优化（社交按钮更小） */
@media (max-width: 768px) {
  .author-social {
    gap: 4px;
  }
  .as-btn {
    width: 26px;
    height: 26px;
  }
  .as-btn .as-icon {
    font-size: 13px;
  }
}

/* 5) 中间：作者与版权信息 */
.copyright-content {
  display: flex;
  gap: 1.2rem;
  flex: 1;
  z-index: 1;
  position: static; /* 使引号图标相对 entry-meta-box 定位 */
  padding-left: 2.4rem; /* 为引号图标留位 */
}

/* 左上角引号图标 */
.entry-meta-box .copyright-icon {
  position: absolute;
  left: 0.5rem;
  top: 0.5rem;
  color: var(--color-primary);
  font-size: 1.6rem;
  opacity: 0.2;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.entry-meta-box:hover .copyright-icon {
  opacity: 0.3;
}

/* 文本容器 */
.copyright-info {
  flex: 1;
}

.copyright-info p {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.4rem 0;
  font-size: 0.95rem;
  color: var(--color-text);
}

.copyright-info span {
  color: var(--color-text);
  white-space: nowrap;
}

.copyright-info a {
  color: var(--color-primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

.copyright-info a:hover {
  color: var(--color-secondary);
  text-decoration: underline;
}

/* 时间信息弱化 */
.entry-meta-box .article-author {
  font-size: 0.92rem;
}

.entry-meta-box .article-author .published,
.entry-meta-box .article-author .updated-time {
  font-size: 0.88em;
  color: #c0c0c0; /* 银色统一 */
  font-weight: 400;
  white-space: nowrap;
}

.entry-meta-box .article-author .sep {
  color: var(--color-text-light);
  opacity: 0.6;
}

/* 小屏再弱化 */
@media (max-width: 480px) {
  .entry-meta-box .article-author {
    font-size: 0.9rem;
  }
  .entry-meta-box .article-author .published,
  .entry-meta-box .article-author .updated-time {
    font-size: 0.86em;
  }
}

/* 版权区链接强调 */
.entry-meta-box .article-author .in-cat a,
.entry-meta-box .article-author a,
.entry-meta-box .article-link a,
.entry-meta-box .article-license a.site-name,
.entry-meta-box .article-license a.license-link {
  color: #d6d6d6 !important; /* 强制覆盖主题默认蓝色 */
  text-decoration: none;
  transition: color 0.18s ease;
}
.entry-meta-box .article-author a:hover,
.entry-meta-box .article-link a:hover,
.entry-meta-box .article-license a.site-name:hover,
.entry-meta-box .article-license a.license-link:hover {
  color: #ececec !important; /* 提升亮度 */
  text-decoration: underline;
}

/* 深色模式：颜色略暗，维持对比度同时不刺眼 */
[data-theme="dark"] .entry-meta-box .article-author .in-cat a,
[data-theme="dark"] .entry-meta-box .article-author a,
[data-theme="dark"] .entry-meta-box .article-link a,
[data-theme="dark"] .entry-meta-box .article-license a.site-name,
[data-theme="dark"] .entry-meta-box .article-license a.license-link {
  color: #b8b8b8 !important;
}
[data-theme="dark"] .entry-meta-box .article-author a:hover,
[data-theme="dark"] .entry-meta-box .article-link a:hover,
[data-theme="dark"] .entry-meta-box .article-license a.site-name:hover,
[data-theme="dark"] .entry-meta-box .article-license a.license-link:hover {
  color: #d0d0d0 !important;
}
.entry-meta-box .article-license .site-name,
.entry-meta-box .article-license .license-link {
  color: var(--color-primary);
}
.entry-meta-box .article-license .site-name:hover,
.entry-meta-box .article-license .license-link:hover {
  color: var(--color-secondary);
}

/* 仅文章底部版权中的“CC BY-NC-SA 4.0”链接文本使用 Roboto Condensed */
.entry-meta-box .article-license .license-link {
  font-family: "Roboto Condensed", "Roboto", "Segoe UI", Arial, sans-serif;
  font-weight: 600; /* 可按需调整粗细 */
  letter-spacing: 0.02em; /* 略微加字距，更利于辨识 */
}

/* 复制链接按钮 */
.article-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.copy-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border: none;
  background: transparent;
  color: var(--color-text-light);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.copy-link-btn:hover {
  color: var(--color-primary);
  background: var(--color-background-light);
}

.copy-link-btn.success {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

/* 深色模式（复制按钮） */
[data-theme="dark"] .copy-link-btn {
  color: var(--color-text-light);
}
[data-theme="dark"] .copy-link-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .copy-link-btn.success {
  color: #34d399;
  background: rgba(52, 211, 153, 0.1);
}

/* 6) 右侧：二维码 */
.qrcode-box {
  position: relative;
  width: 80px;
  margin-left: auto;
  opacity: 0.8;
  transition: transform 0.25s ease, opacity 0.25s ease;
  transform: none !important;
}

/* ================= AI 摘要 Provider 徽章 ================= */
.ai-badge--provider {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1;
  background: var(--color-surface, #f5f7fa);
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 4px 8px;
  border-radius: 20px;
}
.ai-provider-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}
.ai-provider-icon {
  width: 16px;
  height: 16px;
  display: block;
  color: #5865f2;
}
.ai-provider-icon--openai {
  color: #10a37f;
}
.ai-provider-icon--deepseek {
  color: #6366f1;
}
.ai-provider-icon--aliyun {
  color: #ff6a00;
}
.ai-summary-loading .ai-badge--provider {
  opacity: 0.6;
}

@media (prefers-color-scheme: dark) {
  .ai-badge--provider {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
  }
}

/* （已移除 Provider Tabs / Regenerate / Compare 按钮样式，保留历史注释以便回退） */

/* Spinner & Progress */
.ai-progress {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
}
.ai-summary-loading .ai-progress {
  display: flex;
}
.ai-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 0, 0, 0.15);
  border-top-color: var(--ai-tab-active-bg, #2563eb);
  border-radius: 50%;
  animation: aiSpin 0.8s linear infinite;
}
@keyframes aiSpin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-color-scheme: dark) {
  .ai-spinner {
    border-color: rgba(255, 255, 255, 0.25);
    border-top-color: #2563eb;
  }
}

/* Toast */
.ai-toast {
  position: relative;
  font-size: 12px;
  color: #fff;
  background: #334155;
  padding: 4px 8px;
  border-radius: 4px;
  display: none;
  max-width: 300px;
}
.ai-toast.is-show {
  display: inline-block;
  animation: aiToastIn 0.25s ease;
}
@keyframes aiToastIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.ai-toast.ai-error {
  background: #dc2626;
}
.ai-toast.ai-success {
  background: #16a34a;
}

/* Compare Modal */
.ai-compare-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5005; /* 全局UI层：图片预览遮罩 */
  opacity: 0;
  pointer-events: none;
  transition: 0.25s opacity;
}
.ai-compare-modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}
.ai-compare-modal {
  background: var(--compare-bg, #fff);
  width: min(960px, 90vw);
  max-height: 80vh;
  overflow: auto;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
@media (prefers-color-scheme: dark) {
  .ai-compare-modal {
    background: #1f2937;
    color: #e5e7eb;
  }
}
.ai-compare-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.ai-compare-card {
  border: 1px solid #e2e8f0;
  padding: 12px 14px;
  border-radius: 8px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
@media (prefers-color-scheme: dark) {
  .ai-compare-card {
    background: #273549;
    border-color: #334155;
  }
}
.ai-compare-card h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-compare-card pre {
  margin: 0;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.ai-compare-close {
  align-self: flex-end;
  background: #ef4444;
  border: none;
  color: #fff;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
}
.ai-compare-close:hover {
  background: #dc2626;
}
@media (prefers-color-scheme: dark) {
  .ai-compare-close {
    background: #dc2626;
  }
}

.qrcode-content {
  width: 100%;
  height: 80px;
  background: #fff;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qrcode-content img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}

.qrcode-tip {
  margin-top: 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-light);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0.8;
}

.qrcode-tip i {
  font-size: 0.9rem;
  color: #07c160;
}

/* 悬浮仅缩放 */
.qrcode-box:hover {
  opacity: 1;
  transform: scale(1.06) !important;
}
.qrcode-box:hover .qrcode-tip {
  opacity: 1;
}

/* 深色模式（二维码） */
[data-theme="dark"] .qrcode-content {
  background: var(--color-background);
  border-color: var(--color-border);
}
[data-theme="dark"] .qrcode-tip {
  color: var(--color-text-light);
}
[data-theme="dark"] .qrcode-box {
  opacity: 0.6;
}
[data-theme="dark"] .qrcode-box:hover {
  opacity: 0.9;
}

/* 7) 移动端布局 */
@media (max-width: 768px) {
  /* 移动端：整块隐藏，页面更简洁 */
  .entry-meta-box {
    display: none !important;
  }
  .author-avatar {
    margin-right: 0;
  }
  .qrcode-box {
    display: none !important; /* 移动端隐藏二维码区域，精简页面 */
  }
}

/*--------------------------------------------------------------
>>> 相关文章区域
--------------------------------------------------------------*/
/* 容器 */
.related-posts {
  margin: 2rem 0;
  position: relative;
}

/* 头部（标题 + 换一批） */
.related-header {
  /* 语义变量，方便与评论头部一致覆盖 */
  --related-header-bg: var(
    --cmt-header-bg,
    var(--color-card-background, var(--color-background-light))
  );
  --related-header-border: var(
    --cmt-header-border,
    var(--color-border, rgba(0, 0, 0, 0.08))
  );
  --related-header-shadow: var(
    --cmt-header-shadow,
    var(
      --card-shadow,
      0 1px 2px rgba(0, 0, 0, 0.04),
      0 3px 8px -2px rgba(0, 0, 0, 0.08)
    )
  );
  --related-header-radius: var(--card-radius, 14px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem 1rem;
  /* 与评论头部 (.comments-header) 高度对齐：使用同样上下内边距 */
  padding: 0.85rem 1rem; /* 同 comments-header */
  margin-bottom: 0.75rem;
  background: var(--related-header-bg);
  border: 1px solid var(--related-header-border);
  border-radius: var(--related-header-radius);
  box-shadow: var(--related-header-shadow);
  position: relative;
  backdrop-filter: saturate(140%) blur(2px); /* 轻玻璃感，与评论头部保持体系 */
  transition: box-shadow 0.25s ease, border-color 0.25s ease,
    background-color 0.25s ease;
}

@media (prefers-color-scheme: light) {
  .related-header {
    --related-header-bg: color-mix(
      in srgb,
      var(--color-card-background, #ffffff) 96%,
      transparent
    );
  }
}

.related-header:hover {
  box-shadow: 0 4px 14px -2px rgba(0, 0, 0, 0.08),
    0 6px 24px -8px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .related-header {
  --related-header-bg: linear-gradient(
    135deg,
    color-mix(in srgb, #232a33 94%, transparent),
    color-mix(in srgb, #1c2229 94%, transparent)
  );
  --related-header-border: rgba(255, 255, 255, 0.08);
  --related-header-shadow: 0 2px 6px -1px rgba(0, 0, 0, 0.5),
    0 4px 14px -4px rgba(0, 0, 0, 0.55);
  background: var(--related-header-bg);
  border: 1px solid var(--related-header-border);
  backdrop-filter: saturate(150%) blur(4px);
}

[data-theme="dark"] .related-header:hover {
  box-shadow: 0 4px 14px -2px rgba(0, 0, 0, 0.55),
    0 6px 22px -8px rgba(0, 0, 0, 0.6);
}

/* 标题：左侧色条 + 图标 */
.related-title {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-heading);
  line-height: 1.2;
  padding-left: 0.75rem;
}
.related-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 1.1em;
  border-radius: 3px;
  background: var(--color-primary);
}
.related-title i {
  color: var(--color-primary);
  font-size: 1.05rem;
}

/* 相关文章：右侧“换一批”动作区（优化版）
  - 默认/悬浮：仅显示刷新 SVG（跟随 currentColor）
  - 加载中(.loading / [aria-busy="true"]):仅显示旋转圆圈，颜色使用 --related-spinner-color (品牌主色 #0166CC)，禁用点击
  - 使用变量控制尺寸与速度；移除一切 hover 切换逻辑
*/
.related-actions {
  --related-icon-size: 18px;
  --related-spinner-duration: 1s;
  --related-spinner-color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}

/* 按钮基础 */
.related-random-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--color-background);
  color: var(--color-text-light); /* 控制图标颜色（SVG/FA 跟随） */
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: none; /* 取消过渡，避免悬浮动画 */
}
.related-random-btn i,
.related-random-btn svg {
  pointer-events: none;
}

/* 悬浮/聚焦：保持外观不变（不触发图标切换） */
.related-random-btn:hover,
.related-random-btn:focus {
  background: var(--color-background);
  color: var(--color-text-light);
  border-color: var(--color-border);
  transform: none;
  box-shadow: none;
}

/* 提示文字（容器悬浮时淡入） */
.related-random-text {
  font-size: 0.85rem;
  color: var(--color-text-light);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.18s ease, transform 0.18s ease, color 0.18s ease;
  white-space: nowrap;
  pointer-events: none;
}
.related-actions:hover .related-random-text,
.related-actions:focus-within .related-random-text {
  opacity: 1;
  transform: translateY(0);
}

/* 刷新 SVG（默认/悬浮均显示） */
.related-random-btn .icon-refresh {
  width: var(--related-icon-size);
  height: var(--related-icon-size);
  display: inline-block;
  vertical-align: -2px;
  fill: currentColor;
}
.related-random-btn .icon-refresh path {
  fill: currentColor;
}

/* 加载圈：默认隐藏，仅 loading 显示；对齐与旋转中心 */
.related-random-btn .fa-circle-notch {
  display: none !important;
  font-size: var(--related-icon-size);
  line-height: 1;
  transform-origin: center center;
  will-change: transform;
}

/* 加载状态：仅在 loading 时切换为旋转圈并着色为主题蓝 */
.related-random-btn.u-loading,
.related-random-btn[aria-busy="true"] {
  color: var(--related-spinner-color); /* 主题蓝，同时作用于旋转圈颜色 */
  cursor: not-allowed;
  pointer-events: none;
}
.related-random-btn.u-loading .icon-refresh,
.related-random-btn[aria-busy="true"] .icon-refresh {
  display: none !important;
}
.related-random-btn.u-loading .fa-circle-notch,
.related-random-btn[aria-busy="true"] .fa-circle-notch {
  display: inline-block !important;
  animation: fa-spin var(--related-spinner-duration) linear infinite !important; /* 强制旋转 */
}

/* 列表容器加载态（淡化） */
.related-grid.u-loading {
  opacity: 0.5;
  pointer-events: none;
}

/* 兜底：若 Font Awesome 未定义 .fa-spin，提供动画（全局） */
@keyframes fa-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
.fa-spin {
  animation: fa-spin 1s linear infinite;
}

/* ==============================
   相关推荐头部：评论框架风皮肤
   用法：.related-posts 加 .is-frame
   仅样式变更，不改 HTML
============================== */
.related-posts.is-frame .related-header {
  /* 复用基础变量，frame 模式下扩大留白与阴影深度 */
  /* 保持与普通状态一致，避免不同模式高度不一致 */
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  --related-header-bg: var(--color-card-background, var(--color-background));
  --related-header-border: var(--color-border, rgba(0, 0, 0, 0.08));
  --related-header-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.1),
    0 8px 28px -8px rgba(0, 0, 0, 0.14);
  background: var(--related-header-bg);
  border: 1px solid var(--related-header-border);
  border-radius: var(--card-radius, 14px);
  box-shadow: var(--related-header-shadow);
}
.related-posts.is-frame .related-title {
  font-size: 1.1rem;
  padding-left: 0; /* 去掉左侧色条 */
}
.related-posts.is-frame .related-title::before {
  display: none;
}
.related-posts.is-frame .related-actions .related-random-text {
  opacity: 1;
  transform: none;
}
.related-posts.is-frame .related-actions {
  gap: 0.6rem;
}
.related-posts.is-frame .related-random-btn {
  background: var(--color-background);
}

[data-theme="dark"] .related-posts.is-frame .related-header {
  --related-header-bg: linear-gradient(
    135deg,
    color-mix(in srgb, #232a33 94%, transparent),
    color-mix(in srgb, #1c2229 94%, transparent)
  );
  --related-header-border: rgba(255, 255, 255, 0.08);
  --related-header-shadow: 0 4px 14px -2px rgba(0, 0, 0, 0.55),
    0 8px 28px -10px rgba(0, 0, 0, 0.65);
  background: var(--related-header-bg);
  border: 1px solid var(--related-header-border);
  box-shadow: var(--related-header-shadow);
}

/* 网格与卡片（保持原有） */
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  transition: opacity 0.3s ease;
}
.related-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}
.related-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.related-thumb {
  position: relative;
  aspect-ratio: 16/9;
  height: auto;
  overflow: hidden;
  background: var(--color-background-light);
}
@supports not (aspect-ratio: 1) {
  .related-thumb {
    padding-bottom: 56.25%;
  }
}
.related-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.related-item:hover .related-thumb img {
  transform: scale(1.1);
}
.related-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 1rem 1rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  backdrop-filter: blur(4px);
  transition: all 0.3s ease;
}
.related-item-title {
  font-size: 1.1rem;
  line-height: 1.5;
  margin: 0;
  color: #fff;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  text-align: center;
  transition: transform 0.3s ease;
}

/* 相关文章：标题变小、背景条变矮，仅包住标题 */
.related-item-title {
  font-size: 0.95rem; /* 比原来更小 */
  line-height: 1.35;
  font-weight: 600;
}

/* 若已有模糊背景，这里仅收紧高度与内边距 */
.related-content {
  padding: 6px 10px; /* 变矮：上下内边距减小 */
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
}

/* 缩略图左上角的发布时间徽标 */
.related-thumb {
  position: relative;
}
.related-date {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  font-size: 12px;
  line-height: 1.4;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 4px;
  backdrop-filter: saturate(140%) blur(4px);
  -webkit-backdrop-filter: saturate(140%) blur(4px);
  pointer-events: none;
}

/* 深色模式微调 */
[data-theme="dark"] .related-content {
  background: rgba(0, 0, 0, 0.45);
}
[data-theme="dark"] .related-date {
  background: rgba(0, 0, 0, 0.6);
  color: #eee;
}

/* 小屏再小一点标题字号 */
@media (max-width: 480px) {
  .related-item-title {
    font-size: 0.9rem;
  }
  .related-content {
    padding: 6px 8px;
  }
}

/* 响应式 */
@media (max-width: 768px) {
  .related-grid {
    grid-template-columns: 1fr; /* 移动端：一列三行展示（每条占一行） */
  }
  .related-item-title {
    font-size: 0.9rem; /* 移动端标题再小一点 */
  }
}
@media (max-width: 480px) {
  .related-grid {
    grid-template-columns: 1fr;
  }
}

/* 动画（模块内） */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

/* 可选：通用工具类 */
.ani-spin {
  animation: spin 1s linear infinite;
}
.ani-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

/* 相关文章卡片阴影 */
[data-theme="dark"] .related-item {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
[data-theme="dark"] .related-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* 单文页主体与通用块（取自单页原深色块） */
[data-theme="dark"] .main-content {
  /* 使用更亮一档的表面色，提升与页面背景(#181818)的对比度 */
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
}
[data-theme="dark"] .entry-content {
  color: var(--color-text);
}
[data-theme="dark"] .entry-content blockquote,
[data-theme="dark"] .entry-content pre[class*="language-"] {
  background: var(--color-background-light);
  border: 1px solid var(--color-border);
}
[data-theme="dark"] .entry-content mark {
  background: rgba(var(--color-primary-rgb), 0.15);
}
[data-theme="dark"] .entry-content kbd {
  background: var(--color-background-light);
  border-color: var(--color-border);
  box-shadow: 0 2px 0 var(--color-border);
}

/* 深色模式：正文常见元素的对比度与边界增强 */
[data-theme="dark"] .entry-content hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  opacity: 0.7;
}

[data-theme="dark"] .entry-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 6px;
}
[data-theme="dark"] .entry-content table th,
[data-theme="dark"] .entry-content table td {
  border-top: 1px solid var(--color-border);
  padding: 0.6rem 0.75rem;
}
[data-theme="dark"] .entry-content table th {
  background: var(--color-background-light);
  color: var(--color-text);
}
[data-theme="dark"] .entry-content table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .entry-content img {
  background: var(--color-background);
  border: 1px solid var(--color-border);
}
[data-theme="dark"] .entry-content figure {
  margin: 1rem 0;
}
[data-theme="dark"] .entry-content figure > figcaption {
  color: var(--color-text-light);
  background: var(--color-background-light);
  border-top: 1px solid var(--color-border);
  padding: 6px 8px;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

/* 行内代码（不影响代码块） */
[data-theme="dark"] .entry-content :not(pre) > code {
  background: var(--color-background-light);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 0.08rem 0.3rem;
  border-radius: 4px;
}

/* 单文页卡片 */
[data-theme="dark"] .entry-meta-box,
[data-theme="dark"] .entry-taxonomy,
[data-theme="dark"] .related-posts {
  background: var(--color-background-light);
  border: 1px solid var(--color-border);
}

/* =============================================================
   相关推荐：卡片模式（可选变体）
   使用方法：给容器 .related-posts 添加类名 .is-card
   仅样式变化，不改动 HTML 结构与脚本逻辑
   ============================================================= */
.related-posts.is-card .related-grid {
  gap: 1rem; /* 稍微紧凑 */
}
.related-posts.is-card .related-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.08));
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease,
    border-color 0.18s ease;
}
.related-posts.is-card .related-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md, 0 6px 18px rgba(0, 0, 0, 0.12));
}
/* 顶部缩略图保留，底部内容改为常规卡片内容区 */
.related-posts.is-card .related-content {
  position: static;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0.75rem 0.75rem 0.9rem;
}
.related-posts.is-card .related-item-title {
  color: var(--color-heading);
  text-shadow: none;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.4;
  margin: 0;
}
.related-posts.is-card .related-thumb {
  background: var(--color-background);
}
.related-posts.is-card .related-thumb img {
  transition: transform 0.35s ease;
}
.related-posts.is-card .related-item:hover .related-thumb img {
  transform: scale(1.05);
}

/* 深色模式下的卡片细节 */
[data-theme="dark"] .related-posts.is-card .related-item {
  background: var(--color-background-light);
  border: 1px solid var(--color-border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .related-posts.is-card .related-item:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
[data-theme="dark"] .related-posts.is-card .related-item-title {
  color: var(--color-text);
}
[data-theme="dark"] .related-posts.is-card .related-thumb {
  background: var(--color-surface);
}

/* 响应式微调（卡片模式） */
@media (max-width: 768px) {
  .related-posts.is-card .related-item-title {
    font-size: 0.95rem;
  }
}
@media (max-width: 480px) {
  .related-posts.is-card .related-item-title {
    font-size: 0.92rem;
  }
  .related-posts.is-card .related-content {
    padding: 0.6rem 0.65rem 0.75rem;
  }
}

/* 代码工具条 */
[data-theme="dark"] .code-toolbar .language-name {
  background: rgba(0, 0, 0, 0.2);
}
[data-theme="dark"] .code-toolbar .copy-button {
  background: var(--color-background);
}

/* 目录卡片 */
[data-theme="dark"] .toc-container {
  background: var(--color-background);
  border-color: var(--color-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
[data-theme="dark"] .toc-list::-webkit-scrollbar-thumb {
  background: var(--color-border);
}

/* 加载遮罩 */
[data-theme="dark"] .loading-overlay {
  background: rgba(0, 0, 0, 0.2);
}

/* 复制/二维码弹层 */
[data-theme="dark"] .copy-tooltip {
  background: rgba(0, 0, 0, 0.9);
}
[data-theme="dark"] .copy-tooltip::after {
  border-top-color: rgba(0, 0, 0, 0.9);
}
[data-theme="dark"] .qrcode-popup {
  background: var(--color-background);
}
[data-theme="dark"] .qrcode-popup::after {
  border-top-color: var(--color-background);
}
[data-theme="dark"] .qrcode-popup p {
  color: var(--color-text-light);
}

/* 作者头像边框与阴影 */
[data-theme="dark"] .author-avatar img {
  border-color: var(--color-background);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 响应式（仅深色差异） */
@media (max-width: 768px) {
  [data-theme="dark"] .entry-meta-box::before {
    opacity: 0.04;
  }
}
@media (max-width: 576px) {
  [data-theme="dark"] .entry-content blockquote {
    background: var(--color-background-light);
  }
  [data-theme="dark"] .code-toolbar .copy-button {
    background: var(--color-background-light);
  }
}

/* 程序化滚动时临时锁住导航栏，防止出现/消失导致定位跳变 */
/* 仅单篇文章页面启用目录锁定时固定头部，避免影响首页等其它页面导航显示 */
body.single.toc-lock-header .site-header {
  /* 常见自动隐藏实现是 transform/top，这里双保险 */
  transform: translateY(-100%) !important;
  top: -200px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: none !important; /* 避免过渡引发中间态错位 */
}
/* 保留 WP 管理条（如存在） */
body.single.toc-lock-header #wpadminbar {
  transform: none !important;
  top: 0 !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/*--------------------------------------------------------------
>>> Ai摘要相关样式
--------------------------------------------------------------*/

/* AI 摘要样式 - 统一定义（移除重复块）
   可调变量：
     --ai-summary-bg-start / --ai-summary-bg-end 渐变起止
     --ai-summary-border-color 边框色
     --ai-summary-radius 圆角
     --ai-summary-padding 基础内边距（桌面）
     响应式会在媒体查询中覆盖 padding 与 margin
*/
.ai-summary {
  --ai-summary-bg-start: #f0f8ff;
  --ai-summary-bg-end: #e6f3ff;
  --ai-summary-border-color: #b3d9ff;
  --ai-summary-radius: 8px;
  --ai-summary-padding: 20px; /* desktop base */
  /* 标题渐变变量 */
  --ai-heading-grad-start: #3b82f6;
  --ai-heading-grad-end: #1d4ed8;
  --ai-heading-dark-grad-start: #60a5fa;
  --ai-heading-dark-grad-end: #3b82f6;
  background: linear-gradient(
    135deg,
    var(--ai-summary-bg-start) 0%,
    var(--ai-summary-bg-end) 100%
  );
  border: 1px solid var(--ai-summary-border-color);
  border-radius: var(--ai-summary-radius);
  padding: var(--ai-summary-padding);
  margin: 20px 0;
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
  overflow: hidden;
}

/* 头部区域 */
.ai-summary .summary-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  position: relative;
  z-index: 2;
}

/* AI 图标容器 */
.ai-icon-wrapper {
  position: relative;
  width: 28px;
  height: 28px;
}

/* 新黄色 AI 徽标按钮 */
.ai-badge-btn {
  /* 统一徽标尺寸：允许在更窄布局里缩小，最大保持原42 */
  --ai-badge-size: clamp(36px, 4vw, 42px);
  --ai-badge-grad: linear-gradient(45deg, #efad21, #ffd60f);
  appearance: none;
  border: 0;
  outline: 0;
  padding: 0;
  margin: 0;
  cursor: default;
  width: var(--ai-badge-size);
  height: var(--ai-badge-size);
  border-radius: 14px;
  background: var(--ai-badge-grad);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15), 0 4px 14px -4px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
  font: 700 14px/1 system-ui, -apple-system, BlinkMacSystemFont;
  margin-right: 2px; /* 与标题更紧凑 */
}
.ai-badge-btn-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.ai-badge-spark {
  width: 18px;
  height: 18px;
  color: #ffec71;
  fill: currentColor;
  transition: transform 0.35s ease, opacity 0.35s ease;
}
.ai-badge-text {
  position: absolute;
  font-size: 16px;
  letter-spacing: 0.5px;
  color: #fff;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  opacity: 0.95;
  line-height: 1; /* 垂直视觉居中 */
}
@media (prefers-reduced-motion: no-preference) {
  .ai-badge-btn:hover .ai-badge-spark {
    transform: scale(1.55) translateY(2px);
    opacity: 0.85;
  }
  .ai-badge-btn:hover .ai-badge-text {
    opacity: 0;
  }
}
.dark .ai-badge-btn {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.07) inset;
}
.dark .ai-badge-spark {
  color: #ffe55c;
}
.dark .ai-badge-text {
  color: #fff;
}
.ai-badge-btn:focus-visible {
  outline: 2px solid var(--color-primary, #2563eb);
  outline-offset: 3px;
}

/* === 简化版单一 SVG AI 图标（呼吸+轻微脉冲） === */
.ai-simple-icon {
  display: inline-flex;
  width: 28px; /* 原 56px 缩小 50% */
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(22, 93, 255, 0.14);
  position: relative;
  overflow: visible;
  --ai-icon-color: #165dff;
}
.ai-simple-icon svg {
  width: 22px; /* 原 44px */
  height: 22px;
  display: block;
  animation: aiSimpleBreath 4.5s ease-in-out infinite;
  filter: drop-shadow(0 2px 6px rgba(22, 93, 255, 0.35));
}
@media (max-width: 640px) {
  .ai-simple-icon {
    width: 24px;
    height: 24px;
  }
  .ai-simple-icon svg {
    width: 20px;
    height: 20px;
  }
}
@keyframes aiSimpleBreath {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}
.ai-simple-icon::before,
.ai-simple-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(22, 93, 255, 0.6),
    rgba(22, 93, 255, 0) 60%
  );
  animation: aiSimplePulse 6s ease-in-out infinite;
  opacity: 0.55;
  pointer-events: none;
}
.ai-simple-icon::after {
  animation-delay: 3s;
  opacity: 0.4;
}
@keyframes aiSimplePulse {
  0%,
  100% {
    transform: scale(0.85);
    opacity: 0.55;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.1;
  }
}
[data-theme="dark"] .ai-simple-icon {
  background: rgba(22, 93, 255, 0.18);
}
[data-theme="dark"] .ai-simple-icon svg {
  filter: drop-shadow(0 4px 12px rgba(22, 93, 255, 0.55));
}

/* 移除旧脉冲光圈空间占位影响 */
.ai-summary .summary-header .ai-pulse {
  display: none !important;
}

/* AI 图标 */
.ai-summary .ai-icon {
  font-size: 24px;
  color: #3b82f6;
  animation: aiPulse 2s ease-in-out infinite;
  position: relative;
  z-index: 2;
}

/* AI 脉冲环 */
.ai-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border: 2px solid #3b82f6;
  border-radius: 50%;
  opacity: 0;
  animation: pulse 2s ease-out infinite;
}

/* 标题（统一 h3 与 .summary-title） */
.ai-summary .summary-header h3,
.ai-summary .summary-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1e40af;
  background: linear-gradient(
    45deg,
    var(--ai-heading-grad-start),
    var(--ai-heading-grad-end)
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* 内容区域：提供初始最小高度防止分析行消失时收缩跳动 */
.ai-summary .summary-content {
  position: relative;
  z-index: 2;
  min-height: 52px; /* 约等于两行文本高度 */
  transition: min-height 0.3s ease;
}

/* 思考指示器：绝对定位覆盖，避免占据文档流导致后续塌陷 */
.thinking-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ai-thinking-fg, #6b7280);
  font-size: 14px;
  padding: 4px 0;
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

/* 思考点动画 - 确保动画正常工作 */
.thinking-dot {
  width: 6px;
  height: 6px;
  background-color: var(--ai-thinking-dot, #3b82f6);
  border-radius: 50%;
  display: block; /* 确保是块级元素 */
  flex-shrink: 0; /* 防止压缩 */
  animation: thinkingDots 1.3s ease-in-out infinite;
  transform-origin: center;
}

.thinking-dot:nth-child(1) {
  animation-delay: 0s;
}
.thinking-dot:nth-child(2) {
  animation-delay: 0.15s;
}
.thinking-dot:nth-child(3) {
  animation-delay: 0.3s;
}

.thinking-text {
  margin-left: 2px;
  font-style: italic;
  color: currentColor;
  opacity: 0.9;
  letter-spacing: 0.2px;
}

/* 动画定义 - 确保关键帧存在且正确 */
@keyframes thinkingDots {
  0%,
  25% {
    opacity: 0.35;
    transform: translateY(0) scale(1);
  }
  45% {
    opacity: 1;
    transform: translateY(-3px) scale(1.15);
  }
  70%,
  100% {
    opacity: 0.35;
    transform: translateY(0) scale(1);
  }
}

@keyframes aiPulse {
  0%,
  100% {
    transform: scale(1);
    color: #3b82f6;
  }
  50% {
    transform: scale(1.1);
    color: #1d4ed8;
  }
}

@keyframes pulse {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  50% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.6);
  }
}

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

/* 深色模式适配 */
[data-theme="dark"] .ai-summary {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-color: #334155;
}

[data-theme="dark"] .ai-summary .summary-header h3,
[data-theme="dark"] .ai-summary .summary-title {
  color: #60a5fa;
  background: linear-gradient(45deg, #60a5fa, #3b82f6);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="dark"] .ai-summary .summary-text p {
  color: #e2e8f0;
}

[data-theme="dark"] .ai-summary .ai-icon {
  color: #60a5fa;
}

[data-theme="dark"] .ai-pulse {
  border-color: #60a5fa;
}

[data-theme="dark"] .thinking-dot {
  background-color: #60a5fa;
}

[data-theme="dark"] .thinking-text {
  color: #94a3b8;
}

[data-theme="dark"] .ai-badge {
  color: #94a3b8;
  background: rgba(96, 165, 250, 0.06);
  border-color: rgba(96, 165, 250, 0.1);
}

[data-theme="dark"] .ai-badge::before {
  opacity: 0.4;
}

/* 悬停效果 */
.ai-summary.hovered {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
  transition: all 0.3s ease;
}

/* 完成状态 */
.ai-summary.typing-complete .summary-text p::after {
  display: none;
}

/* 无动画版本 */
.ai-summary.no-animation * {
  animation: none !important;
}

.ai-summary.no-animation .thinking-indicator {
  display: none !important;
}

.ai-summary.no-animation .summary-text {
  display: block !important;
}

.ai-summary.no-animation .summary-footer {
  opacity: 1 !important;
}

/* 重播提示（可选） - 调整位置 */
.ai-summary.typing-complete .summary-content::after {
  content: "双击重播动画";
  position: absolute;
  bottom: -16px; /* 调整位置 */
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px; /* 减小字体 */
  color: #94a3b8;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.ai-summary.typing-complete:hover .summary-content::after {
  opacity: 1;
}

/* 减少动画偏好 - 修正这部分，确保动画偏好检测正确 */
@media (prefers-reduced-motion: reduce) {
  .ai-summary .ai-icon,
  .ai-pulse,
  .thinking-dot {
    animation: none !important;
  }

  .summary-text p::after {
    animation: none !important;
    content: "";
  }

  /* 为减少动画用户提供静态指示 */
  .thinking-dot {
    opacity: 0.6;
    transform: none;
  }
}

/* 确保动画在所有浏览器中正常工作 */
.thinking-dot {
  -webkit-animation: thinkingDots 1.4s ease-in-out infinite;
  -moz-animation: thinkingDots 1.4s ease-in-out infinite;
  -o-animation: thinkingDots 1.4s ease-in-out infinite;
  animation: thinkingDots 1.4s ease-in-out infinite;
}

.ai-summary .ai-icon {
  -webkit-animation: aiPulse 2s ease-in-out infinite;
  -moz-animation: aiPulse 2s ease-in-out infinite;
  -o-animation: aiPulse 2s ease-in-out infinite;
  animation: aiPulse 2s ease-in-out infinite;
}

.ai-pulse {
  -webkit-animation: pulse 2s ease-out infinite;
  -moz-animation: pulse 2s ease-out infinite;
  -o-animation: pulse 2s ease-out infinite;
  animation: pulse 2s ease-out infinite;
}

/* 摘要文本 */
.summary-text p {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: #374151;
  position: relative;
  padding-bottom: 2px; /* 大幅减少为页脚预留的空间 */
}

/* AI 摘要打字光标：改用内联 span，避免块级换行导致单独一行 */
.summary-text p .typing-caret {
  display: inline-block;
  width: 1px;
  height: 1.1em;
  vertical-align: text-bottom;
  background: #3b82f6;
  margin-left: 2px;
  animation: blink 1s steps(2, start) infinite;
}

/* 初始隐藏摘要文本容器（等待首段开始打字再显示，避免空壳 + 单竖线闪现） */
/* 仅在加载时隐藏正文文本，不隐藏思考指示器 */
/* 改用透明度，避免显示/隐藏引起的回流高度跳动 */
/* 兼容旧属性 data-loading 仍可能存在的情况 */
.ai-summary[data-loading="1"] .summary-text {
  opacity: 0;
}
.ai-summary[data-loading="0"] .summary-text {
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* 新阶段控制：thinking | typing | done */
.ai-summary[data-phase="thinking"] .summary-text {
  opacity: 0;
}
.ai-summary[data-phase="typing"] .summary-text {
  opacity: 1;
  transition: opacity 0.25s ease;
}
.ai-summary[data-phase="done"] .summary-text {
  opacity: 1;
}
.ai-summary[data-phase="typing"] .thinking-indicator,
.ai-summary[data-phase="done"] .thinking-indicator {
  opacity: 0;
  pointer-events: none;
}
.ai-summary[data-phase="typing"] .summary-content,
.ai-summary[data-phase="done"] .summary-content {
  min-height: 0;
}

/* 页脚 - 重新设计为嵌入式背景样式 */
.summary-footer {
  position: relative;
  margin-top: 4px; /* 进一步减少上边距 */
  padding: 0;
  border: none; /* 移除边框 */
  text-align: right;
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 2;
  height: auto; /* 自适应高度 */
  line-height: 1; /* 减少行高 */
}

/* AI 徽标 - 更加紧凑的设计 */
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px; /* 减少图标和文字间距 */
  font-size: 9px; /* 进一步减小字体 */
  line-height: 1; /* 减少行高 */
  color: #64748b;
  background: rgba(59, 130, 246, 0.06); /* 更淡的背景 */
  padding: 1px 4px; /* 进一步减小内边距 */
  border-radius: 6px; /* 减小圆角 */
  border: 1px solid rgba(59, 130, 246, 0.1);
  position: relative;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  vertical-align: baseline; /* 避免额外的基线偏移 */
}

/* 可选：调整小图标大小 */
.ai-badge::before {
  content: "✨";
  font-size: 7px; /* 减小图标尺寸 */
  opacity: 0.6;
  line-height: 1;
}

/* 需求：移除徽章前的星星图标 */
.ai-badge.no-star::before,
.ai-badge--provider::before {
  content: none !important;
  display: none !important;
}

/* 精细调：桌面端希望底部更紧凑时可单独覆写（若不需要可删除） */
.ai-summary.tight-bottom {
  padding: 18px 20px 12px;
}

/* 深色模式适配 */
[data-theme="dark"] .ai-badge {
  color: #94a3b8;
  background: rgba(96, 165, 250, 0.06);
  border-color: rgba(96, 165, 250, 0.1);
}

[data-theme="dark"] .ai-badge::before {
  opacity: 0.4;
}

/* 响应式适配 */
@media (max-width: 768px) {
  .ai-summary {
    padding: 14px 16px 10px;
    margin: 16px 0;
  }

  .ai-summary .summary-header h3 {
    font-size: 16px;
  }

  .ai-summary .summary-text p {
    font-size: 14px;
    padding-bottom: 1px; /* 移动端更紧凑 */
  }

  .ai-badge {
    font-size: 8px; /* 移动端更小字体 */
    padding: 1px 3px;
    gap: 1px;
  }

  .ai-badge::before {
    font-size: 6px;
  }

  .thinking-indicator {
    padding: 8px 0;
  }

  .summary-footer {
    margin-top: 3px; /* 移动端进一步减少间距 */
  }
}

@media (max-width: 480px) {
  .ai-summary {
    padding: 12px 14px 8px;
  }

  .summary-footer {
    margin-top: 2px;
  }
}

/* 文章目录样式（重写） */
.article-toc {
  position: fixed;
  top: 0; /* 由 JS 实时设置 */
  left: 0; /* 由 JS 实时设置 */
  width: 280px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(20px);
  /* 加上 top 的过渡，配合 JS 惯性更顺滑 */
  transition: top 0.25s ease-out, opacity 0.3s ease, transform 0.3s ease,
    visibility 0.3s ease;
  will-change: top, left, transform;
  z-index: 100;
}
/* 小屏兜底隐藏可保留；移除响应式 left 的兜底，避免视觉错觉 */
@media (max-width: 1400px) {
  .article-toc {
    font-size: 0.85rem; /* 超小屏再小一点 */
  }
}

.article-toc.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/* 评论区淡出状态（不抢事件） */
.article-toc.u-fade-out {
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
}

/* 强制隐藏（空间不足/无目录项时） */
.article-toc.u-hidden {
  display: none !important;
}

/* 目录卡片 */
.toc-container {
  background: var(--color-background);
  border-radius: 8px;
  padding: 0.8rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--color-border);
  /* 高度自适应：随目录项增多而增长 */
  height: auto;
  max-height: none;
  display: block;
  overflow: visible;
}

.toc-title {
  font-size: 1rem;
  font-weight: 540;
  color: var(--color-text);
  margin: 0 0 0.55rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: space-between;
  cursor: grab; /* 显示抓手光标，提示可拖动 */
}

.toc-title i {
  color: var(--color-primary);
  font-size: 1.1rem;
}

/* 关闭按钮 */
.toc-close {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  color: var(--color-text-light);
  font-size: 16px;
  line-height: 1;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}
.toc-close:hover,
.toc-close:focus-visible {
  background: var(--color-background-light);
  color: var(--color-text);
  outline: none;
}

/* 拖拽时的视觉反馈 */
.article-toc.dragging .toc-title {
  cursor: grabbing;
}
.article-toc.dragging .toc-container {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  z-index: 1000;
}

/* 底部操作按钮 */
.toc-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.55rem;
  margin-top: 0.55rem;
  border-top: 1px solid var(--color-border);
}
.toc-btn {
  /* 图标按钮：去除外圈、仅显示图标 */
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  padding: 4px; /* 点击热区更友好，视觉仍为纯图标 */
  border: none;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
}
.toc-btn i {
  color: var(--color-primary);
  font-size: 20px;
  transition: transform 0.15s ease, color 0.2s ease;
}
.toc-btn:hover {
  /* 仅图标放大，按钮本体不改变背景/边框 */
  background: transparent;
}
.toc-btn:hover i {
  transform: scale(1.15);
}
.toc-btn:active i {
  transform: scale(0.98);
}

/* 禁用状态（无上一篇/下一篇时） */
.toc-btn[disabled],
.toc-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.2);
}
.toc-btn[disabled]:hover,
.toc-btn[aria-disabled="true"]:hover {
  background: transparent;
}
.toc-btn[disabled] i,
.toc-btn[aria-disabled="true"] i {
  transform: none;
}

/* 无障碍隐藏文本 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 暗色模式适配 */
[data-theme="dark"] .toc-btn {
  background: transparent;
}
[data-theme="dark"] .toc-close:hover,
[data-theme="dark"] .toc-close:focus-visible {
  background: var(--color-background);
}

.toc-list {
  /* 目录列表不滚动；高度随内容撑开 */
  overflow: visible;
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-item {
  list-style: none;
  margin: 0.25rem 0;
  line-height: 1.4;
}
.toc-item.level-2 {
  padding-left: 0;
}
.toc-item.level-3 {
  padding-left: 1.2em;
}
.toc-item.level-4 {
  padding-left: 2.4em;
}
.toc-item.level-5 {
  padding-left: 3.6em;
}
.toc-item.level-6 {
  padding-left: 4.8em;
}

.toc-link {
  display: block;
  padding: 0.2rem 0.3rem;
  color: var(--color-text);
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.85rem;
  transition: color 0.2s ease, background 0.2s ease, opacity 0.2s ease,
    filter 0.2s ease, transform 0.18s ease;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform-origin: left center;
}
.toc-link:hover {
  color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.08);
  opacity: 1;
}
.toc-link.active {
  color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.1);
  font-weight: 500;
  opacity: 1;
  transform: scale(1.06);
}

/* 朦胧效果：当鼠标未悬浮在 TOC 上时，非当前项降低对比度/轻微虚化 */
.toc-container:not(:hover) .toc-link:not(.active) {
  opacity: 0.5;
  filter: blur(0.25px) brightness(0.96);
}

/* 目录不同层级字号区分，避免占满宽度 */
.toc-item.level-2 > .toc-link {
  font-size: 0.95rem;
  font-weight: 400;
}
.toc-item.level-3 > .toc-link {
  font-size: 0.85rem;
}
.toc-item.level-4 > .toc-link {
  font-size: 0.75rem;
}
.toc-item.level-5 > .toc-link {
  font-size: 0.65rem;
}
.toc-item.level-6 > .toc-link {
  font-size: 0.6rem;
}

/* 去除自定义滚动条（列表不再滚动） */

/* 修复锚点被固定头部遮挡（JS 会设置 --fixed-header-offset） */
.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
  scroll-margin-top: var(--fixed-header-offset, 100px);
}

/* 深色模式 */
[data-theme="dark"] .toc-container {
  background: var(--color-background);
  border-color: var(--color-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* 响应式兜底（JS 会优先计算定位） */
@media (max-width: 1400px) {
  .article-toc {
    display: none !important;
  }
}
