/* =============================================================
   滚动进度/回到顶部（头部工具栏按钮）
   - 顶部隐藏；下拉显示圆形进度（1-100）
   - 到底部变为椭圆显示“回到顶部”，悬浮显示火箭图标
   - 使用 CSS 变量 --progress 控制 conic-gradient 角度
   ============================================================= */
.header-tools .scroll-progress[hidden] {
  display: none !important;
}
.header-tools .scroll-progress {
  --size: 34px;
  --ring-thickness: 4px; /* 外圈厚度 */
  --progress: 0; /* 0-100 */
  position: relative;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  padding: 0;
  outline: none;
  border: none;
  /* 单一进度：主色弧 + 透明剩余；无黑刻度 */
  background: conic-gradient(
    var(--primary-color) calc(var(--progress) * 1%),
    rgba(0, 0, 0, 0.08) 0
  );
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.25s ease;
}
/* 按钮槽：保持固定尺寸防止抖动；内部通过绝对定位切换 */
.header-tools .tool-button-slot {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
}
.theme-toggle {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle-btn {
  --tt-size: 40px;
  --tt-bg: var(--color-background-light);
  --tt-bg-hover: var(--color-background);
  --tt-border: rgba(0, 0, 0, 0.08);
  --tt-icon-color: var(--color-text);
  --tt-icon-color-dark: var(--color-text);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  width: var(--tt-size);
  height: var(--tt-size);
  padding: 0;
  border: none;
  cursor: pointer;
  border-radius: 10px;
  background: var(--tt-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  transition: background 0.25s, box-shadow 0.25s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--tt-border) inset;
  font: inherit;
  color: var(--tt-icon-color);
}
[data-theme="dark"] .theme-toggle-btn {
  --tt-bg: rgba(255, 255, 255, 0.06);
  --tt-bg-hover: rgba(255, 255, 255, 0.16);
  --tt-border: rgba(255, 255, 255, 0.15);
  --tt-icon-color: var(--tt-icon-color-dark);
}
.theme-toggle-btn:hover,
.theme-toggle-btn:focus-visible {
  background: var(--tt-bg-hover);
}
.theme-toggle-btn:active {
  transform: translateY(1px);
}
.theme-toggle-btn .icon {
  position: absolute;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  top: 50%;
  left: 50%;
  transform-origin: center;
  color: currentColor;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.4) rotate(-45deg);
  transition: opacity 0.5s cubic-bezier(0.65, 0.05, 0.36, 1),
    transform 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  pointer-events: none;
}
.theme-toggle-btn .icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.theme-toggle-btn[data-mode="light"] .icon--sun,
.theme-toggle-btn[data-mode="dark"] .icon--moon,
.theme-toggle-btn[data-mode="system"] .icon--system {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1) rotate(0deg);
}
.theme-toggle-btn.switching .icon {
  transition-duration: 0.35s, 0.45s;
}
.theme-toggle-btn:focus-visible {
  box-shadow: 0 0 0 2px var(--focus-ring, #5b9dd9),
    0 0 0 4px rgba(30, 140, 190, 0.35);
}
[data-theme="dark"] .theme-toggle-btn:focus-visible {
  box-shadow: 0 0 0 2px #4da3ff, 0 0 0 4px rgba(77, 163, 255, 0.35);
}
@media (prefers-reduced-motion: reduce) {
  .theme-toggle-btn .icon {
    transition: opacity 0.25s linear, transform 0.25s linear;
  }
}
/* --------------------------------------------------
   Compact Header Search (Migrated Custom Style)
   基于用户提供的 uiverse.io 设计，适配主题变量与暗色模式
   结构：
   <form class="search-form--compact">
     <label class="wl-search-label">
       <input class="wl-search-input" />
       <span class="wl-search-shortcut">⌘K</span>
     </label>
   -------------------------------------------------- */
.search-form--compact {
  position: relative;
  display: flex;
  align-items: center;
}
.wl-search-label {
  --wl-search-base: 180px; /* 基础宽度 */
  position: relative;
  display: block;
  width: var(--wl-search-base);
  max-width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 5px 8px 5px 9px;
  background: var(--color-background-light);
  box-shadow: none;
  transition: border-color 0.25s, background 0.25s;
}
[data-theme="dark"] .wl-search-label {
  background: rgba(255, 255, 255, 0.06);
  /* 移除暗色模式下的外部阴影 */
  box-shadow: none;
}
.wl-search-label:focus-within {
  border-color: var(--color-primary);
  background: var(--color-background);
  z-index: 20;
}
.wl-search-input {
  width: 100%;
  background: transparent;
  border: 0;
  outline: none;
  font-size: 14px;
  line-height: 1.3;
  color: var(--color-text);
  font-family: inherit;
  padding: 0;
}
.wl-search-input::placeholder {
  color: var(--color-text-light);
  opacity: 0.8;
}
.wl-search-shortcut {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--color-text-light);
  background: var(--color-background);
  border: 1px solid var(--color-border);
  padding: 2px 6px 3px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  pointer-events: none;
}
.wl-search-shortcut.is-mac {
  /* 放大按钮，缩小内部文字，保持正方形 */
  padding: 0;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 12px;
  justify-content: center;
  line-height: 1;
}
[data-theme="dark"] .wl-search-shortcut {
  background: rgba(255, 255, 255, 0.08);
}
.wl-search-label:hover .wl-search-shortcut {
  color: var(--color-text);
}
.wl-search-submit {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
@media (max-width: 780px) {
  .wl-search-label {
    --wl-search-base: 160px;
  }
}
@media (max-width: 520px) {
  .wl-search-label {
    --wl-search-base: 140px;
    padding: 4px 7px 4px 8px;
  }
  .wl-search-input {
    font-size: 13px;
  }
  .wl-search-shortcut {
    display: none;
  }
}
.theme-toggle {
  z-index: 2;
  transition: opacity 0.35s ease;
}
#scrollProgress {
  z-index: 1;
}
.site-header.show-scroll-progress .theme-toggle {
  opacity: 0;
  pointer-events: none;
}
.site-header.show-scroll-progress.is-complete .theme-toggle,
.site-header.is-complete .theme-toggle {
  opacity: 1;
  pointer-events: auto;
}

/* =========================
  Theme dropdown selector
  ========================= */
.theme-dropdown {
  position: relative;
  width: 40px;
  height: 40px;
}
.theme-dropdown-toggle {
  position: relative;
}
.theme-dropdown-toggle.theme-dropdown-toggle {
  border-radius: 50%;
  background: var(--color-background-light);
  width: 40px;
  height: 40px;
  transition: background 0.25s, color 0.25s;
}
.theme-dropdown-toggle:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
[data-theme="dark"] .theme-dropdown-toggle {
  background: var(--color-background);
}
[data-theme="dark"] .theme-dropdown-toggle:hover {
  background: var(--color-primary);
}
.theme-icon-stack {
  position: absolute;
  inset: 0;
  display: block;
}
/* 绝对居中三枚图标，固定 24px 避免不同 SVG viewBox 造成视觉偏移 */
.theme-icon-stack .ti {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%) scale(0.55) rotate(-35deg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s cubic-bezier(0.6, 0.05, 0.3, 1),
    transform 0.55s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
.theme-icon-stack .ti svg {
  width: 100%;
  height: 100%;
  display: block;
}
.theme-icon-stack .ti[data-active] {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1) rotate(0deg);
}
.theme-dropdown.open .theme-icon-stack .ti[data-active] {
  animation: themeIconPulse 0.6s ease;
}
@keyframes themeIconPulse {
  0% {
    transform: translate(-50%, -50%) scale(0.85);
    opacity: 0.6;
  }
  55% {
    transform: translate(-50%, -50%) scale(1.15);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}
.theme-dropdown-menu {
  position: absolute;
  top: 46px;
  right: 0;
  min-width: 160px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 40;
}
.theme-dropdown.open .theme-dropdown-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
[data-theme="dark"] .theme-dropdown-menu {
  background: var(--color-background);
  border-color: var(--color-border);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
}
.theme-option {
  --opt-radius: 8px;
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: var(--opt-radius);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--color-text);
  transition: background 0.25s, color 0.25s;
}
.theme-option:hover,
.theme-option:focus-visible {
  background: var(--color-background-light);
  outline: none;
}
[data-theme="dark"] .theme-option:hover,
[data-theme="dark"] .theme-option:focus-visible {
  background: rgba(255, 255, 255, 0.06);
}
.theme-option[aria-checked="true"] {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.theme-option[aria-checked="true"] .option-icon {
  color: inherit;
}
.theme-option .option-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-light);
}
.theme-option .option-label {
  flex: 1;
  font-size: 0.85rem;
}
.theme-dropdown.close-leave .theme-dropdown-menu {
  opacity: 0;
  transform: translateY(6px);
}
@media (max-width: 768px) {
  .theme-dropdown-menu {
    right: auto;
    left: 0;
  }
}

/* Hide dropdown during scroll progress if slot reused */
.site-header.show-scroll-progress .theme-dropdown {
  opacity: 0;
  pointer-events: none;
}
.site-header.show-scroll-progress.is-complete .theme-dropdown {
  opacity: 1;
  pointer-events: auto;
}
.header-tools .tool-button-slot .tool-button {
  position: absolute;
  inset: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.header-tools .tool-button {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
}
.header-tools .tool-button > i {
  font-size: 18px;
}
.header-tools .tool-button-slot .theme-switch {
  padding: 0;
  line-height: 1;
}
.header-tools .tool-button-slot .theme-switch .icon-swap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.header-tools .tool-button-slot .theme-switch .icon-swap i {
  line-height: 1;
}
.header-tools .tool-button-slot .theme-switch .icon-swap {
  position: relative;
}
.header-tools .tool-button-slot .theme-switch .icon-swap i.icon-theme {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 1em;
  height: 1em;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
/* 初始消除字体加载导致的上跳：提前指定字体平滑与渲染基准 */
.header-tools .tool-button i {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.header-tools .tool-button-slot .scroll-progress {
  display: none;
}
.site-header.show-scroll-progress .tool-button-slot .scroll-progress {
  display: inline-flex;
}
/* 100% 完成：常驻图标，隐藏数字 */
.scroll-progress.is-complete .progress-text {
  display: none;
}
.scroll-progress.is-complete .progress-icon {
  opacity: 1 !important;
  transform: scale(1) !important;
}
/* 工具栏所有按钮内图标绝对居中（不影响进度按钮内部结构） */
.header-tools .tool-button:not(.scroll-progress) i {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  line-height: 1;
  width: 1em;
  height: 1em;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* 若按钮有多图标切换容器（.icon-swap），保持容器填满并允许 hover 切换 */
.header-tools .tool-button:not(.scroll-progress) .icon-swap {
  position: relative;
  width: 100%;
  height: 100%;
}
.header-tools .tool-button:not(.scroll-progress) .icon-swap i {
  font-size: 18px;
}
/* 内心遮盖形成环效果 */
.header-tools .scroll-progress::after {
  content: "";
  position: absolute;
  inset: var(--ring-thickness);
  background: var(--color-background, #fff);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
/* 数字层级需在内心之上 */
.header-tools .scroll-progress .progress-text {
  position: relative;
  font-size: 0;
  z-index: 1;
}
.header-tools .scroll-progress .progress-text::before {
  content: attr(data-percent);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text, #333);
}
[data-theme="dark"] .header-tools .scroll-progress {
  background: conic-gradient(
    var(--primary-color) calc(var(--progress) * 1%),
    rgba(255, 255, 255, 0.12) 0
  );
}
[data-theme="dark"] .header-tools .scroll-progress::after {
  background: var(--color-background, #1c2227);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .header-tools .scroll-progress .progress-text::before {
  color: var(--color-text, #e6e6e6);
}
.header-tools .scroll-progress .progress-visual {
  position: absolute;
  inset: var(--ring);
  background: var(--surface, #fff);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  /* 不拦截点击，确保按钮任意位置可点击 */
  pointer-events: none;
}
.header-tools .scroll-progress .progress-text {
  position: relative;
  font-size: 0; /* 隐藏原始文本，使用 ::before 渲染 */
  line-height: 1;
  /* 避免“回到顶部”在窄屏被挤换行 */
  white-space: nowrap;
}
.header-tools .scroll-progress .progress-text::before {
  content: attr(data-percent);
  font-size: 12px;
  font-weight: 600;
  color: currentColor;
}

/* 避免继承通用 .tool-button:hover 导致文字/进度不可见：强制悬浮时保留本组件配色 */
.header-tools .tool-button.scroll-progress:hover:not(.at-bottom) {
  color: var(--color-text) !important;
  background: conic-gradient(
      var(--primary-color) calc(var(--progress) * 1%),
      rgba(0, 0, 0, 0.08) 0
    ),
    repeating-conic-gradient(
      var(--tick-color, rgba(0, 0, 0, 0.14)) 0deg 2deg,
      transparent 2deg 10deg
    ) !important;
}
[data-theme="dark"]
  .header-tools
  .tool-button.scroll-progress:hover:not(.at-bottom) {
  color: var(--text-color, #e6e6e6) !important;
  background: conic-gradient(
      var(--primary-color) calc(var(--progress) * 1%),
      rgba(255, 255, 255, 0.12) 0
    ),
    repeating-conic-gradient(
      var(--tick-color, rgba(255, 255, 255, 0.22)) 0deg 2deg,
      transparent 2deg 10deg
    ) !important;
}

/* 移除底部胶囊模式：保持圆形；兼容已存在类不做尺寸/布局改变 */
.header-tools .scroll-progress.at-bottom {
  width: var(--size);
  border-radius: 50%;
  padding: 0;
  background: conic-gradient(
      var(--primary-color) calc(var(--progress) * 1%),
      rgba(0, 0, 0, 0.08) 0
    ),
    repeating-conic-gradient(
      var(--tick-color, rgba(0, 0, 0, 0.14)) 0deg 2deg,
      transparent 2deg 10deg
    );
}
.header-tools .scroll-progress.at-bottom .progress-visual {
  display: block;
}
.header-tools .scroll-progress.at-bottom .progress-text::before {
  content: attr(data-percent);
}
.header-tools .scroll-progress.at-bottom .rocket-icon {
  display: none;
}

/* 悬浮/焦点：数字变向上箭头，保持蓝色（主色）；不再使用火箭元素 */
/* 图标切换：默认显示数字，hover/focus 显示 Font Awesome 圆形向上箭头图标 */
.header-tools .scroll-progress .progress-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
  transition: opacity 0.22s ease,
    transform 0.25s cubic-bezier(0.4, 0.14, 0.3, 1);
  color: var(--primary-color);
  font-size: calc(var(--size) * 0.72);
  z-index: 2;
}
.header-tools .scroll-progress:hover .progress-icon,
.header-tools .scroll-progress:focus-visible .progress-icon {
  opacity: 1;
  transform: scale(1);
}
.header-tools .scroll-progress:hover .progress-text::before,
.header-tools .scroll-progress:focus-visible .progress-text::before {
  opacity: 0;
}
.header-tools .scroll-progress .progress-text::before {
  transition: opacity 0.18s ease;
}

/* 悬浮时：圆形显示轻微阴影，底部状态显示火箭 */
/* Hover 与其他按钮保持一致（浅色模式下内部填充轻微高亮） */
.header-tools .scroll-progress:hover:not(.at-bottom) {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.header-tools .scroll-progress:hover::after {
  background: var(--color-background-hover, #f5f7fa);
}
[data-theme="dark"] .header-tools .scroll-progress:hover::after {
  background: var(--color-background, #1c2227); /* 深色保持原样 */
}

/* 键盘可见焦点样式（可访问性） */
.header-tools .scroll-progress:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb, 1, 102, 204), 0.35),
    0 2px 8px rgba(0, 0, 0, 0.12);
}

/* 文本保持纯数字，不替换为“回到顶部” */

/* 无障碍：在所有页面提供 .sr-only 工具类（避免仅单页才隐藏） */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 顶部时隐藏，由 JS 控制 hidden 属性，这里仅提供过渡兜底 */

/* 暗色模式适配 */
[data-theme="dark"] .header-tools .scroll-progress {
  --tick-color: rgba(255, 255, 255, 0.22);
  background: conic-gradient(
      var(--primary-color) calc(var(--progress) * 1%),
      rgba(255, 255, 255, 0.12) 0
    ),
    repeating-conic-gradient(
      var(--tick-color) 0deg 2deg,
      transparent 2deg 10deg
    );
  color: var(--text-color, #e6e6e6);
}
[data-theme="dark"] .header-tools .scroll-progress .progress-visual {
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
/* 深色下保持圆形同逻辑（无需特殊 at-bottom 状态） */
/* 旧 progress-arrow / rocket 结构已移除，保留此注释提示历史：
  现采用 ::before 切换字符实现 hover 箭头 */

/* 响应式尺寸略缩小 */
@media (max-width: 480px) {
  .header-tools .scroll-progress {
    --size: 30px;
    --ring: 2.5px;
  }
  .header-tools .scroll-progress.at-bottom {
    width: 108px;
  }
  .header-tools .scroll-progress .progress-text {
    font-size: 11px;
  }
}
/**
 * 头部样式（精简优化版）
 * - 保留：头部基础/Logo/工具按钮/搜索/主题切换/用户菜单/登录模态
 * - 导航样式与行为交由 modules/nav.css 处理（不在此处隐藏/显示）
 */

/*--------------------------------------------------------------
>>> 头部基础
--------------------------------------------------------------*/
.site-header {
  background: var(--color-background);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0;
  width: 100%;
  margin: 0 0 var(--header-content-gap, 16px);
  /* 移除滚动隐藏逻辑：保持始终可见 */
}

/* 主行：单行四列（站点菜单 | LOGO/标题 | 主导航 | 工具区） */
.header-wrapper {
  display: grid;
  grid-template-columns: auto auto 1fr auto; /* 左左中右 */
  align-items: center;
  column-gap: 12px;
  padding: 8px 0; /* 左右留白由 .header-content 控制 */
  position: relative;
}

/* 明确四列放置 */
.site-menu-wrapper {
  grid-column: 1;
}
.site-branding {
  grid-column: 2;
}
.site-header .main-navigation {
  grid-column: 3;
}
.header-tools {
  grid-column: 4;
}

/* 将头部内容限制在居中的容器内 */
.header-content {
  /* 宽度与 .container 对齐，具体值在 main.css 中统一设置 */
  max-width: var(--container-width, 1160px);
  margin: 0 auto;
  padding: 0 var(--container-padding, 16px);
  position: relative; /* 作为进度条的定位上下文 */
}

/* 顶行三块（左：菜单 | 中：Logo/标题 | 右：工具）作为独立 flex 项 */
.site-menu-wrapper,
.site-branding,
.header-tools {
  display: flex;
  align-items: center;
}
.header-tools {
  gap: 8px;
  justify-self: end;
}

/* 确保四列各就各位：左列左对齐，中列左对齐，导航居中，右列右对齐 */
.site-menu-wrapper {
  justify-self: start;
}
.site-branding {
  justify-self: start;
}
.site-header .main-navigation {
  justify-self: center;
}
.header-tools {
  justify-self: end;
  margin-left: auto;
}

/* 主导航位于第三列，容器内居中 */
.site-header .main-navigation {
  position: static;
  left: auto;
  top: auto;
  transform: none;
  max-width: 100%;
  white-space: nowrap;
  grid-column: 3;
  justify-self: center;
}
/* 居中对齐主导航菜单 */
.site-header .main-navigation .nav-menu {
  display: flex;
  gap: 5px;
  justify-content: center;
  align-items: center;
}

/* 小屏头部布局：单行布局（左菜单按钮 | 中站点标题 | 右工具） */
@media (max-width: 768px) {
  .header-wrapper {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto;
    align-items: center;
    gap: 0.75rem 0.5rem;
    padding: 8px 12px; /* 小屏依旧保留内部留白 */
  }

  /* 左侧：移动菜单按钮 */
  .mobile-menu-toggle {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--color-background-light);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
  }

  .mobile-menu-toggle:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-text-inverse);
    transform: scale(1.05);
  }

  .mobile-menu-toggle:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
  }

  .mobile-menu-toggle i {
    font-size: 14px;
    transition: transform 0.2s ease;
  }

  .mobile-menu-toggle:hover i {
    transform: scale(1.1);
  }

  .site-branding {
    grid-column: 2;
    grid-row: 1;
    justify-self: start; /* 紧跟菜单按钮，不居中 */
    align-self: center;
    margin: 0;
    text-align: left;
  }

  .site-branding .site-title {
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }

  /* 隐藏桌面站点菜单入口 */
  .site-menu-wrapper {
    display: none !important; /* 移动端隐藏桌面站点菜单入口 */
  }

  .header-tools {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* 保险：隐藏站点菜单切换按钮（指南针） */
  .site-menu-toggle {
    display: none !important;
  }

  /* 隐藏桌面版主导航 */
  .site-header .main-navigation {
    display: none;
  }

  /* 桌面版主导航在移动端隐藏 */

  /* 确保工具栏在小屏幕下正常显示 */
  .header-tools {
    display: flex;
    align-items: center;
    gap: 8px;
  }
}

/* 超小屏优化 */
@media (max-width: 480px) {
  .site-header {
    padding: 0; /* 顶边贴边 */
  }

  .header-wrapper {
    gap: 0.5rem;
    padding: 8px 12px; /* 维持内部控件留白 */
  }

  /* 站点菜单下拉框适配超小屏 */
  .site-menu-dropdown {
    width: calc(var(--vw) - 24px);
    left: -12px;
  }

  /* 工具栏按钮间距调整 */
  .tool-group {
    gap: 6px;
  }

  /* 搜索框在超小屏下简化 */
  .search-input-wrapper {
    max-width: 120px;
  }

  .search-field {
    font-size: 14px;
    padding: 6px 8px;
  }

  /* 主题切换按钮尺寸 */
  .theme-switch {
    width: 32px;
    height: 32px;
  }
}

/* 极小屏（iPhone SE等） */
@media (max-width: 375px) {
  .header-wrapper {
    padding: 0 8px;
  }

  .search-input-wrapper {
    max-width: 100px;
  }
}

/*--------------------------------------------------------------
>>> 站点标题/Logo（单/双 Logo 适配）
--------------------------------------------------------------*/
.site-branding {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* 手机端Logo和标题适配 */
@media (max-width: 768px) {
  .site-branding {
    flex-shrink: 1;
    min-width: 0;
  }

  /* 手机端隐藏Logo图片，只显示文字 */
  .site-branding .custom-logo {
    display: none;
  }

  /* 确保站点标题一行显示 */
  .site-branding .site-title-wrapper {
    display: flex;
    align-items: center;
    min-width: 0;
  }

  .site-branding .site-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
  }

  .site-branding .site-title a {
    color: var(--color-text);
    text-decoration: none;
  }
}
.site-branding .custom-logo-link {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  position: relative;
  overflow: visible;
  isolation: isolate;
}

/* 单图滤镜变量（双图自动禁用） */
[data-theme],
:root {
  --logo-filter: none;
  --logo-hover-filter: drop-shadow(
      0 6px 18px rgba(var(--color-primary-rgb, 1, 102, 204), 0.35)
    )
    saturate(1.08) brightness(1.05);
}
[data-theme="dark"] {
  --logo-filter: saturate(0) contrast(130%) brightness(100%) invert(1);
  --logo-hover-filter: saturate(0) contrast(140%) brightness(105%) invert(1)
    drop-shadow(0 8px 20px rgba(var(--color-primary-rgb, 1, 102, 204), 0.45));
}
.site-branding .custom-logo {
  height: auto;
  max-height: 42px;
  max-width: 200px;
  width: auto;
  object-fit: contain;
  vertical-align: middle;
  filter: var(--logo-filter);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform, filter;
}

/* 双 Logo 自动切换（.has-dual-logo） */
.site-branding .custom-logo-link.has-dual-logo .logo--light {
  display: inline-block;
}
.site-branding .custom-logo-link.has-dual-logo .logo--dark {
  display: none;
}
[data-theme="dark"]
  .site-branding
  .custom-logo-link.has-dual-logo
  .logo--light {
  display: none;
}
[data-theme="dark"] .site-branding .custom-logo-link.has-dual-logo .logo--dark {
  display: inline-block;
}

/* 双图禁用反色滤镜，仅保留悬浮发光 */
.site-branding .custom-logo-link.has-dual-logo .custom-logo {
  filter: none;
}
.site-branding .custom-logo-link.has-dual-logo:hover .custom-logo {
  filter: drop-shadow(
      0 6px 18px rgba(var(--color-primary-rgb, 1, 102, 204), 0.35)
    )
    saturate(1.08) brightness(1.05);
}

/* 悬浮光晕层 */
.site-branding .custom-logo-link::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 16px;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
      60% 60% at 50% 50%,
      rgba(var(--color-primary-rgb, 1, 102, 204), 0.25) 0%,
      rgba(var(--color-primary-rgb, 1, 102, 204), 0) 60%
    ),
    radial-gradient(
      35% 35% at 25% 35%,
      rgba(255, 255, 255, 0.2) 0%,
      rgba(255, 255, 255, 0) 60%
    );
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.35s ease, transform 0.35s ease, filter 0.35s ease;
  filter: blur(0);
}
.site-branding .custom-logo-link:hover::before {
  opacity: 1;
  transform: scale(1);
  filter: blur(0.5px);
}
.site-branding .custom-logo-link:hover .custom-logo {
  transform: scale(1.05) rotate(0.4deg);
  filter: var(--logo-hover-filter);
}

[data-theme="dark"] .site-branding .custom-logo-link::before {
  background: radial-gradient(
      60% 60% at 50% 50%,
      rgba(var(--color-primary-rgb, 1, 102, 204), 0.35) 0%,
      rgba(var(--color-primary-rgb, 1, 102, 204), 0) 60%
    ),
    radial-gradient(
      35% 35% at 25% 35%,
      rgba(255, 255, 255, 0.15) 0%,
      rgba(255, 255, 255, 0) 60%
    );
}

@media (max-width: 992px) {
  .site-branding .custom-logo {
    max-height: 38px;
    max-width: 180px;
  }
}
@media (max-width: 768px) {
  .site-branding .custom-logo {
    max-height: 32px;
    max-width: 160px;
  }
}

/* 文字标题兜底 */
.site-title {
  margin: 0;
  font-size: 2rem;
  line-height: 1.4;
}
.site-title a {
  color: var(--color-heading);
  text-decoration: none;
  font-family: "Source Han Serif CN", serif;
  font-weight: 900;
  transition: color 0.3s ease;
}
/* 根据需要，标题可在小屏断行，默认不强制 nowrap 以避免布局挤压 */
.site-title a:hover {
  color: var(--color-primary);
}
[data-theme="dark"] .site-title a {
  color: var(--color-text-inverse);
}

/*--------------------------------------------------------------
>>> 工具按钮
--------------------------------------------------------------*/
.header-tools {
  display: flex;
  align-items: center;
  /* 与居中布局一致，不再向右推 */
  margin-left: 0;
}
.tool-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: var(--color-background-light);
  color: var(--color-text);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tool-button i {
  font-size: 1.1rem;
  transition: transform 0.3s ease;
}
.tool-button:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
/* 通用按钮 hover 放大对绝对定位+翻转的随机按钮造成干扰，这里改成只对非随机按钮生效 */
.tool-button:hover i {
  transform: scale(1.2);
}
.tool-button.random-post:hover i,
.random-post.tool-button:hover i {
  transform: none; /* 禁用通用 scale */
}

/* 随机文章按钮：固定尺寸，消除字体/行高引起的跳动 */
.random-post {
  position: relative;
  width: 40px;
  height: 40px;
  line-height: 0; /* 移除基线影响 */
  font-size: 18px; /* 与40尺寸匹配 */
  -webkit-font-smoothing: antialiased;
  will-change: transform;
}
/* 新结构：内层 rp-icon 绝对 + translate 精准居中，避免字体与按钮尺寸差异导致位移 */
.random-post .rp-icon {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.random-post .rp-icon i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: 0;
  display: block;
  transform: translate(-50%, -50%);
  transform-origin: 50% 50%;
  transition: transform 0.4s cubic-bezier(0.55, 0.1, 0.4, 1);
  backface-visibility: hidden;
  will-change: transform;
}
.random-post:hover .rp-icon i {
  transform: translate(-50%, -50%) rotate(200deg);
}
.random-post.u-loading {
  pointer-events: none;
  opacity: 0.85;
}
.random-post .wl-loading-indicator {
  /* 专用覆盖：避免 modules/loading.css 中的背景 & 圆角 & transition:all 造成尺寸闪动 */
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent !important; /* 取消通用层的背景填充，避免亮/暗模式下闪一下 */
  border-radius: 0 !important; /* 避免与工具按钮自身圆角叠加产生视觉扩大 */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  --rp-spinner-size: 24px; /* 可调：加载圈直径（默认24，可按需 20/22/28） */
}
/* 使用纯 CSS ring 替换字体图标，避免字体度量引起中心微偏 */
.random-post .wl-loading-indicator i {
  /* 占位（可移除），保持最小影响 */
  display: none !important;
}
.random-post .wl-loading-indicator::before,
.random-post .wl-loading-indicator::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--rp-spinner-size);
  height: var(--rp-spinner-size);
  margin: 0;
  padding: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
}
/* 外环：淡色轨道 */
.random-post .wl-loading-indicator::before {
  border: 3px solid var(--color-border, rgba(0, 0, 0, 0.15));
  opacity: 0.45;
}
/* 内环：主色 + 旋转缺口 */
.random-post .wl-loading-indicator::after {
  border: 3px solid var(--color-primary);
  border-color: var(--color-primary) var(--color-primary) var(--color-primary)
    transparent;
  animation: rpRingSpin 0.8s linear infinite;
}
@keyframes rpRingSpin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}
.random-post.u-loading .rp-icon {
  opacity: 0;
  visibility: hidden;
}
.random-post.u-loading .wl-loading-indicator {
  opacity: 1;
  visibility: visible;
}
@keyframes wlSpin {
  to {
    transform: rotate(360deg);
  }
}

[data-theme="dark"] .tool-button {
  background: var(--color-background);
  color: var(--color-text);
}
[data-theme="dark"] .tool-button:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

@media (max-width: 1200px) {
  .tool-group {
    gap: 6px;
  }
}
@media (max-width: 768px) {
  .tool-group {
    gap: 4px;
  }
  .tool-button {
    width: 32px;
    height: 32px;
  }
  .tool-button i {
    font-size: 1rem;
  }
}
@media (max-width: 480px) {
  .tool-group {
    gap: 3px;
  }
  .tool-button {
    width: 30px;
    height: 30px;
  }
}

/*--------------------------------------------------------------
>>> 搜索框与搜索模态
--------------------------------------------------------------*/
.search-form {
  position: relative;
}
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-field {
  width: 180px;
  height: 36px;
  padding: 0 36px 0 1rem;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  background: var(--color-background-light);
  color: var(--color-text);
  font-size: 0.9rem;
  transition: all 0.3s ease;
}
.search-field:focus {
  width: 300px;
  border-color: var(--color-primary);
  outline: none;
}
.search-field::placeholder {
  color: var(--color-text-light);
  opacity: 0.7;
}

.search-submit {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}
.search-submit:hover {
  color: var(--color-primary);
}

/* 移动端：搜索改为按钮形态（隐藏输入框） */
@media (max-width: 768px) {
  .search-wrapper {
    margin: 0;
    display: inline-flex;
    align-items: center;
  }
  .search-wrapper .search-form {
    display: contents;
  }
  .search-wrapper .search-input-wrapper {
    display: contents;
    height: auto;
  }
  .search-wrapper .search-field {
    display: none !important;
  }
  .search-wrapper .search-submit {
    position: static !important;
    right: auto;
    top: auto;
    transform: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--color-background-light);
    color: var(--color-text);
    transition: background-color 0.18s ease, color 0.18s ease,
      transform 0.18s ease;
  }
  .search-wrapper .search-submit i {
    font-size: 1rem;
    line-height: 1;
  }
  .search-wrapper .search-submit:hover {
    background: var(--color-primary);
    color: var(--color-text-inverse);
  }
}

/* 搜索模态 */
.search-modal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  z-index: 5000; /* 全局UI层：搜索遮罩 */
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
.search-modal.active {
  opacity: 1;
  visibility: visible;
}

.search-modal-inner {
  position: relative;
  width: 90%;
  max-width: 800px;
  margin: 80px auto 0;
  background: var(--color-background);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}
.search-modal.active .search-modal-inner {
  transform: translateY(0);
}

.modal-search-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}
.search-icon {
  font-size: 1.2rem;
  color: var(--color-primary);
}
.modal-search-form {
  flex: 1;
}
.modal-search-field {
  width: 100%;
  padding: 0.8rem;
  border: 0;
  background: none;
  font-size: 1.2rem;
  color: var(--color-text);
}
.modal-search-field:focus {
  outline: none;
}
.modal-search-field::placeholder {
  color: var(--color-text-light);
}

.search-shortcut {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  background: var(--color-background-light);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--color-text-light);
}
.search-close {
  padding: 0.5rem;
  background: none;
  border: 0;
  color: var(--color-text-light);
  cursor: pointer;
  transition: color 0.2s ease;
}
.search-close:hover {
  color: var(--color-primary);
}

.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.search-item {
  padding: 0.8rem;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}
.search-item:hover {
  background: var(--color-background-light);
}
.search-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: var(--color-text);
}
.search-title {
  font-size: 1rem;
}
.search-date {
  font-size: 0.85rem;
  color: var(--color-text-light);
}
.highlight {
  color: var(--color-primary);
  font-weight: 500;
}
.view-all {
  display: block;
  text-align: center;
  padding: 1rem;
  margin-top: 1rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}
.search-wrapper {
  position: relative;
  margin-right: 1rem;
}

/* 暗色适配（搜索） */
[data-theme="dark"] .search-field {
  background: var(--color-background);
  border-color: var(--color-border);
  color: var(--color-text);
}
[data-theme="dark"] .search-field:focus {
  background: var(--color-background-light);
  border-color: var(--color-primary);
}
[data-theme="dark"] .search-field::placeholder {
  color: var(--color-text-light);
  opacity: 0.5;
}
[data-theme="dark"] .search-modal {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
}
[data-theme="dark"] .search-modal-inner {
  background: var(--color-background);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--color-border);
}
[data-theme="dark"] .modal-search-field {
  color: var(--color-text);
}
[data-theme="dark"] .search-shortcut {
  background: var(--color-background);
  border-color: var(--color-border);
}
[data-theme="dark"] .search-close:hover {
  background: var(--color-background-light);
}

/* (旧 .theme-switch 样式已移除，改用 .theme-toggle-btn 三态动画组件) */

/* 主题图标轻微脉冲动画（点击切换时） */
.theme-switch .icon-theme.is-pulse {
  animation: wlThemePulse 0.38s ease;
}
@keyframes wlThemePulse {
  0% {
    transform: scale(0.9);
    opacity: 0.6;
  }
  55% {
    transform: scale(1.08);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .theme-switch .icon-theme.is-pulse {
    animation: none;
  }
}

/* 通用微型旋转器 */
.u-spinner {
  display: inline-block;
  line-height: 1;
}
.u-spinner > i,
.u-spinner.i,
i.u-spinner {
  animation: wlSpin 0.85s linear infinite;
}
@keyframes wlSpin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Sun/Moon SVG toggle animation (Type-Delta, adapted) --- */
.themeToggle {
  /* 使用按钮原色，便于 currentColor 传递给 SVG */
  color: var(--color-text);
}
.st-sunMoonThemeToggleBtn {
  position: relative;
  cursor: pointer;
}
.st-sunMoonThemeToggleBtn .themeToggleInput {
  opacity: 0;
  width: 100%;
  aspect-ratio: 1;
}
.st-sunMoonThemeToggleBtn svg {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.1rem; /* 与 .tool-button i 字号一致 */
  height: 1.1rem;
  transition: transform 0.4s ease;
  transform: translate(-50%, -50%) rotate(40deg);
}
.st-sunMoonThemeToggleBtn svg .sunMoon {
  transform-origin: center center;
  /* 更顺滑的弹性过渡 */
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform: scale(1);
}
.st-sunMoonThemeToggleBtn svg .sunRay {
  transform-origin: center center;
  transform: scale(0);
}
.st-sunMoonThemeToggleBtn svg mask > circle {
  transition: transform 0.64s cubic-bezier(0.41, 0.64, 0.32, 1.575);
  transform: translate(0px, 0px);
}
.st-sunMoonThemeToggleBtn svg .sunRay2 {
  animation-delay: 0.05s !important;
}
.st-sunMoonThemeToggleBtn svg .sunRay3 {
  animation-delay: 0.1s !important;
}
.st-sunMoonThemeToggleBtn svg .sunRay4 {
  animation-delay: 0.17s !important;
}
.st-sunMoonThemeToggleBtn svg .sunRay5 {
  animation-delay: 0.25s !important;
}
.st-sunMoonThemeToggleBtn svg .sunRay6 {
  animation-delay: 0.29s !important;
}

.st-sunMoonThemeToggleBtn .themeToggleInput:checked + svg {
  transform: translate(-50%, -50%) rotate(90deg);
}
.st-sunMoonThemeToggleBtn .themeToggleInput:checked + svg mask > circle {
  transform: translate(16px, -3px);
}
.st-sunMoonThemeToggleBtn .themeToggleInput:checked + svg .sunMoon {
  transform: scale(0.55);
}
.st-sunMoonThemeToggleBtn .themeToggleInput:checked + svg .sunRay {
  animation: showRay1832 0.4s ease 0s 1 forwards;
}

@keyframes showRay1832 {
  0% {
    transform: scale(0);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 768px) {
  .theme-toggle-btn {
    --tt-size: 32px;
  }
}

/* === 功能面板按钮双态（四格 -> 变形布局） === */
.site-panel-toggle .icon-swap {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
}
.site-panel-toggle .icon-swap .icon-default,
.site-panel-toggle .icon-swap .icon-hover {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1) rotate(0deg);
  font-size: 24px;
  line-height: 1;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.38s ease,
    transform 0.55s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
.site-panel-toggle .icon-swap .icon-default {
  opacity: 1;
}
.site-panel-toggle .icon-swap .icon-hover {
  transform: translate(-50%, -50%) scale(0.55) rotate(-25deg);
}
.site-panel-toggle:hover .icon-swap .icon-default,
.site-panel-toggle:focus-visible .icon-swap .icon-default {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.55) rotate(25deg);
}
.site-panel-toggle:hover .icon-swap .icon-hover,
.site-panel-toggle:focus-visible .icon-swap .icon-hover {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1) rotate(0deg);
}
.site-panel-toggle:active .icon-swap .icon-hover,
.site-panel-toggle:active .icon-swap .icon-default {
  transform: translate(-50%, -50%) scale(0.92);
  transition: transform 0.15s ease;
}

/*--------------------------------------------------------------
>>> 用户菜单 / 登录模态
--------------------------------------------------------------*/
.user-profile {
  position: relative;
}
.user-avatar {
  padding: 0 !important;
  overflow: hidden;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: all 0.25s ease;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06),
    0 0 0 1px var(--color-border, rgba(0, 0, 0, 0.08));
}
.user-avatar:hover {
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12),
    0 0 0 1px var(--color-border, rgba(0, 0, 0, 0.1));
}
.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* === 登录后头像 -> 退出图标 双态切换 === */
.user-avatar .icon-swap {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}
.user-avatar .icon-swap .avatar-default,
.user-avatar .icon-swap .icon-hover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.28s ease;
  will-change: opacity;
}
.user-avatar .icon-swap .avatar-default {
  opacity: 1;
  pointer-events: auto;
}
.user-avatar .icon-swap .avatar-default img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.user-avatar .icon-swap .icon-hover {
  font-size: 18px;
  color: #dc2626;
  opacity: 0;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18));
}
.user-profile:hover .user-avatar .icon-swap .avatar-default,
.user-avatar:focus-visible .icon-swap .avatar-default {
  opacity: 0;
}
.user-profile:hover .user-avatar .icon-swap .icon-hover,
.user-avatar:focus-visible .icon-swap .icon-hover {
  opacity: 1;
}
/* 去除激活缩放，保持视觉中心固定 */
@media (prefers-reduced-motion: reduce) {
  .user-avatar .icon-swap .avatar-default,
  .user-avatar .icon-swap .icon-hover {
    transition: none;
  }
}

/* 深色模式下退出图标略微提亮避免与背景混淆 */
[data-theme="dark"] .user-avatar {
  background: #1f252b;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 4px 10px -2px rgba(0, 0, 0, 0.55);
}
[data-theme="dark"] .user-avatar:hover {
  background: #232a31;
}
[data-theme="dark"] .user-avatar .icon-swap .icon-hover {
  color: #f87171;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

/* === 精简用户信息行（名字 + 角色徽章） === */
.user-dropdown .user-info-line {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  line-height: 1.1;
}
.user-dropdown .user-info-line .user-name {
  font-weight: 600;
  color: var(--color-primary, #1d4ed8); /* 设为主色/蓝色 */
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.2px;
}
/* 左右对齐：名称靠左，徽章靠右 */
.user-dropdown .user-info-line {
  justify-content: space-between;
}
.user-dropdown .user-info-line .user-name {
  flex: 1 1 auto;
}
.user-dropdown .user-info-line .user-role-badge {
  margin-left: 12px;
  flex-shrink: 0;
}
[data-theme="dark"] .user-dropdown .user-info-line .user-name {
  color: var(--color-primary, #60a5fa);
}

/* === 角色徽章基础 === */
.user-role-badge {
  --badge-bg: var(--badge-bg-base, #eef1f5);
  --badge-fg: var(--badge-fg-base, #334155);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  height: 18px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
  border-radius: 9px;
  background: var(--badge-bg);
  color: var(--badge-fg);
  line-height: 1;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04);
  backdrop-filter: saturate(1.2);
}
.user-role-badge::after {
  display: none;
}

/* 角色色系（浅色） */
.user-role-badge.role-administrator {
  --badge-bg: #dceeff; /* 蓝色浅背景 */
  --badge-fg: #075985; /* 深蓝文字 */
}
.user-role-badge.role-editor {
  --badge-bg: #e4e9ff;
  --badge-fg: #3730a3;
}
.user-role-badge.role-author {
  --badge-bg: #d9f7eb;
  --badge-fg: #046348;
}
.user-role-badge.role-contributor {
  --badge-bg: #fff1d6;
  --badge-fg: #9a5807;
}
.user-role-badge.role-subscriber {
  --badge-bg: #edf1f5;
  --badge-fg: #334155;
}
.user-role-badge.role- {
  --badge-bg: #edf1f5;
  --badge-fg: #334155;
}

/* 深色模式下调整背景透明度与前景亮度 */
[data-theme="dark"] .user-role-badge {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .user-role-badge.role-administrator {
  --badge-bg: rgba(59, 130, 246, 0.22); /* blue-500 透明背景 */
  --badge-fg: #93c5fd; /* blue-300 文本 */
}
[data-theme="dark"] .user-role-badge.role-editor {
  --badge-bg: rgba(129, 140, 248, 0.18);
  --badge-fg: #c7d2fe;
}
[data-theme="dark"] .user-role-badge.role-author {
  --badge-bg: rgba(16, 185, 129, 0.18);
  --badge-fg: #6ee7b7;
}
[data-theme="dark"] .user-role-badge.role-contributor {
  --badge-bg: rgba(251, 191, 36, 0.18);
  --badge-fg: #fcd34d;
}
[data-theme="dark"] .user-role-badge.role-subscriber {
  --badge-bg: rgba(156, 163, 175, 0.18);
  --badge-fg: #e2e8f0;
}

/* hover 主菜单时徽章保持不变避免干扰 */
.user-role-badge {
  transition: background 0.25s ease, color 0.25s ease;
}
.user-profile:hover .user-role-badge {
  filter: brightness(1.08);
}

@media (max-width: 420px) {
  .user-dropdown {
    right: 0;
  }
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 25px);
  right: -100px;
  width: 240px;
  background: var(--color-background);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.2s ease;
  z-index: 1000;
}
.user-profile:hover .user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-info {
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--color-border);
}
.user-avatar-large {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
}
.user-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.user-meta {
  flex: 1;
}
.user-name {
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}
.user-role {
  font-size: 0.85rem;
  color: var(--color-text-light);
}

.user-links {
  padding: 0.5rem;
}
.user-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--color-text);
  border-radius: 8px;
  transition: all 0.2s ease;
}
.user-link:hover {
  background: var(--color-background-light);
  color: var(--color-primary);
}
.user-link.logout {
  color: #dc2626;
}
.user-link.logout:hover {
  background: #fee2e2;
  color: #dc2626;
}

.login-button {
  background: var(--color-background-light);
}
.login-button:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

/* 登录按钮白底覆盖：图标变绿色时背景保持白色 */
.login-button:hover,
.login-button:focus-visible {
  background: #fff !important;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.08);
}
[data-theme="dark"] .login-button:hover,
[data-theme="dark"] .login-button:focus-visible {
  background: #fff !important;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 2px 4px -1px rgba(0, 0, 0, 0.4);
}
/* Active 仍保持压下反馈 */
.login-button:active {
  background: #fff !important;
}

/* === 登录按钮双态切换动画及绿色悬浮色 === */
.login-button .icon-swap {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
}
.login-button .icon-swap .icon-default,
.login-button .icon-swap .icon-hover {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1) rotate(0deg);
  font-size: 20px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.35s ease,
    transform 0.55s cubic-bezier(0.68, -0.55, 0.27, 1.55), color 0.3s ease;
}
.login-button .icon-swap .icon-default {
  opacity: 1;
}
.login-button .icon-swap .icon-hover {
  transform: translate(-50%, -50%) scale(0.55) rotate(-25deg);
  color: var(--login-accent, #2eaf66);
}
.login-button:hover .icon-swap .icon-default,
.login-button:focus-visible .icon-swap .icon-default {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.55) rotate(25deg);
}
.login-button:hover .icon-swap .icon-hover,
.login-button:focus-visible .icon-swap .icon-hover {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1) rotate(0deg);
}
.login-button:active .icon-swap .icon-hover,
.login-button:active .icon-swap .icon-default {
  transform: translate(-50%, -50%) scale(0.9);
  transition: transform 0.15s ease;
}

/* 可配置登录主题色变量（可在主题设置里注入 --login-accent） */
:root {
  --login-accent: #2eaf66;
}

[data-theme="dark"] .user-dropdown {
  background: var(--color-background);
  border: 1px solid var(--color-border);
}
[data-theme="dark"] .user-link:hover {
  background: var(--color-background-light);
}
[data-theme="dark"] .user-link.logout:hover {
  background: rgba(220, 38, 38, 0.1);
}

/* 登录模态 */
.login-modal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5001; /* 全局UI层：退出确认遮罩 */
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.login-modal.active {
  opacity: 1;
  visibility: visible;
}
.login-modal-inner {
  position: relative;
  width: 90%;
  max-width: 400px;
  margin: auto;
  background: var(--color-background);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}
.login-modal.active .login-modal-inner {
  transform: translateY(0);
}

.login-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--color-border);
}
.login-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--color-text);
}
.modal-close {
  width: 32px;
  height: 32px;
  border: 0;
  background: var(--color-background-light);
  color: var(--color-text);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.modal-close:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  transform: rotate(90deg);
}

.login-content {
  padding: 20px;
}

/* 表单（登录/找回公用） */
.login-form .form-group,
.forgot-form .form-group {
  margin-bottom: 20px;
}
.login-form label,
.forgot-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--color-text);
  font-size: 0.9rem;
}
.login-form input,
.forgot-form input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-background-light);
  color: var(--color-text);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}
.login-form input:focus,
.forgot-form input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb, 1, 102, 204), 0.1);
}

/* 密码显隐 */
.password-input {
  position: relative;
}
.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  color: var(--color-text-light);
  cursor: pointer;
  padding: 0;
}

/* 记住我/忘记密码 */
.form-check {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 15px 0;
}
.form-check label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  cursor: pointer;
}
.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}
.form-check label span {
  color: var(--color-text);
  font-size: 0.9rem;
  user-select: none;
}
.forgot-password {
  color: var(--color-primary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}
.forgot-password:hover {
  text-decoration: underline;
}
@media (max-width: 768px) {
  .form-check {
    margin: 12px 0;
  }
  .form-check label span {
    font-size: 0.85rem;
  }
}

/* 找回密码显隐 */
.forgot-form {
  display: none;
  padding: 20px;
}
.forgot-form.active {
  display: block;
}
.login-form.hide {
  display: none;
}

/* 提交按钮 */
.submit-btn,
.login-form .submit-btn,
.forgot-form .submit-btn {
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 6px;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}
.submit-btn:hover {
  background: var(--color-primary-dark, var(--color-primary));
  transform: translateY(-1px);
}
.submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.login-error,
.login-message {
  padding: 12px;
  margin-bottom: 15px;
  border-radius: 6px;
  font-size: 14px;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}
.login-error {
  background: #fff5f5;
  color: #e53e3e;
  border: 1px solid #feb2b2;
}
.login-message {
  background: #f0fff4;
  color: #38a169;
  border: 1px solid #9ae6b4;
}
.login-error.show,
.login-message.show {
  opacity: 1;
  transform: translateY(0);
}

.login-message.login-success {
  background: #e7f6ed;
  color: #0a5132;
  border: 1px solid #9ddfc3;
}
.login-message.login-error {
  background: #fee7e7;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}
.login-message i {
  font-size: 1.1em;
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

/* 暗色适配（登录） */
[data-theme="dark"] .forgot-form input {
  background: var(--color-background);
  border-color: var(--color-border);
  color: var(--color-text);
}
[data-theme="dark"] .forgot-form input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb, 1, 102, 204), 0.15);
}

/*--------------------------------------------------------------
>>> 基线对齐（桌面端）
--------------------------------------------------------------*/
@media (min-width: 769px) {
  :root {
    --hdr-item-h: 36px;
  }

  .site-header .header-wrapper {
    align-items: center;
  }

  .site-menu-wrapper,
  .site-branding,
  .site-header .main-navigation,
  .header-tools,
  .header-tools .tool-group,
  .search-wrapper,
  .search-wrapper .search-input-wrapper {
    display: flex;
    align-items: center;
    min-height: var(--hdr-item-h);
  }

  .tool-button,
  .theme-switch,
  .search-wrapper .search-submit,
  .user-profile .user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--hdr-item-h);
    height: var(--hdr-item-h);
    box-sizing: border-box;
  }

  .search-form {
    margin: 0;
  }
  .search-field {
    height: var(--hdr-item-h);
    line-height: var(--hdr-item-h);
    padding: 0 12px;
    margin: 0;
    box-sizing: border-box;
  }

  .user-profile .user-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .site-branding .custom-logo-link {
    line-height: 0;
  }
  .main-navigation.hover-icons .nav-menu > li {
    line-height: 0;
  }
  .main-navigation.hover-icons .nav-menu > li > a i {
    line-height: 1;
  }

  .site-branding,
  .site-menu-wrapper,
  .site-header .main-navigation,
  .search-wrapper,
  .header-tools {
    margin-top: 0;
    margin-bottom: 0;
  }
}

/*--------------------------------------------------------------
>>> 移动端菜单样式
--------------------------------------------------------------*/

/* 移动端菜单按钮（默认隐藏） */
.mobile-menu-toggle {
  display: none;
}

/* 移动端菜单覆盖层 */
.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 4999; /* 全局UI层：移动菜单遮罩 */
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* 移动端菜单容器 */
.mobile-menu-container {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background: var(--color-card-background);
  border-right: 1px solid var(--color-border);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 5000; /* 全局UI层：移动菜单 */
  overflow-y: auto;
  transition: all 0.3s ease;
  padding: 1rem 0;
  padding-top: 3rem; /* 为关闭按钮留出空间 */
}

.mobile-menu-container.active {
  left: 0;
}

/* 移动端菜单列表 */
.mobile-nav-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-nav-menu li {
  border-bottom: 1px solid var(--color-border-light);
}

.mobile-nav-menu li:last-child {
  border-bottom: none;
}

.mobile-nav-menu a {
  display: block;
  padding: 1rem 1.5rem;
  color: var(--color-text);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.mobile-nav-menu a:hover,
.mobile-nav-menu a:focus {
  background: var(--color-background-light);
  color: var(--color-primary);
}

/* 移动端菜单关闭按钮 */
.mobile-menu-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-background-light);
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.2s ease;
}
.mobile-menu-close:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-inverse);
}
.mobile-menu-close:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.mobile-menu-close i {
  font-size: 14px;
}

/* 移动端菜单子菜单 */
.mobile-nav-menu .sub-menu {
  background: var(--color-background-light);
  border-top: 1px solid var(--color-border-light);
}

.mobile-nav-menu .sub-menu a {
  padding-left: 2.5rem;
  font-size: 0.9rem;
  color: var(--color-text-light);
}

.mobile-nav-menu .sub-menu a:hover {
  color: var(--color-primary);
}

/* 深色模式适配 */
[data-theme="dark"] .mobile-menu-container {
  background: var(--color-background);
  border-right-color: var(--color-border);
}

[data-theme="dark"] .mobile-menu-overlay {
  background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .mobile-menu-toggle {
  background: var(--color-background-light);
  border-color: var(--color-border);
}

[data-theme="dark"] .mobile-menu-toggle:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-inverse);
}

[data-theme="dark"] .mobile-menu-toggle:focus-visible {
  outline-color: var(--color-primary);
}

[data-theme="dark"] .mobile-menu-close {
  background: var(--color-background-light);
  border-color: var(--color-border);
}
[data-theme="dark"] .mobile-menu-close:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-inverse);
}
[data-theme="dark"] .mobile-menu-close:focus-visible {
  outline-color: var(--color-primary);
}

/* 移动端显示菜单按钮 */
@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
  }
}
/* =============================================================
     头部公告（外置样式）
     - 固定在 header 下方左侧空白区域，10s 自动隐藏（交互在 nav.js）
     ============================================================= */
.wl-header-notice.wl-floating-left {
  position: fixed;
  /* 固定定位，避免随 header 结构重叠 */
  left: 12px; /* 初始值，脚本会更新 */
  top: 12px; /* 初始值，脚本会更新为 header 底部 + 间距 */
  z-index: 1000;
  max-width: min(520px, 72vw);
  pointer-events: auto;
}
.wl-header-notice .notice-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px 8px 8px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.12);
  -webkit-backdrop-filter: saturate(1.2) blur(6px);
  backdrop-filter: saturate(1.2) blur(6px);
  color: var(--color-text);
  transform: translateY(8px);
  opacity: 0;
  animation: wlNoticeFloatIn 0.45s ease-out 0.1s forwards;
}
.wl-header-notice .notice-content {
  flex: 1;
  line-height: 1.45;
}
.wl-header-notice .notice-content a {
  color: #10b981;
  text-decoration: underline;
}
.wl-header-notice .notice-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.wl-header-notice .notice-icon i {
  font-size: 15px;
  background: conic-gradient(
    from 180deg,
    #10b981,
    #22d3ee,
    #f59e0b,
    #ef4444,
    #8b5cf6,
    #10b981
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.wl-header-notice .notice-close {
  appearance: none;
  border: 0;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.14);
  color: #059669;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.wl-header-notice .notice-close:hover {
  background: rgba(16, 185, 129, 0.22);
  transform: rotate(90deg);
}
@keyframes wlNoticeFloatIn {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
[data-theme="dark"] .wl-header-notice .notice-inner {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.28);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}
@media (max-width: 420px) {
  .wl-header-notice.wl-floating-left {
    max-width: 86vw;
    left: 8px;
    bottom: 6px;
  }
}
/* 火车前进增强：hover/聚焦时轻微上移与速度模糊 */
.wormhole-link .icon-swap {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}
.wormhole-link .icon-swap i {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: transform 0.45s cubic-bezier(0.55, 0.1, 0.4, 1), opacity 0.3s;
}
.wormhole-link .icon-swap .icon-hover {
  opacity: 0;
  pointer-events: none;
}
.wormhole-link:hover .icon-swap .icon-hover,
.wormhole-link:focus-visible .icon-swap .icon-hover {
  opacity: 1;
  pointer-events: auto;
}
.wormhole-link:hover .icon-swap .icon-default,
.wormhole-link:focus-visible .icon-swap .icon-default {
  opacity: 0;
}
.wormhole-link:not(.is-launching):hover .icon-swap .icon-hover {
  /* 改为放大接近效果 */
  transform: translate(-50%, -50%) scale(1.18) translateY(-2px);
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.25));
}
.wormhole-link.is-launching {
  pointer-events: none;
}
.wormhole-link.is-launching .icon-swap .icon-hover {
  /* 启动时显示但不再自身旋转，改用外围圆环旋转 */
  opacity: 1;
  transform: translate(-50%, -50%);
  animation: none;
}
.wormhole-link.is-launching .icon-swap .icon-default {
  opacity: 0;
}
/* 启动时完全隐藏两种图标避免与外部圆环视觉重叠 */
.wormhole-link.is-launching .icon-swap i {
  opacity: 0 !important;
}
.wormhole-link.is-launching::after {
  /* 外部旋转主色圆环（与随机文章加载风格一致） */
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--rp-spinner-size, 20px);
  height: var(--rp-spinner-size, 20px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-sizing: border-box;
  border: 3px solid var(--color-primary);
  border-color: var(--color-primary) var(--color-primary) var(--color-primary)
    transparent;
  animation: rpRingSpin 0.8s linear infinite;
}
/* 移除火车旋转 whSpin，改用统一 rpRingSpin 外环 */
.wormhole-link:hover .icon-swap .icon-hover,
.wormhole-link:focus-visible .icon-swap .icon-hover {
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.25));
  transform: translate(-50%, -50%) scale(1.18) translateY(-2px);
}
.wormhole-link:hover .icon-swap .icon-default,
.wormhole-link:focus-visible .icon-swap .icon-default {
  filter: blur(0.3px);
}

/* 面板展开保持第二图标 */
.panel-open .site-panel-toggle .icon-swap .icon-default {
  opacity: 0 !important;
  transform: translate(-50%, -50%) scale(0.55) rotate(25deg) !important;
}
.panel-open .site-panel-toggle .icon-swap .icon-hover {
  opacity: 1 !important;
  transform: translate(-50%, -50%) scale(1) rotate(0deg) !important;
}

/* === 登出确认弹层 === */
.logout-confirm[aria-hidden="true"] {
  display: none;
}
.logout-confirm {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px) saturate(1.2);
  -webkit-backdrop-filter: blur(4px) saturate(1.2);
  animation: fadeInModal 0.25s ease;
}
.logout-confirm-inner {
  width: min(400px, 90vw);
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 22px 22px 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
  position: relative;
  animation: scaleInModal 0.38s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
.logout-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 600;
}
.logout-desc {
  margin: 0 0 18px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--color-text-light);
}
.logout-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
.logout-actions .btn-logout-cancel,
.logout-actions .btn-logout-confirm {
  cursor: pointer;
  border: 0;
  font: inherit;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px;
  line-height: 1;
  transition: background 0.25s, color 0.25s, transform 0.2s;
}
.logout-actions .btn-logout-cancel {
  background: var(--color-background-light);
  color: var(--color-text);
  box-shadow: 0 0 0 1px var(--color-border) inset;
}
.logout-actions .btn-logout-cancel:hover {
  background: var(--color-background);
}
.logout-actions .btn-logout-confirm {
  background: #dc2626;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.logout-actions .btn-logout-confirm:hover {
  background: #b91c1c;
}
.logout-actions .btn-logout-cancel:active,
.logout-actions .btn-logout-confirm:active {
  transform: translateY(1px);
}
@keyframes fadeInModal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes scaleInModal {
  0% {
    transform: scale(0.85);
    opacity: 0.4;
  }
  60% {
    transform: scale(1.04);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}
[data-theme="dark"] .logout-confirm-inner {
  background: var(--color-background);
  border-color: var(--color-border);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}
[data-theme="dark"] .logout-actions .btn-logout-cancel {
  background: var(--color-background);
}
[data-theme="dark"] .logout-actions .btn-logout-cancel:hover {
  background: var(--color-background-light);
}
[data-theme="dark"] .logout-actions .btn-logout-confirm {
  background: #ef4444;
}
[data-theme="dark"] .logout-actions .btn-logout-confirm:hover {
  background: #dc2626;
}

/* ===== 新版登出确认卡片（card 样式） ===== */
.logout-card {
  overflow: hidden;
  position: relative;
  background: var(--color-background, #fff);
  border-radius: 14px;
  max-width: 400px; /* 扩宽以减少换行 */
  width: 100%;
  padding: 0;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.logout-card-header {
  padding: 22px 22px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.logout-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 999px;
  background: #fee2e2;
}
.logout-card-icon svg {
  width: 1.6rem;
  height: 1.6rem;
  color: #dc2626;
}
.logout-card-title {
  margin: 14px 0 6px;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.5rem;
  letter-spacing: 0.3px;
  color: var(--color-heading, #111827);
}
.logout-card-message {
  margin: 0 0 10px;
  padding: 0 10px;
  font-size: 0.84rem;
  line-height: 1.15rem; /* 更紧凑单行 */
  color: var(--color-text-light, #6b7280);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 480px) {
  .logout-card {
    max-width: 92vw;
  }
  .logout-card-message {
    white-space: normal;
    line-height: 1.25rem;
  }
}
.logout-card-actions {
  margin: 14px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f9fafb;
  padding: 14px 14px 16px;
  border-radius: 12px;
}
.logout-card-actions .btn-logout-confirm {
  width: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0.62rem 1rem;
  border-radius: 8px;
  background: #dc2626;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: background 0.25s, box-shadow 0.25s;
}
.logout-card-actions .btn-logout-confirm:hover {
  background: #b91c1c;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
}
.logout-card-actions .btn-logout-cancel {
  width: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0.62rem 1rem;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  border: 1px solid #d1d5db;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.logout-card-actions .btn-logout-cancel:hover {
  background: #f3f4f6;
}

/* 使用原 scale 动画 */
.logout-confirm-inner.logout-card {
  animation: scaleInModal 0.42s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

/* 暗色模式 */
[data-theme="dark"] .logout-card {
  background: var(--color-background, #1e2328);
  box-shadow: 0 18px 40px -8px rgba(0, 0, 0, 0.6);
}
[data-theme="dark"] .logout-card-icon {
  background: rgba(239, 68, 68, 0.18);
}
[data-theme="dark"] .logout-card-icon svg {
  color: #f87171;
}
[data-theme="dark"] .logout-card-title {
  color: #f1f5f9;
}
[data-theme="dark"] .logout-card-message {
  color: #94a3b8;
}
[data-theme="dark"] .logout-card-actions {
  background: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .logout-card-actions .btn-logout-cancel {
  background: var(--color-background, #1e2328);
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.18);
}
[data-theme="dark"] .logout-card-actions .btn-logout-cancel:hover {
  background: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .logout-card-actions .btn-logout-confirm {
  background: #ef4444;
}
[data-theme="dark"] .logout-card-actions .btn-logout-confirm:hover {
  background: #dc2626;
}

/* 焦点可访问性 */
.logout-card-actions .btn-logout-confirm:focus-visible,
.logout-card-actions .btn-logout-cancel:focus-visible {
  outline: 2px solid var(--color-primary, #2563eb);
  outline-offset: 2px;
}
[data-theme="dark"] .logout-card-actions .btn-logout-confirm:focus-visible,
[data-theme="dark"] .logout-card-actions .btn-logout-cancel:focus-visible {
  outline-color: #60a5fa;
}

/* =============================================================
   社交登录占位按钮 (Google / GitHub)
   结构：
   .social-signup-placeholder
     .social-hint
     .social-login-buttons
        button.social-btn.social-btn--google
        button.social-btn.social-btn--github
   需求：两个按钮等宽 / 图标与文字水平对齐 / 暗色模式适配
   ============================================================= */
.login-footer.social-signup-placeholder {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border, #e5e7eb);
}
.social-signup-placeholder .social-hint {
  font-size: 0.8rem;
  color: var(--color-text-light, #6b7280);
  margin: 0 0 10px;
  text-align: left;
  letter-spacing: 0.5px;
}
.social-login-buttons {
  display: flex;
  gap: 10px;
  width: 100%;
}
@media (max-width: 420px) {
  .social-login-buttons {
    flex-direction: column;
    gap: 8px;
  }
}
.social-login-buttons .social-btn {
  --btn-h: 42px;
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--btn-h);
  border: 1px solid var(--color-border, #d1d5db);
  background: var(--color-background, #fff);
  color: var(--color-text, #374151);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 10px;
  padding: 0 14px;
  line-height: 1;
  cursor: not-allowed; /* 占位禁用 */
  position: relative;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.social-login-buttons .social-btn[aria-disabled="true"] {
  opacity: 0.65;
}
.social-login-buttons .social-btn .social-icon {
  display: inline-flex;
  width: 20px; /* 原 18 → 20 与实际 SVG 属性保持一致 */
  height: 20px; /* 原 18 → 20 */
  align-items: center;
  justify-content: center;
}
.social-login-buttons .social-btn svg {
  /* 统一 SVG 尺寸对齐：原 18 → 20 */
  width: 20px;
  height: 20px;
  display: block;
}
/* 暗色模式下 GitHub 图标填充改为白色，仅作用于 GitHub 按钮内部 path */
[data-theme="dark"] .social-login-buttons .social-btn--github svg path {
  fill: #fff !important;
}
/* 预留品牌差异化：
   .social-btn--google / .social-btn--github 若未来启用 hover 状态，可在此添加：
   .social-btn--google:not([aria-disabled="true"]):hover { border-color:#ea4335; }
   .social-btn--github:not([aria-disabled="true"]):hover { border-color:#333; }
*/
[data-theme="dark"] .social-login-buttons .social-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--color-text, #e5e7eb);
}
[data-theme="dark"] .social-login-buttons .social-btn[aria-disabled="true"] {
  opacity: 0.55;
}
.social-later-note {
  margin: 10px 0 0;
  font-size: 0.7rem;
  color: var(--color-text-light, #6b7280);
  letter-spacing: 0.5px;
  text-align: left;
}
[data-theme="dark"] .social-later-note {
  color: #8b95a5;
}

/* 焦点可访问性（若未来启用） */
.social-login-buttons .social-btn:focus-visible {
  outline: 2px solid var(--color-primary, #2563eb);
  outline-offset: 2px;
}
[data-theme="dark"] .social-login-buttons .social-btn:focus-visible {
  outline-color: #60a5fa;
}

/* 预留激活态类（未来接入 OAuth 时可添加 .is-loading 或 .is-active） */
.social-login-buttons .social-btn.is-loading {
  cursor: progress;
  opacity: 0.8;
}
.social-login-buttons .social-btn.is-active {
  box-shadow: 0 0 0 2px var(--color-primary, #2563eb) inset;
}

/* ============================================
   移动端适配 - Header 完整优化
   适用于 768px、480px、375px 断点
   ============================================ */

/* 768px - 平板和小屏设备 */
@media (max-width: 768px) {
  /* Header 基础布局 */
  .site-header {
    padding: 0 16px;
  }

  .header-wrapper {
    gap: 12px;
  }

  /* Logo/站点标题缩小 */
  .site-branding {
    max-width: 150px;
  }

  .custom-logo {
    max-height: 36px;
  }

  .site-title {
    font-size: 1.1rem;
  }

  /* 主导航隐藏（使用菜单按钮替代） */
  .main-navigation {
    display: none;
  }

  /* 菜单按钮显示 */
  .site-menu-toggle {
    display: flex !important;
    width: 40px;
    height: 40px;
  }

  /* 搜索框缩小 */
  .search-wrapper {
    max-width: 140px;
  }

  .wl-search-input {
    font-size: 0.9rem;
    padding: 8px 12px;
  }

  .wl-search-shortcut {
    font-size: 0.75rem;
    padding: 2px 6px;
  }

  /* 工具按钮缩小 */
  .tool-button {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }

  /* 滚动进度按钮 */
  #scrollProgress {
    width: 38px;
    height: 38px;
  }

  .progress-text {
    font-size: 0.7rem;
  }

  /* 用户下拉菜单适配 */
  .user-dropdown {
    right: 0;
    left: auto;
    min-width: 200px;
  }

  /* 登录模态框适配 */
  .login-modal-inner {
    max-width: 90vw;
    margin: 20px auto;
  }

  /* 主题切换下拉菜单 */
  .theme-dropdown-menu {
    right: 0;
    left: auto;
  }
}

/* 480px - 小屏手机 */
@media (max-width: 480px) {
  /* Header 更紧凑 */
  .site-header {
    padding: 0 12px;
  }

  .header-wrapper {
    gap: 8px;
  }

  /* Logo/站点标题进一步缩小 */
  .site-branding {
    max-width: 120px;
  }

  .custom-logo {
    max-height: 32px;
  }

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

  /* 搜索框改为按钮模式或隐藏 */
  .search-wrapper {
    max-width: 100px;
  }

  .wl-search-input {
    font-size: 0.85rem;
    padding: 6px 10px;
  }

  .wl-search-shortcut {
    display: none; /* 隐藏快捷键提示 */
  }

  /* 工具按钮进一步缩小 */
  .tool-button {
    width: 36px;
    height: 36px;
    font-size: 0.95rem;
  }

  .site-menu-toggle {
    width: 36px;
    height: 36px;
  }

  /* 滚动进度按钮 */
  #scrollProgress {
    width: 36px;
    height: 36px;
  }

  .progress-text {
    font-size: 0.65rem;
  }

  /* 登录模态框适配 */
  .login-modal-inner {
    max-width: 95vw;
    padding: 20px 16px;
  }

  .login-header {
    margin-bottom: 16px;
  }

  .modal-title {
    font-size: 1.2rem;
  }

  /* 表单输入框 */
  .form-group input {
    font-size: 0.9rem;
    padding: 10px 12px;
  }

  /* 社交登录按钮 */
  .social-btn {
    font-size: 0.85rem;
    padding: 8px 12px;
  }

  /* 用户下拉菜单 */
  .user-dropdown {
    min-width: 180px;
  }

  .user-name {
    font-size: 0.9rem;
  }

  .user-link {
    font-size: 0.85rem;
    padding: 8px 12px;
  }
}

/* 375px - 超小屏手机 */
@media (max-width: 375px) {
  /* Header 最紧凑布局 */
  .site-header {
    padding: 0 8px;
  }

  .header-wrapper {
    gap: 6px;
  }

  /* Logo 最小尺寸 */
  .site-branding {
    max-width: 100px;
  }

  .custom-logo {
    max-height: 28px;
  }

  .site-title {
    font-size: 0.95rem;
  }

  /* 搜索框隐藏或最小化 */
  .search-wrapper {
    max-width: 80px;
  }

  .wl-search-input {
    font-size: 0.8rem;
    padding: 5px 8px;
  }

  /* 工具按钮最小尺寸 */
  .tool-button,
  .site-menu-toggle,
  #scrollProgress {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

  /* 登录模态框 */
  .login-modal-inner {
    padding: 16px 12px;
  }

  /* 表单 */
  .form-group {
    margin-bottom: 12px;
  }

  .form-group label {
    font-size: 0.85rem;
  }

  .form-group input {
    font-size: 0.85rem;
    padding: 8px 10px;
  }

  /* 按钮 */
  .submit-btn {
    font-size: 0.9rem;
    padding: 10px 16px;
  }
}

/* 横向布局优化 (宽度优先) */
@media (min-width: 769px) and (max-width: 1024px) {
  /* 平板横屏 */
  .search-wrapper {
    max-width: 180px;
  }

  .main-navigation {
    flex: 1;
  }

  .nav-menu {
    gap: 16px;
  }
}

/* 极小屏幕 (<320px) 兜底 */
@media (max-width: 320px) {
  .header-wrapper {
    gap: 4px;
  }

  .site-branding {
    max-width: 80px;
  }

  .tool-button,
  .site-menu-toggle {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
  }

  .search-wrapper {
    display: none; /* 极小屏完全隐藏搜索框 */
  }
}
