/* ============================================================
   base.css — 全局布局与公共组件（导航 / 卡片 / 按钮 / 页脚）
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  transition: background-color .3s, color .3s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }

a { color: inherit; text-decoration: none; transition: var(--t); }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }

::selection { background: var(--brand-op); }

/* 细滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c3c9d4; border-radius: 4px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #3a3f4a; }
::-webkit-scrollbar-track { background: transparent; }

/* 渐变氛围底：亮=樱粉×蓝紫透明感，暗=星空雾紫（由 body::before 承载，见下） */

/* ---------- 布局 ---------- */
.container { max-width: 1150px; margin: 0 auto; padding: 0 22px; }
.container-narrow { max-width: 780px; margin: 0 auto; padding: 0 22px; }

/* ---------- 顶部导航（毛玻璃吸顶 + 沉浸式自动隐藏） ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  transition: transform .38s cubic-bezier(.4, 0, .2, 1), background-color .3s, border-color .3s;
}
/* 沉浸模式：向下滚动时藏起，鼠标靠近顶部或向上滚时滑出 */
.site-header.immersive-hide { transform: translateY(-100%); border-color: transparent; }
/* 顶栏隐藏时，鼠标热区（屏幕顶部 60px 无形区域）保持可探测 */
.hover-zone {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  z-index: 99;
  pointer-events: none;
}
.nav-bar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.nav-logo {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(120deg, var(--brand), #9a6bff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.nav-logo .logo-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-op);
  -webkit-text-fill-color: initial;
}
.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; }
.nav-item { position: relative; }
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 9px 16px;
  border-radius: var(--r-full);
  font-size: 16.5px;
  color: var(--text-2);
  transition: var(--t);
  white-space: nowrap;
}
.nav-link:hover { color: var(--brand); background: var(--brand-op); }
.nav-link.is-active {
  color: #fff;
  font-weight: 600;
  background: var(--grad-brand);
  box-shadow: 0 4px 12px -4px rgba(124, 108, 240, .5);
}
.nav-link .caret { font-size: 10px; opacity: .6; transition: var(--t); }

/* 下拉菜单 */
.submenu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  min-width: 170px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-float);
  padding: 6px;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transition: var(--t);
}
/* 透明桥：填满导航与菜单之间的空隙，hover 中途不丢失 */
.submenu::before {
  content: '';
  position: absolute;
  top: -14px;
  left: 0;
  right: 0;
  height: 14px;
}
.nav-item.has-sub:hover .submenu,
.nav-item.has-sub:focus-within .submenu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.nav-item.has-sub:hover .caret { transform: rotate(180deg); }
.submenu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--text-2);
  transition: var(--t);
}
.submenu a:hover { background: var(--bg-hover); color: var(--text); }
.submenu .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* 主题切换按钮 */
.theme-toggle {
  width: 38px; height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-full);
  color: var(--text-2);
  font-size: 17px;
  transition: var(--t);
}
.theme-toggle:hover { background: var(--brand-op); color: var(--brand); transform: rotate(30deg); }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }

/* 汉堡按钮（移动端） */
.nav-burger { display: none; width: 38px; height: 38px; border-radius: var(--r-sm); color: var(--text-2); font-size: 20px; align-items: center; justify-content: center; }
.nav-burger:hover { background: var(--bg-hover); }

/* 移动端抽屉 */
.nav-drawer {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  padding: 8px 20px 16px;
}
.nav-drawer.open { display: block; }
.nav-drawer a {
  display: block;
  padding: 11px 12px;
  border-radius: var(--r-sm);
  font-size: 15px;
  color: var(--text-2);
}
.nav-drawer a:hover { background: var(--bg-hover); color: var(--brand); }
.nav-drawer .drawer-group {
  font-size: 12px;
  color: var(--text-3);
  padding: 12px 12px 4px;
  letter-spacing: .1em;
}

@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-burger { display: inline-flex; }
}

/* ---------- 按钮 / 徽章 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 30px;
  border-radius: var(--r-full);
  font-size: 16.5px;
  font-weight: 500;
  transition: var(--t);
  cursor: pointer;
}
.btn-primary { background: var(--grad-brand); background-size: 150% 150%; color: #fff; box-shadow: var(--shadow-brand); border: none; }
.btn-primary:hover { background-position: 100% 50%; transform: translateY(-2px); box-shadow: 0 12px 26px -8px rgba(255, 143, 171, .55); }
.btn-ghost { border: 1px solid var(--border); color: var(--text-2); background: var(--bg-card); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-sm { padding: 7px 16px; font-size: 13.5px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  border-radius: var(--r-full);
  font-size: 12.5px;
  background: var(--bg-secondary);
  color: var(--text-2);
  transition: var(--t);
}
a.chip:hover { color: var(--brand); background: var(--brand-op); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-card);
  transition: var(--t);
}
.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}

/* ---------- 区块标题 ---------- */
.section-head { text-align: center; margin-bottom: 26px; }
.section-head h2 {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: .02em;
}
.section-head .sub { margin-top: 8px; color: var(--text-3); font-size: 14.5px; }
.section-head .accent {
  display: inline-block;
  width: 44px; height: 5px;
  border-radius: 3px;
  background: var(--grad-brand);
  margin-bottom: 12px;
}

/* ---------- 文章卡片（左图右文） ---------- */
.post-card {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: var(--t);
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card-hover); }
.post-card .cover {
  flex: 0 0 45%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  position: relative;
  background: var(--bg-secondary);
}
.post-card .cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s cubic-bezier(.4, 0, .25, 1);
}
.post-card:hover .cover img { transform: scale(1.08); }
.post-card .cover .cat-badge {
  position: absolute;
  top: 12px; left: 12px;
  padding: 3px 12px;
  border-radius: var(--r-full);
  font-size: 12px;
  color: #fff;
  background: var(--cat-color, var(--brand));
  box-shadow: 0 4px 10px rgba(0, 0, 0, .18);
}
.post-card .body {
  flex: 1;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}
.post-card .meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-3);
}
.post-card h3 {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card:hover h3 { color: var(--brand); }
.post-card .excerpt {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.75;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card .more {
  font-size: 13.5px;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.post-card .more .arrow { transition: var(--t); }
.post-card:hover .more .arrow { transform: translateX(4px); }

@media (max-width: 640px) {
  .post-card { flex-direction: column; }
  .post-card .cover { flex: none; width: 100%; }
}

/* ---------- 入场动画（JS 可用时才隐藏，失败保底可见） ---------- */
html.js-anim .reveal { opacity: 0; transform: translateY(18px); }
html.js-anim .reveal.in {
  opacity: 1;
  transform: none;
  transition: opacity .6s ease, transform .6s ease;
}

/* ---------- Flash 提示 ---------- */
.toast-wrap {
  position: fixed;
  top: calc(var(--header-h) + 14px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(92vw, 420px);
}
.toast {
  padding: 12px 18px;
  border-radius: var(--r);
  font-size: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  box-shadow: var(--shadow-float);
  animation: toast-in .35s ease;
}
.toast.success { border-left-color: #3fb950; }
.toast.error { border-left-color: #e5534b; }
.toast.info { border-left-color: var(--brand); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ---------- 回到顶部 ---------- */
.back-top {
  position: fixed;
  right: 22px;
  bottom: calc(26px + var(--toolbar-comp, 0px));
  width: 44px; height: 44px;
  border-radius: var(--r-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  color: var(--brand);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: var(--t);
  z-index: 90;
}
.back-top.show { opacity: 1; visibility: visible; transform: none; }
.back-top:hover { box-shadow: var(--shadow-brand); transform: translateY(-3px); }

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: 44px;
  border-top: 1px solid var(--border);
  padding: 36px 0 42px;
  color: var(--text-3);
  font-size: 13.5px;
}
.site-footer .inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.site-footer .foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; }
.site-footer .foot-links a { color: var(--text-2); }
.site-footer .foot-links a:hover { color: var(--brand); }
.site-footer .run-days { color: var(--brand); font-weight: 600; }

/* ---------- 通用正文排版（generic detail / 简单页面用） ---------- */
.prose { font-size: 19px; line-height: 2; color: var(--text); }
.prose p { margin: 0 0 1.1em; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin: 1.6em 0 .7em; font-weight: 700; line-height: 1.4; }
.prose h1 { font-size: 26px; }
.prose h2 { font-size: 22px; }
.prose h3 { font-size: 18.5px; }
.prose img { border-radius: var(--r); margin: 1em auto; box-shadow: var(--shadow-card); }
.prose blockquote {
  margin: 1.2em 0;
  padding: 12px 18px;
  border-left: 3px solid var(--brand);
  background: var(--bg-secondary);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--text-2);
}
.prose ul, .prose ol { padding-left: 1.6em; margin: 0 0 1.1em; }
.prose li { margin-bottom: .35em; }
.prose code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--bg-secondary);
  padding: .15em .45em;
  border-radius: 5px;
}
.prose table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: 14.5px; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.prose th { background: var(--bg-secondary); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }
.prose a { color: var(--brand); }
.prose a:hover { text-decoration: underline; }

/* 代码块容器（codehilite 输出） */
.prose .codehilite, .prose .highlight {
  background: #282c34;
  border-radius: var(--r);
  margin: 1.2em 0;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.prose .codehilite pre, .prose .highlight pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.75;
}
/* 关键修复：pre 内部的 code 不吃行内代码的药丸样式（否则暗底浅字看不清） */
.prose .codehilite code, .prose .highlight code,
.prose .codehilite pre code, .prose .highlight pre code {
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
  color: inherit !important;
  font-size: inherit;
}
[data-theme="dark"] .prose code {
  background: var(--bg-hover);
  color: #d8e1ec;
}

/* ---------- 全站氛围层 ---------- */

/* 点击冒出「水中气泡」文字：上浮一段长距离 + 轻微摆动后消失（JS 生成） */
.click-word {
  position: fixed;
  pointer-events: none;
  z-index: 999;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .1em;
  text-shadow: 0 2px 8px rgba(14, 165, 160, .28);
  animation: word-bubble 2.6s cubic-bezier(.22, .68, .36, 1) forwards;
  will-change: transform, opacity;
  user-select: none;
  white-space: nowrap;
}
@keyframes word-bubble {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(.5); }
  12%  { opacity: 1; transform: translate(-50%, -80%) scale(1.12); }
  30%  { transform: translate(calc(-50% + 7px), -180%) scale(1); }
  50%  { transform: translate(calc(-50% - 7px), -290%) scale(.97); }
  70%  { opacity: .9; transform: translate(calc(-50% + 5px), -400%) scale(.93); }
  100% { opacity: 0; transform: translate(calc(-50% - 3px), -540%) scale(.86); }
}

/* 页脚一言 */
.foot-quote-line {
  font-family: var(--font-serif);
  color: var(--text-2);
  font-size: 13.5px;
  letter-spacing: .05em;
  max-width: 640px;
  line-height: 1.8;
}
.foot-quote-line .from { color: var(--text-3); font-size: 12px; margin-left: 8px; }

/* 虫洞按钮的小动效 */
.wormhole-link { position: relative; overflow: hidden; }
.wormhole-link .wh-icon { display: inline-block; animation: wh-spin 3.2s linear infinite; }
@keyframes wh-spin { 80% { transform: rotate(360deg) scale(1); } 90% { transform: rotate(380deg) scale(1.25); } 100% { transform: rotate(360deg) scale(1); } }

/* ============================================================
   头像 Logo + 个人信息侧滑抽屉 + 虫洞缓冲 + 桌面宠物
   ============================================================ */

/* ---------- 头像 Logo（聊天软件风格） ---------- */
.nav-logo { gap: 10px; }
.nav-logo .logo-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  padding: 2.5px;
  background: var(--grad-brand);
  box-shadow: 0 3px 10px -2px rgba(124, 108, 240, .5);
  transition: var(--t);
  flex-shrink: 0;
}
.nav-logo:hover .logo-avatar { transform: rotate(8deg) scale(1.06); }
.nav-logo .logo-avatar img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--bg-card-solid);
}
.nav-logo .logo-text { font-size: 19px; }

/* ---------- 个人信息侧滑抽屉 ---------- */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(74, 68, 88, .35);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: var(--t);
  z-index: 400;
}
.drawer-mask.open { opacity: 1; visibility: visible; }
.profile-drawer {
  position: fixed;
  top: 0; left: 0; bottom: var(--toolbar-comp, 0px);
  width: min(360px, 88vw);
  background: var(--bg-card-solid);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-float);
  z-index: 401;
  transform: translateX(-102%);
  transition: transform .42s cubic-bezier(.32, .72, .28, 1);
  overflow-y: auto;
  padding: 30px 26px 34px;
}
.profile-drawer.open { transform: translateX(0); }
.pd-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 34px; height: 34px;
  border-radius: 50%;
  color: var(--text-3);
  font-size: 16px;
  transition: var(--t);
}
.pd-close:hover { background: var(--bg-hover); color: var(--brand); transform: rotate(90deg); }
.pd-avatar {
  width: 92px; height: 92px;
  margin: 6px auto 0;
}
.pd-avatar img { width: 100%; height: 100%; object-fit: contain; }
.pd-name { text-align: center; margin-top: 14px; font-family: var(--font-serif); font-size: 21px; font-weight: 700; }
.pd-bio { text-align: center; margin-top: 6px; font-size: 13px; color: var(--text-3); line-height: 1.8; }
.pd-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.pd-tags .chip { font-size: 12px; }
.pd-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 20px 0;
}
.pd-stats .st { text-align: center; padding: 12px 6px; border-radius: var(--r-sm); background: var(--grad-soft); }
.pd-stats .st b { display: block; font-family: var(--font-serif); font-size: 19px; color: var(--brand); }
.pd-stats .st span { font-size: 11.5px; color: var(--text-3); }
.pd-links { display: flex; flex-direction: column; gap: 6px; }
.pd-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  font-size: 14.5px;
  color: var(--text-2);
  transition: var(--t);
}
.pd-links a:hover { background: var(--brand-op); color: var(--brand); transform: translateX(4px); }
.pd-links a .ico { width: 22px; text-align: center; }
/* 文字模块四个分类：横向一排胶囊 */
.pd-links.pd-sub {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.pd-links.pd-sub a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 4px;
  font-size: 12.5px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--bg-secondary);
  white-space: nowrap;
  overflow: hidden;
}
.pd-links.pd-sub a:hover { transform: translateY(-2px); }
.pd-social { display: flex; justify-content: center; margin-top: 20px; }

/* 主题切换：横向三按钮选择块（浅色 / 深色 / 护眼） */
.pd-theme {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 4px;
  background: var(--bg-secondary);
  transition: var(--t);
}
.pd-theme .pdt-opt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: transparent;
  border-radius: var(--r-full);
  padding: 6px 13px;
  font-size: 12.5px;
  color: var(--text-3);
  cursor: pointer;
  transition: var(--t);
  white-space: nowrap;
}
.pd-theme .pdt-opt:hover { color: var(--text); background: var(--bg-hover); }
.pd-theme .pdt-opt:active { transform: scale(.95); }
.pd-theme .pdt-opt.active {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 3px 10px -2px var(--brand-op);
  font-weight: 600;
}
.pd-theme .pdt-opt .pdt-ico { font-size: 13px; line-height: 1; }

/* 抽屉里的音乐控制条（音乐播放时出现） */
.pd-music {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--grad-soft);
  cursor: pointer;
  transition: var(--t);
}
.pd-music.show { display: flex; }
.pd-music:hover { border-color: var(--brand); }
.pd-music .pdm-disc {
  width: 34px; height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  color: #fff;
  background: radial-gradient(circle at 50% 50%, #4a5060 0 24%, #101318 25% 100%);
  border: 2px solid rgba(255, 255, 255, .4);
}
.pd-music .pdm-disc.spin { animation: disc-spin 3.4s linear infinite; }
.pd-music .pdm-info { flex: 1; min-width: 0; }
.pd-music .pdm-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pd-music .pdm-state { font-size: 11px; color: var(--text-3); }
.pd-music .pdm-toggle {
  width: 34px; height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--brand);
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--t);
}
.pd-music .pdm-toggle:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.pd-music .pdm-toggle:active { transform: scale(.92); }

/* ---------- 虫洞缓冲遮罩 ---------- */
.wormhole-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1b1533 0%, #0c0918 70%);
  overflow: hidden;
}
.wormhole-overlay.open { display: flex; }
.wh-tunnel {
  position: absolute;
  left: 50%; top: 50%;
  width: 200vmax; height: 200vmax;
  transform: translate(-50%, -50%);
  background: repeating-conic-gradient(
    from 0deg,
    rgba(124, 108, 240, .16) 0deg 12deg,
    rgba(255, 143, 171, .12) 12deg 24deg,
    transparent 24deg 40deg);
  border-radius: 50%;
  mask-image: radial-gradient(circle, transparent 8%, #000 12%, #000 42%, transparent 62%);
  -webkit-mask-image: radial-gradient(circle, transparent 8%, #000 12%, #000 42%, transparent 62%);
  animation: wh-rotate 7s linear infinite;
}
@keyframes wh-rotate { to { transform: translate(-50%, -50%) rotate(360deg); } }
.wh-star {
  position: absolute;
  left: 50%; top: 50%;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: #fff;
  opacity: 0;
  animation: wh-star 1.6s linear infinite;
}
@keyframes wh-star {
  0% { opacity: 0; transform: translate(0, 0) scale(1); }
  12% { opacity: .9; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.2); }
}
.wh-content { position: relative; text-align: center; color: #efeaff; padding: 20px; }
.wh-title {
  font-family: var(--font-serif);
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: .18em;
  text-indent: .18em;
  background: linear-gradient(120deg, #c4b0ff, #ff9eb5);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.wh-desc { margin-top: 14px; color: rgba(239, 234, 255, .65); font-size: 14px; line-height: 1.9; max-width: 460px; }
.wh-count {
  margin: 26px auto 0;
  width: 84px; height: 84px;
  border-radius: 50%;
  border: 2px solid rgba(196, 176, 255, .5);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-size: 40px;
  color: #fff;
  box-shadow: 0 0 34px rgba(124, 108, 240, .5), inset 0 0 22px rgba(255, 143, 171, .25);
}
.wh-cancel {
  margin-top: 30px;
  padding: 9px 26px;
  border-radius: var(--r-full);
  border: 1px solid rgba(196, 176, 255, .45);
  color: rgba(239, 234, 255, .8);
  font-size: 13.5px;
  transition: var(--t);
}
.wh-cancel:hover { background: rgba(196, 176, 255, .16); color: #fff; }

/* ---------- 悬浮头像入口 ---------- */
.avatar-fab {
  position: fixed;
  top: 18px;
  left: 24px;
  z-index: 300;
  width: var(--fab-size);
  height: var(--fab-size);
  background: transparent;
  border: 0;
  transition: var(--t);
}
.avatar-fab:hover { transform: scale(1.08) rotate(-4deg); }
.avatar-fab img {
  width: 100%; height: 100%;
  object-fit: contain;
}
.fab-ping {
  position: absolute;
  top: 2px; right: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2.5px solid var(--bg-card-solid);
  animation: ping-soft 2s ease-in-out infinite;
}
@keyframes ping-soft { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }

/* ---------- 森林精灵桌面宠物 ---------- */
.fairy-widget {
  position: fixed;
  left: 28px;
  bottom: 24px;
  z-index: 301;
  width: 140px;
  cursor: pointer;
  user-select: none;
  transition: filter .2s ease;
  filter: drop-shadow(0 6px 12px rgba(76, 175, 80, .3));
  will-change: left, bottom;
}
.fairy-widget:hover { filter: drop-shadow(0 8px 16px rgba(76, 175, 80, .45)); }
.fairy-widget:active { transform: scale(.96); }
.fairy-img {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  animation: fairy-float 3.5s ease-in-out infinite;
}
@keyframes fairy-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* 对话气泡 */
.fairy-widget .fairy-say {
  position: absolute;
  left: calc(100% + 10px);
  bottom: 30%;
  transform: translateX(-6px) scale(.92);
  width: max-content;
  max-width: min(220px, 55vw);
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 9px 14px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  box-shadow: var(--shadow-float);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
  pointer-events: none;
  white-space: normal;
  z-index: 96;
}
.fairy-widget .fairy-say::before {
  content: '';
  position: absolute;
  left: -6px; bottom: 16px;
  border: 6px solid transparent;
  border-right-color: var(--border);
  border-left: none;
}
.fairy-widget .fairy-say.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(0) scale(1);
}
.fairy-widget .fairy-say.show::before { border-right-color: var(--bg-card-solid); }

/* 精灵在屏幕右侧时，气泡显示在左侧 */
.fairy-widget.say-left .fairy-say {
  left: auto;
  right: calc(100% + 10px);
  transform: translateX(6px) scale(.92);
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 4px;
}
.fairy-widget.say-left .fairy-say::before {
  left: auto;
  right: -6px;
  border-right: none;
  border-left: 6px solid var(--border);
  border-right-color: transparent;
}
.fairy-widget.say-left .fairy-say.show {
  transform: translateX(0) scale(1);
}
.fairy-widget.say-left .fairy-say.show::before {
  border-left-color: var(--bg-card-solid);
  border-right-color: transparent;
}

/* ---------- 阅读进度条（沉浸阅读页） ---------- */
#readingBar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  background: var(--grad-brand);
  z-index: 500;
  border-radius: 0 2px 2px 0;
  transition: width .12s linear;
  display: none;
}
body.immersive #readingBar { display: block; }

/* ---------- 沉浸阅读：文章详情页隐藏其余组件 ---------- */
body.immersive .site-footer,
body.immersive .back-top { display: none !important; }
body.immersive .avatar-fab { top: 14px; left: 18px; animation: none; }
body.immersive .fairy-widget { display: block !important; }

@media (max-width: 640px) {
  .avatar-fab { top: 12px; left: 12px; }
  .quote-ticker { display: none; }
  .fairy-widget { width: 100px; left: 12px; bottom: 14px; }
  .fairy-widget .fairy-say { max-width: 42vw; font-size: 12px; bottom: 25%; }
}

@media (prefers-reduced-motion: reduce) {
  .fairy-img, .fab-ping, .avatar-fab, .wh-tunnel, .wh-star { animation: none; }
}


/* ---------- 头像旁金句轮播 ---------- */
.quote-ticker {
  position: fixed;
  top: 34px;
  left: calc(var(--fab-size) + 46px);
  max-width: min(620px, calc(100vw - var(--fab-size) - 90px));
  z-index: 299;
  padding: 12px 20px;
  border-radius: var(--r-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--text-2);
  cursor: pointer;
  transition: opacity .26s ease, transform .26s ease, var(--t);
  display: flex;
  align-items: baseline;
  gap: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quote-ticker:hover { border-color: var(--brand); }
.quote-ticker .qt-mark { color: var(--brand); font-weight: 700; }
.quote-ticker .qt-text { overflow: hidden; text-overflow: ellipsis; }
.quote-ticker .qt-from { color: var(--text-3); font-size: 12px; margin-left: 8px; flex-shrink: 0; }


/* ---------- 抽屉 v2：分节导航（无图标） ---------- */
.pd-section {
  font-size: 11px;
  letter-spacing: .3em;
  text-indent: .3em;
  color: var(--text-3);
  margin: 22px 0 8px;
  padding-left: 14px;
  font-weight: 700;
}
.pd-section:first-of-type { margin-top: 8px; }
.pd-links a {
  display: block;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: 14.5px;
  color: var(--text-2);
  transition: var(--t);
  position: relative;
}
.pd-links a:hover { background: var(--brand-op); color: var(--brand); transform: translateX(4px); }
.pd-links.pd-sub .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }


/* ---------- 虫洞确认弹窗 ---------- */
.wh-modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(30, 30, 36, .45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
.wh-modal-mask.open { display: flex; }
.wh-confirm {
  width: min(420px, 90vw);
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-float);
  padding: 30px 32px 26px;
  text-align: center;
  animation: whc-in .3s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes whc-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
.whc-icon { font-size: 40px; }
.wh-confirm h3 { margin: 12px 0 10px; font-family: var(--font-serif); font-size: 21px; }
.wh-confirm p { font-size: 14px; color: var(--text-2); line-height: 1.9; }
.wh-confirm b { color: var(--brand); }
.whc-actions { margin-top: 22px; display: flex; gap: 12px; justify-content: center; }
.whc-btn {
  padding: 10px 24px;
  border-radius: var(--r-full);
  font-size: 14px;
  transition: var(--t);
}
.whc-btn.ghost { border: 1px solid var(--border); color: var(--text-2); }
.whc-btn.ghost:hover { border-color: var(--text-3); color: var(--text); }
.whc-btn.primary { background: var(--brand); color: #fff; }
.whc-btn.primary:hover { background: var(--brand-hover); transform: translateY(-1px); }
