/* ==========================================================================
   半梦 · 网页客户端
   色板与 Android 端 Theme.kt 一致（典雅文学志 / Claude 风）
   ========================================================================== */
:root {
  --bg: #FAF9F5;
  --scene-veil: rgba(250, 249, 245, .87);
  --on-bg: #141413;
  --surface: #F5F0E8;
  --surface-variant: #EFE9DE;
  --on-surface: #3D3D3A;
  --on-surface-variant: #6E6B65;
  --outline: #E6DFD8;
  --primary: #CC785C;
  --on-primary: #FFFFFF;
  --tertiary: #5DB8A6;
  --error: #B3563E;

  /* 衬线回退链补 CJK 字形：Google Fonts 不可达时品牌字体不静默死亡（Finish Gate R4） */
  --font-display: 'Noto Serif SC', 'Source Han Serif SC', 'Noto Serif CJK SC', 'STSong', 'SimSun', 'Times New Roman', serif;
  --font-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A0C11;
    --scene-veil: rgba(10, 12, 17, .84);
    --on-bg: #F0EFEA;
    --surface: rgba(20, 24, 34, 0.5);
    --surface-variant: rgba(26, 32, 46, 0.62);
    --on-surface: #A5A8B0;
    --on-surface-variant: #6B6F7B;
    --outline: rgba(255, 255, 255, 0.08);
    --primary: #D98A72;
    --on-primary: #141413;
    --error: #E08772;
  }
}
:root[data-theme="dark"] {
  --bg: #0A0C11;
  --scene-veil: rgba(10, 12, 17, .84);
  --on-bg: #F0EFEA;
  --surface: rgba(20, 24, 34, 0.5);
  --surface-variant: rgba(26, 32, 46, 0.62);
  --on-surface: #A5A8B0;
  --on-surface-variant: #6B6F7B;
  --outline: rgba(255, 255, 255, 0.08);
  --primary: #D98A72;
  --on-primary: #141413;
  --error: #E08772;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* 全局：滚动到顶/底不触发整页回弹（iOS 橡皮筋会让页面"滑滑的"） */
html, body { overscroll-behavior-y: contain; }

/* 文本选中色：灯火暖调（视觉升级 · 纸页与灯火） */
::selection { background: rgba(204, 120, 92, .28); }

/* 键盘可达性底线：所有可交互元素获得可见焦点环（Finish Gate R1） */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---------- 全局滚动条：与主题一致的细轨 ---------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--outline) transparent;
}
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--outline); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--on-surface-variant); }
*::-webkit-scrollbar-corner { background: transparent; }
/* 横向滑动条（chips 等）整体隐藏，靠手势滑动 */
.chips::-webkit-scrollbar, .chips { scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

html, body {
  height: 100%;
  width: 100%;
  max-width: 100vw;
}
/* 滚动锁：聊天/沉浸页锁死 document 滚动，键盘弹起不再把整页顶飞 */
html.lock-scroll, body.lock-scroll { overflow: hidden !important; height: 100%; overscroll-behavior: none; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--on-bg);
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

#root {
  height: 100%;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}
@supports not (height: 100dvh) {
  #root {
    height: 100vh;
    height: var(--app-height, 100vh);
  }
}

button { font-family: inherit; cursor: pointer; touch-action: manipulation; }
input, textarea, select { font-family: inherit; }

/* ---------- 通用 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 8px;
  padding: 12px 18px; min-height: 44px; font-size: 14px;
  background: var(--primary); color: var(--on-primary);
  transition: opacity .15s ease;
}
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-outline {
  background: transparent; color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-ghost {
  background: transparent; color: var(--on-surface-variant);
  border: 1px solid var(--outline);
}

.field {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 14px; color: var(--on-bg);
  outline: none;
}
.field:focus { border-color: var(--primary); }
.field::placeholder { color: var(--on-surface-variant); }

.mono-label {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--tertiary);
}

/* ---------- 过渡动效（页面切换/按压反馈/悬停） ---------- */
/* ⛔ fill-mode 必须是 backwards，不能是 both / forwards：
   both|forwards 会把终帧的 transform:none 当「动画值」永久留在元素上，computed 变成
   matrix(1,0,0,1,0,0)（≠ none）——该元素连同整棵子树从此常驻独立合成层。
   页节点（#app-body 的直接子元素；#/c/ 线程页就是 .thread-wrap）是全站最大的那一棵，
   被提升成合成层后，真机系统字体放大 / 键盘频繁开合时，安卓 WebView 会漏绘瓦片 →
   输入框那一行出现一条浅色横带（用户口中的「白线」，现象是「字被抹掉半行」）。
   backwards 只在动画开始前套起始帧、跑完不留任何样式；本组关键帧的终帧（opacity:1 /
   transform:none）与元素自然基态等价，所以入场观感完全不变。
   ⛔ 特异性提醒：这条是 (1,0,0)。想用 .thread-wrap{animation-fill-mode:backwards} 之类
      (0,1,0) 的选择器覆盖它**压不住**（跟先后顺序无关，2026-09-19 那次热修就死在这里）。
      要改就改这条，或下面第 2036 行那条 view-in 分组规则。 */
#app-body > * { animation: page-in .28s ease-out backwards; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.btn, .chip, .tile, .feat-card, .user-card, .vendor-tile {
  transition: transform .12s ease, box-shadow .16s ease,
              background-color .15s ease, border-color .15s ease, filter .12s ease;
}
.btn:active, .chip:active, .tile:active, .nav-btn:active,
.feat-card:active, .user-card:active, .vendor-tile:active {
  transform: scale(.97); filter: brightness(.92);
}
.card { transition: box-shadow .18s ease; }
@media (hover: hover) {
  .feat-card:hover, .user-card:hover { box-shadow: 0 4px 14px rgba(0, 0, 0, .08); transform: translateY(-1px); }
}
@media (prefers-reduced-motion: reduce) {
  #app-body > * { animation: none; }
  /* 卡片在 .stack 内层，需显式关闭入场与节奏动画 */
  .char-card, .char-banner { animation: none; }
}

/* 拉丁字标 LIMINAL */
.latin-wordmark {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500;
  letter-spacing: .42em; text-transform: uppercase;
  color: var(--primary);
}

.card {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 12px; padding: 18px 20px;
}

.hairline { border: none; border-top: 1px solid var(--outline); }

/* ---------- 登录页 ---------- */
.auth-wrap {
  min-height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card { width: 100%; max-width: 380px; text-align: center; }
.auth-logo {
  font-family: var(--font-display); font-size: 40px; font-weight: 600;
  margin-bottom: 6px;
}
.auth-sub { color: var(--on-surface-variant); font-size: 14px; margin-bottom: 32px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.auth-switch {
  margin-top: 20px; font-size: 13px; color: var(--on-surface-variant);
  background: none; border: none; text-decoration: underline;
}
.auth-error {
  color: var(--error); font-size: 13px; min-height: 18px; text-align: center;
}
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0 14px;
  color: var(--on-surface-variant);
  font-size: 11px; letter-spacing: .3em;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--outline);
}
.auth-guest-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 14px; font-weight: 600;
  letter-spacing: .08em;
  cursor: pointer;
  transition: background .15s;
}
.auth-guest-btn:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.auth-guest-hint {
  font-size: 11px; color: var(--on-surface-variant);
  font-weight: 400; letter-spacing: .04em;
}

/* ---------- 应用布局 ---------- */
.app-shell {
  height: 100%;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  display: flex; flex-direction: column;
  width: 100%;
  max-width: 720px; margin: 0 auto;
  min-width: 0;
  overflow-x: hidden;
  /* 显式定位上下文 + 层叠上下文：这两个原本是入场动画残留 transform 的副作用，摘掉后必须自己接管。
     - position: relative —— 大厅底栏（.hall-v2-tabbar）等 absolute 后代以 shell 为包含块，
       锚定「屏幕可视区」而非滚动内容；
     - isolation: isolate —— 残留 transform 曾让 shell 顺带成为层叠上下文，壳内 z-index 与
       body 上挂的浮层（弹窗 / 悬浮球 / toast，全部挂在 document.body）之间的层叠顺序依赖它；
       isolate 只建层叠上下文、**不建合成层**，正好接住这条语义。
     ⛔ 别再给 shell 加 transform / will-change / filter：那会把整棵子树重新提升为常驻合成层，
       安卓 WebView 会漏绘瓦片（输入框白条）。详见文件上方「过渡动效」与第 2036 行两处注释。 */
  position: relative;
  isolation: isolate;
}
@media (display-mode: standalone) {
  #root, .app-shell {
    height: 100dvh;
    height: var(--app-height, 100dvh);
  }
}
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  /* 顶部安全区（刘海/灵动岛/PWA 全屏）：padding-top 并入 env，桌面端 env 为 0 无影响 */
  padding: calc(16px + env(safe-area-inset-top)) 20px 12px;
  border-bottom: 1px solid var(--outline);
}
.app-title {
  font-family: var(--font-display); font-size: 19px; font-weight: 500;
  display: flex; align-items: baseline; gap: 10px;
}
.app-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 20px; overscroll-behavior: contain; min-width: 0; }
/* App 壳质感：主滚动区保留滚动、隐藏滚动条（桌面端 Chrome 右侧那条细框即它）。
   只动主滚动容器，内层 .thread-scroll 等细样式滚动条保持原样。 */
#app-body, .app-body {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#app-body::-webkit-scrollbar, .app-body::-webkit-scrollbar {
  display: none;
  width: 0 !important;
}
/* 对话页 thread 是满屏布局：app-body 去 padding，布局由 thread-wrap 全权接管。
   用 .body-thread（JS 挂载）而非 :has()——后者在旧 Safari 不支持会导致整体失效
   止血：线程页只留内层 .thread-scroll 可滚，锁死外层 #app-body 消除嵌套滚动抢夺 */
.app-body.body-thread { padding: 0; overflow: hidden; overscroll-behavior: none; }
.app-body.body-thread .thread-wrap { height: 100%; padding: 12px 14px 0; gap: 10px; }

.app-nav {
  display: flex; justify-content: space-around;
  border-top: 1px solid var(--outline);
  padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
  background: var(--bg);
  flex-shrink: 0;
}
/* 软键盘弹出时隐藏底部导航（main.js initKbNavToggle 开关 body.kb-open）：
   否则 adjustResize 把文档流里的导航顶到键盘上方，挤压聊天输入区 */
body.kb-open .app-nav { display: none; }
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 48px;
  background: none; border: none;
  padding: 6px 0; color: var(--on-surface-variant);
  font-family: var(--font-display); font-size: 13px; letter-spacing: .12em;
}
.nav-btn.active { color: var(--primary); }

/* ---------- 对话线程布局 ---------- */
.thread-wrap {
  display: flex; flex-direction: column; gap: 12px;
  height: 100%;
  min-height: 0;
}
.thread-wrap .thread-scroll { flex: 1 1 0%; min-height: 0; }
.thread-wrap .composer { position: relative; flex-shrink: 0; }
.thread-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: var(--outline) transparent;
  /* 内容底部留白：滚动到底的最后一条消息不被输入框压住 */
  /* 安卓 WebView 修复：确保内层可独立滚动，不被外层 SwipeRefresh 误判 */
}
.thread-scroll > * { margin-bottom: 0; }
.thread-scroll .thread { padding-bottom: 0; }
.thread-scroll .thread::after {
  content: '';
  display: block;
  height: 20px;
  /* ::after 占位不产生 margin 溢出，避免 Safari scrollHeight 多算导致滚动条残影 */
}
.thread-scroll::-webkit-scrollbar { width: 4px; }
.thread-scroll::-webkit-scrollbar-thumb { background: var(--outline); border-radius: 999px; }
.thread-scroll::-webkit-scrollbar-track { background: transparent; }

/* ---------- 列表/空态 ---------- */
.empty-hint {
  text-align: center; color: var(--on-surface-variant);
  font-size: 13px; padding: 28px 12px; line-height: 1.8;
}

.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- 角色广场（独立页） ---------- */
.plaza-page { display: flex; flex-direction: column; gap: 14px; }
.plaza-hero {
  padding: 18px 4px 6px;
  border-bottom: 1px solid var(--outline);
  margin-bottom: 4px;
}
.plaza-hero-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .04em;
}
.plaza-hero-sub {
  font-size: 12px;
  color: var(--on-surface-variant);
  margin-top: 4px;
  letter-spacing: .15em;
}
.plaza-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .03);
}
.plaza-control-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.plaza-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 170px;
}
.plaza-search-icon {
  position: absolute;
  left: 12px;
  font-size: 15px;
  color: var(--on-surface-variant);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
}
.plaza-search {
  width: 100%;
  padding: 8px 32px 8px 34px;
  border-radius: 999px;
  border: 1px solid var(--outline);
  background: var(--surface-variant);
  color: var(--on-surface);
  font-size: 13px;
  outline: none;
  transition: border-color .15s, background .15s;
}
.plaza-search:focus {
  border-color: var(--primary);
  background: var(--surface);
}
.plaza-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--on-surface-variant);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: .7;
}
.plaza-search-clear:hover { opacity: 1; }
.plaza-gender-seg {
  display: inline-flex;
  background: var(--surface-variant);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--outline);
}
.plaza-gender-btn {
  border: none;
  background: transparent;
  color: var(--on-surface-variant);
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .16s ease;
  white-space: nowrap;
}
.plaza-gender-btn.active {
  background: var(--surface);
  color: var(--on-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  font-weight: 600;
}
.plaza-clear {
  font-size: 11.5px;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  transition: all .15s;
}
.plaza-category-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.plaza-category-bar::-webkit-scrollbar { display: none; }
.plaza-cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  background: var(--surface-variant);
  border: 1px solid transparent;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: all .18s ease;
  user-select: none;
  flex-shrink: 0;
}
.plaza-cat-pill:hover {
  color: var(--on-surface);
  border-color: var(--outline);
}
.plaza-cat-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
}
.plaza-cat-pill .plaza-cat-count {
  font-size: 10.5px;
  opacity: .8;
  margin-left: 2px;
}
.plaza-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0 0;
  border-top: 1px dashed var(--outline);
}
.plaza-tags .chip {
  font-size: 11px;
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid var(--outline);
  background: var(--surface);
  color: var(--on-surface-variant);
  transition: all .15s ease;
}
.plaza-tags .chip:hover {
  border-color: var(--primary);
  color: var(--on-surface);
}
.plaza-tags .chip.active {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
  font-weight: 500;
}
.plaza-tag-toggle {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px dashed var(--outline);
  background: transparent;
  color: var(--on-surface-variant);
}
.plaza-tag-toggle.active {
  background: var(--surface-variant);
  border-color: var(--outline);
}
.plaza-counter {
  font-size: 12px;
  color: var(--on-surface-variant);
  letter-spacing: .06em;
  padding: 2px 4px;
}
.plaza-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 768px) {
  .plaza-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
}
.plaza-card {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 12px;
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease;
}
.plaza-card:active { transform: scale(.99); }
.plaza-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.plaza-card-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}
.plaza-card-name::before { content: '✦ '; color: var(--primary); font-size: 11px; }
.plaza-card-tagline {
  font-size: 12px;
  color: var(--on-surface-variant);
  line-height: 1.55;
}
.plaza-card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.plaza-card-tags .chip { font-size: 10px; padding: 2px 7px; }
.plaza-card-greet {
  font-size: 11.5px;
  color: var(--on-surface-variant);
  font-family: var(--font-display);
  line-height: 1.6;
  border-left: 2px solid var(--outline);
  padding-left: 8px;
  margin-top: 3px;
}
.chip.adopted { opacity: .55; cursor: default; }
/* 立绘墙卡片：固定 3/4 画幅，图片 cover 裁切，底部渐变浮层 */
.plaza-card.art {
  position: relative;
  aspect-ratio: 3 / 4;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
}
.plaza-card.art:active { transform: scale(.99); }
.plaza-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  display: block;
}
.plaza-card-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10, 12, 17, .78) 0%, rgba(10, 12, 17, .38) 38%, rgba(10, 12, 17, 0) 62%);
}
.plaza-card-info {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  color: #fff;
  pointer-events: none;
}
.plaza-card-info .plaza-card-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plaza-card-info .plaza-card-name::before { content: '✦ '; color: var(--primary); font-size: 11px; }
.plaza-card-info .plaza-card-tagline {
  font-size: 11px;
  color: rgba(255, 255, 255, .82);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.plaza-card.art .plaza-card-name { color: #fff; }
.plaza-take {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  color: #111;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  font-weight: 500;
  z-index: 2;
}
.plaza-take.adopted {
  background: rgba(10, 12, 17, .65);
  color: rgba(255, 255, 255, .88);
  box-shadow: none;
}
.plaza-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 0 20px;
  font-size: 12px;
  color: var(--on-surface-variant);
}
.plaza-pager .chip { padding: 5px 12px; font-size: 12px; }
.plaza-pager .chip:disabled { opacity: .4; cursor: not-allowed; }
.plaza-pager-info {
  font-family: var(--font-mono);
  letter-spacing: .15em;
  min-width: 50px;
  text-align: center;
}
.plaza-page-jump {
  width: 52px;
  padding: 5px 6px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface);
  font-size: 12px;
  text-align: center;
  outline: none;
  font-family: var(--font-mono);
}
.plaza-page-jump:focus { border-color: var(--primary); }
.plaza-page-jump::-webkit-outer-spin-button,
.plaza-page-jump::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.plaza-page-jump[type='number'] { -moz-appearance: textfield; appearance: textfield; }
.plaza-pager-sep { font-size: 12px; color: var(--on-surface-variant); }
.plaza-page-go { padding: 5px 10px; font-size: 11.5px; }

/* ---------- 角色广场：角色小传与人物档案抽屉 ---------- */
.plaza-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 12, 17, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: modal-fade 0.2s ease-out;
}
.plaza-detail-modal {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 86vh;
  background: var(--bg);
  border: 1px solid var(--outline);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-pop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (max-width: 640px) {
  .plaza-detail-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .plaza-detail-modal {
    max-width: 100%;
    max-height: 88vh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .plaza-detail-overlay,
  .plaza-detail-modal {
    animation: none;
  }
}
.plaza-detail-hero {
  position: relative;
  width: 100%;
  height: 210px;
  flex-shrink: 0;
  overflow: hidden;
  background: #0d1017;
}
.plaza-detail-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
}
.plaza-detail-hero-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    var(--bg) 0%,
    rgba(10, 12, 17, 0.85) 45%,
    rgba(10, 12, 17, 0.25) 75%,
    rgba(10, 12, 17, 0.45) 100%
  );
  pointer-events: none;
}
.plaza-detail-hero-top {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 3;
}
.plaza-detail-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(10, 12, 17, 0.6);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.15s, transform 0.1s;
}
.plaza-detail-close:hover {
  background: rgba(10, 12, 17, 0.85);
}
.plaza-detail-close:active {
  transform: scale(0.92);
}
.plaza-detail-close-ghost {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--outline);
  background: var(--surface-variant);
  color: var(--on-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.plaza-detail-close-ghost:hover {
  background: var(--surface);
}
.plaza-detail-close-ghost:active {
  transform: scale(0.92);
}
.plaza-detail-art-zoom {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(10, 12, 17, 0.6);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.15s, transform 0.1s;
}
.plaza-detail-art-zoom:hover {
  background: rgba(10, 12, 17, 0.85);
}
.plaza-detail-art-zoom:active {
  transform: scale(0.95);
}
.plaza-detail-hero-info {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 12px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.plaza-detail-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.plaza-detail-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  line-height: 1.3;
}
.plaza-detail-gender {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.plaza-detail-gender.male {
  background: rgba(56, 125, 240, 0.35);
  color: #a8cdfc;
  border: 1px solid rgba(56, 125, 240, 0.45);
}
.plaza-detail-gender.female {
  background: rgba(230, 80, 140, 0.35);
  color: #fcb1d0;
  border: 1px solid rgba(230, 80, 140, 0.45);
}
.plaza-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.plaza-detail-tag {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.plaza-detail-noart-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--outline);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}
.plaza-detail-noart-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.plaza-detail-noart-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--on-surface);
}
.plaza-detail-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.plaza-detail-quote {
  padding: 10px 14px;
  border-left: 3px solid var(--primary);
  background: var(--surface-variant);
  border-radius: 0 10px 10px 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--on-surface);
  font-style: italic;
  font-family: var(--font-serif, var(--font-display));
}
.plaza-detail-slot {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.plaza-detail-sec {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.plaza-detail-sec-head {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.5px;
}
.plaza-detail-sec-body {
  font-size: 13px;
  line-height: 1.75;
  color: var(--on-surface);
  white-space: pre-wrap;
  word-break: break-word;
}
.plaza-detail-firstmes {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-variant);
  border: 1px solid var(--outline);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.plaza-firstmes-line {
  font-size: 13px;
  line-height: 1.75;
  color: var(--on-surface);
  word-break: break-word;
}
.plaza-firstmes-line.action {
  font-style: italic;
  color: var(--on-surface-variant);
  font-size: 12.5px;
}
.plaza-memory-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.plaza-memory-chip {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(197, 160, 89, 0.12);
  color: var(--primary);
  border: 1px solid rgba(197, 160, 89, 0.28);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.plaza-detail-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--outline);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}
.plaza-detail-btn {
  min-height: 38px;
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 999px;
}

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chip {
  white-space: nowrap;
  background: var(--surface-variant); color: var(--on-surface);
  border: 1px solid var(--outline); border-radius: 999px;
  padding: 7px 14px; font-size: 13px;
}
.chip.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }

/* ---------- 加载骨架屏（聊天卷宗：消息气泡占位） ---------- */
.skeleton-thread, .skeleton-hall {
  display: flex; flex-direction: column; gap: 14px;
  padding: 8px 0 16px; pointer-events: none;
}
.skeleton-hall .sk-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; }
.skeleton-hall .sk-card {
  height: 216px; border-radius: 14px; border: 1px solid var(--outline);
  background: linear-gradient(160deg, var(--surface-variant), var(--surface));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
.skeleton-hall .sk-avatar { width: 72px; height: 72px; border-radius: 50%; }
.skeleton-hall .sk-name { width: 60px; height: 12px; }
.sk-avatar, .sk-name, .sk-line, .sk-bubble {
  background: linear-gradient(90deg, var(--surface-variant) 25%, var(--surface) 37%, var(--surface-variant) 63%);
  background-size: 400% 100%;
  animation: sk-shimmer 1.4s ease infinite;
}
.sk-msg { display: flex; flex-direction: column; gap: 6px; max-width: 86%; }
.sk-msg.user { align-self: flex-end; align-items: flex-end; }
.sk-msg.assistant { align-self: flex-start; }
.sk-line { height: 14px; border-radius: 8px; }
.sk-bubble { border-radius: 14px; }
.sk-bubble.long { width: 78%; height: 34px; }
.sk-bubble.mid { width: 58%; height: 34px; }
.sk-bubble.short { width: 40%; height: 26px; }
.sk-bubble.user { background: color-mix(in srgb, var(--primary) 22%, var(--surface-variant)); }
.sk-name { width: 64px; height: 10px; }
@keyframes sk-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sk-avatar, .sk-name, .sk-line, .sk-bubble { animation: none; }
}

/* ---------- 对话线程 ---------- */
.thread { display: flex; flex-direction: column; gap: 14px; padding: 8px 0 16px; }
.msg-group { display: flex; flex-direction: column; gap: 6px; max-width: 86%; animation: msg-in .22s ease-out; }
.msg-live .msg-group { animation: none; }
@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .msg-group { animation: none; }
}
.msg-group.user { align-self: flex-end; }
.msg-group.assistant { align-self: flex-start; }
.msg-role {
  font-family: var(--font-sans); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  margin-bottom: 2px; color: var(--on-surface-variant); opacity: .9;
}
.msg-role.user { color: var(--primary); text-align: right; }
.msg-bubble {
  font-size: 15px; line-height: 1.7; white-space: pre-wrap; word-break: break-word;
  padding: 12px 16px; border-radius: 18px; border: 1px solid var(--outline);
  background: var(--surface); color: var(--on-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.msg-group.user .msg-bubble {
  background: var(--primary); color: var(--on-primary); border-color: var(--primary);
  border-bottom-right-radius: 6px;
}
.msg-group.assistant .msg-bubble {
  /* 纸感：纵向极淡的纸页明暗，替代平涂 */
  background: linear-gradient(180deg, var(--surface), var(--surface-variant));
  border-color: var(--outline);
  border-bottom-left-radius: 6px;
}
.msg-meta {
  font-family: var(--font-mono); font-size: 10px; color: var(--on-surface-variant); opacity: .7;
  margin-top: 2px; padding: 0 4px;
}
.msg-group.user .msg-meta { text-align: right; }

/* ---------- 消息气泡快捷操作（重新生成 / 撤回重编 / 复制） ---------- */
.msg-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  padding: 0 4px;
  user-select: none;
  transition: opacity 0.15s;
}
.msg-group.user .msg-actions {
  justify-content: flex-end;
}
/* 仅最新消息默认展示；历史消息在 hover / 聚焦时显现，避免长列表过度杂乱 */
.msg-group:not(.is-latest) .msg-actions {
  opacity: 0;
  pointer-events: none;
}
.msg-group:not(.is-latest):hover .msg-actions,
.msg-group:not(.is-latest):focus-within .msg-actions {
  opacity: 0.85;
  pointer-events: auto;
}
.msg-act-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono, sans-serif);
  font-size: 11px;
  color: var(--on-surface-variant);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 2px 7px;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.15s, background-color 0.15s, border-color 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.msg-act-btn:hover {
  opacity: 1;
  color: var(--on-bg);
  background: var(--surface-variant);
  border-color: var(--outline);
}
.msg-act-btn:active {
  transform: scale(0.96);
}
.msg-act-btn.is-busy {
  pointer-events: none;
  opacity: 0.4;
}

/* ---------- 旁白场景块（对话/旁白分离渲染） ---------- */
.msg-live { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: 100%; }
.scene-block {
  width: 100%;
  padding: 1px 22px;
  text-align: center;
}
.scene-text {
  font-family: var(--font-display);
  font-size: 13px;
  line-height: 1.9;
  letter-spacing: .04em;
  color: var(--on-surface-variant);
  opacity: .85;
}
.scene-text::before { content: "✦ "; font-style: normal; font-size: 9px; opacity: .5; vertical-align: 2px; }
.msg-live-empty { min-height: 24px; display: block; }

.composer {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 12px 12px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--outline);
  background: var(--bg);
  position: relative; bottom: auto; z-index: 2;
}
.composer textarea {
  flex: 1; resize: none;
  background: var(--surface);
  border: 1px solid var(--outline); border-radius: 20px;
  padding: 12px 16px; font-size: 15px; line-height: 1.5; color: var(--on-bg);
  outline: none; min-height: 46px; max-height: 140px;
  transition: border-color .15s, box-shadow .15s;
  /* 输入框内不显示滚动条（内容超长时仍可滚动） */
  scrollbar-width: none;
}
.composer textarea::-webkit-scrollbar { display: none; }
.composer textarea::placeholder { color: var(--on-surface-variant); opacity: .55; }
.composer textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(204,120,92,.12); }
@supports (color: color-mix(in srgb, red 12%, transparent)) {
  .composer textarea:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); }
}
.send-btn {
  width: 46px; height: 46px; border-radius: 50%; border: none; flex-shrink: 0;
  background: var(--primary); color: var(--on-primary); font-size: 18px; display: flex; align-items: center; justify-content: center;
  transition: transform .12s, opacity .15s;
}
.send-btn:active { transform: scale(.96); }
.send-btn:disabled { opacity: .4; cursor: not-allowed; }
.send-btn.is-stop { background: var(--on-surface-variant); }

/* ---------- 立绘：横幅 / 头像 / VN 舞台 / 选人大厅 ---------- */
/* ---------- 相遇大厅 · 画廊墙（设计契约「大厅=画廊」） ---------- */
.hall-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
}

/* ---------- 相遇大厅 · 案头续卷（Plan A 横滑微卡架） ---------- */
.hall-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.hall-recent-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 2px 0 8px;
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}
.hall-recent-section .shint {
  display: none !important;
}
.hall-recent-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px;
}
.hall-recent-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.hall-recent-glyph {
  font-size: 11px;
  color: var(--primary);
  line-height: 1;
}
.hall-recent-title {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--on-bg);
}
.hall-recent-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--tertiary);
  background: color-mix(in srgb, var(--tertiary) 12%, transparent);
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 500;
}
.hall-recent-sub {
  font-size: 11px;
  color: var(--on-surface-variant);
  opacity: .75;
  letter-spacing: .03em;
}
.hall-recent-shelf {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 3px 2px 6px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
.hall-recent-shelf::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
  background: transparent !important;
}
.hall-recent-shelf::-webkit-scrollbar-track,
.hall-recent-shelf::-webkit-scrollbar-thumb {
  display: none !important;
  background: transparent !important;
}
.hall-recent-card {
  flex: 0 0 228px;
  width: 228px;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .03);
  transition: transform .18s cubic-bezier(.16, 1, .3, 1),
              box-shadow .18s ease,
              border-color .18s ease,
              background-color .18s ease;
}
.hall-recent-card:only-child {
  flex: 1 1 100%;
  width: 100%;
  max-width: 100%;
}
@media (hover: hover) {
  .hall-recent-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 4px 14px rgba(204, 120, 92, .14);
    background: color-mix(in srgb, var(--surface) 96%, var(--primary));
  }
  .hall-recent-card:hover .hall-recent-arrow {
    transform: translateX(3px);
    color: var(--primary);
    opacity: .9;
  }
  .hall-recent-card:hover .hall-recent-avatar-wrap::after {
    border-color: var(--primary);
  }
}
.hall-recent-card:active {
  transform: scale(.98);
}
.hall-recent-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hall-recent-avatar-wrap::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, transparent);
  pointer-events: none;
  transition: border-color .18s ease;
}
.hall-recent-avatar {
  width: 38px !important;
  height: 38px !important;
  border-radius: 10px !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}
.hall-recent-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hall-recent-name {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--on-bg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}
.hall-recent-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-size: 11.5px;
  color: var(--on-surface-variant);
  line-height: 1.2;
}
.hall-recent-vol {
  font-family: var(--font-display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1 1 auto;
  opacity: .9;
}
.hall-recent-dot {
  flex-shrink: 0;
  opacity: .5;
  font-size: 10px;
}
.hall-recent-time {
  flex-shrink: 0;
  white-space: nowrap;
  opacity: .75;
  font-size: 11px;
  font-feature-settings: "tnum";
}
.hall-recent-arrow {
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1;
  color: var(--on-surface-variant);
  opacity: .5;
  margin-left: 2px;
  flex-shrink: 0;
  transition: transform .18s ease, color .18s ease, opacity .18s ease;
}
@media (prefers-reduced-motion: reduce) {
  .hall-recent-card,
  .hall-recent-arrow {
    transition: none;
    transform: none !important;
  }
}
.hall-recent {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 2px 0 6px;
}
.hall-recent .chip {
  font-size: 11.5px;
  padding: 6px 12px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* ---------- 世界分流：纪元 / 入梦 ---------- */
.world-mode-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 16px;
}
.world-mode-glyph { font-size: 26px; line-height: 1; padding-top: 2px; }
.world-mode-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .04em;
}
.world-mode-latin {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .25em;
  color: var(--primary);
  margin-left: 8px;
  text-transform: uppercase;
}
.world-mode-sub {
  font-size: 12px;
  color: var(--on-surface-variant);
  line-height: 1.7;
  margin-top: 6px;
}
/* ---------- 入梦世界书 ---------- */
.dream-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 560px) {
  .dream-grid { grid-template-columns: 1fr 1fr; }
}
.dream-book-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}
.dream-book-head {
  display: flex;
  gap: 6px;
  align-items: center;
}
.dream-book-cat { font-size: 10.5px; padding: 3px 9px; color: var(--primary); border-color: var(--primary); }
.dream-book-src { font-size: 10px; padding: 3px 8px; opacity: .7; }
.dream-book-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}
.dream-book-tagline {
  font-size: 12.5px;
  color: var(--on-surface-variant);
  line-height: 1.7;
}
.dream-book-meta {
  font-size: 11px;
  color: var(--on-surface-variant);
  font-family: var(--font-mono);
  letter-spacing: .05em;
}
/* ---------- 入梦沉浸剧本流 ---------- */
.dream-script {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0; /* 覆盖 flex 子项的自动最小尺寸，允许收缩 */
  overflow-y: auto; /* 剧本流自身滚动——此前外溢出盒子，把输入区盖住 */
}
.dream-line { font-size: 13.5px; line-height: 1.8; }
.dream-line.narrator {
  color: var(--on-surface-variant);
  font-family: var(--font-display);
  background: var(--surface-variant);
  border-radius: 12px;
  padding: 12px 14px;
  white-space: pre-wrap;
}
.dream-line.player {
  align-self: flex-end;
  max-width: 85%;
}
.dream-line.player .dream-line-body {
  background: var(--primary);
  color: var(--on-primary);
  border-radius: 14px 4px 14px 14px;
  padding: 10px 14px;
  white-space: pre-wrap;
}
.dream-line.npc {
  align-self: flex-start;
  max-width: 85%;
}
.dream-line.npc .dream-line-body {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 4px 14px 14px 14px;
  padding: 10px 14px;
  white-space: pre-wrap;
}
.dream-line-label {
  font-size: 10.5px;
  color: var(--on-surface-variant);
  font-family: var(--font-mono);
  letter-spacing: .1em;
  margin-bottom: 4px;
}
.dream-event {
  background: linear-gradient(120deg, rgba(204, 124, 92, .12), rgba(204, 124, 92, .04));
  border: 1px solid var(--primary);
  color: var(--primary);
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 10px;
  letter-spacing: .05em;
}
.dream-status {
  font-size: 11px;
  color: var(--on-surface-variant);
  min-height: 16px;
  font-family: var(--font-mono);
  letter-spacing: .05em;
}
/* 输入区固定在剧本流底部，不随内容滚走（IM 骨架） */
.dream-input {
  flex-shrink: 0;
  border-top: 1px solid var(--outline);
  padding-top: 10px;
}
.dream-event { flex-shrink: 0; }
.dream-memory {
  border-color: var(--primary);
  background: linear-gradient(150deg, rgba(204, 124, 92, .07), var(--surface));
  padding: 0 14px;
}
/* 记忆折叠条：默认收起一行；展开体内部滚动（上限 40vh），不吃对话区 */
.dream-memory summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  cursor: pointer; list-style: none; user-select: none;
}
.dream-memory summary::-webkit-details-marker { display: none; }
.dream-memory-chev {
  color: var(--primary); font-family: var(--font-mono); font-size: 11px;
  transition: transform .15s;
}
.dream-memory[open] .dream-memory-chev { transform: rotate(90deg); }
.dream-memory-body {
  max-height: 40vh; overflow-y: auto;
  margin-top: 0; padding: 10px 0 12px;
  border-top: 1px dashed var(--outline);
}
/* ---------- 世界模式选择弹窗（渐出） ---------- */
.world-mode-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8, 10, 14, .45);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .22s ease;
}
.world-mode-overlay.show { opacity: 1; }
.world-mode-pop {
  width: min(340px, calc(100vw - 48px));
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 18px;
  padding: 20px 18px 16px;
  box-shadow: 0 18px 60px rgba(8, 10, 14, .28);
  transform: translateY(14px) scale(.97);
  transition: transform .22s cubic-bezier(.22, 1, .36, 1);
}
.world-mode-overlay.show .world-mode-pop { transform: none; }
.world-mode-pop-title {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 600; letter-spacing: .05em;
}
.world-mode-pop-sub {
  font-size: 12px; color: var(--on-surface-variant);
  margin-top: 2px; letter-spacing: .1em;
}
.world-mode-pop-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 6px;
  border-bottom: 1px solid var(--outline);
  cursor: pointer;
}
.world-mode-pop-item:last-of-type { border-bottom: none; }
.world-mode-pop-item:hover .world-mode-pop-title { color: var(--primary); }
.world-mode-pop-item .world-mode-glyph { font-size: 24px; }
.char-card {
  position: relative; overflow: hidden;
  border-radius: 14px; /* 画框收紧，退后成框 */
  border: 1px solid var(--outline); cursor: pointer;
  background: linear-gradient(160deg, var(--surface-variant), var(--surface));
  transition: transform .18s ease, box-shadow .22s ease, border-color .18s ease;
  /* backwards：下面是 nth-child 阶梯延迟入场，both 会让每张卡都常驻一个合成层（几十张卡 = 几十个层） */
  animation: msg-in .28s ease-out backwards;
}
/* 竖幅画框（3:4 接近完整立绘）；不支持 aspect-ratio 的老浏览器给固定高度兜底 */
.hall-wall .char-card { height: 216px; }
@supports (aspect-ratio: 1 / 1) {
  .hall-wall .char-card { height: auto; aspect-ratio: 3 / 4; }
}
/* 入场节奏：画框依次落定（reduced-motion 下随 msg-in 一起关闭） */
.hall-wall .char-card:nth-child(2) { animation-delay: .04s; }
.hall-wall .char-card:nth-child(3) { animation-delay: .08s; }
.hall-wall .char-card:nth-child(4) { animation-delay: .12s; }
.hall-wall .char-card:nth-child(5) { animation-delay: .16s; }
.hall-wall .char-card:nth-child(n + 6) { animation-delay: .2s; }
.char-card:hover {
  transform: translateY(-2px);
  border-color: rgba(204, 120, 92, .45);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .13);
}
.char-card:active { transform: scale(.985); }
.char-card-img { position: absolute; inset: 0; background-size: cover; background-position: center 15%; }
.char-card-fade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(10, 12, 17, .78) 100%);
}
.char-card.no-art .char-card-fade { background: linear-gradient(160deg, var(--surface-variant) 30%, rgba(10,12,17,.55) 100%); }
.char-card-info { position: absolute; left: 12px; right: 34px; bottom: 10px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.char-card-info strong {
  font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: .03em;
  color: #fff; text-shadow: 0 1px 8px rgba(0, 0, 0, .5);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.char-card-info span { font-size: 11px; color: rgba(255,255,255,.85); font-family: var(--font-mono); }
.char-card-arrow {
  position: absolute; right: 10px; bottom: 11px;
  color: rgba(255,255,255,.9); font-size: 16px; line-height: 1;
  transition: transform .18s ease, color .18s ease, text-shadow .18s ease;
}
.char-card:hover .char-card-arrow {
  transform: translateX(3px);
  color: #fff; text-shadow: 0 0 8px rgba(204, 120, 92, .9);
}
/* ---------- 记忆页茧卡片：可点暗示（chevron 常驻 + 悬停主题色轻反馈） ---------- */
.cocoon-row { transition: border-color .18s ease; }
.cocoon-row:hover { border-color: var(--primary); }
.cocoon-row-chevron {
  color: var(--on-surface-variant); font-size: 18px; line-height: 1;
  flex-shrink: 0;
  transition: transform .18s ease, color .18s ease;
}
.cocoon-row:hover .cocoon-row-chevron,
.cocoon-row:focus-visible .cocoon-row-chevron {
  transform: translateX(3px);
  color: var(--primary);
}
@media (prefers-reduced-motion: reduce) {
  .cocoon-row-chevron { transition: none; }
  .cocoon-row:hover .cocoon-row-chevron,
  .cocoon-row:focus-visible .cocoon-row-chevron { transform: none; }
}
.char-banner {
  position: relative; height: 128px; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--outline); background: var(--surface-variant);
  animation: msg-in .3s ease-out;
}
.char-banner-img { position: absolute; inset: 0; background-size: cover; background-position: center 20%; }
.char-banner-fade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 30%, var(--bg) 100%);
}
.char-banner.no-art .char-banner-fade { background: linear-gradient(160deg, var(--surface-variant), var(--surface)); }
.char-banner-info { position: absolute; left: 14px; right: 40px; bottom: 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.char-banner-info .char-banner-name-row { display: flex; align-items: baseline; gap: 8px; max-width: 100%; }
.char-banner-info strong { font-family: var(--font-display); font-size: 20px; letter-spacing: .03em; color: var(--on-bg); }
.char-banner-status { font-size: 11px; color: var(--tertiary); letter-spacing: .08em; }
.char-banner-recall {
  background: none; border: none; padding: 0;
  font-family: var(--font-display); font-size: 11px; letter-spacing: .06em;
  color: var(--on-surface-variant); cursor: pointer; white-space: nowrap;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.char-banner-recall:hover { color: var(--primary); }

.cavatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background-size: cover; background-position: center 20%;
  border: 1px solid var(--outline);
  display: inline-flex; align-items: center; justify-content: center;
}
.cavatar.fallback {
  background: var(--surface-variant); color: var(--primary);
  font-family: var(--font-display); font-size: 15px;
}
.msg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.msg-head.user { justify-content: flex-end; }

.art-preview {
  width: 72px; height: 72px; border-radius: 12px; flex-shrink: 0;
  background-color: var(--surface-variant); background-size: cover; background-position: center 20%;
  border: 1px dashed var(--outline);
  display: inline-block;
  position: relative; overflow: hidden;
}
.art-preview.has { border-style: solid; }
.art-preview.generating { border-style: solid; border-color: var(--primary); }
.art-preview.generating::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(204, 120, 92, .28) 50%, transparent 70%);
  animation: art-sweep 1.4s ease-in-out infinite;
}
@keyframes art-sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .art-preview.generating::after { animation: none; }
}
.sec-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--tertiary);
  margin-bottom: 8px;
}
.style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.style-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 6px 11px; border-radius: 12px;
  background: var(--surface); border: 1.5px solid var(--outline);
  color: inherit; transition: border-color .15s ease, background-color .15s ease;
}
.style-tile.active { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--surface-variant); }
.style-tile .st-icon { font-size: 22px; line-height: 1; }
.style-tile .st-label { font-family: var(--font-display); font-weight: 600; font-size: 14px; }
.style-tile .st-sub { font-size: 10.5px; color: var(--on-surface-variant); }
.char-card.slim { height: 108px; }
.char-card-actions {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: flex; gap: 6px;
}
.chip.mini {
  padding: 3px 9px; font-size: 11px;
  background: rgba(10, 12, 17, .5); color: #fff;
  border-color: rgba(255, 255, 255, .28);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.chip.mini.danger { color: #ffb4a0; }

/* VN 沉浸模式 */
.vn-wrap { gap: 0 !important; min-height: 0; }
.vn-stage {
  position: relative; flex: 1; min-height: 0; border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, var(--surface-variant), var(--surface));
  border: 1px solid var(--outline);
  display: flex; flex-direction: column; justify-content: flex-end;
}
.vn-stage.has-art { background: #0d0f14; }
.vn-backdrop {
  position: absolute; inset: -20px;
  background-size: cover; background-position: center 15%;
  filter: blur(18px) brightness(.55); opacity: .8;
}
.vn-figure {
  position: absolute; inset: 0;
  background-size: contain; background-repeat: no-repeat; background-position: center bottom;
  animation: msg-in .4s ease-out;
}
.vn-top {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 10px; right: 10px; z-index: 3;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.vn-top .chip { background: rgba(10, 12, 17, .45); color: #f0efea; border-color: rgba(255,255,255,.15); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.vn-top .chip.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.vn-top .mono-label { color: rgba(240,239,234,.75); }
.vn-box {
  position: relative; z-index: 2;
  margin: 12px; padding: 14px 16px 10px;
  border-radius: 14px;
  background: rgba(250, 249, 245, .88);
  border: 1px solid var(--outline);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
  min-height: 120px;
  max-height: min(42vh, 380px);
  overflow: hidden;
  display: flex; flex-direction: column; gap: 8px;
}
@supports (color: color-mix(in srgb, red 88%, transparent)) {
  .vn-box { background: color-mix(in srgb, var(--bg) 88%, transparent); }
}
.vn-box::-webkit-scrollbar { width: 4px; }
.vn-box::-webkit-scrollbar-thumb { background: var(--outline); border-radius: 999px; }
.vn-box::-webkit-scrollbar-track { background: transparent; }
.vn-name-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.vn-name-row .cavatar { width: 26px; height: 26px; font-size: 13px; }
.vn-nameplate { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--primary); }
.vn-nameplate.user { color: var(--tertiary); }
.vn-counter { font-family: var(--font-mono); font-size: 10px; color: var(--on-surface-variant); }
.vn-content { flex: 1; min-height: 0; font-size: 15px; line-height: 1.8; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.vn-line { white-space: pre-wrap; word-break: break-word; }
.vn-line.error { color: var(--error); font-size: 13px; }
.vn-narr { font-family: var(--font-display); font-size: 13px; letter-spacing: .04em; color: var(--on-surface-variant); margin: 4px 0; }
.vn-steppers { display: flex; justify-content: space-between; }
.vn-steppers .chip { padding: 8px 14px; min-height: 36px; font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  .char-banner, .vn-figure { animation: none; }
}

.typing-dots::after {
  content: "▍";
  animation: blink 1s steps(2) infinite;
  color: var(--primary);
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .typing-dots::after { animation: none; }
}

/* ---------- 长按操作单 / Toast / 下拉刷新 ---------- */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(10, 12, 17, .4);
  animation: modal-fade .18s ease-out;
}
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  border-radius: 18px 18px 0 0;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 4px;
  animation: sheet-up .22s cubic-bezier(.2, .9, .3, 1.1);
}
@keyframes sheet-up { from { transform: translateY(40%); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet-btn {
  border: none; background: none; text-align: left;
  padding: 14px 16px; min-height: 48px; border-radius: 10px;
  font-size: 15px; color: var(--on-bg);
}
.sheet-btn:active { background: var(--surface-variant); }
.sheet-btn.danger { color: var(--error); }
.sheet-btn.cancel {
  text-align: center; color: var(--on-surface-variant);
  border-top: 1px solid var(--outline); border-radius: 0;
}
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  background: rgba(10, 12, 17, .85); color: #f0efea;
  padding: 9px 18px; border-radius: 999px;
  font-size: 13px; z-index: 120; pointer-events: none;
  opacity: 0; transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* ---------- 上下文水位环：conic-gradient 圆环 + 中心镂空。
   --pct 由 JS 写入（0-100）；≥70% 琥珀、≥90% 红。token 越多，彩色弧越长，顺时针填满一圈 ---------- */
.ctx-ring {
  width: 24px; height: 24px; border-radius: 50%;
  flex-shrink: 0; cursor: pointer; position: relative;
  background: conic-gradient(var(--ctx-color, var(--primary)) calc(var(--pct, 0) * 1%), var(--outline) 0);
  transition: background .35s cubic-bezier(.4,0,.2,1);
}
.ctx-ring::after {
  content: ''; position: absolute; inset: 3px;
  border-radius: 50%; background: var(--bg);
}
/* 圆心读数：已知显示水位百分比数字，未知显示 ? */
.ctx-ring-txt {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 8px; line-height: 1;
  color: var(--on-surface-variant);
}
.ctx-ring.warn .ctx-ring-txt { color: #d97706; }
.ctx-ring.danger .ctx-ring-txt { color: var(--error); }
.ctx-ring.unknown { cursor: help; }
.ctx-ring.unknown .ctx-ring-txt { font-size: 11px; color: var(--on-surface-variant); }
.ctx-ring.warn { --ctx-color: #d97706; }
.ctx-ring.danger { --ctx-color: var(--error); }

/* 圆环右侧的 token 消耗小字——不挤进圆心，圆环本职保持不变 */
.ctx-tokens {
  flex-shrink: 0;
  background: none; border: none; padding: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--on-surface-variant);
  letter-spacing: .02em;
  cursor: pointer;
  min-width: 28px;
  text-align: left;
}
.ctx-tokens:hover { color: var(--primary); }
.ctx-ring:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .ctx-ring { transition: none; }
}
/* ---------- 水位弹窗 ---------- */
.ctx-pop-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(10, 12, 17, .25);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 24px 16px calc(96px + env(safe-area-inset-bottom, 0px));
  animation: overlay-in .15s ease-out backwards;
}
.ctx-pop {
  width: 100%; max-width: 360px;
  background: var(--bg);
  border: 1px solid var(--outline);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .25);
  animation: card-in .18s ease-out backwards;
}
.ctx-pop-status {
  min-height: 18px; margin-top: 8px;
  font-size: 12px; color: var(--on-surface-variant);
  white-space: pre-wrap;
}
.ctx-pop-usage {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--surface-variant);
  border-radius: 10px;
  border: 1px solid var(--outline);
}
.ctx-pop-usage-title {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: .12em;
  color: var(--primary);
  margin-bottom: 8px;
}
.ctx-pop-usage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  text-align: center;
}
.ctx-pop-usage-num {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}
.ctx-pop-usage-cap {
  font-size: 10.5px;
  color: var(--on-surface-variant);
  margin-top: 2px;
  letter-spacing: .08em;
}
.ctx-pop-usage-split {
  display: flex; justify-content: space-around;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--outline);
  font-size: 11px;
  color: var(--on-surface-variant);
}
@media (prefers-reduced-motion: reduce) {
  .ctx-pop-overlay, .ctx-pop { animation: none; }
}

/* ---------- 页面与弹窗过渡（克制：淡入 + 轻位移，尊重系统减少动态） ---------- */
@keyframes view-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}
@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes card-in {
  from { opacity: 0; transform: scale(.96) translateY(6px); }
  to { opacity: 1; transform: none; }
}
.app-shell, .conn-shell, .auth-wrap, .thread-wrap, .view-in {
  animation: view-in .22s ease-out backwards;
}
/* ⛔ 为什么这里是 backwards —— 2026-09-19「composerband」热修的教训：
   上一轮只把 fill-mode 改在 .thread-wrap 上（.thread-wrap{animation-fill-mode:backwards}），
   结果**完全无效**：页节点同时还命中文件上方 #app-body > * { animation: page-in … both }，
   那条特异性 (1,0,0) 压过 .thread-wrap 的 (0,1,0)，与先后顺序无关。实测该元素 computed 仍是
   matrix(1,0,0,1,0,0)、fill-mode 仍是 both —— 等于没修，线上照旧偶发白条
   （当时 --verify 只 grep 了「字符串在不在」，没量 computed，这是漏网的原因）。
   ⇒ 摘「常驻合成层」必须改**真正生效的那条规则**，改完要用脚本量 computed transform
     （scripts/guard-repaint.mjs），不能只 grep。
   ⇒ 新增任何入场动画时，若终帧（opacity:1 / transform:none）与元素自然基态一致，一律用 backwards。 */
/* 弹窗入场同理：终帧（opacity:1 / transform:none）与基态一致 → 一律 backwards。
   注：下面第 2096/2105 行还有一组同选择器的声明且更靠后，实际生效的是那一组；
   这里改成 backwards 是为了不给「常驻元素 + both」留下任何可被后人抄走的样本。 */
.modal-overlay { animation: overlay-in .15s ease-out backwards; }
.modal-card { animation: card-in .18s ease-out backwards; }
@media (prefers-reduced-motion: reduce) {
  .app-shell, .conn-shell, .auth-wrap, .thread-wrap, .view-in,
  .modal-overlay, .modal-card { animation: none; }
}

/* ---------- 梦茧页「破茧」入场：羁绊先落定，星屑如微尘次第浮现。
   仅 transform/opacity；子项阶梯延迟封顶 0.3s；reduced-motion 退为轻淡入 ---------- */
@keyframes cocoon-unfurl {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.cocoon-unfurl > * {
  /* backwards：阶梯延迟期间照样不可见（from 态），但跑完不留恒等 transform */
  animation: cocoon-unfurl .45s cubic-bezier(.16, 1, .3, 1) backwards;
}
.cocoon-unfurl > *:nth-child(2) { animation-delay: .06s; }
.cocoon-unfurl > *:nth-child(3) { animation-delay: .12s; }
.cocoon-unfurl > *:nth-child(4) { animation-delay: .18s; }
.cocoon-unfurl > *:nth-child(5) { animation-delay: .24s; }
.cocoon-unfurl > *:nth-child(n+6) { animation-delay: .3s; }
@media (prefers-reduced-motion: reduce) {
  .cocoon-unfurl > * { animation-duration: .22s; animation-delay: 0s; }
}

.ptr-ind {
  height: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: var(--on-surface-variant); font-size: 12px; font-family: var(--font-mono);
  transition: height .2s ease;
}

/* ---------- 应用内弹窗 ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(10, 12, 17, .45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: modal-fade .18s ease-out;
}
.modal-card {
  width: 100%; max-width: 320px;
  background: var(--bg);
  border: 1px solid var(--outline);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
  animation: modal-pop .2s cubic-bezier(.2, .9, .3, 1);
  max-height: min(85vh, 85dvh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  box-sizing: border-box;
}
@keyframes modal-fade { from { opacity: 0; } }
@keyframes modal-pop { from { opacity: 0; transform: scale(.94) translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  .modal-overlay, .modal-card { animation: none; }
}
.modal-title {
  font-family: var(--font-display);
  font-size: 16px; font-weight: 600;
  margin-bottom: 6px;
}
.modal-msg {
  font-size: 13.5px; line-height: 1.75;
  color: var(--on-surface);
  white-space: pre-wrap;
  word-break: break-word;
}
.modal-card .field { margin-top: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.modal-btn { min-width: 76px; min-height: 44px; padding: 10px 16px; }
.modal-danger { background: var(--error); border-color: var(--error); }

/* 移动端：通用轻弹窗居中并自适应剩余高度，支持局部滚动避免软键盘遮挡操作按钮 */
@media (max-width: 767px) {
  .modal-overlay {
    align-items: center;
    justify-content: center;
    padding: 16px;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .modal-card {
    max-width: min(340px, calc(100vw - 32px));
    max-height: min(80vh, 80dvh);
  }
}

/* ---------- 角色创建/编辑大弹窗（支持移动端抽屉与大表单顺滑滚动） ---------- */
.char-modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(10, 12, 17, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: modal-fade .18s ease-out;
  overscroll-behavior: contain;
}
.char-modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  max-height: min(88vh, 760px);
  background: var(--bg);
  border: 1px solid var(--outline);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-pop .2s cubic-bezier(.2, .9, .3, 1);
}
.char-modal-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--outline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--bg);
}
.char-modal-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--on-bg);
}
.char-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--outline);
  background: var(--surface);
  color: var(--on-surface-variant);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: all .15s ease;
}
.char-modal-close:hover {
  background: var(--surface-variant);
  color: var(--on-surface);
}
.char-modal-close:active {
  transform: scale(.92);
}
.char-modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 16px 20px 20px;
}
.char-modal-body .sec-label {
  margin-top: 14px;
  margin-bottom: 4px;
}
.char-modal-body .sec-label:first-child {
  margin-top: 0;
}
.char-modal-body .field {
  margin-top: 10px;
}
.char-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--outline);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
  background: var(--bg);
}
@media (max-width: 640px) {
  .char-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .char-modal-card {
    max-width: 100%;
    max-height: 90vh;
    max-height: 90dvh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: none;
  }
  .char-modal-footer {
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
}
@media (prefers-reduced-motion: reduce) {
  .char-modal-overlay, .char-modal-card { animation: none; }
}

/* ---------- 世界 ---------- */
.world-clock {
  text-align: center; padding: 22px;
  background: var(--surface-variant);
  border: 1px solid var(--outline); border-radius: 12px;
}
.world-day {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 2px;
  color: var(--primary);
}
.world-time {
  font-family: var(--font-display); font-size: 42px; margin: 8px 0 6px;
}

/* ---------- 表单卡 ---------- */
.form-grid { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

/* ---------- 设置页 ---------- */
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; font-size: 14px;
}
.setting-group {
  background: var(--surface-variant);
  border: 1px solid var(--outline); border-radius: 12px;
  overflow: hidden;
}
.setting-group .setting-row + .setting-row { border-top: 1px solid var(--outline); }

/* 心动开关：粉渐变小爱心（纯爱模式的加料项） */
.heart-ic {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #ff9eb5 0%, #f43f6e 100%);
  box-shadow: 0 4px 12px rgba(244, 63, 110, .35);
}
.heart-row.on .heart-ic { animation: heartbeat 1.6s ease-in-out infinite; }
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(1.14); }
  24% { transform: scale(1); }
  36% { transform: scale(1.08); }
  48% { transform: scale(1); }
}
.heart-row .switch.on { background: linear-gradient(135deg, #ff7ba9, #f43f6e); }
.setting-row.heart-row.disabled { opacity: .6; }
/* 生日三段输入：年月日横排，各端长相一致（不用原生 date 控件） */
.bdate-row { display: flex; align-items: center; gap: 6px; }
.bdate-row .field { padding-left: 8px; padding-right: 8px; }
.bdate-unit { flex: none; font-size: 13px; color: var(--on-surface-variant); }
/* 心动确认弹窗：顶部粉光带 + 跳动大爱心 + 渐变确认钮 */
.modal-card.heart-modal { position: relative; overflow: hidden; border: none; padding: 26px 22px 20px; text-align: center; }
.modal-card.heart-modal::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 84px;
  background: linear-gradient(135deg, #ffe3ec 0%, #ffc9da 45%, #f6a9c6 100%);
}
.heart-modal-hero {
  position: relative; z-index: 1;
  width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(135deg, #ff9eb5 0%, #f43f6e 100%);
  box-shadow: 0 10px 24px rgba(244, 63, 110, .45), 0 0 0 8px rgba(244, 63, 110, .12);
  animation: heartbeat 1.6s ease-in-out infinite;
}
.heart-modal-title { font-size: 18px; }
.heart-modal .modal-msg { font-size: 12.5px; }
.heart-modal .conn-label { justify-content: center; margin-top: 14px; }
.heart-modal .bdate-row .field { border-radius: 12px; padding-top: 12px; padding-bottom: 12px; font-size: 15px; }
.heart-modal .modal-actions { justify-content: stretch; margin-top: 20px; }
.heart-modal .modal-actions .btn { flex: 1; }
.btn.heart-go {
  background: linear-gradient(135deg, #ff7ba9, #f43f6e);
  border: none; color: #fff;
  box-shadow: 0 6px 16px rgba(244, 63, 110, .4);
}
.btn.heart-go:active { transform: scale(.97); }
@media (prefers-reduced-motion: reduce) {
  .heart-modal-hero { animation: none; }
}
@media (prefers-reduced-motion: reduce) {
  .heart-row.on .heart-ic { animation: none; }
}

.avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 26px;
  margin: 0 auto 12px;
}

/* ==========================================================================
   编辑连接（LLM 配置页）
   ========================================================================== */
.conn-header {
  display: flex; align-items: center; flex-shrink: 0;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  border-bottom: 1px solid var(--outline);
}
.conn-back {
  width: 42px; height: 42px;
  background: none; border: none;
  font-size: 20px; color: var(--on-bg);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  transition: background .15s ease;
}
.conn-back:hover, .conn-back:active {
  background: var(--surface-variant);
}
.conn-title {
  flex: 1; text-align: center;
  font-family: var(--font-display); font-size: 17px; font-weight: 600;
  margin-right: 42px; /* 平衡左侧返回键宽度 */
}

.conn-label {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 20px 2px 8px;
  font-size: 13px; color: var(--on-bg);
}
.conn-hint { font-size: 11px; color: var(--on-surface-variant); }

.vendor-row {
  display: flex; gap: 10px;
  overflow-x: auto; padding: 2px 2px 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.vendor-row::-webkit-scrollbar { display: none; }
.vendor-tile {
  min-width: 84px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--outline); border-radius: 14px;
  padding: 13px 8px 11px;
  color: inherit;
  cursor: pointer;
  transition: all .15s ease;
}
.vendor-tile:hover {
  border-color: var(--primary);
  background: var(--surface-variant);
}
.vendor-tile.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
  background: var(--surface-variant);
}
.vendor-logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, .08);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}
.vendor-logo img {
  width: 22px; height: 22px;
  object-fit: contain;
  display: block;
  -webkit-user-drag: none;
}
.vendor-name { font-size: 12px; font-weight: 500; white-space: nowrap; color: var(--on-bg); }

/* ---- 滚动可见性提示（scanScrollHints）：边缘渐隐 + 细进度条，横竖通用 ---- */
.shint-host {
  position: relative;
}
.shint {
  position: absolute;
  pointer-events: none;
  z-index: 2;
}
.shfade {
  position: absolute;
  opacity: 0;
  transition: opacity .15s ease;
}
.shfade.l { left: 0; top: 0; bottom: 0; width: 24px; background: linear-gradient(90deg, var(--bg) 15%, transparent); }
.shfade.r { right: 0; top: 0; bottom: 0; width: 24px; background: linear-gradient(270deg, var(--bg) 15%, transparent); }
.shfade.t { top: 0; left: 0; right: 0; height: 20px; background: linear-gradient(180deg, var(--bg) 15%, transparent); }
.shfade.b { bottom: 0; left: 0; right: 0; height: 20px; background: linear-gradient(0deg, var(--bg) 15%, transparent); }
.shfade.show { opacity: 1; }
.shrail {
  position: absolute;
  display: none;
  border-radius: 3px;
  background: var(--surface-variant);
}
.shrail.x { left: 6px; right: 6px; bottom: 2px; height: 3px; }
.shrail.y { top: 6px; bottom: 6px; right: 2px; width: 3px; }
.shint.has-x .shrail.x { display: block; }
.shint.has-y .shrail.y { display: block; }
.shthumb {
  position: absolute;
  border-radius: 3px;
  background: var(--on-surface-variant);
  opacity: .45;
}
.shrail.x .shthumb { top: 0; left: 0; height: 100%; min-width: 24px; }
.shrail.y .shthumb { left: 0; top: 0; width: 100%; min-height: 24px; }

.conn-card {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 14px;
  padding: 16px;
}

.input-wrap { position: relative; display: flex; }
.input-wrap .field { padding-right: 46px; }
.input-adorn {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none;
  color: var(--on-surface-variant); font-size: 15px;
  pointer-events: none;
}
button.input-adorn { pointer-events: auto; cursor: pointer; }

.warn-line {
  font-size: 12px; color: #C77E1F;
  margin-top: 10px; min-height: 16px;
}

.test-btn {
  width: 100%; justify-content: center;
  margin-top: 20px;
  background: transparent;
  border: 1.5px solid var(--primary); color: var(--primary);
}
.test-result {
  text-align: center;
  font-family: var(--font-mono); font-size: 12px;
  margin-top: 8px; min-height: 16px;
}

.conn-footer {
  display: flex; gap: 12px;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--outline);
  background: var(--bg);
}

/* ==========================================================================
   全新设置页与 LLM 连接页样式（Notion / Apple 质感）
   ========================================================================== */

/* 设置分区小标题 */
.settings-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--on-surface-variant);
  letter-spacing: 0.5px;
  margin: 22px 6px 8px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.settings-section-title:first-child {
  margin-top: 6px;
}

/* 设置卡片容器 */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 8px;
}
.settings-card .setting-row + .setting-row,
.settings-card .settings-item + .settings-item,
.settings-card .setting-row + .settings-item,
.settings-card .settings-item + .setting-row,
.settings-card .setting-theme-row + .setting-row,
.settings-card .setting-row + .setting-theme-row {
  border-top: 1px solid var(--outline);
}

/* 主题分段选择行 */
.setting-theme-row {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.setting-theme-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 500;
  color: var(--on-bg);
}

/* 点击型设置行（关于、教程、导出、退出等） */
.settings-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  font-size: 14px;
  color: var(--on-bg);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}
.settings-item:hover {
  background: var(--surface-variant);
}
.settings-item:active {
  background: var(--surface-variant);
  opacity: 0.85;
}
.settings-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--surface-variant);
  color: var(--on-surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.settings-item-main {
  flex: 1;
  min-width: 0;
}
.settings-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--on-bg);
}
.settings-item-sub {
  font-size: 11px;
  color: var(--on-surface-variant);
  margin-top: 2px;
  line-height: 1.45;
}
.settings-item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--on-surface-variant);
  font-size: 13px;
  flex-shrink: 0;
}
.settings-item.danger .settings-item-title {
  color: var(--error);
}
.settings-item.danger .settings-item-icon {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

/* LLM 连接页提示条 */
.conn-banner {
  background: var(--surface-variant);
  border: 1px solid var(--outline);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--on-surface-variant);
  line-height: 1.6;
  margin: 6px 0 16px;
}
.conn-banner-icon {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--primary);
}

/* LLM 表单分组卡片 */
.conn-field-group {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 8px;
}
.conn-field-row {
  display: flex;
  align-items: center;
  padding: 11px 16px;
  min-height: 52px;
  gap: 12px;
}
.conn-field-row + .conn-field-row {
  border-top: 1px solid var(--outline);
}
.conn-field-label {
  width: 76px;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--on-surface-variant);
}
.conn-field-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
  min-width: 0;
}
.conn-field-input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 6px 0;
  font-size: 15px;
  color: var(--on-bg);
  outline: none;
  font-family: inherit;
}
.conn-field-input::placeholder {
  color: var(--on-surface-variant);
  opacity: 0.5;
}
.conn-field-adorn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--on-surface-variant);
  flex-shrink: 0;
  padding: 0;
  border-radius: 8px;
}
button.conn-field-adorn {
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
button.conn-field-adorn:hover {
  background: var(--surface-variant);
  color: var(--on-bg);
}

/* 模型管理卡片 */
.conn-model-card {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 8px;
}
.conn-model-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.conn-model-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--on-bg);
}
.conn-model-sub {
  font-size: 11px;
  color: var(--on-surface-variant);
  margin-top: 2px;
}
.conn-model-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 8px;
  background: var(--surface-variant);
  border: 1px solid var(--outline);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--primary);
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conn-model-chips {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 连通性测试卡片 */
.conn-test-card {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 8px;
}
.conn-test-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.conn-test-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.conn-test-btn:hover {
  background: var(--surface-variant);
}
.conn-test-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.conn-test-pill {
  font-size: 12px;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--surface-variant);
  border: 1px solid var(--outline);
}

/* 安全隐私说明条 */
.conn-security-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11px;
  color: var(--on-surface-variant);
  line-height: 1.6;
  margin: 14px 4px 10px;
  opacity: 0.85;
}
.conn-security-note svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--on-surface-variant);
}

/* ==========================================================================
   「我的」仪表盘 与「设置」页
   ========================================================================== */
.page-hero {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 26px; font-weight: 600;
  padding: calc(16px + env(safe-area-inset-top)) 20px 4px;
}

.user-card {
  display: flex; align-items: center; gap: 16px;
  width: 100%; text-align: left; color: inherit;
  background: var(--surface);
  border: 1px solid var(--outline); border-radius: 18px;
  padding: 16px 18px;
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .03);
}
.user-card:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, .06);
  transform: translateY(-1px);
}
.user-card:active {
  transform: scale(0.99);
}
.user-avatar {
  width: 60px; height: 60px; border-radius: 50%; flex-shrink: 0;
  background: var(--surface-variant);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 24px;
  color: var(--on-surface-variant);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1.5px var(--outline);
}
.user-name { font-weight: 600; font-size: 17px; line-height: 1.3; }
.user-sub { font-size: 12px; color: var(--on-surface-variant); margin-top: 3px; }
.user-badge-row { display: flex; align-items: center; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
/* 自我设定摘要行（未设定时为引导文案，用主色暗示可点） */
.user-persona {
  font-size: 12px; color: var(--on-surface-variant); margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-persona.empty { color: var(--primary); opacity: .75; }
.user-chevron { margin-left: auto; color: var(--on-surface-variant); display: flex; align-items: center; }

/* 仪表盘分组小标题 */
.profile-section-title {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; font-weight: 600; color: var(--on-surface-variant);
  letter-spacing: .5px; margin: 20px 4px 8px;
}
.profile-section-title:first-child { margin-top: 4px; }

/* 数据总览 Bento 格子 */
.bento-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.bento-cell {
  background: var(--surface);
  border: 1px solid var(--outline); border-radius: 16px;
  padding: 13px 8px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.bento-cell:hover {
  box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
  transform: translateY(-1px);
}
.bento-num {
  font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--on-bg);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bento-lab {
  font-size: 11px; color: var(--on-surface-variant); font-weight: 500;
}

/* LLM 算力消耗精细视窗 */
.llm-insight-card {
  background: var(--surface);
  border: 1px solid var(--outline); border-radius: 16px;
  overflow: hidden;
}
.llm-insight-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px;
  background: var(--surface-variant); border-bottom: 1px solid var(--outline);
  font-size: 12px; font-weight: 500; color: var(--on-surface-variant);
}
.llm-insight-hero-num {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--primary);
}
.llm-insight-body {
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 13px 6px; gap: 12px 4px;
}
.llm-insight-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center;
}
.llm-insight-num {
  font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: var(--on-bg);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.llm-insight-lab { font-size: 11px; color: var(--on-surface-variant); }

/* 通用功能收纳一体化分组卡片 */
.profile-menu-card {
  background: var(--surface);
  border: 1px solid var(--outline); border-radius: 16px;
  overflow: hidden;
}
.profile-menu-item {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left; color: inherit;
  background: transparent; border: none;
  padding: 14px 16px; cursor: pointer;
  transition: background .15s ease;
}
.profile-menu-item + .profile-menu-item { border-top: 1px solid var(--outline); }
.profile-menu-item:hover { background: var(--surface-variant); }
.profile-menu-item:active { background: var(--surface-variant); opacity: .85; }
.profile-menu-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--surface-variant); color: var(--on-surface-variant);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.profile-menu-main { flex: 1; min-width: 0; }
.profile-menu-title { font-size: 14px; font-weight: 500; color: var(--on-bg); }
.profile-menu-sub {
  font-size: 11px; color: var(--on-surface-variant); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.profile-menu-extra { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.profile-menu-pill {
  font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 8px;
  background: var(--surface-variant); color: var(--primary); border: 1px solid var(--outline);
  max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.profile-menu-arrow { color: var(--on-surface-variant); display: flex; align-items: center; }

/* 开发者交流与星尘投递按钮 */
.profile-feedback-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 16px;
  background: var(--surface); border: 1px solid var(--outline); border-radius: 14px;
  font-size: 13px; font-weight: 500; color: var(--on-surface-variant);
  cursor: pointer; transition: all .15s ease;
}
.profile-feedback-btn:hover { background: var(--surface-variant); color: var(--on-bg); }

/* 底部文学寄语页脚 */
.profile-quote-foot {
  text-align: center; margin-top: 20px; padding: 0 16px 8px;
}
.profile-quote-text {
  font-size: 12px; color: var(--on-surface-variant); opacity: .7; letter-spacing: .04em;
}
.profile-quote-ver {
  font-family: var(--font-mono); font-size: 11px; color: var(--on-surface-variant); opacity: .45; margin-top: 4px;
}

/* 性别徽标：极简素雅微标签，与字标和暗色/亮色背景协调 */
.gender-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-variant);
  color: var(--on-surface-variant);
  border: 1px solid var(--outline);
  line-height: 1.4;
  letter-spacing: .02em;
  vertical-align: middle;
}

/* 个人信息编辑页：卡片式精致布局 */
.profile-avatar-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0 16px;
}
.profile-avatar-wrap {
  position: relative;
  width: 84px;
  height: 84px;
  cursor: pointer;
}
.profile-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-variant);
  color: var(--on-surface-variant);
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  border: 2px solid var(--outline);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .05);
  background-size: cover;
  background-position: center;
  transition: transform .15s ease;
}
.profile-avatar-wrap:active .profile-avatar-img {
  transform: scale(0.96);
}
.profile-avatar-badge {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--outline);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-surface-variant);
}
.profile-avatar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.profile-text-action {
  background: none;
  border: none;
  padding: 4px 6px;
  font-size: 13px;
  color: var(--primary);
  cursor: pointer;
  border-radius: 4px;
}
.profile-text-action:hover {
  text-decoration: underline;
}
.profile-text-action.danger {
  color: var(--error);
}
.profile-action-sep {
  color: var(--outline);
  font-size: 11px;
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 16px;
  overflow: hidden;
  margin-top: 8px;
}
.profile-row {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  min-height: 52px;
  gap: 12px;
}
.profile-row + .profile-row {
  border-top: 1px solid var(--outline);
}
.profile-label {
  width: 64px;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--on-surface-variant);
}
.profile-content {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}
.profile-input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  font-size: 15px;
  color: var(--on-bg);
  outline: none;
  font-family: inherit;
}
.profile-input::placeholder {
  color: var(--on-surface-variant);
  opacity: .55;
}

/* 分段选择器：iOS 灵感分段控制，无 emoji，素雅精致 */
.seg-control {
  display: inline-flex;
  background: var(--surface-variant);
  border: 1px solid var(--outline);
  border-radius: 10px;
  padding: 2.5px;
  gap: 2px;
  width: 100%;
}
.seg-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 7.5px;
  padding: 6.5px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--on-surface-variant);
  cursor: pointer;
  text-align: center;
  transition: all .15s ease;
}
.seg-btn:active {
  transform: scale(0.97);
}
.seg-btn.active {
  background: var(--surface);
  color: var(--on-bg);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.profile-hint {
  font-size: 12px;
  color: var(--on-surface-variant);
  line-height: 1.6;
  margin: 14px 4px 0;
  opacity: .8;
}
.profile-actions {
  margin-top: 28px;
}
/* 我的设定：textarea 行（label 顶对齐）与实时预览行 */
.profile-row-area {
  align-items: flex-start;
}
.profile-row-area .profile-label {
  padding-top: 3px;
}
textarea.profile-textarea {
  resize: none;
  line-height: 1.55;
  min-height: 34px;
  display: block;
}
.persona-preview {
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.stat-row {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--outline); border-radius: 14px;
  padding: 14px 0;
}
.stat-cell {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.stat-cell + .stat-cell { border-left: 1px solid var(--outline); }
.stat-num {
  font-family: var(--font-display); font-size: 17px; font-weight: 600;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 0 6px;
}
.stat-lab { font-size: 11px; color: var(--on-surface-variant); }

.feat-card {
  display: flex; align-items: center; gap: 13px;
  width: 100%; text-align: left; color: inherit;
  background: var(--surface);
  border: 1px solid var(--outline); border-radius: 14px;
  padding: 15px 16px;
}
.feat-icon {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: var(--surface-variant);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
}
.feat-main { flex: 1; min-width: 0; }
.feat-title { font-weight: 600; font-size: 15px; }
.feat-sub {
  font-size: 12px; color: var(--on-surface-variant); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.feat-arrow { color: var(--on-surface-variant); }

.ver-foot {
  text-align: center;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--on-surface-variant);
  padding: 8px 0 4px;
}

/* 设置宫格 */
.tile-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  background: var(--surface);
  border: 1px solid var(--outline); border-radius: 14px;
  padding: 20px 4px 13px;
  color: inherit; font-size: 11px;
}
.tile .t-icon { font-size: 20px; line-height: 1; }
.tile:disabled { opacity: .5; }

/* 开关行 */
.setting-main { flex: 1; min-width: 0; }
.setting-sub {
  font-size: 11px; color: var(--on-surface-variant);
  margin-top: 3px; line-height: 1.55;
}
.switch {
  position: relative; flex-shrink: 0;
  width: 46px; height: 26px; border-radius: 999px;
  background: #C9CFDA; border: none;
  transition: background .2s ease;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s ease;
}
.switch.on { background: var(--primary); }
.switch.on::after { transform: translateX(20px); }

/* ==========================================================================
   移动端适配（手机优先的触控体验）
   ========================================================================== */
@media (max-width: 767px) {
  /* 输入类 16px 起，彻底杜绝 iOS Safari 聚焦时强制放大视口导致界面错位 */
  input,
  textarea,
  select,
  .field,
  .composer textarea,
  .ta-composer textarea,
  .conn-field-input,
  .profile-input,
  .plaza-search,
  .wx-search input,
  .wx-ds-field-input,
  .wx-detail-input,
  .wx-tr-amount-input,
  .wx-tr-note-input,
  .wx-rp-amount-input,
  .wx-rp-note-input,
  .wx-mic-input {
    font-size: 16px !important;
  }

  .app-header { padding: calc(12px + env(safe-area-inset-top)) 16px 10px; }
  .page-hero { padding: calc(12px + env(safe-area-inset-top)) 16px 4px; }
  .conn-header { padding: calc(8px + env(safe-area-inset-top)) 12px 8px; }
  .app-title { font-size: 18px; }
  .app-body { padding: 14px 14px 20px; }
  .card { padding: 15px 16px; border-radius: 10px; }

  /* 触控目标放大 */
  .chip { padding: 9px 16px; font-size: 13px; }
  .btn { padding: 12px 18px; }
  .send-btn { width: 46px; height: 46px; flex-shrink: 0; }

  .composer {
    position: relative;
    bottom: auto;
    background: var(--bg);
    padding: 10px 12px max(12px, env(safe-area-inset-bottom));
  }
  body.kb-open .composer,
  body.kb-open .ta-composer {
    padding-bottom: 8px;
  }

  /* 小屏输入栏一行 5 控件太挤（水位环+token 小字+图+输入框+发送）：
     隐藏 token 小字，点击水位环弹窗照样看完整明细 */
  .composer .ctx-tokens { display: none; }

  .auth-wrap { padding: 16px; align-items: flex-start; padding-top: calc(12vh + env(safe-area-inset-top)); }
  .auth-logo { font-size: 34px; }
  .world-time { font-size: 36px; }
}

/* 横屏矮窗口：压缩头部留白（仍保留安全区以避开侧边刘海） */
@media (max-height: 520px) {
  .app-header { padding: calc(8px + env(safe-area-inset-top)) 20px 6px; }
  .page-hero { padding: calc(8px + env(safe-area-inset-top)) 20px 4px; }
  .conn-header { padding: calc(6px + env(safe-area-inset-top)) 12px 6px; }
}

/* ==========================================================================
   桌面端：把手机界面装进"手机壳"预览
   默认**不套壳**（`.phone` 就是 display: contents，手机上等于没有这层），只有**真桌面**才套：
   有鼠标、能悬停（hover/pointer 条件）——iPad 竖屏(768+) 与任何手机横屏(844+) 宽度也 ≥768px，
   但它们是指针粗糙的触屏，套上固定 390×844 的壳就成了"手机里套手机"
   （iOS 又不遵守 manifest 的 orientation: portrait，横过来必中）。
   ========================================================================== */
.phone-stage { display: contents; }
.phone { display: contents; }
.phone-caption { display: none; }

@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
  .phone-stage {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 18px;
    height: 100%;
    padding: 24px;
  }

  /* 夜色背景 + 微星点，衬托手机屏 */
  .phone-stage {
    background:
      radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,.35) 50%, transparent 51%),
      radial-gradient(1px 1px at 70% 15%, rgba(255,255,255,.25) 50%, transparent 51%),
      radial-gradient(1.5px 1.5px at 85% 60%, rgba(255,255,255,.3) 50%, transparent 51%),
      radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,.2) 50%, transparent 51%),
      radial-gradient(1.5px 1.5px at 10% 65%, rgba(255,255,255,.25) 50%, transparent 51%),
      radial-gradient(circle at 50% 45%, #10131b 0%, #090A0F 70%);
  }

  .phone {
    display: block;
    width: 390px;
    height: min(844px, calc(100dvh - 110px));
    min-height: 560px;
    background: var(--bg);
    color: var(--on-bg);
    border-radius: 44px;
    box-shadow:
      0 0 0 10px #14161d,
      0 0 0 11px rgba(255,255,255,.08),
      0 34px 90px rgba(0,0,0,.6);
    overflow: hidden;
    position: relative;
  }
  @supports not (height: 100dvh) {
    .phone { height: min(844px, calc(100vh - 110px)); }
  }

  /* 听筒已删：假听筒在全屏模式（display:contents）会挣脱壳框悬浮在页面顶部，
     像一块突兀的「灵动岛」；真手机有自己的刘海/挖孔，模拟件没有意义 */
  .phone > *:first-child { padding-top: 0; }

  /* 壳内布局回到固定高度，不再吃视口单位 */
  .phone .app-shell,
  .phone .auth-wrap { height: 100%; max-width: none; }
  .phone .app-shell { padding-top: 0; } /* 2026-09-11 去掉顶部 34px 呼吸空间：
     它在手机壳顶部留一条纯白空带（所有页都有、随滚不动，被当成 bug），
     原听筒已删，这块让位区不再需要；壳圆角 + overflow:hidden 会自然收住 hero 顶角 */

  .phone-caption {
    font-family: var(--font-display);
    color: rgba(240, 239, 234, .75);
    font-size: 13px; letter-spacing: .08em;
    text-align: center; line-height: 1.9;
  }
  .phone-caption .mono-label { color: rgba(93, 184, 166, .8); margin-right: 8px; }

  /* Ta 全屏：手机壳整个让位（平板/折叠屏等宽屏设备进 Ta 时也满屏） */
  body.ta-fullscreen .phone,
  body.ta-fullscreen .phone-stage { display: contents; }
  body.ta-fullscreen .phone-caption { display: none; }
  body.ta-fullscreen .app-shell { padding-top: 0; }
}

/* PWA「添加到主屏幕」：无论屏幕多宽一律满屏，绝不套手机壳。
   这条是给 iPad / 横屏手机准备的兜底——它们是触屏但带上鼠标（妙控键盘/台前调度）时
   可能报 hover:hover，指针条件就兜不住了；而"从主屏幕打开"本来就是 App 形态，不该有壳。 */
@media (display-mode: standalone) {
  .phone, .phone-stage { display: contents !important; }
  .phone-caption { display: none !important; }
}

/* ==========================================================================
   梦茧 · Dream Cocoon（用户×角色三层记忆）
   ========================================================================== */
.cocoon-hero {
  background: linear-gradient(160deg, var(--surface-variant), var(--surface));
  border: 1px solid var(--outline);
  border-radius: 14px;
  padding: 20px 18px;
  position: relative;
}
/* 相遇 hero 卡右上角 · 每日小记入口（21 点档） */
.hall-daily-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--outline);
  background: var(--surface);
  font-size: 12px;
  line-height: 1.4;
  color: var(--on-surface);
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  -webkit-tap-highlight-color: transparent;
}
.hall-daily-btn:active { transform: scale(0.94); }
.hall-daily-btn-t { font-size: 12px; }
.hall-daily-btn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #E8406E;
}

/* 每日小记半屏（dailies.js，新旧大厅共用，样式只放这里一份） */
.dailies-overlay {
  position: fixed;
  inset: 0;
  background: rgba(38, 34, 42, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 90;
}
.dailies-sheet {
  width: 100%;
  max-width: 560px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: #FBF7EF;
  border-radius: 18px 18px 0 0;
  overflow: hidden;
}
.dailies-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 16px 10px 16px;
  border-bottom: 1px solid #EBDFC9;
}
.dailies-title { font-size: 16px; font-weight: 700; color: #26222A; }
.dailies-sub { font-size: 11px; color: #8A7B6E; margin-top: 2px; }
.dailies-close { flex-shrink: 0; }
.dailies-body { overflow-y: auto; padding: 12px 14px 20px 14px; -webkit-overflow-scrolling: touch; }
.dailies-loading, .dailies-empty {
  padding: 22px 6px;
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
  color: #8A7B6E;
}
.dailies-list { display: flex; flex-direction: column; gap: 8px; }
.dailies-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #EBDFC9;
  border-radius: 12px;
  background: #FFFDF8;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.dailies-row:active { transform: scale(0.985); }
.dailies-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: #E8DCCB;
  flex-shrink: 0;
}
.dailies-avatar-ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #8A7B6E;
}
.dailies-row-name { flex: 1; font-size: 14px; font-weight: 600; color: #26222A; }
.dailies-badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.dailies-badge.on { background: #E7F6E9; color: #2E7D43; }
.dailies-badge.wait { background: #FFF3DC; color: #9A6B1F; }
.dailies-badge.mute { background: #F1EDE6; color: #9A938A; }
.dailies-back { align-self: flex-start; margin-bottom: 8px; }
.dailies-detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.dailies-detail-name { font-size: 16px; font-weight: 700; color: #26222A; }
.dailies-sec { margin-top: 12px; }
.dailies-sec-title { font-size: 12px; letter-spacing: 2px; color: #9A6B1F; margin-bottom: 8px; }
.dailies-card {
  border: 1px solid #EBDFC9;
  border-radius: 12px;
  background: #FFFDF8;
  padding: 12px 13px;
  margin-bottom: 10px;
}
.dailies-card-date { font-size: 11px; color: #9A938A; }
.dailies-card-title { font-size: 15px; font-weight: 700; color: #26222A; margin: 2px 0 6px 0; }
.dailies-card-body { font-size: 13.5px; line-height: 1.75; color: #3D3742; }
.dailies-card-quote { margin-top: 8px; font-size: 12.5px; line-height: 1.6; color: #7D5A2E; }
.dailies-jump { margin-top: 4px; width: 100%; }
.dailies-lock {
  border: 1px dashed #D8BE8E;
  border-radius: 12px;
  background: #FFF9EE;
  padding: 14px 13px;
  text-align: center;
}
.dailies-lock-title { font-size: 14px; font-weight: 700; color: #26222A; }
.dailies-lock-sub { font-size: 12px; line-height: 1.7; color: #8A7B6E; margin: 6px 0 10px 0; }
.dailies-invite-btn { width: 100%; }
.cocoon-hero-title {
  display: flex; align-items: baseline;
  font-family: var(--font-display);
  font-size: 24px; font-weight: 600; letter-spacing: .06em;
}
.cocoon-hero-sub {
  margin-top: 8px;
  font-size: 13px; line-height: 1.8;
  color: var(--on-surface-variant);
}
.layer-legend {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin-top: 14px;
  font-size: 11.5px; color: var(--on-surface);
}
.layer-legend .legend-item b { margin-right: 4px; }
.layer-legend .legend-item { opacity: .85; }

.bond-card { border-left: 3px solid var(--primary); }
.bond-text {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 15px; line-height: 1.9;
  color: var(--on-bg);
}
.chapter-row .chapter-summary {
  margin-top: 8px;
  font-size: 13px; line-height: 1.8;
  color: var(--on-surface-variant);
}
.atom-row { padding: 11px 14px; font-size: 13.5px; line-height: 1.7; }

.weave-btn { color: var(--primary); border-color: var(--primary); }
.weave-status {
  font-size: 12px; line-height: 1.6;
  color: var(--on-surface-variant);
  min-height: 16px;
}
.weave-status.ok { color: var(--tertiary); }
.weave-status.error { color: var(--error); }

/* ---------- 聊天图片（附件选择 + 消息气泡渲染）---------- */
.attach-btn {
  flex-shrink: 0; align-self: center;
  width: 38px; height: 38px; border: none; border-radius: 50%;
  background: transparent; color: var(--on-surface-variant);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.attach-btn:hover { background: var(--surface); }
.attach-btn:disabled { opacity: .5; cursor: default; }

/* ---------- 按住说话（语音输入）---------- */
/* touch-action:user-select 全压掉：长按默认会弹系统选择菜单并触发页面滚动，录音会中途断 */
.voice-btn {
  flex-shrink: 0; align-self: center;
  width: 38px; height: 38px; border: none; border-radius: 50%;
  background: transparent; color: var(--on-surface-variant);
  font-size: 18px; line-height: 1; cursor: pointer;
  touch-action: none; -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  font-variant-numeric: tabular-nums;
  transition: background .15s, color .15s, transform .12s;
}
.voice-btn:hover { background: var(--surface); }
.voice-btn.is-rec {
  background: var(--error); color: #fff; font-size: 13px; font-weight: 600;
  animation: voice-pulse 1.1s ease-in-out infinite;
}
/* 手指滑出按钮 = 取消：先变灰给反馈，不直接停，滑回来还能继续录 */
.voice-btn.is-cancel { filter: grayscale(1); transform: scale(.92); }
.voice-btn.is-busy { opacity: .55; cursor: progress; }
@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(179, 86, 62, .45); }
  50% { box-shadow: 0 0 0 7px rgba(179, 86, 62, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .voice-btn.is-rec { animation: none; }
}
.img-preview {
  position: absolute; bottom: calc(100% + 8px); left: 12px;
  display: flex; align-items: flex-end; gap: 6px; z-index: 5;
}
.img-thumb {
  max-width: 120px; max-height: 120px; border-radius: 10px;
  border: 1px solid var(--outline); box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.img-remove {
  width: 22px; height: 22px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.65); color: #fff;
  font-size: 14px; line-height: 1; cursor: pointer;
}
.msg-img {
  display: block; max-width: min(260px, 72%);
  border-radius: 12px; margin: 2px 0; cursor: zoom-in;
  border: 1px solid var(--outline);
}
.msg-group.user .msg-img { margin-left: auto; }

/* ---------- Ta 悬浮圆（仅角色页，可拖动） ---------- */
.ta-fab {
  position: fixed;
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 22px; font-weight: 600;
  color: #fff;
  background: radial-gradient(120% 120% at 30% 20%, #ffcfb0 0%, #e8a090 18%, #c97a6a 42%, #8a4a5a 100%);
  border: 1.5px solid rgba(255,255,255,.9);
  box-shadow: 0 8px 22px rgba(80,40,40,.32), 0 2px 8px rgba(0,0,0,.18);
  cursor: grab; user-select: none; touch-action: none;
  z-index: 45;
  transition: box-shadow .18s ease, transform .12s ease;
}
.ta-fab:active { cursor: grabbing; }
.ta-fab.dragging { transition: none; box-shadow: 0 12px 28px rgba(80,40,40,.38); }
.ta-fab.male { background: radial-gradient(120% 120% at 30% 20%, #cfe8ff 0%, #a8c8f0 20%, #6b8ec0 50%, #3a5a8a 100%); }
.ta-fab.female { background: radial-gradient(120% 120% at 30% 20%, #ffd6e8 0%, #f0a8c8 20%, #c97a9a 50%, #8a4a6a 100%); }
.ta-fab.neutral { background: radial-gradient(120% 120% at 30% 20%, #e8e0f0 0%, #d4c8e8 18%, #b8a8d0 42%, #8a7aa8 100%); }
/* 微信悬浮球：微信绿 + 白色双气泡图标（对齐微信入口样式） */
.ta-fab.wechat {
  background: #07C160;
  border-color: rgba(255, 255, 255, .95);
  box-shadow: 0 8px 22px rgba(7, 193, 96, .35), 0 2px 8px rgba(0, 0, 0, .18);
  font-size: 0; /* 隐藏文字占位（图标用 SVG） */
  color: #fff;
}
.ta-fab.wechat svg { width: 34px; height: 34px; display: block; }
.ta-fab.wechat .ta-fab-dot { background: #fff; top: 8px; right: 12px; }
.ta-fab.wechat.dragging { box-shadow: 0 12px 28px rgba(7, 193, 96, .42); }
/* 桌面手机壳内：悬浮球改相对手机壳绝对定位，避免 fixed 相对视口飞到壳外右下角 */
.phone .ta-fab { position: absolute; }
.ta-fab-label { font-size: 11px; letter-spacing: .12em; opacity: .92; margin-top: 2px; }
.ta-fab-dot { width: 6px; height: 6px; border-radius: 50%; background: #fff; opacity: .9; position: absolute; top: 10px; right: 14px; box-shadow: 0 0 8px rgba(255,255,255,.9); }
.ta-fab.male .ta-fab-dot { background: #7ec8ff; }
.ta-fab.female .ta-fab-dot { background: #ff8ec0; }

.ta-gender-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.ta-gender-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 10px 14px; border-radius: 14px;
  background: var(--surface); border: 1.5px solid var(--outline);
  cursor: pointer; transition: border-color .15s, background .15s, transform .12s;
}
.ta-gender-btn.active { border-color: var(--primary); background: var(--surface-variant); box-shadow: inset 0 0 0 1px var(--primary); }
.ta-gender-btn:active { transform: scale(.97); }
.ta-gender-icon { font-size: 28px; line-height: 1; }
.ta-gender-label { font-family: var(--font-display); font-weight: 600; font-size: 14px; }
.ta-gender-sub { font-size: 11px; color: var(--on-surface-variant); }
@media (prefers-reduced-motion: reduce) { .ta-fab { transition: none; } }

/* ---------- Ta 微信式单会话（沉浸全屏，对齐微信官方 WeUI 设计令牌） ---------- */
.app-shell.ta-mode .app-nav,
.app-shell.ta-mode .app-header { display: none; }
/* Ta 沉浸态：壳内背景与聊天区对齐，避免顶部听筒让位区（padding-top 34px）透出页面底色形成"白边"；
   同时切断 overscroll 链（滚动到消息顶/底不再回弹出底色） */
.app-shell.ta-mode { background: #EDEDED; }
.app-shell.ta-mode .app-body { padding: 0; overflow: hidden; min-height: 0; }
@media (prefers-color-scheme: dark) {
  .app-shell.ta-mode { background: #111111; }
}
.ta-wechat {
  position: relative;
  display: flex; flex-direction: column; height: 100%; min-height: 0;
  background: var(--wx-bg);
}
@media (prefers-color-scheme: dark) {
  .ta-wechat { background: #111111; }
}
/* ---------- 梦信配色令牌（微信式）：深色模式由「我 → 深色模式」独立控制 ----------
   data-wx-theme=dark/light 显式设置；auto（无标记）走系统 prefers-color-scheme。
   与半梦主题（data-theme）互不影响。
   令牌同时挂 body：action sheet / 搜索弹层等挂在 document.body 的面板不在
   .ta-wechat 子树内，只在容器上定义会令 var() 全部失效（面板透明裸文本）。 */
.ta-wechat,
body {
  --wx-bg: #EDEDED; --wx-page: #FFFFFF; --wx-bar: #F7F7F7; --wx-bar-alpha: rgba(247, 247, 247, 0.94);
  --wx-cell: #FFFFFF; --wx-text: #191919; --wx-text2: #999999; --wx-text3: #B2B2B2;
  --wx-sep: rgba(0, 0, 0, 0.06); --wx-press: #E5E5E5; --wx-avatar-ph: #C8C8CC;
  --wx-bubble-ta: #FFFFFF; --wx-bubble-user: #95EC69; --wx-bubble-user-text: rgba(0, 0, 0, 0.9);
  --wx-link: #576B95; color-scheme: light;
}
html[data-wx-theme='dark'] .ta-wechat,
html[data-wx-theme='dark'] body {
  --wx-bg: #111111; --wx-page: #111111; --wx-bar: #1E1E1E; --wx-bar-alpha: rgba(30, 30, 30, 0.94);
  --wx-cell: #1E1E1E; --wx-text: rgba(255, 255, 255, 0.92); --wx-text2: #8D8D8D; --wx-text3: #6E6E6E;
  --wx-sep: rgba(255, 255, 255, 0.08); --wx-press: rgba(255, 255, 255, 0.08); --wx-avatar-ph: #3A3A3A;
  --wx-bubble-ta: #2C2C2C; --wx-bubble-user: #3EB575; --wx-bubble-user-text: rgba(255, 255, 255, 0.95);
  --wx-link: #7D90B5; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  html:not([data-wx-theme='light']) .ta-wechat,
  html:not([data-wx-theme='light']) body {
    --wx-bg: #111111; --wx-page: #111111; --wx-bar: #1E1E1E; --wx-bar-alpha: rgba(30, 30, 30, 0.94);
    --wx-cell: #1E1E1E; --wx-text: rgba(255, 255, 255, 0.92); --wx-text2: #8D8D8D; --wx-text3: #6E6E6E;
    --wx-sep: rgba(255, 255, 255, 0.08); --wx-press: rgba(255, 255, 255, 0.08); --wx-avatar-ph: #3A3A3A;
    --wx-bubble-ta: #2C2C2C; --wx-bubble-user: #3EB575; --wx-bubble-user-text: rgba(255, 255, 255, 0.95);
    --wx-link: #7D90B5; color-scheme: dark;
  }
}
/* 壳底色跟随 wx 主题（overscroll 透出时不穿帮） */
html[data-wx-theme='dark'] .app-shell.ta-mode { background: #111111; }
html[data-wx-theme='light'] .app-shell.ta-mode { background: #EDEDED; }
/* 梦信顶栏/时间胶囊/头像底：跟随 wx 主题 */
.wx-light .ta-wechat-header {
  background: var(--wx-bar-alpha); border-bottom-color: var(--wx-sep);
}
.wx-light .ta-wechat-header .ta-wx-name,
.wx-light .ta-wechat-header .ta-wx-back,
.wx-light .ta-wechat-header .ta-wx-more { color: var(--wx-text); }
.wx-light .ta-time { color: var(--wx-text3); }
.wx-light .ta-avatar { background-color: var(--wx-avatar-ph); }
.ta-wechat-header {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; gap: 0;
  /* 顶部安全区：min-height 吸收 env，内容下移至安全区下方；桌面 env 为 0 保持 50px */
  min-height: calc(50px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 8px 0;
  /* 微信导航栏材质（WeUI MATERIAL_NAVIGATIONBAR）：半透明 + 毛玻璃，消息从其下滚过 */
  background: rgba(237, 237, 237, 0.94);
  -webkit-backdrop-filter: blur(20px) saturate(1.8); backdrop-filter: blur(20px) saturate(1.8);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
@media (prefers-color-scheme: dark) {
  .ta-wechat-header { background: rgba(18, 18, 18, 0.9); border-color: rgba(255, 255, 255, 0.15); }
}
/* 微信聊天页顶栏只有居中标题（无头像/副标题）：两侧按钮各 44px，flex:1 标题几何居中 */
.ta-wechat-header .ta-wx-name {
  flex: 1; min-width: 0; text-align: center;
  font-weight: 600; font-size: 17px; line-height: 1.2;
  color: rgba(0, 0, 0, 0.9);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: pointer;
}
@media (prefers-color-scheme: dark) {
  .ta-wechat-header .ta-wx-name { color: rgba(255, 255, 255, 0.8); }
}
/* 微信聊天页右上角「⋯」与左上角返回键：44px 触区、图标居中 */
.ta-wechat-header .ta-wx-more,
.ta-wechat-header .ta-wx-back {
  width: 44px; height: 44px; margin: 0 -6px; border-radius: 8px;
  border: none; background: transparent;
  display: flex; align-items: center; justify-content: center; color: #1F2329;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.ta-wechat-header .ta-wx-more:active,
.ta-wechat-header .ta-wx-back:active { background: rgba(0,0,0,.06); }
@media (prefers-color-scheme: dark) {
  .ta-wechat-header .ta-wx-more,
  .ta-wechat-header .ta-wx-back { color: rgba(255, 255, 255, 0.8); }
  .ta-wechat-header .ta-wx-more:active,
  .ta-wechat-header .ta-wx-back:active { background: rgba(255,255,255,.08); }
}
.ta-thread {
  flex: 1; min-height: 0; overflow-y: auto;
  /* 顶栏改为覆盖式毛玻璃：滚动区从其下穿过，这里补出内容起始位 */
  padding: calc(58px + env(safe-area-inset-top)) 12px 20px;
  background: #EDEDED; background-size: cover; background-position: center;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; /* 滚到顶/底不回弹外层，消除"滑滑的"橡皮筋感 */
}
@media (prefers-color-scheme: dark) {
  .ta-thread { background: #111111; }
}
.ta-thread.has-bg { background-color: #EDEDED; }
/* 微信式消息时间胶囊：居中灰字（无边框，微信原生样式，FG-2 令牌） */
.ta-time {
  text-align: center; font-size: 11px; color: rgba(0, 0, 0, 0.3); line-height: 1.4;
  margin: 16px auto 8px; max-width: 80%;
  white-space: pre-wrap; word-break: break-word;
}
@media (prefers-color-scheme: dark) {
  .ta-time { color: rgba(255, 255, 255, 0.3); }
}
/* 旁白/系统条：微信系统消息同款——去斜体，小号灰字 */
.ta-system {
  text-align: center; font-size: 12px; color: rgba(0, 0, 0, 0.3); margin: 12px auto 6px;
  line-height: 1.6; max-width: 80%; letter-spacing: .01em;
}
@media (prefers-color-scheme: dark) {
  .ta-system { color: rgba(255, 255, 255, 0.3); }
}
/* 消息行：换方间距 16px，同方连续（.cont）收紧到 4px——微信分组节奏 */
.ta-msg { display: flex; gap: 8px; margin: 16px 0 0; width: 100%; align-items: flex-start; }
.ta-msg.cont { margin-top: 4px; }
/* 用户消息：row-reverse 主轴起点在视觉右侧，flex-start 才能把头像贴右缘（flex-end 会推到左边） */
.ta-msg.user { justify-content: flex-start; flex-direction: row-reverse; }
.ta-msg.ta { justify-content: flex-start; }
.ta-msg .ta-bubble .msg-img {
  max-height: 320px; /* 超长截图限高，避免撑爆气泡 */
}
.ta-msg .ta-bubble {
  position: relative; max-width: 68%; min-width: 0;
  padding: 9px 12px; border-radius: 5px; font-size: 17px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
  /* 禁长按选择/系统菜单：长按已让位给微信式胶囊菜单 */
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
.ta-msg.user .ta-bubble { background: #95EC69; color: rgba(0, 0, 0, 0.9); border-radius: 5px 2px 5px 5px; margin-left: 12px; }
.ta-msg.user .ta-bubble::after {
  content: ""; position: absolute; right: -5px; top: 13px; width: 0; height: 0;
  border: 5px solid transparent; border-left-color: #95EC69; border-right: none;
}
.ta-msg.ta .ta-bubble { background: #FFFFFF; color: rgba(0, 0, 0, 0.9); border-radius: 2px 5px 5px 5px; margin-right: 12px; }
/* 表情包气泡：透明背景，图片居中（Ta 和用户共用；提高特异性压过明暗气泡底色） */
.ta-msg.user .ta-bubble.ta-sticker,
.ta-msg.ta .ta-bubble.ta-sticker { background: transparent; padding: 4px; text-align: center; }
.ta-msg .ta-bubble.ta-sticker .ta-sticker-img { width: 64px; height: 64px; display: block; margin: 0 auto; object-fit: contain; }
.ta-msg.ta .ta-bubble::after {
  content: ""; position: absolute; left: -5px; top: 13px; width: 0; height: 0;
  border: 5px solid transparent; border-right-color: #FFFFFF; border-left: none;
}
/* 表情包气泡去掉小尾巴箭头（透明背景不需要） */
.ta-msg .ta-bubble.ta-sticker::after { display: none; }
@media (prefers-color-scheme: dark) {
  .ta-msg.user .ta-bubble { background: #3EB575; color: rgba(0, 0, 0, 0.9); }
  .ta-msg.user .ta-bubble::after { border-left-color: #3EB575; }
  .ta-msg.ta .ta-bubble { background: #2C2C2C; color: rgba(255, 255, 255, 0.8); }
  .ta-msg.ta .ta-bubble::after { border-right-color: #2C2C2C; }
}
/* 新消息到达：整条淡入（微信式），替代逐字流式 */
.ta-msg.arrive { animation: ta-bubble-in .18s ease-out; }
@keyframes ta-bubble-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .ta-msg.arrive { animation: none; }
}
/* 对方正在输入：三点跳动（替代静态文字） */
.ta-bubble.ta-typing {
  display: flex; align-items: center; justify-content: center;
  gap: 5px; min-width: 44px; min-height: 20px; padding: 11px 14px;
}
.ta-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #C9C9C9;
  animation: ta-typing-bounce 1.2s ease-in-out infinite;
}
.ta-typing span:nth-child(2) { animation-delay: .15s; }
.ta-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes ta-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30% { transform: translateY(-4px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .ta-typing span { animation: none; opacity: .6; }
}
/* 头像：微信 40px 方形 5px 圆角 */
.ta-msg .ta-avatar {
  width: 40px; height: 40px; border-radius: 5px; flex-shrink: 0; margin-top: 0;
  background-size: cover; background-position: center top; background-color: #D9D9D9;
  border: none; display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.ta-msg .ta-avatar svg { width: 100%; height: 100%; display: block; }
.ta-msg.user .ta-avatar { background-color: #07C160; }
.ta-msg.ta .ta-avatar { background-color: #C9B99A; }
/* 输入区：微信布局——白底圆角输入框 + ＋号 + 内容出现时绿色「发送」 */
/* 待发送图片预览：在 Ta 页内随文档流显示在输入区上方（微信同款位置） */
.ta-wechat > .img-preview { position: static; padding: 6px 12px 0; background: transparent; }
.ta-composer {
  position: relative;
  display: flex; gap: 6px; align-items: flex-end; padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  background: #F7F7F7; border-top: 1px solid rgba(0, 0, 0, 0.1); flex-shrink: 0;
}
@media (prefers-color-scheme: dark) {
  .ta-composer { background: rgba(35, 35, 35, 0.93); border-color: rgba(255, 255, 255, 0.15); }
}
.ta-composer textarea {
  flex: 1; min-height: 38px; max-height: 110px; padding: 8px 10px;
  border: none; border-radius: 6px; background: #fff;
  font-size: 16px; line-height: 1.4; resize: none; outline: none;
  font-family: inherit; color: rgba(0, 0, 0, 0.9);
}
.ta-composer textarea::placeholder { color: rgba(0, 0, 0, 0.3); }
@media (prefers-color-scheme: dark) {
  .ta-composer textarea { background: #2C2C2C; color: rgba(255, 255, 255, 0.8); }
  .ta-composer textarea::placeholder { color: rgba(255, 255, 255, 0.3); }
}
.ta-composer .ta-wx-plus {
  width: 38px; height: 38px; border-radius: 6px; background: transparent; border: none; color: #1F2329;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ta-composer .ta-wx-plus:active { background: rgba(0,0,0,.06); }
.ta-composer .ta-wx-emoji {
  width: 38px; height: 38px; border-radius: 6px; background: transparent; border: none; color: #1F2329;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center; cursor: pointer;
  font-size: 22px; line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.ta-composer .ta-wx-emoji:active { background: rgba(0,0,0,.06); }
/* 梦信 / Ta 悬浮球里的「按住说话」：贴齐微信式按钮尺寸（聊天页那套是 38px 圆底） */
.ta-composer .voice-btn.ta-wx-voice {
  width: 38px; height: 38px; border-radius: 6px; background: transparent; border: none; color: #1F2329;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center; cursor: pointer;
  font-size: 21px; line-height: 1; -webkit-tap-highlight-color: transparent;
}
.ta-composer .voice-btn.ta-wx-voice:active { background: rgba(0,0,0,.06); }
.ta-composer .voice-btn.ta-wx-voice.is-rec {
  background: var(--error); color: #fff; font-size: 13px; font-weight: 600; border-radius: 6px;
}
@media (prefers-color-scheme: dark) {
  .ta-composer .ta-wx-plus { color: rgba(255, 255, 255, 0.8); }
  .ta-composer .ta-wx-plus:active { background: rgba(255,255,255,.08); }
  .ta-composer .ta-wx-emoji { color: rgba(255, 255, 255, 0.8); }
  .ta-composer .ta-wx-emoji:active { background: rgba(255,255,255,.08); }
}
/* 绿色「发送」/红色「停止」按钮（微信发送键样式） */
.ta-composer .ta-wx-send {
  height: 34px; padding: 0 14px; border-radius: 5px; background: #07C160; color: #fff;
  border: none; font-size: 14px; font-weight: 500; font-family: inherit;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center; cursor: pointer;
  -webkit-tap-highlight-color: transparent; margin-bottom: 2px;
}
.ta-composer .ta-wx-send:active { background: #06AD56; }
.ta-composer .ta-wx-send.is-stop { background: #FA5151; }
.ta-composer .ta-wx-send.is-stop:active { background: #E04848; }
/* ＋号面板：微信安卓版底部九宫格（只放真实功能），＋号键弹出 */
.ta-plus-mask { position: fixed; inset: 0; z-index: 29; background: transparent; }
.ta-plus-panel {
  position: absolute; left: 0; right: 0; bottom: 100%; z-index: 30;
  background: #F7F7F7; border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding: 18px 14px calc(16px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; max-width: 280px;
  margin: 0 auto;
  animation: ta-sheet-in .18s ease-out;
}
@keyframes ta-sheet-in {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .ta-plus-panel { animation: none; }
}
@media (prefers-color-scheme: dark) {
  .ta-plus-panel { background: #1E1E1E; border-color: rgba(255, 255, 255, 0.1); }
}
.ta-plus-item {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  border: none; background: transparent; cursor: pointer; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.ta-plus-item .ta-plus-ico {
  width: 60px; height: 60px; border-radius: 12px; background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  display: flex; align-items: center; justify-content: center; color: #1F2329;
}
@media (prefers-color-scheme: dark) {
  .ta-plus-item .ta-plus-ico { background: #2C2C2C; border-color: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.8); }
}
.ta-plus-item:active .ta-plus-ico { background: #E5E5E5; }
@media (prefers-color-scheme: dark) {
  .ta-plus-item:active .ta-plus-ico { background: #404040; }
}
.ta-plus-item .ta-plus-txt { font-size: 12px; color: rgba(0, 0, 0, 0.55); font-family: inherit; margin-top: 2px; }
@media (prefers-color-scheme: dark) {
  .ta-plus-item .ta-plus-txt { color: rgba(255, 255, 255, 0.5); }
}
/* 表情面板：微信式底部网格，遮罩 + 弹层 */
.ta-sticker-mask { position: fixed; inset: 0; z-index: 29; background: transparent; }
.ta-sticker-panel {
  position: absolute; left: 0; right: 0; bottom: 100%; z-index: 30;
  background: #F7F7F7; border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding: 16px 12px calc(14px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; max-width: 340px;
  margin: 0 auto;
  /* 贴纸多（100+）：面板限高内部滚动，不再把输入条顶出屏幕 */
  max-height: min(45vh, 320px); overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  animation: ta-sheet-in .18s ease-out;
}
.ta-sticker-item {
  width: 100%; aspect-ratio: 1; padding: 0; border: none; background: transparent;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  border-radius: 8px; -webkit-tap-highlight-color: transparent;
}
.ta-sticker-item:active { background: rgba(0, 0, 0, 0.06); }
.ta-sticker-item img { width: 100%; height: 100%; object-fit: contain; }
@media (prefers-color-scheme: dark) {
  .ta-sticker-panel { background: #1E1E1E; border-color: rgba(255, 255, 255, 0.1); }
  .ta-sticker-item:active { background: rgba(255, 255, 255, 0.08); }
}
@media (prefers-reduced-motion: reduce) {
  .ta-sticker-panel { animation: none; }
}
/* 语音键与按住说话条（安卓微信语法） */
.ta-wx-voice {
  width: 38px; height: 38px; border-radius: 6px; background: transparent; border: none; color: #1F2329;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ta-wx-voice:active { background: rgba(0, 0, 0, 0.06); }
@media (prefers-color-scheme: dark) {
  .ta-wx-voice { color: rgba(255, 255, 255, 0.8); }
  .ta-wx-voice:active { background: rgba(255, 255, 255, 0.08); }
}
.ta-hold-bar {
  flex: 1; min-height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border-radius: 6px;
  font-size: 16px; font-weight: 500; color: rgba(0, 0, 0, 0.9);
  user-select: none; -webkit-user-select: none; touch-action: none; cursor: pointer;
  transition: background .12s ease;
}
.ta-hold-bar.holding { background: #C9C9C9; }
@media (prefers-color-scheme: dark) {
  .ta-hold-bar { background: #2C2C2C; color: rgba(255, 255, 255, 0.8); }
  .ta-hold-bar.holding { background: #404040; }
}
/* 按住说话浮层：中央黑色毛玻璃卡片（松开发送/上滑取消/识别中） */
.ta-hold-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.ta-hold-card {
  background: rgba(0, 0, 0, 0.75);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-radius: 14px; padding: 24px 28px;
  display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 210px;
}
.ta-hold-main { color: #fff; font-size: 16px; font-weight: 600; }
.ta-hold-sub { color: rgba(255, 255, 255, 0.6); font-size: 12px; min-height: 14px; }
.ta-hold-txt { color: rgba(255, 255, 255, 0.8); font-size: 13px; }
.ta-hold-card .ta-typing span { background: rgba(255, 255, 255, 0.7); }
.ta-menu {
  position: fixed; z-index: 90;
  display: flex; overflow: hidden;
  background: rgba(0, 0, 0, 0.75);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-radius: 8px;
}
.ta-menu button {
  border: none; background: transparent; cursor: pointer;
  color: #fff; font-size: 14px; font-family: inherit;
  padding: 10px 18px; display: flex; align-items: center; gap: 5px;
  -webkit-tap-highlight-color: transparent;
}
.ta-menu button + button { border-left: 1px solid rgba(255, 255, 255, 0.12); }
.ta-menu button:active { background: rgba(255, 255, 255, 0.1); }
.ta-menu-mask { position: fixed; inset: 0; z-index: 89; background: transparent; }
/* Ta 个人页：微信「个人信息」版式——#EDEDED 底 + 通栏白色分组块 + 行内右对齐值 */
.ta-profile-page {
  position: relative;
  display: flex; flex-direction: column; height: 100%; min-height: 0;
  background: #EDEDED;
}
@media (prefers-color-scheme: dark) {
  .ta-profile-page { background: #111111; }
}
.ta-profile-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: calc(58px + env(safe-area-inset-top)) 0 24px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.ta-wx-group { background: #fff; margin-top: 8px; }
@media (prefers-color-scheme: dark) {
  .ta-wx-group { background: #1E1E1E; }
}
.ta-wx-cell {
  display: flex; align-items: center; gap: 10px;
  min-height: 54px; padding: 8px 16px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ta-wx-cell + .ta-wx-cell { border-top: 1px solid rgba(0, 0, 0, 0.05); }
@media (prefers-color-scheme: dark) {
  .ta-wx-cell + .ta-wx-cell { border-color: rgba(255, 255, 255, 0.08); }
}
.ta-wx-cell:active { background: rgba(0, 0, 0, 0.04); }
@media (prefers-color-scheme: dark) {
  .ta-wx-cell:active { background: rgba(255, 255, 255, 0.06); }
}
.ta-wx-cell-label { font-size: 17px; color: rgba(0, 0, 0, 0.9); }
@media (prefers-color-scheme: dark) {
  .ta-wx-cell-label { color: rgba(255, 255, 255, 0.8); }
}
.ta-wx-cell-value {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: rgba(0, 0, 0, 0.55);
  max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (prefers-color-scheme: dark) {
  .ta-wx-cell-value { color: rgba(255, 255, 255, 0.5); }
}
.ta-wx-chev { color: rgba(0, 0, 0, 0.3); font-size: 16px; }
@media (prefers-color-scheme: dark) {
  .ta-wx-chev { color: rgba(255, 255, 255, 0.3); }
}
.ta-wx-cell.danger { justify-content: center; color: #FA5151; font-size: 17px; }
.ta-wx-avatar-cell {
  width: 56px; height: 56px; border-radius: 5px; flex-shrink: 0;
  background-size: cover; background-position: center; background-color: #D9D9D9;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.ta-wx-avatar-cell svg { width: 100%; height: 100%; display: block; }
.ta-wx-thumb {
  width: 44px; height: 30px; border-radius: 4px; flex-shrink: 0;
  background-size: cover; background-position: center; background-color: var(--surface-variant);
  display: flex; align-items: center; justify-content: center;
}

/* ---------- 微信模块·皮肤（微信 iOS 版式；颜色全部走 --wx-* 令牌，深色由 data-wx-theme 切换） ---------- */
.ta-wechat.wx-light { background: var(--wx-bg); }
.wx-light .ta-wechat-header { background: var(--wx-bar-alpha); border-bottom-color: var(--wx-sep); }
.wx-light .ta-wechat-header .ta-wx-name { color: var(--wx-text); }
.wx-light .ta-wechat-header .ta-wx-more,
.wx-light .ta-wechat-header .ta-wx-back { color: var(--wx-text); }
.wx-light .ta-wechat-header .ta-wx-more:active,
.wx-light .ta-wechat-header .ta-wx-back:active { background: var(--wx-press); }
.wx-light .ta-thread { background: var(--wx-bg); }
.wx-light .ta-time { color: var(--wx-text3); }
.wx-light .ta-system { color: var(--wx-text3); }
.wx-light .ta-composer { background: var(--wx-bar); border-top-color: var(--wx-sep); }
.wx-light .ta-composer textarea { background: var(--wx-cell); color: var(--wx-text); }
.wx-light .ta-composer textarea::placeholder { color: var(--wx-text3); }
.wx-light .ta-composer .ta-wx-plus,
.wx-light .ta-composer .ta-wx-emoji,
.wx-light .ta-wx-voice { color: var(--wx-text); }
.wx-light .ta-composer .ta-wx-plus:active,
.wx-light .ta-composer .ta-wx-emoji:active,
.wx-light .ta-wx-voice:active { background: var(--wx-sep); }
.wx-light .ta-msg.user .ta-bubble { background: var(--wx-bubble-user); color: var(--wx-bubble-user-text); }
.wx-light .ta-msg.user .ta-bubble::after { border-left-color: var(--wx-bubble-user); }
.wx-light .ta-msg.ta .ta-bubble { background: var(--wx-cell); color: var(--wx-bubble-user-text); }
.wx-light .ta-msg.ta .ta-bubble::after { border-right-color: var(--wx-bubble-ta); }
.wx-light .ta-plus-panel,
.wx-light .ta-sticker-panel { background: var(--wx-bar); border-top-color: var(--wx-sep); }
.wx-light .ta-plus-item .ta-plus-ico { background: var(--wx-cell); border-color: var(--wx-sep); color: var(--wx-text); }
.wx-light .ta-plus-item:active .ta-plus-ico { background: var(--wx-press); }
.wx-light .ta-plus-item .ta-plus-txt { color: var(--wx-text2); }
.wx-light .ta-sticker-item:active { background: var(--wx-sep); }
.wx-light .ta-hold-bar { background: var(--wx-cell); color: var(--wx-bubble-user-text); }
.wx-light .ta-hold-bar.holding { background: var(--wx-text3); }
.wx-light .ta-profile-page { background: var(--wx-bg); }
.wx-light .ta-wx-group { background: var(--wx-cell); }
.wx-light .ta-wx-cell + .ta-wx-cell { border-top-color: var(--wx-sep); }
.wx-light .ta-wx-cell:active { background: var(--wx-press); }
.wx-light .ta-wx-cell-label { color: var(--wx-bubble-user-text); }
.wx-light .ta-wx-cell-value { color: var(--wx-text2); }
.wx-light .ta-wx-chev { color: var(--wx-text3); }

/* ---------- 微信主界面·会话列表（微信 iOS 版式：搜索条 + 白色分组块） ---------- */
.wx-search-bar {
  position: absolute; top: calc(50px + env(safe-area-inset-top)); left: 0; right: 0; z-index: 9;
  padding: 7px 16px; background: var(--wx-bg);
}
.wx-search {
  display: flex; align-items: center; gap: 6px; height: 32px;
  background: var(--wx-cell); border-radius: 8px; padding: 0 10px;
}
.wx-search svg { flex-shrink: 0; color: var(--wx-text3); }
.wx-search input {
  flex: 1; min-width: 0; height: 100%;
  border: none; outline: none; background: transparent;
  font-size: 14px; color: var(--wx-text); font-family: inherit;
}
.wx-search input::placeholder { color: var(--wx-text3); }
.wx-sheet { background: var(--wx-cell); }
.wx-sheet + .wx-sheet { margin-top: 8px; }
.wx-entry-cell {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 16px; min-height: 56px; background: var(--wx-cell); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.wx-entry-cell.danger { color: #FA5151; font-size: 16px; justify-content: center; }
.wx-entry-cell:active { background: var(--wx-press); }
.wx-entry-icon {
  width: 40px; height: 40px; border-radius: 9px; flex-shrink: 0;
  background: #07C160; color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
}
.wx-entry-label { flex: 1; min-width: 0; font-size: 17px; color: var(--wx-text); }
.wx-chat-cell {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 0 16px; min-height: 64px; background: var(--wx-cell); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .18s ease;
  user-select: none; -webkit-user-select: none; /* 左滑拖拽时防止选中文本 */
}
.wx-chat-cell:active { background: var(--wx-press); }
/* 左滑动作层：行底下的置顶/取消置顶按钮 */
.wx-swipe-item { position: relative; background: var(--wx-cell); overflow: hidden; }
.wx-swipe-item + .wx-swipe-item::before {
  content: ""; position: absolute; top: 0; left: 76px; right: 0; height: 1px;
  background: var(--wx-sep); z-index: 2;
}
.wx-swipe-btn {
  position: absolute; top: 0; right: 0; bottom: 0; width: 76px;
  border: none; cursor: pointer; font-family: inherit;
  background: #C8C9CD; color: #FFFFFF; font-size: 13px; line-height: 1.4;
  padding: 0 8px;
  -webkit-tap-highlight-color: transparent;
}
.wx-swipe-btn.is-pin { background: #FA9D3B; }
.wx-avatar48 {
  width: 48px; height: 48px; border-radius: 5px; flex-shrink: 0;
  background-size: cover; background-position: center top; background-color: var(--wx-avatar-ph);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  position: relative; color: #FFFFFF; font-size: 18px;
}
.wx-avatar48 svg { width: 100%; height: 100%; display: block; }
.wx-chat-main { flex: 1; min-width: 0; }
.wx-chat-name {
  font-size: 17px; color: var(--wx-text); line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wx-chat-preview {
  font-size: 14px; color: var(--wx-text2); margin-top: 2px; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wx-chat-side {
  flex-shrink: 0; align-self: flex-start; padding-top: 16px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
}
.wx-chat-time { font-size: 12px; color: var(--wx-text3); }
.wx-badge {
  position: absolute; top: -4px; right: -6px; min-width: 17px; height: 17px;
  box-sizing: border-box; padding: 0 4px;
  background: #FA5151; color: #FFFFFF; font-size: 11px; line-height: 17px;
  border-radius: 9px; text-align: center;
}
/* 头像角标 wrapper：不裁剪（avatar48 overflow:hidden 会裁掉悬出角外的红点） */
.wx-avatar-box { position: relative; flex-shrink: 0; }
.wx-empty {
  padding: 90px 24px 0; text-align: center;
  font-size: 14px; color: var(--wx-text3); line-height: 1.9; white-space: pre-wrap;
}
.wx-friend-cell {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; min-height: 64px; background: var(--wx-cell);
  -webkit-tap-highlight-color: transparent;
}
.wx-friend-cell + .wx-friend-cell::before {
  content: ""; position: absolute; top: 0; left: 76px; right: 0; height: 1px;
  background: var(--wx-sep);
}
.wx-friend-name { font-size: 16px; color: var(--wx-text); line-height: 1.3; }
.wx-friend-status { font-size: 12px; color: var(--wx-text2); margin-top: 2px; }
.wx-btn-accept {
  flex-shrink: 0; border: none; cursor: pointer; font-family: inherit;
  background: #07C160; color: #FFFFFF; font-size: 13px;
  padding: 6px 14px; border-radius: 4px; -webkit-tap-highlight-color: transparent;
}
.wx-btn-accept:active { background: #06AD56; }
.wx-btn-accept:disabled { opacity: 0.5; cursor: default; }
.wx-btn-ghost {
  flex-shrink: 0; cursor: pointer; font-family: inherit;
  background: var(--wx-cell); color: var(--wx-link); font-size: 13px;
  padding: 5px 12px; border-radius: 4px; border: 1px solid var(--wx-sep);
  -webkit-tap-highlight-color: transparent;
}
.wx-btn-ghost:active { background: var(--wx-sep); }
.wx-btn-text {
  flex-shrink: 0; cursor: pointer; font-family: inherit;
  background: transparent; border: none; color: var(--wx-link); font-size: 13px; padding: 6px 8px;
  -webkit-tap-highlight-color: transparent;
}
.wx-btn-text.danger { color: #FA5151; }

/* ---------- 导入聊天记录（蒸馏角色 · 记忆蒸馏舱） ---------- */
.wx-ds-container {
  max-width: 580px;
  margin: 0 auto;
  padding: 0 16px 36px;
  box-sizing: border-box;
}

/* 顶部头图 / 导言区 */
.wx-ds-hero {
  margin: 12px 0 16px;
  padding: 20px 18px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(7, 193, 96, 0.08) 0%, rgba(87, 107, 149, 0.05) 100%), var(--wx-cell);
  border: 1px solid rgba(7, 193, 96, 0.16);
  position: relative;
  overflow: hidden;
}
.wx-ds-hero-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.wx-ds-hero-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #07C160 0%, #10A37F 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(7, 193, 96, 0.28);
  flex-shrink: 0;
}
.wx-ds-hero-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--wx-text);
  letter-spacing: -0.2px;
}
.wx-ds-hero-sub {
  font-size: 13px;
  line-height: 1.6;
  color: var(--wx-text2);
}
.wx-ds-privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  color: #07C160;
  background: rgba(7, 193, 96, 0.1);
}

/* 分段切换器 (Tabs) */
.wx-ds-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.04);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 16px;
  border: 1px solid var(--wx-sep);
}
.wx-dark .wx-ds-tabs {
  background: rgba(255, 255, 255, 0.05);
}
.wx-ds-tab {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  color: var(--wx-text2);
  border: none;
  background: transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.wx-ds-tab.active {
  background: var(--wx-cell);
  color: var(--wx-text);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* 文件上传拖拽区 */
.wx-ds-dropzone {
  border: 1.5px dashed var(--wx-sep);
  border-radius: 14px;
  padding: 28px 16px;
  text-align: center;
  background: var(--wx-cell);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}
.wx-ds-dropzone:hover, .wx-ds-dropzone.dragover {
  border-color: #07C160;
  background: rgba(7, 193, 96, 0.03);
}
.wx-ds-drop-icon {
  font-size: 36px;
  margin-bottom: 8px;
  display: block;
}
.wx-ds-drop-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--wx-text);
  margin-bottom: 4px;
}
.wx-ds-drop-sub {
  font-size: 12px;
  color: var(--wx-text3);
}
.wx-ds-formats {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 6px;
}
.wx-ds-format-badge {
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--wx-page);
  border: 1px solid var(--wx-sep);
  font-size: 10px;
  color: var(--wx-text2);
  font-family: monospace;
}

/* 已选文件卡片 */
.wx-ds-file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--wx-cell);
  border: 1px solid var(--wx-sep);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}
.wx-ds-file-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(7, 193, 96, 0.12);
  color: #07C160;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.wx-ds-file-meta {
  flex: 1;
  min-width: 0;
}
.wx-ds-file-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--wx-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wx-ds-file-details {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--wx-text3);
}
.wx-ds-enc-tag {
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(7, 193, 96, 0.1);
  color: #07C160;
  font-weight: 500;
}
.wx-ds-clear-btn {
  padding: 6px 10px;
  font-size: 12px;
  color: #FA5151;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s;
}
.wx-ds-clear-btn:active {
  background: rgba(250, 81, 81, 0.1);
}

/* 文本粘贴区 */
.wx-ds-text-box {
  background: var(--wx-cell);
  border: 1px solid var(--wx-sep);
  border-radius: 12px;
  padding: 12px;
  transition: border-color 0.2s;
}
.wx-ds-text-box:focus-within {
  border-color: #07C160;
}
.wx-ds-textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 120px;
  max-height: 280px;
  border: none;
  background: transparent;
  color: var(--wx-text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}
.wx-ds-textarea::placeholder {
  color: var(--wx-text3);
}
.wx-ds-text-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--wx-sep);
  font-size: 11px;
  color: var(--wx-text3);
}

/* 预检简报卡片 */
.wx-ds-preview {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(7, 193, 96, 0.05);
  border: 1px solid rgba(7, 193, 96, 0.18);
  animation: wxDsFadeIn 0.3s ease;
}
.wx-ds-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #07C160;
}
.wx-ds-preview-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.wx-ds-stat-pill {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--wx-cell);
  border: 1px solid rgba(7, 193, 96, 0.15);
  font-size: 11px;
  color: var(--wx-text);
}
.wx-ds-speaker-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--wx-text2);
}
.wx-ds-speaker-tag {
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--wx-cell);
  border: 1px solid var(--wx-sep);
  cursor: pointer;
  transition: all 0.15s;
}
.wx-ds-speaker-tag:hover {
  border-color: #07C160;
  color: #07C160;
}
.wx-ds-sample-box {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--wx-cell);
  font-size: 11px;
  line-height: 1.5;
  color: var(--wx-text2);
  border: 1px dashed var(--wx-sep);
}
.wx-ds-sample-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 表单字段 */
.wx-ds-card {
  background: var(--wx-cell);
  border-radius: 12px;
  border: 1px solid var(--wx-sep);
  padding: 16px;
  margin-top: 14px;
}
.wx-ds-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--wx-text);
  margin-bottom: 6px;
}
.wx-ds-field-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--wx-sep);
  background: var(--wx-page);
  color: var(--wx-text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.wx-ds-field-input:focus {
  border-color: #07C160;
}
.wx-ds-field-input::placeholder {
  color: var(--wx-text3);
}

/* 合规声明 */
.wx-ds-consent-card {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--wx-cell);
  border: 1px solid var(--wx-sep);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.wx-ds-consent-card input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: #07C160;
  margin-top: 2px;
  cursor: pointer;
  flex-shrink: 0;
}
.wx-ds-consent-text {
  font-size: 12px;
  line-height: 1.55;
  color: var(--wx-text2);
  user-select: none;
}

/* 状态信息与操作按钮 */
.wx-ds-error-bar {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(250, 81, 81, 0.08);
  border: 1px solid rgba(250, 81, 81, 0.2);
  color: #FA5151;
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.wx-ds-btn-submit {
  width: 100%;
  margin-top: 16px;
  padding: 13px 0;
  font-size: 16px;
  font-weight: 600;
  border-radius: 10px;
  background: #07C160;
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(7, 193, 96, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
}
.wx-ds-btn-submit:active {
  background: #06AD56;
  transform: scale(0.985);
}
.wx-ds-btn-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ---------- 导出指引按钮与弹窗 (方案 2) ---------- */
.wx-ds-guide-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: #576B95;
  background: rgba(87, 107, 149, 0.08);
  border: 1px solid rgba(87, 107, 149, 0.18);
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}
.wx-ds-guide-trigger:hover {
  background: rgba(87, 107, 149, 0.16);
  color: #3b5078;
}
.wx-dark .wx-ds-guide-trigger {
  color: #7d96c8;
  background: rgba(125, 150, 200, 0.12);
  border-color: rgba(125, 150, 200, 0.2);
}

.wx-eg-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  animation: wxDsFadeIn 0.2s ease;
}
.wx-eg-modal {
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--wx-cell);
  border-radius: 16px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  border: 1px solid var(--wx-sep);
}
.wx-eg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--wx-sep);
}
.wx-eg-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--wx-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.wx-eg-close {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--wx-text3);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.wx-eg-close:hover {
  background: var(--wx-page);
  color: var(--wx-text);
}
.wx-eg-tabs {
  display: flex;
  padding: 8px 16px;
  background: var(--wx-page);
  gap: 8px;
  border-bottom: 1px solid var(--wx-sep);
}
.wx-eg-tab-btn {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--wx-text2);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.wx-eg-tab-btn.active {
  background: var(--wx-cell);
  color: #07C160;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
.wx-eg-body {
  padding: 18px 20px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
  color: var(--wx-text);
}
.wx-eg-step-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.wx-eg-step-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #07C160;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.wx-eg-step-content {
  flex: 1;
}
.wx-eg-step-title {
  font-weight: 600;
  color: var(--wx-text);
  margin-bottom: 2px;
}
.wx-eg-step-desc {
  font-size: 12px;
  color: var(--wx-text2);
}
.wx-eg-tip-box {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(7, 193, 96, 0.08);
  border: 1px solid rgba(7, 193, 96, 0.16);
  font-size: 12px;
  color: var(--wx-text2);
  margin-top: 14px;
  line-height: 1.55;
}

/* ---------- 前置 API Key 状态指示条 (方案 3) ---------- */
.wx-ds-key-status {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  transition: all 0.2s ease;
}
.wx-ds-key-status.ready {
  background: rgba(7, 193, 96, 0.08);
  border: 1px solid rgba(7, 193, 96, 0.22);
}
.wx-ds-key-status.warning {
  background: rgba(255, 154, 0, 0.09);
  border: 1px solid rgba(255, 154, 0, 0.28);
}
.wx-ds-key-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.wx-ds-key-title {
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.wx-ds-key-status.ready .wx-ds-key-title {
  color: #07C160;
}
.wx-ds-key-status.warning .wx-ds-key-title {
  color: #E68200;
}
.wx-dark .wx-ds-key-status.warning .wx-ds-key-title {
  color: #F89C26;
}
.wx-ds-key-desc {
  color: var(--wx-text2);
  font-size: 11px;
}
.wx-ds-key-action {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}
.wx-ds-key-status.warning .wx-ds-key-action {
  background: #E68200;
  color: #fff;
}
.wx-ds-key-status.ready .wx-ds-key-action {
  background: rgba(7, 193, 96, 0.15);
  color: #07C160;
}

/* ---------- 角色认领双选器 (方案 4) ---------- */
.wx-ds-role-picker {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: var(--wx-cell);
  border: 1px solid var(--wx-sep);
}
.wx-ds-role-header {
  margin-bottom: 12px;
}
.wx-ds-role-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--wx-text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.wx-ds-role-sub {
  font-size: 11px;
  color: var(--wx-text3);
  margin-top: 2px;
}
.wx-ds-role-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 480px) {
  .wx-ds-role-cols {
    grid-template-columns: 1fr;
  }
}
.wx-ds-role-col {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--wx-page);
  border: 1px solid var(--wx-sep);
}
.wx-ds-role-label {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--wx-text);
}
.wx-ds-role-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.wx-ds-role-pill {
  padding: 3px 9px;
  font-size: 11px;
  border-radius: 12px;
  background: var(--wx-cell);
  border: 1px solid var(--wx-sep);
  color: var(--wx-text2);
  cursor: pointer;
  transition: all 0.15s;
}
.wx-ds-role-pill:hover {
  border-color: #07C160;
  color: #07C160;
}
.wx-ds-role-pill.active {
  background: #07C160;
  color: #FFFFFF;
  border-color: #07C160;
  font-weight: 600;
}

/* ---------- 隐私脱敏与机制 (方案 5) ---------- */
.wx-ds-privacy-section {
  margin-top: 14px;
}
.wx-ds-privacy-card {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--wx-cell);
  border: 1px solid var(--wx-sep);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.wx-ds-privacy-card input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: #07C160;
  margin-top: 2px;
  cursor: pointer;
  flex-shrink: 0;
}
.wx-ds-privacy-text {
  flex: 1;
}
.wx-ds-privacy-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--wx-text);
}
.wx-ds-privacy-desc {
  font-size: 11px;
  color: var(--wx-text3);
  margin-top: 2px;
  line-height: 1.45;
}
.wx-ds-privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: rgba(7, 193, 96, 0.1);
  color: #07C160;
  font-weight: 500;
}

/* 蒸馏运行中：仪表盘 Stepper */
.wx-ds-stage-panel {
  background: var(--wx-cell);
  border-radius: 16px;
  border: 1px solid var(--wx-sep);
  padding: 26px 20px;
  margin-top: 14px;
  text-align: center;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.03);
}
.wx-ds-pulse-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wx-ds-pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid #07C160;
  opacity: 0.7;
  animation: wxDsRingPulse 2s infinite ease-out;
}
.wx-ds-pulse-center {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #07C160 0%, #10A37F 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 16px rgba(7, 193, 96, 0.35);
}
.wx-ds-stage-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--wx-text);
  margin-bottom: 6px;
}
.wx-ds-stage-desc {
  font-size: 13px;
  color: var(--wx-text2);
  margin-bottom: 24px;
}
.wx-ds-stepper {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
  max-width: 380px;
  margin: 0 auto;
}
.wx-ds-step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--wx-page);
  border: 1px solid var(--wx-sep);
  transition: all 0.25s ease;
}
.wx-ds-step-item.is-done {
  border-color: rgba(7, 193, 96, 0.3);
  background: rgba(7, 193, 96, 0.05);
}
.wx-ds-step-item.is-current {
  border-color: #07C160;
  background: rgba(7, 193, 96, 0.08);
  box-shadow: 0 2px 10px rgba(7, 193, 96, 0.12);
}
.wx-ds-step-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--wx-sep);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  flex-shrink: 0;
}
.wx-ds-step-item.is-done .wx-ds-step-dot {
  background: #07C160;
}
.wx-ds-step-item.is-current .wx-ds-step-dot {
  background: #07C160;
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.25);
  animation: wxDsDotPulse 1.5s infinite;
}
.wx-ds-step-info {
  flex: 1;
}
.wx-ds-step-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--wx-text);
}
.wx-ds-step-detail {
  font-size: 11px;
  color: var(--wx-text3);
  margin-top: 2px;
}
.wx-ds-stage-tip {
  margin-top: 20px;
  font-size: 11px;
  color: var(--wx-text3);
}

/* 蒸馏成功结果卡片 */
.wx-ds-result-panel {
  background: var(--wx-cell);
  border-radius: 20px;
  border: 1px solid var(--wx-sep);
  padding: 28px 20px;
  margin-top: 14px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
  animation: wxDsFadeIn 0.4s ease;
}
.wx-ds-avatar-halo {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  margin: 0 auto 14px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #10A37F 0%, #07C160 100%);
  color: #FFFFFF;
  font-size: 32px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(7, 193, 96, 0.35);
}
.wx-ds-avatar-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #07C160;
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--wx-cell);
}
.wx-ds-result-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--wx-text);
  margin-bottom: 6px;
}
.wx-ds-result-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  color: #07C160;
  background: rgba(7, 193, 96, 0.1);
  font-weight: 500;
  margin-bottom: 16px;
}
.wx-ds-traits-wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 16px;
}
.wx-ds-trait-tag {
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--wx-page);
  border: 1px solid var(--wx-sep);
  font-size: 12px;
  color: var(--wx-text2);
}
.wx-ds-greeting-bubble {
  background: var(--wx-page);
  border: 1px solid var(--wx-sep);
  border-radius: 12px;
  padding: 14px;
  text-align: left;
  margin-bottom: 18px;
  position: relative;
}
.wx-ds-greeting-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--wx-text3);
  margin-bottom: 6px;
}
.wx-ds-greeting-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--wx-text);
  white-space: pre-wrap;
}
.wx-ds-mem-stats {
  padding: 10px;
  border-radius: 10px;
  background: rgba(7, 193, 96, 0.05);
  font-size: 12px;
  color: var(--wx-text2);
  margin-bottom: 20px;
}
.wx-ds-status-notice {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(87, 107, 149, 0.08);
  font-size: 12px;
  line-height: 1.5;
  color: var(--wx-text2);
  margin-bottom: 20px;
  text-align: left;
}
.wx-ds-result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@keyframes wxDsRingPulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 0.2; }
  100% { transform: scale(1.3); opacity: 0; }
}
@keyframes wxDsDotPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
@keyframes wxDsFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 新手引导（梦信「我」页 · 分页卡片） ---------- */
.wx-guide-card { margin: 16px; border-radius: 12px; overflow: hidden; }
.wx-guide-body { padding: 30px 24px 8px; text-align: center; }
.wx-guide-emoji { font-size: 46px; line-height: 1.15; margin-bottom: 12px; }
.wx-guide-title { font-size: 20px; font-weight: 600; color: var(--wx-text); margin-bottom: 14px; }
.wx-guide-text { font-size: 14px; line-height: 1.9; color: var(--wx-text2); text-align: left; }
.wx-guide-text > div:empty { min-height: 0.9em; }
.wx-guide-link { color: var(--wx-link); cursor: pointer; font-size: 13px; text-align: left; margin-top: 4px; }
.wx-guide-link:active { opacity: .7; }
.wx-guide-dots { display: flex; justify-content: center; gap: 7px; padding: 16px 0 4px; }
.wx-guide-dot {
  width: 7px; height: 7px; border-radius: 4px; background: var(--wx-text3);
  opacity: .45; transition: all .2s ease;
}
.wx-guide-dot.on { opacity: 1; background: #07C160; width: 20px; }
.wx-guide-btns { display: flex; gap: 12px; padding: 10px 20px calc(20px + env(safe-area-inset-bottom)); }
.wx-guide-btn {
  flex: 1; padding: 11px 0; border-radius: 8px; font-size: 15px; font-family: inherit;
  cursor: pointer; border: none; -webkit-tap-highlight-color: transparent;
}
.wx-guide-btn.primary { background: #07C160; color: #FFFFFF; }
.wx-guide-btn.primary:active { background: #06AD56; }
.wx-guide-btn.ghost {
  background: var(--wx-cell); color: var(--wx-link); border: 1px solid var(--wx-sep);
}
.wx-guide-btn.ghost:active { background: var(--wx-sep); }
.wx-guide-btn:disabled { opacity: .4; cursor: default; }

/* ---------- 转账页面（极简 · 高端 · 微信原生质感） ---------- */
.wx-transfer { background: #F0F7FF; border: 1px solid rgba(87, 107, 149, 0.18); }
.wx-tr-top { display: flex; align-items: center; gap: 8px; }
.wx-tr-icon { font-size: 22px; }
.wx-tr-note {
  font-size: 14px; color: var(--wx-text); max-width: 150px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wx-tr-sub { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--wx-sep); font-size: 12px; color: var(--wx-text2); }

.wx-tr-page {
  position: fixed; inset: 0; z-index: 140;
  background: var(--wx-bg);
  display: flex; flex-direction: column;
  color: var(--wx-text);
}
.wx-tr-page .ta-wechat-header {
  background: var(--wx-bar-alpha);
  border-bottom: 1px solid var(--wx-sep);
  color: var(--wx-text);
}
.wx-tr-page .ta-wechat-header .ta-wx-name {
  color: var(--wx-text);
  font-weight: 600;
}
.wx-tr-page .ta-wechat-header .ta-wx-back {
  color: var(--wx-text);
}

@media (min-width: 768px) {
  .wx-tr-page {
    top: calc((100dvh - min(844px, calc(100dvh - 110px))) / 2);
    bottom: auto;
    left: 50%; right: auto;
    transform: translateX(-50%);
    width: 390px;
    height: min(844px, calc(100dvh - 110px));
    min-height: 560px;
    border-radius: 44px;
    overflow: hidden;
    box-shadow:
      0 0 0 10px #14161d,
      0 0 0 11px rgba(255, 255, 255, 0.08),
      0 34px 90px rgba(0, 0, 0, 0.6);
  }
}

.wx-tr-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: calc(58px + env(safe-area-inset-top)) 20px 24px;
  overflow-y: auto;
}

/* 顶部收款人信息 */
.wx-tr-recipient {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 12px 0 22px;
  text-align: center;
}
.wx-tr-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--wx-sep);
  background: var(--wx-avatar-ph);
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.wx-tr-avatar-fallback {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--wx-cell);
  color: var(--wx-text);
  font-size: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--wx-sep);
  margin-bottom: 10px;
}
.wx-tr-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--wx-text);
}
.wx-tr-sub-hint {
  font-size: 12px;
  color: var(--wx-text3);
  margin-top: 3px;
}

/* 金额卡片 */
.wx-tr-card {
  width: 100%;
  background: var(--wx-cell);
  border-radius: 16px;
  padding: 20px 20px 16px;
  border: 1px solid var(--wx-sep);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.02);
}
.wx-tr-card-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--wx-text2);
  margin-bottom: 12px;
}
.wx-tr-amount-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.wx-tr-yen {
  font-size: 28px;
  font-weight: 600;
  color: var(--wx-text);
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
.wx-tr-amount-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-size: 38px;
  font-weight: 700;
  font-family: "JetBrains Mono", -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  color: var(--wx-text);
  background: transparent;
  line-height: 1.1;
}
.wx-tr-amount-input::placeholder {
  color: var(--wx-text3);
}
.wx-tr-divider {
  height: 1px;
  background: var(--wx-sep);
  margin: 16px 0 12px;
}
.wx-tr-note-input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--wx-text);
  background: transparent;
  padding: 4px 0;
}
.wx-tr-note-input::placeholder {
  color: var(--wx-text3);
}

/* 卡片下方说明与限额 */
.wx-tr-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px 0;
  font-size: 12px;
  color: var(--wx-text3);
}

.wx-tr-err {
  min-height: 20px;
  font-size: 12px;
  color: #FA5151;
  text-align: center;
  margin: 8px 0 4px;
}

/* 按钮 */
.wx-tr-go {
  width: 100%;
  margin-top: 8px;
  min-height: 48px;
  border: none;
  border-radius: 12px;
  background: #07C160;
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(7, 193, 96, 0.25);
  transition: transform 0.15s, opacity 0.15s, filter 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.wx-tr-go:active {
  transform: scale(0.985);
  filter: brightness(0.95);
}
.wx-tr-go:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- 转账详情页 ---- */
.wx-tr-detail-body {
  padding-top: calc(58px + env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-left: 24px;
  padding-right: 24px;
}
.wx-tr-detail-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(7, 193, 96, 0.12);
  color: #07C160;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 32px;
  margin-bottom: 14px;
}
.wx-tr-detail-status {
  font-size: 16px;
  font-weight: 600;
  color: var(--wx-text);
  margin-bottom: 8px;
}
.wx-tr-detail-amount {
  font-size: 40px;
  font-weight: 700;
  color: var(--wx-text);
  font-family: "JetBrains Mono", -apple-system, sans-serif;
  margin-bottom: 12px;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.wx-tr-detail-yen {
  font-size: 26px;
  font-weight: 500;
}
.wx-tr-detail-note {
  font-size: 13px;
  color: var(--wx-text2);
  margin-top: 6px;
  padding: 6px 14px;
  background: var(--wx-cell);
  border-radius: 20px;
  border: 1px solid var(--wx-sep);
}

/* ---------- 梦信私享金库（高端黑金 / 琉璃星穹卡面 & 奢华流水） ---------- */
.wx-wallet-container {
  padding: 0 14px 32px;
}

.wx-wallet-card {
  position: relative;
  overflow: hidden;
  padding: 22px 20px 18px;
  border-radius: 18px;
  background:
    radial-gradient(130% 120% at 90% -10%, rgba(212, 175, 55, 0.22) 0%, transparent 60%),
    radial-gradient(90% 90% at 10% 110%, rgba(87, 107, 149, 0.25) 0%, transparent 70%),
    linear-gradient(145deg, #181B24 0%, #1F2430 45%, #13151D 100%);
  border: 1px solid rgba(212, 175, 55, 0.28);
  box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  margin: 0 0 16px;
  user-select: none;
}
.wx-wallet-card::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(230, 194, 128, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.wx-wallet-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.wx-wallet-label-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wx-wallet-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.72);
}
.wx-wallet-eye-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.wx-wallet-eye-btn:hover, .wx-wallet-eye-btn:active {
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  transform: scale(0.95);
}

.wx-wallet-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.3);
  font-size: 10px;
  font-weight: 600;
  color: #F3D995;
  letter-spacing: 1px;
}

.wx-wallet-balance-wrap {
  margin: 4px 0 16px;
  min-height: 48px;
  display: flex;
  align-items: baseline;
}
.wx-wallet-cur {
  font-size: 20px;
  font-weight: 400;
  color: #F3D995;
  margin-right: 6px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.wx-wallet-balance-int {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #FFFFFF;
  font-family: "JetBrains Mono", -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
}
.wx-wallet-balance-dec {
  font-size: 22px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  font-family: "JetBrains Mono", -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
}
.wx-wallet-balance-masked {
  font-size: 30px;
  letter-spacing: 4px;
  color: rgba(255, 255, 255, 0.85);
  font-family: -apple-system, sans-serif;
  line-height: 1;
}

.wx-wallet-card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.wx-wallet-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.wx-wallet-cardno {
  font-size: 12px;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.45);
  font-family: "JetBrains Mono", monospace;
}
.wx-wallet-closed-badge {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.42);
}

.wx-wallet-daily-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
}
.wx-wallet-daily-pill.granted {
  background: rgba(7, 193, 96, 0.14);
  border-color: rgba(7, 193, 96, 0.32);
  color: #57E389;
}
.wx-wallet-daily-pill .pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #F3D995;
}
.wx-wallet-daily-pill.granted .pill-dot {
  background: #07C160;
  box-shadow: 0 0 6px rgba(7, 193, 96, 0.7);
}

/* 角色小金库板块（视窗与卡片） */
.wx-wallet-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px 8px;
}
.wx-wallet-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--wx-text2);
  letter-spacing: 0.5px;
}
.wx-wallet-section-subtitle {
  font-size: 11px;
  color: var(--wx-text3);
}

.wx-vault-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.wx-vault-card {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  background: var(--wx-cell);
  border-radius: 14px;
  border: 1px solid var(--wx-sep);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.wx-vault-card:active {
  transform: scale(0.985);
  background: var(--wx-press);
}
.wx-vault-avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  margin-right: 12px;
}
.wx-vault-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(212, 175, 55, 0.35);
  background: var(--wx-avatar-ph);
  display: block;
}
.wx-vault-avatar-fallback {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4A5568, #2D3748);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  border: 1.5px solid rgba(212, 175, 55, 0.35);
}
.wx-vault-info {
  flex: 1;
  min-width: 0;
}
.wx-vault-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.wx-vault-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--wx-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wx-vault-tag {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(87, 107, 149, 0.1);
  color: var(--wx-link);
  font-weight: 500;
}
.wx-vault-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--wx-text2);
}
.wx-vault-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  margin-left: 10px;
}
.wx-vault-balance {
  font-size: 16px;
  font-weight: 700;
  color: #D48806;
  font-family: "JetBrains Mono", -apple-system, monospace;
}
.wx-vault-action-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(87, 107, 149, 0.08);
  color: var(--wx-link);
  border: 1px solid rgba(87, 107, 149, 0.15);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* 账单流水板块 */
.wx-txns-group {
  background: var(--wx-cell);
  border-radius: 14px;
  border: 1px solid var(--wx-sep);
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}
.wx-txns-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px 8px;
  font-size: 12px;
  color: var(--wx-text2);
  border-bottom: 1px solid var(--wx-sep);
  background: rgba(0, 0, 0, 0.015);
}
.wx-txns-day-stat {
  font-size: 11px;
  color: var(--wx-text3);
}

.wx-txn-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--wx-sep);
  transition: background 0.15s;
}
.wx-txn-row:first-of-type {
  border-top: none;
}
.wx-txn-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}
.wx-txn-icon-wrap.redpacket {
  background: linear-gradient(135deg, #FA5151, #FF7875);
  color: #FFFFFF;
}
.wx-txn-icon-wrap.transfer-in {
  background: rgba(7, 193, 96, 0.12);
  color: #07C160;
}
.wx-txn-icon-wrap.transfer-out {
  background: rgba(87, 107, 149, 0.12);
  color: var(--wx-link);
}
.wx-txn-icon-wrap.daily {
  background: rgba(212, 175, 55, 0.15);
  color: #D48806;
}

.wx-txn-body {
  flex: 1;
  min-width: 0;
}
.wx-txn-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.wx-txn-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--wx-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wx-txn-amount {
  flex-shrink: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--wx-text);
  font-family: "JetBrains Mono", -apple-system, monospace;
}
.wx-txn-amount.in {
  color: #07C160;
}
.wx-txn-sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 3px;
  font-size: 12px;
  color: var(--wx-text2);
}
.wx-txn-desc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wx-txn-time {
  flex-shrink: 0;
  color: var(--wx-text3);
  font-size: 11px;
}

/* 空状态卡片 */
.wx-wallet-empty-card {
  padding: 24px 16px;
  text-align: center;
  background: var(--wx-cell);
  border-radius: 14px;
  border: 1px dashed var(--wx-sep);
  color: var(--wx-text2);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-line;
  margin-bottom: 16px;
}
/* 兼容老 class */
.wx-wallet-balance { display: none; }
.wx-wallet-empty { padding: 20px 16px; font-size: 13px; line-height: 1.7; color: var(--wx-text2); white-space: pre-line; }
.wx-wallet-section { margin: 4px 16px 8px; font-size: 13px; color: var(--wx-text2); }
.wx-wallet-day { padding: 10px 16px 4px; font-size: 12px; color: var(--wx-text2); }
.wx-wallet-row { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-top: 1px solid var(--wx-sep); }
.wx-wallet-row:first-of-type { border-top: none; }
.wx-wallet-row-main { flex: 1; min-width: 0; }
.wx-wallet-row-title { font-size: 15px; color: var(--wx-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wx-wallet-row-sub { margin-top: 2px; font-size: 12px; color: var(--wx-text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wx-wallet-row-amt { flex-shrink: 0; font-size: 16px; font-weight: 600; color: var(--wx-text); }
.wx-wallet-row-amt.in { color: #07C160; }

/* ---------- 快速上手指南（半梦「帮助与关于」· 分页弹层） ---------- */
.guide-overlay {
  position: fixed; inset: 0; z-index: 950;
  background: var(--scene-veil);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.guide-card {
  width: 100%; max-width: 360px;
  background: var(--surface); border: 1px solid var(--outline); border-radius: 20px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .18);
  padding: 28px 24px 20px;
}
.guide-body { text-align: center; min-height: 218px; }
.guide-emoji { font-size: 44px; line-height: 1.2; margin-bottom: 12px; }
.guide-title {
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  color: var(--on-bg); margin-bottom: 14px; letter-spacing: .02em;
}
.guide-text { font-size: 13.5px; line-height: 1.9; color: var(--on-surface-variant); text-align: left; }
.guide-text > div:empty { min-height: 0.9em; }
.guide-dots { display: flex; justify-content: center; gap: 7px; padding: 16px 0 14px; }
.guide-dot {
  width: 7px; height: 7px; border-radius: 4px; background: var(--on-surface-variant);
  opacity: .35; transition: all .2s ease;
}
.guide-dot.on { opacity: 1; background: var(--primary); width: 20px; }
.guide-btns { display: flex; gap: 12px; }
.guide-btn {
  flex: 1; padding: 11px 0; border-radius: 10px; font-size: 15px; font-family: inherit;
  cursor: pointer; border: none; -webkit-tap-highlight-color: transparent;
}
.guide-btn.primary { background: var(--primary); color: var(--on-primary); }
.guide-btn.primary:active { transform: scale(.98); }
.guide-btn.ghost {
  background: transparent; color: var(--on-surface); border: 1px solid var(--outline);
}
.guide-btn.ghost:active { background: var(--surface-variant); }
.guide-btn:disabled { opacity: .4; cursor: default; }

/* ---------- 微信主框架：底部四 Tab ---------- */
.wx-main-scroll { padding-left: 0; padding-right: 0; }
.wx-tabbar {
  flex-shrink: 0; display: flex;
  background: var(--wx-bar);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding-bottom: max(4px, env(safe-area-inset-bottom));
}
.wx-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; padding: 4px 0 2px;
  border: none; background: transparent; cursor: pointer;
  color: var(--wx-text2); font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.wx-tab.active { color: #07C160; }
.wx-tab-label { font-size: 10px; line-height: 1.2; }
.wx-entry-hint { flex-shrink: 0; font-size: 13px; color: var(--wx-text3); }
.wx-danger-cell {
  color: #FA5151; font-size: 16px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.wx-danger-cell:active { background: var(--wx-press); }
.wx-btn-send {
  display: block; width: calc(100% - 32px); margin: 12px 16px 14px;
  padding: 11px 0; border: none; border-radius: 6px; cursor: pointer;
  background: #07C160; color: #FFFFFF; font-size: 16px; font-weight: 500; font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.wx-btn-send:active { background: #06AD56; }
.wx-light .switch.on { background: #07C160; }
.wx-light .switch { background: var(--wx-press); }

/* + 菜单：微信式深色圆角弹出层（右上角） */
.wx-plus-mask { position: fixed; inset: 0; z-index: 39; background: transparent; }
.wx-plus-menu {
  position: fixed; z-index: 40; min-width: 148px;
  background: rgba(20, 22, 28, 0.96);
  border-radius: 8px; padding: 4px 0;
  animation: wx-pop-in .15s ease-out;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35);
}
@keyframes wx-pop-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) { .wx-plus-menu { animation: none; } }
.wx-plus-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: none; background: transparent; cursor: pointer;
  color: #FFFFFF; font-size: 15px; font-family: inherit;
  padding: 11px 18px; -webkit-tap-highlight-color: transparent;
  text-align: left;
}
.wx-plus-item:active { background: rgba(255, 255, 255, 0.08); }

/* 梦信设置页：表单行与分割线 */
.wx-cell-divider { height: 1px; background: var(--wx-sep); margin-left: 16px; }
.wx-field-row {
  display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 6px 16px;
}
.wx-field-label { flex-shrink: 0; width: 72px; font-size: 15px; color: var(--wx-text); }
.wx-field {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  font-size: 15px; color: var(--wx-text); font-family: inherit;
  text-align: right;
}
.wx-field::placeholder { color: var(--wx-avatar-ph); }

/* 梦信底部动作面板（ActionSheet）：微信式弹层，选项带勾选态 */
.wx-as-root { position: fixed; inset: 0; z-index: 130; }
.wx-as-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); }
.wx-action-sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--wx-bar);
  border-radius: 14px 14px 0 0;
  padding: 8px 0 max(10px, env(safe-area-inset-bottom));
  animation: wx-as-in .2s ease-out;
}
@keyframes wx-as-in {
  from { transform: translateY(40%); opacity: .6; }
  to { transform: translateY(0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .wx-action-sheet { animation: none; } }
.wx-as-title {
  text-align: center; font-size: 13px; color: var(--wx-text2);
  padding: 10px 16px 8px; line-height: 1.4;
}
.wx-as-options { background: var(--wx-cell); }
.wx-as-item {
  position: relative; display: flex; align-items: center; justify-content: center; width: 100%;
  border: none; background: transparent; cursor: pointer; font-family: inherit;
  min-height: 57px; padding: 8px 16px;
  -webkit-tap-highlight-color: transparent;
  text-align: center;
}
.wx-as-item:active { background: var(--wx-press); }
.wx-as-item + .wx-as-item::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: var(--wx-sep);
}
.wx-as-check {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font-size: 15px; color: #07C160;
}
.wx-as-item-main { flex: 1; min-width: 0; }
.wx-as-label { display: block; font-size: 17px; color: var(--wx-text); line-height: 1.4; text-align: center; }
.wx-as-item.active .wx-as-label { color: #07C160; }
.wx-as-sub { display: block; font-size: 12px; color: var(--wx-text2); margin-top: 2px; line-height: 1.4; text-align: center; }
.wx-as-cancel {
  display: block; width: 100%; margin-top: 8px;
  border: none; background: var(--wx-cell); cursor: pointer; font-family: inherit;
  min-height: 52px; font-size: 16px; color: var(--wx-text);
  -webkit-tap-highlight-color: transparent;
}
.wx-as-cancel:active { background: var(--wx-press); }
/* 桌面手机壳模式：ActionSheet 与壳同宽居中（移动端保持全宽），
   专用 keyframes 在动画期间也保留 translateX(-50%)，避免弹出瞬间横跳 */
@media (min-width: 768px) {
  @keyframes wx-as-in-desk {
    from { transform: translateX(-50%) translateY(40%); opacity: .6; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
  }
  .wx-action-sheet {
    left: 50%; right: auto; width: 390px;
    bottom: calc((100dvh - min(844px, calc(100dvh - 110px))) / 2);
    transform: translateX(-50%);
    animation-name: wx-as-in-desk;
  }
}

/* ---------- 个人信息页：右侧取值（微信式右对齐灰字） ---------- */
.wx-entry-value {
  flex: 1; min-width: 0; text-align: right;
  font-size: 15px; color: var(--wx-text2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 梦圈（二期壳：封面头图 + 动态流；发布/点赞/评论三期接） ---------- */
/* 顶栏透明浮在封面头上（默认毛玻璃条在封面场景穿帮），按钮改白色 */
.wx-moments-page { position: relative; background: var(--wx-page); }
.wx-moments-page .ta-wechat-header {
  background: transparent; border-bottom: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.wx-moments-page .ta-wechat-header .ta-wx-back,
.wx-moments-page .ta-wechat-header .ta-wx-more { color: #FFFFFF; }
.wx-moments-page .ta-wechat-header .ta-wx-back:active,
.wx-moments-page .ta-wechat-header .ta-wx-more:active { background: rgba(0, 0, 0, 0.12); }
.wx-moments-cover {
  position: relative; height: 264px;
  background: linear-gradient(165deg, #6E809B 0%, #93A5BC 55%, #BFCBD8 100%);
}
/* 封面右下：我的名字 + 头像（头像压过封面下缘，微信同款） */
.wx-moment-me {
  position: absolute; right: 16px; bottom: -22px; z-index: 2;
  display: flex; align-items: flex-end; gap: 12px;
}
.wx-moment-me-name {
  color: #FFFFFF; font-size: 16px; font-weight: 500;
  margin-bottom: 16px; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.wx-moment-me .wx-avatar48 {
  width: 64px; height: 64px; border-radius: 8px;
  border: 2px solid #FFFFFF; box-sizing: border-box;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.wx-moments-feed { background: var(--wx-page); padding-top: 34px; }
.wx-moment-item { display: flex; gap: 10px; padding: 12px 16px 0; }
.wx-moment-item .wx-avatar48 { width: 42px; height: 42px; border-radius: 6px; }
.wx-moment-body {
  flex: 1; min-width: 0;
  border-bottom: 1px solid var(--wx-sep);
  padding-bottom: 12px;
}
.wx-moment-name { color: var(--wx-link); font-weight: 600; font-size: 15px; line-height: 1.35; }
.wx-moment-text {
  font-size: 15px; color: var(--wx-text); line-height: 1.5; margin-top: 2px;
  white-space: pre-wrap; word-break: break-word;
}
.wx-moment-imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 6px; }
.wx-moment-imgs img {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
  border-radius: 4px; display: block; cursor: zoom-in;
}
.wx-moment-time { font-size: 12px; color: var(--wx-text3); margin-top: 8px; }
.wx-moment-hint {
  padding: 80px 24px 0; text-align: center;
  font-size: 14px; color: var(--wx-text3); line-height: 1.9; white-space: pre-wrap;
}

/* ==========================================================================
   图片查看器（应用内全屏看图：单击关闭 / 双击缩放 / 捏合缩放 / 拖拽平移）
   ========================================================================== */
.img-viewer {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(8, 10, 14, 0.94);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s ease;
  touch-action: none; /* 手势全交 JS，避免浏览器默认滚动/缩放 */
  cursor: zoom-out;
}
.img-viewer.show { opacity: 1; }
.img-viewer-img {
  max-width: 94vw; max-height: 90vh;
  object-fit: contain; border-radius: 6px;
  user-select: none; -webkit-user-drag: none;
  touch-action: none; will-change: transform;
  cursor: zoom-in;
}

/* ==========================================================================
   星尘织茧榜（「我的」页 · 提交 bug 捕获星尘 → 确认后凝实为茧）
   视觉沿用半梦粒子引擎的星尘色 --star-base，昼夜双主题自动适配
   ========================================================================== */
.stardust-card {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 12px;
  overflow: hidden;
}
.stardust-tier {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
}
.stardust-tier + .stat-row { border-top: 1px solid var(--outline); }
.stardust-medal {
  width: 44px; height: 44px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700;
  color: var(--on-primary);
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--primary) 78%, #fff), var(--primary) 70%);
  box-shadow: 0 0 12px color-mix(in srgb, var(--primary) 45%, transparent);
}
.stardust-tier-main { min-width: 0; }
.stardust-tier-name {
  font-size: 16px; font-weight: 700;
  font-family: var(--font-display);
  color: var(--ink);
}
.stardust-tier-sub { font-size: 12px; color: var(--on-surface-variant); margin-top: 2px; }
.stardust-board-wrap { border-top: 1px solid var(--outline); }
.stardust-board {
  background: var(--surface-variant);
  padding: 4px 0;
}
.board-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
}
.board-row + .board-row { border-top: 1px dashed var(--outline); }
.board-rank {
  width: 24px; flex-shrink: 0; text-align: center;
  font-family: var(--font-mono); font-size: 12px;
  color: var(--on-surface-variant);
}
.board-rank.top {
  color: var(--primary);
  font-family: var(--font-display);
  font-weight: 700; font-size: 14px;
}
.board-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.board-tier { font-size: 11px; color: var(--on-surface-variant); flex-shrink: 0; }
.board-cocoons { font-family: var(--font-mono); font-size: 12px; color: var(--primary); flex-shrink: 0; }
.board-toggle {
  width: 100%;
  border: none; background: transparent;
  padding: 10px 0;
  font: inherit; font-size: 12px;
  color: var(--on-surface-variant);
  cursor: pointer;
}
.board-toggle:active { opacity: .7; }
/* 全服排名入口：可点击的统计格，点击进入独立榜单页 */
.board-entry {
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
}
.board-entry .stat-lab { color: var(--primary); }
.board-entry:active { background: var(--surface-variant); }
.board-entry:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
/* 段位体系说明列表 */
.stardust-tiers .board-row { padding: 8px 16px; }
.stardust-catch {
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px 0;
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}
.stardust-catch:active { opacity: .6; }

/* ========== 梦信一期扩展：拍一拍 / 红包 / 引用回复 / 免打扰 / 聊内搜索 ========== */
/* 拍一拍：系统灰字行 + 头像抖动 */
.wx-pat-row {
  text-align: center; font-size: 12.5px; color: var(--wx-text2);
  padding: 3px 16px; user-select: none;
}
.wx-pat-shake { animation: wx-pat-shake .6s ease-in-out; }
@keyframes wx-pat-shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-5px) rotate(-4deg); }
  30% { transform: translateX(5px) rotate(4deg); }
  45% { transform: translateX(-4px) rotate(-3deg); }
  60% { transform: translateX(4px) rotate(3deg); }
  75% { transform: translateX(-2px) rotate(-2deg); }
  90% { transform: translateX(2px) rotate(1deg); }
}
/* 撤回提示：微信同款居中灰字。
   ⚠️ 2026-09-23 修：此前写死 rgba(0,0,0,.34) + 一条只认**系统** prefers-color-scheme 的深色覆盖，
   于是「App 深色 + 系统浅色」下是黑字落在深色底上——实测对比度 **1.11**（等于隐形）。
   用户反馈的「消息被撤回、而且看不到的那种」就是这个：灰字看不见，但那一行仍然占位，
   后面的气泡看着就像"错位"。改用主题变量（--wx-text3 三级文字，随 data-wx-theme 走）。 */
.wx-recall-row {
  text-align: center; font-size: 12.5px; color: var(--wx-text2);
  padding: 3px 16px; user-select: none;
}
.wx-reedit-btn {
  color: var(--wx-text2); margin-left: 6px; cursor: pointer; user-select: none;
  font-weight: 500; text-decoration: none; display: inline-block;
}
.wx-reedit-btn:hover { text-decoration: underline; }
.wx-reedit-btn:active { opacity: .75; }
/* 深色模式：上面已走主题变量，这里不再重复覆盖（重复覆盖会盖掉 data-wx-theme 的口径） */
/* 扮演红包：橙色卡片气泡 */
.ta-bubble.wx-redpacket {
  background: linear-gradient(160deg, #F7D28B 0%, #EFAE5C 100%);
  color: #7A4A12; min-width: 168px; padding: 10px 14px; cursor: pointer;
  border-radius: 8px;
}
.ta-bubble.wx-redpacket:active { filter: brightness(.96); }
.ta-bubble.wx-redpacket .wx-rp-top {
  display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 500;
}
.ta-bubble.wx-redpacket .wx-rp-icon { font-size: 22px; line-height: 1; }
.ta-bubble.wx-redpacket .wx-rp-note {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px;
}
.ta-bubble.wx-redpacket .wx-rp-sub {
  margin-top: 6px; padding-top: 5px; border-top: 1px solid rgba(122, 74, 18, .25);
  font-size: 11px; opacity: .75;
}
/* 引用块：气泡内左竖线小字 */
.ta-bubble .wx-quote {
  display: block;
  margin: 0 0 4px; padding: 4px 8px; border-left: 2px solid #07C160;
  background: rgba(0, 0, 0, 0.05); border-radius: 4px;
  font-size: 12px; color: rgba(0, 0, 0, 0.45); line-height: 1.5;
  max-width: 220px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.ta-bubble .wx-quote .wx-quote-name { color: rgba(0, 0, 0, 0.6); }
/* 引用条：composer 上方待引用提示 */
.wx-quote-bar {
  display: flex; align-items: center; gap: 8px;
  margin: 0 8px; padding: 6px 10px;
  background: #F2F2F2; border-radius: 8px 8px 0 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}
.wx-quote-bar .wx-quote-hint {
  flex: 1; min-width: 0; font-size: 12.5px; color: rgba(0, 0, 0, 0.5);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wx-quote-bar .wx-quote-close {
  flex-shrink: 0; width: 24px; height: 24px; border: none; border-radius: 50%;
  background: rgba(0, 0, 0, 0.08); color: rgba(0, 0, 0, 0.5);
  font-size: 16px; line-height: 1; cursor: pointer;
}
@media (prefers-color-scheme: dark) {
  .wx-quote-bar { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.1); }
  .wx-quote-bar .wx-quote-hint { color: rgba(255, 255, 255, 0.45); }
  .wx-quote-bar .wx-quote-close { background: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.5); }
}
/* 免打扰未读：灰色圆点 */
/* 免打扰未读：实色灰点（半透明叠在头像上会出现两色断层，像裁剪坏了） */
.wx-badge.wx-badge-muted { background: #B2B2B2; min-width: 10px; width: 10px; height: 10px; padding: 0; right: -2px; top: -2px; border: 1.5px solid var(--wx-cell); box-sizing: content-box; }
/* 聊内搜索覆盖层 */
.wx-search-overlay-mask { position: fixed; inset: 0; z-index: 94; background: rgba(0, 0, 0, 0.35); }
.wx-search-overlay {
  position: fixed; z-index: 95; left: 50%; transform: translateX(-50%);
  top: 8vh; width: min(92vw, 420px); max-height: 76vh;
  background: #F7F7F7; border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
}
.wx-sr-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08); flex-shrink: 0;
}
.wx-sr-head input {
  flex: 1; min-width: 0; height: 34px; padding: 0 12px;
  border: none; border-radius: 8px; background: #FFFFFF;
  font-size: 14px; outline: none; color: rgba(0, 0, 0, 0.85);
}
.wx-sr-count { flex-shrink: 0; font-size: 12px; color: rgba(0, 0, 0, 0.4); }
.wx-sr-close {
  flex-shrink: 0; border: none; background: transparent; color: #576B95;
  font-size: 14px; cursor: pointer; padding: 4px 2px;
}
.wx-sr-list { overflow-y: auto; flex: 1; padding: 6px 0; }
.wx-sr-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 14px; border: none; background: transparent; text-align: left; cursor: pointer;
}
.wx-sr-item:active { background: rgba(0, 0, 0, 0.05); }
.wx-sr-avatar { width: 36px; height: 36px; flex-shrink: 0; background-size: cover; background-position: center; background-color: #E5E5E5; }
.wx-sr-main { flex: 1; min-width: 0; }
.wx-sr-name { font-size: 13px; color: rgba(0, 0, 0, 0.45); }
.wx-sr-text {
  font-size: 14.5px; color: rgba(0, 0, 0, 0.85); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wx-sr-time { flex-shrink: 0; font-size: 11px; color: rgba(0, 0, 0, 0.35); }
.wx-sr-empty { padding: 36px 0; text-align: center; font-size: 13px; color: rgba(0, 0, 0, 0.35); }
/* 搜索命中高亮 */
.wx-sr-hit .ta-bubble, .wx-sr-hit.ta-bubble { outline: 2px solid #07C160; outline-offset: 1px; border-radius: 6px; }
.wx-sr-hit { border-radius: 8px; }
@media (prefers-color-scheme: dark) {
  .wx-search-overlay { background: #2C2C2C; }
  .wx-sr-head { border-color: rgba(255, 255, 255, 0.1); }
  .wx-sr-head input { background: #3A3A3A; color: rgba(255, 255, 255, 0.85); }
  .wx-sr-count { color: rgba(255, 255, 255, 0.4); }
  .wx-sr-item:active { background: rgba(255, 255, 255, 0.06); }
  .wx-sr-avatar { background-color: #3A3A3A; }
  .wx-sr-name { color: rgba(255, 255, 255, 0.45); }
  .wx-sr-text { color: rgba(255, 255, 255, 0.85); }
  .wx-sr-time { color: rgba(255, 255, 255, 0.35); }
  .wx-sr-empty { color: rgba(255, 255, 255, 0.35); }
  .wx-badge.wx-badge-muted { background: #5C5C5C; }
}

/* ========== 红包封面页（东方美学 · 鎏金朱砂奢华全屏） ========== */
.wx-rp-page {
  position: fixed; inset: 0; z-index: 140;
  background:
    radial-gradient(120% 85% at 50% -8%, rgba(255, 185, 120, 0.28) 0%, transparent 60%),
    radial-gradient(90% 60% at 50% 115%, rgba(26, 4, 3, 0.65) 0%, transparent 70%),
    linear-gradient(172deg, #A8241D 0%, #8A1A14 45%, #64110C 100%);
  display: flex; flex-direction: column;
  color: #FFFFFF;
}
.wx-rp-page .ta-wechat-header {
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}
.wx-rp-page .ta-wechat-header .ta-wx-name {
  color: #FFFFFF;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.wx-rp-page .ta-wechat-header .ta-wx-back {
  color: #FFFFFF;
}

/* 桌面手机壳模式：整页居中 */
@media (min-width: 768px) {
  .wx-rp-page {
    top: calc((100dvh - min(844px, calc(100dvh - 110px))) / 2);
    bottom: auto;
    left: 50%; right: auto;
    transform: translateX(-50%);
    width: 390px;
    height: min(844px, calc(100dvh - 110px));
    min-height: 560px;
    border-radius: 44px;
    overflow: hidden;
    box-shadow:
      0 0 0 10px #14161d,
      0 0 0 11px rgba(255, 255, 255, 0.08),
      0 34px 90px rgba(0, 0, 0, 0.6);
  }
}

.wx-rp-body {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: calc(58px + env(safe-area-inset-top)) 18px 24px;
  overflow-y: auto;
}

/* 顶部伴侣专属礼遇封章 */
.wx-rp-recipient-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 6px 0 18px;
  text-align: center;
}
.wx-rp-avatar-halo {
  position: relative;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, #FFF0CC 0%, #F4CE75 45%, #D49326 100%);
  box-shadow: 0 10px 24px rgba(24, 3, 2, 0.38), 0 0 16px rgba(244, 206, 117, 0.3);
  margin-bottom: 10px;
}
.wx-rp-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.wx-rp-avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #5C1D17, #360E0A);
  color: #FFF0CC;
  font-size: 24px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wx-rp-recipient-title {
  font-size: 16px;
  font-weight: 500;
  color: #FFF6E5;
  letter-spacing: 0.5px;
}
.wx-rp-recipient-name {
  font-weight: 700;
  color: #FFE199;
}
.wx-rp-recipient-sub {
  margin-top: 4px;
  font-size: 11.5px;
  color: rgba(255, 230, 205, 0.68);
  letter-spacing: 1px;
}

/* 暖玉白柔光卡片 */
.wx-rp-input-card {
  width: 100%;
  background: rgba(255, 253, 248, 0.95);
  border-radius: 18px;
  padding: 16px 18px 14px;
  box-shadow: 0 12px 30px rgba(25, 3, 2, 0.22);
  border: 1px solid rgba(255, 235, 215, 0.6);
  margin-bottom: 12px;
}
.wx-rp-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.wx-rp-card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #4A3324;
}
.wx-rp-balance-hint {
  font-size: 11.5px;
  color: #9C7E6A;
  font-family: "JetBrains Mono", -apple-system, sans-serif;
}

.wx-rp-amount-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  border-bottom: 1px solid rgba(74, 51, 36, 0.1);
  padding-bottom: 8px;
}
.wx-rp-yen {
  font-size: 28px;
  font-weight: 700;
  color: #B5741E;
}
.wx-rp-amount-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-size: 32px;
  font-weight: 700;
  font-family: "JetBrains Mono", -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  color: #2F1B10;
  background: transparent;
}
.wx-rp-amount-input::placeholder {
  color: #D6C5B5;
}

/* 快捷选额胶囊 */
.wx-rp-presets {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.wx-rp-preset-chip {
  flex: 1;
  min-width: 58px;
  padding: 5px 6px;
  border-radius: 12px;
  border: 1px solid rgba(181, 116, 30, 0.22);
  background: rgba(181, 116, 30, 0.06);
  color: #8A5313;
  font-size: 12px;
  font-weight: 600;
  font-family: "JetBrains Mono", monospace;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}
.wx-rp-preset-chip:active {
  background: #B5741E;
  color: #FFFFFF;
  transform: scale(0.96);
}

/* 祝福语卡片 */
.wx-rp-note-card {
  padding: 14px 18px 12px;
}
.wx-rp-note-input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 15px;
  font-weight: 500;
  color: #352115;
  background: transparent;
  padding: 2px 0 8px;
  border-bottom: 1px solid rgba(74, 51, 36, 0.08);
}
.wx-rp-note-input::placeholder {
  color: #BBA999;
}
.wx-rp-note-presets {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.wx-rp-note-chip {
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(0, 0, 0, 0.03);
  color: #6C5544;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.15s;
}
.wx-rp-note-chip:active {
  background: rgba(0, 0, 0, 0.08);
  color: #2F1B10;
}

.wx-rp-err {
  min-height: 20px;
  font-size: 12px;
  color: #FFD4D0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  margin: 2px 4px 6px;
  align-self: stretch;
  text-align: center;
}

/* 鎏金封签大按钮 */
.wx-rp-go {
  width: 100%;
  margin-top: 6px;
  border: none;
  cursor: pointer;
  min-height: 50px;
  border-radius: 16px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #FFE49E 0%, #FFB535 50%, #EE8000 100%);
  color: #582A00;
  box-shadow: 0 10px 26px rgba(180, 50, 10, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.6);
  transition: transform 0.15s, filter 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.wx-rp-go:active {
  transform: scale(0.98);
  filter: brightness(0.95);
}
.wx-rp-go:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.wx-rp-tip {
  margin-top: 14px;
  font-size: 11.5px;
  color: rgba(255, 230, 205, 0.72);
  letter-spacing: 0.5px;
  text-align: center;
}
/* ---- 拆红包详情页 ---- */
.wx-rp-detail-back { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 8px; z-index: 2; background: rgba(0, 0, 0, 0.14); border-radius: 8px; padding: 6px 10px 6px 6px; border: none; }
.wx-rp-detail-body {
  position: relative; flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 0 30px 8vh;
}
/* 红包封：正红卡纸 + 上盖 + 金色「開」印 */
.wx-rp-cover {
  position: relative; width: 262px; height: 360px; border-radius: 16px;
  background: linear-gradient(168deg, #E8432A 0%, #CE3413 60%, #B92A10 100%);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.28), inset 0 0 0 2px rgba(255, 214, 140, 0.4);
  perspective: 900px; transition: transform .5s ease, opacity .45s .35s;
}
/* 翻开后红包封缩小上移让位给金额 */
.wx-rp-page.is-open .wx-rp-cover { transform: translateY(-70px) scale(.72); }
.wx-rp-cover-circle {
  position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%);
  width: 92px; height: 92px; border-radius: 50%;
  background: radial-gradient(circle at 36% 28%, #FFF3D6 0%, #F6CF7A 42%, #D9982E 76%, #B87C1E 100%);
  box-shadow: inset 0 0 0 3px rgba(126, 66, 0, 0.32), inset 0 0 0 4px rgba(255, 228, 168, 0.45), 0 4px 14px rgba(0, 0, 0, 0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 42px; font-weight: 600; color: #8A4B00; font-family: var(--font-display);
}
.wx-rp-cover-note {
  position: absolute; left: 0; right: 0; top: 60%;
  text-align: center; font-size: 17px; color: #FFE9C4;
  padding: 0 24px; line-height: 1.5; transition: opacity .3s;
}
.wx-rp-page.is-open .wx-rp-cover .wx-rp-cover-note { opacity: 0; }
.wx-rp-reveal .wx-rp-reveal-note { position: static; color: #FFFFFF; opacity: 1; }
.wx-rp-flap {
  position: absolute; top: 0; left: 0; right: 0; height: 55%;
  background: linear-gradient(180deg, #F04E30 0%, #D63317 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: 16px 16px 0 0;
  transform-origin: top center;
  transition: transform .55s cubic-bezier(.6, .05, .3, 1), opacity .45s .1s;
  box-shadow: inset 0 -3px 0 rgba(255, 214, 140, 0.35);
  z-index: 2; border: none; padding: 0; cursor: pointer;
}
.wx-rp-open-btn {
  position: absolute; left: 50%; bottom: -40px; transform: translateX(-50%);
  width: 88px; height: 88px; border-radius: 50%; border: none; cursor: pointer;
  background: radial-gradient(circle at 36% 28%, #FFF3D6 0%, #F6CF7A 42%, #D9982E 76%, #B87C1E 100%);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3), inset 0 0 0 3px rgba(126, 66, 0, 0.35);
  font-size: 36px; font-weight: 600; color: #8A4B00; font-family: var(--font-display);
  -webkit-tap-highlight-color: transparent; z-index: 3;
  animation: wx-rp-pulse 1.6s ease-in-out infinite;
}
.wx-rp-open-btn:active { filter: brightness(.94); }
@keyframes wx-rp-pulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.06); }
}
/* 翻盖动画 + 揭晓金额 */
.wx-rp-page.is-open .wx-rp-flap { transform: rotateX(-168deg); opacity: 0; pointer-events: none; }
.wx-rp-page.is-open .wx-rp-open-btn { opacity: 0; pointer-events: none; transition: opacity .3s; }
.wx-rp-reveal {
  position: absolute; left: 0; right: 0; bottom: 6vh;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center; opacity: 0; transform: translateY(36px);
  transition: opacity .45s .32s, transform .5s .32s; pointer-events: none;
}
.wx-rp-page.is-open .wx-rp-reveal { opacity: 1; transform: none; }
.wx-rp-detail-who { font-size: 15px; color: rgba(255, 255, 255, 0.88); margin-bottom: 12px; letter-spacing: .5px; }
.wx-rp-detail-amount {
  font-size: 48px; font-weight: 700; color: #FFE3B8; line-height: 1.1;
  display: flex; align-items: baseline; gap: 5px; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}
.wx-rp-detail-cur { font-size: 22px; font-weight: 600; }

/* ========== 梦圈发布页 + 动态互动区（点赞/评论） ========== */
/* ⛔ 底色必须用 --wx-page，不许写死 #FFFFFF：梦信有独立主题（data-wx-theme=dark 或系统深色），
   那种情况下 --wx-text 是近白的 rgba(255,255,255,.92)，写死白底就是**白底白字**。
   2026-09-22 用户报「梦圈打字看不到文字」——实测梦信深色时 .wx-mc-text
   文字 rgb(255,255,255) / 背景 rgb(255,255,255)，对比度 1.00；
   而占位符用 --wx-text3（深色下 #6E6E6E 中灰）在白底上看得见，
   所以现象正是「占位符看得见、自己打的字看不见」。防线见 scripts/guard-wx-contrast.mjs：
   量的是「文字色 vs 往上第一个不透明背景色」的对比度，四种主题组合都要过。 */
.wx-mc-page { background: var(--wx-page); }
.wx-mc-page .ta-thread { background: var(--wx-page); }
.wx-mc-body { padding: calc(58px + env(safe-area-inset-top)) 16px 14px; }
.wx-mc-text {
  width: 100%; min-height: 120px; border: none; outline: none; resize: none;
  font-size: 17px; line-height: 1.55; font-family: inherit; color: var(--wx-text);
  background: transparent;
}
.wx-mc-text::placeholder { color: var(--wx-text3); }
.wx-mc-err { min-height: 18px; font-size: 12px; color: #FA5151; margin: 6px 0; }
.wx-mc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.wx-mc-cell {
  position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden;
  background: var(--wx-press); border: none; padding: 0; cursor: pointer;
}
.wx-mc-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wx-mc-add {
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; color: var(--wx-text2); font-weight: 200; background: var(--wx-bar);
}
.wx-mc-add:active { background: var(--wx-press); }
.wx-mc-del {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px;
  border: none; border-radius: 50%; background: rgba(0, 0, 0, 0.55);
  color: #FFFFFF; font-size: 14px; line-height: 1; cursor: pointer; padding: 0;
}
.wx-mc-submit {
  border: none; background: #07C160; color: #FFFFFF; font-size: 14px; font-weight: 500;
  font-family: inherit; padding: 6px 16px; border-radius: 5px; cursor: pointer;
  margin-right: 44px; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.wx-mc-submit:disabled { background: #A8E6BE; }
/* 动态互动区：微信式灰底圆角块 */
.wx-moment-social {
  margin-top: 8px; background: rgba(0, 0, 0, 0.045); border-radius: 4px;
  padding: 6px 10px; font-size: 13.5px; line-height: 1.6;
}
.wx-social-likes { color: var(--wx-text); }
.wx-social-heart { color: #576B95; font-size: 12px; margin-right: 6px; }
.wx-social-comma { color: var(--wx-text3); margin-right: 2px; }
.wx-social-name { color: #576B95; font-weight: 500; }
.wx-social-comment { color: var(--wx-text); }
.wx-social-comment .wx-social-name { margin-right: 2px; }
.wx-social-comment + .wx-social-comment { border-top: 1px solid rgba(0, 0, 0, 0.05); margin-top: 4px; padding-top: 4px; }
@media (prefers-color-scheme: dark) {
  .wx-moment-social { background: rgba(255, 255, 255, 0.06); }
  .wx-social-comment + .wx-social-comment { border-color: rgba(255, 255, 255, 0.06); }
}

/* ========== 梦圈三期：互动面板 / 详情页 / 互动消息 ========== */
.wx-moment-item { cursor: pointer; }
.wx-entry-badge { position: static; flex-shrink: 0; min-width: 16px; width: 16px; height: 16px; padding: 0; font-size: 10px; line-height: 16px; text-align: center; }
.wx-notifs-badge { position: static; flex-shrink: 0; margin-left: auto; }
.wx-moments-notifs-bar {
  display: flex; align-items: center; gap: 6px;
  margin: 10px 16px 0; padding: 11px 14px; border-radius: 8px;
  background: var(--wx-cell); font-size: 15px; color: var(--wx-text); cursor: pointer;
}
/* 时间线：透明顶栏浮在封面上，封面必须顶到页面顶部（覆盖 ta-thread 的顶部预留） */
.wx-moments-page .ta-thread { padding-top: 0; }
.wx-moment-detail-page,
.wx-moment-notifs-page { background: var(--wx-page); }
.wx-moment-detail-scroll {
  padding: calc(58px + env(safe-area-inset-top)) 16px 20px;
  background: var(--wx-page);
}
.wx-moment-detail-head { display: flex; align-items: center; gap: 10px; }
.wx-moment-detail-head .wx-avatar48 { width: 42px; height: 42px; border-radius: 6px; }
.wx-moment-detail-meta { display: flex; flex-direction: column; gap: 2px; }
.wx-moment-detail-text { margin-top: 12px; font-size: 16px; line-height: 1.6; color: var(--wx-text); white-space: pre-wrap; }
.wx-moment-detail-imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 12px; }
.wx-moment-detail-imgs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; cursor: pointer; }
.wx-moment-detail-scroll .wx-moment-social { margin-top: 12px; max-width: 100%; }
.wx-detail-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--wx-cell); border-top: 1px solid rgba(0, 0, 0, 0.05);
}
.wx-detail-input {
  flex: 1; min-width: 0; height: 36px; padding: 0 12px;
  border: none; border-radius: 18px; background: var(--wx-bg); font-size: 15px;
  color: var(--wx-text); outline: none; font-family: inherit;
}
.wx-detail-send { border: none; background: none; color: #4D9AF0; font-size: 15px; padding: 6px 4px; cursor: pointer; }
.wx-detail-send:disabled { color: #B2B2B2; }
.wx-detail-like { border: none; background: none; font-size: 24px; line-height: 1; color: #7F7F7F; padding: 0 6px; cursor: pointer; }
.wx-detail-like.liked { color: #07C160; }
.wx-notifs-list { padding: 8px 0; }
.wx-notif-item { display: flex; align-items: center; gap: 10px; padding: 11px 16px; background: var(--wx-cell); cursor: pointer; }
.wx-notif-item:active { background: var(--wx-press); }
.wx-notif-avatar {
  width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0;
  background: #4D9AF0; color: #FFFFFF; font-size: 18px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.wx-notif-body { flex: 1; min-width: 0; }
.wx-notif-text { font-size: 14px; color: var(--wx-text); line-height: 1.45; }
.wx-notif-actor { color: #576B95; font-weight: 600; }
.wx-notif-time { margin-top: 2px; font-size: 12px; color: var(--wx-text3); }
.wx-notif-dot { width: 8px; height: 8px; border-radius: 50%; background: #FA5151; flex-shrink: 0; margin-left: auto; }
@media (prefers-color-scheme: dark) {
  .wx-moment-detail-scroll .wx-moment-social { background: rgba(255, 255, 255, 0.06); }
}

/* ========== 梦圈四期：微信式气泡菜单 + 就地评论 + 右下角两点图标 ========== */
.wx-moment-meta {
  display: flex; align-items: center; justify-content: space-between;
}
.wx-moment-meta .wx-moment-time { margin-top: 0; }
.wx-moment-dots {
  display: flex; align-items: center; gap: 3px;
  padding: 8px 2px 6px 10px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.wx-moment-dots span {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--wx-text3);
}
/* 顶栏两点（右上角消息入口）：点击区加大，圆点稍大，跟随透明顶栏的白色按钮 */
.wx-header-dots { padding: 10px 12px; }
.wx-header-dots span { width: 5px; height: 5px; }
.wx-moments-page .wx-header-dots span { background: #FFFFFF; opacity: 0.95; }
.wx-moment-me-link { cursor: pointer; }
/* 个人梦圈：封面略深色渐变做区分，标题白字浮在封面上 */
.wx-moments-cover.me-cover {
  background: linear-gradient(165deg, #4A5A78 0%, #6E8098 55%, #A7B4C4 100%);
}
.wx-moments-page .ta-wechat-header .ta-wx-name { color: #FFFFFF; }
.wx-moment-menu {
  position: fixed; z-index: 120;
  display: flex; gap: 2px;
  background: var(--wx-cell);
  border-radius: 8px; padding: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(0, 0, 0, 0.12);
}
.wx-moment-menu::before {
  content: ''; position: absolute; top: -6px; left: 50%; margin-left: -6px;
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-bottom: 6px solid var(--wx-cell);
}
.wx-moment-menu.up::before {
  top: auto; bottom: -6px;
  border-bottom: none; border-top: 6px solid var(--wx-cell);
}
.wx-mm-item {
  background: none; border: none; padding: 9px 16px;
  font-size: 14.5px; color: var(--wx-text); cursor: pointer;
  border-radius: 6px; font-family: inherit;
}
.wx-mm-item:active { background: var(--wx-press); }
.wx-moment-comment-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
}
.wx-mic-input {
  flex: 1; min-width: 0; height: 34px;
  border: 1px solid rgba(0, 0, 0, 0.14); border-radius: 17px;
  padding: 0 14px; font-size: 14px; outline: none;
  background: var(--wx-page); color: var(--wx-text); font-family: inherit;
}
.wx-mic-send {
  border: none; background: none; color: #4D9AF0;
  font-size: 14px; padding: 6px 2px; cursor: pointer; font-family: inherit;
}
.wx-mic-send:disabled { color: #B2B2B2; }

/* ---------- 抖音群悬浮球（全局左上、可拖动，44px 比梦信球小一号） ---------- */
.promo-fab {
  position: fixed;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #1a1a1a 0%, #000 60%, #161616 100%);
  border: 1.5px solid rgba(255,255,255,.9);
  box-shadow: 0 6px 16px rgba(0,0,0,.35), 0 2px 6px rgba(0,0,0,.2);
  cursor: grab; user-select: none; touch-action: none;
  z-index: 45;
  transition: box-shadow .18s ease, transform .12s ease;
  padding: 0;
}
.promo-fab:active { cursor: grabbing; }
.promo-fab.dragging { transition: none; box-shadow: 0 10px 24px rgba(0,0,0,.45); }
.promo-fab .promo-note svg { width: 22px; height: 22px; display: block; }
.promo-fab .promo-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #fe2c55; position: absolute; top: 5px; right: 6px;
  box-shadow: 0 0 8px rgba(254,44,85,.9); border: 1.5px solid #fff;
}
.phone .promo-fab { position: absolute; }
.promo-card {
  position: fixed;
  width: 260px; max-width: calc(100vw - 32px);
  background: var(--surface); color: inherit;
  border: 1px solid var(--outline); border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
  padding: 14px 14px 12px; z-index: 60;
}
.phone .promo-card { position: absolute; }
.promo-card[hidden] { display: none; }
.promo-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.promo-hook { font-size: 13px; line-height: 1.5; opacity: .92; margin-bottom: 4px; }
.promo-hook.sub { opacity: .7; font-size: 12px; margin-bottom: 10px; }
.promo-copy {
  width: 100%; border: none; border-radius: 10px; padding: 10px 0;
  background: var(--primary); color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.promo-copy:active { transform: scale(.98); }
.promo-hint { font-size: 11px; opacity: .6; text-align: center; margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .promo-fab { transition: none; } }

/* ==========================================================================
   梦信群聊（modules/group.js）
   单聊的样式全在 app.css 的 .ta-wechat/.ta-msg/.ta-bubble 系列里，群聊直接复用；
   这里只补群聊**独有**的东西：群头像拼图、发言人名字、@ chip、建群选择器、群记忆面板。
   为什么不开新文件：index.html 只引 app.css（hall-v2/messages 那两份是未发版的），
   新开一份 css 不引进来等于没写。
   ========================================================================== */

/* ---------- 会话列表：群头像 2×2 拼图 ---------- */
.wx-group-avatar {
  width: 48px; height: 48px; border-radius: 8px; overflow: hidden;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  gap: 1px; background: var(--wx-line, #e5e5e5); flex: 0 0 auto;
}
.wx-group-avatar-cell {
  background-size: cover; background-position: center; background-color: var(--wx-avatar-bg, #ddd);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #fff; overflow: hidden;
}
.wx-group-avatar-cell.is-empty { background-color: var(--wx-avatar-bg, #e8e8e8); }
.wx-group-avatar-cell.is-more { background-color: #9aa0a6; font-weight: 600; }
/* 列表分组小标题（群 / 单聊之间） */
.wx-list-section {
  font-size: 12px; color: var(--wx-text3, #9a9a9a);
  padding: 10px 16px 4px; background: transparent;
}

/* ---------- 群聊页顶栏：名字 + 成员一行 ---------- */
.wx-group-title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.wx-group-title .ta-wx-name { max-width: 100%; }

/* ---------- 群聊消息：发言人名字 + 头像占位 ---------- */
/* 外层盒子做三件事：名字在上气泡在下的纵向排列、宽度受行宽约束、不被 flex 压缩挤没。
   为什么必须显式给 min-width:0 —— .ta-msg .ta-bubble 上写着 max-width:68%，
   百分比是**相对这个盒子**解析的。盒子若也是收缩宽度，68% 会相对一个很小的基准算，
   气泡被压窄成窄条。所以这里把盒子的宽度基准钉在"行宽减去头像"，气泡的 68% 才有意义。
   同时盒子自身要收缩到内容宽（align-items 决定），否则气泡会被撑满、头像与文字之间空一大段。 */
.wx-msg-box {
  display: flex; flex-direction: column; align-items: flex-start;
  flex: 0 1 auto; min-width: 0; max-width: calc(100% - 48px);
}
.wx-msg-name { font-size: 11px; color: var(--wx-text3, #9a9a9a); margin: 0 0 2px 2px; }
.ta-msg.user .wx-msg-box { align-items: flex-end; }
/* 连发合并时补一个等宽空位，保持气泡左边缘对齐 */
.ta-avatar-spacer { visibility: hidden; }
.ta-avatar-fallback, .wx-avatar-fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff; background: #b9b2ad;
}

/* ---------- 输入区：@ chip ---------- */
.wx-input-wrap { flex: 0 0 auto; background: var(--wx-bg, #f7f7f7); border-top: 1px solid var(--wx-line, #e5e5e5); }
.wx-mention-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; }
.wx-mention-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(7,193,96,.12); color: #07c160;
  border-radius: 12px; padding: 2px 8px; font-size: 13px;
}
.wx-mention-x {
  border: 0; background: transparent; color: inherit; font-size: 15px; line-height: 1;
  cursor: pointer; padding: 0 0 0 2px;
}
.wx-input-row { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
/* ⛔ 白底输入框必须自带主题文字色，不能用 color: inherit：
   半梦主题（data-theme=dark）与梦信主题互相独立，App 深色时 inherit 会拿到近白的正文色，
   叠在写死的白底上就是白底白字（2026-09-22 实测对比度 1.15，同样是"打字看不见"）。 */
.wx-input {
  flex: 1; min-height: 36px; max-height: 120px; resize: none;
  border: 1px solid var(--wx-line, #e5e5e5); border-radius: 6px;
  padding: 8px 10px; font-size: 15px; font-family: inherit; line-height: 1.4;
  background: var(--wx-cell); color: var(--wx-text);
}
.wx-input:focus { outline: none; border-color: rgba(7,193,96,.6); }
/* @ 选人入口：长按头像只能 @ 到已经说过话的人（头像才在屏幕上），
   而"点名让沉默的人开口"恰恰最需要 @——所以输入区必须有一个不依赖历史的入口。 */
.wx-at-btn {
  flex: 0 0 auto; width: 36px; height: 36px; border: 1px solid var(--wx-line, #e5e5e5);
  border-radius: 6px; background: #fff; color: #07c160;
  font-size: 18px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.wx-at-btn:active { background: var(--wx-press); }
.wx-at-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
}
.wx-at-sheet {
  width: 100%; max-width: 540px; background: var(--wx-cell); color: var(--wx-text);
  border-radius: 12px 12px 0 0;
  padding-bottom: env(safe-area-inset-bottom); max-height: 70vh; overflow-y: auto;
}
.wx-at-title { font-size: 13px; color: var(--wx-text3, #9a9a9a); padding: 14px 16px 6px; }
.wx-at-cancel {
  display: block; width: 100%; height: 48px; border: 0; border-top: 1px solid var(--wx-sep, #f2f2f2);
  background: transparent; font-size: 15px; font-family: inherit; cursor: pointer; color: inherit;
}
.wx-send {
  flex: 0 0 auto; height: 36px; padding: 0 16px; border: 0; border-radius: 6px;
  background: #07c160; color: #fff; font-size: 15px; font-family: inherit; cursor: pointer;
}
.wx-send:disabled { background: #c8c9cc; cursor: default; }

/* ---------- 建群页 ---------- */
.wx-pick-count { font-size: 13px; color: var(--wx-text3, #9a9a9a); }
.wx-pick-cell { position: relative; }
.wx-pick-cell.picked { background: rgba(7,193,96,.06); }
.wx-pick-check {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--wx-line, #ddd);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; flex: 0 0 auto;
}
.wx-pick-cell.picked .wx-pick-check { background: #07c160; border-color: #07c160; }
.wx-pick-footer {
  flex: 0 0 auto; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--wx-line, #e5e5e5); background: var(--wx-bg, #f7f7f7);
}
.wx-pick-ok {
  width: 100%; height: 44px; border: 0; border-radius: 6px;
  background: #07c160; color: #fff; font-size: 16px; font-family: inherit; cursor: pointer;
}
.wx-pick-ok:disabled { background: #c8c9cc; cursor: default; }

/* ---------- 群设置 / 群记忆 ---------- */
.wx-entry-value { flex: 1; text-align: right; color: var(--wx-text3, #9a9a9a); font-size: 15px; }
.wx-entry-cell.wx-danger .wx-entry-label { color: #fa5151; }
.wx-group-section { font-size: 12px; color: var(--wx-text3, #9a9a9a); padding: 10px 16px 6px; }
.wx-mem-scroll { padding-bottom: 32px; }
.wx-mem-intro {
  font-size: 13px; line-height: 1.6; color: var(--wx-text3, #8a8a8a);
  padding: 14px 16px 6px;
}
/* ⛔ 同 .wx-input：白卡要自带主题文字色，否则 App 深色时卡内文字继承到近白色 = 白底白字 */
.wx-mem-card {
  background: var(--wx-cell); color: var(--wx-text);
  margin: 10px 12px; border-radius: 10px; padding: 12px 14px;
}
.wx-mem-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.wx-mem-title { font-size: 14px; font-weight: 600; }
.wx-mem-edit {
  border: 1px solid rgba(7,193,96,.5); background: transparent; color: #07c160;
  border-radius: 12px; padding: 2px 10px; font-size: 12px; font-family: inherit; cursor: pointer;
}
.wx-mem-text { font-size: 14px; line-height: 1.65; white-space: pre-wrap; }
.wx-mem-empty { font-size: 13px; color: var(--wx-text3, #9a9a9a); padding: 4px 0; }
.wx-mem-atom { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-top: 1px solid #f2f2f2; }
.wx-mem-atom:first-of-type { border-top: 0; }
.wx-mem-cat {
  flex: 0 0 auto; font-size: 11px; color: #07c160; background: rgba(7,193,96,.1);
  border-radius: 8px; padding: 1px 6px; margin-top: 2px;
}
.wx-mem-atom-text { flex: 1; font-size: 14px; line-height: 1.55; word-break: break-word; }
.wx-mem-ops { flex: 0 0 auto; display: flex; gap: 6px; }
.wx-mem-op {
  border: 1px solid var(--wx-line, #ddd); background: transparent; color: inherit;
  border-radius: 10px; padding: 1px 8px; font-size: 12px; font-family: inherit; cursor: pointer;
}
.wx-mem-op-danger { color: #fa5151; border-color: rgba(250,81,81,.4); }
.wx-mem-weave {
  display: block; width: calc(100% - 24px); margin: 16px 12px 0; height: 44px;
  border: 0; border-radius: 10px; background: var(--primary, #6b5b8e); color: #fff;
  font-size: 15px; font-family: inherit; cursor: pointer;
}
.wx-mem-weave:disabled { opacity: .6; cursor: default; }
