/**
 * 树洞网页版样式
 *
 * 配色和小程序版一致：暖米底而不是纯白，降低屏幕的"诊所感"；
 * 主色用低饱和灰绿，不用蓝（太像客服）、不用紫（太像心理测评）。
 *
 * 全局不写 transition / animation —— 只有必要的过渡，不做花哨动画。
 */

:root {
  --bg:        #F7F5F1;
  --surface:   #FFFFFF;
  --surface-2: #EFEDE8;
  --primary:   #7C8B7A;
  --primary-d: #6A7968;
  --text:      #33312E;
  --text-2:    #6B6760;
  --text-3:    #9C978F;
  --line:      #E5E2DC;
  --warm:      #C98A5E;
  --warm-bg:   #FDF6F0;
  --warm-line: #F0DECF;
}

* { box-sizing: border-box; }

/* hidden 属性必须真的能藏住东西。
 *
 * 浏览器自带的 [hidden] { display: none } 优先级只有 (0,1,0)，
 * 随便一条 .help-bar { display: flex } 就能盖掉它 ——
 * 而作者样式永远赢过浏览器默认样式。
 * 这里踩过四个：求助条、"记得 0 件事"角标、"全部忘掉"按钮、
 * 菜单里的记忆入口。最要命的是求助条 ——
 * 它本该只在检测到危机时出现，结果每个人一进聊天页就看到
 * "需要有人现在陪着你吗"，会被吓到。
 *
 * 用 !important 是故意的，也是这个属性的标准做法：
 * 谁想显示就得把 hidden 属性摘掉，而不是靠再加一条 display 去打架。 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
               "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body {
  /* 手机上防止整页被键盘顶起来 */
  overscroll-behavior: none;
}

/* 聊天中：页面锁死，不给键盘任何滚动空间。
   聊天页自己是 fixed 的，所以锁掉 body 不会影响它里面的滚动。 */
body.chat-on {
  overflow: hidden;
  height: 100dvh;
}

/* 所有视图都限制在这个宽度内，桌面上居中像个手机 */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
}

.view { display: none; }
.view.active { display: block; }

/* ============ 通用 ============ */

.btn-primary {
  display: block;
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 24px;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-family: inherit;
  letter-spacing: 1px;
  cursor: pointer;
}
.btn-primary:disabled { background: var(--line); color: var(--text-3); cursor: default; }

.btn-ghost {
  display: block;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: transparent;
  color: var(--text-2);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
}

.hint { font-size: 12px; color: var(--text-3); }

/* ============ 启动页 ============ */

#splash {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  /* 用户点之前不响应别的操作 */
  touch-action: manipulation;
  /* ⚠️ 这里**故意不写** transition: opacity。
     整体淡出的话，藤蔓是 #splash 的子元素，会被父元素的 opacity 一起带走，
     0.7 秒就跟着没了 —— 看起来就是"啪"一下消失。
     现在改成各走各的：背景快、藤蔓慢。 */
}

/* 背景单独一层。它才是挡着首页、需要快点让开的那个。
 *
 * ⚠️ z-index 必须写死。::before 是**定位元素**，而 .splash-inner 是普通静态元素，
 * 不写的话定位元素会盖在静态元素上面（绘制顺序里定位的那一档在后面）——
 * 结果就是背景色把标题糊掉了，屏幕上只剩一棵树。
 * 显式分层：背景 0 ＜ 藤蔓 1 ＜ 文字 2。 */
#splash::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--bg);
  transition: opacity .7s ease;
}
#splash.gone::before { opacity: 0; }

#splash.gone { pointer-events: none; }

/* 品牌区和提示跟着背景一起走 */
.splash-inner {
  position: relative;
  z-index: 2;
  transition: opacity .55s ease;
}
#splash.gone .splash-inner { opacity: 0; }

/* 提示条有个 forwards 的入场动画，它的填充值优先级高于普通声明，
   所以必须先 animation: none 才能淡出 */
#splash.gone .splash-hint {
  animation: none;
  opacity: 0;
  transition: opacity .45s ease;
}

/* 品牌区的位置必须和首页那个一模一样，否则淡出时会"跳"一下 */
.splash-inner {
  width: 100%;
  max-width: 480px;
  padding: 26px 24px 0;   /* 和 #view-home 的顶部内边距保持一致 */
}

.splash-hint {
  position: relative;
  z-index: 2;            /* 和品牌区同层，都在藤蔓上面 */
  margin-top: auto;
  margin-bottom: 64px;
  font-size: 13px;
  color: var(--text-3);
  letter-spacing: 3px;
  opacity: 0;
  /* 等树和藤蔓长得差不多了再出现，别和生长动画抢注意力。
     最后一片花瓣是 1.58s 开始开的，所以这里等到 1.6s。 */
  animation: hint-in 1.2s ease 1.6s forwards;
}

@keyframes hint-in {
  to { opacity: 1; }
}

/* ============ 启动页的装饰层：藤蔓 + 草 ============
 *
 * 全部只挂在启动页。首页和关于页用的是 <use> 引用的影子树，
 * CSS 选择器进不去；而且那两页要短、要安静。
 *
 * 写法上和树的动画遵守同一条规则：
 * **默认状态就是"长好之后"的样子**，动画只负责"从无到有"（backwards）。
 * 这样用户提前点击时，去掉 animation 就等于瞬间补完，
 * 不会出现"动画停在一半"的样子。
 */

.splash-scene {
  position: absolute;
  z-index: 1;            /* 背景之上、文字之下 */
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 620px;      /* 桌面上别让它长成一整面墙 */
  height: auto;
  pointer-events: none;  /* 别挡住"轻触进入" */
  /* 退场：比背景慢得多，而且**往下沉**一点 ——
     "慢慢退出去"，而不是跟着背景一起消失。
     时长必须和 app.js 里 remove 的定时器对得上。 */
  transition: opacity 1.25s ease .12s,
              transform 1.25s cubic-bezier(.4, 0, .6, 1) .12s;
}

#splash.gone .splash-scene {
  opacity: 0;
  transform: translateX(-50%) translateY(52px);
}

/* 藤蔓：从下面两个角往上爬。
   pathLength="100" 把路径长度归一化成 100，
   所以虚线不用管路径到底多长，写 100 就行。 */
.splash-scene .vine {
  stroke-dasharray: 100;
  stroke-dashoffset: 0;                 /* 默认：已经爬完了 */
  animation: vine-draw 1.4s ease-out .25s backwards;
}
.splash-scene .vine:nth-child(2) { animation-delay: .45s; }
@keyframes vine-draw {
  from { stroke-dashoffset: 100; }
}

/* 藤叶 / 藤上的花。
 *
 * ⚠️ 这里踩过一个**不会报错的坑**：动画名写成了 leaf-pop，
 *    但 @keyframes leaf-pop 从来没定义过。浏览器遇到不存在的动画名
 *    什么都不做 —— 不缩放、也不理会 animation-delay。
 *    表现就是：藤蔓的茎在长，叶子和花却从头到尾钉在原地不动。
 *    控制台没有报错，静态检查也看不出来。现在有测试盯着这一类。
 *
 * 动效本身：叶子的定位层已经把坐标放在"从藤上往外偏 6.5"的位置了，
 * 所以这里先 translateX(-7px) 退回藤的中心线，再从那儿长出来 ——
 * 看着就是藤尖爬过去、顺手把叶子推了出来，而不是原地凭空放大。
 * 出现时刻（animation-delay）在 HTML 里按藤蔓的生长曲线算好了。 */
.splash-scene .vine-leaf {
  transform-box: fill-box;
  transform-origin: 0 50%;              /* 原点是叶柄那端，不是叶子中心 */
  animation: bud-out .55s cubic-bezier(.34, 1.2, .64, 1) backwards;
}
.splash-scene .vine-flower {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: bud-out .6s cubic-bezier(.34, 1.3, .64, 1) backwards;
}
@keyframes bud-out {
  from { opacity: 0; transform: translateX(-7px) scale(.12); }
  to   { opacity: 1; transform: none; }
}

/* 草。
   进来是淡入而不是缩放 —— 草是从地里长出来的，从一个小点放大很怪。
   摆动周期按 3n 分三档错开：一片草整齐划一地摆，一眼就看出是假的。 */
.splash-scene .blade {
  transform-box: fill-box;
  transform-origin: 50% 100%;           /* 以根部为轴，不是以中心 */
  animation: blade-in .5s ease-out .55s backwards,
             blade-sway 3.6s ease-in-out .55s infinite;
}
.splash-scene .blade:nth-child(3n)   { animation-duration: .5s, 4.6s; }
.splash-scene .blade:nth-child(3n+1) { animation-duration: .5s, 3.1s; }
.splash-scene .blade:nth-child(3n+2) { animation-duration: .5s, 5.4s; }

@keyframes blade-in {
  from { opacity: 0; }
}

/* 摆动。
   回不回到 0 是关键：0% 和 100% 都停在 -2.5°，中间冲到 +8°，
   整根草是**被风吹得偏向一边**的，不是左右对称地摇 ——
   真实的风是推着草往一个方向倒，然后弹回来。
   幅度给到 10.5° 跨度，比之前那 2.6° 明显得多，但还没到"抽搐"。 */
@keyframes blade-sway {
  0%, 100% { transform: rotate(-2.5deg); }
  50%      { transform: rotate(8deg); }
}

/* 注意：这里**没有** .splash-scene.grown。
   藤蔓和草退场时是要继续动的（一边摆一边沉下去），
   所以 app.js 里故意不给它们加 grown。 */

/* 只有启动页还在的时候，首页下半部分才需要淡入。
   这样写的好处：启动页被跳过时，首页直接是正常的，不会因为
   某个类没加上而永久隐身。 */
body.splash-on #view-home .corner-link,
body.splash-on #view-home .entries,
body.splash-on #view-home .promises,
body.splash-on #view-home .actions,
body.splash-on #view-home .footer {
  opacity: 0;
  transform: translateY(10px);
}

body.splash-on.splash-done #view-home .corner-link,
body.splash-on.splash-done #view-home .entries,
body.splash-on.splash-done #view-home .promises,
body.splash-on.splash-done #view-home .actions,
body.splash-on.splash-done #view-home .footer {
  opacity: 1;
  transform: none;
  transition: opacity .7s ease .15s, transform .7s ease .15s;
}

/* 尊重系统的"减少动态效果"设置 */
@media (prefers-reduced-motion: reduce) {
  #splash::before, .splash-inner, .splash-hint, .splash-scene,
  body.splash-on.splash-done #view-home .entries,
  body.splash-on.splash-done #view-home .promises,
  body.splash-on.splash-done #view-home .actions,
  body.splash-on.splash-done #view-home .footer {
    transition: none;
  }
  .splash-hint { animation: none; opacity: 1; }
  #splash.gone .splash-hint { opacity: 0; }
  .splash-scene .vine,
  .splash-scene .vine-leaf,
  .splash-scene .vine-flower,
  .splash-scene .blade { animation: none; }
}

/* ============ 首页 ============ */

/* 顶部内边距必须和 .splash-inner 一模一样 ——
   启动页淡出时品牌区要停在原地，差一个像素都会看到跳。 */
#view-home { padding: 26px 24px 24px; position: relative; }

/* 左上角的提意见入口。
 *
 * 定位的参照是 #view-home（所以上面那行 position: relative 不能删）。
 * 左边距 16 + 内边距 8 = 24，正好和正文的左右留白对齐 ——
 * 不齐的话一眼就能看出是"贴上去的"。
 *
 * 顶部那个 env() 是给刘海屏留的：网页模式下它是 0，
 * 但以后要是做成"添加到主屏幕"的全屏模式，状态栏会压下来。 */
.corner-link {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: calc(16px + env(safe-area-inset-left, 0px));
  padding: 8px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-3);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.corner-link:active { color: var(--text-2); }

.brand { text-align: center; margin-bottom: 18px; }
.brand-mark {
  display: block;
  width: 46px;
  height: 46px;
  margin: 0 auto 8px;
}

/* ============ 树的生长动画 ============
 *
 * 设计要点：**默认状态就是"长成之后"的样子**，动画只负责"从无到有"。
 *
 * 这样写的好处：用户提前点击时，只要去掉 animation，树立刻是完整的 ——
 * 不会出现"半棵树淡出、整棵树淡入"的重影。
 * 如果反过来（默认是空的、动画负责长大），就没法瞬间补完。
 */

.tree-animated .trunk,
.tree-animated .branch {
  stroke-dasharray: 100;
  stroke-dashoffset: 0;              /* 默认：完全长好 */
}

@keyframes tree-draw {
  from { stroke-dashoffset: 100; }    /* 缩到看不见 */
  to   { stroke-dashoffset: 0; }
}

@keyframes tree-pop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

@keyframes tree-bloom {
  from { transform: scale(0) rotate(-45deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg);   opacity: 1; }
}

.tree-animated .trunk,
.tree-animated .branch {
  animation: tree-draw .6s ease-out backwards;
}

.tree-animated .branch { animation-duration: .4s; }

.tree-animated .leaf {
  /* fill-box 让缩放以每个圆自己的中心为原点，而不是整个 SVG 的原点 */
  transform-box: fill-box;
  transform-origin: center;
  animation: tree-pop .42s cubic-bezier(.34, 1.36, .64, 1) backwards;
}

.tree-animated .flower {
  transform-box: fill-box;
  transform-origin: center;
  animation: tree-bloom .5s cubic-bezier(.34, 1.56, .64, 1) backwards;
}

/* 长完之后轻轻晃一下，像有风。幅度很小，只是让树"活着" */
@keyframes tree-sway {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(.7deg); }
}
.tree-animated {
  transform-origin: 50% 92%;
  animation: tree-sway 6s ease-in-out 2.2s infinite;
}

/* 用户点击时加上 .grown：所有动画停掉，元素回到默认状态（= 长成的样子）。
   因为默认状态就是最终状态，这一下是"瞬间补完"，不是"跳变到另一个样子"。 */
.tree-animated.grown,
.tree-animated.grown .trunk,
.tree-animated.grown .branch,
.tree-animated.grown .leaf,
.tree-animated.grown .flower {
  animation: none;
}

/* 系统设了"减少动态效果"就不动，直接显示长成的样子 */
@media (prefers-reduced-motion: reduce) {
  .tree-animated .trunk,
  .tree-animated .branch,
  .tree-animated .leaf,
  .tree-animated .flower,
  .tree-animated {
    animation: none;
  }
  .tree-animated .trunk,
  .tree-animated .branch { stroke-dashoffset: 0; }
}
.brand-title {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 2px;
  line-height: 1.4;
  margin-bottom: 6px;
}
.brand-sub {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
  white-space: pre-line;
}

.entry {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 13px 16px;
  margin-bottom: 12px;
  cursor: pointer;
  position: relative;
}
.entry.active { border-color: var(--primary); background: #FBFCFA; }
.entry-icon { font-size: 22px; margin-right: 14px; }
.entry-body { flex: 1; }
.entry-name { font-size: 16px; font-weight: 500; line-height: 1.4; margin-bottom: 2px; }
.entry-desc { font-size: 13px; color: var(--text-2); }
.entry-note { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.entry-check { font-size: 16px; color: var(--primary); font-weight: 600; }

/* 老朋友卡片：虚线和上面区分开，提示"这个不一样" */
.entry-memory { border-style: dashed; border-color: var(--line); margin-top: 12px; }
.entry-memory.active { border-style: solid; border-color: var(--primary); }

.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 10px;
  font-weight: 400;
  vertical-align: middle;
}

.promises { margin: 12px 0 0; padding: 0 4px; }
.promise {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.7;
}
.dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--primary);
  margin-right: 8px;
  flex-shrink: 0;
}

.ai-note { text-align: center; margin-top: 12px; }

.footer {
  text-align: center;
  padding: 14px 0 8px;
  font-size: 13px;
  color: var(--text-3);
}
.footer a { color: var(--text-3); text-decoration: none; cursor: pointer; }
.footer-sep { margin: 0 8px; color: var(--line); }

/* ============ 聊天 ============ */

#view-chat {
  display: none;
  flex-direction: column;
}

/* 聊天页脱离文档流，钉在**可视区域**上（不是布局视口）。
 *
 * 为什么光有 height: 100dvh 不够：
 * 手机键盘弹出来的时候，iOS 不改 dvh，也不改 window.innerHeight ——
 * 它只是把可视区域缩小、往上推，然后滚动页面去露出输入框。
 * 页面一滚，顶上的导航栏就出屏幕了，「返回」按钮就没了。
 * （小程序里踩过同一个坑，那边叫 adjust-position。）
 *
 * 现在这样：position: fixed 让页面本身没有可滚的东西，
 * 键盘就没有东西可推；高度和位置由 JS 用 visualViewport 实时喂进来。
 * 两个变量都带兜底 —— JS 没跑、或者浏览器不支持 visualViewport 时，
 * 退回 100dvh 和 0，表现和以前一样，不会更糟。 */
#view-chat.active {
  display: flex;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  top: var(--vv-top, 0px);
  height: var(--vv-height, 100dvh);
  overflow: hidden;
  background: var(--bg);
  z-index: 10;
  /* 刘海屏：别让导航栏钻到状态栏底下。
     桌面和普通屏上这两个 env() 就是 0，加了没副作用。 */
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.chat-nav {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 8px;
  background: var(--bg);
}
.nav-btn {
  min-width: 64px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  font-size: 15px;
  padding: 0 8px;
}
.nav-btn:active { background: var(--surface-2); }
.nav-back-icon { font-size: 24px; line-height: 1; margin-right: 2px; }
.nav-more { font-size: 20px; color: var(--text-2); letter-spacing: 1px; }
.nav-title {
  flex: 1;
  text-align: center;
  font-size: 14px;
  color: var(--text-2);
  letter-spacing: 1px;
}

.help-bar {
  flex-shrink: 0;
  margin: 0 16px 8px;
  padding: 10px 14px;
  background: var(--warm-bg);
  border: 1px solid var(--warm-line);
  border-radius: 8px;
  font-size: 13px;
  color: var(--warm);
  cursor: pointer;
  display: flex;
  align-items: center;
}
.help-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--warm);
  margin-right: 8px;
  flex-shrink: 0;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 0;
  -webkit-overflow-scrolling: touch;
}

.row { display: flex; margin-bottom: 14px; }
.row-ai { justify-content: flex-start; }
.row-user { justify-content: flex-end; }

.bubble {
  max-width: 78%;
  padding: 11px 15px;
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-line;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.bubble-ai {
  background: var(--surface);
  border-radius: 3px 14px 14px 14px;
}
.bubble-user {
  background: #E8EBE6;
  border-radius: 14px 3px 14px 14px;
}
.typing { color: var(--text-3); letter-spacing: 3px; }

/* 危机卡片 */
.card {
  max-width: 88%;
  background: var(--warm-bg);
  border: 1px solid var(--warm-line);
  border-left: 3px solid var(--warm);
  border-radius: 4px 14px 14px 4px;
  padding: 16px 16px 12px;
}
.card.acked { opacity: 0.55; border-left-color: var(--line); }
.card-tag {
  font-size: 13px;
  color: var(--warm);
  font-weight: 500;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.card-line {
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-line;
  margin-bottom: 12px;
}
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card-btn {
  padding: 9px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
}
.card-btn-call { background: var(--warm); color: #fff; border-color: var(--warm); }
.card-btn-quiet { background: transparent; border-color: transparent; color: var(--text-3); padding-left: 4px; }

.composer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.composer input {
  flex: 1;
  height: 40px;
  padding: 0 16px;
  border: none;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
}
.composer input::placeholder { color: var(--text-3); }
.composer button {
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 15px;
  font-family: inherit;
  cursor: default;
}
.composer button.on { background: var(--primary); color: #fff; cursor: pointer; }

.composer-note {
  flex-shrink: 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
  padding: 6px 16px 10px;
  background: var(--surface);
  line-height: 1.4;
}

/* ============ 记忆页 / 关于页 ============ */

.page-view { padding: 24px 20px 48px; }

.page-nav {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}
.page-nav .nav-btn { min-width: 56px; }
.page-title { flex: 1; text-align: center; font-size: 16px; font-weight: 500; }

.intro {
  background: var(--surface);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
}
.intro-title { font-size: 15px; font-weight: 500; margin-bottom: 8px; }
.intro-line { font-size: 13px; color: var(--text-2); line-height: 1.9; }

/* ============ 提意见 ============ */

/* 三条承诺单独一块，用和"免责声明"同一套暖色 ——
   它是这个页面最重要的一句话，不能长得像普通小字。 */
.fb-promises {
  background: var(--warm-bg);
  border: 1px solid var(--warm-line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.fb-promise {
  font-size: 13px;
  color: var(--warm);
  line-height: 1.9;
  padding-left: 16px;
  position: relative;
}
.fb-promise::before {
  content: '·';
  position: absolute;
  left: 4px;
}

#fb-text {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  line-height: 1.8;
  resize: none;
  outline: none;
}
#fb-text:focus { border-color: var(--primary); }
#fb-text::placeholder { color: var(--text-3); }

.fb-count {
  text-align: right;
  font-size: 11px;
  color: var(--text-3);
  height: 18px;
  margin-top: 4px;
}

.fb-note {
  margin-top: 14px;
  line-height: 1.8;
  text-align: center;
}

.fb-error {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--warm-bg);
  border: 1px solid var(--warm-line);
  color: var(--warm);
  font-size: 13px;
  text-align: center;
}

.fb-done { text-align: center; padding: 48px 0; }
.fb-done-title { font-size: 17px; font-weight: 500; margin-bottom: 12px; }
.fb-done-lines { font-size: 14px; color: var(--text-2); line-height: 2; }

.mem-item {
  display: flex;
  align-items: center;
  background: var(--surface);
  border-radius: 8px;
  padding: 14px 12px 14px 16px;
  margin-bottom: 8px;
}
.mem-main { flex: 1; }
.mem-text { font-size: 15px; line-height: 1.6; margin-bottom: 5px; }
.mem-meta { font-size: 11px; color: var(--text-3); }
.mem-tag {
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 10px;
}
.mem-del {
  width: 40px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  padding: 8px 0;
}

.empty { text-align: center; padding: 48px 0 36px; }
.empty-title { font-size: 15px; color: var(--text-2); margin-bottom: 8px; }
.empty-desc { font-size: 13px; color: var(--text-3); line-height: 1.8; }

.adder { display: flex; gap: 8px; margin-top: 20px; }
.adder input {
  flex: 1;
  height: 40px;
  padding: 0 16px;
  border: none;
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.adder input::placeholder { color: var(--text-3); }
.adder button {
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 14px;
  font-family: inherit;
}
.adder button.on { background: var(--primary); color: #fff; cursor: pointer; }

.foot-note {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.9;
  margin: 36px 0 20px;
}
.foot-link {
  display: block;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  padding: 8px 0;
}

/* 关于页 */
.about-head { text-align: center; margin-bottom: 36px; }
.about-head .brand-mark { font-size: 36px; margin-bottom: 10px; }
.about-head .brand-title { font-size: 20px; letter-spacing: 3px; margin-bottom: 6px; }
.about-sub { font-size: 13px; color: var(--text-2); }

.section { margin-bottom: 32px; }
.section-title {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 1px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.block { margin-bottom: 20px; }
.block-h { font-size: 14px; color: var(--primary); margin-bottom: 7px; letter-spacing: 0.5px; }
.block-p { font-size: 14px; color: var(--text-2); line-height: 1.9; white-space: pre-line; }

.hotline {
  display: block;
  width: 100%;
  background: var(--warm-bg);
  border: 1px solid var(--warm-line);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  margin-bottom: 10px;
  font-family: inherit;
  cursor: pointer;
}
.hotline-name { font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.hotline-num { font-size: 26px; font-weight: 500; color: var(--warm); letter-spacing: 2px; }
.hotline-note { font-size: 12px; color: var(--text-3); }
.hotline-row { display: flex; gap: 10px; }
.hotline-row .hotline { margin-bottom: 0; padding: 16px; }
.hotline-row .hotline-num { font-size: 20px; color: var(--text); }

/* ============ 小人 ============
 *
 * 蜷缩着打盹 → 点一下 → 醒过来伸懒腰挥手 → 又睡回去。
 *
 * 它只是好玩，没有任何"点击索取"的意味 ——
 * 这个产品里的用户可能正难受着，一个小人在这种时候要钱会让人有负担。
 */

/* 上面留 26px：台词是绝对定位的，溢出在舞台**上方**，
   得保证它压不到上面的承诺列表。margin-bottom 不用留了。 */
.buddy-wrap {
  display: flex;
  justify-content: center;
  margin: 26px 0 18px;
}

/* 高度写死，台词绝对定位、向上溢出。
 *
 * 为什么定高：台词是从舞台里"冒"出来的，如果按正常流排版，
 * 它一出现就会把下面的「开始说话」顶下去 —— 手指刚要点，按钮跑了。
 * 定高 + 绝对定位之后，三下点完页面高度**一个像素都不变**。
 *
 * 80px 是"小人 68 + 上下各 6"——原来是 96，多出来的那 16 是给收款码留的，
 * 码拿掉之后不收回来就是白白一段空。 */
.buddy-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.buddy-stage:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 16px;
}

/* z-index 比收款码高：手臂要压在卡片上面，才像"捏着" */
.buddy {
  position: relative;
  z-index: 2;
  display: block;
  width: 68px;
  height: 68px;
  flex-shrink: 0;
}

/* 台词 —— 只在中途第二下（拿出收款码）时出现，在小人**头顶**。
 *
 * 绝对定位且向上溢出到舞台外面：上面那段留白本来就空着，
 * 借它放一行字，就不用为了这行字把整块撑高 —— 首页已经够长了。 */
.buddy-line {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 8px);
  width: max-content;
  max-width: 170px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-3);
  letter-spacing: .5px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity .26s ease, transform .32s ease-out;
}

/* 收款码已经拿掉了（首页不该出现索取的东西），
   所以这里没有 .buddy-qr 的规则。关于页那份还在。 */

/* 呼吸：只有蜷缩着的时候有，像真的在睡 */
@keyframes buddy-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.035); }
}

.buddy-body {
  transform-box: fill-box;
  transform-origin: center bottom;
  transition: transform .45s cubic-bezier(.34, 1.4, .64, 1);
  animation: buddy-breathe 3.6s ease-in-out infinite;
}

/* 头：蜷缩时埋着，醒来时抬起来 */
.buddy-head {
  transform-box: fill-box;
  transform-origin: center bottom;
  transition: transform .45s cubic-bezier(.34, 1.4, .64, 1);
}

/* 眼睛：蜷缩时闭成一条缝 */
.buddy-eye {
  transform-box: fill-box;
  transform-origin: center;
  transform: scaleY(.14);
  transition: transform .25s ease;
}

/* 手：蜷缩时收在身上看不见 */
.buddy-arm {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: opacity .3s ease;
}

/* ---- 点开 ---- */

@keyframes buddy-wave {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(-24deg); }
}

/* ---- 三下：0 蜷缩 → 1 探头（半个码） → 2 拿出来（整个码+台词） → 0 ---- */

/* 第 1、2 下都是醒着的，区别只在收款码露多少 */
.buddy-stage[data-step="1"] .buddy-body,
.buddy-stage[data-step="2"] .buddy-body {
  transform: scaleY(1.28);
  animation: none;                 /* 醒了就不打呼噜了 */
}
.buddy-stage[data-step="1"] .buddy-head,
.buddy-stage[data-step="2"] .buddy-head { transform: translateY(-20px); }
.buddy-stage[data-step="1"] .buddy-eye,
.buddy-stage[data-step="2"] .buddy-eye  { transform: scaleY(1); }
.buddy-stage[data-step="1"] .buddy-arm,
.buddy-stage[data-step="2"] .buddy-arm  { opacity: 1; }
/* 挥手只在刚醒的那一下，第二下开始要"拿着"，不能再晃 */
.buddy-stage[data-step="1"] .buddy-arm-r { animation: buddy-wave .5s ease-in-out 3; }

/* 台词只在第 2 下出现 */
.buddy-stage[data-step="2"] .buddy-line {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 系统设了"减少动态效果"就别动 */
@media (prefers-reduced-motion: reduce) {
  .buddy-body { animation: none; }
  .buddy-body, .buddy-head, .buddy-eye, .buddy-arm,
  .buddy-line { transition: none; }
  .buddy-stage[data-step="1"] .buddy-arm-r { animation: none; }
}

/* ============ 收款码 ============ */

.tip { margin-top: 8px; }

.tip-desc {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.9;
  margin-bottom: 18px;
}

.tip-qr-box {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 120px;
  padding: 16px;
  background: var(--surface);
  border-radius: 12px;
}

.tip-qr {
  display: block;
  width: 200px;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.tip-missing {
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.9;
}
.tip-missing .hint { font-size: 11px; }

/* ============ 弹层 ============ */

.mask {
  position: fixed;
  inset: 0;
  background: rgba(40, 38, 35, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.modal {
  width: 100%;
  max-width: 400px;
  /* 能占多高占多高：mask 有 24px 内边距，所以减掉 48。
     免责声明每次都弹，内容又不短 —— 让它尽量铺满，少让用户滚一屏。 */
  max-height: calc(100dvh - 48px);
  background: var(--surface);
  border-radius: 14px;
  padding: 28px 22px 20px;
  display: flex;
  flex-direction: column;
}
.modal-title {
  font-size: 18px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 20px;
  letter-spacing: 0.5px;
}
/* 内容区**自动撑满**弹窗剩下的高度。
 *
 * 这里原来写的是 max-height: 52dvh —— 一个跟弹窗高度无关的固定值。
 * 结果弹窗明明能用 84dvh，内容区只肯用 52dvh，上面白白空着一块，
 * 下面却把内容藏进滚动里。实测在窄屏上「全国心理援助热线 12356」
 * 那一行被推到可视区外面 —— 而那条恰恰是整个免责声明里最重要的一句。
 *
 * ⚠️ min-height: 0 不能删：flex 子项默认不会缩到比内容还小，
 *    不加这行 overflow-y: auto 根本不生效，内容会把弹窗顶爆。 */
.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
/* 免责声明是"每次进来都要看完"的东西，所以密度比美观重要一点。
   行距从 1.9 收到 1.75、段间距 16 收到 12 ——
   在一台 iPhone SE 上刚好能把四段完整放下，不用滚。
   （1.75 对 14px 的中文仍然舒服，不算挤。） */
.modal-p {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.75;
  white-space: pre-line;
  margin-bottom: 12px;
}
.modal-p:last-child { margin-bottom: 0; }
.modal-link {
  text-align: center;
  font-size: 13px;
  color: var(--primary);
  padding: 8px 0 12px;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
}

/* 顶部菜单 */
.menu-mask {
  position: fixed;
  inset: 0;
  background: rgba(40, 38, 35, 0.28);
  z-index: 90;
}
.menu {
  position: absolute;
  top: 56px;
  right: 16px;
  width: 200px;
  background: var(--surface);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
.menu-item {
  display: block;
  width: 100%;
  padding: 15px 16px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: none;
  border: none;
  border-bottom: 1px solid var(--line);
  text-align: left;
  cursor: pointer;
}
.menu-item:last-child { border-bottom: none; }
.menu-item-quiet { color: var(--text-3); text-align: center; }
.menu-count { float: right; font-size: 12px; color: var(--text-3); }
