/* 手毬 Bot 指令文档 —— v6 多页文档站
   架构参考 bot-docs.otmdb.cn（侧边栏分组导航 + 窄栏文档排版 + 深色模式 + 搜索），
   视觉体系自建：明暗双主题变量、5 级字号、统一图片瓦片、Q版眨眼。 */

/* ==================== 主题变量 ==================== */
/* 全站取色以月村手毬代表色「水色」为基调（粉丝共识 aqua blue）：
   accent 强调 = 手毬水色；背景带冷蓝调；分区色保持四色辨识（中二青碧/舞萌粉/娱乐绯/帮助绿）。 */
:root {
  color-scheme: light;   /* 原生控件/滚动条跟随主题，防切换闪白 */

  --bg: #ffffff;
  --bg-side: #f6f9fc;
  --bg-soft: #eff5fa;
  --bg-code: #f0f6fb;
  --line: #e2eaf2;
  --line-2: #edf2f8;

  --t1: #1c2733;
  --t2: #4e5b6b;
  --t3: #8593a4;

  --accent: #108fce;
  --accent-soft: #e3f2fc;
  --ok: #0f8a68;
  --ok-soft: #e8f7f2;

  --chu: #0e9a98;  --chu-soft: #e2f6f5;
  --mai: #e8559b;  --mai-soft: #fdeaf4;
  --fun: #ef6288;  --fun-soft: #fdebf0;
  --more: #10a37f; --more-soft: #e8f7f2;

  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --ui: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;

  /* 5 级字号 */
  --fs-h1: 30px;
  --fs-h2: 20px;
  --fs-lead: 15px;
  --fs-body: 14px;
  --fs-mini: 13px;
  --fs-meta: 12px;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 44px;
  --side-w: 262px;
  --r1: 8px; --r2: 11px; --r3: 16px;
  --doc-max: 1200px;      /* 正文栏最大宽度（含左右 32px 内边距） */
  --measure: 68ch;        /* 段落最大行长，防止宽屏把长句拉成一条线 */

  /* —— 动效令牌 —— */
  --e-out: cubic-bezier(.22, .68, .32, 1);      /* 进场：快速起步，柔和落位 */
  --e-in-out: cubic-bezier(.65, 0, .35, 1);     /* 位移 / 抽屉 */
  --e-spring: cubic-bezier(.34, 1.4, .5, 1);    /* 轻微回弹，用于强调元素 */
  --t-fast: 140ms;                              /* 颜色 / 边框 */
  --t-base: 240ms;                              /* 位移 / 阴影 */
  --t-slow: 420ms;                              /* 面板 / 大块 */
  --t-enter: 500ms;                             /* 首屏入场 */
  --rise: 14px;                                 /* 入场位移距离 */
  --stagger: 60ms;                              /* 列表逐项延迟 */
}

html[data-theme="dark"] {
  color-scheme: dark;   /* 原生控件/滚动条深色，overscroll 不再闪白 */

  --bg: #131820;
  --bg-side: #171e2a;
  --bg-soft: #1c2432;
  --bg-code: #1a2230;
  --line: #2a3342;
  --line-2: #242d3a;

  --t1: #edf1f8;
  --t2: #a3adc2;
  --t3: #757f96;

  --accent: #6cc8f2;
  --accent-soft: #1b2f42;
  --ok: #4fd2a8;
  --ok-soft: #1c332c;

  --chu: #4fc6c0;  --chu-soft: #173332;
  --mai: #f37cb4;  --mai-soft: #3a2030;
  --fun: #f585a4;  --fun-soft: #3a2130;
  --more: #4fd2a8; --more-soft: #16302a;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; background: var(--bg); }
::selection { background: var(--accent-soft); }

html, body,
.side, .topbar, .foot {
  transition: background-color var(--t-base) var(--e-in-out),
              color var(--t-base) var(--e-in-out),
              border-color var(--t-base) var(--e-in-out);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--t1);
  font: var(--fs-body)/1.7 var(--ui);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
code {
  font-family: var(--mono); font-size: .92em;
  background: var(--bg-code); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 5px; color: var(--accent);
}

/* ==================== 布局 ==================== */
.layout { display: flex; align-items: flex-start; }

/* —— 侧边栏 —— */
.side {
  position: sticky; top: 0; z-index: 60;
  flex: 0 0 var(--side-w); width: var(--side-w);
  height: 100vh; overflow-y: auto;
  background: var(--bg-side);
  border-right: 1px solid var(--line);
  padding: var(--s5) var(--s4) var(--s4);
}
.side-brand { margin-bottom: var(--s4); }
.side-brand a {
  display: flex; align-items: center; gap: var(--s2);
  text-decoration: none; color: var(--t1);
}
.side-brand b { font-size: var(--fs-lead); font-weight: 800; letter-spacing: .2px; }
.side-brand small { display: block; margin: var(--s1) 0 0 34px; color: var(--t3); font-size: var(--fs-meta); }

/* ==================== 动效体系 ==================== */
/* 原则：只动 transform / opacity / filter（合成层友好）；
   JS 可用时才隐藏待入场元素（.js-motion），禁用动效时全部静态呈现。 */

/* .blink 必须是 block：inline-block 上 aspect-ratio 不生效，立绘会塌成一条 26px 细缝 */
.blink { position: relative; display: block; width: 26px; height: 26px; flex: 0 0 auto; }
.blink img { width: 100%; height: 100%; object-fit: contain; }
.blink .face-shut { position: absolute; inset: 0; opacity: 0; animation: blink 5.2s infinite; }
.blink.mini { width: 26px; height: 26px; }
@keyframes blink {
  0%, 90%   { opacity: 0; }
  91%, 94%  { opacity: 1; }
  95%, 100% { opacity: 0; }
}

/* —— 呼吸：头像缓慢起伏（用独立的 translate 属性，避免与入场 transform 过渡打架） —— */
.mv-float { animation: float 5.5s var(--e-in-out) infinite; }
@keyframes float {
  0%, 100% { translate: 0 0 }
  50%      { translate: 0 -7px }
}

/* —— 光环：头像背后的缓慢旋转光弧 + 柔光 —— */
.mv-orb { position: relative; }
.mv-orb::before,
.mv-orb::after {
  content: ""; position: absolute; pointer-events: none;
  left: 50%; top: 50%; z-index: 0;
}
.mv-orb::before {
  width: 118%; aspect-ratio: 1; margin: -59% 0 0 -59%;
  border-radius: 50%;
  background: radial-gradient(circle,
              color-mix(in srgb, var(--accent) 26%, transparent) 0%,
              transparent 62%);
  filter: blur(14px);
  animation: breathe 5.5s var(--e-in-out) infinite;
}
.mv-orb::after {
  width: 106%; aspect-ratio: 1; margin: -53% 0 0 -53%;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
              transparent 0 68%,
              color-mix(in srgb, var(--accent) 62%, transparent) 88%,
              transparent 100%);
  -webkit-mask: radial-gradient(circle, transparent 61%, #000 62%);
          mask: radial-gradient(circle, transparent 61%, #000 62%);
  opacity: .5;
  animation: spin 14s linear infinite;
}
.mv-orb > * { position: relative; z-index: 1; }
@keyframes breathe { 0%, 100% { opacity: .75; transform: scale(1) } 50% { opacity: 1; transform: scale(1.06) } }
@keyframes spin { to { transform: rotate(360deg) } }

/* —— 入场：元素进入视口后上浮淡入（用 transition，避免与 hover 的 animation 打架） —— */
.js-motion .mv {
  opacity: 0; transform: translate3d(0, var(--rise), 0);
  transition: opacity var(--t-enter) var(--e-out) var(--d, 0ms),
              transform var(--t-enter) var(--e-out) var(--d, 0ms);
}
.js-motion .mv.rv { opacity: 1; transform: none; }
/* 图片瓦片另加一点缩放进场 */
.js-motion .mv-tile {
  opacity: 0; transform: translate3d(0, var(--rise), 0) scale(.97);
  transition: opacity var(--t-enter) var(--e-out) var(--d, 0ms),
              transform var(--t-enter) var(--e-out) var(--d, 0ms);
}
.js-motion .mv-tile.rv { opacity: 1; transform: none; }
/* hover 的位移必须排在入场规则之后，否则会被 .mv-tile.rv 的 transform:none 压掉 */
.js-motion .mv-tile.rv:hover, .tile.mv-tile.rv:hover {
  transform: translateY(-4px);
  transition: transform var(--t-base) var(--e-out), border-color var(--t-fast) linear,
              box-shadow var(--t-base) var(--e-out);
}

/* —— 标题遮罩揭示：文字从下往上“擦”出来 —— */
/* 注意：被裁剪的元素 IntersectionObserver 会判定为不相交，所以外层 .mv-maskw 只管裁切，
   被观察 / 被过渡的是内层 .mv-maski（它始终有真实布局盒）。 */
.js-motion .mv-maskw { overflow: hidden; display: block; }
.js-motion .mv-maski {
  display: block; transform: translate3d(0, 105%, 0);
  transition: transform 430ms var(--e-out) var(--d, 0ms);
}
.js-motion .mv-maski.rv { transform: none; }

/* —— 分隔线 / 下划线生长 —— */
.js-motion .mv-line { transform: scaleX(0); transform-origin: left center; }
.js-motion .mv-line.rv { transform: scaleX(1); transition: transform 640ms var(--e-out) var(--d, 0ms); }

/* —— 章节标题：左侧短竖条展开 + 标题上浮 —— */
.js-motion .doc h2.mv { position: relative; padding-left: 0; }
.js-motion .doc h2.mv.rv { padding-left: var(--s4); transition: padding-left 0ms; }
.doc h2.mv::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 3px; height: 1.1em;
  margin-top: -.55em; border-radius: 3px;
  background: var(--accent); transform: scaleY(0); transform-origin: center top;
  opacity: 0;
}
.doc h2.mv.rv::before {
  opacity: 1; transform: scaleY(1);
  transition: transform 380ms 70ms var(--e-spring), opacity 180ms 70ms linear;
}

/* —— 交互反馈 —— */
.cmd {
  border-radius: 4px;
  transition: color var(--t-fast) linear, background-color var(--t-fast) linear,
              box-shadow var(--t-base) var(--e-out);
}
.cmd:hover { box-shadow: 0 0 0 6px var(--accent-soft); }
.cmd:active { background-color: var(--accent-soft); }
.cmd.copied { animation: flash 460ms var(--e-out); }
@keyframes flash {
  0%   { background-color: var(--accent-soft); box-shadow: 0 0 0 8px var(--accent-soft) }
  100% { background-color: transparent; box-shadow: 0 0 0 0 transparent }
}

.side-nav a { position: relative; }
.side-nav a::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 3px; height: 18px;
  margin-top: -9px; border-radius: 0 3px 3px 0;
  background: var(--accent); transform: scaleY(0);
  transition: transform var(--t-base) var(--e-spring);
}
.side-nav a.on::before { transform: scaleY(1); }

.btn {
  position: relative; overflow: hidden;
  transition: transform var(--t-base) var(--e-out), filter var(--t-fast) linear,
              border-color var(--t-fast) linear, color var(--t-fast) linear,
              box-shadow var(--t-base) var(--e-out);
}
.btn::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 32%, rgba(255,255,255,.34) 50%, transparent 68%);
  transform: translateX(-105%);
  transition: transform 620ms var(--e-out);
  pointer-events: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -14px rgba(60,40,120,.6); }
.btn:hover::after { transform: translateX(105%); }
.btn:active { transform: translateY(0) scale(.985); }
.btn.ghost::after { background: linear-gradient(105deg, transparent 32%, color-mix(in srgb, var(--accent) 16%, transparent) 50%, transparent 68%); }

.side-foot button, .burger, .tsearch {
  transition: color var(--t-fast) linear, border-color var(--t-fast) linear,
              background-color var(--t-fast) linear, transform var(--t-base) var(--e-out);
}
.side-foot button:active, .burger:active, .tsearch:active { transform: scale(.96); }

.entry { position: relative; overflow: hidden; }
.entry::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--entry-c, var(--accent));
  transform: scaleY(0); transform-origin: center top;
  transition: transform var(--t-base) var(--e-out);
}
.entry:hover::before { transform: scaleY(1); }
.entry-no { transition: background-color var(--t-base) var(--e-out), color var(--t-base) var(--e-out), transform var(--t-base) var(--e-spring); }
.entry:hover .entry-no { background: var(--entry-c, var(--accent)); color: #fff; transform: scale(1.08); }
.entry > * { position: relative; }

.tile { isolation: isolate; }
.tile::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(105deg, transparent 36%, rgba(255,255,255,.5) 50%, transparent 64%);
  transform: translateX(-110%);
  transition: transform 700ms var(--e-out);
}
.tile:hover::after { transform: translateX(110%); }
.tile:hover figcaption { color: var(--t1); border-top-color: var(--accent); }

/* —— 滚动进度条 —— */
.progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 100%; z-index: 90;
  background: linear-gradient(90deg, var(--accent), var(--chu) 55%, var(--mai));
  transform: scaleX(0); transform-origin: 0 50%;
  will-change: transform;
}

/* —— 入场关键帧（不依赖 JS 的首屏动画） —— */
@keyframes rise-in { from { opacity: 0; transform: translate3d(0, var(--rise), 0) } to { opacity: 1; transform: none } }
@keyframes ripple {
  from { opacity: .5; transform: scale(.92) }
  to   { opacity: 0;  transform: scale(1.12) }
}

/* —— 减少动态效果 —— */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .blink .face-shut { animation: none !important; opacity: 0 !important; }
  .js-motion .mv, .js-motion .mv-tile, .js-motion .mv-maski {
    opacity: 1 !important; transform: none !important; clip-path: none !important;
  }
  .mv-orb::before, .mv-orb::after, .mv-float { animation: none !important; }
  .progress { display: none; }
}

.side-search { margin-bottom: var(--s4); }
.side-search input {
  width: 100%; height: 36px;
  padding: 0 var(--s3);
  font: var(--fs-mini)/1 var(--ui);
  color: var(--t1); background: var(--bg);
  border: 1px solid var(--line); border-radius: 9px;
  outline: none;
}
.side-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.side-nav .nav-group {
  margin: var(--s4) 0 var(--s2);
  font-size: var(--fs-meta); font-weight: 700; letter-spacing: 1.4px;
  color: var(--t3); text-transform: uppercase;
}
.side-nav ul { list-style: none; margin: 0; padding: 0; }
.side-nav a {
  display: flex; align-items: center; gap: var(--s2);
  padding: 7px var(--s3); margin-bottom: 2px;
  border-radius: 8px; text-decoration: none;
  color: var(--t2); font-size: var(--fs-mini); font-weight: 600;
  transition: background .14s, color .14s;
}
.side-nav a:hover { background: var(--bg-soft); color: var(--t1); }
.side-nav a.on { background: var(--accent-soft); color: var(--accent); }
.side-nav a i {
  margin-left: auto; font-style: normal;
  font-size: var(--fs-meta); font-weight: 700; color: var(--t3);
  background: var(--bg-soft); border-radius: 999px; padding: 0 6px;
}
.side-nav a.on i { color: var(--accent); background: var(--bg); }

.side-foot { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--line); }
.side-foot button {
  width: 100%; height: 34px; cursor: pointer;
  font: var(--fs-meta)/1 var(--ui); font-weight: 600;
  color: var(--t2); background: var(--bg);
  border: 1px solid var(--line); border-radius: 9px;
}
.side-foot button:hover { color: var(--t1); border-color: var(--accent); }

/* —— 顶栏（移动端） —— */
.topbar {
  display: none;
  position: sticky; top: 0; z-index: 70;
  align-items: center; gap: var(--s3);
  height: 54px; padding: 0 var(--s4);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.burger, .tsearch {
  height: 32px; cursor: pointer;
  font: var(--fs-mini)/1 var(--ui); font-weight: 700;
  color: var(--t1); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 8px;
}
.burger { width: 36px; font-size: 16px; }
.tsearch { padding: 0 var(--s3); margin-left: auto; }
.topbar-title { font-size: var(--fs-mini); font-weight: 700; }

.scrim {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(20, 16, 34, .45);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--t-base) var(--e-out), visibility 0s linear var(--t-base);
}
.scrim.show {
  opacity: 1; visibility: visible; pointer-events: auto;
  transition: opacity var(--t-base) var(--e-out), visibility 0s;
}

/* ==================== 文档内容 ==================== */
.doc {
  flex: 1 1 auto; min-width: 0;
  /* 居中：只在 flex 容器有剩余空间时才生效，否则等同占满。
     不居中时剩余空间会全部堆在右侧——2048px 屏上会空掉 43% 的宽度。 */
  max-width: var(--doc-max);
  margin-inline: auto;
  padding: var(--s6) var(--s6) var(--s7);
}
/* 正文行宽单独收窄，宽度变大后长句不会拉成一条线 */
.doc p, .doc li, .callout { max-width: var(--measure); }
.eyebrow {
  margin: 0 0 var(--s2);
  font-size: var(--fs-meta); font-weight: 700; letter-spacing: 2.2px;
  color: var(--t3); text-transform: uppercase;
}
.doc h1 {
  margin: 0 0 var(--s3);
  font-size: var(--fs-h1); font-weight: 800; letter-spacing: -.4px; line-height: 1.25;
}
.lead { margin: 0 0 var(--s5); font-size: var(--fs-lead); color: var(--t2); line-height: 1.8; }
.lead b { color: var(--accent); }

.doc h2 {
  margin: var(--s6) 0 var(--s3);
  padding-top: var(--s3);
  font-size: var(--fs-h2); font-weight: 700;
  border-top: 1px solid var(--line);
}
.doc h2:first-of-type { border-top: none; padding-top: 0; }

/* —— 指令表 —— */
.cmds {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.cmds tr { border-bottom: 1px solid var(--line-2); }
.cmds tr:last-child { border-bottom: none; }
.cmds td { padding: var(--s3) var(--s4) var(--s3) 0; vertical-align: top; }
.cmds td:first-child { width: 44%; padding-left: 0; }
.cmds td:last-child { color: var(--t2); padding-right: 0; }
.cmds tr:hover { background: var(--bg-soft); }

.cmd {
  display: inline-block; text-align: left;
  font-family: var(--mono); font-size: var(--fs-mini); font-weight: 600;
  line-height: 1.65; color: var(--accent);
  background: none; border: none; padding: 0;
  cursor: copy; overflow-wrap: anywhere;
}
.cmd:hover { text-decoration: underline; text-underline-offset: 3px; }
tr.admin .cmd { color: var(--ok); }

.ex {
  display: block; margin-top: var(--s2);
  font-family: var(--mono); font-size: var(--fs-meta); line-height: 1.8;
  color: var(--t3);
  border-left: 2px solid var(--line);
  padding-left: var(--s3);
  overflow-wrap: anywhere;
}

.callout {
  margin: var(--s5) 0 0;
  padding: var(--s3) var(--s4);
  font-size: var(--fs-mini); color: var(--t2);
  background: var(--bg-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 9px 9px 0;
}

/* ==================== 图片瓦片 ==================== */
/* 4 列：1240px 时瓦片 289px、方版正好 289px 高，比 3 列 394px 的大块更耐看；
   窄屏由 auto-fit 自动降列，不需要额外断点。 */
.grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); }
.tile {
  position: relative; margin: 0;
  aspect-ratio: 4 / 3;
  background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r2);
  overflow: hidden; cursor: zoom-in;
  transition: transform var(--t-base) var(--e-out), border-color var(--t-fast) linear,
              box-shadow var(--t-base) var(--e-out);
}
.grid-portrait .tile { aspect-ratio: 3 / 4; }
.grid-square .tile { aspect-ratio: 1 / 1; }
.tile img {
  width: 100%; height: 100%;
  object-fit: contain;
  background: var(--bg-soft);
}
.tile.crop img { object-fit: cover; object-position: top center; }
.tile figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 28px; display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-meta); color: var(--t2);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(4px);
  border-top: 1px solid var(--line-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 0 var(--s2);
}
.tile:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 16px 34px -20px rgba(60, 40, 120, .6);
}

/* ==================== 首页 ==================== */
/* 后端面板入口（制作人跳管理面板） */
.panel-entry {
  margin: var(--s4) 0 var(--s1);
  display: flex;
}
.panel-entry .btn {
  flex: none;
}
.doc-home .panel-entry {
  justify-content: flex-end;
}
.panel-entry a[target="_blank"]::after {
  content: ""; margin-left: var(--s1);
}
.doc .panel-entry + h2 { margin-top: var(--s4); }

.doc-home { --doc-max: 1240px; --measure: 72ch; }
.hero {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) 236px;
  gap: var(--s6); align-items: center;
  padding: var(--s4) var(--s2) var(--s6);
  margin-bottom: var(--s5);
  border-bottom: 1px solid var(--line);
  overflow: clip;          /* 背景柔光会外扩，裁掉以免窄屏出现横向滚动 */
}
/* 柔光背景 + 极淡点阵，给首屏一点纵深 */
.hero::before {
  content: ""; position: absolute; inset: -34px -40px -18px -26px; z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 82% at 82% 18%,
      color-mix(in srgb, var(--accent) 11%, transparent) 0%, transparent 58%),
    radial-gradient(90% 70% at 8% 92%,
      color-mix(in srgb, var(--chu) 7%, transparent) 0%, transparent 60%);
}
.hero > * { position: relative; z-index: 1; }

.hero .blink {
  width: 100%; max-width: 236px; margin-inline: auto;
  height: auto;              /* 必须放开基础 .blink 的 26px 高度，否则 aspect-ratio 无效 */
  aspect-ratio: 1;
}
.hero .blink img { width: 100%; height: 100%; object-fit: contain; }
/* 呼吸光环 */
.hero .blink::after {
  content: ""; position: absolute; inset: 6%; border-radius: 50%; z-index: -1;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
  animation: ripple 5.5s var(--e-in-out) infinite;
}

.hero-text h1 { margin-bottom: var(--s3); }
.hero-text .eyebrow { margin-bottom: var(--s2); }
.hero-text .lead { margin-bottom: var(--s5); }
.hero-cta { display: flex; flex-wrap: wrap; gap: var(--s3); margin: 0; }
.btn {
  display: inline-flex; align-items: center; height: 40px;
  padding: 0 var(--s5); border-radius: 10px;
  background: var(--accent); color: #fff;
  font-size: var(--fs-mini); font-weight: 700; text-decoration: none;
  box-shadow: 0 6px 18px -12px color-mix(in srgb, var(--accent) 80%, transparent);
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: var(--bg); color: var(--t1); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }

.entries {
  display: grid; gap: var(--s3);
  /* 5 张卡：内容宽 ≥1180px 时排成 3+2，比 4+1 更稳 */
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  margin: var(--s5) 0 0;
}
.entry {
  display: grid; grid-template-columns: 26px 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px var(--s3);
  padding: var(--s4);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r2);
  text-decoration: none; color: var(--t1);
  transition: border-color var(--t-base) var(--e-out), transform var(--t-base) var(--e-out),
              box-shadow var(--t-base) var(--e-out), background-color var(--t-base) var(--e-out);
}
.entry[data-c="chu"] { --entry-c: var(--chu); }
.entry[data-c="mai"] { --entry-c: var(--mai); }
.entry[data-c="fun"] { --entry-c: var(--fun); }
.entry[data-c="more"] { --entry-c: var(--more); }
.entry:hover {
  border-color: var(--entry-c, var(--accent));
  transform: translateY(-3px);
  box-shadow: 0 14px 30px -20px rgba(60,40,120,.55);
}
.entry-no {
  grid-row: span 2; display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: var(--r1);
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--mono); font-size: var(--fs-meta); font-weight: 700;
  transition: background-color var(--t-base) var(--e-out), color var(--t-base) var(--e-out),
              transform var(--t-base) var(--e-spring);
}
.entry b { font-size: var(--fs-body); font-weight: 700; }
.entry-en { grid-column: 2; font-size: var(--fs-meta); color: var(--t3); letter-spacing: 1px; }
.entry-n {
  grid-column: 3; grid-row: 1 / span 2; align-self: center;
  font-size: var(--fs-meta); color: var(--t3);
  transition: color var(--t-base) var(--e-out), transform var(--t-base) var(--e-out);
}
.entry:hover .entry-n { color: var(--entry-c, var(--accent)); transform: translateX(-2px); }

.how { margin: 0; padding-left: var(--s5); color: var(--t2); }
.how li { margin-bottom: var(--s2); }

/* ==================== 搜索 ==================== */
.results {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(20, 16, 34, .5);
  display: flex; justify-content: center; padding: 8vh var(--s4);
  animation: scrim-in 200ms var(--e-out) both;
  backdrop-filter: blur(2px);
}
@keyframes scrim-in { from { opacity: 0 } to { opacity: 1 } }
.results[hidden] { display: none; }
.results-in {
  width: min(680px, 100%); max-height: 76vh; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r3);
  box-shadow: 0 30px 70px -30px rgba(20, 10, 50, .6);
  padding: var(--s3);
  animation: sheet-in 300ms var(--e-out) both;
}
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(-14px) scale(.985) }
  to   { opacity: 1; transform: none }
}
.r-item {
  display: block; padding: var(--s3); border-radius: 9px;
  text-decoration: none; color: var(--t1);
  transition: background-color var(--t-fast) linear, transform var(--t-base) var(--e-out);
}
.r-item:hover { background: var(--bg-soft); transform: translateX(3px); }
.r-cmd { font-family: var(--mono); font-size: var(--fs-mini); font-weight: 600; color: var(--accent); }
.r-desc { display: block; font-size: var(--fs-mini); color: var(--t2); margin-top: 2px; }
.r-meta { display: block; font-size: var(--fs-meta); color: var(--t3); margin-top: var(--s1); }
.r-empty { padding: var(--s5); text-align: center; color: var(--t3); font-size: var(--fs-mini); }

/* ==================== 页脚 / 灯箱 / toast ==================== */
.foot {
  border-top: 1px solid var(--line);
  padding: var(--s6) var(--s6) var(--s7);
  text-align: center;
}
.foot img { width: 118px; margin: 0 auto var(--s4); opacity: .9; }
.foot p { margin: 0 0 var(--s2); font-size: var(--fs-mini); font-weight: 600; color: var(--t2); }
.foot p.dim { font-size: var(--fs-meta); font-weight: 400; color: var(--t3); line-height: 1.9; }

.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(18, 13, 32, .93);
  display: flex; align-items: center; justify-content: center;
  padding: 3vh 3vw; cursor: zoom-out;
  animation: scrim-in 180ms var(--e-out) both;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%; max-height: 94vh; width: auto; border-radius: var(--r2);
  animation: zoom-in 320ms var(--e-spring) both;
}
@keyframes zoom-in {
  from { opacity: 0; transform: scale(.94) }
  to   { opacity: 1; transform: none }
}
.lb-close {
  position: absolute; top: var(--s4); right: var(--s5);
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .16);
  color: #fff; font-size: 21px; cursor: pointer;
  transition: background-color var(--t-fast) linear, transform var(--t-base) var(--e-spring);
}
.lb-close:hover { background: rgba(255, 255, 255, .28); transform: rotate(90deg); }

.toast {
  position: fixed; left: 50%; bottom: var(--s6);
  z-index: 300; padding: 8px 16px; border-radius: 10px;
  background: var(--accent); color: #fff;
  font-size: var(--fs-meta); font-weight: 700;
  box-shadow: 0 12px 30px -14px rgba(60, 20, 140, .7);
  animation: toast-in 300ms var(--e-spring) both;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 14px) scale(.94) }
  to   { opacity: 1; transform: translate(-50%, 0) scale(1) }
}
.toast[hidden] { display: none; }

/* ==================== 响应式 ==================== */
@media (max-width: 1000px) {
  /* 窄屏没有剩余空间，居中自动失效；这里显式放开上限，避免两侧出现对称留白 */
  .doc, .doc-home { max-width: none; padding: var(--s5) var(--s5) var(--s6); }
  .doc p, .doc li, .callout { max-width: none; }
}
@media (max-width: 860px) {
  .topbar { display: flex; transition: box-shadow var(--t-base) var(--e-out), height var(--t-base) var(--e-out); }
  .topbar.lift { box-shadow: 0 6px 20px -14px rgba(20, 10, 50, .5); }
  .side {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100vh;
    transform: translateX(-102%);
    transition: transform var(--t-slow) var(--e-in-out);
    box-shadow: 0 0 40px rgba(20, 10, 50, .25);
    width: 280px; flex-basis: 280px;
    visibility: hidden;
  }
  .side.open { transform: translateX(0); visibility: visible; }
  .doc { padding: var(--s5) var(--s4) var(--s6); }
  :root { --fs-h1: 25px; --fs-h2: 18px; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: var(--s5); text-align: center; }
  .hero .blink { width: 170px; max-width: 170px; height: auto; margin-inline: auto; grid-row: 1; }
  .hero-text .lead { margin-inline: auto; max-width: none; }
  .hero-cta { justify-content: center; }
  .entries { grid-template-columns: 1fr; }
  .cmds td:first-child { width: 100%; }
  .cmds, .cmds tbody, .cmds tr, .cmds td { display: block; width: auto; }
  .cmds tr { padding: var(--s3) 0; }
  .cmds td { padding: 0; }
  .cmds td:last-child { margin-top: var(--s2); }
  /* .grid 交给 auto-fit 逐级降列，无需固定列数 */
}
@media (max-width: 520px) {
  .foot { padding: var(--s5) var(--s4) var(--s6); }
}
