:root {
  --bg-app: #f3f4f7;
  --bg-surface: #ffffff;
  --bg-chat: #f0f1f4;
  --bg-subtle: #f7f8fa;
  --text-1: #111827;
  --text-2: #4b5563;
  --text-3: #8e95a2;
  --hairline: rgba(15, 23, 42, 0.08);
  --hairline-strong: rgba(15, 23, 42, 0.14);
  --wechat-green: #95ec69;
  --emerald: #07c160;
  --emerald-soft: rgba(7, 193, 96, 0.10);
  --obsidian: #111827;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.03), 0 8px 24px rgba(15, 23, 42, 0.04);
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg-app); color: var(--text-1); font-family: var(--font-sans); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
[hidden] { display: none !important; }

.sb-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 304px;
  height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
  background: var(--bg-surface);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.06);
}
/* 剧本杀模式：右栏放「本」（案情/秘密/在场者），不是日常资料卡；三栏布局照常。 */
.sb-shell.sb-script-mode { grid-template-columns: 248px minmax(0, 1fr) 320px !important; }
@media (max-width: 1024px) {
  .sb-shell.sb-script-mode { grid-template-columns: 200px minmax(0, 1fr) 280px !important; }
}
@media (max-width: 720px) {
  .sb-shell.sb-script-mode { grid-template-columns: 1fr !important; }
}
/* 角色广场（2026-11-25）：右栏是聊天页的伴侣状态/关系共鸣/动态/签到，与挑角色无关。
   整页隐藏，中间占满；!important 覆盖 #toggleRightBtn 写的内联三列网格（点了就一直那样）。 */
.sb-shell.sb-plaza-mode .sb-right { display: none !important; }
@media (min-width: 1025px) {
  .sb-shell.sb-plaza-mode { grid-template-columns: 248px minmax(0, 1fr) !important; }
}
@media (min-width: 721px) and (max-width: 1024px) {
  .sb-shell.sb-plaza-mode { grid-template-columns: 200px minmax(0, 1fr) !important; }
}
@media (max-width: 720px) {
  .sb-shell.sb-plaza-mode { grid-template-columns: 1fr !important; }
}

/* 左侧栏 */
.sb-left {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-right: 1px solid var(--hairline);
  padding: 16px 14px;
  gap: 14px;
  overflow: hidden;
}
.sb-brand { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px; }
.sb-logo-mark { display: flex; align-items: center; gap: 8px; }
.sb-pulse-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 4px var(--emerald-soft);
}
.sb-brand-name { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.sb-brand-tag {
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em;
  padding: 2px 6px; border-radius: 999px;
  background: var(--bg-subtle); color: var(--text-2); border: 1px solid var(--hairline);
}

.sb-char-strip {
  display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-height: 0;
  padding-bottom: 10px; border-bottom: 1px solid var(--hairline);
}
.sb-char-strip.collapsed { flex: 0 0 auto; }
.sb-char-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2px; font-size: 12px; color: var(--text-3); flex-shrink: 0;
}
.sb-char-head-left {
  display: flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; user-select: none;
}
.sb-char-head-left:hover { color: var(--text-1); }
.sb-char-caret { display: inline-block; transition: transform .18s ease; font-size: 10px; }
.sb-char-strip.collapsed .sb-char-caret { transform: rotate(-90deg); }
.sb-char-add-btn {
  font-size: 11.5px; font-weight: 600; color: var(--emerald);
  padding: 2px 7px; border-radius: 6px; background: var(--emerald-soft);
}
.sb-char-add-btn:hover { background: rgba(7, 193, 96, 0.18); }
.sb-char-list {
  display: flex; flex-direction: column; gap: 6px;
  flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; padding-right: 2px;
}
.sb-char-pill {
  display: flex; align-items: center; gap: 11px; width: 100%; flex-shrink: 0;
  padding: 9px 10px; border-radius: 12px;
  background: transparent; border: 1px solid transparent;
  font-size: 13px; font-weight: 500; text-align: left; transition: background .15s, border-color .15s;
}
.sb-char-pill:hover { background: var(--bg-subtle); border-color: var(--hairline); }
.sb-char-pill.active {
  background: rgba(7, 193, 96, 0.09);
  color: var(--text-1);
  border-color: rgba(7, 193, 96, 0.22);
  box-shadow: inset 3px 0 0 var(--emerald);
}
.sb-char-pill.active .sb-char-pill-sub { color: var(--text-2); opacity: 0.9; }
.sb-char-pill.active .sb-char-pill-time { color: #059669; opacity: 0.9; }
.sb-char-pill .mini-ava {
  position: relative; width: 38px; height: 38px; min-width: 38px; border-radius: 50%;
  overflow: visible; flex-shrink: 0;
  background: #e5e7eb; color: #111827; display: grid; place-items: center; font-size: 14px; font-weight: 600;
}
.sb-char-pill .mini-ava img,
.sb-char-pill .mini-ava video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 20%; border-radius: 50%; display: block;
}
/* 动态头像：所有头像容器里的 video 与 img 同尺寸裁切，圆形容器由父级 overflow 保证 */
.sb-avatar-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sb-char-pill-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sb-char-pill-name {
  font-size: 13.5px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-char-pill-sub {
  font-size: 11.5px; line-height: 1.3; margin-top: 3px; opacity: 0.72; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-char-pill-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--emerald); flex-shrink: 0;
}
.sb-char-pill:not(.active) .sb-char-pill-dot { opacity: 0.35; }
.sb-char-unread {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: #ef4444; color: #fff; font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center; flex-shrink: 0; line-height: 1;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35);
}
.sb-char-pill.has-unread:not(.active) {
  background: rgba(239, 68, 68, 0.04); border-color: rgba(239, 68, 68, 0.16);
}
.sb-char-pill.has-unread:not(.active) .sb-char-pill-name { color: #111827; font-weight: 700; }

.sb-nav { display: flex; flex-direction: column; gap: 3px; flex: 0 0 auto; margin-top: auto; padding-top: 2px; }
.sb-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  transition: background .15s, color .15s; text-align: left;
}
.sb-nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; }
.sb-nav-item:hover { background: var(--bg-subtle); color: var(--text-1); }
.sb-nav-item.active {
  background: #eef1f5; color: var(--text-1); font-weight: 600;
}
.sb-nav-item.active svg { opacity: 1; color: var(--obsidian); }
.sb-nav-item.disabled {
  opacity: 0.42; color: var(--text-3); cursor: not-allowed;
}
.sb-nav-item.disabled:hover { background: transparent; color: var(--text-3); }

.sb-user-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--radius-md);
  background: var(--bg-subtle); border: 1px solid var(--hairline);
}
.sb-user-avatar {
  width: 34px; height: 34px; border-radius: 50%; overflow: hidden;
  background: var(--obsidian); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.sb-user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sb-user-meta { flex: 1; min-width: 0; }
.sb-user-name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sb-user-meta b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-tier {
  flex-shrink: 0; font-size: 10px; font-weight: 700; letter-spacing: 0.02em;
  padding: 1.5px 6px; border-radius: 999px; line-height: 1.3;
  background: rgba(15, 23, 42, 0.06); color: var(--text-2); border: 1px solid var(--hairline);
}
.sb-user-tier.tier-plus {
  background: rgba(14, 165, 233, 0.12); color: #0369a1; border-color: rgba(14, 165, 233, 0.28);
}
.sb-user-tier.tier-pro {
  background: rgba(7, 193, 96, 0.12); color: #047857; border-color: rgba(7, 193, 96, 0.30);
}
.sb-user-tier.tier-max {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(217, 119, 6, 0.12));
  color: #b45309; border-color: rgba(245, 158, 11, 0.38);
}
.sb-user-meta small { font-size: 11.5px; color: var(--text-3); }

.sb-icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center; color: var(--text-2); position: relative;
  transition: background .15s, color .15s;
}
.sb-icon-btn svg { width: 17px; height: 17px; }
.sb-icon-btn:hover { background: rgba(15, 23, 42, 0.05); color: var(--text-1); }
.sb-dot-badge {
  position: absolute; top: 6px; right: 6px; width: 7px; height: 7px;
  border-radius: 50%; background: #ef4444; border: 1.5px solid #fff;
}

/* 中央主舞台 */
.sb-center { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg-chat); position: relative; }
.sb-stage { display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; }

.sb-chat-head {
  height: 62px; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--hairline);
  z-index: 5;
}
/* 手机端聊天页返回按钮：桌面默认隐藏，仅窄屏显示 */
.sb-chat-back {
  display: none; width: 34px; height: 34px; flex: none; border: 0; background: transparent;
  font-size: 30px; line-height: 1; color: var(--text-1, #0f172a); cursor: pointer; padding: 0 4px;
  -webkit-tap-highlight-color: transparent;
}
.sb-head-left { display: flex; align-items: center; gap: 12px; }
.sb-head-avatar {
  width: 36px; height: 36px; border-radius: 50%; overflow: hidden;
  background: var(--obsidian); color: #fff; display: grid; place-items: center; font-weight: 600;
  cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.sb-head-avatar:hover { transform: scale(1.04); box-shadow: 0 2px 10px rgba(15, 23, 42, 0.14); }
.sb-head-avatar img, .sb-head-avatar video { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.sb-head-title { display: flex; align-items: center; gap: 8px; }
.sb-head-title strong { font-size: 15px; font-weight: 600; }
.sb-ai-chip {
  font-size: 10px; font-weight: 500; padding: 1px 6px; border-radius: 4px;
  background: var(--bg-subtle); color: var(--text-3); border: 1px solid var(--hairline);
}
.sb-head-sub { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* 连接状态徽章（参照 App 截图"⚡已连接"）：在线=绿色闪电，离线=灰。
   默认在线；加 .offline 切离线样式。文字由 JS 填"在线/离线"。 */
.sb-conn-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: var(--emerald); background: var(--emerald-soft); width: fit-content;
}
.sb-conn-text::before {
  content: ''; display: inline-block; width: 11px; height: 11px; margin-right: 3px;
  vertical-align: -1px;
  /* 绿色闪电 */
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13 2 4.5 13.5H11l-1 8.5L19.5 10H13l1-8z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13 2 4.5 13.5H11l-1 8.5L19.5 10H13l1-8z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.sb-conn-badge.offline { color: var(--text-3); background: var(--bg-subtle); }
.sb-conn-badge.typing { color: var(--emerald); background: var(--emerald-soft); }
.sb-conn-badge.offline .sb-conn-text::before {
  /* 离线：月亮图标代替闪电 */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12.5 3a9 9 0 1 0 8.5 11.5A7 7 0 0 1 12.5 3z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12.5 3a9 9 0 1 0 8.5 11.5A7 7 0 0 1 12.5 3z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.sb-conn-badge-sm { padding: 1px 7px; font-size: 11px; }
/* 离线时状态徽章旁的「呼叫上线」（原叫醒，仅改名，逻辑不变） */
.sb-call-online {
  padding: 2px 9px; border-radius: 999px; font-size: 11px; line-height: 1.5; font-weight: 600;
  color: var(--emerald); background: var(--emerald-soft);
  border: 1px solid var(--emerald); cursor: pointer;
}
.sb-call-online:hover { background: rgba(7, 193, 96, 0.18); }
/* 陪伴电量条（2026-11-19）：满电绿/低电黄/没电灰，充电按钮 */
.sb-power { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.sb-power-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-2, #8a8f98); }
.sb-power-bar { height: 7px; border-radius: 999px; background: var(--bg-subtle, #eef0f2); overflow: hidden; }
.sb-power-fill { height: 100%; width: 100%; border-radius: 999px; background: var(--emerald); transition: width .4s ease, background .3s; }
.sb-power-fill.low { background: #f5a623; }
.sb-power-fill.empty { background: #c2c7cd; }
.sb-power-charge { align-self: flex-start; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--emerald); background: var(--emerald-soft); border: 1px solid var(--emerald); cursor: pointer; }
.sb-power-charge:hover { background: rgba(7, 193, 96, .18); }
/* 她的动态 feed（替换思维共鸣光晕，2026-11-19） */
.sb-moments-feed { display: flex; flex-direction: column; gap: 8px; }
.sb-moment-item { padding: 8px 10px; border-radius: 10px; background: var(--bg-subtle, #f6f7f9); }
.sb-moment-text { font-size: 12.5px; color: var(--text-1); line-height: 1.5; }
.sb-moment-empty { font-size: 12px; color: var(--text-2, #8a8f98); padding: 6px 2px; }
.sb-head-actions { display: flex; align-items: center; gap: 6px; }

.sb-pill-btn {
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--bg-surface); border: 1px solid var(--hairline-strong); color: var(--text-1);
}
.sb-pill-btn:hover { background: var(--bg-subtle); }

.sb-search-bar {
  padding: 10px 20px; background: var(--bg-surface); border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.sb-search-bar input {
  flex: 1; min-width: 180px; padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--hairline-strong); background: var(--bg-subtle); outline: none; font-size: 13px;
}
.sb-search-results { width: 100%; max-height: 180px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.sb-search-hit { padding: 8px 10px; border-radius: 8px; background: var(--bg-subtle); font-size: 12.5px; }

/* 微信风格消息流 */
.sb-chat-stream {
  flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px;
  display: flex; flex-direction: column; gap: 14px;
}
#chatMessages { display: flex; flex-direction: column; gap: 14px; width: 100%; }
.sb-load-more { text-align: center; margin-bottom: 6px; }
.sb-ts-divider {
  text-align: center; font-size: 11.5px; color: var(--text-3);
  margin: 6px 0; user-select: none;
}
.sb-msg-row { display: flex; align-items: flex-start; gap: 10px; max-width: 78%; }
.sb-msg-row.user { align-self: flex-end; margin-left: auto; flex-direction: row-reverse; }
.sb-msg-row.assistant { align-self: flex-start; margin-right: auto; }

.sb-msg-ava {
  width: 36px; height: 36px; border-radius: 6px; overflow: hidden; flex-shrink: 0;
  background: #d1d5db; color: #111827; display: grid; place-items: center; font-size: 13px; font-weight: 600;
}
.sb-msg-ava img, .sb-msg-ava video { width: 100%; height: 100%; object-fit: cover; }

.sb-bubble {
  padding: 10px 14px; border-radius: 8px; font-size: 14px; line-height: 1.55;
  word-break: break-word; position: relative;
}
.sb-msg-row.assistant .sb-bubble {
  background: #ffffff; color: #111827;
  border: 0.5px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.sb-msg-row.user .sb-bubble {
  background: var(--wechat-green); color: #111827;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 2px rgba(15, 23, 42, 0.04);
}
.sb-bubble.recalled {
  background: rgba(15, 23, 42, 0.05) !important;
  color: var(--text-3) !important; font-size: 12.5px; font-style: italic; box-shadow: none !important;
}
.sb-sticker-img { max-width: 140px; max-height: 140px; border-radius: 10px; display: block; }
/* 微信式语音泡（2026-11-21）：波形+秒数、宽随时长；转文字泡旁按钮；合成中占位 */
.sb-voice-wrap { display: flex; flex-direction: column; gap: 4px; max-width: 260px; }
.sb-voice-line { display: flex; align-items: center; gap: 6px; }
.sb-voice-bubble {
  display: flex; align-items: center; gap: 8px; width: 132px; min-height: 38px;
  padding: 8px 12px; cursor: pointer; position: relative; text-align: left;
}
.sb-voice-playicon { font-size: 11px; line-height: 1; opacity: .85; }
.sb-voice-bubble.playing .sb-voice-playicon { visibility: hidden; }
.sb-voice-wave { display: inline-flex; align-items: center; gap: 2.5px; height: 16px; flex: 1; }
.sb-voice-wave i {
  width: 2.5px; border-radius: 2px; background: currentColor; opacity: .8;
  height: 5px;
}
.sb-voice-wave i:nth-child(2) { height: 10px; }
.sb-voice-wave i:nth-child(3) { height: 14px; }
.sb-voice-wave i:nth-child(4) { height: 9px; }
.sb-voice-wave i:nth-child(5) { height: 6px; }
.sb-voice-bubble.playing .sb-voice-wave i { animation: sb-wave 1s ease-in-out infinite; }
.sb-voice-bubble.playing .sb-voice-wave i:nth-child(2) { animation-delay: .15s; }
.sb-voice-bubble.playing .sb-voice-wave i:nth-child(3) { animation-delay: .3s; }
.sb-voice-bubble.playing .sb-voice-wave i:nth-child(4) { animation-delay: .45s; }
.sb-voice-bubble.playing .sb-voice-wave i:nth-child(5) { animation-delay: .6s; }
@keyframes sb-wave { 0%, 100% { transform: scaleY(.5); } 50% { transform: scaleY(1.25); } }
.sb-voice-dur { font-size: 12px; opacity: .75; white-space: nowrap; }
.sb-voice-dot { width: 6px; height: 6px; border-radius: 50%; background: #fa5151; flex: none; align-self: center; }
.sb-voice-totext {
  border: none; background: none; color: var(--text-3); font-size: 11.5px;
  cursor: pointer; padding: 4px 2px; white-space: nowrap;
}
.sb-voice-totext.on { color: var(--wechat-green, #07c160); font-weight: 600; }
.sb-voice-text {
  background: var(--bg-surface); border: 1px solid var(--hairline-strong);
  border-radius: 10px; padding: 8px 12px; font-size: 12.5px; color: var(--text-2);
  max-width: 240px;
}
.sb-voice-wrap audio { display: none; }

/* 底部输入区 */
.sb-composer-wrap { padding: 12px 20px 18px; background: var(--bg-chat); position: relative; }
.sb-composer {
  background: var(--bg-surface); border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-lg); padding: 10px 14px 8px;
  box-shadow: var(--shadow-card);
}
.sb-composer textarea {
  width: 100%; border: none; outline: none; resize: none; background: transparent;
  font-size: 14px; line-height: 1.5; max-height: 120px; min-height: 24px;
}
.sb-composer-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--hairline);
}
.sb-composer-tools { display: flex; gap: 4px; }
.sb-send-btn {
  padding: 6px 18px; border-radius: 8px;
  background: var(--emerald); color: #fff; font-size: 13px; font-weight: 600;
  transition: opacity .15s;
}
.sb-send-btn:hover { opacity: .92; }
.sb-send-btn:disabled { opacity: .5; cursor: not-allowed; }

.sb-popover {
  position: absolute; bottom: 108px; left: 20px;
  background: var(--bg-surface); border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md); padding: 12px; box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
  z-index: 20; max-width: 320px;
}
.sb-pop-title { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.sb-pop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sb-pop-chip {
  padding: 7px 10px; border-radius: 8px; font-size: 12.5px;
  background: var(--bg-subtle); border: 1px solid var(--hairline); text-align: center;
}
.sb-pop-chip:hover { border-color: var(--emerald); color: var(--emerald); }
.sb-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.sb-emoji-item { font-size: 18px; padding: 4px; border-radius: 6px; }
.sb-emoji-item:hover { background: var(--bg-subtle); }

/* 右侧栏 */
.sb-right {
  background: var(--bg-surface); border-left: 1px solid var(--hairline);
  padding: 16px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto;
}
/* 圆形动态头像（像手机 App 的头像）：居中圆图 + 下方名字，不再是大矩形立绘 */
.sb-portrait-card {
  position: relative; display: flex; flex-direction: column; align-items: center;
  padding: 18px 12px 14px; gap: 10px;
  border-radius: var(--radius-lg); background: var(--bg-subtle);
  border: 1px solid var(--hairline); flex-shrink: 0;   /* 不被下方内容挤压 */
}
.sb-portrait-img {
  width: 132px; height: 132px; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; font-size: 40px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #e5e7eb, #cbd5e1);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.10);
}
.sb-portrait-img img, .sb-portrait-img video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sb-portrait-meta { text-align: center; max-width: 100%; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.sb-portrait-meta h3 { font-size: 16px; font-weight: 600; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-portrait-meta .sb-conn-badge { margin: 0 auto; }
.sb-portrait-meta p { font-size: 12px; opacity: .72; color: var(--text-2); margin-top: 3px;
  width: 100%; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sb-insp-card {
  background: var(--bg-subtle); border: 1px solid var(--hairline);
  border-radius: var(--radius-md); padding: 12px;
}
.sb-insp-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 10px;
}
.sb-badge-soft {
  padding: 2px 8px; border-radius: 999px; font-size: 11px;
  background: var(--emerald-soft); color: #059669;
}
.sb-text-btn { font-size: 12px; color: var(--text-3); }
.sb-text-btn:hover { color: var(--text-1); }

.sb-resonance-row { display: flex; align-items: center; gap: 12px; }
.sb-ring { width: 54px; height: 54px; transform: rotate(-90deg); }
.sb-ring-bg { fill: none; stroke: rgba(15, 23, 42, 0.08); stroke-width: 4; }
.sb-ring-fg { fill: none; stroke: var(--emerald); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .4s; }
.sb-metric-big { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.sb-metric-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.sb-timeline { display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.sb-tl-item { display: flex; gap: 8px; align-items: flex-start; }
.sb-tl-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--emerald); margin-top: 6px; flex-shrink: 0; }

.sb-memory-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sb-mem-chip {
  font-size: 11.5px; padding: 4px 8px; border-radius: 6px;
  background: var(--bg-surface); border: 1px solid var(--hairline); color: var(--text-2);
  transition: border-color .25s, background .25s, box-shadow .25s, color .25s;
}
.sb-mem-chip.hit {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.10);
  color: #047857;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}
.sb-halo-viewport {
  position: relative; height: 156px; border-radius: 12px; overflow: hidden;
  background: radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.96), #eef2f6 82%);
  border: 1px solid var(--hairline);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.sb-halo-viewport canvas { display: block; width: 100%; height: 100%; }
.sb-halo-foot {
  position: absolute; left: 10px; right: 10px; bottom: 8px;
  text-align: center; font-size: 11px; font-weight: 500; letter-spacing: 0.02em;
  color: var(--text-2); pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-notify-btn.granted { color: #059669; }
.sb-notify-btn.denied { opacity: 0.45; }

/* 不用 margin-top:auto：内容变高时它会把顶部头像挤出滚动区（用户反馈的"头像上移看不到"） */
.sb-insp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex-shrink: 0; }
.sb-action-primary {
  padding: 9px 12px; border-radius: 10px; background: var(--obsidian); color: #fff;
  font-size: 12.5px; font-weight: 600; transition: background .15s, color .15s, opacity .15s;
}
.sb-action-primary:disabled {
  background: #e5e7eb; color: #9ca3af; cursor: not-allowed; box-shadow: none;
}
.sb-action-secondary {
  padding: 9px 12px; border-radius: 10px; background: var(--bg-subtle);
  border: 1px solid var(--hairline-strong); color: var(--text-1); font-size: 12.5px; font-weight: 500;
}

/* 子视图 */
.sb-subview { flex: 1; overflow-y: auto; padding: 24px 28px; background: var(--bg-subtle); }
.sb-sub-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.sb-sub-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.sb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.sb-card {
  background: var(--bg-surface); border: 1px solid var(--hairline);
  border-radius: var(--radius-md); padding: 16px; box-shadow: var(--shadow-card);
}
.sb-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.sb-card p { font-size: 13px; color: var(--text-2); line-height: 1.55; }
.sb-plaza-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.sb-plaza-cover {
  position: relative; aspect-ratio: 4/3; background: linear-gradient(135deg, #e5e7eb, #cbd5e1);
  display: grid; place-items: center; overflow: hidden;
}
.sb-plaza-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; display: block; z-index: 1; }
.sb-plaza-init { position: relative; z-index: 0; font-size: 36px; font-weight: 700; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,0.18); }
.sb-plaza-badge {
  position: absolute; top: 10px; right: 10px; padding: 3px 9px; border-radius: 999px; z-index: 2;
  font-size: 11px; font-weight: 600; background: rgba(255,255,255,0.9); color: var(--text-1);
  backdrop-filter: blur(8px);
}
/* 性别角标（2026-11-22）：卡片标题旁轻量标识；无性别数据则不渲染 */
.sb-gender-tag {
  display: inline-block; padding: 1px 7px; border-radius: 999px; margin-left: 4px;
  font-size: 11px; font-weight: 500; vertical-align: middle;
  background: var(--bg-subtle); color: var(--text-2); border: 1px solid var(--border, rgba(0,0,0,0.1));
}
/* 年龄角标（2026-11-27）：与性别角标同构，精确年龄来自 preset_card.age/characters.age */
.sb-age-tag {
  display: inline-block; padding: 1px 7px; border-radius: 999px; margin-left: 4px;
  font-size: 11px; font-weight: 500; vertical-align: middle;
  background: rgba(255,255,255,0.08); color: var(--text-2); border: 1px solid var(--border, rgba(0,0,0,0.1));
}

/* 角色广场分栏标题 */
.sb-plaza-group { margin-bottom: 22px; }
.sb-plaza-group-title {
  display: flex; align-items: center; gap: 8px; margin: 0 0 10px;
  font-size: 14px; font-weight: 500; color: var(--text-1);
}
.sb-msg-row.assistant .sb-msg-ava { cursor: pointer; transition: transform .15s; }
.sb-msg-row.assistant .sb-msg-ava:hover { transform: scale(1.06); }
.sb-farewell-link {
  width: 100%; padding: 8px 10px; border-radius: 9px; font-size: 12px; font-weight: 500;
  color: #dc2626; background: rgba(239, 68, 68, 0.06); border: 1px solid rgba(239, 68, 68, 0.16);
  transition: background .15s, border-color .15s;
}
.sb-farewell-link:hover { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.3); }
.sb-char-row {
  display: flex; flex-direction: column; gap: 10px; padding: 12px;
  border-radius: 10px; background: var(--bg-subtle); border: 1px solid var(--hairline);
}
.sb-char-row + .sb-char-row { margin-top: 8px; }
/* 信息行：圆形头像 + 名字/签名，头像固定不收缩 */
.sb-char-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sb-char-ava {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.sb-char-meta { flex: 1; min-width: 0; }
.sb-char-name { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.sb-char-name b { white-space: nowrap; }
.sb-char-meta small {
  display: block; margin-top: 2px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 操作行：独立成行、自动换行，按钮不挤压、文案不竖排 */
.sb-char-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.sb-char-actions button { white-space: nowrap; }
.sb-btn-danger-soft {
  padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 500;
  color: #dc2626; background: rgba(239, 68, 68, 0.08); border: 1px solid rgba(239, 68, 68, 0.22);
}
.sb-btn-danger-soft:hover { background: rgba(239, 68, 68, 0.16); }
.sb-plaza-init { font-size: 36px; font-weight: 700; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,0.18); }
.sb-plaza-badge {
  position: absolute; top: 10px; right: 10px; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; background: rgba(255,255,255,0.9); color: var(--text-1);
  backdrop-filter: blur(8px);
}
.sb-plaza-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.sb-plaza-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.sb-edit-media { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.sb-media-box {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px;
  background: var(--bg-subtle); border: 1px solid var(--hairline);
}
.sb-media-thumb {
  width: 48px; height: 48px; border-radius: 10px; overflow: hidden; flex-shrink: 0;
  background: #e5e7eb; display: grid; place-items: center; font-weight: 700; color: var(--text-2);
}
.sb-media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sb-form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.sb-form-row label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.sb-form-row input, .sb-form-row textarea, .sb-form-row select {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--hairline-strong);
  background: var(--bg-surface); outline: none;
}
.sb-seg-group { display: inline-flex; background: var(--bg-subtle); border: 1px solid var(--hairline); border-radius: 9px; padding: 3px; gap: 3px; }
.sb-seg-btn { padding: 5px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 500; color: var(--text-2); transition: all .15s; }
.sb-seg-btn.active { background: var(--obsidian); color: #fff; font-weight: 600; }
.sb-mom-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sb-mom-ava { width: 38px; height: 38px; border-radius: 8px; overflow: hidden; background: #e5e7eb; display: grid; place-items: center; font-weight: 600; font-size: 14px; flex-shrink: 0; }
.sb-mom-ava img { width: 100%; height: 100%; object-fit: cover; }
.sb-mom-media { margin-top: 10px; max-width: 340px; border-radius: 12px; overflow: hidden; border: 1px solid var(--hairline); background: var(--bg-subtle); }
.sb-mom-media img { display: block; width: 100%; max-height: 360px; object-fit: cover; cursor: zoom-in; }
.sb-mom-comments { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-2); }
.sb-mom-comment.her b { color: var(--accent, #5b8cff); }
.sb-mom-comment.friend b { color: var(--text-3); }
.sb-mom-cmt-form { display: flex; gap: 8px; margin-top: 8px; }
.sb-mom-cmt-form input { flex: 1; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--hairline-strong); background: var(--bg-subtle); font-size: 12.5px; outline: none; }
.sb-graph-frame-wrap { border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--hairline-strong); background: #070b14; box-shadow: var(--shadow-card); margin-bottom: 18px; }
.sb-graph-frame { width: 100%; height: 600px; border: none; display: block; }

/* 弹窗 & Toast */
.sb-modal {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 50;
}
.sb-modal-card {
  width: min(520px, 92vw); max-height: 84vh; overflow-y: auto;
  background: var(--bg-surface); border-radius: var(--radius-lg);
  padding: 18px 20px; box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}
.sb-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sb-toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: var(--obsidian); color: #fff; padding: 8px 16px; border-radius: 999px;
  font-size: 13px; z-index: 60; box-shadow: 0 10px 28px rgba(0,0,0,0.18);
}

/* 世界寻人转场动画（约5秒多阶段共振校准） */
.sb-world-search {
  position: fixed; inset: 0; z-index: 80; overflow: hidden;
  background: radial-gradient(900px 600px at 50% 42%, rgba(16, 185, 129, 0.16), rgba(7, 11, 20, 0.97) 68%), #070b14;
  backdrop-filter: blur(22px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #f8fafc; text-align: center; padding: 24px;
  animation: sbWsFadeIn .35s ease both;
}
.sb-ws-grid {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.25;
  background-image:
    linear-gradient(rgba(52, 211, 153, 0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(52, 211, 153, 0.10) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 48%, black 15%, transparent 70%);
}
.sb-ws-radar {
  position: relative; width: 248px; height: 248px; margin-bottom: 18px;
  display: grid; place-items: center;
}
.sb-ws-orbit {
  position: absolute; inset: 6px; border-radius: 50%;
  border: 1.5px dashed rgba(56, 189, 248, 0.30);
  animation: sbWsSpinRev 16s linear infinite;
}
.sb-ws-ring {
  position: absolute; inset: 14px; border-radius: 50%;
  border: 1px solid rgba(52, 211, 153, 0.28);
  animation: sbWsPulse 2.6s cubic-bezier(0.2, 0.7, 0.2, 1) infinite;
}
.sb-ws-ring.r2 { animation-delay: .85s; }
.sb-ws-ring.r3 { animation-delay: 1.7s; }
.sb-ws-sweep {
  position: absolute; inset: 24px; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(34, 211, 238, 0.28), rgba(16, 185, 129, 0.14) 24%, transparent 46%);
  animation: sbWsSpin 2.1s linear infinite;
}
.sb-ws-core {
  position: relative; width: 78px; height: 78px; border-radius: 24px; overflow: hidden;
  background: rgba(15, 23, 42, 0.92); border: 1.5px solid rgba(52, 211, 153, 0.65);
  box-shadow: 0 0 40px rgba(16, 185, 129, 0.38);
  display: grid; place-items: center; font-size: 28px; font-weight: 700; color: #34d399;
  transition: transform .5s cubic-bezier(0.2, 0.8, 0.2, 1), border-color .4s ease, box-shadow .4s ease;
}
.sb-ws-core img { width: 100%; height: 100%; object-fit: cover; }
.sb-world-search.matched .sb-ws-core {
  transform: scale(1.12);
  border-color: #fbbf24;
  box-shadow: 0 0 48px rgba(52, 211, 153, 0.55), 0 0 24px rgba(251, 191, 36, 0.40);
}
.sb-ws-dot {
  position: absolute; width: 7px; height: 7px; border-radius: 50%;
  background: #34d399; box-shadow: 0 0 12px #34d399;
  animation: sbWsBlink 1.8s ease-in-out infinite;
}
.sb-ws-dot.d1 { top: 32px; left: 56px; animation-delay: .15s; }
.sb-ws-dot.d2 { bottom: 42px; right: 38px; animation-delay: .65s; }
.sb-ws-dot.d3 { top: 72px; right: 26px; animation-delay: 1.15s; background: #22d3ee; box-shadow: 0 0 12px #22d3ee; }
.sb-ws-dot.d4 { bottom: 54px; left: 34px; animation-delay: .45s; background: #fbbf24; box-shadow: 0 0 12px #fbbf24; }
.sb-ws-dot.d5 { top: 24px; right: 86px; animation-delay: 1.45s; }
.sb-ws-wave {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  height: 28px; margin-bottom: 16px;
}
.sb-ws-wave i {
  display: block; width: 3px; height: 8px; border-radius: 999px;
  background: linear-gradient(180deg, #22d3ee, #10b981);
  animation: sbWsWave 1.1s ease-in-out infinite;
}
.sb-ws-wave i:nth-child(2n) { animation-delay: .18s; }
.sb-ws-wave i:nth-child(3n) { animation-delay: .36s; }
.sb-ws-wave i:nth-child(5n) { animation-delay: .54s; }
.sb-ws-badge {
  font-size: 10.5px; letter-spacing: 0.16em; font-weight: 600;
  color: #34d399; padding: 4px 12px; border-radius: 999px;
  background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(52, 211, 153, 0.28);
  margin-bottom: 12px; position: relative;
}
.sb-ws-title { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 8px; position: relative; }
.sb-ws-sub { font-size: 13.5px; color: rgba(226, 232, 240, 0.74); max-width: 390px; line-height: 1.6; position: relative; }
.sb-ws-prog {
  width: min(320px, 82vw); height: 4px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.10); overflow: hidden; margin-top: 20px; position: relative;
}
.sb-ws-prog-bar {
  height: 100%; width: 8%; border-radius: 999px;
  background: linear-gradient(90deg, #22d3ee, #10b981, #fbbf24);
  transition: width .7s cubic-bezier(0.22, 1, 0.36, 1);
}
.sb-ws-steps {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  margin-top: 14px; position: relative;
}
.sb-ws-steps span {
  font-size: 11px; padding: 3px 10px; border-radius: 999px;
  color: rgba(226, 232, 240, 0.45); background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08); transition: all .3s ease;
}
.sb-ws-steps span.active {
  color: #34d399; background: rgba(16, 185, 129, 0.16); border-color: rgba(52, 211, 153, 0.40);
}
.sb-ws-steps span.done {
  color: #e2e8f0; background: rgba(255, 255, 255, 0.10); border-color: rgba(255, 255, 255, 0.22);
}
@keyframes sbWsFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sbWsSpin { to { transform: rotate(360deg); } }
@keyframes sbWsSpinRev { to { transform: rotate(-360deg); } }
@keyframes sbWsWave {
  0%, 100% { height: 7px; opacity: 0.45; }
  50% { height: 24px; opacity: 1; }
}
@keyframes sbWsPulse {
  0% { transform: scale(0.45); opacity: 0.9; }
  100% { transform: scale(1.15); opacity: 0; }
}
@keyframes sbWsBlink { 0%, 100% { opacity: 0.25; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.25); } }

@media (max-width: 1024px) {
  .sb-shell { grid-template-columns: 200px minmax(0, 1fr); }
  .sb-right { display: none; }
}
@media (max-width: 720px) {
  .sb-shell { grid-template-columns: 1fr; }
  .sb-left { display: none; }
  /* 手机上没有右信息栏，展开按钮无意义；藏掉防止点出三列网格把聊天挤窄。
     !important 是为了压过 toggleRightBtn 写的内联 gridTemplateColumns（点了就一直那样）。 */
  #toggleRightBtn { display: none !important; }
  .sb-shell { grid-template-columns: 1fr !important; }
  /* 子页头部（记忆/相册/钱包等）：窄屏下标题与按钮换行，按钮平分一行，
     避免被挤成竖排（记忆页两个按钮曾竖着排）。 */
  .sb-sub-head { flex-wrap: wrap; gap: 12px; }
  .sb-sub-head > div:last-child { width: 100%; }
  .sb-sub-head > div:last-child > a,
  .sb-sub-head > div:last-child > button { flex: 1; min-width: 0; white-space: nowrap; }
  /* 微信式聊天页：头像+名字居中，左上角返回；桌面端这些样式不生效 */
  /* 返回键固定在左上角，与右侧操作按钮对称；头像+名字仍居中 */
  .sb-chat-back { display: flex !important; position: absolute; left: 8px; top: 50%; transform: translateY(-50%); }
  .sb-chat-head { justify-content: center !important; padding: 0 12px !important; position: relative; }
  .sb-head-left { flex-direction: row; gap: 8px; }
  .sb-head-title { justify-content: center; }
  .sb-head-sub { justify-content: center; }
  .sb-head-actions { position: absolute; right: 8px; }
  /* 会话列表页（微信「对话」） */
  .sb-conv-page { max-width: 620px; margin: 0 auto; }
  .sb-conv-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 4px 14px; }
  .sb-conv-head h2 { font-size: 20px; font-weight: 500; margin: 0; }
  .sb-conv-head button {
    width: 34px; height: 34px; border: 0.5px solid var(--hairline, rgba(15,23,42,.1));
    border-radius: 50%; background: var(--bg-subtle, rgba(15,23,42,.03));
    font-size: 20px; line-height: 1; color: var(--text-1, #0f172a); cursor: pointer;
  }
  .sb-conv-list { border: 0.5px solid var(--hairline, rgba(15,23,42,.08)); border-radius: 12px; overflow: hidden; background: var(--bg-surface, #fff); }
  .sb-conv-row {
    width: 100%; display: flex; align-items: center; gap: 12px; min-height: 68px;
    padding: 10px 12px; border: 0; border-bottom: 0.5px solid var(--hairline, rgba(15,23,42,.08));
    background: transparent; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .sb-conv-row:last-child { border-bottom: 0; }
  .sb-conv-row:active { background: var(--bg-subtle, rgba(15,23,42,.03)); }
  .sb-conv-ava {
    width: 48px; height: 48px; flex: none; border-radius: 10px; overflow: visible; position: relative;
    background: var(--emerald-soft, rgba(7,193,96,.12)); color: var(--emerald, #059669);
    display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 500;
  }
  .sb-conv-ava img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
  .sb-conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
  .sb-conv-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
  .sb-conv-top b { font-size: 14px; font-weight: 500; color: var(--text-1, #0f172a); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sb-conv-top small { font-size: 11px; color: var(--text-3, #94a3b8); flex: none; }
  .sb-conv-sub { font-size: 12px; color: var(--text-2, #64748b); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
/* 移动端底部导航（2026-11-23）：替代被隐藏的左侧栏。默认隐藏，仅窄屏显示。 */
.sb-mobile-nav { display: none; }
@media (max-width: 720px) {
  .sb-mobile-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: calc(58px + env(safe-area-inset-bottom, 0px));
    padding: 0 4px env(safe-area-inset-bottom, 0px);
    background: var(--bg-surface, #fff); border-top: 1px solid var(--hairline, rgba(15,23,42,.08));
    box-shadow: 0 -4px 16px rgba(15, 23, 42, .05);
    justify-content: space-around; align-items: center;
  }
  .sb-mnav-item {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 3px; height: 100%; padding: 6px 2px;
    border: 0; background: transparent; color: var(--text-3, #94a3b8);
    font-size: 11px; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .sb-mnav-item svg { width: 22px; height: 22px; flex: none; }
  .sb-mnav-item.active { color: var(--emerald, #059669); }
  .sb-mnav-item.active svg { stroke-width: 2.1; }
  /* 给底部内容留出导航高度，避免输入框/按钮被挡 */
  .sb-center { padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }
  .sb-subview { padding-bottom: 24px; }
  /* 设置页：卡片去框、组间留白，接近微信的分组列表；内部控件/绑定完全不动 */
  .sb-se-settings { display: block; }
  .sb-se-settings .sb-card {
    border: 0; border-radius: 12px; box-shadow: none; padding: 14px 16px;
    margin-bottom: 14px; background: var(--bg-surface, #fff);
  }
  .sb-se-settings .sb-card h3 { font-size: 13px; color: var(--text-2, #475569); margin: 0 0 10px; }
  .sb-se-page { padding: 4px 0; }
}

/* 微信风「我」/「设置」页（2026-11-23）：原生 App 的列表行，不做卡片网格 */
.sb-se-page { max-width: 620px; margin: 0 auto; }
.sb-se-profile {
  width: 100%; display: flex; align-items: center; gap: 14px;
  padding: 18px 16px; margin-bottom: 18px; border: 0.5px solid var(--hairline, rgba(15,23,42,.08));
  border-radius: 12px; background: var(--bg-surface, #fff); text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sb-se-ava {
  width: 56px; height: 56px; flex: none; border-radius: 50%; overflow: hidden;
  background: var(--emerald-soft, rgba(7,193,96,.12)); color: var(--emerald, #059669);
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 500;
}
.sb-se-ava img { width: 100%; height: 100%; object-fit: cover; }
.sb-se-profile-main { flex: 1; min-width: 0; }
.sb-se-profile-main b { display: block; font-size: 15px; color: var(--text-1, #0f172a); }
.sb-se-profile-main small { display: block; font-size: 12px; color: var(--text-3, #94a3b8); margin-top: 3px; }
.sb-se-group {
  border: 0.5px solid var(--hairline, rgba(15,23,42,.08)); border-radius: 12px;
  background: var(--bg-surface, #fff); overflow: hidden; margin-bottom: 16px;
}
.sb-se-cell {
  width: 100%; display: flex; align-items: center; gap: 12px; min-height: 52px;
  padding: 10px 14px; border: 0; border-bottom: 0.5px solid var(--hairline, rgba(15,23,42,.08));
  background: transparent; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.sb-se-cell:last-child { border-bottom: 0; }
.sb-se-cell:active { background: var(--bg-subtle, rgba(15,23,42,.03)); }
.sb-se-cell svg { width: 21px; height: 21px; flex: none; color: var(--emerald, #059669); }
.sb-se-cell-main { flex: 1; min-width: 0; font-size: 13.5px; color: var(--text-1, #0f172a); }
.sb-se-cell-main small { display: block; font-size: 11.5px; color: var(--text-3, #94a3b8); margin-top: 2px; }
.sb-se-arrow { color: var(--text-3, #cbd5e1); font-size: 20px; line-height: 1; }
.sb-se-bar {
  display: flex; align-items: center; gap: 8px; padding: 6px 0 12px;
}
.sb-se-bar h2 { font-size: 16px; font-weight: 500; margin: 0; color: var(--text-1, #0f172a); }
.sb-se-back {
  width: 34px; height: 34px; border: 0; background: transparent; cursor: pointer;
  font-size: 28px; line-height: 1; color: var(--text-1, #0f172a); padding: 0 6px;
  -webkit-tap-highlight-color: transparent;
}

/* 回忆相册与实体纪念卡 */
.sb-album-shelf {
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px;
  padding: 20px; border-radius: 18px; margin-bottom: 24px;
  background: linear-gradient(145deg, #ffffff, #f8f7f4);
  border: 1px solid rgba(15, 23, 42, 0.09);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
}
@media (max-width: 820px) { .sb-album-shelf { grid-template-columns: 1fr; } }
.sb-polaroid {
  background: #fff; padding: 10px 10px 16px; border-radius: 6px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.10), 0 0 0 1px rgba(15, 23, 42, 0.06);
  transform: rotate(-1.2deg); transition: transform .25s ease, box-shadow .25s ease;
}
.sb-polaroid:hover { transform: rotate(0deg) translateY(-2px); box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14); }
.sb-polaroid-frame {
  position: relative; aspect-ratio: 4/4.2; border-radius: 3px; overflow: hidden;
  background: linear-gradient(135deg, #cbd5e1, #64748b); display: grid; place-items: center;
  color: #fff; font-size: 38px; font-weight: 700;
}
.sb-polaroid-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.sb-polaroid-cap {
  margin-top: 12px; text-align: center;
  font-family: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
}
.sb-polaroid-cap b { display: block; font-size: 16px; color: #1f2937; letter-spacing: .04em; }
.sb-polaroid-cap small { display: block; font-size: 11.5px; color: #6b7280; margin-top: 3px; }
.sb-print-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; align-content: start; }
.sb-print-card {
  position: relative; padding: 12px 14px; border-radius: 10px;
  background: #fffdf9; border: 1px solid rgba(120, 95, 60, 0.16);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}
.sb-print-card::before {
  content: ""; position: absolute; top: -5px; left: 16px; width: 34px; height: 10px;
  background: rgba(216, 176, 106, 0.36); border-radius: 2px; transform: rotate(-2deg);
}
.sb-print-title { font-size: 11px; font-weight: 600; color: #8a7b66; letter-spacing: .04em; margin-bottom: 4px; }
.sb-print-text { font-size: 12.5px; color: #2b2622; line-height: 1.5; }

.sb-keepsake-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.sb-keepsake {
  position: relative; border-radius: 16px; overflow: hidden;
  background: linear-gradient(180deg, #fffefb, #f8f3ea);
  border: 1px solid rgba(130, 100, 60, 0.22);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.07), inset 0 0 0 1px rgba(255, 255, 255, 0.7);
  display: flex; flex-direction: column; transition: transform .2s ease, box-shadow .2s ease;
}
.sb-keepsake:hover { transform: translateY(-2px); box-shadow: 0 18px 38px rgba(15, 23, 42, 0.11); }
.sb-keepsake-band {
  height: 6px; width: 100%;
}
.sb-keepsake-head {
  padding: 14px 18px 10px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  border-bottom: 1px dashed rgba(130, 100, 60, 0.22);
}
.sb-keepsake-serial {
  font-size: 10px; font-weight: 700; letter-spacing: .12em; color: #8a7b66;
  text-transform: uppercase; margin-bottom: 4px;
}
.sb-keepsake-name {
  font-size: 19px; font-weight: 700; color: #1f1b18;
  font-family: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
}
.sb-keepsake-tag { font-size: 12px; color: #6b5e50; margin-top: 2px; }
.sb-keepsake-badge {
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap;
}
.sb-keepsake-badge.letter { background: rgba(192, 57, 43, 0.10); color: #a93226; border: 1px solid rgba(192, 57, 43, 0.22); }
.sb-keepsake-badge.card { background: rgba(16, 185, 129, 0.10); color: #047857; border: 1px solid rgba(16, 185, 129, 0.22); }
.sb-keepsake-body { padding: 14px 18px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.sb-keepsake-stats {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 12px; color: #6b5e50;
}
.sb-keepsake-envelope {
  position: relative; padding: 12px 14px 12px 52px; border-radius: 10px;
  background: linear-gradient(135deg, #f7efe0, #efe3cd);
  border: 1px solid rgba(150, 110, 60, 0.22);
  font-family: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  font-size: 13px; color: #3d332a; line-height: 1.6;
}
.sb-keepsake-wax {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #df5c67, #8c242e 75%);
  color: #fff; font-size: 13px; font-weight: 700;
  box-shadow: 0 3px 10px rgba(140, 36, 46, 0.35);
}
.sb-keepsake-foot {
  padding: 10px 18px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

/* 首次注册进入引导弹窗 */
.sb-onboard {
  position: fixed; inset: 0; z-index: 75;
  background: rgba(9, 14, 26, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  display: grid; place-items: center; padding: 20px;
  animation: sbWsFadeIn .28s ease both;
}
.sb-onboard-card {
  position: relative; width: min(880px, 94vw); max-height: 90vh; overflow-y: auto;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px; padding: 30px 32px 26px;
  box-shadow: 0 36px 90px rgba(0, 0, 0, 0.36);
}
.sb-onboard-close {
  position: absolute; top: 18px; right: 18px;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-subtle); border: 1px solid var(--hairline);
  color: var(--text-2); font-size: 20px; line-height: 1;
  display: grid; place-items: center; transition: background .15s, color .15s;
}
.sb-onboard-close:hover { background: #e5e7eb; color: var(--text-1); }
.sb-onboard-head { padding-right: 40px; margin-bottom: 20px; }
.sb-onboard-eyebrow {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .1em;
  color: #059669; background: rgba(16, 185, 129, 0.10);
  border: 1px solid rgba(16, 185, 129, 0.22);
  padding: 4px 10px; border-radius: 999px; margin-bottom: 10px;
}
.sb-onboard-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; color: var(--text-1); margin-bottom: 6px; }
.sb-onboard-head p { font-size: 13.5px; color: var(--text-2); line-height: 1.6; }
.sb-onboard-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 780px) { .sb-onboard-grid { grid-template-columns: 1fr; } }
.sb-ob-card {
  background: #fff; border: 1px solid var(--hairline);
  border-radius: 16px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.sb-ob-card:hover { transform: translateY(-3px); border-color: rgba(7, 193, 96, 0.45); box-shadow: 0 16px 34px rgba(15, 23, 42, 0.10); }
.sb-ob-cover {
  position: relative; aspect-ratio: 4/3; overflow: hidden;
  display: grid; place-items: center; color: #fff; font-size: 32px; font-weight: 700;
}
.sb-ob-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.sb-ob-body { padding: 13px 14px 14px; display: flex; flex-direction: column; flex: 1; }
.sb-ob-body h3 { font-size: 16px; font-weight: 700; margin-bottom: 3px; }
.sb-ob-tag { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.sb-ob-intro { font-size: 12.5px; color: var(--text-2); line-height: 1.55; flex: 1; margin-bottom: 12px; }
.sb-ob-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.sb-onboard-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: 14px;
  background: var(--bg-subtle); border: 1px solid var(--hairline);
}
.sb-onboard-custom b { display: block; font-size: 13.5px; color: var(--text-1); margin-bottom: 2px; }
.sb-onboard-custom span { font-size: 12px; color: var(--text-2); }
.sb-onboard-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* 心意弹窗 & 外卖菜单 & 配送进度条 */
.sb-gift-pop { max-width: 340px; min-width: 280px; }
.sb-pop-chip.accent {
  background: rgba(7, 193, 96, 0.08);
  border-color: rgba(7, 193, 96, 0.25);
  color: #059669; font-weight: 600;
}
.sb-pop-chip.accent:hover { background: rgba(7, 193, 96, 0.16); }

.sb-takeout-bar {
  padding: 10px 20px; background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--hairline);
  backdrop-filter: blur(12px);
}
.sb-to-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 12.5px; margin-bottom: 7px;
}
.sb-to-title { display: flex; align-items: center; gap: 7px; font-weight: 600; color: var(--text-1); }
.sb-to-eta { font-size: 12px; color: #059669; font-weight: 600; }
.sb-to-prog {
  height: 5px; border-radius: 999px; background: rgba(15, 23, 42, 0.08); overflow: hidden;
  margin-bottom: 7px;
}
.sb-to-prog-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #10b981, #34d399);
  transition: width .4s ease;
}
.sb-to-steps {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; font-size: 11px; color: var(--text-3);
}
.sb-to-step { display: flex; align-items: center; gap: 4px; }
.sb-to-step i {
  width: 6px; height: 6px; border-radius: 50%; background: rgba(15, 23, 42, 0.18); flex-shrink: 0;
}
.sb-to-step.done { color: var(--text-2); }
.sb-to-step.done i { background: var(--emerald); }
.sb-to-step.now { color: #059669; font-weight: 600; }
.sb-to-step.now i { background: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-soft); }

.sb-menu-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.sb-menu-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
@media (max-width: 520px) { .sb-menu-list { grid-template-columns: 1fr; } }
.sb-menu-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 10px; border: 1px solid var(--hairline); background: var(--bg-subtle);
  text-align: left; transition: all .15s;
}
.sb-menu-item:hover { border-color: var(--hairline-strong); }
.sb-menu-item.on {
  border-color: var(--emerald); background: rgba(7, 193, 96, 0.08);
  box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.14);
}
.sb-menu-ico { font-size: 22px; flex-shrink: 0; }
.sb-menu-meta { flex: 1; min-width: 0; }
.sb-menu-meta b { display: block; font-size: 13px; color: var(--text-1); }
.sb-menu-meta small { display: block; font-size: 11px; color: var(--text-3); }
.sb-menu-price { font-size: 12.5px; font-weight: 700; color: #059669; white-space: nowrap; }
.sb-rp-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.sb-rp-chip {
  padding: 8px 6px; border-radius: 8px; border: 1px solid var(--hairline);
  background: var(--bg-subtle); font-size: 12.5px; font-weight: 600; text-align: center;
}
.sb-rp-chip.on { background: rgba(239, 68, 68, 0.10); border-color: #ef4444; color: #dc2626; }

/* 微信风格红包卡片 & 领取系统提示 & 详情弹窗 */
.sb-wx-rp {
  width: 236px; border-radius: 8px; overflow: hidden; cursor: pointer;
  user-select: none; position: relative;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  transition: transform .12s ease, filter .15s ease;
}
.sb-wx-rp:hover { transform: translateY(-1px); }
.sb-wx-rp-body {
  display: flex; align-items: center; gap: 11px; padding: 12px 13px;
  background: linear-gradient(135deg, #fa9d3b 0%, #f17a26 100%);
  color: #ffffff;
}
.sb-wx-rp.opened .sb-wx-rp-body,
.sb-wx-rp.rejected .sb-wx-rp-body {
  background: linear-gradient(135deg, #fbdab7 0%, #f7cba0 100%);
  color: #ffffff;
}
.sb-wx-rp-icon {
  width: 36px; height: 42px; flex-shrink: 0;
  display: grid; place-items: center;
}
.sb-wx-rp-icon svg { width: 36px; height: 42px; display: block; }
.sb-wx-rp-meta { flex: 1; min-width: 0; }
.sb-wx-rp-title {
  font-size: 14.5px; font-weight: 600; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-wx-rp-status {
  font-size: 12px; opacity: 0.92; margin-top: 3px;
}
.sb-wx-rp.opened .sb-wx-rp-status,
.sb-wx-rp.rejected .sb-wx-rp-status {
  opacity: 0.96;
}
.sb-wx-rp-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 12px; font-size: 11px;
  background: #ffffff; color: #8e95a2;
  border-top: 0.5px solid rgba(15, 23, 42, 0.05);
}
.sb-wx-rp.opened .sb-wx-rp-foot,
.sb-wx-rp.rejected .sb-wx-rp-foot {
  background: #fffaf5; color: #a8aeb9;
}
.sb-wx-sys-notice {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  font-size: 11.5px; color: var(--text-3); margin: 2px 0 4px;
  user-select: none;
}
.sb-wx-sys-notice .hl { color: #ea580c; font-weight: 500; }

/* 微信红包详情弹窗 */
.sb-wx-rp-modal {
  margin: -18px -20px; border-radius: var(--radius-lg); overflow: hidden;
  background: #ffffff;
}
.sb-wx-rp-mhead {
  position: relative; padding: 26px 20px 32px; text-align: center;
  background: linear-gradient(180deg, #f25542 0%, #e14232 100%);
  color: #fde6ba;
}
.sb-wx-rp-mhead::after {
  content: ""; position: absolute; left: -10%; right: -10%; bottom: -18px; height: 36px;
  background: #ffffff; border-radius: 50% 50% 0 0;
}
.sb-wx-rp-msender {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600; color: #fff4d8;
}
.sb-wx-rp-msender .ava {
  width: 24px; height: 24px; border-radius: 5px; overflow: hidden;
  background: rgba(255, 255, 255, 0.2); display: grid; place-items: center;
  font-size: 12px; color: #fff;
}
.sb-wx-rp-msender .ava img { width: 100%; height: 100%; object-fit: cover; }
.sb-wx-rp-mwish { font-size: 12.5px; color: rgba(255, 244, 216, 0.85); margin-top: 6px; }
.sb-wx-rp-mbody { padding: 18px 22px 22px; text-align: center; }
.sb-wx-rp-mamt {
  font-size: 32px; font-weight: 700; color: #c9923b; letter-spacing: -0.02em;
}
.sb-wx-rp-mamt small { font-size: 13px; font-weight: 500; margin-left: 4px; color: #8e95a2; }
.sb-wx-rp-mstat {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  background: var(--bg-subtle); font-size: 12.5px; color: var(--text-2);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

/* 聊天对象头像角标（圆形头像 + 右上角未读徽章） */
.sb-char-pill .mini-ava { position: relative; overflow: visible; }
.sb-char-pill .mini-ava img { border-radius: 50%; }
/* 会话列表头像右下角在线状态点：绿=在线/忙，灰=睡了。不整条变灰（那样难读且制造焦虑）。 */
.sb-char-presence-dot {
  position: absolute; right: -1px; bottom: -1px; z-index: 2;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--emerald); border: 2px solid var(--bg-surface);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06);
}
.sb-char-presence-dot.offline { background: #9ca3af; }
.sb-char-ava-badge {
  position: absolute; top: -3px; right: -3px; z-index: 2;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: #fa5151; color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; line-height: 1;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(250, 81, 81, 0.38);
}
.sb-char-pill-top {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.sb-char-pill-time {
  font-size: 10px; opacity: 0.55; flex-shrink: 0; font-weight: 400;
}



/* 表情包浮层（2026-11-20）：用户也能发 curated 池表情 */
.sb-sticker-pop { width: 344px; max-width: 88vw; }
.sb-sticker-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
.sb-sticker-tab {
  font-size: 11px; padding: 4px 9px; border-radius: 999px; cursor: pointer;
  background: var(--bg-subtle); color: var(--text-2); border: 1px solid var(--hairline);
}
.sb-sticker-tab.on { background: var(--text-1); color: var(--bg, #fff); border-color: var(--text-1); }
.sb-sticker-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  max-height: 264px; overflow: auto; padding: 2px;
}
.sb-sticker-item {
  background: var(--bg-subtle); border: 1px solid var(--hairline); border-radius: 10px;
  padding: 6px; cursor: pointer; transition: border-color .15s;
}
.sb-sticker-item:hover { border-color: var(--text-2); }
.sb-sticker-item img { width: 100%; height: 62px; object-fit: contain; display: block; }
.sb-sticker-empty { padding: 20px 12px; text-align: center; opacity: .6; font-size: 12px; }

/* 剧本杀 P0（2026-11-24）：大厅 + 群聊——桌面与手机共用（入口在左侧栏/更多页） */
/* 剧本杀 P0（2026-11-24）：大厅 + 群聊，手机端原生感 */
.sb-script-page { max-width: 620px; margin: 0 auto; padding-bottom: 16px; }
.sb-script-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.sb-script-card {
  width: 100%; display: flex; flex-direction: column; gap: 4px; text-align: left;
  padding: 14px 16px; border: 0.5px solid var(--hairline, rgba(15,23,42,.08));
  border-radius: 12px; background: var(--bg-surface, #fff); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sb-script-card.on { border-color: var(--emerald, #059669); background: var(--emerald-soft, rgba(7,193,96,.08)); }
.sb-script-card b { font-size: 14px; font-weight: 500; }
.sb-script-card small { font-size: 12px; color: var(--text-2, #64748b); }
.sb-script-card span { font-size: 11px; color: var(--text-3, #94a3b8); }
.sb-script-roles { border-top: 0.5px solid var(--hairline); padding-top: 14px; }
.sb-script-role {
  display: flex; align-items: center; gap: 10px; padding: 8px 4px; cursor: pointer;
  border-bottom: 0.5px solid var(--hairline, rgba(15,23,42,.06));
}
.sb-script-role input { accent-color: var(--emerald, #059669); }
.sb-script-role .sb-se-ava { width: 38px; height: 38px; font-size: 14px; }
.sb-script-status { display: flex; gap: 12px; align-items: center; padding: 4px 2px 12px; font-size: 12px; color: var(--text-2, #64748b); }

/* 剧本杀「本」展示栏（玩家视角）：读本时能看到背景/自己的秘密目标 */
.sb-script-book { border: 0.5px solid var(--hairline, rgba(15,23,42,.1)); border-radius: 12px; background: var(--bg-surface, #fff); overflow: hidden; margin-bottom: 12px; }
.sb-script-book-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border: 0; background: transparent; cursor: pointer;
  font-size: 13px; color: var(--text-1, #0f172a); text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.sb-script-book-toggle span { color: var(--text-3, #94a3b8); font-size: 12px; }
.sb-script-book-body { padding: 0 14px 14px; border-top: 0.5px solid var(--hairline); }
.sb-script-book-body h4 { font-size: 12px; font-weight: 500; color: var(--emerald, #059669); margin: 12px 0 4px; }
.sb-script-book-body p { font-size: 12.5px; line-height: 1.6; color: var(--text-2, #475569); margin: 0 0 6px; }
.sb-script-book-body p b { color: var(--text-1, #0f172a); font-weight: 500; }

/* 剧本杀页的返回箭头只在手机需要（回大厅）；桌面用左侧栏导航，隐藏避免误解 */
@media (min-width: 721px) {
  .sb-script-page .sb-se-bar .sb-se-back { display: none; }
}

/* 剧本杀桌面右栏：本（案情/秘密/在场者），用角色的调性但不串日常资料卡 */
.sb-script-side { display: flex; flex-direction: column; gap: 16px; height: 100%; padding: 4px 2px; }
.sb-script-side h3 { font-size: 15px; font-weight: 500; margin: 0; color: var(--text-1, #0f172a); }
.sb-script-side-sec { padding-top: 12px; border-top: 0.5px solid var(--hairline); }
.sb-script-side-sec h4 { font-size: 12px; font-weight: 500; color: var(--emerald, #059669); margin: 0 0 6px; }
.sb-script-side-sec p { font-size: 12.5px; line-height: 1.6; color: var(--text-2, #475569); margin: 0 0 6px; }
.sb-script-side-sec p b { display: block; color: var(--text-1, #0f172a); font-weight: 500; font-size: 11.5px; }
.sb-script-side-sec p.dim, .sb-script-side p.dim { color: var(--text-3, #94a3b8); }

/* 剧本杀中间空态群聊台 */
.sb-script-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 320px; color: var(--text-3); text-align: center; }
.sb-script-empty-icon { font-size: 40px; color: var(--emerald, #059669); line-height: 1; }
.sb-script-empty h3 { font-size: 15px; font-weight: 500; color: var(--text-1, #0f172a); margin: 2px 0 0; }
.sb-script-empty p { font-size: 12.5px; margin: 0 0 6px; }
/* 右栏选本按钮 / 角色勾选 */
.sb-script-side-pick {
  width: 100%; display: flex; flex-direction: column; gap: 2px; text-align: left;
  padding: 9px 12px; margin-bottom: 6px; border-radius: 8px; cursor: pointer;
  border: 0.5px solid var(--hairline); background: var(--bg-surface, #fff);
}
.sb-script-side-pick.on { border-color: var(--emerald, #059669); background: var(--emerald-soft, rgba(7,193,96,.08)); }
.sb-script-side-pick b { font-size: 12.5px; font-weight: 500; color: var(--text-1, #0f172a); }
.sb-script-side-pick small { font-size: 11px; color: var(--text-3, #94a3b8); }
.sb-script-side-roles { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; margin: 6px 0 10px; }
.sb-script-side-role { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2, #475569); cursor: pointer; }
.sb-script-side-role input { accent-color: var(--emerald, #059669); }

/* 桌面端右栏已是完整剧本，中间的「查看剧本」只在手机端需要 */
@media (min-width: 721px) {
  .sb-script-book { display: none; }
}

/* 剧本杀主持人（GM）：居中告示条，区别于角色气泡 */

/* ===== 剧本杀群聊（2026-11-24）：复用单聊的聊天布局与气泡，只是多角色 ===== */
.sb-script-chat-page { display: flex !important; flex-direction: column; height: 100%; min-height: 0; padding: 0 !important; max-width: none !important; }
.sb-script-chat-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px;
  border-bottom: 0.5px solid var(--hairline); background: var(--bg-surface); flex: none;
}
.sb-script-head-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sb-script-head-title b { font-size: 15px; font-weight: 500; color: var(--text-1, #0f172a); }
.sb-script-head-title small { font-size: 11.5px; color: var(--text-3, #94a3b8); }
.sb-script-head-actions { display: flex; gap: 6px; }
/* 消息流直接用 .sb-chat-stream（flex:1 滚动），此处只补背景 */
.sb-script-chat-page .sb-chat-stream { background: var(--bg-chat, #f7f8fa); }
/* 群聊气泡上方的小名字 */
.sb-script-name { font-size: 11px; color: var(--text-3, #94a3b8); margin: 0 2px 4px; }
.sb-msg-row.user .sb-script-name { text-align: right; }
.sb-script-msg .sb-bubble { max-width: 100%; }
.sb-script-ava { border-radius: 50%; }
/* 主持人/系统提示：微信式居中胶囊 */
.sb-sys-notice { align-self: center; max-width: 90%; margin: 4px 0 10px; text-align: center; }
.sb-sys-notice > span {
  display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 11px;
  color: var(--emerald, #059669); background: var(--emerald-soft, rgba(7,193,96,.08));
}
.sb-sys-notice > p {
  margin: 6px auto 0; padding: 10px 14px; border-radius: 8px; font-size: 12.5px; line-height: 1.6;
  color: var(--text-2, #475569); background: rgba(15,23,42,.035); text-align: left;
}
.sb-composer-hint { font-size: 11.5px; color: var(--text-3, #94a3b8); }
.sb-script-foot-actions { display: flex; gap: 8px; justify-content: center; padding: 0 20px 10px; flex: none; }
/* 桌面隐藏聊天页返回箭头（用左侧栏导航） */
@media (min-width: 721px) { .sb-script-chat-head .sb-chat-back { display: none; } }
/* 剧本杀视图：子容器占满、内部消息流自己滚动（像聊天页） */
.sb-subview.sb-subview-chat { padding: 0 !important; overflow: hidden !important; display: flex; }

/* 选角：你演谁 —— 角色卡片两列 */
.sb-script-role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.sb-script-role-grid .sb-script-side-pick { margin-bottom: 0; }
.sb-script-role-grid .sb-script-side-pick b { font-size: 12px; }
.sb-script-role-grid .sb-script-side-pick small { font-size: 10.5px; line-height: 1.35; }

/* ===== 剧本杀回合制 UI ===== */
.sb-turn-indicator {
  flex: none; padding: 5px 12px; border-radius: 14px; font-size: 12px; white-space: nowrap;
  color: var(--text-2, #475569); background: var(--bg-subtle, rgba(15,23,42,.04));
  border: 0.5px solid var(--hairline);
}
.sb-turn-indicator.mine { color: var(--emerald, #059669); background: var(--emerald-soft, rgba(7,193,96,.1)); border-color: var(--emerald, #059669); }
.sb-script-wait { font-size: 12.5px; color: var(--text-3, #94a3b8); padding: 8px 0; text-align: center; }
.sb-script-vote { margin: 10px 20px 0; padding: 12px 14px; border-radius: 10px; background: var(--bg-surface, #fff); border: 0.5px solid var(--hairline); }
.sb-script-vote h4 { font-size: 12.5px; font-weight: 500; margin: 0 0 10px; color: var(--text-1, #0f172a); }
.sb-script-vote-list { display: flex; flex-wrap: wrap; gap: 8px; }
.sb-script-vote-btn { padding: 7px 16px; border-radius: 8px; cursor: pointer; font-size: 12.5px; color: var(--text-1, #0f172a); background: var(--bg-subtle); border: 0.5px solid var(--hairline-strong); }
.sb-script-vote-btn:hover { border-color: var(--emerald, #059669); color: var(--emerald, #059669); }
.sb-script-truth { margin: 10px 20px 0; padding: 12px 14px; border-radius: 10px; background: var(--bg-surface, #fff); border: 0.5px solid var(--emerald, #059669); }
.sb-script-truth h3 { font-size: 13px; font-weight: 500; color: var(--emerald, #059669); margin: 0 0 8px; }
.sb-script-truth p { font-size: 12.5px; line-height: 1.6; color: var(--text-2, #475569); margin: 0 0 8px; }
.sb-script-truth p b { display: inline-block; min-width: 34px; color: var(--text-1, #0f172a); font-weight: 500; margin-right: 6px; }
.sb-script-truth p.dim { color: var(--text-3, #94a3b8); font-size: 11.5px; }
.sb-script-verdict { margin-top: 10px !important; padding-top: 10px; border-top: 0.5px solid var(--hairline); font-weight: 500; color: var(--text-1, #0f172a) !important; }
.sb-script-verdict.hit { color: var(--emerald, #059669) !important; }
@media (max-width: 720px) {
  .sb-turn-indicator { font-size: 11px; padding: 4px 8px; }
  .sb-script-vote, .sb-script-truth { margin-left: 12px; margin-right: 12px; }
}

/* 设置页里的语言下拉（浅底） */
.ciwimate-lang-setting .ciwimate-lang-btn{background:var(--bg-subtle,#f1f5f9);color:var(--text-2,#475569);border-color:var(--line,#e2e8f0)}
.ciwimate-lang-setting .ciwimate-lang-btn:hover{background:var(--surface,#fff)}
.ciwimate-lang-setting .ciwimate-lang-menu{left:0;right:auto}

/* 设置页单列分组（2026-11-24） */
.sb-se-settings{display:flex!important;flex-direction:column;gap:14px}
.sb-se-settings .sb-card{padding:18px 20px}
.sb-se-group-title{font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:var(--text-3);margin:6px 0 2px;padding-left:2px}
.sb-se-settings .sb-card h3{font-size:14px;font-weight:500;margin:0 0 14px;padding-bottom:10px;border-bottom:.5px solid var(--line)}
.sb-se-settings .sb-form-row{border-bottom:.5px solid var(--line);padding-bottom:12px;margin-bottom:12px}
.sb-se-settings .sb-form-row:last-of-type{border-bottom:0;margin-bottom:0}
.sb-se-danger{border-color:rgba(220,38,38,.35)!important;background:rgba(220,38,38,.03)}
.sb-se-danger h3{color:#dc2626!important;border-bottom-color:rgba(220,38,38,.2)!important}
.sb-se-settings .ciwimate-lang-setting .ciwimate-lang-btn{min-width:96px;justify-content:space-between}
@media(max-width:720px){.sb-se-settings .sb-card{padding:16px}}
