/* ===== 蓓蓓：店里的 AI 助手浮窗（web/js/beibei.js 画的 DOM）。右下角圆形小人，点开是小浮窗；手机上铺满全屏。
   外观照 guide.css 的 .wzg（白底、16 圆角、软阴影、蓝底标题条、13px 字）。颜色全走 theme.css 的变量；
   只有绿（对）和红（错/危险）、暖色的“客户”头像是自己写的。所有选择器都挂在 .bb- 类名上，不影响别的页面。 ===== */

.bb-root, .bb-root * { box-sizing: border-box; }
.bb-root {
  --bb-ink: var(--ink, #1C2026);
  --bb-ink-2: var(--ink-2, #4A515C);
  --bb-ink-3: var(--ink-3, #6A717C);
  --bb-line: var(--line, #DDE3EA);
  --bb-line-soft: var(--line-soft, #EAEEF2);
  --bb-blue: var(--carbon, #1A5DB0);
  --bb-wash: var(--carbon-wash, #EAF1FB);
  --bb-seal: var(--seal, #C42A1F);
  --bb-primary: var(--primary, #1C2026);
  --bb-primary-hover: var(--primary-hover, #2A3442);
  --bb-red: #A32A22;
  --bb-red-bg: #FFF0EE;
  --bb-green: #16844A;
  --bb-green-bg: #E9F7EF;
  position: fixed; right: 18px; bottom: 18px; z-index: 1400;
  color: var(--bb-ink); font-family: var(--font, system-ui, sans-serif); font-size: 13px; line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
.bb-root[hidden] { display: none; }
/* 重置：放在最前面，后面的 .bb- 类按先后顺序覆盖它 */
.bb-root :where(button, textarea) { font: inherit; }
.bb-root :where(button) { cursor: pointer; }
.bb-root :where(p, ul, ol, pre, details, table) { margin: 0; }
.bb-root :where(ul, ol) { padding-left: 20px; }
.bb-root :where(pre) { padding: 0; }
.bb-root a { color: var(--bb-blue); }

/* ───────── 右下角的小人（launcher） ───────── */
.bb-launch {
  position: relative; display: block; width: 60px; height: 60px; padding: 3px; border: 1px solid rgba(26, 93, 176, .22); border-radius: 50%;
  background: #fff; color: inherit; line-height: 0;
  box-shadow: 0 0 0 3px #fff, 0 12px 28px -8px rgba(28, 32, 38, .5), 0 2px 6px rgba(28, 32, 38, .18);
  animation: bb-bob 1.2s ease-in-out 3;   /* 登录后浮三下就停：够醒目，也不让按钮一直在动（自动化点不中、晃眼） */
}
.bb-launch:hover { animation-play-state: paused; box-shadow: 0 0 0 3px #fff, 0 0 0 5px rgba(26, 93, 176, .22), 0 14px 30px -8px rgba(28, 32, 38, .55), 0 2px 6px rgba(28, 32, 38, .18); }
.bb-launch:focus-visible { outline: 2px solid var(--bb-blue); outline-offset: 4px; }
.bb-avatar { display: block; flex: none; border-radius: 50%; }
.bb-launch .bb-avatar { width: 100%; height: 100%; }
/* 3D 形象图头像：浅蓝圆底 + 圆形裁切（图本身是透明底，底部已渐隐） */
.bb-avatar[data-mood-img] { overflow: hidden; background: radial-gradient(circle at 50% 38%, #fff 0, var(--carbon-wash, #EAF1FB) 72%); }
.bb-avatar[data-mood-img] img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bb-launch-tip {
  position: absolute; right: calc(100% + 12px); top: 50%; transform: translateY(-50%);
  padding: 6px 12px; border: 1px solid var(--bb-line); border-radius: 999px; background: #fff; color: var(--bb-ink);
  font-size: 13px; font-weight: 600; line-height: 1.4; white-space: nowrap; pointer-events: none;
  box-shadow: 0 8px 20px -10px rgba(28, 32, 38, .45);
}
.bb-launch-tip::after {
  content: ""; position: absolute; right: -5px; top: 50%; width: 8px; height: 8px; margin-top: -4px;
  border-top: 1px solid var(--bb-line); border-right: 1px solid var(--bb-line); background: #fff; transform: rotate(45deg);
}
.bb-root.is-open .bb-launch { display: none; }
@keyframes bb-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* ───────── 浮窗外壳 ───────── */
.bb-panel {
  position: fixed; right: 18px; bottom: 18px; z-index: 1; width: 400px; max-width: calc(100vw - 20px); height: min(640px, calc(100vh - 40px));
  display: flex; flex-direction: column; overflow: hidden; overscroll-behavior: contain;
  border: 1px solid rgba(26, 93, 176, .28); border-radius: 16px; background: rgba(255, 255, 255, .98); color: var(--bb-ink);
  box-shadow: 0 18px 44px -14px rgba(28, 32, 38, .42), 0 2px 6px rgba(28, 32, 38, .1);
  transform-origin: bottom right;   /* 从右下角（小人所在处）弹出来 */
  animation: bb-pop .26s cubic-bezier(.34, 1.45, .64, 1);
}
.bb-panel[hidden] { display: none; }
.bb-panel.wide { width: min(760px, calc(100vw - 40px)); height: calc(100vh - 40px); }
@keyframes bb-pop { from { opacity: 0; transform: translateY(14px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes bb-sheet { from { opacity: .5; transform: translateY(100%); } to { opacity: 1; transform: none; } }

.bb-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border-bottom: 1px solid var(--bb-line-soft); background: var(--bb-wash); }
.bb-head-text { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.bb-head-text strong { font-size: 15px; font-weight: 650; line-height: 1.3; }
.bb-head-text span { overflow: hidden; color: var(--bb-ink-3); font-size: 12px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.bb-icon { flex: none; width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 1px solid var(--bb-line); border-radius: 8px; background: #fff; color: var(--bb-ink-2); font-size: 16px; line-height: 1; }
.bb-icon:hover { border-color: #B9BEC6; color: var(--bb-ink); }

.bb-tabs { flex: none; display: flex; border-bottom: 1px solid var(--bb-line-soft); background: #fff; }
.bb-tab { flex: 1 1 0; min-width: 0; height: 38px; padding: 0 8px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--bb-ink-3); font-size: 13px; font-weight: 600; }
.bb-tab:hover { color: var(--bb-ink); background: rgba(28, 32, 38, .03); }
.bb-tab.on { border-bottom-color: var(--bb-blue); color: var(--bb-blue); }

/* 专家团：一排药丸，放不下就横着滑 */
.bb-experts {
  flex: none; display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; padding: 8px 12px; overflow-x: auto; overflow-y: hidden;
  border-bottom: 1px solid var(--bb-line-soft); background: #fff; -webkit-overflow-scrolling: touch;
}
.bb-experts::-webkit-scrollbar { height: 4px; }
.bb-experts::-webkit-scrollbar-button { display: none; }
.bb-experts::-webkit-scrollbar-thumb { border-radius: 2px; background: var(--bb-line); }
@supports (-moz-appearance: none) { .bb-experts { scrollbar-width: thin; } }
.bb-chip {
  flex: none; display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 11px 0 9px; border: 1px solid var(--bb-line); border-radius: 999px;
  background: #fff; color: var(--bb-ink-2); font-size: 12.5px; font-weight: 600; line-height: 1; white-space: nowrap;
}
.bb-chip b { font-size: 13px; font-weight: 700; line-height: 1; color: var(--bb-blue); }
.bb-chip:hover { border-color: #B9BEC6; color: var(--bb-ink); }
.bb-chip.on { border-color: var(--bb-blue); background: var(--bb-blue); color: #fff; }
.bb-chip.on b { color: #fff; }

/* ───────── 对话区 ───────── */
.bb-log {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: #F7F9FB; background: color-mix(in srgb, var(--bb-line-soft) 40%, #fff);
}
.bb-msg { flex: none; min-width: 0; display: flex; align-items: flex-start; gap: 8px; }
.bb-msg.me { justify-content: flex-end; }
.bb-bubble {
  min-width: 0; max-width: 85%; padding: 9px 12px; border: 1px solid var(--bb-line); border-radius: 4px 14px 14px 14px; background: #fff; color: var(--bb-ink);
  font-size: 13px; line-height: 1.6; overflow-wrap: anywhere;
}
.bb-bubble.wide { flex: 1 1 0; max-width: calc(100% - 36px); }
.bb-bubble > * + * { margin-top: 8px; }
.bb-bubble > .bb-who + * { margin-top: 6px; }
.bb-msg.me .bb-bubble { border-color: rgba(26, 93, 176, .2); border-radius: 14px 4px 14px 14px; background: var(--bb-wash); white-space: pre-wrap; }
.bb-bubble.bad { border-color: rgba(163, 42, 34, .28); background: var(--bb-red-bg); color: var(--bb-red); }
.bb-bubble.cust { border-color: #EBD9C6; background: #FBF4EC; }
.bb-bubble ul, .bb-bubble ol { padding-left: 20px; }
.bb-bubble li + li { margin-top: 3px; }
.bb-bubble small { color: var(--bb-ink-3); font-size: 12px; }
.bb-bubble summary { cursor: pointer; }

.bb-expert-badge, .bb-cust { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-size: 14px; font-weight: 700; line-height: 1; }
.bb-expert-badge { background: var(--bb-blue); color: #fff; }
.bb-cust { background: #F3E3D3; color: var(--bb-ink); }
.bb-who { color: var(--bb-ink-2); font-size: 12px; font-weight: 650; line-height: 1.4; }
.bb-who small { margin-left: 2px; font-weight: 400; }

/* 引导问题 */
.bb-samples { display: flex; flex-wrap: wrap; gap: 6px; }
.bb-sample { max-width: 100%; padding: 5px 11px; border: 1px solid rgba(26, 93, 176, .28); border-radius: 999px; background: var(--bb-wash); color: var(--bb-blue); font-size: 12.5px; line-height: 1.4; text-align: left; }
.bb-sample:hover { border-color: var(--bb-blue); background: #fff; }

/* 系统行：已识别 … → 转接 xx */
.bb-route { flex: none; align-self: center; max-width: 100%; padding: 2px 8px; color: var(--bb-ink-3); font-size: 12px; line-height: 1.6; text-align: center; overflow-wrap: anywhere; }
.bb-route b { color: var(--bb-ink-2); font-weight: 650; }
.bb-route small { display: block; margin-top: 2px; color: var(--bb-ink-3); font-size: 11.5px; line-height: 1.5; }
.bb-route-tag, .bb-danger-tag { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 18px; vertical-align: 1px; white-space: nowrap; }
.bb-route-tag { margin-right: 4px; background: var(--bb-wash); color: var(--bb-blue); }
.bb-danger-tag { border: 1px solid rgba(163, 42, 34, .25); background: var(--bb-red-bg); color: var(--bb-red); line-height: 16px; }
.bb-arrow { color: var(--bb-blue); font-weight: 700; }
.bb-spin { display: inline-block; flex: none; width: 12px; height: 12px; margin-right: 6px; vertical-align: -2px; border: 2px solid rgba(26, 93, 176, .25); border-top-color: var(--bb-blue); border-radius: 50%; animation: bb-spin .8s linear infinite; }
@keyframes bb-spin { to { transform: rotate(360deg); } }

/* ───────── 回答的各块 ───────── */
.bb-safety { padding: 9px 12px; border: 1px solid rgba(163, 42, 34, .22); border-left: 4px solid var(--bb-seal); border-radius: 0 10px 10px 0; background: var(--bb-red-bg); }
.bb-safety strong { color: var(--bb-red); font-weight: 700; }
.bb-safety ol { margin-top: 6px; padding-left: 20px; }
.bb-safety small { display: block; margin-top: 6px; color: var(--bb-ink-3); }
.bb-points { padding-left: 20px; }
.bb-points li + li { margin-top: 6px; }
.bb-points li::marker { color: var(--bb-ink-3); font-weight: 600; }
.bb-ref {
  display: inline-block; min-width: 22px; height: 20px; margin: 0 1px; padding: 0 6px; border: 1px solid var(--bb-blue); border-radius: 6px; background: #fff; color: var(--bb-blue);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; vertical-align: 1px;
}
.bb-ref:hover { background: var(--bb-wash); }
.bb-ref.on { background: var(--bb-blue); color: #fff; }

.bb-source { overflow: hidden; border: 1px solid var(--bb-line); border-radius: 10px; background: #fff; }
.bb-source-head { padding: 7px 10px; border-bottom: 1px solid var(--bb-line-soft); background: var(--bb-wash); color: var(--bb-ink-2); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.bb-source-head b { margin-right: 4px; color: var(--bb-blue); }
.bb-bubble .bb-source pre, .bb-source pre { max-height: 220px; margin: 0; padding: 8px 10px; overflow: auto; border: 0; border-radius: 0; background: transparent; }
.bb-source > small { display: block; padding: 6px 10px 8px; border-top: 1px solid var(--bb-line-soft); color: var(--bb-ink-3); font-size: 11.5px; line-height: 1.5; overflow-wrap: anywhere; }
.bb-source > .bb-note { margin: 0 10px 8px; }

.bb-note { padding: 6px 10px; border-radius: 8px; background: var(--yellow-bg, #FFF6DF); color: var(--bb-ink-2); font-size: 12px; line-height: 1.6; }
.bb-note.bad { background: var(--bb-red-bg); color: var(--bb-red); }
.bb-muted { color: var(--bb-ink-3); font-size: 12px; line-height: 1.6; }
.bb-follow { padding-left: 8px; border-left: 3px solid var(--bb-line); color: var(--bb-ink-2); }

/* 系统查数（价目表、库存） */
.bb-facts { overflow-x: auto; overflow-y: hidden; border: 1px solid var(--bb-line); border-radius: 10px; background: #fff; }
.bb-facts-head { padding: 7px 10px; border-bottom: 1px solid var(--bb-line-soft); background: var(--bb-wash); font-size: 12.5px; font-weight: 650; line-height: 1.5; }
.bb-facts-head small { margin-left: 6px; font-weight: 400; }
.bb-facts table { width: 100%; border-collapse: collapse; font-size: 12px; line-height: 1.5; }
.bb-facts th, .bb-facts td { padding: 5px 8px; border-bottom: 1px solid var(--bb-line-soft); text-align: left; vertical-align: top; }
.bb-facts th { color: var(--bb-ink-3); font-weight: 600; white-space: nowrap; }
.bb-facts td:first-child { min-width: 0; overflow-wrap: anywhere; }
.bb-facts th:not(:first-child), .bb-facts td:not(:first-child) { text-align: right; white-space: nowrap; }
.bb-facts tbody tr:last-child td { border-bottom: 0; }
.bb-facts > small { display: block; padding: 5px 10px 7px; border-top: 1px solid var(--bb-line-soft); color: var(--bb-ink-3); font-size: 11.5px; }

/* 出处列表 */
.bb-sources { overflow: hidden; border: 1px solid var(--bb-line-soft); border-radius: 10px; background: #fff; }
.bb-sources > summary { padding: 6px 10px; color: var(--bb-ink-2); font-size: 12px; font-weight: 600; }
.bb-source-row { width: 100%; min-width: 0; display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; border: 0; border-top: 1px solid var(--bb-line-soft); border-radius: 0; background: transparent; color: var(--bb-ink); font-size: 12px; line-height: 1.5; text-align: left; overflow-wrap: anywhere; }
.bb-source-row:hover { background: var(--bb-wash); }
.bb-source-row b { flex: none; min-width: 22px; color: var(--bb-blue); font-weight: 700; }
.bb-source-row span { flex: none; padding: 0 6px; border-radius: 6px; background: var(--bb-line-soft); color: var(--bb-ink-3); font-size: 11px; line-height: 18px; }

/* 按钮 */
.bb-actions, .bb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.bb-act { min-height: 30px; max-width: 100%; padding: 4px 12px; border: 1px solid var(--bb-line); border-radius: 9px; background: #fff; color: var(--bb-ink); font-size: 12.5px; font-weight: 600; line-height: 1.35; text-align: center; }
.bb-act:hover { border-color: #B9BEC6; }
.bb-act.primary { border-color: var(--bb-primary); background: var(--bb-primary); color: #fff; }
.bb-act.primary:hover { border-color: var(--bb-primary-hover); background: var(--bb-primary-hover); }
.bb-mini { flex: none; min-height: 24px; padding: 0 9px; border: 1px solid var(--bb-line); border-radius: 7px; background: #fff; color: var(--bb-ink-2); font-size: 12px; font-weight: 600; line-height: 1.3; }
.bb-mini:hover { border-color: #B9BEC6; color: var(--bb-ink); }

/* ───────── 新人练手 ───────── */
.bb-coach-bar { flex: none; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--bb-line-soft); background: #fff; }
.bb-coach-bar .bb-chip { height: 26px; cursor: default; }
.bb-coach-bar .bb-chip.on:hover { border-color: var(--bb-blue); color: #fff; }
.bb-mode { min-width: 0; flex: 1 1 auto; overflow: hidden; color: var(--bb-ink-3); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.bb-weak { display: inline-block; margin: 0 4px 4px 0; padding: 0 8px; border-radius: 999px; background: var(--bb-red-bg); color: var(--bb-red); font-size: 12px; font-weight: 600; line-height: 20px; }
.bb-suggest { display: grid; gap: 8px; min-width: 0; padding: 10px 12px; border: 1px solid rgba(26, 93, 176, .28); border-radius: 12px; background: var(--bb-wash); }
.bb-suggest > div { min-width: 0; display: grid; gap: 2px; }
.bb-suggest > .bb-row { display: flex; gap: 6px; }
.bb-suggest small { color: var(--bb-blue); font-size: 11.5px; font-weight: 700; }
.bb-suggest b { font-size: 14px; font-weight: 650; line-height: 1.4; }
.bb-suggest span { color: var(--bb-ink-2); font-size: 12.5px; }
.bb-items { overflow: hidden; border: 1px solid var(--bb-line); border-radius: 10px; background: #fff; }
.bb-items > summary { padding: 7px 10px; color: var(--bb-ink-2); font-size: 12.5px; font-weight: 600; }
.bb-item { min-width: 0; display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-top: 1px solid var(--bb-line-soft); }
.bb-item > span { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.bb-item b { font-size: 13px; font-weight: 600; line-height: 1.4; }
.bb-item small { font-size: 11.5px; line-height: 1.4; }

.bb-step { color: var(--bb-ink-3); font-size: 12px; font-weight: 600; }
.bb-step .bb-weak { margin: 0 0 0 2px; background: var(--bb-line-soft); color: var(--bb-ink-2); }
.bb-trap, .bb-root .bad { color: var(--bb-red); }
.bb-quote { padding: 8px 10px; border-left: 3px solid var(--bb-blue); border-radius: 0 8px 8px 0; background: var(--bb-wash); }
.bb-basis { overflow: hidden; border: 1px solid var(--bb-line-soft); border-radius: 8px; background: #fff; }
.bb-basis > summary { padding: 5px 10px; color: var(--bb-ink-2); font-size: 12px; }
.bb-basis > pre { max-height: 180px; margin: 0 8px 8px; overflow: auto; }
.bb-teach { padding: 8px 10px; border-radius: 10px; background: var(--bb-wash); }
.bb-teach > * + * { margin-top: 6px; }
.bb-score { font-size: 26px; font-weight: 750; letter-spacing: -.01em; line-height: 1.25; }
.bb-bubble .bb-checks, .bb-checks { padding: 0; display: grid; gap: 4px; list-style: none; }
.bb-checks li { padding: 5px 8px; border-radius: 8px; font-size: 13px; line-height: 1.5; }
.bb-checks li + li { margin-top: 0; }
.bb-checks li.ok { background: var(--bb-green-bg); color: #1F5E3D; }
.bb-checks li.no { background: var(--bb-red-bg); color: var(--bb-red); }
.bb-checks li small { display: block; margin-top: 2px; color: var(--bb-ink-3); font-size: 12px; }
.bb-comments { color: var(--bb-ink-2); }

/* 预格式文字（客户原话、出处原文、程序读到的内容）：自动换行、不撑宽 */
.bb-bubble pre, .bb-source pre, .bb-basis pre {
  max-width: 100%; padding: 8px 10px; border: 1px solid var(--bb-line-soft); border-radius: 8px; background: rgba(28, 32, 38, .045); color: var(--bb-ink);
  font: 12.5px/1.6 var(--font, system-ui, sans-serif); white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: auto;
}
.bb-bubble.cust pre { padding: 0; border: 0; background: transparent; font-size: 13px; }
.bb-bubble pre.bb-quote { border: 0; border-left: 3px solid var(--bb-blue); border-radius: 0 8px 8px 0; background: var(--bb-wash); }

/* ───────── 动起来（只用 transform / opacity / mask，不动宽高位置，不卡） ─────────
   规则：render() 会整块重画，所以入场动画只挂在 JS 打了 .bb-enter / .bb-reveal 的“新出现”元素上，旧消息不会重播。
   .bb-launch 按钮本身不做循环动画（自动化点击要等它静止），循环的只有里面的头像。 */

/* 蓓蓓的头像：按 .bb-root[data-mood] 换动作。默认（idle）= 慢呼吸。右下角小人和浮窗标题条里的头像才会动 */
.bb-launch .bb-avatar, .bb-head .bb-avatar { transform-origin: 50% 88%; animation: bb-breathe 3.2s ease-in-out infinite; }
.bb-root[data-mood="thinking"] .bb-head .bb-avatar { animation: bb-sway 1.8s ease-in-out infinite; }
.bb-root[data-mood="talking"] .bb-head .bb-avatar { animation: bb-nod .44s ease-in-out infinite; }
.bb-root[data-mood="happy"] .bb-head .bb-avatar { animation: bb-hop .72s cubic-bezier(.3, .7, .4, 1) 1; }
@keyframes bb-breathe { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-1px) scale(1.04); } }
@keyframes bb-sway { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes bb-nod { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(2px) scale(1.02, .97); } }
@keyframes bb-hop {
  0% { transform: translateY(0) scale(1); }
  16% { transform: translateY(0) scale(1.08, .9); }
  42% { transform: translateY(-8px) scale(.96, 1.07); }
  68% { transform: translateY(0) scale(1.06, .94); }
  84% { transform: translateY(-2px) scale(1); }
  100% { transform: none; }
}

/* 新气泡：从下方淡入滑入（蓓蓓的从左、用户自己的从右），头像/专家徽章跟着“啵”一下 */
.bb-msg.bb-enter { transform-origin: 0 100%; animation: bb-in-left .32s cubic-bezier(.34, 1.4, .64, 1); }
.bb-msg.me.bb-enter { transform-origin: 100% 100%; animation-name: bb-in-right; }
.bb-msg.bb-enter > .bb-avatar, .bb-msg.bb-enter > .bb-expert-badge, .bb-msg.bb-enter > .bb-cust { animation: bb-badge .42s cubic-bezier(.34, 1.7, .5, 1) .05s backwards; }
.bb-route.bb-enter { animation: bb-fade .3s ease-out; }
@keyframes bb-in-left { from { opacity: 0; transform: translate(-8px, 12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes bb-in-right { from { opacity: 0; transform: translate(8px, 12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes bb-badge { from { opacity: 0; transform: scale(.5); } to { opacity: 1; transform: none; } }
@keyframes bb-fade { from { opacity: 0; } to { opacity: 1; } }

/* 流式“写出来”：一条要点从左到右被擦开（mask 软边），同时轻轻上移淡入。
   列表圆点原本画在 li 盒子外面，会被 mask 遮掉；所以 li 向左多撑出 20px（margin 与 padding 抵消，文字位置不变），
   圆点改用 ::before 画在盒子里面（大小、颜色、位置照原生圆点），这样圆点也跟着一起被擦出来。
   mask 的静止状态 = 全部显示，所以动画放完不用 fill，也不会留下半透明。 */
.bb-reveal {
  position: relative; margin-left: -20px; padding-left: 20px; list-style: none;
  -webkit-mask-image: linear-gradient(100deg, #000 40%, transparent 60%); mask-image: linear-gradient(100deg, #000 40%, transparent 60%);
  -webkit-mask-size: 250% 100%; mask-size: 250% 100%; -webkit-mask-position: 0 0; mask-position: 0 0; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  animation: bb-wipe .6s cubic-bezier(.4, .1, .3, 1), bb-rise .5s ease-out;
}
.bb-reveal::before { content: ""; position: absolute; left: 3px; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--bb-ink-3); }
@keyframes bb-wipe { from { -webkit-mask-position: 100% 0; mask-position: 100% 0; } to { -webkit-mask-position: 0 0; mask-position: 0 0; } }
@keyframes bb-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* “正在输入”三点跳动 */
.bb-typing { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 2px; vertical-align: middle; }
.bb-typing i { display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--bb-blue); opacity: .35; animation: bb-dot 1.2s ease-in-out infinite; }
.bb-typing i:nth-child(2) { animation-delay: .16s; }
.bb-typing i:nth-child(3) { animation-delay: .32s; }
@keyframes bb-dot { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

/* “刘工正在写第 2 条…”：一道亮光从左扫到右（只改文字透明度的 mask，不动布局） */
.bb-stream-status {
  display: block; color: var(--bb-ink-2); font-size: 12px; line-height: 1.6;
  -webkit-mask-image: linear-gradient(105deg, rgba(0, 0, 0, .75) 40%, #000 50%, rgba(0, 0, 0, .75) 60%); mask-image: linear-gradient(105deg, rgba(0, 0, 0, .75) 40%, #000 50%, rgba(0, 0, 0, .75) 60%);
  -webkit-mask-size: 250% 100%; mask-size: 250% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  animation: bb-shimmer 1.8s linear infinite;
}
@keyframes bb-shimmer { from { -webkit-mask-position: 100% 0; mask-position: 100% 0; } to { -webkit-mask-position: 0 0; mask-position: 0 0; } }

/* 小细节：按钮悬停/按下有过渡，输入框聚焦不“啪”地一变 */
.bb-launch { transition: box-shadow .2s ease; }
.bb-launch-tip { animation: bb-tip-in .4s ease-out .5s backwards; }
@keyframes bb-tip-in { from { opacity: 0; transform: translate(8px, -50%); } to { opacity: 1; transform: translateY(-50%); } }
.bb-tab, .bb-chip, .bb-sample, .bb-act, .bb-mini, .bb-icon, .bb-send, .bb-ref, .bb-source-row, .bb-input textarea {
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.bb-chip:active, .bb-sample:active, .bb-act:active, .bb-mini:active, .bb-icon:active, .bb-ref:active, .bb-send:active:not(:disabled) { transform: scale(.95); }

/* ───────── 输入条 ───────── */
.bb-input {
  flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--bb-line-soft); background: #fff;
}
.bb-input textarea {
  flex: 1 1 auto; min-width: 0; min-height: 40px; max-height: 120px; padding: 9px 12px; border: 1px solid var(--bb-line); border-radius: 12px; background: #fff; color: var(--bb-ink);
  font-size: 14px; line-height: 20px; resize: none; field-sizing: content;
}
.bb-input textarea::placeholder { color: var(--bb-ink-3); }
.bb-input textarea:focus { outline: none; border-color: var(--bb-blue); box-shadow: 0 0 0 3px rgba(26, 93, 176, .14); }
.bb-send { flex: none; height: 40px; padding: 0 16px; border: 1px solid var(--bb-primary); border-radius: 12px; background: var(--bb-primary); color: #fff; font-size: 13px; font-weight: 600; }
.bb-send:hover:not(:disabled) { border-color: var(--bb-primary-hover); background: var(--bb-primary-hover); }

/* ───────── 平板 / 手机 ───────── */
@media (max-width: 850px) {
  /* 手机底部有一条导航栏：小人抬高一点，别压在上面 */
  .bb-root { right: 12px; bottom: 96px; }
}
@media (max-width: 640px) {
  .bb-launch-tip { display: none; }
  .bb-panel, .bb-panel.wide { inset: 0; width: auto; max-width: none; height: 100vh; height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
  .bb-icon[data-bb="wide"] { display: none; }
  .bb-head { padding: 10px 12px; }
  .bb-input textarea { font-size: 16px; }
  .bb-bubble { max-width: 90%; }
  .bb-bubble.wide { max-width: calc(100% - 36px); }
}
@media (max-width: 640px) {
  /* 手机上整屏的浮窗：从底部滑上来 */
  .bb-panel, .bb-panel.wide { transform-origin: 50% 100%; animation: bb-sheet .32s cubic-bezier(.22, .9, .3, 1); }
}
@media (prefers-reduced-motion: reduce) {
  .bb-launch, .bb-panel, .bb-spin { animation: none; }
  /* 新加的动画（头像、气泡、擦开、三点、闪光、悬停过渡）全部关掉 */
  .bb-root *, .bb-root *::before, .bb-root *::after { animation: none !important; transition: none !important; }
  .bb-root .bb-reveal, .bb-root .bb-stream-status { -webkit-mask-image: none; mask-image: none; }
}

/* ───────── 管家：蓓蓓替你走的几步、红线只指不点 ───────── */
.bb-did { margin-top: 6px; padding-left: 0; list-style: none; color: var(--bb-ink-3); font-size: 12px; }
.bb-did li + li { margin-top: 2px; }
.bb-bubble.bb-refuse { border-color: #E9C46A; background: #FFF8E6; }
.bb-point-ring[hidden] { display: none; }

/* ───────── 和「蓓蓓带你试」引导协调（beibei.js 的 GUIDE / guide.js 的 wzg:state） ─────────
   引导卡就是蓓蓓此刻的样子：电脑上启动按钮留在卡下面，旁边的小字换成“带你试 04 · 1/3”；
   手机上引导是贴底的一块，启动按钮让出来（引导卡头上有“问蓓蓓”）。打开对话时引导卡自己藏起来，面板顶上钉一条状态。 */
.bb-root.is-guiding .bb-launch-tip { border-color: var(--bb-blue); background: var(--bb-blue); color: #fff; }
.bb-root.is-guiding .bb-launch-tip::after { border-color: var(--bb-blue); background: var(--bb-blue); }
.bb-guide-bar { flex: none; display: flex; align-items: center; gap: 10px; padding: 7px 12px 7px 14px; border-bottom: 1px solid var(--bb-line-soft); background: var(--bb-wash); color: var(--bb-ink-2); font-size: 12.5px; }
.bb-guide-text { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-guide-back { flex: none; min-height: 28px; padding: 0 12px; border: 1px solid var(--bb-blue); border-radius: 8px; background: #fff; color: var(--bb-blue); font-size: 12.5px; font-weight: 650; }
.bb-guide-back:hover { background: var(--bb-blue); color: #fff; }
@media (max-width: 640px) {
  body:has(.wzg:not([hidden])) .bb-launch { display: none; }
}
