/* ============================================================
   爪哇碎碎念 · 设计系统
   设计语言：shadcn/ui 语义化 token（纯 CSS 实现，无构建依赖）
   品牌：咖啡棕 + 米白（爪哇 = Java 旧译 = 咖啡产地），避开技术号普遍的蓝紫
   ============================================================ */

:root {
  /* 表面与文字 */
  --background: oklch(0.982 0.007 85);
  --foreground: oklch(0.22 0.015 60);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.22 0.015 60);
  --muted: oklch(0.955 0.008 82);
  --muted-foreground: oklch(0.52 0.02 65);

  /* 品牌与强调 */
  --primary: oklch(0.44 0.085 55);
  --primary-foreground: oklch(0.985 0.005 85);
  --accent: oklch(0.58 0.14 42);
  --accent-foreground: oklch(0.99 0.005 85);

  /* 结构与状态 */
  --border: oklch(0.9 0.01 78);
  --input: oklch(0.9 0.01 78);
  --ring: oklch(0.44 0.085 55);

  /* 语义节点色（与 map.js 的 TONE_COLOR 保持一致） */
  --tone-primary: #8b5e34;
  --tone-info: #0e7490;
  --tone-success: #15803d;
  --tone-warn: #b45309;
  --tone-danger: #b91c1c;
  --tone-neutral: #57534e;
  --tone-shared: #c2410c;
  --tone-private: #1d4ed8;

  /* 圆角单源派生 */
  --radius: 0.75rem;
  --radius-sm: calc(var(--radius) * 0.6);
  --radius-md: calc(var(--radius) * 0.8);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) * 1.4);

  /* 阴影：极克制，靠 1px 边框分层 */
  --shadow-sm: 0 1px 2px oklch(0.22 0.015 60 / 0.05);
  --shadow-md: 0 6px 20px -8px oklch(0.22 0.015 60 / 0.14);
  --shadow-lg: 0 16px 48px -12px oklch(0.22 0.015 60 / 0.2);

  /* 动效 token */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 140ms;
  --dur-base: 220ms;
  --dur-slow: 320ms;

  --maxw: 720px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 元素上的 hidden 属性必须压过组件自身的 display（如 .share-overlay 的 flex），
   否则浮层会在页面加载时就展开。 */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------------- 顶部栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in oklab, var(--background) 86%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex; align-items: center; gap: 10px;
  height: 56px; max-width: var(--maxw); margin: 0 auto; padding: 0 20px;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 15px; letter-spacing: 0.01em; color: var(--foreground);
}
.brand:hover { text-decoration: none; }
.brand-dot {
  width: 22px; height: 22px; border-radius: 7px;
  background: linear-gradient(140deg, var(--primary), var(--accent));
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 800; letter-spacing: -0.02em;
  box-shadow: var(--shadow-sm);
}
.topbar .spacer { flex: 1; }
.topbar .nav-link { font-size: 13px; color: var(--muted-foreground); }
.topbar .nav-link:hover { color: var(--foreground); text-decoration: none; }

/* ---------------- 首屏 ---------------- */
.hero { padding: 40px 0 26px; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--primary); background: color-mix(in oklab, var(--primary) 9%, white);
  border: 1px solid color-mix(in oklab, var(--primary) 22%, white);
  padding: 4px 10px; border-radius: 999px; margin-bottom: 16px;
}
.hero h1 {
  margin: 0 0 12px; font-size: 30px; line-height: 1.28;
  letter-spacing: -0.02em; font-weight: 800;
}
.hero h1 em { font-style: normal; color: var(--primary); }
.hero p.lead {
  margin: 0; font-size: 15px; color: var(--muted-foreground); max-width: 34em;
}
.hero-stats {
  display: flex; gap: 26px; margin-top: 22px; padding-top: 20px;
  border-top: 1px dashed var(--border);
}
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats b { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.hero-stats span { font-size: 11.5px; color: var(--muted-foreground); }

/* ---------------- 入口三宫格 ---------------- */
.entry-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin: 4px 0 34px;
}
.entry-card {
  display: block; padding: 14px 12px; border-radius: var(--radius-lg);
  background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out);
}
.entry-card:hover {
  text-decoration: none; transform: translateY(-2px);
  border-color: color-mix(in oklab, var(--primary) 34%, white);
  box-shadow: var(--shadow-md);
}
.entry-card:active { transform: translateY(0); }
.entry-icon {
  width: 30px; height: 30px; border-radius: 9px; margin-bottom: 10px;
  background: color-mix(in oklab, var(--primary) 10%, white);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.entry-card b { display: block; font-size: 14px; font-weight: 700; color: var(--foreground); }
.entry-card span { display: block; font-size: 11.5px; color: var(--muted-foreground); margin-top: 3px; line-height: 1.5; font-weight: 400; }

/* ---------------- 分区标题 ---------------- */
.section-head {
  display: flex; align-items: baseline; gap: 10px; margin: 0 0 14px;
}
.section-head h2 { margin: 0; font-size: 17px; font-weight: 750; letter-spacing: -0.01em; }
.section-head .count { font-size: 12px; color: var(--muted-foreground); }
.section-head .more { margin-left: auto; font-size: 12.5px; }

/* ---------------- 场景卡片 ---------------- */
.scene-list { display: grid; gap: 10px; padding-bottom: 8px; }

/* ---------- 首页：知识域卡片 ---------- */
.domain-list {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px; padding-bottom: 8px;
}
@media (max-width: 340px) {
  .domain-list { grid-template-columns: 1fr; }
}
.domain-card {
  display: block; padding: 13px 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  text-decoration: none; color: var(--foreground);
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.domain-card:hover { border-color: var(--domain-accent, var(--primary)); }
.domain-card:active { transform: scale(0.985); }
.dc-head { display: flex; align-items: center; gap: 7px; }
.dc-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px;
  background: var(--domain-accent, var(--primary));
}
.dc-head b { font-size: 14px; font-weight: 750; letter-spacing: -0.01em; }
.dc-count { margin-left: auto; font-size: 11px; color: var(--muted-foreground); }
.domain-card p {
  margin: 7px 0 0; font-size: 12px; line-height: 1.55; color: var(--muted-foreground);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.scene-card {
  display: block; padding: 16px 16px 14px; border-radius: var(--radius-lg);
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out);
}
.scene-card:hover {
  text-decoration: none; transform: translateY(-2px);
  border-color: color-mix(in oklab, var(--primary) 30%, white);
  box-shadow: var(--shadow-md);
}
.scene-card .tag {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--primary); background: color-mix(in oklab, var(--primary) 8%, white);
  border-radius: 999px; padding: 2px 9px; margin-bottom: 9px;
}
.scene-card h2 { margin: 0 0 6px; font-size: 16.5px; font-weight: 750; color: var(--foreground); letter-spacing: -0.01em; }
.scene-card p { margin: 0; font-size: 13.5px; color: var(--muted-foreground); line-height: 1.62; }
.scene-card .meta {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
  font-size: 11.5px; color: var(--muted-foreground);
}
.scene-card .meta .go { margin-left: auto; color: var(--primary); font-weight: 650; }

.tool-card { border-style: dashed; background: color-mix(in oklab, var(--primary) 3%, white); }
.tool-card .tag { color: var(--accent); background: color-mix(in oklab, var(--accent) 10%, white); }

.loading, .empty {
  padding: 36px 16px; text-align: center; color: var(--muted-foreground); font-size: 14px;
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 18px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 650; font-family: inherit; cursor: pointer;
  border: 1px solid var(--border); background: var(--card); color: var(--foreground);
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.btn:hover { background: var(--muted); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.btn.primary:hover { background: color-mix(in oklab, var(--primary) 88%, black); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }
.btn:disabled:hover { background: var(--card); }
.btn.primary:disabled:hover { background: var(--primary); }

/* ---------------- 关注引导 ---------------- */
.follow-box {
  margin: 30px 0 0; padding: 20px; border-radius: var(--radius-xl);
  background: linear-gradient(150deg, color-mix(in oklab, var(--primary) 8%, white), color-mix(in oklab, var(--accent) 6%, white));
  border: 1px solid color-mix(in oklab, var(--primary) 18%, white);
}
.follow-box h3 { margin: 0 0 6px; font-size: 15px; font-weight: 750; }
.follow-box p { margin: 0 0 12px; font-size: 13px; color: var(--muted-foreground); line-height: 1.6; }
.kw-list { display: flex; flex-wrap: wrap; gap: 8px; }
.kw {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  padding: 5px 11px; border-radius: 8px; background: var(--card);
  border: 1px solid var(--border); color: var(--foreground);
}
.kw b { color: var(--primary); }

.footer {
  padding: 26px 0 34px; margin-top: 26px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted-foreground); line-height: 1.8;
}
.footer a { color: var(--muted-foreground); text-decoration: underline; text-underline-offset: 3px; }

/* ============================================================
   地图页
   ============================================================ */
.map-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 14px;
  background: color-mix(in oklab, var(--background) 88%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.map-header .back {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; color: var(--foreground); background: var(--muted);
}
.map-header .back:hover { text-decoration: none; background: var(--border); }
.map-title {
  flex: 1; font-size: 15px; font-weight: 700; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.share-btn {
  flex: 0 0 auto; height: 32px; padding: 0 13px; border-radius: 9px; cursor: pointer;
  font-size: 12.5px; font-weight: 650; font-family: inherit;
  border: 1px solid color-mix(in oklab, var(--primary) 30%, white);
  background: color-mix(in oklab, var(--primary) 9%, white);
  color: var(--primary);
}
.share-btn:active { transform: scale(0.97); }

.toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; max-width: var(--maxw); margin: 0 auto;
}
.progress { font-size: 12.5px; color: var(--muted-foreground); }
.progress b { color: var(--primary); font-weight: 750; }
.steps { margin-left: auto; display: flex; gap: 8px; }
.steps button {
  height: 32px; padding: 0 13px; border-radius: 9px; cursor: pointer;
  font-size: 12.5px; font-weight: 650; font-family: inherit;
  border: 1px solid var(--border); background: var(--card); color: var(--foreground);
}
.steps button.primary {
  background: var(--primary); border-color: var(--primary); color: var(--primary-foreground);
}
.steps button:disabled { opacity: 0.4; }

.legend {
  display: flex; flex-wrap: wrap; gap: 7px;
  padding: 0 14px 12px; max-width: var(--maxw); margin: 0 auto;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--muted-foreground);
  background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }

/* ---------- 目录页：知识域导航 + 搜索 ---------- */
.domain-nav {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 2px 0 16px; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.domain-nav::-webkit-scrollbar { display: none; }
.domain-nav .chip {
  flex: 0 0 auto; font-size: 12px; padding: 5px 12px;
  text-decoration: none; color: var(--foreground);
}
.domain-nav .chip::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--chip-accent, var(--primary));
}

.search-box { margin-bottom: 22px; }
.search-box input {
  width: 100%; font-size: 14px; font-family: inherit;
  padding: 12px 14px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--card);
  color: var(--foreground); outline: none; -webkit-appearance: none;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.search-box input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px oklch(0.44 0.085 55 / 0.12);
}
.search-box input::placeholder { color: var(--muted-foreground); }
.search-hint { display: block; margin-top: 7px; font-size: 12px; color: var(--muted-foreground); }


.canvas-wrap {
  max-width: var(--maxw); margin: 0 auto; padding: 0 14px 20px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
/* 宽画布（手写布局的 1000 单位图）按最小宽度展示而不是整图缩放：
   压到 360px 会把 15px 文字缩成 5px，必须允许横向平移。 */
/* 窄画布（自动布局生成的单列清单）反过来处理：按容器宽度缩放，
   手机上接近 1:1 显示、不用横滑。判定由 map.js 按 canvas 宽度加 class。 */
#svg.canvas-fit { min-width: 0; }
.canvas-wrap.wrap-fit { max-width: 520px; overflow-x: visible; }
#svg {
  display: block; width: 100%; min-width: 620px; height: auto; border-radius: var(--radius-lg);
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}

/* SVG 元素 */
.edge { stroke: #d6cec3; stroke-width: 1.5; }
.edge-label {
  font-size: 15px; fill: var(--muted-foreground);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.node { cursor: pointer; }
.node rect {
  transition: filter var(--dur-base) var(--ease-out), stroke-width var(--dur-fast) var(--ease-out);
}
.node:hover rect { filter: brightness(0.97); }
.node:active rect { filter: brightness(0.93); }
.n-badge-bg { fill: #fff; stroke: currentColor; stroke-width: 1.5; }
.n-badge { font-size: 20px; font-weight: 750; fill: currentColor; }
.n-title { font-size: 23px; font-weight: 650; fill: var(--foreground); }
.n-short { font-size: 17px; fill: var(--muted-foreground); }
.node.selected rect { stroke-width: 2.5; filter: drop-shadow(0 4px 12px oklch(0.22 0.015 60 / 0.14)); }

/* tone：浅底 + 同色描边，选中加粗描边 */
.tone-primary rect { fill: #f7efe6; stroke: var(--tone-primary); stroke-width: 1.5; }
.tone-primary { color: var(--tone-primary); }
.tone-info rect { fill: #e6f3f7; stroke: var(--tone-info); stroke-width: 1.5; }
.tone-info { color: var(--tone-info); }
.tone-success rect { fill: #e8f4ea; stroke: var(--tone-success); stroke-width: 1.5; }
.tone-success { color: var(--tone-success); }
.tone-warn rect { fill: #fdf1e3; stroke: var(--tone-warn); stroke-width: 1.5; }
.tone-warn { color: var(--tone-warn); }
.tone-danger rect { fill: #fbeaea; stroke: var(--tone-danger); stroke-width: 1.5; }
.tone-danger { color: var(--tone-danger); }
.tone-neutral rect { fill: #f2f0ed; stroke: var(--tone-neutral); stroke-width: 1.5; }
.tone-neutral { color: var(--tone-neutral); }
.tone-shared rect { fill: #fdece3; stroke: var(--tone-shared); stroke-width: 1.5; }
.tone-shared { color: var(--tone-shared); }
.tone-private rect { fill: #e8eefb; stroke: var(--tone-private); stroke-width: 1.5; }
.tone-private { color: var(--tone-private); }

/* ---------------- 讲解卡（bottom sheet） ---------------- */
.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop {
  position: absolute; inset: 0; background: oklch(0.22 0.015 60 / 0.42);
  backdrop-filter: blur(2px); animation: fade var(--dur-base) var(--ease-out);
}
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 86vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--card); border-radius: 20px 20px 0 0;
  padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  animation: slide-up var(--dur-slow) var(--ease-out);
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes slide-up { from { transform: translateY(24px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

.sheet-close {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px;
  border-radius: 50%; border: none; background: var(--muted); color: var(--muted-foreground);
  font-size: 19px; line-height: 1; cursor: pointer;
}
.sheet-head { padding-right: 40px; margin-bottom: 18px; }
.tone-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-bottom: 8px; }
.sheet-head h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.35; }
.sheet-short {
  margin-top: 6px; font-size: 13px; color: var(--muted-foreground);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.sheet-body section { margin: 0 0 18px; }
.sheet-body section h3 {
  margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.05em;
  color: var(--primary);
}
.sheet-body section p { margin: 0; font-size: 15px; line-height: 1.75; }
.sheet-body section.mis {
  background: color-mix(in oklab, var(--accent) 7%, white);
  border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; padding: 12px 14px;
}
.sheet-body section.mis h3 { color: var(--accent); }
/* 一句话结论是每个节点必有的一段，做成高亮块放在最前面 */
.sheet-body section.summary {
  background: color-mix(in oklab, var(--primary) 6%, white);
  border-left: 3px solid var(--primary);
  border-radius: 0 10px 10px 0;
  padding: 12px 14px;
}
.sheet-body section.summary p { font-size: 15.5px; font-weight: 550; line-height: 1.7; }
.sheet-body section p.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  background: var(--muted); padding: 10px 12px; border-radius: 10px;
  word-break: break-all; line-height: 1.6; color: var(--foreground);
}
.sheet-actions { display: flex; gap: 10px; padding-top: 6px; }
.sheet-actions button {
  flex: 1; height: 44px; border-radius: var(--radius-md); cursor: pointer;
  font-size: 14.5px; font-weight: 700; font-family: inherit;
  border: 1px solid var(--border); background: var(--card); color: var(--foreground);
}
.sheet-actions button.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }

/* ---------------- 分享卡 ---------------- */
.share-overlay { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; }
.share-overlay .mask { position: absolute; inset: 0; background: oklch(0.22 0.015 60 / 0.72); }
.share-panel {
  position: relative; width: min(320px, 82vw); text-align: center;
  animation: slide-up var(--dur-slow) var(--ease-out);
}
.share-panel img { border-radius: 14px; box-shadow: var(--shadow-lg); }
.share-panel .tip { font-size: 12.5px; color: #f2ece4; margin: 14px 0; line-height: 1.7; }
.share-panel .tip b { color: #fff; }
.share-panel button {
  height: 38px; padding: 0 24px; border-radius: 10px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.12);
  color: #fff; font-size: 13.5px; font-weight: 650; font-family: inherit;
}

/* ============================================================
   目录页 / 资料页（文档型）
   ============================================================ */
.doc { padding: 30px 0 0; }
.doc-head { margin-bottom: 26px; }
.doc-head h1 { margin: 0 0 8px; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.3; }
.doc-head p { margin: 0; font-size: 14px; color: var(--muted-foreground); }

/* scroll-margin 让 #domain-xxx 定位时不贴屏幕顶端，留出呼吸空间 */
.group { margin-bottom: 30px; scroll-margin-top: 18px; }
/* 从公众号菜单/回复跳进来时，高亮 2 秒，告诉用户"就是这个域" */
.group-hit .group-head { animation: group-hit 2.2s ease-out; }
@keyframes group-hit {
  0% { background: color-mix(in oklch, var(--primary) 22%, transparent); }
  100% { background: transparent; }
}
.group-head {
  display: grid; grid-template-columns: 24px 1fr; gap: 6px 10px; align-items: center;
  margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.group-head h2 { margin: 0; font-size: 16px; font-weight: 750; }
.group-head .num {
  width: 24px; height: 24px; border-radius: 7px; grid-row: 1;
  background: var(--primary); color: var(--primary-foreground);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
}
.group-head .desc {
  grid-column: 2; font-size: 12px; color: var(--muted-foreground); line-height: 1.5;
}

.item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 0; border-bottom: 1px dashed var(--border);
}
.item:last-child { border-bottom: none; }
.item .idx {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; color: var(--muted-foreground); padding-top: 3px; flex: 0 0 26px;
}
.item .body { flex: 1; min-width: 0; }
.item .body b { display: block; font-size: 14.5px; font-weight: 700; line-height: 1.45; }
.item .body span { display: block; font-size: 12.5px; color: var(--muted-foreground); margin-top: 3px; line-height: 1.55; }
.item .acts { display: flex; gap: 6px; flex: 0 0 auto; padding-top: 2px; }
.mini {
  font-size: 11.5px; font-weight: 650; padding: 4px 9px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--card); color: var(--muted-foreground);
  white-space: nowrap;
}
.mini:hover { text-decoration: none; background: var(--muted); color: var(--foreground); }
.mini.solid { background: color-mix(in oklab, var(--primary) 9%, white); color: var(--primary); border-color: color-mix(in oklab, var(--primary) 26%, white); }

/* 资料页正文 */
.paper {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: 26px 22px; box-shadow: var(--shadow-sm); margin-bottom: 20px;
}
.paper h2 {
  margin: 26px 0 10px; font-size: 17px; font-weight: 750; letter-spacing: -0.01em;
  padding-left: 11px; border-left: 3px solid var(--primary);
}
.paper h2:first-child { margin-top: 0; }
.paper h3 { margin: 18px 0 8px; font-size: 14.5px; font-weight: 700; color: var(--primary); }
.paper p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.78; }
.paper ul, .paper ol { margin: 0 0 12px; padding-left: 20px; font-size: 14.5px; line-height: 1.78; }
.paper li { margin-bottom: 5px; }
.paper code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.8px;
  background: var(--muted); padding: 1.5px 5px; border-radius: 5px;
}
.paper pre {
  margin: 0 0 14px; padding: 13px 14px; border-radius: 10px; overflow-x: auto;
  background: oklch(0.235 0.015 60); color: oklch(0.94 0.008 85);
  font-size: 12.5px; line-height: 1.65;
}
.paper pre code { background: none; padding: 0; color: inherit; }
.paper blockquote {
  margin: 0 0 14px; padding: 10px 14px; border-left: 3px solid var(--accent);
  background: color-mix(in oklab, var(--accent) 6%, white); border-radius: 0 10px 10px 0;
  font-size: 14px; color: var(--muted-foreground);
}
.paper table { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 13px; }
.paper th, .paper td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.paper th { background: var(--muted); font-weight: 700; }
.paper .check { list-style: none; padding-left: 0; }
.paper .check li { position: relative; padding-left: 26px; margin-bottom: 8px; }
.paper .check li::before {
  content: ""; position: absolute; left: 0; top: 5px; width: 15px; height: 15px;
  border: 1.5px solid var(--border); border-radius: 4px; background: var(--card);
}

.doc-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.badge {
  font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
  background: var(--muted); color: var(--muted-foreground); border: 1px solid var(--border);
}
.badge.solid { background: color-mix(in oklab, var(--primary) 9%, white); color: var(--primary); border-color: color-mix(in oklab, var(--primary) 24%, white); }

/* 资料中心卡片 */
.dl-grid { display: grid; gap: 10px; }
.dl-card {
  display: block; padding: 18px; border-radius: var(--radius-lg);
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.dl-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.dl-card .kicker { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--accent); }
.dl-card h2 { margin: 6px 0 6px; font-size: 16.5px; font-weight: 750; color: var(--foreground); }
.dl-card p { margin: 0; font-size: 13px; color: var(--muted-foreground); line-height: 1.6; }
.dl-card .row { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 11.5px; color: var(--muted-foreground); }
.dl-card .row .go { margin-left: auto; color: var(--primary); font-weight: 650; }

/* ---------------- 404 ---------------- */
.notfound { text-align: center; padding: 80px 20px; }
.notfound .code { font-size: 68px; font-weight: 800; letter-spacing: -0.04em; color: var(--primary); line-height: 1; }
.notfound h1 { margin: 14px 0 8px; font-size: 20px; }
.notfound p { color: var(--muted-foreground); font-size: 14px; margin: 0 0 22px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 380px) {
  .hero h1 { font-size: 26px; }
  .entry-grid { gap: 8px; }
  .entry-card { padding: 12px 10px; }
  .entry-card b { font-size: 13px; }
}

@media (min-width: 720px) {
  .hero h1 { font-size: 34px; }
  .scene-list { grid-template-columns: 1fr 1fr; }
  .dl-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------------- 打印（资料页 A4） ---------------- */
@media print {
  body { background: #fff; }
  .topbar, .toolbar, .footer, .follow-box, .share-btn, .no-print { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .paper { border: none; box-shadow: none; padding: 0; margin: 0; }
  .paper h2 { break-after: avoid; page-break-after: avoid; }
  .paper pre { background: #f5f5f5; color: #111; border: 1px solid #ddd; }
  a { color: #111; text-decoration: none; }
}

/* ---------------- 动效降级 ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
