/* ============================================================================
 * styles.css — 《你，是孩子的前传》互动导览页
 * 视觉基调：奶油白纸张 · 水彩树影 · 暖阳柔影 · 圆角卡片 · 童趣治愈
 * 移动端优先，逐步增强到桌面端。
 * ========================================================================== */

/* ----------------------------- 自托管字体 --------------------------------- */
/* 三款字体均取自 Google Fonts 官方仓库（SIL OFL 1.1，见 fonts/OFL.txt），
 * 并按本页实际用到的字符做了子集化，体积极小、完全离线、不依赖任何 CDN。
 *   · Noto Serif SC —— 正文宋体（已实例化为常规字重，粗体由浏览器合成）
 *   · ZCOOL KuaiLe  —— 童书感标题圆体
 *   · Quicksand     —— 英文标题圆体（仅拉丁，中文由上面两款兜底） */
@font-face {
  font-family: "Noto Serif SC";
  src: url("fonts/NotoSerifSC-subset.woff2") format("woff2");
  /* optional：弱网首访直接用系统宋体（不闪动）；SW 缓存后回访即为品牌字体 */
  font-weight: 400 700; font-style: normal; font-display: optional;
}
@font-face {
  font-family: "ZCOOL KuaiLe";
  src: url("fonts/ZCOOLKuaiLe-subset.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Quicksand";
  src: url("fonts/Quicksand-subset.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
}

/* ----------------------------- 设计令牌 ----------------------------------- */
:root {
  /* 主色板 */
  --cream:   #FFF8ED;   /* 奶油白·背景 */
  --orange:  #F6A64F;   /* 暖橙·主点缀 */
  --leaf-red:#9E3F2F;   /* 树叶红棕·深点缀/标题 */
  --green:   #A9C97A;   /* 嫩绿 */
  --sky:     #BFE4F8;   /* 浅天蓝 */
  --coffee:  #4A3328;   /* 深咖啡·正文 */

  /* 衍生色 */
  --cream-2: #FFFCF6;   /* 卡片白 */
  --cream-3: #FBEEDB;   /* 次级底 */
  --green-d: #7FA257;
  --orange-d:#E08A2E;
  --ink-soft:#6E5A4C;   /* 次级文字 */
  --line:    #EBD9BF;   /* 描边 */

  /* 阴影（暖调） */
  --sh-sm: 0 4px 14px rgba(74, 51, 40, .08);
  --sh-md: 0 12px 30px rgba(74, 51, 40, .12);
  --sh-lg: 0 24px 60px rgba(74, 51, 40, .16);
  --sh-orange: 0 12px 26px rgba(246, 166, 79, .34);

  /* 圆角 */
  --r-sm: 14px;
  --r-md: 22px;
  --r-lg: 32px;
  --r-pill: 999px;

  /* 字体 */
  --font-body: "Noto Serif SC", "Songti SC", "STSong", "SimSun", "LXGW WenKai", Georgia, serif;
  --font-disp: "ZCOOL KuaiLe", "Quicksand", "Noto Serif SC", "Songti SC", cursive;

  --maxw: 1080px;
}

/* ----------------------------- 基础重置 ----------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--coffee);
  line-height: 1.85;
  background-color: var(--cream);
  /* 纸张肌理：两层柔和光晕 + 极淡噪点（SVG data-uri，非外部图片） */
  background-image:
    radial-gradient(1200px 620px at 12% -8%, rgba(191, 228, 248, .35), transparent 60%),
    radial-gradient(1000px 560px at 92% 4%, rgba(169, 201, 122, .26), transparent 58%),
    radial-gradient(900px 700px at 50% 116%, rgba(246, 166, 79, .16), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  background-attachment: fixed, fixed, fixed, fixed;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; border-radius: 6px; }

/* ----------------------------- 排版骨架 ----------------------------------- */
.section { position: relative; padding: clamp(64px, 11vw, 120px) 20px; }
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; }

.tag {
  display: inline-block;
  font-family: var(--font-disp);
  font-size: .92rem;
  letter-spacing: .14em;
  color: var(--leaf-red);
  background: rgba(158, 63, 47, .09);
  border: 1px solid rgba(158, 63, 47, .16);
  padding: 5px 16px;
  border-radius: var(--r-pill);
  margin: 0 0 18px;
}
.section-title {
  font-family: var(--font-disp);
  font-weight: 400;
  font-size: clamp(1.7rem, 5.4vw, 2.9rem);
  line-height: 1.32;
  color: var(--leaf-red);
  margin: 0 0 14px;
  letter-spacing: .01em;
}
.section-intro {
  font-size: clamp(1rem, 2.5vw, 1.18rem);
  color: var(--ink-soft);
  max-width: 44ch;
  margin: 0 0 10px;
}
.hint {
  font-family: var(--font-disp);
  color: var(--green-d);
  font-size: .95rem;
  margin: 6px 0 28px;
}

/* ----------------------------- 通用按钮 ----------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  font-family: var(--font-disp);
  font-size: 1.04rem;
  padding: 13px 30px;
  border-radius: var(--r-pill);
  border: none;
  transition: transform .25s cubic-bezier(.2,.8,.3,1.2), box-shadow .25s, background .25s;
}
.btn:hover  { transform: translateY(-3px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--orange), var(--orange-d));
  box-shadow: var(--sh-orange);
}
.btn-primary:hover { box-shadow: 0 16px 32px rgba(246,166,79,.42); }
.btn-soft {
  color: var(--leaf-red);
  background: var(--cream-2);
  border: 1.5px solid var(--line);
  box-shadow: var(--sh-sm);
}

/* ----------------------------- 滚动淡入（渐进增强）------------------------ */
/* 默认（无 JS / 预渲染首屏）内容直接可见；仅当 <html> 带 js 类时，才先隐后显做淡入动画 */
.reveal { opacity: 1; }
html.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.3,1); }
html.js .reveal.in-view { opacity: 1; transform: none; }

/* ----------------------------- 无 JS 提示条 -------------------------------- */
.noscript-tip {
  position: relative; z-index: 60;
  background: var(--cream-3); color: var(--leaf-red);
  font-family: var(--font-disp); font-size: .92rem; text-align: center;
  padding: 64px 16px 12px; /* 顶部留出固定顶栏的高度 */
  border-bottom: 1px solid var(--line);
}

/* ----------------------------- 顶部栏 ------------------------------------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px clamp(16px, 4vw, 34px);
  background: rgba(255, 248, 237, .72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(235, 217, 191, .6);
  transition: transform .4s ease;
}
.topbar.hide { transform: translateY(-110%); }
.brand { display: flex; align-items: center; gap: .5em; font-family: var(--font-disp); color: var(--leaf-red); font-size: 1.12rem; }
.brand-mark { font-size: 1.3rem; animation: sway 5s ease-in-out infinite; transform-origin: 50% 90%; }
.brand-text { white-space: nowrap; }
.lang-toggle {
  display: inline-flex; align-items: center; gap: .35em;
  font-family: var(--font-disp); font-size: .98rem;
  color: var(--coffee);
  background: var(--cream-2);
  border: 1.5px solid var(--line);
  padding: 7px 16px; border-radius: var(--r-pill);
  box-shadow: var(--sh-sm); transition: transform .2s, box-shadow .2s;
}
.lang-toggle:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.lang-current { color: var(--leaf-red); font-weight: 700; }
.lang-sep { color: var(--line); }
.lang-other { color: var(--ink-soft); }

/* ----------------------------- 飘叶层 ------------------------------------- */
.leaf-field { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.leaf-field .floating {
  position: absolute; top: -8%;
  font-size: var(--sz, 22px); opacity: var(--op, .5);
  animation: drift var(--dur, 18s) linear infinite;
  animation-delay: var(--delay, 0s);
  will-change: transform;
}
/* drift 关键帧统一定义在文末「关键帧」区块 */

/* ============================ 1. Hero ===================================== */
.hero { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: center; padding-top: 92px; }
.hero-inner {
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: 1fr; gap: 14px; align-items: center;
}
.kicker {
  font-family: var(--font-disp); color: var(--green-d);
  letter-spacing: .12em; margin: 0 0 14px; font-size: 1rem;
}
.hero-title {
  font-family: var(--font-disp); font-weight: 400;
  font-size: clamp(2.6rem, 11vw, 5rem); line-height: 1.12;
  color: var(--leaf-red); margin: 0 0 14px;
  text-shadow: 0 6px 0 rgba(246, 166, 79, .14);
}
.hero-subtitle { font-size: clamp(1.05rem, 3.6vw, 1.4rem); color: var(--coffee); margin: 0 0 22px; font-weight: 500; }
.hero-quote {
  position: relative; font-size: clamp(1rem, 3.4vw, 1.22rem); color: var(--ink-soft);
  line-height: 2; max-width: 32ch; margin: 0 0 30px; padding-left: 18px;
  border-left: 4px solid var(--green); font-style: italic;
}
.hero-cta { font-size: 1.16rem; padding: 15px 38px; }

/* Hero 书与树（纯绘制） */
.hero-art { display: flex; justify-content: center; margin-top: 18px; }
.book-tree { position: relative; width: min(86vw, 380px); aspect-ratio: 1 / 1; }
.bt-tree { position: absolute; inset: -6% 0 18% 0; width: 100%; height: 86%; overflow: visible; animation: sway 6s ease-in-out infinite; transform-origin: 50% 100%; }
.bt-canopy circle { fill: var(--green); }
.bt-canopy circle:nth-child(2) { fill: #b9d68c; }
.bt-canopy circle:nth-child(3) { fill: #98bd66; }
.bt-trunk { fill: var(--coffee); }
.bt-branch { fill: none; stroke: var(--coffee); stroke-width: 5; stroke-linecap: round; }
.bt-leaf { font-size: 17px; }
.bt-leaf.l1 { animation: fall 5s ease-in-out infinite; }
.bt-leaf.l2 { animation: fall 6.5s ease-in-out .8s infinite; }
.bt-leaf.l3 { animation: fall 7s ease-in-out 1.6s infinite; }
/* 翻开的书 */
.bt-book {
  position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%);
  width: 78%; height: 26%;
  display: flex; filter: drop-shadow(var(--sh-md));
}
.bt-page {
  flex: 1; height: 100%; background: linear-gradient(180deg, #fff, #f4e9d6);
  border: 2px solid var(--line);
}
.bt-page-l { border-radius: 8px 0 28px 8px; transform: skewY(6deg);  transform-origin: right; box-shadow: inset -8px 0 14px rgba(74,51,40,.08); }
.bt-page-r { border-radius: 0 8px 8px 28px; transform: skewY(-6deg); transform-origin: left;  box-shadow: inset 8px 0 14px rgba(74,51,40,.08); }
.bt-spine { position: absolute; left: 50%; top: -2%; width: 4px; height: 104%; transform: translateX(-50%); background: var(--leaf-red); border-radius: 4px; }
.bt-ground {
  position: absolute; left: 50%; bottom: 4%; transform: translateX(-50%);
  width: 88%; height: 26px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(127,162,87,.4), transparent 70%);
}

/* 向下滚动提示 */
.scroll-hint {
  margin: 40px auto 0; display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-family: var(--font-disp); color: var(--ink-soft); font-size: .9rem;
}
.scroll-arrow { animation: bob 1.8s ease-in-out infinite; font-size: 1.1rem; color: var(--orange); }

/* ============================ 2. 小剧场 =================================== */
.theater { background: linear-gradient(180deg, transparent, rgba(191,228,248,.16) 40%, transparent); }
.scene-grid {
  display: grid; grid-template-columns: 1fr; gap: 20px;
  margin: 12px 0 30px;
}
.scene-card { perspective: 1200px; height: 250px; cursor: pointer; }
.scene-inner {
  position: relative; width: 100%; height: 100%;
  transition: transform .8s cubic-bezier(.4,.2,.2,1); transform-style: preserve-3d;
}
.scene-card.flipped .scene-inner { transform: rotateY(180deg); }
.scene-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: var(--r-lg); padding: 24px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  box-shadow: var(--sh-md); border: 1.5px solid var(--line);
  overflow-y: auto; /* 英文长文案在极窄屏上的兜底，正常情况不会出现滚动条 */
}
.scene-front { background: var(--cream-2); gap: 14px; }
.scene-emoji { font-size: 3rem; filter: drop-shadow(0 6px 8px rgba(74,51,40,.12)); }
.scene-q { font-family: var(--font-disp); font-size: 1.32rem; color: var(--leaf-red); }
.scene-flip-tip { font-size: .82rem; color: var(--ink-soft); margin-top: 4px; }
.scene-back {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, #fff, var(--cream-3));
  border-color: rgba(246,166,79,.4);
}
.scene-a { font-size: 1rem; color: var(--coffee); line-height: 1.8; }
.theater-footer {
  max-width: 50ch; margin: 8px auto 0; text-align: center;
  font-size: clamp(1.05rem, 3vw, 1.28rem); line-height: 1.95; color: var(--leaf-red);
  font-family: var(--font-disp);
}

/* ============================ 3. 成长树 =================================== */
.tree-layout { display: grid; grid-template-columns: 1fr; gap: 22px; margin-top: 14px; align-items: start; }
.tree-stage {
  display: flex; justify-content: center;
  background: radial-gradient(120% 90% at 50% 8%, rgba(191,228,248,.35), transparent 60%), var(--cream-2);
  border: 1.5px solid var(--line); border-radius: var(--r-lg);
  padding: 18px; box-shadow: var(--sh-sm);
}
.big-tree { width: min(82vw, 360px); height: auto; overflow: visible; }
.big-tree .ground-line { stroke: var(--line); stroke-width: 3; stroke-dasharray: 2 12; stroke-linecap: round; }

.zone { cursor: pointer; transition: transform .35s cubic-bezier(.2,.8,.3,1.3); transform-origin: 50% 70%; }
.zone:hover, .zone.is-active { transform: scale(1.05); }
.zone-emoji { font-size: 22px; text-anchor: middle; pointer-events: none; opacity: 0; transition: opacity .3s; }
.zone.is-active .zone-emoji, .zone:hover .zone-emoji { opacity: 1; }

/* 叶 */
.zone-leaf circle { fill: var(--green); transition: fill .3s; }
.zone-leaf circle:nth-child(2) { fill: #bcd891; }
.zone-leaf circle:nth-child(3) { fill: #98bd66; }
.zone-leaf:hover circle, .zone-leaf.is-active circle { fill: var(--green-d); }
.zone-leaf.is-active circle:nth-child(1) { fill: #8fb45f; }
/* 枝 */
.zone-branch path { fill: none; stroke: var(--coffee); stroke-width: 6; stroke-linecap: round; transition: stroke .3s; }
.zone-branch .zone-dot { fill: var(--orange); stroke: none; }
.zone-branch:hover path, .zone-branch.is-active path { stroke: var(--leaf-red); }
/* 干 */
.zone-trunk path { fill: var(--coffee); transition: fill .3s; }
.zone-trunk:hover path, .zone-trunk.is-active path { fill: #5e4334; }
/* 根 */
.zone-root path { fill: none; stroke: #6b4b38; stroke-width: 6; stroke-linecap: round; transition: stroke .3s; }
.zone-root:hover path, .zone-root.is-active path { stroke: var(--leaf-red); }

/* 解释卡 */
.tree-card {
  background: var(--cream-2); border: 1.5px solid var(--line); border-radius: var(--r-lg);
  padding: 30px clamp(22px, 5vw, 38px); box-shadow: var(--sh-md);
  position: relative; overflow: hidden; min-height: 220px;
}
.tree-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 7px;
  background: linear-gradient(90deg, var(--green), var(--orange), var(--leaf-red));
}
.tree-card-emoji { font-size: 2.6rem; margin-bottom: 6px; }
.tree-card-title { font-family: var(--font-disp); font-size: 1.6rem; color: var(--leaf-red); margin: 0 0 4px; }
.tree-card-sub { color: var(--green-d); font-family: var(--font-disp); margin: 0 0 14px; }
.tree-card-desc { font-size: 1.04rem; color: var(--coffee); line-height: 1.95; margin: 0 0 22px; }
.tree-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.tree-chip {
  font-family: var(--font-disp); font-size: .95rem; color: var(--ink-soft);
  background: var(--cream-3); border: 1.5px solid var(--line);
  padding: 7px 16px; border-radius: var(--r-pill); transition: all .25s;
}
.tree-chip:hover { transform: translateY(-2px); }
.tree-chip.active { color: #fff; background: var(--orange); border-color: var(--orange); box-shadow: var(--sh-orange); }

/* ============================ 4. 互动诊断 ================================= */
.diag-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 18px 0 26px; }
.diag-btn {
  display: flex; align-items: center; gap: .6em; justify-content: flex-start;
  font-family: var(--font-disp); font-size: 1.02rem; color: var(--coffee);
  background: var(--cream-2); border: 1.5px solid var(--line); border-radius: var(--r-md);
  padding: 15px 18px; box-shadow: var(--sh-sm); text-align: left;
  transition: transform .25s, box-shadow .25s, border-color .25s, background .25s;
}
.diag-btn .d-emoji { font-size: 1.4rem; }
.diag-btn:hover { transform: translateY(-3px); box-shadow: var(--sh-md); border-color: var(--orange); }
.diag-btn.active { background: linear-gradient(135deg, var(--orange), var(--orange-d)); color: #fff; border-color: var(--orange); box-shadow: var(--sh-orange); }

.diag-result {
  background: var(--cream-2); border: 1.5px solid var(--line); border-radius: var(--r-lg);
  padding: clamp(24px, 5vw, 40px); box-shadow: var(--sh-md); min-height: 200px;
}
.diag-empty { text-align: center; color: var(--ink-soft); padding: 22px 0; }
.diag-empty-leaf { font-size: 3rem; display: block; margin-bottom: 12px; animation: sway 4s ease-in-out infinite; }
.diag-empty-t { font-family: var(--font-disp); font-size: 1.3rem; color: var(--leaf-red); margin: 0 0 8px; }
.diag-empty-d { margin: 0; }

/* 路径：叶→枝→干→根→行动 */
.diag-path { display: flex; flex-direction: column; gap: 0; }
.path-step { position: relative; padding: 4px 0 4px 56px; }
.path-step + .path-step { margin-top: 2px; }
.path-node {
  position: absolute; left: 8px; top: 8px;
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 1.15rem;
  background: var(--cream-3); border: 2px solid var(--line); z-index: 2;
}
.path-step:not(:last-child)::before {
  content: ""; position: absolute; left: 26px; top: 40px; bottom: -6px; width: 3px;
  background: linear-gradient(var(--green), var(--orange)); border-radius: 3px;
}
.path-label { font-family: var(--font-disp); font-size: .92rem; margin: 6px 0 2px; }
.path-text  { margin: 0 0 16px; line-height: 1.85; }
.path-step.is-leaf   .path-node { border-color: var(--green);   color: var(--green-d); }
.path-step.is-branch .path-node { border-color: var(--green-d); }
.path-step.is-trunk  .path-node { border-color: #6b4b38; }
.path-step.is-root   .path-node { border-color: var(--leaf-red); }
.path-step.is-leaf   .path-label { color: var(--green-d); }
.path-step.is-branch .path-label { color: var(--green-d); }
.path-step.is-trunk  .path-label { color: #6b4b38; }
.path-step.is-root   .path-label { color: var(--leaf-red); }
/* 温柔行动：高亮卡 */
.path-action {
  margin-top: 10px; padding: 20px 22px 20px 56px;
  background: linear-gradient(150deg, rgba(246,166,79,.16), rgba(169,201,122,.16));
  border: 1.5px dashed var(--orange); border-radius: var(--r-md);
}
.path-action::before { display: none; }
.path-action .path-node { background: var(--orange); border-color: var(--orange); color: #fff; }
.path-action .path-label { color: var(--orange-d); }
.path-action .path-text { margin: 0; font-size: 1.06rem; color: var(--coffee); }
.diag-fade { animation: softIn .55s ease both; }

/* ============================ 5. 魔法盒 =================================== */
.magic-box {
  background: linear-gradient(165deg, var(--cream-2), var(--cream-3));
  border: 1.5px solid var(--line); border-radius: var(--r-lg);
  padding: clamp(20px, 5vw, 38px); box-shadow: var(--sh-md);
  margin-top: 14px;
}
.magic-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 26px; }
.magic-row {
  display: grid; grid-template-columns: 1fr; gap: 12px; align-items: stretch;
}
.magic-cell { border-radius: var(--r-md); padding: 16px 18px; position: relative; }
.magic-cell .mc-label {
  display: inline-block; font-family: var(--font-disp); font-size: .78rem;
  padding: 2px 10px; border-radius: var(--r-pill); margin-bottom: 8px;
}
.magic-harsh { background: rgba(158,63,47,.07); border: 1.5px solid rgba(158,63,47,.18); }
.magic-harsh .mc-label { color: #fff; background: var(--leaf-red); }
.magic-harsh .mc-text { color: var(--leaf-red); }
.magic-kind  { background: rgba(169,201,122,.18); border: 1.5px solid rgba(127,162,87,.4); }
.magic-kind .mc-label { color: #fff; background: var(--green-d); }
.magic-kind .mc-text { color: var(--coffee); }
.mc-text { margin: 0; line-height: 1.85; font-size: 1.02rem; }
.magic-arrow {
  align-self: center; justify-self: center; font-size: 1.3rem; color: var(--orange);
  transform: rotate(90deg);
}
.magic-shuffle { display: block; margin: 0 auto; }
.magic-swap { animation: softIn .5s ease both; }

/* ============================ 6. 目录地图 ================================= */
.catalog-groups { display: flex; flex-direction: column; gap: 30px; margin-top: 16px; }
.cat-group { background: var(--cream-2); border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 22px clamp(16px,4vw,28px); box-shadow: var(--sh-sm); }
.cat-group-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 2px dashed var(--line); }
.cat-group-icon { font-size: 1.5rem; }
.cat-group-title { font-family: var(--font-disp); font-size: 1.35rem; margin: 0; }
.cat-group-sub { color: var(--ink-soft); font-size: .95rem; }
.cat-group[data-g="root"]   .cat-group-title { color: #6b4b38; }
.cat-group[data-g="trunk"]  .cat-group-title { color: var(--leaf-red); }
.cat-group[data-g="branch"] .cat-group-title { color: var(--green-d); }
.cat-group[data-g="leaf"]   .cat-group-title { color: var(--orange-d); }

.leaf-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.leaf-card {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: var(--cream); border: 1.5px solid var(--line);
  border-radius: 18px 18px 18px 4px; /* 叶子感：一角收尖 */
  padding: 13px 15px; box-shadow: var(--sh-sm);
  transition: transform .25s cubic-bezier(.2,.8,.3,1.3), box-shadow .25s, border-color .25s;
}
.leaf-card:hover { transform: translateY(-4px) rotate(-1deg); box-shadow: var(--sh-md); border-color: var(--green-d); }
.leaf-card .lc-emoji { font-size: 1.4rem; flex-shrink: 0; }
.leaf-card .lc-no { font-family: var(--font-disp); font-size: .72rem; color: var(--ink-soft); }
.leaf-card .lc-title { font-family: var(--font-disp); font-size: 1.02rem; color: var(--coffee); line-height: 1.3; }

/* 章节弹窗 */
.modal {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(74, 51, 40, .42); backdrop-filter: blur(4px);
}
.modal.open { display: flex; animation: fadeIn .3s ease; }
.modal-card {
  position: relative; width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
  background: var(--cream-2); border-radius: var(--r-lg); box-shadow: var(--sh-lg);
  padding: 30px clamp(22px, 5vw, 34px); animation: popIn .4s cubic-bezier(.2,.8,.3,1.2);
}
.modal-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 8px; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.modal-card[data-g="root"]::before   { background: linear-gradient(90deg, #6b4b38, #a07a5c); }
.modal-card[data-g="trunk"]::before  { background: linear-gradient(90deg, var(--leaf-red), #c56a4d); }
.modal-card[data-g="branch"]::before { background: linear-gradient(90deg, var(--green-d), var(--green)); }
.modal-card[data-g="leaf"]::before   { background: linear-gradient(90deg, var(--orange-d), var(--orange)); }
.modal-head { display: flex; align-items: center; gap: 14px; margin: 6px 0 18px; }
.modal-emoji { font-size: 2.6rem; }
.modal-no { font-family: var(--font-disp); color: var(--ink-soft); font-size: .82rem; }
.modal-title { font-family: var(--font-disp); font-size: 1.6rem; color: var(--leaf-red); margin: 2px 0 0; line-height: 1.2; }
.modal-row { margin-bottom: 16px; }
.modal-row:last-of-type { margin-bottom: 0; }
.modal-row .mr-label {
  display: inline-flex; align-items: center; gap: .4em;
  font-family: var(--font-disp); font-size: .86rem; color: #fff;
  padding: 3px 12px; border-radius: var(--r-pill); margin-bottom: 7px;
}
.mr-keyword .mr-label { background: var(--green-d); }
.mr-myth .mr-label    { background: var(--leaf-red); }
.mr-need .mr-label    { background: var(--sky); color: var(--coffee); }
.mr-action .mr-label  { background: var(--orange); }
.modal-row .mr-text { margin: 0; line-height: 1.85; font-size: 1.03rem; }
.mr-action { background: linear-gradient(150deg, rgba(246,166,79,.14), rgba(169,201,122,.14)); border: 1.5px dashed var(--orange); border-radius: var(--r-md); padding: 14px 16px; }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line);
  background: var(--cream); color: var(--leaf-red); font-size: 1.3rem; line-height: 1;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--sh-sm);
  transition: transform .2s, background .2s;
}
.modal-close:hover { transform: rotate(90deg); background: var(--cream-3); }

/* ============================ 7. 任务卡 =================================== */
.tasks { text-align: center; }
.tasks .container { display: flex; flex-direction: column; align-items: center; }
.tasks .tag, .tasks .section-title, .tasks .section-intro { align-self: center; }
.task-card {
  position: relative; width: min(92vw, 460px); margin: 20px auto 24px;
  background: linear-gradient(160deg, #fff, var(--cream-3));
  border: 1.5px solid var(--line); border-radius: var(--r-lg);
  padding: 40px 30px; box-shadow: var(--sh-md);
  min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
}
.task-card::after { /* 卡片打孔小装饰 */
  content: ""; position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  width: 44px; height: 8px; border-radius: var(--r-pill); background: var(--line);
}
.task-emoji { font-size: 3rem; filter: drop-shadow(0 6px 8px rgba(74,51,40,.12)); }
.task-text { font-family: var(--font-disp); font-size: clamp(1.2rem, 4.4vw, 1.5rem); color: var(--leaf-red); line-height: 1.6; margin: 0; }
.task-card.flip { animation: cardFlip .55s cubic-bezier(.4,.2,.2,1); }
.task-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ============================ 8. 结尾 ===================================== */
.ending { text-align: center; background: linear-gradient(180deg, transparent, rgba(246,166,79,.12)); }
.ending-inner { display: flex; flex-direction: column; align-items: center; }
.ending-sun { position: relative; margin-bottom: 8px; height: 86px; display: flex; align-items: center; justify-content: center; }
.sun-core { font-size: 3.4rem; position: absolute; animation: pulse 4s ease-in-out infinite; }
.sun-tree { font-size: 2.2rem; position: relative; top: 18px; animation: sway 5s ease-in-out infinite; transform-origin: 50% 90%; }
.ending-text { max-width: 46ch; margin: 4px auto 28px; font-size: clamp(1.05rem, 3vw, 1.24rem); line-height: 2; color: var(--coffee); }
.ending-actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.site-footer { margin-top: 60px; text-align: center; color: var(--ink-soft); font-size: .86rem; padding: 0 16px; }
.site-footer p { max-width: 56ch; margin: 0 auto; }

/* ============================ Toast ====================================== */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 30px);
  background: var(--coffee); color: #fff; font-family: var(--font-disp);
  padding: 13px 26px; border-radius: var(--r-pill); box-shadow: var(--sh-lg);
  opacity: 0; pointer-events: none; transition: opacity .35s, transform .35s; z-index: 200;
  font-size: 1rem;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============================ 关键帧 ===================================== */
@keyframes drift  { 0% { transform: translate(0,-10vh) rotate(0); } 100% { transform: translate(var(--driftX,40px),112vh) rotate(360deg); } }
@keyframes sway   { 0%,100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes fall   { 0% { transform: translateY(0) rotate(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(40px) rotate(40deg); opacity: 0; } }
@keyframes bob    { 0%,100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
@keyframes pulse  { 0%,100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(246,166,79,.6)); } 50% { transform: scale(1.08); filter: drop-shadow(0 0 18px rgba(246,166,79,.6)); } }
@keyframes softIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn  { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes cardFlip { 0% { transform: rotateY(0); } 50% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }

/* ============================ 响应式（桌面增强） ========================= */
@media (min-width: 720px) {
  .hero-inner { grid-template-columns: 1.05fr .95fr; gap: 30px; }
  .book-tree { width: min(40vw, 420px); }
  .scene-grid { grid-template-columns: repeat(3, 1fr); }
  .tree-layout { grid-template-columns: .92fr 1.08fr; gap: 30px; align-items: center; }
  .diag-options { grid-template-columns: repeat(4, 1fr); }
  .magic-row { grid-template-columns: 1fr auto 1fr; align-items: stretch; }
  .magic-arrow { transform: rotate(0); }
  .leaf-cards { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1000px) {
  .leaf-cards { grid-template-columns: repeat(4, 1fr); }
}

/* ============================ 无障碍：减少动效 =========================== */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .leaf-field { display: none; }
}
