/* ============================================================================
 * beauty-panel.css —— 美化设置 2.0（对照 my-blog 的 fomal 面板移植）
 * ----------------------------------------------------------------------------
 * 只在 Winbox 面板 .settings 内生效；页面级规则统一走 html 上的 hg-* 类或 :root 变量。
 * 偏好写入 / 首屏应用见 source/js/fomal/boot.js，面板逻辑见 panel.js。
 * ========================================================================== */

/* ── 本地字体 ────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'LXGWNeoXiHei';
  src: url(/font/霞鹜新晰黑.woff2) format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'SourceHanSerif';
  src: url(/font/思源宋体.woff2) format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'SourceCodePro';
  src: url(/font/SourceCodePro.woff2) format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'MapleMono';
  src: url(/font/MapleMono.woff2) format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'JetBrainsMono';
  src: url(/font/JetBrainsMono.woff2) format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'ZhuZiAWan';
  src: url(/font/筑紫A丸by宁静之雨.woff2) format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'HYTMR';
  src: url(/font/HYTangMeiRen55W.woff2) format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'TTQHB';
  src: url(/font/甜甜圈海报字体.woff2) format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'MiSans';
  src: url(/font/MiSans.woff2) format('woff2');
  font-display: swap;
}

/* 正文与代码字体：变量由 boot.js 在首帧前写好，缺省时仍是原来的霞鹜文楷 / Consolas */
body {
  font-family: var(--hg-text-font, myfont, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif) !important;
}
#article-container pre,
#article-container code,
#article-container kbd,
#article-container samp,
.highlight,
.highlight pre,
.highlight code,
.code-tools,
pre[class*='language-'],
code[class*='language-'],
.settings .ap-code-sample {
  font-family: var(--hg-code-font, Consolas, 'SourceCodePro', monospace) !important;
}

/* ── 页面级外观开关 ──────────────────────────────────────────────────────── */
/* 背景图：变量 + !important，压过主题在 #web_bg 上的内联 background-image 与手机端 !important 规则 */
html.hg-has-bg #web_bg {
  background-image: var(--hg-bg-image) !important;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
}
#web_bg {
  filter: var(--hg-bg-filter, none) !important;
}
html.hg-bg-blurred #web_bg {
  transform: scale(1.03);
  transform-origin: center center;
}
/* 滤镜的轻微缩放需要平滑过渡，不做循环动画 */
#web_bg {
  transition: filter .25s ease, transform .25s ease;
}

/* 顶栏常驻：主题滚动时把 #nav 抬到 top:-60px，这里按需求钉回 0；上滑时的 translate 也一并取消 */
html.hg-nav-always #page-header.nav-fixed #nav {
  top: 0 !important;
  transform: none !important;
}

/* 右侧部件 */
html.hg-rightside-off #rightside {
  display: none !important;
}

/* 侧栏放到左：内容区与侧栏是同一 flex 行，反向排列即可，不动主题源码 */
html.hg-aside-left #content-inner.layout {
  flex-direction: row-reverse;
}
@media (max-width: 900px) {
  html.hg-aside-left #content-inner.layout {
    flex-direction: column;
  }
}
/* 主题只给“侧栏在右”留了 padding-left:15px；反排到左侧后这段空白跑到最外边，
   侧栏和文章就贴在一起了，这里把内边距换到另一边 */
@media (min-width: 900px) {
  html.hg-aside-left #aside-content {
    padding-left: 0 !important;
    padding-right: 15px !important;
  }
}

/* 星空开关：直接让主题的 canvas 不可见，effects.js 的可见性判断会停掉整个绘制循环 */
html.hg-universe-off #universe {
  display: none !important;
}
/* 霓虹彩灯开关：只关暗色下的灯光动画 */
html.hg-neon-off[data-theme='dark'] #site-name,
html.hg-neon-off[data-theme='dark'] #site-title,
html.hg-neon-off[data-theme='dark'] #site-subtitle,
html.hg-neon-off[data-theme='dark'] #post-info,
html.hg-neon-off[data-theme='dark'] #site-name a,
html.hg-neon-off[data-theme='dark'] #site-title a {
  animation: none !important;
  text-shadow: none !important;
}

/* 雪花画布：浅色桌面才显示，层级在壁纸之上、正文之下 */
#snow {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  pointer-events: none;
  user-select: none;
}
html[data-theme='dark'] #snow,
html.hg-snow-on[data-theme='dark'] #snow {
  display: none !important;
}
@media screen and (max-width: 768px) {
  #snow {
    display: none !important;
  }
}

/* ── 弹窗与面板骨架 ──────────────────────────────────────────────────────── */
.winbox.hg-winbox {
  z-index: 10050 !important;
  border-radius: 14px !important;
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28) !important;
}
/* 兜底：旧缓存的面板脚本没有传 header 选项时，表头保持 WinBox 默认的 35px，
   与最小化后的窗口高度一致；新脚本的内联 header:42 会覆盖这里 */
.winbox.hg-winbox .wb-header {
  height: 35px;
  line-height: 35px;
}
/* 标题栏按钮显式垂直居中，避免依赖 line-height 的基线对齐 */
.winbox.hg-winbox .wb-control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}
/* WinBox 默认把减号下移 6px，单独扳回中心，与其它按钮对齐 */
.winbox.hg-winbox .wb-min {
  background-position: center center;
}
.winbox.hg-winbox .wb-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.winbox.hg-winbox .wb-body {
  margin: 0;
  padding: 0;
  background: #fff !important;
  color: #333;
  overflow-y: auto;
  overscroll-behavior: contain;
}
[data-theme='dark'] body.DarkMode .winbox.hg-winbox .wb-body,
[data-theme='dark'] .winbox.hg-winbox .wb-body,
body.DarkMode .winbox.hg-winbox .wb-body {
  background: #22272e !important;
  color: #d6d9df;
}
.winbox.hg-winbox .wb-body::-webkit-scrollbar {
  width: 8px;
}
.winbox.hg-winbox .wb-body::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: rgba(128, 128, 128, 0.35);
}

.settings {
  container-type: inline-size;
  padding: 14px 18px 28px;
  font-size: 14px;
  line-height: 1.6;
}

.settings .hg-topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 2px 0 4px;
}
.settings #reset_btn {
  min-height: 38px;
  padding: 6px 16px;
  border: 1px solid var(--theme-color);
  border-radius: 999px;
  background: var(--theme-color);
  color: var(--on-theme, #fff);
  font: inherit;
  font-size: 0.84em;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  transition: transform 0.16s ease, opacity 0.16s ease;
}
.settings #reset_btn:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

.settings h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 26px 0 12px;
  padding: 0 0 8px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.18);
  font-size: 1.04em;
  font-weight: 700;
  line-height: 1.5;
}
.settings h2:first-of-type {
  margin-top: 8px;
}
.settings h2 i {
  color: var(--theme-color);
  font-size: 0.95em;
}
.settings h3,
.settings .ap-subtitle {
  margin: 18px 0 8px;
  padding: 0;
  font-size: 0.95em;
  font-weight: 700;
}
.settings .hg-hint {
  margin: 6px 0 10px;
  font-size: 0.8em;
  line-height: 1.7;
  opacity: 0.75;
}
.settings .hg-box {
  margin: 12px 0 18px;
  padding: 4px 16px;
  border: 1px solid rgba(128, 128, 128, 0.2);
  border-radius: 14px;
  background: rgba(128, 128, 128, 0.045);
}
.settings .hg-box > .feature-opt:last-child,
.settings .hg-box > .hg-range:last-child {
  border-bottom: 0;
}

/* ── 滑块 / 数字框 ────────────────────────────────────────────────────────── */
.settings .bf-panel {
  margin: 12px 0 18px;
  padding: 16px 18px;
  border: 1px solid rgba(128, 128, 128, 0.2);
  border-radius: 14px;
  background: rgba(128, 128, 128, 0.045);
}
.settings .bf-heading,
.settings .bf-value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.settings .bf-heading {
  font-weight: 700;
}
.settings .bf-hint {
  margin: 6px 0 4px;
  font-size: 0.8em;
  opacity: 0.8;
  line-height: 1.6;
}
.settings .hg-range {
  padding: 12px 0;
  border-bottom: 1px dashed rgba(128, 128, 128, 0.2);
}
.settings .hg-range.is-disabled {
  opacity: 0.45;
}
.settings .bf-value-row > label {
  font-weight: 600;
}
.settings .bf-number {
  display: flex;
  align-items: center;
  gap: 6px;
}
.settings .bf-number span {
  font-size: 0.8em;
  opacity: 0.72;
}
.settings .bf-panel .bf-number input:is(#transNumber, #blurRad, #saturation, #contrast) {
  box-sizing: border-box;
  flex: 0 0 76px;
  width: 76px;
  min-width: 76px;
  max-width: none;
  height: 40px;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid rgba(128, 128, 128, 0.45);
  border-radius: 8px;
  background: rgba(128, 128, 128, 0.08);
  color: inherit;
  font: inherit;
  font-size: 16px;
  text-align: center;
}
.settings .bf-panel input:focus-visible,
.settings .bf-panel button:focus-visible,
.settings .ap-btn:focus-visible,
.settings .ap-font-option:focus-visible,
.settings .ap-bg-option:focus-visible,
.settings .ap-details > summary:focus-visible,
.settings .ap-bg-advanced > summary:focus-visible,
.settings #pic-link:focus-visible {
  outline: 2px solid var(--theme-color);
  outline-offset: 3px;
}
.settings .bf-panel .bf-slider {
  --bf-fill: 0%;
  box-sizing: border-box;
  display: block;
  width: 100%;
  height: 40px;
  margin: 2px 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: linear-gradient(to right, var(--theme-color) var(--bf-fill), rgba(128, 128, 128, 0.35) var(--bf-fill)) center / 100% 5px no-repeat;
  touch-action: pan-y;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.settings .bf-panel .bf-slider:disabled {
  cursor: not-allowed;
}
.settings .bf-slider::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  border: 3px solid var(--theme-color);
  border-radius: 50%;
  background: var(--theme-color);
  -webkit-appearance: none;
  appearance: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
}
.settings .bf-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid var(--theme-color);
  border-radius: 50%;
  background: var(--theme-color);
}
.settings .bf-slider::-moz-range-track {
  border: 0;
  background: transparent;
}
.settings .bf-limits {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.72em;
  line-height: 1.5;
  opacity: 0.75;
}
.settings .bf-limits span:nth-child(2) {
  text-align: center;
}
.settings .bf-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}
.settings .bf-footer button {
  min-height: 38px;
  padding: 6px 12px;
  border: 1px solid rgba(128, 128, 128, 0.45);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.84em;
  cursor: pointer;
}
.settings .bf-panel input:disabled,
.settings .bf-panel button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── 开关（iOS 胶囊） ─────────────────────────────────────────────────────── */
.settings input[type='checkbox'] {
  width: 37px;
  height: 20px;
  flex: 0 0 auto;
  min-width: 37px;
  position: relative;
  display: inline-block;
  margin: 0;
  border: 1px solid rgba(128, 128, 128, 0.55);
  border-radius: 12px;
  background-color: rgba(128, 128, 128, 0.22);
  background-clip: content-box;
  -webkit-appearance: none;
  appearance: none;
  user-select: none;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
[data-theme='dark'] .settings input[type='checkbox'] {
  border-color: rgba(255, 255, 255, 0.35);
  background-color: rgba(255, 255, 255, 0.16);
}
.settings input[type='checkbox']::before {
  content: '';
  width: 14px;
  height: 14px;
  position: absolute;
  top: 2px;
  left: 3px;
  border-radius: 10px;
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  transition: left 0.2s;
}
[data-theme='dark'] .settings input[type='checkbox']::before {
  background-color: rgba(220, 225, 232, 0.95);
}
.settings input[type='checkbox']:checked {
  border-color: var(--theme-color);
  background-color: var(--theme-color);
}
.settings input[type='checkbox']:checked::before {
  left: 19px;
}
.settings input[type='checkbox']:checked:hover {
  opacity: 0.85;
}
.settings input[type='checkbox']:active {
  opacity: 0.7;
}

/* ── 功能网格（氛围 / 互动 / 布局） ───────────────────────────────────────── */
.settings .feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 22px;
}
.settings .feature-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  min-height: 62px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(128, 128, 128, 0.2);
  cursor: pointer;
}
.settings .feature-opt > span {
  min-width: 0;
  font-weight: 600;
  line-height: 1.5;
}
.settings .feature-opt small {
  display: block;
  margin-top: 2px;
  font-size: 0.72em;
  font-weight: 400;
  line-height: 1.5;
  opacity: 0.72;
}
.settings .feature-opt input[type='checkbox'] {
  flex-shrink: 0;
  margin: 0;
}
@container (max-width: 560px) {
  .settings .feature-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}
@media (max-width: 600px) {
  .settings .feature-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .settings .feature-opt {
    min-height: 58px;
  }
}
.settings .feature-opt.dm-wide {
  grid-column: 1 / -1;
  flex-wrap: wrap;
  align-items: flex-start;
  padding: 10px 0;
}
.settings .dm-seg {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(128, 128, 128, 0.22);
  border-radius: 999px;
  background: rgba(128, 128, 128, 0.12);
}
.settings .dm-seg button {
  min-height: 34px;
  padding: 5px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.84em;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.settings .dm-seg button:hover {
  background: rgba(128, 128, 128, 0.18);
}
.settings .dm-seg button.is-on {
  background: var(--theme-color);
  border-color: var(--theme-color);
  color: var(--on-theme, #fff);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
}
.settings .feature-opt .dm-seg-note {
  flex: 1 0 100%;
  margin: 6px 0 0;
  font-size: 0.76em;
  font-weight: 400;
  line-height: 1.6;
  opacity: 0.82;
}
@media (max-width: 600px) {
  .settings .feature-opt.dm-wide {
    flex-direction: column;
    align-items: stretch;
  }
  .settings .dm-seg {
    width: 100%;
  }
  .settings .dm-seg button {
    flex: 1 1 0;
    padding: 5px 6px;
  }
  .settings .feature-opt .dm-seg-note {
    flex: 0 0 auto;
    width: 100%;
  }
}

/* ── 主题色 ──────────────────────────────────────────────────────────────── */
:root {
  --color-red: #ef5a5a;
  --color-orange: #d7924d;
  --color-yellow: #c4a64a;
  --color-matcha: #66b34d;
  --color-puregreen: #4daf87;
  --color-green: #39c5bb;
  --color-blue: #4a9cc7;
  --color-darkblue: #71859c;
  --color-heoblue: #616ad1;
  --color-purepurple: #9d7bd8;
  --color-pink: #ff8fa3;
}
.settings .content.colorRow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 6px 0 2px 6px;
}
.settings .colorRow .theme-choice {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
}
.settings .colorRow .theme-choice input[name='colors'] {
  box-sizing: border-box;
  flex: none;
  min-width: 24px;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  border: 3px solid currentColor;
  border-radius: 50%;
  background: currentColor;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: transform 0.18s ease;
}
.settings .colorRow .theme-choice input[name='colors']:checked {
  box-shadow: 0 0 0 2px #fff inset, 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.settings .colorRow .theme-choice:hover input[name='colors'],
.settings .theme-custom:hover .theme-rainbow {
  transform: scale(1.08);
}
.settings .colorRow .theme-choice input:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 5px;
}
.settings .colorRow .theme-custom {
  margin-left: 6px;
}
.settings .theme-rainbow {
  display: block;
  position: relative;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--color-red), var(--color-orange), var(--color-yellow), var(--color-matcha), var(--color-puregreen), var(--color-green), var(--color-blue), var(--color-darkblue), var(--color-heoblue), var(--color-purepurple), var(--color-pink), var(--color-red));
  transition: transform 0.18s ease;
}
.settings .theme-rainbow::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #f5f5f5;
}
[data-theme='dark'] .settings .theme-rainbow::before {
  background: #333;
}
.settings .theme-rainbow::after {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: var(--custom-theme-color, #c74bd0);
  opacity: 0;
}
.settings .theme-custom.is-selected .theme-rainbow::after {
  opacity: 1;
}
.settings .colorRow .theme-custom input[type='color'] {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}
.settings .colorRow .theme-custom:has(input:focus-visible) {
  outline: 2px solid currentColor;
}
.settings .theme-color-hint {
  margin: 8px 2px 6px;
  font-size: 0.75em;
  line-height: 1.7;
  opacity: 0.8;
}
.settings .hg-color-input {
  width: 38px;
  height: 26px;
  padding: 0;
  border: 1px solid rgba(128, 128, 128, 0.35);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

/* 实底上的前景色，主题里写死白字的几处接到 --on-theme */
*::selection {
  background: var(--theme-color);
  color: var(--on-theme);
}
#aside-content #card-toc .toc-content .toc-link.active,
#aside-content #card-toc .toc-content .toc-link.active:hover,
#aside-content > .card-widget.card-info > #card-info-btn,
#article-container .music-note-id {
  color: var(--on-theme);
}
#aside-content > .card-widget.card-info > #card-info-btn:hover {
  color: var(--on-theme) !important;
}

/* TOC 高亮跟随主题色（主题默认写死 #00c4b6） */
#aside-content #card-toc .toc-content .toc-link.active,
#aside-content #card-toc .toc-content .toc-link.active:hover {
  background: var(--theme-color) !important;
  color: var(--on-theme) !important;
}
#aside-content #card-toc .toc-content .toc-link:hover:not(.active) {
  color: color-mix(in srgb, var(--theme-color) 78%, var(--font-color)) !important;
}

/* ── 字体设置 / 背景设置共用面板 ─────────────────────────────────────────── */
.settings .ap-panel {
  --ap-border: rgba(40, 55, 65, 0.16);
  --ap-surface: rgba(255, 255, 255, 0.52);
  --ap-soft: rgba(255, 255, 255, 0.32);
  margin: 12px 0 18px;
  padding: 18px;
  border: 1px solid rgba(128, 128, 128, 0.2);
  border-radius: 14px;
  min-width: 0;
  background: rgba(128, 128, 128, 0.045);
}
[data-theme='dark'] .settings .ap-panel {
  --ap-border: rgba(255, 255, 255, 0.16);
  --ap-surface: rgba(255, 255, 255, 0.055);
  --ap-soft: rgba(255, 255, 255, 0.025);
}
.settings .ap-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}
.settings .ap-eyebrow {
  margin: 0 0 4px !important;
  font-size: 0.95em;
  font-weight: 700;
}
.settings .ap-hint,
.settings .ap-bg-meta {
  margin: 4px 0 12px !important;
  opacity: 0.78;
  font-size: 0.85em;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.settings .ap-subtitle {
  margin: 18px 0 10px;
  font-size: 0.95em;
  font-weight: 600;
}
.settings .ap-btn,
.settings .ap-font-option,
.settings .ap-bg-option {
  border: 1px solid var(--ap-border);
  border-radius: 10px;
  background: var(--ap-surface);
  color: inherit;
  font: inherit;
  cursor: pointer;
  box-shadow: none;
  transition: border-color 0.16s, background-color 0.16s;
}
.settings .ap-btn {
  min-height: 40px;
  padding: 8px 14px;
  line-height: 1.5;
  flex-shrink: 0;
}
.settings .ap-btn:hover,
.settings .ap-font-option:hover,
.settings .ap-bg-option:hover {
  border-color: var(--theme-color);
}
.settings .ap-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.settings #swfs,
.settings #swfs_code,
.settings .ap-font-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.settings .ap-font-option {
  position: relative;
  min-height: 66px;
  padding: 10px 32px 10px 14px;
  text-align: left;
  min-width: 0;
}
.settings .ap-font-name {
  display: block;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.settings .ap-font-option small {
  display: block;
  margin-top: 3px;
  opacity: 0.76;
  font-size: 0.76em;
  line-height: 1.6;
}
.settings .ap-check {
  position: absolute;
  right: 12px;
  top: 12px;
  display: none;
  color: var(--theme-color);
}
.settings .ap-font-option[aria-pressed='true'],
.settings .ap-bg-option[aria-pressed='true'],
.settings .ap-tabs .ap-btn[aria-pressed='true'] {
  border-color: var(--theme-color);
  background: color-mix(in srgb, var(--theme-color) 12%, var(--ap-surface));
  box-shadow: inset 0 0 0 1px var(--theme-color);
}
.settings .ap-font-option[aria-pressed='true'] .ap-check {
  display: block;
}
.settings .ap-preview {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--ap-border);
  border-radius: 12px;
  background: var(--ap-soft);
  min-width: 0;
}
.settings .ap-current {
  margin: 0 0 8px !important;
  font-size: 0.8em;
  opacity: 0.78;
  font-family: system-ui, sans-serif;
}
.settings .ap-text-sample {
  margin: 0 !important;
  font-size: 18px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}
.settings #article-container .ap-code-sample {
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.settings .ap-status {
  min-height: 1.7em;
  margin: 10px 0 0 !important;
  font-size: 0.8em;
  line-height: 1.7;
  opacity: 0.82;
  overflow-wrap: anywhere;
}
.settings .ap-status[data-state='error'] {
  opacity: 1;
  font-weight: 600;
  color: #d9534f;
}
.settings .ap-details,
.settings .ap-bg-advanced {
  margin: 14px 0;
  border-top: 1px solid var(--ap-border);
}
.settings .ap-details > summary,
.settings .ap-bg-advanced > summary {
  min-height: 40px;
  padding: 12px 0;
  font-size: 0.88em;
  line-height: 1.6;
  cursor: pointer;
}
.settings .ap-license {
  margin-bottom: 0;
}
.settings .ap-bg-current {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 12px 18px;
  margin-bottom: 10px;
}
.settings .ap-bg-current > .ap-btn {
  grid-column: 2;
  justify-self: start;
}
.settings .ap-bg-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 0 !important;
  border-radius: 8px;
  background: var(--ap-soft);
  object-fit: cover;
}
.settings .ap-bg-current > .ap-bg-thumb {
  grid-row: span 2;
  position: relative;
  overflow: hidden;
}
.settings .ap-bg-current > .ap-bg-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.settings .ap-bg-placeholder {
  border: 1px dashed var(--ap-border);
}
.settings .ap-bg-name {
  display: block;
  font-size: 0.9em;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.settings .ap-tabs,
.settings .ap-bg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}
.settings .ap-tabs .ap-btn {
  flex: 0 1 auto;
}
.settings .ap-bg-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.settings .ap-panel [hidden] {
  display: none !important;
}
.settings .ap-bg-option {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 6px;
  text-align: left;
}
.settings .ap-bg-option .ap-bg-name {
  padding: 6px 3px 2px;
}
.settings .ap-bg-option .ap-bg-meta {
  margin: 0 0 3px !important;
  padding: 0 3px;
  font-size: 0.72em;
}
.settings #ap-bg-category-mobile .ap-bg-thumb {
  aspect-ratio: 3 / 4;
}
.settings .ap-bg-check {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--theme-color);
  color: var(--on-theme, #fff);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
}
.settings .ap-bg-swatch {
  min-height: 54px;
}
.settings #define_colors {
  box-sizing: border-box;
  width: 72px;
  height: 40px;
  margin: 0 0 8px;
  vertical-align: middle;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  cursor: pointer;
}
.settings #pic-link {
  box-sizing: border-box;
  width: 100%;
  min-height: 40px;
  margin: 8px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--ap-border);
  border-radius: 10px;
  background: var(--ap-surface);
  color: inherit;
  font: inherit;
  font-size: 0.85em;
}
.settings #ap-bg-custom-preview {
  width: 100%;
  max-height: 230px;
  position: relative;
  overflow: hidden;
  margin-top: 12px;
}
.settings #ap-bg-custom-preview img {
  width: 100%;
  height: 100%;
  max-height: 230px;
  object-fit: contain;
}
@container (max-width: 560px) {
  .settings .ap-panel {
    padding: 14px;
  }
  .settings #swfs,
  .settings #swfs_code,
  .settings .ap-font-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .settings .ap-bg-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .settings .ap-section-head {
    flex-direction: column;
    gap: 8px;
  }
  .settings .ap-bg-current {
    grid-template-columns: 100px minmax(0, 1fr);
  }
  .settings .ap-bg-current > .ap-btn {
    grid-column: 1 / -1;
  }
}
@media (max-width: 600px) {
  .settings .ap-panel {
    padding: 14px;
  }
  .settings #swfs,
  .settings #swfs_code,
  .settings .ap-font-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .settings .ap-bg-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .settings .ap-section-head {
    flex-direction: column;
    gap: 8px;
  }
  .settings .ap-bg-current {
    grid-template-columns: 100px minmax(0, 1fr);
  }
  .settings .ap-bg-current > .ap-btn {
    grid-column: 1 / -1;
  }
}

/* 面板底部 */
.settings .hg-panel-foot {
  margin: 26px 0 4px;
  text-align: center;
  font-size: 0.78em;
  opacity: 0.55;
  letter-spacing: 0.5px;
}

/* ── 点击涟漪 ─────────────────────────────────────────────────────────────── */
.ripple-layer {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 9998;
}
.ripple-burst {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
}
.ripple-ring {
  box-sizing: border-box;
  position: absolute;
  left: 0;
  top: 0;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border: 1.5px solid color-mix(in srgb, var(--theme-color, #39c5bb) 55%, transparent);
  border-radius: 50%;
  opacity: 0;
  animation: ripple-out 0.52s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
.ripple-ring.is-late {
  border-width: 1px;
  border-color: color-mix(in srgb, var(--theme-color, #39c5bb) 30%, transparent);
  animation-delay: 0.06s;
  animation-duration: 0.56s;
}
@keyframes ripple-out {
  from {
    transform: scale(0.16);
    opacity: 0.9;
  }
  to {
    transform: scale(2.6);
    opacity: 0;
  }
}

/* ── 萤火虫微光 ───────────────────────────────────────────────────────────── */
#fireflies-stage {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 44vh;
  min-height: 180px;
  max-height: 440px;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  contain: layout paint;
  margin: 0;
  padding: 0;
}
#fireflies-stage[hidden] {
  display: none !important;
}
#fireflies-stage .ff-mote {
  position: absolute;
  display: block;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  pointer-events: none;
  animation: ff-drift var(--ff-drift-time) ease-in-out var(--ff-delay) infinite alternate;
}
#fireflies-stage .ff-glow {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--ff-color), 0.5) 0, rgba(var(--ff-color), 0.16) 20%, rgba(var(--ff-color), 0) 70%);
  animation: ff-breathe var(--ff-breathe-time) ease-in-out var(--ff-delay) infinite;
}
#fireflies-stage .ff-glow::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: var(--ff-size);
  height: var(--ff-size);
  border-radius: 50%;
  background: rgb(var(--ff-color));
  box-shadow: 0 0 6px 1px rgba(var(--ff-color), 0.65);
}
#fireflies-stage[data-paused='true'] .ff-mote,
#fireflies-stage[data-paused='true'] .ff-glow {
  animation-play-state: paused !important;
}
@keyframes ff-drift {
  0% {
    transform: translate(-12px, 10px);
  }
  45% {
    transform: translate(8px, -14px);
  }
  100% {
    transform: translate(22px, -32px);
  }
}
@keyframes ff-breathe {
  0%,
  100% {
    opacity: 0.18;
  }
  45% {
    opacity: 0.95;
  }
  70% {
    opacity: 0.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  .settings .theme-rainbow,
  .settings .colorRow .theme-choice input[name='colors'],
  .settings .ap-btn,
  .settings .ap-font-option,
  .settings .ap-bg-option {
    transition: none;
  }
  #fireflies-stage {
    display: none !important;
  }
  #fireflies-stage .ff-mote,
  #fireflies-stage .ff-glow {
    animation: none !important;
  }
  #snow {
    display: none !important;
  }
  .ripple-burst {
    display: none !important;
  }
}

/* 窄屏面板：留白收一点，功能行不换行挤压开关 */
@media (max-width: 480px) {
  .settings {
    padding: 10px 12px 24px;
  }
  .settings .bf-panel {
    margin: 10px 0 14px;
    padding: 12px;
  }
  .settings h2 {
    margin-top: 22px;
  }
  .settings .ap-panel {
    margin: 10px 0 14px;
  }
  .settings .ap-bg-grid {
    gap: 8px;
  }
}

/* ── 2026-11-22 主题色收口：搜索分页 / 导航下划线 / 标签云 / 首页分类磁贴 ── */
#local-search .search-dialog .ais-Pagination-link {
  color: var(--on-theme, #fff);
}
#local-search .search-dialog .ais-Pagination-item--selected .ais-Pagination-link {
  background: var(--theme-color) !important;
  color: var(--on-theme, #fff) !important;
}
#local-search .search-dialog .local-search-hit-item[value]::before,
#local-search .search-dialog .local-search-hit-item a:hover {
  color: color-mix(in srgb, var(--theme-color) 78%, var(--font-color)) !important;
}

#nav .site-page:not(.child)::after {
  background-color: color-mix(in srgb, var(--theme-color) 70%, #fff);
}

.tag-cloud-list a:hover,
.tag-cloud-list a:active {
  color: var(--on-theme, #fff) !important;
}
#aside-content .card-tag-cloud a:hover {
  color: color-mix(in srgb, var(--theme-color) 78%, var(--font-color)) !important;
}

/* hexo-magnet 注入的「查看更多」写死 #555，且 body 末尾内联样式顺序在后，用 ID 提高权重 */
#catalog_magnet .magnet_link_more {
  color: color-mix(in srgb, var(--font-color, #4c4948) 70%, transparent);
}
#catalog_magnet .magnet_link:hover {
  color: var(--on-theme, #fff) !important;
}
#catalog_magnet .magnet_link_more:hover {
  color: color-mix(in srgb, var(--theme-color) 78%, var(--font-color)) !important;
}