/* ── Global ───────────────────────────────────────────────────────── */
:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-dim: #6b6b6b;
  --border: #e8e6e0;
  --user-bubble: #2563eb;
  --user-text: #ffffff;
  --bot-bubble: #f3f1ec;
  --bot-text: #1a1a1a;
  --accent: #2563eb;
  --danger: #dc2626;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.5;
}

button {
  font: inherit;
  cursor: pointer;
}

input, textarea {
  font: inherit;
}

a { color: var(--accent); text-decoration: none; }

/* ── Chat page layout ──────────────────────────────────────────────── */
.chat-body {
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

.container {
  max-width: 720px;
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.avatar-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: #ddd;
  border: 2px solid var(--surface);
}

.status-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.header-text h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;        /* 最多两行，超出省略 */
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (max-width: 480px) {
  .subtitle { font-size: 11.5px; }   /* 窄屏缩字号，整句两行内放得下 */
}

/* Header buttons (mute + refresh) */
.header-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.header-btn:hover { background: rgba(0,0,0,.04); }
#refresh-btn { margin-left: auto; }
.mute-btn.muted {
  border-color: var(--text-dim);
  color: var(--text-dim);
  background: rgba(0,0,0,.03);
}

/* 历史消息：淡化以跟"当前"对话区分 */
.msg.history-msg { opacity: 0.62; }
.msg.history-msg .audio-btn { display: none; }
.history-divider {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  padding: 4px 0;
  margin: 4px 0;
  letter-spacing: 0.5px;
}

/* ── Chat area ─────────────────────────────────────────────────────── */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 15.5px;
  line-height: 1.55;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.msg.user {
  align-self: flex-end;
  background: var(--user-bubble);
  color: var(--user-text);
  border-bottom-right-radius: 4px;
}

.msg.bot {
  align-self: flex-start;
  background: var(--bot-bubble);
  color: var(--bot-text);
  border-bottom-left-radius: 4px;
}

.msg.bot.thinking,
.msg.bot.thinking-mode {
  background: transparent;
  color: var(--text-dim);
  font-style: italic;
}

/* "小李正在想" loader：保留光标的闪烁就够了，不再加点点动画
   （之前的 width-animation 跟 inline 布局打架会让点点飘起来） */

/* 打字光标 ▏闪烁 */
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: currentColor;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursor-blink 1s steps(2, end) infinite;
}
@keyframes cursor-blink {
  0%, 50%   { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.msg .audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 4px 10px;
  font-size: 12px;
  background: rgba(0,0,0,.05);
  border: none;
  border-radius: 12px;
  color: var(--text-dim);
}

.msg .audio-btn:hover { background: rgba(0,0,0,.1); }
.msg .audio-btn.playing { background: var(--accent); color: white; }

/* Markdown rendering inside AI bubbles */
.msg.bot .msg-body strong { font-weight: 600; }
.msg.bot .msg-body em { font-style: italic; }
.msg.bot .msg-body code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-size: 0.92em;
}
.msg.bot .msg-body pre {
  background: rgba(0, 0, 0, 0.06);
  padding: 10px 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0;
  font-family: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-size: 0.88em;
  line-height: 1.5;
}
.msg.bot .msg-body pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}
.msg.bot .msg-body h3,
.msg.bot .msg-body h4 {
  font-size: 1.02em;
  font-weight: 600;
  margin: 12px 0 4px;
}
.msg.bot .msg-body ul,
.msg.bot .msg-body ol {
  margin: 6px 0 6px 0;
  padding-left: 22px;
}
.msg.bot .msg-body li { margin: 2px 0; }
.msg.bot .msg-body p { margin: 0 0 6px; }

.msg.welcome {
  align-self: center;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  max-width: 100%;
  text-align: center;
}

/* ── Composer ──────────────────────────────────────────────────────── */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  /* 横屏 iPhone notch / 圆角:左右内边距吃掉 safe-area 避免按钮被裁 */
  padding: 10px max(12px, env(safe-area-inset-right))
           max(10px, env(safe-area-inset-bottom))
           max(12px, env(safe-area-inset-left));
  border-top: 1px solid var(--border);
  background: var(--surface);
  /* 兜底:溢出永远不裁(按钮宁可下行也不消失) */
  flex-wrap: nowrap;
}

.composer textarea {
  flex: 1 1 0;
  min-width: 0;             /* iOS Safari flex 兼容:不加这条 textarea 不会缩,会把右侧按钮挤出屏幕 */
  resize: none;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  font-size: 16px;          /* iOS Safari < 16px 会自动放大页面;改 16px 防版心整体偏移 */
  max-height: 140px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s;
}

.composer textarea:focus {
  border-color: var(--accent);
}

.composer button {
  width: 40px;
  height: 40px;
  min-width: 40px;          /* iOS 防被父级 flex 压扁 */
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
}

.composer button:disabled {
  background: var(--text-dim);
  cursor: not-allowed;
}

/* ── Admin login ───────────────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 360px;
  margin: 16px;
  padding: 32px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
  text-align: center;
}

.login-card input {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  outline: none;
}

.login-card input:focus { border-color: var(--accent); }

.login-card button {
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
}

.login-card .error {
  color: var(--danger);
  margin: 0;
  text-align: center;
  font-size: 14px;
}

/* ── Admin dashboard ───────────────────────────────────────────────── */
.admin-body {
  min-height: 100dvh;
  background: var(--bg);
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.admin-header h1 { margin: 0; font-size: 18px; }

.link-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  padding: 4px 8px;
}
.link-btn:hover { color: var(--text); }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  padding: 16px 24px;
  max-width: 100%;
}

.stat-card {
  padding: 14px 18px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 24px;
  font-weight: 600;
}

.admin-main {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  padding: 0 24px 24px;
  min-height: 60dvh;
}

@media (max-width: 720px) {
  .admin-main { grid-template-columns: 1fr; }
}

.visitor-list {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  max-height: 70dvh;
  overflow-y: auto;
}

.visitor-list h2 { margin: 0 0 10px; font-size: 14px; color: var(--text-dim); font-weight: 500; }

.visitor-list ul { list-style: none; padding: 0; margin: 0; }

.visitor-item {
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
  border-bottom: 1px solid var(--border);
}

.visitor-item:hover { background: var(--bg); }
.visitor-item.active { background: rgba(37,99,235,.08); }

.vname { font-weight: 500; font-size: 14px; }

.vmeta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.vlast {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty { padding: 24px; text-align: center; color: var(--text-dim); }

.chat-detail {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  max-height: 70dvh;
  overflow-y: auto;
}

.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-dim);
}

.detail-header { padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.detail-header h2 { margin: 0 0 4px; font-size: 16px; }
.detail-meta { font-size: 12px; color: var(--text-dim); }

.detail-messages { display: flex; flex-direction: column; gap: 8px; }

.detail-msg {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
}

.detail-msg.user { background: var(--user-bubble); color: var(--user-text); align-self: flex-end; max-width: 80%; }
.detail-msg.assistant { background: var(--bot-bubble); align-self: flex-start; max-width: 80%; }
.detail-msg .ts { display: block; font-size: 10px; opacity: .6; margin-top: 2px; }


/* ── 语音输入麦克风按钮 ───────────────────────── */
.composer .mic-btn {
  background: #d6f3e0;
  color: #2e9e5b;
  cursor: pointer;
}
.composer .mic-btn:hover { background: #c4ecd2; }
.composer .mic-btn.recording {
  background: #e8453c; color: #fff;
  animation: micpulse 1s infinite;
}
.composer .mic-btn.processing,
.composer .mic-btn:disabled { background: #f3c14b; color: #fff; cursor: wait; }
@keyframes micpulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }


/* ── 录音指示条（音浪 + 正在聆听 + 计时）───────────── */
.rec-indicator {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  margin: 0 12px 6px;
  background: #fdecea;
  border: 1px solid #f5c6c0;
  border-radius: 12px;
  color: #c0392b;
  font-size: 13px;
}
.rec-indicator.show { display: flex; }
.rec-wave { display: flex; align-items: center; gap: 3px; height: 20px; }
.rec-wave span {
  width: 3px; height: 6px; border-radius: 2px;
  background: #e8453c;
  animation: recwave 0.9s infinite ease-in-out;
}
.rec-wave span:nth-child(2) { animation-delay: 0.15s; }
.rec-wave span:nth-child(3) { animation-delay: 0.30s; }
.rec-wave span:nth-child(4) { animation-delay: 0.45s; }
.rec-wave span:nth-child(5) { animation-delay: 0.60s; }
@keyframes recwave { 0%, 100% { height: 6px; } 50% { height: 18px; } }
.rec-timer { font-variant-numeric: tabular-nums; font-weight: 600; }
.rec-hint { margin-left: auto; opacity: 0.7; font-size: 12px; }


/* ── 视频数字人舞台 ───────────────────────── */
.avatar-stage {
  position: relative;
  width: 200px;
  height: 267px;
  margin: 10px auto 4px;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .14);
  flex-shrink: 0;
}
.avatar-stage[hidden] { display: none; }
.av-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .2s ease;
}


/* ── 视频版：抖音式全屏布局（仅 body.avatar-on 生效，不影响文字版）── */
body.avatar-on .container { position: relative; }
body.avatar-on .avatar-stage {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  margin: 0; border-radius: 0;
  z-index: 0;
}
/* 底部渐变压暗，保证叠加文字可读 */
body.avatar-on .container::before {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 48%;
  background: linear-gradient(to top, rgba(0,0,0,.38), rgba(0,0,0,0));
  z-index: 1;
  pointer-events: none;
}
/* 顶栏浮在视频上，渐隐 */
body.avatar-on .header {
  position: absolute; left: 0; right: 0; top: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,.92), rgba(255,255,255,0));
  border-bottom: none;
  z-index: 10;
}
/* 对话区：透明、消息贴底、可上滑看历史 */
body.avatar-on .chat-area {
  flex: 0 0 auto;
  width: 80%;                 /* 加宽匹配红框 */
  height: 30vh;               /* 收矮，露出下巴/脖子 */
  margin-top: auto;           /* 推到底部 */
  margin-right: auto;         /* 靠左 → 左下区域 */
  position: relative;
  z-index: 5;
  gap: 5px;                   /* 消息间距收紧 */
  background: transparent;
  overflow-y: auto;
  scrollbar-width: none;          /* Firefox 隐藏滚动条 */
  -ms-overflow-style: none;       /* 旧 Edge */
}
body.avatar-on .chat-area::-webkit-scrollbar { width: 0; height: 0; display: none; }
body.avatar-on .chat-area > *:first-child { margin-top: auto; }
/* 视频版：气泡缩小、行距收紧、段落间不空行 */
body.avatar-on .msg {
  font-size: 12.5px;
  line-height: 1.34;
  padding: 6px 10px;
  border-radius: 13px;
  max-width: 90%;
}
body.avatar-on .msg-body br + br { display: none; }   /* 折叠空行 */
body.avatar-on .msg-body p { margin: 0 0 2px; }
/* 气泡在视频上加底色 + 阴影，确保清晰 */
body.avatar-on .msg.bot {
  background: rgba(255,255,255,.94);
  box-shadow: 0 1px 8px rgba(0,0,0,.22);
}
body.avatar-on .msg.user { box-shadow: 0 1px 8px rgba(0,0,0,.22); }
body.avatar-on .msg.welcome,
body.avatar-on .history-divider {
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.75);
}
/* 输入栏半透明浮在底部 */
body.avatar-on .composer {
  position: relative;
  background: rgba(255,255,255,.95);
  border-top: none;
  z-index: 10;
}


/* ── 视频版：缩放方式 = contain（完整露出头到胸，不怼脸）av-layer contain ── */
body.avatar-on .avatar-stage {
  background: #887b75;   /* 窗帘褐色 */
}
body.avatar-on .avatar-stage::after {
  content: '';
  position: absolute; inset: 0;
  z-index: 0;            /* 在视频层(1/2)之下、舞台底色之上 */
  background: url('/static/avatar_clips/bg.jpg') center / cover no-repeat;
  filter: blur(10px);
  opacity: .6;           /* 让褐色透出，整体偏褐 */
  pointer-events: none;
}
body.avatar-on .av-layer {
  left: 50%; right: auto;
  width: auto;                   /* 宽度按视频原比例 */
  height: 100%;                  /* 竖向填满，消除上下空缺 */
  transform: translateX(-50%);   /* 水平居中 */
  object-fit: cover;
  object-position: center;
}


/* ── 视频版：顶栏加底衬 + 三按钮加背景，更明显 ── */
body.avatar-on .header {
  background: linear-gradient(to bottom, rgba(255,255,255,.96), rgba(255,255,255,.6) 55%, rgba(255,255,255,0));
  padding-bottom: 22px;
}
body.avatar-on .header-btn {
  background: rgba(255,255,255,.9);
  box-shadow: 0 1px 5px rgba(0,0,0,.2);
}
body.avatar-on .header-btn:hover { background: #fff; }


/* ── 视频版底栏与录音条 ── */
/* 改动2：举报邮箱栏用输入框浅底，贴底可读 */
body.avatar-on .chat-footer {
  position: relative;
  z-index: 10;
  background: rgba(255,255,255,.95);
  margin: 0;
}
body.avatar-on .chat-footer a { color: #9aa0a6 !important; }
/* 改动6：录音指示条（音浪+计时+背景）提到最上层，别被视频/遮罩盖住 */
body.avatar-on .rec-indicator {
  position: relative;
  z-index: 12;
  margin: 0 8px 6px;
}


/* ── 视频版：对话区顶部渐隐（抖音式淡出）── */
body.avatar-on .chat-area {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 18%);
}


/* ── 移动端"点击播放"提示（覆盖在模糊静态图中央）── */
.tap-hint {
  position: absolute; inset: 0;
  z-index: 8;
  display: none;
  flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px;
  pointer-events: none;
  color: #fff; font-size: 14px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .6);
}
body.avatar-on .tap-hint:not([hidden]) { display: flex; }
.tap-ring {
  width: 66px; height: 66px; border-radius: 50%;
  background: rgba(0, 0, 0, .32);
  border: 2px solid rgba(255, 255, 255, .85);
  display: flex; align-items: center; justify-content: center;
  animation: tapPulse 1.4s ease-in-out infinite;
}
@keyframes tapPulse {
  0%, 100% { transform: scale(1); opacity: .9; }
  50% { transform: scale(1.12); opacity: 1; }
}


/* ── 切换按钮图标：深灰（不要纯黑，淡一点）── */
.av-icon { color: #5f6368; display: inline-flex; }
.av-icon svg { display: block; }


/* ── 按钮交互：去高亮/焦点框 + 按下变暗反馈 ── */
.header-btn, .composer button, .composer .mic-btn, #avatar-toggle, button, a {
  -webkit-tap-highlight-color: transparent;   /* 去移动端点击黄/橙高亮 */
}
.header-btn:focus, .composer button:focus, .composer .mic-btn:focus { outline: none; }
.header-btn:focus-visible, .composer button:focus-visible, .composer .mic-btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;   /* 仅键盘聚焦才显示框 */
}
/* 按下反馈：背景变暗 */
.header-btn:active { background: rgba(0,0,0,.12); filter: brightness(.92); }
body.avatar-on .header-btn:active { background: rgba(0,0,0,.2); }
.composer button:active { filter: brightness(.84); }
.composer .mic-btn:active { filter: brightness(.9); }


/* ── 摄像头预览小窗（中央左侧，让用户看到数字人看到了什么）── */
.cam-preview {
  position: fixed;
  left: 16px; top: 46%;
  transform: translateY(-50%);
  width: 150px;
  z-index: 9;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 3px 16px rgba(0, 0, 0, .4);
  background: #000;
}
.cam-preview[hidden] { display: none; }
.cam-preview video { display: block; width: 100%; }
.cam-preview span {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: 11px; color: #fff; text-align: center;
  padding: 3px 0; background: rgba(0, 0, 0, .55);
}


/* ── 语音识别中：指示条变黄（只留文字）── */
.rec-indicator.processing {
  background: #fdf3d6;
  border-color: #f0d98c;
  color: #9a7d1e;
}
.rec-indicator.processing .rec-wave,
.rec-indicator.processing .rec-timer,
.rec-indicator.processing .rec-hint { display: none; }


/* 摄像头预览：冻结帧（不透明，盖住 video 防黑闪）*/
.cam-preview img {
  position: absolute; top: 0; left: 0;
  width: 100%; display: block;
}
.cam-preview img[hidden] { display: none; }


/* 摄像头预览：翻转 / 关闭 按钮（仅实时预览时显示）*/
.cam-btn {
  position: absolute; top: 6px;
  width: 27px; height: 27px;
  border: none; border-radius: 50%;
  background: rgba(0, 0, 0, .5); color: #fff;
  font-size: 13px; line-height: 1; padding: 0;
  display: none; align-items: center; justify-content: center;
  cursor: pointer; z-index: 3;
}
.cam-preview.live .cam-btn { display: flex; }
.cam-flip { left: 6px; font-size: 15px; }
.cam-close { right: 6px; }
.cam-btn:active { background: rgba(0, 0, 0, .75); }


/* 摄像头预览：实时 video 与冻结 img 都在普通流内，谁显示谁撑开盒子（修复冻结帧变小）*/
.cam-preview video,
.cam-preview img {
  position: static;
  display: block;
  width: 100%;
  height: auto;
}
.cam-preview video[hidden],
.cam-preview img[hidden] { display: none; }


/* ── 加号面板（上传图片 / 开启摄像头）── */
.container { position: relative; }
.plus-panel {
  position: absolute;
  right: 12px; bottom: 80px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .2);
  padding: 6px;
  z-index: 30;
  min-width: 158px;
}
.plus-panel[hidden] { display: none; }
.plus-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 11px 12px;
  border: none; background: none;
  font-size: 15px; color: #222;
  cursor: pointer; border-radius: 10px; text-align: left;
}
.plus-item:active { background: rgba(0, 0, 0, .06); }
.plus-ico { font-size: 20px; width: 24px; text-align: center; }


/* ── 上传图片缩略图（输入框上方）── */
.img-thumbs {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px 0;
}
.img-thumbs[hidden] { display: none; }
.img-thumb {
  position: relative;
  width: 56px; height: 56px;
  border-radius: 8px; overflow: hidden;
  background: #eee;
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-thumb-x {
  position: absolute; top: 0; right: 0;
  width: 18px; height: 18px; padding: 0;
  border: none; border-radius: 0 0 0 8px;
  background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 11px; line-height: 18px; cursor: pointer;
}


/* ── 情绪识别调试框（左上角，opt-in）── */
.emo-box {
  position: fixed;
  left: 12px; top: 92px;
  width: 150px;
  z-index: 40;
  border-radius: 12px; overflow: hidden;
  background: #000;
  box-shadow: 0 3px 16px rgba(0, 0, 0, .4);
}
.emo-box[hidden] { display: none; }
.emo-box video { display: block; width: 100%; }
.emo-label {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, .6); color: #6cff8e;
  font-size: 14px; font-weight: 600; text-align: center;
  padding: 4px 0;
}
.emo-close {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; padding: 0;
  border: none; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 12px; line-height: 22px; cursor: pointer;
}

/* 本体 VIP 徽章 (只在 cookie 验证通过时显示,贴在「小李」名字旁) */
#owner-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
  font-size: 11px; font-weight: 600;
  background: linear-gradient(135deg, #fff8e1, #ffe082);
  border: 1px solid #d4a017; color: #6b4f00;
  padding: 1px 7px; border-radius: 10px;
  line-height: 1.5; white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
#owner-badge[hidden] { display: none; }
