/* ============================================================
   心境万象 · 统一设计系统（温暖系温暖风）
   所有页面统一引用，保证视觉与交互一致。
   ============================================================ */
:root {
  /* 调色板：暖沙底 + 鼠尾草绿 + 蜜桃 + 藕粉 */
  --bg: #FBF7F2;
  --bg-soft: #F4ECE3;
  --surface: #FFFFFF;
  --surface-2: #FCFAF7;

  --ink: #413E3B;        /* 主文字（暖深灰，非纯黑） */
  --ink-soft: #9A938C;   /* 次要文字 */
  --ink-faint: #C4BCB2;

  --primary: #6FB3A6;    /* 鼠尾草绿（主色，平静暖心） */
  --primary-deep: #4E9589;
  --primary-soft: #E4F1ED;

  --accent: #F2A08D;     /* 蜜桃（温暖点缀） */
  --accent-deep: #E8896F;
  --accent-soft: #FBE7E0;

  --lavender: #B6A6D9;   /* 藕粉紫 */
  --lavender-soft: #ECE7F5;

  --line: #ECE4DA;
  --success: #5FAE86;
  --warning: #E5A33D;
  --danger: #E0726A;

  /* 柔和渐变（Hero / 头部） */
  --grad-hero: linear-gradient(155deg, #F8D9C4 0%, #CFE6D6 52%, #DAD0E8 100%);
  --grad-primary: linear-gradient(135deg, #7FC0B3 0%, #4E9589 100%);
  --grad-accent: linear-gradient(135deg, #F6B49F 0%, #E8896F 100%);
  --grad-lavender: linear-gradient(135deg, #C6B8E6 0%, #9D8CD8 100%);

  /* 圆角 / 阴影 */
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --r-pill: 999px;

  --shadow-sm: 0 2px 10px rgba(150, 120, 100, 0.06);
  --shadow-md: 0 8px 24px rgba(150, 120, 100, 0.10);
  --shadow-lg: 0 16px 40px rgba(150, 120, 100, 0.14);

  --nav-h: 72px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --maxw: 560px;

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 桌面端把内容约束在居中“手机列”里，两侧留暖色氛围 */
.app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100%;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 60px rgba(180, 150, 130, 0.08);
}
@media (min-width: 600px) {
  body { background: linear-gradient(160deg, #F3E7DC 0%, #E7EEE8 100%); }
  .app { margin: 24px auto; border-radius: 28px; overflow: hidden; min-height: calc(100vh - 48px); }
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 15px; }

/* ---------------- 顶部栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-t) + 14px) 18px 14px;
  background: rgba(251, 247, 242, 0.86);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .back {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); box-shadow: var(--shadow-sm);
  font-size: 18px; color: var(--ink); flex-shrink: 0;
}
.topbar .title { font-size: 17px; font-weight: 700; letter-spacing: .3px; }
.topbar .spacer { flex: 1; }
.topbar .action { font-size: 14px; color: var(--primary-deep); font-weight: 600; }

/* ---------------- 底部导航 ---------------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex; background: rgba(255,255,255,0.94);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 -4px 20px rgba(150,120,100,0.08);
  border-top: 1px solid var(--line);
}
.bottom-nav .nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--ink-faint); transition: color .2s, transform .2s;
  padding-top: 4px;
}
.bottom-nav .nav-item .ico { font-size: 24px; line-height: 1; filter: grayscale(.4); transition: filter .2s, transform .25s; }
.bottom-nav .nav-item .lbl { font-size: 12px; font-weight: 600; letter-spacing: .2px; }
.bottom-nav .nav-item.active { color: var(--primary-deep); }
.bottom-nav .nav-item.active .ico { filter: none; transform: translateY(-2px) scale(1.05); }
.bottom-nav .nav-item:active { transform: scale(.94); }
@media (min-width: 600px) {
  .bottom-nav { max-width: var(--maxw); margin: 0 auto; left: 0; right: 0; border-radius: 0 0 28px 28px; }
}

/* ---------------- 通用布局 ---------------- */
.page { padding: 18px 16px calc(var(--nav-h) + var(--safe-b) + 20px); min-height: 100%; }
.page.no-nav { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); }
.section { margin-bottom: 22px; }
.section-title { font-size: 16px; font-weight: 700; margin: 4px 4px 12px; display: flex; align-items: center; gap: 8px; }
.section-title .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.muted { color: var(--ink-soft); }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt20 { margin-top: 20px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--surface); border-radius: var(--r-lg);
  padding: 18px; box-shadow: var(--shadow-sm); border: 1px solid var(--line);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card.tap { cursor: pointer; }
.card.tap:active { transform: scale(.985); box-shadow: var(--shadow-md); }
.card.soft { background: var(--surface-2); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px; border-radius: var(--r-pill); font-size: 15px; font-weight: 700;
  color: #fff; background: var(--grad-primary); box-shadow: var(--shadow-md);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s;
}
.btn:active { transform: translateY(1px) scale(.99); box-shadow: var(--shadow-sm); }
.btn.block { width: 100%; }
.btn.accent { background: var(--grad-accent); }
.btn.lavender { background: var(--grad-lavender); }
.btn.ghost { background: var(--primary-soft); color: var(--primary-deep); box-shadow: none; }
.btn.ghost.accent { background: var(--accent-soft); color: var(--accent-deep); }
.btn.soft { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn.sm { padding: 9px 16px; font-size: 13px; }

/* ---------------- 标签 / 药丸 ---------------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; background: var(--primary-soft); color: var(--primary-deep);
}
.pill.accent { background: var(--accent-soft); color: var(--accent-deep); }
.pill.lavender { background: var(--lavender-soft); color: #7E6CB0; }
.pill.gray { background: var(--bg-soft); color: var(--ink-soft); }
.tag { font-size: 12px; color: var(--ink-soft); }

/* ---------------- 头像 ---------------- */
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: var(--grad-primary); color: #fff;
}
.avatar.accent { background: var(--grad-accent); }
.avatar.lavender { background: var(--grad-lavender); }

/* ---------------- 输入框 ---------------- */
.field {
  width: 100%; padding: 13px 16px; border: 1.5px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); transition: border-color .2s, box-shadow .2s;
}
.field:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.field::placeholder { color: var(--ink-faint); }
.field-label { display: block; font-size: 14px; font-weight: 500; color: var(--ink); margin-bottom: 8px; }
.field-group { margin-bottom: 16px; }

/* 弹窗标题 */
.modal-title { font-size: 18px; font-weight: 700; color: var(--ink); margin-bottom: 16px; }

/* btn.primary 别名（默认 btn 已是 primary 渐变，此为兼容写法） */
.btn.primary { background: var(--grad-primary); }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 200; background: rgba(50, 40, 35, 0.5);
  display: none; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; transition: opacity .25s ease;
}
.modal-mask.show { display: flex; opacity: 1; }
.modal-card {
  width: 100%; max-width: 420px; background: var(--surface); border-radius: var(--r-lg);
  padding: 24px 20px; box-shadow: var(--shadow-lg); max-height: 86vh; overflow: auto;
  transform: translateY(14px) scale(.98); transition: transform .25s ease;
}
.modal-mask.show .modal-card { transform: translateY(0) scale(1); }
.modal-close {
  position: absolute; top: 12px; right: 16px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-soft); color: var(--ink-soft); font-size: 20px; line-height: 1;
}

/* ---------------- Toast ---------------- */
.toast-wrap {
  position: fixed; left: 50%; top: 18%; transform: translateX(-50%); z-index: 999;
  display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none;
}
.toast {
  max-width: 80vw; padding: 11px 18px; border-radius: var(--r-pill);
  background: rgba(50, 40, 35, 0.92); color: #fff; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(-8px); transition: opacity .25s, transform .25s;
  display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { background: rgba(79, 149, 137, 0.96); }
.toast.err { background: rgba(224, 114, 106, 0.96); }
.toast.warn { background: rgba(229, 163, 61, 0.96); }

/* ---------------- 骨架屏 / 加载 ---------------- */
.skeleton {
  background: linear-gradient(100deg, #eee6db 30%, #f6f0e8 50%, #eee6db 70%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

.empty {
  text-align: center; padding: 48px 20px; color: var(--ink-soft);
}
.empty .ico { font-size: 44px; margin-bottom: 12px; opacity: .8; }
.empty .t { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--primary-soft); border-top-color: var(--primary);
  animation: spin .8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 动效 ---------------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pulseSoft { 0%,100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.06); opacity: 1; } }
.fade-up { animation: fadeUp .5s ease both; }
.float { animation: floatY 4s ease-in-out infinite; }
.stagger > * { animation: fadeUp .5s ease both; }
.stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .12s; }
.stagger > *:nth-child(4) { animation-delay: .18s; }
.stagger > *:nth-child(5) { animation-delay: .24s; }
.stagger > *:nth-child(6) { animation-delay: .30s; }
.stagger > *:nth-child(7) { animation-delay: .36s; }
.stagger > *:nth-child(8) { animation-delay: .42s; }

/* 打字气泡三点 */
.typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); animation: pulseSoft 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }

/* 滚动条（桌面） */
@media (min-width: 600px) {
  .app ::-webkit-scrollbar { width: 8px; }
  .app ::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
}

/* 法律页脚（隐私/协议入口，置于底部导航之上） */
.legal-foot {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  flex-wrap: wrap;
  font-size: 12px; color: var(--ink-faint);
  padding: 18px 16px 10px;
  letter-spacing: .2px;
}
.legal-foot a { color: var(--primary-deep); text-decoration: none; }
.legal-foot a:hover { text-decoration: underline; }
.legal-foot span { color: var(--line); }

/* ============================================================
   阶段三 · 增强层：多机型适配 / 情感化微交互 / 过场动画
   （2026-08-30 新增，向下兼容旧页面，无需逐页改造）
   ============================================================ */

/* 动态视口高度：解决移动端地址栏伸缩导致的 100vh 跳动 */
.app { min-height: 100vh; min-height: 100dvh; }

/* 抑制页面级橡皮筋：避免下拉露出底色、滚动链到宿主容器 */
html, body { overscroll-behavior-y: contain; }

/* ---------------- 页面过场 / 入场 ---------------- */
/* 全页淡入（作用于 .app 容器，配合 App.go 跳转） */
.app-fade { animation: appFade .42s ease both; }
@keyframes appFade { from { opacity: 0; } to { opacity: 1; } }

/* 页面进入：轻微上浮 + 缩放，营造"翻开一页"的呼吸感 */
.page-enter { animation: pageEnter .46s cubic-bezier(.22,.61,.36,1) both; }
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(18px) scale(.992); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 单卡片 / 单按钮上浮增强（与现有 .stagger 协同） */
.card.raise, .btn.raise, .section.raise { animation: fadeUp .5s ease both; }

/* ---------------- 涟漪触感反馈 ---------------- */
/* JS 在 .ripple 元素内注入 <span class="ripple-dot">，由 currentColor 着色 */
.ripple { position: relative; overflow: hidden; }
.ripple > .ripple-dot {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: currentColor; opacity: .16; transform: scale(0);
  animation: rippleOut .55s ease-out forwards;
}
@keyframes rippleOut { to { transform: scale(2.6); opacity: 0; } }

/* ---------------- 底部导航激活指示细化 ---------------- */
.bottom-nav .nav-item { gap: 3px; }
.bottom-nav .nav-item.active .lbl { color: var(--primary-deep); }
.bottom-nav .nav-item.active::after {
  content: ''; width: 22px; height: 3px; border-radius: 3px; margin-top: 2px;
  background: var(--grad-primary);
}
/* 更细腻的"按下"反馈 */
.btn:active { transform: translateY(1px) scale(.985); box-shadow: var(--shadow-sm); }
.card.tap:active { transform: scale(.985) translateY(1px); box-shadow: var(--shadow-md); }

/* ---------------- 平滑滚动（锚点 / 列表内跳） ---------------- */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------------- 小屏（<360px）适配 ---------------- */
@media (max-width: 360px) {
  .page { padding-left: 12px; padding-right: 12px; }
  .card { padding: 15px; }
  .btn { padding: 12px 18px; font-size: 14px; }
  .section-title { font-size: 15px; }
  .bottom-nav .nav-item .ico { font-size: 22px; }
  .bottom-nav .nav-item .lbl { font-size: 11px; }
  .topbar .title { font-size: 16px; }
}

/* ---------------- 大屏手机（≥414px）微调 ---------------- */
@media (min-width: 414px) and (max-width: 599px) {
  body { font-size: 15.5px; }
  .page { padding-left: 20px; padding-right: 20px; }
}

/* ---------------- 超窄（≤320px）极端兜底 ---------------- */
@media (max-width: 320px) {
  .topbar { padding-left: 12px; padding-right: 12px; }
  .btn { padding: 11px 16px; }
  .card { padding: 14px; }
}

/* ---------------- 无障碍：尊重"减少动态效果"系统偏好 ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .float, .stagger > *, .page-enter, .app-fade, .card.raise, .btn.raise { animation: none !important; }
  .ripple > .ripple-dot { display: none !important; }
}
