/**
 * Chat App Styles - 现代化聊天界面
 * 参考通讯录设计，打造精美的聊天体验
 */

/* ==================== 聊天APP容器 ==================== */
#app-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: var(--bg-primary);
  overflow: hidden;
  padding-bottom: 0;
  position: relative;
  --chat-highlight: var(--border-tint-highlight, var(--accent-color));
  --chat-highlight-rgb: var(--border-tint-rgb, var(--accent-color-rgb));
}

/* ==================== 现代化导航栏 ==================== */
.chat-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--navbar-padding);
  background: var(--navbar-bg-standard);
  border-bottom: 1px solid var(--navbar-border);
  flex-shrink: 0;
  position: relative;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.chat-navbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--brand-primary) 50%,
    transparent 100%);
  opacity: 0.3;
}

.chat-navbar .nav-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--brand-primary);
  cursor: pointer;
  border-radius: 12px;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.chat-navbar .nav-btn i {
  font-size: 18px;
}

.chat-navbar .nav-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.chat-navbar .nav-btn-group {
  display: flex;
  gap: 8px;
}

.chat-navbar .nav-btn-group .nav-btn-ghost {
  background: var(--navbar-bg-standard);
  color: var(--text-primary);
}

.chat-navbar .nav-btn:hover {
  background: var(--bg-hover);
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.chat-navbar .nav-btn:active {
  background: var(--bg-active);
  transform: scale(0.95);
}

.chat-navbar .nav-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--nav-title-font-size);
  font-weight: var(--nav-title-font-weight);
  color: var(--text-primary);
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ==================== 现代化底部Tab栏 ==================== */
.chat-footer-bar {
  --chat-footer-gap: 0px;
  --chat-safe-reserve: 0px;
  --chat-safe-inset: var(--safe-area-bottom);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  padding-bottom: calc(6px + var(--chat-safe-inset));
  height: auto;
  min-height: 40px;
  background: var(--bg-secondary);
  border-radius: 16px 16px 0 0;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-tabbar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: none;
}

body[data-device="android"] .chat-footer-bar {
  --chat-footer-gap: 0px;
  --chat-safe-reserve: 0px;
}

body[data-device="ios"][data-statusbar="hidden"] .chat-footer-bar {
  --chat-footer-gap: 0px;
}

.chat-footer-btn {
  flex: 1;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 8px;
  border-radius: 12px;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.chat-footer-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  opacity: 0;
  transition: opacity var(--transition-fast);
  border-radius: 12px;
}

.chat-footer-btn i {
  font-size: 16px;
  position: relative;
  z-index: 1;
  transition: all var(--transition-fast);
}

.chat-footer-btn span {
  font-size: 11px;
  line-height: 1;
  position: relative;
  z-index: 1;
  transition: all var(--transition-fast);
}

.chat-footer-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  transform: translateY(-2px);
}

.chat-footer-btn.active {
  color: var(--text-on-primary);
  background: transparent;
  font-weight: 600;
  transform: translateY(-1px);
}

.chat-footer-btn.active::before {
  opacity: 1;
}

.chat-footer-btn.active i {
  color: var(--text-on-primary);
  transform: scale(1.1);
}

.chat-footer-btn.active span {
  color: var(--text-on-primary);
}

.chat-footer-btn:active {
  transform: translateY(0);
}

/* ==================== 内容区域 ==================== */
.chat-content {
  flex: 1;
  min-height: 0; /* 重要：允许flex子元素正确收缩 */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 16px 16px 16px;
  height: 100%; /* 🔥🔥🔥 关键！必须保留！解决滚动条问题！ */
}

/* ==================== 现代化会话列表 ==================== */
.session-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 50px 0; /* 🔥🔥🔥 最关键！解决滚动回弹问题！ */
}

.session-item {
  display: flex;
  align-items: stretch;
  padding: 2px 2px;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin: 0 4px;
}

.session-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
    rgba(var(--accent-color-rgb), 0.05) 0%,
    transparent 100%);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.session-item.pinned {
  background: linear-gradient(135deg,
    var(--bg-secondary) 0%,
    rgba(var(--accent-color-rgb), 0.08) 100%);
  border-color: var(--brand-primary);
  position: relative;
}

.session-item.pinned::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(var(--accent-color-rgb), 0.4);
}

.session-item:hover {
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-primary);
}

.session-item:hover::before {
  opacity: 1;
}

.session-item:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.session-avatar {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--chat-highlight, var(--brand-primary)), var(--brand-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-2xl);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 4px 12px rgba(var(--chat-highlight-rgb, var(--accent-color-rgb)), 0.2),
    0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all var(--transition-fast);
  align-self: center;
}

/* 群聊头像：使用日夜兼容的中性底色，避免品牌色过亮/过暗 */
.session-avatar.group {
  background: var(--bg-elevated, var(--surface-2, var(--background-secondary, #f5f5f5)));
  box-shadow: none;
  border-radius: 8px;
}

/* 群聊头像：多成员小缩略图网格（最多 6 个） */
.session-avatar.group.grid {
  display: grid;
  padding: 0;
  gap: 1px;
  align-items: stretch;
  justify-items: stretch;
}

/* 固定 3 列 2 行，始终 6 格 */
.session-avatar.group.grid {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.group-grid-item {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 0;
  overflow: hidden;
  position: relative;
  background: transparent;
}

.group-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0;
}

.group-grid-placeholder {
  position: absolute;
  inset: 0;
  display: none;
}

.group-grid-item.empty {
  background: transparent;
}

.group-grid-item.placeholder {
  color: var(--text-tertiary);
}

.session-avatar::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  border-radius: 22px;
  background: var(--chat-highlight, var(--brand-primary));
  opacity: 0;
  z-index: -1;
  filter: blur(8px);
  transition: opacity var(--transition-fast);
}

.session-item:hover .session-avatar::after {
  opacity: 0.3;
}

.session-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  transition: transform var(--transition-fast);
}

.session-item:hover .session-avatar img {
  transform: scale(1.05);
}

.session-avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-on-primary);
  font-size: var(--font-size-xl);
}

.session-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0px;
  align-self: center;
}

.session-name {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
}

.session-group-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  color: var(--brand-secondary);
}

.session-group-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.session-pin-indicator {
  color: var(--brand-primary);
  font-size: var(--font-size-sm);
}

.session-message {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: -3px;
  line-height: 1.2;
}

.session-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  justify-content: flex-start;
  align-self: stretch;
}

.session-pin-btn {
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: var(--font-size-base);
  line-height: 1;
  transition: color var(--transition-fast);
  margin: 0;
}

.session-pin-btn:hover {
  color: var(--brand-primary);
}

.session-pin-btn.active {
  color: var(--brand-primary);
}

.session-time {
  font-size: var(--font-size-xxs);
  color: var(--text-tertiary);
  line-height: 1.2;
}

.session-meta-bottom {
  position: absolute;
  right: 10px;
  top: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-direction: row;
}

.session-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--semantic-error);
  color: white;
  font-size: var(--font-size-xs-md);
  font-weight: 600;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==================== 聊天界面 ==================== */
.chat-messages {
  --chat-input-offset: calc(150px + max(0px, var(--safe-area-bottom)));
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 16px;
  padding-bottom: var(--chat-input-offset);
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

body[data-device="android"] .chat-messages {
  --chat-input-offset: calc(140px + clamp(8px, 1.8vh, 20px));
}

body[data-device="ios"] .chat-messages {
  --chat-input-offset: calc(90px + max(0px, var(--safe-area-bottom)));
}

/* ==================== 现代化消息气泡 ==================== */
.message-bubble {
  max-width: 100%;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  animation: messageSlideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  margin-bottom: 20px;
}

.chat-messages > .message-bubble:last-child {
  margin-bottom: 0;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.message-bubble.user {
  align-self: flex-end;
  justify-content: flex-end;
}

.message-bubble.ai {
  align-self: flex-start;
  justify-content: flex-start;
}

/* ==================== 消息内容区域 ==================== */
.message-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 1 auto;
  max-width: calc(100% - 64px);
  width: fit-content;
}

.message-bubble.user .message-content-wrapper {
  align-items: flex-end;
}

.message-bubble.ai .message-content-wrapper {
  align-items: flex-start;
}

/* ==================== 消息头像 ==================== */
.message-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--chat-highlight, var(--brand-primary)), var(--brand-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 2px 8px rgba(var(--chat-highlight-rgb, var(--accent-color-rgb)), 0.15),
    0 1px 2px rgba(0, 0, 0, 0.1);
  transition: all var(--transition-fast);
  margin-top: 0;
  align-self: flex-end;
}

.message-bubble.user .message-avatar {
  background: linear-gradient(135deg, var(--chat-highlight, var(--brand-primary)), var(--brand-secondary));
  align-self: flex-end;
}

.message-bubble.ai .message-avatar {
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
  border: 2px solid var(--border-light);
  align-self: flex-start;
}

.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.message-avatar .session-avatar.group {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  box-shadow: none;
  background: var(--bg-tertiary);
}

.message-avatar .session-avatar.group.grid {
  gap: 1px;
}

.message-avatar .group-grid-item,
.message-avatar .group-grid-item img {
  border-radius: 0;
}

.message-avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.message-bubble.user .message-avatar-placeholder {
  color: var(--text-on-primary);
}

.message-bubble.ai .message-avatar-placeholder {
  color: var(--text-secondary);
}

/* ==================== 消息时间和气泡容器 ==================== */
.message-bubble-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
  width: fit-content;
  max-width: 100%;
}

.message-bubble.user .message-bubble-container {
  align-items: flex-end;
}

.message-bubble.ai .message-bubble-container {
  align-items: flex-start;
}

.bubble-text {
  padding: 12px 16px;
  border-radius: 20px;
  font-size: var(--font-size-base);
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  max-width: 240px;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.bubble-text::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 50%,
    rgba(0, 0, 0, 0.05) 100%);
  pointer-events: none;
}

.message-bubble.user .bubble-text {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  color: var(--text-on-primary);
  border-bottom-right-radius: 8px;
  box-shadow:
    0 4px 12px rgba(var(--chat-highlight-rgb, var(--accent-color-rgb)), 0.25),
    0 2px 4px rgba(0, 0, 0, 0.1);
}

.message-bubble.ai .bubble-text {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-top-left-radius: 8px;
  border-bottom-left-radius: 20px;
  border: 1px solid var(--border-light);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.05);
}

.bubble-text-content {
  display: block;
  width: 100%;
  white-space: pre-wrap;
}

.bubble-quote {
  background: rgba(0, 0, 0, 0.04);
  border-left: 3px solid var(--brand-secondary);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
  max-height: 90px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.message-bubble.user .bubble-quote {
  background: rgba(255, 255, 255, 0.12);
  border-left-color: var(--brand-secondary);
}

.bubble-quote:hover {
  background: rgba(0, 0, 0, 0.07);
}

.message-bubble.user .bubble-quote:hover {
  background: rgba(255, 255, 255, 0.18);
}

.bubble-quote-sender {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  line-height: 1.2;
}

.message-bubble.user .bubble-quote-sender {
  color: rgba(255, 255, 255, 0.75);
}

.bubble-quote-content {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  word-wrap: break-word;
  white-space: normal;
  max-height: calc(13px * 1.3 * 3);
  flex-shrink: 1;
  min-height: 0;
}

.message-bubble.user .bubble-quote-content {
  color: rgba(255, 255, 255, 0.95);
}

.bubble-text .bubble-quote,
.bubble-voice .bubble-quote {
  margin-bottom: 4px;
}

/* ==================== 夜间模式引用消息样式 ==================== */
[data-theme="dark"] .bubble-quote {
  background: rgba(58, 58, 60, 0.6);
}

[data-theme="dark"] .message-bubble.user .bubble-quote {
  background: rgba(58, 58, 60, 0.5);
}

[data-theme="dark"] .bubble-quote:hover {
  background: rgba(58, 58, 60, 0.75);
}

[data-theme="dark"] .message-bubble.user .bubble-quote:hover {
  background: rgba(58, 58, 60, 0.65);
}

/* 草稿气泡样式已废弃，相关逻辑移除 */

.message-bubble:hover .bubble-text {
  transform: translateY(-1px);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.12),
    0 2px 4px rgba(0, 0, 0, 0.08);
}

.bubble-inline-html {
  max-width: min(320px, 100vw);
  max-height: min(420px, 95vh);
  width: auto;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 20px;
  display: inline-block;
  overflow: auto;
}

.bubble-inline-html::before {
  display: none;
}

.bubble-inline-html > * {
  max-width: 100%;
  max-height: 100%;
  box-sizing: border-box;
}

/* 固定卡片宽度：位置 / 分享 / 转账 / inlineHtml */
.location-segment .location-share-card,
.share-card-segment .share-card-container,
.transfer-segment .transfer-card,
.bubble-inline-html {
  width: 240px !important;
  max-width: 240px !important;
  min-width: 240px !important;
}

.message-bubble.user .bubble-inline-html,
.message-bubble.ai .bubble-inline-html {
  background: transparent;
  border: none;
  box-shadow: none;
}

.message-bubble.user .bubble-inline-html::before,
.message-bubble.ai .bubble-inline-html::before {
  display: none;
}

/* ==================== 消息时间显示 ==================== */
.message-time {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  font-weight: 400;
  white-space: nowrap;
  margin-top: 0;
  padding: 0 4px;
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 6px;
}

.message-bubble.user .message-time {
  text-align: right;
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-bubble.ai .message-time {
  text-align: left;
  align-self: flex-end;
}

/* ==================== 语音喇叭图标（时间上方） ==================== */
.message-voice-icon {
  align-self: flex-end;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.message-bubble.user .message-voice-icon {
  justify-content: flex-end;
}

.message-bubble.ai .message-voice-icon {
  justify-content: flex-start;
}

.message-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.bubble-segment {
  background: inherit;
  border-radius: inherit;
  padding: 0;
}

.bubble-attachments {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.bubble-attachment {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: var(--font-size-xs);
  background: rgba(0, 0, 0, 0.1);
  color: inherit;
}

.message-bubble.user .bubble-attachment {
  background: rgba(255, 255, 255, 0.25);
}

.message-bubble.ai .bubble-attachment {
  background: rgba(0, 0, 0, 0.08);
}

.bubble-image-wrapper {
  max-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 正常图片样式（直接显示图片） */
.bubble-image {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.12);
  /* 固定尺寸：3:4竖屏比例，高度250px，宽度188px（250 * 3/4） */
  /* 占位符固定尺寸，用于滚动位置计算 */
  width: 188px;
  height: 250px;
  min-height: 250px;
}

.message-bubble.user .bubble-image {
  background: rgba(255, 255, 255, 0.2);
}

.bubble-image-media {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}

.bubble-image-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* 图片铺满容器，而不是居中显示 */
}

.bubble-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-sizing: border-box;
  color: var(--text-primary);
  font-size: var(--font-size-base);
  letter-spacing: 1px;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 16px rgba(15, 22, 32, 0.12), inset 0 1px 2px rgba(0, 0, 0, 0.06);
  border-radius: 18px;
}

/* 图片fallback样式（卡片样式，与表情包一致，仅在加载失败时使用） */
.bubble-image-item {
  width: min(140px, 60vw);
  height: min(140px, 60vw);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 8px 16px rgba(15, 22, 32, 0.12), inset 0 1px 2px rgba(0, 0, 0, 0.06);
  position: relative;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.bubble-image-item:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 24px rgba(15, 22, 32, 0.16), inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.bubble-image-fallback .bubble-image-media {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
}

.bubble-image-placeholder-text {
  font-size: var(--font-size-base);
  color: var(--text-primary);
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
  padding: 0;
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 图片详情弹窗样式 */
.chat-image-detail-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.chat-image-detail-modal.show {
  opacity: 1;
  pointer-events: auto;
}

.chat-image-detail-modal.closing {
  opacity: 0;
}

.chat-image-detail-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chat-image-detail-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  background: var(--bg-primary);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  transform: scale(0.9);
  transition: transform 0.2s ease;
}

.chat-image-detail-modal.show .chat-image-detail-content {
  transform: scale(1);
}

.chat-image-detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.chat-image-detail-close:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

.chat-image-detail-close svg {
  width: 20px;
  height: 20px;
}

.chat-image-detail-image {
  width: 100%;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.chat-image-detail-image img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  display: block;
}

.chat-image-detail-placeholder {
  width: 100%;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--font-size-lg);
}

.chat-image-detail-info {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
}

.chat-image-detail-desc {
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--text-primary);
  margin-bottom: 8px;
  word-break: break-word;
}

.chat-image-detail-hint {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  opacity: 0.8;
}

.bubble-image-refresh {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: 8px;
  bottom: 8px;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.bubble-image-refresh i {
  font-size: 14px;
}

.bubble-image-refresh:hover {
  transform: scale(1.08);
}

.bubble-image-refresh.loading {
  animation: bubble-spin 1s linear infinite;
  pointer-events: none;
  opacity: 0.6;
}

@keyframes bubble-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}


.image-composer-mode {
  display: inline-flex;
  gap: 8px;
}

.image-composer-mode button {
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: var(--font-size-sm);
  transition: all var(--transition-fast);
}

.image-composer-mode button:hover {
  background: var(--bg-hover);
  border-color: var(--brand-primary);
}

.image-composer-mode button.active {
  background: var(--brand-primary);
  color: var(--text-on-primary);
  border-color: var(--brand-primary);
}

.image-upload-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px dashed var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.image-upload-btn:hover {
  border-color: var(--brand-primary);
  color: var(--text-primary);
}

.image-upload-btn input {
  display: none;
}

.image-composer-preview {
  margin-top: 12px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.05);
}

.image-composer-preview img {
  display: block;
  width: 100%;
  height: auto;
}

.image-composer-hint {
  margin-top: 6px;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.voice-composer-mode {
  display: inline-flex;
  gap: 8px;
}

.voice-composer-modal.image-composer-modal .modal-content {
  width: min(420px, 92vw);
}

.voice-composer-modal .image-composer-section {
  display: block;
}

.voice-composer-modal .image-composer-section[hidden] {
  display: none !important;
}

.voice-composer-mode button {
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: var(--font-size-sm);
  transition: all var(--transition-fast);
}

.voice-composer-mode button:hover {
  background: var(--bg-hover);
  border-color: var(--brand-primary);
}

.voice-composer-mode button.active {
  background: var(--brand-primary);
  color: var(--text-on-primary);
  border-color: var(--brand-primary);
}

.voice-composer-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.voice-recorder-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.voice-recorder-panel button {
  min-width: 140px;
}

.voice-recorder-panel button.recording {
  background: linear-gradient(135deg, #ff5e62, #ff9966);
  color: #fff;
}

.voice-recorder-status {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.voice-recorder-hint {
  font-size: var(--font-size-xxs);
  color: var(--text-secondary);
  line-height: 1.5;
}

.voice-language-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bubble-voice {
  position: relative;
  cursor: pointer;
  padding: 12px 16px;
  /* 继承 bubble-text 的样式，不单独设置背景 */
  min-height: auto;
  line-height: 1.4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-auto-rows: auto;
  column-gap: 12px;
  row-gap: 6px;
  align-items: center;
}

/* 用户消息：改为3列布局，从左到右：查看文字 → 波浪动画 → 时间戳 */
.message-bubble.user .bubble-voice {
  grid-template-columns: auto minmax(0, 1fr) auto;
  column-gap: 10px;
}

.bubble-voice::before {
  /* 移除独立的背景渐变，使用 bubble-text 的样式 */
  display: none;
}

.bubble-voice-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 1;
  grid-column: 1 / 2;
  grid-row: 1;
}

/* 用户消息：拆开bar，让时间和波浪分别占据不同列 */
.message-bubble.user .bubble-voice-bar {
  display: contents;
}

.message-bubble.user .bubble-voice-time {
  grid-column: 3 / 4;
  grid-row: 1;
  justify-self: end;
  margin-right: -16px;
  margin-left: 18px;
}

.message-bubble.user .bubble-voice-wave {
  grid-column: 2 / 3;
  grid-row: 1;
}

.message-bubble.ai .bubble-voice-bar {
  flex-direction: row;
}

.bubble-voice-time {
  font-size: var(--font-size-base);
  font-weight: 500;
  min-width: 36px;
  flex-shrink: 0;
  line-height: 1.2;
}

.message-bubble.user .bubble-voice-time {
  color: rgba(255, 255, 255, 0.95);
}

.message-bubble.ai .bubble-voice-time {
  color: var(--text-primary);
}

.bubble-voice-wave {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  height: 24px;
  min-height: 24px;
  max-height: 24px;
}

.message-bubble.user .bubble-voice-wave {
  justify-content: flex-start;
}

.bubble-voice-wave span {
  display: block;
  width: 3.5px;
  height: 16px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.6;
  animation: voiceWave 1.5s ease-in-out infinite;
}

.message-bubble.user .bubble-voice-wave span {
  background: rgba(255, 255, 255, 0.9);
}

.message-bubble.ai .bubble-voice-wave span {
  background: var(--text-secondary);
}

.bubble-voice-wave span:nth-child(1) { animation-delay: 0s; }
.bubble-voice-wave span:nth-child(2) { animation-delay: 0.2s; }
.bubble-voice-wave span:nth-child(3) { animation-delay: 0.4s; }
.bubble-voice-wave span:nth-child(4) { animation-delay: 0.6s; }
.bubble-voice-wave span:nth-child(5) { animation-delay: 0.8s; }

.bubble-voice-toggle {
  margin-top: 0px;
  font-size: var(--font-size-xxs);
  position: relative;
  z-index: 1;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s ease;
  grid-column: 2 / 3;
  grid-row: 1;
  align-self: center;
  justify-self: end;
  white-space: nowrap;
}

/* 用户消息：查看文字在第一列（最左边） */
.message-bubble.user .bubble-voice-toggle {
  grid-column: 1 / 2;
  justify-self: start;
}

.message-bubble.user .bubble-voice-toggle {
  color: rgba(255, 255, 255, 0.9);
}

.message-bubble.ai .bubble-voice-toggle {
  color: var(--brand-primary);
}

.bubble-voice.expanded .bubble-voice-toggle {
  opacity: 0.6;
}

.message-bubble.ai .bubble-voice.expanded .bubble-voice-toggle {
  color: var(--text-tertiary);
}

.bubble-voice-text {
  display: none;
  margin-top: 0px;
  font-size: var(--font-size-sm);
  line-height: 1.5;
  position: relative;
  z-index: 1;
  word-wrap: break-word;
  white-space: pre-wrap;
  grid-column: 1 / -1;
}

.message-bubble.user .bubble-voice-text {
  color: rgba(255, 255, 255, 0.95);
}

.message-bubble.ai .bubble-voice-text {
  color: var(--text-primary);
}

.bubble-voice.expanded .bubble-voice-text {
  display: block;
}

.bubble-voice.voice-loading .bubble-voice-wave span {
  opacity: 0.4;
}

.bubble-voice.voice-playing .bubble-voice-wave span {
  opacity: 1;
}

.message-bubble.user .bubble-voice.voice-playing .bubble-voice-wave span {
  background: rgba(255, 255, 255, 1);
}

.message-bubble.ai .bubble-voice.voice-playing .bubble-voice-wave span {
  background: var(--brand-primary);
}

.bubble-voice.voice-error .bubble-voice-wave span {
  opacity: 0.9;
}

.message-bubble.user .bubble-voice.voice-error .bubble-voice-wave span {
  background: rgba(255, 200, 200, 1);
}

.message-bubble.ai .bubble-voice.voice-error .bubble-voice-wave span {
  background: #e35d6a;
}

.voice-icon-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.voice-play-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: transparent;
  color: var(--brand-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.05);
}

.voice-play-icon:hover {
  border-color: var(--border-light);
  color: var(--brand-secondary);
  transform: scale(1.05);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.08);
}

.voice-play-icon:active {
  transform: scale(0.95);
}

.voice-play-icon:focus-visible {
  outline: 2px solid var(--brand-secondary);
  outline-offset: 1px;
}

.voice-play-icon svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.voice-play-icon:hover svg {
  transform: scale(1.1);
}

.voice-play-icon i {
  font-size: 14px;
}

.message-bubble.user .voice-play-icon {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--brand-secondary);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.05);
}

.message-bubble.user .voice-play-icon:hover {
  background: transparent;
  border-color: var(--border-light);
  color: var(--brand-secondary);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.08);
}

@keyframes voiceWave {
  0%, 100% { transform: scaleY(0.4); height: 6px; }
  50% { transform: scaleY(1.0); height: 20px; }
}

/* ==================== 现代化加载动画 ==================== */
.message-bubble.loading .bubble-text {
  padding: 6px 16px;
  line-height: 1.2;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
}

.message-bubble.loading .bubble-text::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(var(--accent-color-rgb), 0.1) 50%,
    transparent 100%);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.loading-dots {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chat-highlight, var(--brand-primary));
  animation: dotPulse 1.4s infinite ease-in-out;
  box-shadow: 0 2px 4px rgba(var(--chat-highlight-rgb, var(--accent-color-rgb)), 0.3);
}

.loading-dots span:nth-child(1) {
  animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotPulse {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* ==================== 消息发送状态指示器 ==================== */
.message-status {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  margin-left: 4px;
  opacity: 0.7;
}

.message-bubble.user .message-status {
  margin-left: 0;
  margin-right: 4px;
}

.message-status.sending {
  color: var(--brand-primary);
  animation: statusPulse 1s infinite;
}

.message-status.sent {
  color: var(--text-tertiary);
}

.message-status.delivered {
  color: var(--brand-primary);
}

.message-status.read {
  color: var(--brand-secondary);
}

@keyframes statusPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ==================== 现代化输入栏 ==================== */
.chat-input-bar {
  --chat-input-gap: 12px;
  --chat-input-safe-reserve: 32px;
  --chat-input-safe-inset: max(0px, calc(var(--safe-area-bottom) - var(--chat-input-safe-reserve)));
  --chat-input-float-gap: clamp(8px, 1.8vh, 18px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 10px 12px;
  padding-bottom: calc(var(--chat-input-gap) + var(--chat-input-safe-inset));
  background: var(--navbar-bg-standard);
  border-top: 1px solid var(--navbar-border);
  flex-shrink: 0;
  position: absolute;
  left: -2px;
  right: -2px;
  width: calc(100% + 4px);
  bottom: max(0px, calc(var(--chat-input-float-gap) - var(--chat-input-safe-inset) - 2px));
  width: 100%;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: var(--z-tabbar);
  box-shadow:
    0 -6px 16px rgba(0, 0, 0, 0.08),
    0 -1px 4px rgba(0, 0, 0, 0.06);
}

body[data-device="ios"] .chat-input-bar,
body[data-device="ios"][data-statusbar="hidden"] .chat-input-bar,
body[data-device="ios"].composer-resetting .chat-input-bar {
  --chat-input-gap: 4px;
  --chat-input-safe-reserve: 8px;
  /* 苹果：让输入栏整体再靠下贴近底部一点点 */
  --chat-input-float-gap: clamp(0px, 0.3vh, 8px);
  padding-bottom: calc(var(--chat-input-gap) + var(--chat-input-safe-inset));
  transition: bottom var(--transition-fast), padding var(--transition-fast);
}

body[data-device="android"] .chat-input-bar {
  --chat-input-safe-reserve: 0px;
  --chat-input-float-gap: clamp(16px, 2.2vh, 28px);
}

body[data-device="android"].composer-focused .chat-input-bar {
  bottom: clamp(28vh, calc(var(--chat-input-float-gap) + var(--android-composer-boost, 40vh) - 2px), 70vh);
  box-shadow:
    0 -6px 24px rgba(0, 0, 0, 0.25),
    0 -2px 8px rgba(0, 0, 0, 0.15);
}

.chat-input-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--brand-primary) 50%,
    transparent 100%);
  opacity: 0.3;
}

.composer-gesture-zone {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}

.composer-gesture-zone.sending {
  animation: composerSendGlow 0.6s ease;
  border-radius: 16px;
}

.composer-gesture-zone.swiping::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 48px;
  width: 64px;
  height: 64px;
  transform: translateX(-50%);
  border-radius: 32px;
  background: radial-gradient(circle, rgba(52, 199, 89, 0.5) 0%, rgba(52, 199, 89, 0) 70%);
  animation: composerSwipeHint 0.6s infinite alternate ease-in-out;
  pointer-events: none;
}

.chat-input-bar.date-lock-active .composer-gesture-zone {
  opacity: 0.55;
}

.chat-input-bar.date-lock-active .chat-input,
.chat-input-bar.date-lock-active .input-btn,
.chat-input-bar.date-lock-active .composer-feature {
  pointer-events: none;
}

.chat-input-bar.date-lock-active .input-btn,
.chat-input-bar.date-lock-active .composer-feature {
  opacity: 0.45;
}

.chat-input-bar.date-lock-active .chat-input {
  cursor: not-allowed;
}

.composer-lock-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px dashed rgba(52, 120, 246, 0.35);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.composer-lock-banner i {
  color: var(--brand-primary);
  font-size: 1rem;
  line-height: 1;
  margin-top: 2px;
}

.composer-lock-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lock-banner-title {
  font-weight: 600;
  color: var(--text-primary);
}

.lock-banner-desc {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

@keyframes composerSwipeHint {
  0% {
    opacity: 0.2;
    transform: translate(-50%, 0) scale(0.8);
  }
  100% {
    opacity: 0.6;
    transform: translate(-50%, -16px) scale(1);
  }
}

.composer-quote-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-secondary);
  border-left: 3px solid var(--brand-primary);
  border-radius: 14px;
  padding: 10px 12px;
  min-height: 48px;
  transition: all var(--transition-fast);
}

.composer-quote-preview.hidden {
  display: none;
}

.quote-preview-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  flex: 1;
}

.quote-preview-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-primary);
}

.quote-preview-sender {
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.2;
  font-weight: 500;
}

.quote-preview-content {
  font-size: var(--font-size-xxs);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.quote-preview-close {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  align-self: flex-start;
  transition: color var(--transition-fast);
}

.quote-preview-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-radius: 4px;
}

.composer-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border-radius: 0;
  padding: 0;
  border: none;
  box-shadow: none;
  transition: all var(--transition-fast);
  margin: 0;
}

.composer-input-row:focus-within {
  box-shadow: none;
  transform: none;
}

.composer-draft-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 4px 4px;
  min-height: 0;
}

.composer-draft-tags.hidden {
  display: none;
}

.draft-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-color-rgb), 0.25);
  background: rgba(var(--accent-color-rgb), 0.08);
  color: var(--text-primary);
  font-size: var(--font-size-xxs);
  line-height: 1.2;
  padding: 3px 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.draft-tag i {
  font-size: 14px;
  color: var(--brand-primary);
}

.draft-tag:hover {
  border-color: rgba(var(--accent-color-rgb), 0.4);
  background: rgba(var(--accent-color-rgb), 0.16);
  transform: translateY(-1px);
}

.draft-tag:active {
  transform: translateY(0);
}

.draft-tag-voice {
  border-color: rgba(52, 199, 89, 0.45);
  background: rgba(52, 199, 89, 0.12);
}

.draft-tag-voice i:first-child {
  color: rgba(52, 199, 89, 0.9);
}

.draft-tag-voice i:last-child {
  color: var(--text-secondary);
  font-size: 12px;
}

.composer-feature-panel {
  display: none;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 10px;
  padding: 2px 12px;
  margin-bottom: 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  /* 隐藏滚动条但保持滚动功能 */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.composer-feature-panel::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* ==================== 上划发送动画特效 ==================== */
@keyframes composerSendGlow {
  0% {
    box-shadow: 0 0 0 rgba(var(--accent-color-rgb), 0);
    transform: translateY(0);
  }
  25% {
    box-shadow: 0 0 20px rgba(var(--accent-color-rgb), 0.4);
    transform: translateY(-2px);
  }
  50% {
    box-shadow: 0 0 30px rgba(var(--accent-color-rgb), 0.6);
    transform: translateY(-4px);
  }
  75% {
    box-shadow: 0 0 20px rgba(var(--accent-color-rgb), 0.4);
    transform: translateY(-2px);
  }
  100% {
    box-shadow: 0 0 0 rgba(var(--accent-color-rgb), 0);
    transform: translateY(0);
  }
}

@keyframes swipeUpIndicator {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  50% {
    opacity: 1;
    transform: translateY(-5px);
  }
  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
}

.composer-gesture-zone.sending::after {
  content: '↑';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  color: var(--brand-primary);
  animation: swipeUpIndicator 0.6s ease;
  pointer-events: none;
  z-index: 10;
}

.composer-feature-panel.active {
  display: flex;
  flex-direction: row;
}

@keyframes featurePanelSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.composer-feature-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.composer-feature {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  color: var(--text-on-primary);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--brand-primary);
  box-shadow:
    0 4px 12px rgba(var(--accent-color-rgb), 0.25),
    0 2px 4px rgba(0, 0, 0, 0.1);
}

.composer-feature::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  opacity: 1;
  transition: opacity var(--transition-fast);
  border-radius: 16px;
}

.composer-feature:hover {
  /* 仅放大，不再向上位移，避免高亮被上方容器遮挡 */
  transform: scale(1.05);
  box-shadow:
    0 6px 16px rgba(var(--accent-color-rgb), 0.3),
    0 2px 8px rgba(0, 0, 0, 0.15);
}

.composer-feature:active {
  transform: translateY(0) scale(1);
}

.composer-feature i {
  font-size: 18px;
  color: var(--text-on-primary);
  position: relative;
  z-index: 1;
  transition: all var(--transition-fast);
}

.composer-feature-label {
  font-size: var(--font-size-xxs);
  color: var(--text-secondary);
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.composer-feature:hover i {
  transform: scale(1.1);
}

.composer-send-hint {
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  margin: 0 0 4px;
  transition: opacity var(--transition-fast);
}

.composer-send-hint.hidden {
  opacity: 0;
  height: 0;
  overflow: hidden;
}

.chat-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.chat-modal .modal-content {
  background: var(--bg-card);
  border-radius: 16px;
  width: min(460px, 90%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-modal .modal-header,
.chat-modal .modal-footer {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-modal .modal-body {
  padding: 0 16px 16px;
}

.chat-modal textarea {
  width: 100%;
  min-height: 160px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  font-family: inherit;
  font-size: var(--font-size-base);
  background: var(--bg-input);
  color: var(--text-primary);
}

.input-btn {
  width: 34px;
  height: 34px;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: var(--font-size-base);
  cursor: pointer;
  border-radius: 16px;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.input-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  opacity: 0;
  transition: opacity var(--transition-fast);
  border-radius: 16px;
}

.input-btn:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-primary);
}

.input-btn:hover::before {
  opacity: 0.1;
}

.input-btn:active {
  transform: translateY(0);
}

#btn-plus {
  margin-left: 1px;
  margin-right: 1px;
  margin-top: -10px;
}

.input-btn.send-btn {
  color: var(--brand-primary);
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  border-color: var(--brand-primary);
  box-shadow:
    0 4px 12px rgba(var(--accent-color-rgb), 0.25),
    0 2px 4px rgba(0, 0, 0, 0.1);
}

.input-btn.send-btn i {
  color: var(--text-on-primary);
  position: relative;
  z-index: 1;
}

.input-btn.send-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow:
    0 6px 16px rgba(var(--accent-color-rgb), 0.3),
    0 2px 8px rgba(0, 0, 0, 0.15);
}

.input-wrapper {
  flex: 1;
  max-height: 100px;
  overflow: hidden;
  position: relative;
}

.chat-input {
  width: 100%;
  min-height: 40px;
  max-height: 100px;
  padding: 10px 16px;
  border: 1px solid var(--border-light);
  border-radius: 20px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  resize: none;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  transition: all var(--transition-fast);
  line-height: 1.4;
}

.chat-input::-webkit-scrollbar {
  display: none;
}

.chat-input:focus {
  outline: none;
  background: var(--bg-primary);
  border-color: var(--border-light);
  box-shadow:
    0 4px 16px rgba(var(--accent-color-rgb), 0.15),
    inset 0 0 0 2px var(--brand-primary);
  transform: translateY(-1px);
}

.chat-input::placeholder {
  color: var(--text-tertiary);
  font-weight: 400;
}

/* ==================== 空状态 ==================== */
.empty-state,
.placeholder-view,
.error-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 60px 20px;
  text-align: center;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(var(--accent-color-rgb), 0.2);
  animation: emptyIconFloat 3s ease-in-out infinite;
}

@keyframes emptyIconFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  25% {
    transform: translateY(-4px) rotate(1deg);
  }
  50% {
    transform: translateY(-8px) rotate(0deg);
  }
  75% {
    transform: translateY(-4px) rotate(-1deg);
  }
}

/* ==================== 页面过渡动画 ==================== */
.chat-content {
  animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== 滚动指示器 ==================== */
.chat-messages {
  position: relative;
}

.chat-history-loader {
  display: flex;
  justify-content: center;
  padding: 8px 0 12px;
}

.chat-history-button {
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.chat-history-button:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.message-bubble.bubble-highlight {
  animation: bubbleHighlight 2s ease;
  border-radius: inherit;
  overflow: visible;
}

@keyframes bubbleHighlight {
  0% {
    box-shadow:
      0 0 0 rgba(var(--accent-color-rgb), 0),
      0 0 0 rgba(var(--accent-color-rgb), 0);
    transform: scale(1);
  }
  30% {
    box-shadow:
      0 0 0 2px rgba(var(--accent-color-rgb), 0.14),
      0 12px 32px 8px rgba(var(--accent-color-rgb), 0.22);
    transform: scale(1.004);
  }
  100% {
    box-shadow:
      0 0 0 rgba(var(--accent-color-rgb), 0),
      0 0 0 rgba(var(--accent-color-rgb), 0);
    transform: scale(1);
  }
}

.chat-messages::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(transparent, var(--bg-primary));
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.chat-messages.has-more::after {
  opacity: 1;
}

/* ==================== 消息气泡悬停增强 ==================== */
.message-bubble:hover .message-avatar {
  transform: scale(1.05);
  box-shadow:
    0 4px 12px rgba(var(--chat-highlight-rgb, var(--accent-color-rgb)), 0.2),
    0 2px 6px rgba(0, 0, 0, 0.1);
}

.message-bubble.user:hover .message-avatar {
  box-shadow:
    0 4px 12px rgba(var(--chat-highlight-rgb, var(--accent-color-rgb)), 0.3),
    0 2px 6px rgba(0, 0, 0, 0.15);
}

.empty-state-icon svg {
  width: 40px;
  height: 40px;
  fill: var(--text-on-primary);
}

.empty-state-text {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.empty-state-hint {
  font-size: var(--font-size-md);
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 280px;
  margin: 0;
}

/* 兼容旧样式 */
.empty-state i,
.placeholder-view i {
  font-size: var(--icon-size);
  color: var(--text-tertiary);
  opacity: 0.5;
}

.empty-state p,
.placeholder-view p {
  font-size: var(--font-size-base-lg);
  margin: 0;
}

.empty-hint,
.placeholder-hint {
  font-size: var(--font-size-md) !important;
  color: var(--text-tertiary) !important;
}

.quick-reply-section {
  margin-top: 16px;
  padding: 16px;
  border-radius: 20px;
  background: var(--bg-card);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quick-reply-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quick-reply-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.quick-reply-desc {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: 4px;
}

.quick-reply-add {
  border: none;
  background: var(--bg-primary);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: var(--font-size-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--border-color);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.quick-reply-add:hover {
  background: var(--bg-tertiary);
}

.quick-reply-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 30px; /* 🔥🔥🔥 关键！解决滚动回弹问题！ */
}

.quick-reply-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.quick-reply-text {
  flex: 1;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  line-height: 1.5;
  word-break: break-word;
}

.quick-reply-actions {
  display: flex;
  gap: 6px;
}

.quick-reply-btn {
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.quick-reply-btn:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.quick-reply-btn.danger {
  color: var(--brand-danger, #ff3b30);
  background: rgba(255, 59, 48, 0.08);
}

.quick-reply-empty {
  padding: 12px;
  text-align: center;
  border-radius: 14px;
  border: 1px dashed var(--border-color);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.chat-search-section {
  margin-top: 16px;
  padding: 16px;
  border-radius: 20px;
  background: var(--bg-card);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-search-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-search-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-search-input input {
  flex: 1;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: var(--font-size-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
}

.chat-search-input button {
  border: none;
  background: var(--brand-primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.chat-search-input button:hover {
  opacity: 0.85;
}

.chat-search-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.chat-search-filter select {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 6px 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
}

.chat-search-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
}

.chat-search-result {
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 10px 12px;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-search-meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.chat-search-text {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  line-height: 1.5;
  word-break: break-word;
}

.chat-search-text mark {
  background: rgba(var(--accent-color-rgb), 0.16);
  border-radius: 4px;
  padding: 0 2px;
  box-shadow:
    0 0 0 1px rgba(var(--accent-color-rgb), 0.18),
    0 4px 10px rgba(var(--accent-color-rgb), 0.25);
}

.chat-search-jump {
  align-self: flex-end;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: 12px;
  padding: 4px 10px;
  font-size: var(--font-size-xs);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.chat-search-jump:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.chat-search-empty,
.chat-search-loading {
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  padding: 12px 0;
}

/* ==================== 角色选择器 ==================== */
/* 使用 contacts-modal 样式，此处仅保留角色选择器特定的内容样式 */

.contacts-modal .character-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contacts-modal .character-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.contacts-modal .character-option:hover {
  background: var(--bg-hover);
  border-color: var(--brand-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.contacts-modal .character-option:active {
  background: var(--bg-active);
  transform: scale(0.98);
}

.contacts-modal .character-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-2xl);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.contacts-modal .character-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contacts-modal .character-avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.contacts-modal .character-name {
  font-size: var(--font-size-md);
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

/* ==================== 群聊创建器 ==================== */
.group-creator-modal .form-item {
  margin-bottom: 16px;
}

.group-creator-modal .group-member-hint {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.group-creator-modal .group-member-list {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 8px;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.group-creator-modal .group-member-list.empty {
  justify-content: center;
  align-items: center;
}

.group-creator-modal .group-member-empty {
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  padding: 24px 12px;
}

.group-member-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--color-surface);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.group-member-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-primary);
}

.group-member-option:hover {
  border-color: var(--brand-primary);
  background: var(--bg-hover);
}

.group-member-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.group-member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-member-avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: var(--font-size-xl);
}

.group-member-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.group-member-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text-primary);
}

.group-member-tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(var(--accent-color-rgb, 17, 120, 255), 0.12);
  color: var(--brand-primary);
}

.group-member-tag.npc {
  background: rgba(255, 87, 51, 0.15);
  color: #ff5733;
}

.group-member-tag.mask {
  background: rgba(102, 126, 234, 0.15);
  color: #667eea;
}

.group-member-desc {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  line-height: 1.4;
  max-height: 32px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== 群聊视图 ==================== */
.group-chat-header {
  padding: 16px;
  margin: 0 12px 12px;
  border-radius: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.group-chat-header.compact {
  margin-top: 12px;
}

.group-info-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.group-info-title-row {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-mask-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(var(--accent-color-rgb, 17, 120, 255), 0.12);
  color: var(--brand-primary);
}

.group-info-meta {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.group-info-types {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.group-info-mask-desc {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  line-height: 1.4;
}

.group-member-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.group-member-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--color-surface);
  border: 1px solid var(--border-light);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
}

.group-member-chip-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.group-member-chip-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-member-chip-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  width: 100%;
  height: 100%;
}

.group-member-empty {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.group-member-more {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.group-conversation-section {
  margin: 0 12px 8px;
  border-radius: 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.group-detail-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.group-member-detail-section {
  border-radius: 16px;
  border: 1px solid var(--border-color);
  padding: 12px;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.group-section-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--font-size-sm);
}

.group-member-detail-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.group-member-detail-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.group-member-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ==================== 我的Tab功能列表 ==================== */
.profile-function-list {
  display: flex;
  flex-direction: column;
  padding: 8px 8px 50px 8px; /* 🔥🔥🔥 最关键！解决滚动回弹问题！ */
  gap: 8px;
}

.profile-function-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color var(--transition-fast);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
}

.profile-function-item:hover {
  background: var(--bg-hover);
}

.profile-function-item:active {
  background: var(--bg-active);
}

.profile-function-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xl);
  color: var(--brand-primary);
  flex-shrink: 0;
}

.profile-function-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-function-title {
  font-size: var(--font-size-base-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.profile-function-desc {
  font-size: var(--font-size-md);
  color: var(--text-secondary);
}

.profile-function-arrow {
  color: var(--text-tertiary);
  font-size: var(--font-size-md);
  flex-shrink: 0;
}

/* ==================== 面具选择器 ==================== */
.contacts-modal .mask-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  position: relative;
}

.contacts-modal .mask-option:hover {
  background: var(--bg-hover);
  border-color: var(--brand-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.contacts-modal .mask-option:active {
  background: var(--bg-active);
  transform: scale(0.98);
}

.contacts-modal .mask-option.active {
  background: var(--bg-hover);
  border-color: var(--brand-primary);
}

.contacts-modal .mask-option .mask-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--chat-highlight, var(--brand-primary)), var(--brand-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-2xl);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  box-shadow:
    0 2px 8px rgba(var(--chat-highlight-rgb, var(--accent-color-rgb)), 0.15),
    0 1px 2px rgba(0, 0, 0, 0.1);
  transition: all var(--transition-fast);
}

.contacts-modal .mask-option .mask-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.contacts-modal .mask-option .mask-avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-on-primary);
  font-weight: 600;
  font-size: var(--font-size-xs);
}

.contacts-modal .mask-option .mask-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contacts-modal .mask-option .mask-name {
  font-size: var(--font-size-md);
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.contacts-modal .mask-option .mask-desc {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== 快捷回复选择器 ==================== */
.contacts-modal .quick-reply-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  position: relative;
}

.contacts-modal .quick-reply-option:hover {
  background: var(--bg-hover);
  border-color: var(--brand-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.contacts-modal .quick-reply-option:active {
  background: var(--bg-active);
  transform: scale(0.98);
}

.contacts-modal .quick-reply-option-text {
  font-size: var(--font-size-md);
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  line-height: 1.5;
  word-break: break-word;
}

/* ==================== 响应式优化 ==================== */
@media (max-width: 320px) {
  .session-avatar {
    width: 40px;
    height: 40px;
    font-size: var(--font-size-2xl);
  }
  
  .session-name {
    font-size: var(--font-size-base);
  }
  
  .session-message {
    font-size: var(--font-size-sm);
  }
  
  .message-content {
    font-size: var(--font-size-md);
  }
}

/* ==================== 滚动条样式 ==================== */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--text-tertiary);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}
/* ==================== 现代化ActionSheet ==================== */
.chat-action-sheet {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  z-index: 11000;
  pointer-events: none;
}

.chat-action-sheet .action-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chat-action-sheet .action-sheet-panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: transparent;
  padding: 0 20px 32px;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: auto;
}

.chat-action-sheet .action-sheet-title {
  background: var(--bg-card);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 20px 24px;
  text-align: center;
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  position: relative;
  box-shadow: var(--shadow-sm);
}

.chat-action-sheet .action-sheet-title::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  background: var(--text-tertiary);
  border-radius: 2px;
  opacity: 0.3;
}

.chat-action-sheet .action-sheet-options {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-bottom-left-radius: 24px;
  border-bottom-right-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.chat-action-sheet .action-sheet-option {
  border: none;
  background: transparent;
  padding: 18px 24px;
  font-size: var(--font-size-base-lg);
  color: var(--text-primary);
  border-top: 1px solid var(--border-light);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  font-weight: 500;
}

.chat-action-sheet .action-sheet-option:first-child {
  border-top: none;
}

.chat-action-sheet .action-sheet-option.danger {
  color: var(--semantic-error);
}

.chat-action-sheet .action-sheet-option:hover {
  background: var(--bg-hover);
}

.chat-action-sheet .action-sheet-option:active {
  background: var(--bg-active);
  transform: scale(0.98);
}

.chat-action-sheet .action-sheet-cancel {
  margin-top: 16px;
  width: 100%;
  border: none;
  background: var(--bg-card);
  border-radius: 24px;
  padding: 18px 24px;
  font-size: var(--font-size-base-lg);
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-md);
}

.chat-action-sheet .action-sheet-cancel:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.chat-action-sheet .action-sheet-cancel:active {
  transform: translateY(0);
}

.chat-action-sheet.show .action-sheet-backdrop {
  opacity: 1;
}

.chat-action-sheet.show .action-sheet-panel {
  transform: translateY(0);
}

.chat-action-sheet.closing .action-sheet-backdrop {
  opacity: 0;
}

.chat-action-sheet.closing .action-sheet-panel {
  transform: translateY(100%);
}

/* ==================== 消息引用弹窗（横向操作菜单） ==================== */
.message-quote-popup {
  position: fixed;
  z-index: 12000;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.message-quote-popup.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.message-quote-popup.closing {
  opacity: 0;
  transform: translateY(10px) scale(0.95);
}

.quote-popup-content {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 
    0 6px 24px rgba(0, 0, 0, 0.15),
    0 2px 6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  width: 280px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
}

.quote-popup-preview {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
}

.quote-preview-text {
  flex: 1;
  font-size: var(--font-size-xxs);
  color: var(--text-secondary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: break-word;
}

.quote-popup-actions {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 4px 2px;
  gap: 1px;
}

.quote-action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 8px;
  transition: all var(--transition-fast);
  font-size: var(--font-size-xxs);
  min-width: 0;
}

.quote-action-btn i {
  font-size: var(--font-size-xxs);
  margin-bottom: 1px;
}

.quote-action-btn span {
  font-size: var(--font-size-xxs);
  font-weight: 500;
  white-space: nowrap;
}

.quote-action-btn:hover {
  background: var(--bg-hover);
  transform: translateY(-2px);
}

.quote-action-btn:active {
  background: var(--bg-active);
  transform: translateY(0) scale(0.95);
}

.quote-action-btn.danger {
  color: var(--semantic-error, #ff4444);
}

.quote-action-btn.danger:hover {
  background: rgba(var(--semantic-error-rgb, 255, 68, 68), 0.1);
}

.quote-action-btn.danger:active {
  background: rgba(var(--semantic-error-rgb, 255, 68, 68), 0.15);
}

/* 响应式调整 */
@media (max-width: 480px) {
  .quote-popup-content {
    width: 260px;
  }
  
  .quote-action-btn {
    padding: 5px 3px;
  }
  
  .quote-action-btn i {
    font-size: var(--font-size-xxs);
  }
  
  .quote-action-btn span {
    font-size: var(--font-size-xxs);
  }
}

/* ==================== 聊天详情页面 ==================== */
.chat-detail-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--navbar-padding);
  background: var(--navbar-bg-standard);
  border-bottom: 1px solid var(--navbar-border);
  flex-shrink: 0;
  position: relative;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.chat-detail-navbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--brand-primary) 50%,
    transparent 100%);
  opacity: 0.3;
}

.chat-detail-navbar .nav-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--nav-title-font-size);
  font-weight: var(--nav-title-font-weight);
  color: var(--text-primary);
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-detail-navbar .nav-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--brand-primary);
  cursor: pointer;
  border-radius: 12px;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.chat-detail-navbar .nav-btn i {
  font-size: 18px;
}

.chat-detail-navbar .nav-btn:hover {
  background: var(--bg-hover);
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.chat-detail-navbar .nav-btn:active {
  background: var(--bg-active);
  transform: scale(0.95);
}

.chat-detail-navbar .nav-right {
  display: flex;
  gap: 8px;
}

/* ==================== 聊天详情内容区 ==================== */
.chat-detail-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  height: 100%;
}

.chat-detail-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 30px; /* 🔥🔥🔥 最关键！解决滚动回弹问题！ */
}

.chat-detail-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.2s;
}

.chat-detail-section:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ==================== 聊天详情头部 ==================== */
.chat-detail-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
}

.chat-detail-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.chat-detail-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-detail-avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  color: var(--text-on-primary);
  font-size: 32px;
  font-weight: 600;
}

.chat-detail-name {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--color-text);
}

/* ==================== 聊天详情项 ==================== */
.chat-detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.chat-detail-item:last-child {
  border-bottom: none;
}

.chat-detail-item-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--font-size-md);
  color: var(--color-text);
}

.chat-detail-item-label i {
  color: var(--brand-primary);
  width: 20px;
  text-align: center;
}

.chat-detail-item-value {
  font-size: var(--font-size-md);
  color: var(--color-text-secondary);
  font-weight: 500;
}

.chat-detail-remark-section .remark-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.chat-detail-remark-input {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.chat-detail-remark-input input {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: var(--font-size-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
}

.chat-detail-remark-input .remark-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.chat-detail-remark-hint {
  margin-top: 8px;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

/* ==================== 聊天详情操作项 ==================== */
.chat-detail-action-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-radius: 8px;
  margin-bottom: 8px;
}

.chat-detail-action-item:last-child {
  margin-bottom: 0;
}

.chat-detail-action-item:hover {
  background: var(--bg-hover);
}

.chat-detail-action-item:active {
  background: var(--bg-active);
  transform: scale(0.98);
}

.chat-detail-action-item.danger {
  color: var(--color-error);
}

.chat-detail-action-item.danger .chat-detail-action-label i {
  color: var(--color-error);
}

.chat-detail-action-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--font-size-md);
  color: inherit;
}

.chat-detail-action-label i {
  width: 20px;
  text-align: center;
}

.chat-detail-action-item i.fa-chevron-right {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

.chat-detail-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chat-detail-switch input[type="checkbox"] {
  appearance: none;
  width: 38px;
  height: 20px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.2);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
}

.chat-detail-switch input[type="checkbox"]::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform 0.2s ease;
}

.chat-detail-switch input[type="checkbox"]:checked {
  background: var(--brand-primary);
}

.chat-detail-switch input[type="checkbox"]:checked::after {
  transform: translateX(16px);
}

.chat-detail-switch span[data-role="voice-status"] {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

/* Emoji bubble rendering */
.bubble-emoji-grid {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: 8px;
}

.bubble-emoji-item {
  width: min(140px, 60vw);
  height: min(140px, 60vw);
  border-radius: 20px;
  border: none;
  background: transparent;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  box-shadow: none;
}

.bubble-emoji-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom;
  image-rendering: auto;
  background: transparent;
}

/* Emoji manager */
.emoji-manager-overlay,
.emoji-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10010;
  animation: emojiOverlayIn 0.2s ease forwards;
}

.emoji-manager-overlay.closing,
.emoji-picker-overlay.closing {
  animation: emojiOverlayOut 0.18s ease forwards;
}

@keyframes emojiOverlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes emojiOverlayOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.emoji-manager-panel {
  width: min(960px, 96vw);
  height: min(640px, 92vh);
  background: var(--bg-card);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(15, 22, 32, 0.25);
  overflow: hidden;
}

.emoji-manager-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.emoji-manager-header h3 {
  margin: 0;
  font-size: 20px;
}

.emoji-manager-header p {
  margin: 4px 0 0;
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
}

.emoji-manager-header button {
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 12px;
  cursor: pointer;
}

.emoji-manager-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Tab样式 */
.emoji-manager-tabs {
  display: flex;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  flex-shrink: 0;
}

.emoji-manager-tabs .tab-btn {
  flex: 1;
  min-width: 120px;
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: var(--font-size-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.emoji-manager-tabs .tab-btn:hover {
  color: var(--color-text);
  background: var(--color-bg);
}

.emoji-manager-tabs .tab-btn.active {
  color: var(--brand-secondary);
  border-bottom-color: var(--brand-secondary);
}

.emoji-manager-tabs .tab-btn i {
  font-size: 14px;
}

.emoji-manager-add-group {
  border: none;
  background: var(--bg-tertiary);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.emoji-manager-add-group:hover {
  background: var(--bg-hover);
  transform: scale(1.05);
}

.emoji-manager-add-group:active {
  background: var(--bg-active);
  transform: scale(0.95);
}

.emoji-group-item {
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 10px 12px;
  text-align: left;
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.emoji-group-item.active {
  border-color: var(--brand-primary);
  background: rgba(88, 142, 255, 0.08);
}

.emoji-group-name {
  font-weight: 600;
  color: var(--text-primary);
}

.emoji-group-meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  margin-top: 4px;
}

.emoji-group-empty {
  text-align: center;
  color: var(--text-tertiary);
  padding: 40px 20px;
  font-size: var(--font-size-sm);
}

.emoji-manager-content {
  flex: 1;
  padding: 20px 28px;
  overflow-y: auto;
  background: var(--bg-secondary);
}

.emoji-manager-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}

.emoji-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.emoji-field label {
  font-size: var(--font-size-md);
  font-weight: 500;
  color: var(--color-text);
}

/* ==================== 分组编辑器 ==================== */
.emoji-group-header {
  margin-bottom: 16px;
}

.emoji-group-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.emoji-group-title h3 {
  margin: 0;
  font-size: var(--font-size-base-lg);
  font-weight: 600;
  color: var(--color-text);
}

.emoji-group-actions {
  display: flex;
  gap: 4px;
}

.emoji-group-actions .action-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--brand-primary);
  cursor: pointer;
  border-radius: 8px;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-group-actions .action-btn i {
  font-size: 14px;
}

.emoji-group-actions .action-btn:hover {
  background: var(--bg-hover);
}

.emoji-group-actions .action-btn:active {
  background: var(--bg-active);
  transform: scale(0.95);
}

.emoji-group-editor {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.emoji-group-editor .form-item {
  margin-bottom: 20px;
}

.emoji-group-editor .form-item:last-child {
  margin-bottom: 0;
}

.emoji-group-editor .form-label {
  display: block;
  margin-bottom: 8px;
  font-size: var(--font-size-md);
  font-weight: 500;
  color: var(--color-text);
}

.emoji-group-editor .form-label-required::after {
  content: '*';
  color: var(--semantic-error);
  margin-left: 4px;
  font-weight: 600;
  font-size: 1.1em;
  vertical-align: top;
  line-height: 1;
}

.emoji-group-editor input,
.emoji-group-editor textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: var(--font-size-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: inherit;
  transition: border-color var(--transition-fast);
}

.emoji-group-editor textarea {
  min-height: 72px;
  resize: vertical;
  line-height: 1.6;
}

.emoji-group-editor input:focus,
.emoji-group-editor textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--accent-color-rgb), 0.1);
}

.emoji-group-editor input::placeholder,
.emoji-group-editor textarea::placeholder {
  color: var(--text-tertiary);
}

.emoji-group-editor .form-hint {
  margin-top: 6px;
  font-size: var(--font-size-xs-md);
  color: var(--color-text-secondary);
}

.emoji-group-editor .character-bindings {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 150px;
  overflow-y: auto;
  padding: 8px;
  background: var(--color-bg);
  border-radius: 8px;
}

.emoji-group-editor .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: var(--font-size-md);
  color: var(--color-text);
}

.emoji-group-editor .checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--brand-primary);
}

/* ==================== 上传区域 ==================== */
.emoji-upload-section {
  margin-bottom: 16px;
}

.emoji-upload-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.emoji-upload-card .form-item {
  margin-bottom: 20px;
}

.emoji-upload-card .form-item:last-child {
  margin-bottom: 0;
}

.emoji-upload-card .form-label {
  display: block;
  margin-bottom: 8px;
  font-size: var(--font-size-md);
  font-weight: 500;
  color: var(--color-text);
}

.emoji-upload-row,
.emoji-url-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.emoji-upload-row input,
.emoji-url-row input {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: var(--font-size-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: inherit;
  transition: border-color var(--transition-fast);
}

.emoji-upload-row input:focus,
.emoji-url-row input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--accent-color-rgb), 0.1);
}

.emoji-upload-row input::placeholder,
.emoji-url-row input::placeholder {
  color: var(--text-tertiary);
}

.emoji-upload-desc,
.emoji-url-desc {
  flex: 0 0 120px;
  min-width: 0;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: var(--font-size-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: inherit;
  transition: border-color var(--transition-fast);
}

.emoji-upload-desc:focus,
.emoji-url-desc:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--accent-color-rgb), 0.1);
}

.emoji-import-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: var(--font-size-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: inherit;
  min-height: 72px;
  resize: vertical;
  line-height: 1.6;
  transition: border-color var(--transition-fast);
}

.emoji-import-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--accent-color-rgb), 0.1);
}

.emoji-import-input::placeholder {
  color: var(--text-tertiary);
}

.emoji-upload-card .form-hint {
  margin-top: 6px;
  font-size: var(--font-size-xs-md);
  color: var(--color-text-secondary);
}

.emoji-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}


/* ==================== 表情网格 ==================== */
.emoji-grid-section {
  margin-top: 16px;
}

.emoji-grid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.emoji-grid-header strong {
  font-size: var(--font-size-base-lg);
  font-weight: 600;
  color: var(--color-text);
}

.emoji-grid-header span {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-left: 8px;
}

.emoji-grid-note {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  padding-bottom: 30px;
}

.emoji-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all var(--transition-fast);
}

.emoji-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.emoji-card .emoji-thumb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.emoji-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.emoji-thumb-placeholder {
  font-size: 24px;
  color: var(--text-tertiary);
}

.emoji-card-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.emoji-card-title {
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--color-text);
  line-height: 1.4;
}

.emoji-card-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.emoji-card-actions button {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--brand-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.emoji-card-actions button i {
  font-size: 12px;
}

.emoji-card-actions button:hover {
  background: var(--bg-hover);
}

.emoji-card-actions button:active {
  background: var(--bg-active);
  transform: scale(0.95);
}

.emoji-card-actions button.danger {
  color: var(--semantic-error);
}

.emoji-card-actions button.danger:hover {
  background: rgba(var(--semantic-error-rgb), 0.1);
}

.emoji-grid-empty {
  text-align: center;
  color: var(--color-text-secondary);
  padding: 60px 20px;
  font-size: var(--font-size-md);
}

/* ==================== 按钮样式 ==================== */
.emoji-group-editor .btn-primary,
.emoji-upload-card .btn-primary,
.emoji-upload-card .btn-secondary {
  padding: 10px 16px;
  font-size: var(--font-size-md);
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
}

.emoji-group-editor .btn-primary,
.emoji-upload-card .btn-primary {
  background: var(--brand-primary);
  color: var(--text-on-primary);
  box-shadow: var(--shadow-sm);
}

.emoji-group-editor .btn-primary:hover,
.emoji-upload-card .btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.emoji-group-editor .btn-primary:active,
.emoji-upload-card .btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.emoji-upload-card .btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.emoji-upload-card .btn-secondary:hover {
  background: var(--bg-hover);
  box-shadow: var(--shadow-md);
}

.emoji-upload-card .btn-secondary:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
}

.emoji-upload-card .btn-secondary i {
  font-size: 14px;
}

.emoji-upload-trigger {
  flex-shrink: 0;
  white-space: nowrap;
}

/* ==================== 空状态 ==================== */
.emoji-content .empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-secondary);
}

.emoji-content .empty-state i {
  font-size: 48px;
  color: var(--color-text-secondary);
  opacity: 0.5;
  margin-bottom: 16px;
}

.emoji-content .empty-state p {
  margin: 8px 0;
  font-size: var(--font-size-md);
  color: var(--color-text-secondary);
}

.emoji-content .empty-state .hint {
  font-size: var(--font-size-sm);
  opacity: 0.7;
  color: var(--color-text-secondary);
}

/* ==================== 表情包管理APP样式 ==================== */
#app-emoji,
.emoji-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: var(--color-bg);
  overflow: hidden;
}

/* 导航栏 */
.emoji-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--navbar-padding);
  background: var(--navbar-bg-standard);
  border-bottom: 1px solid var(--navbar-border);
  flex-shrink: 0;
  position: relative;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.emoji-navbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--brand-primary) 50%,
    transparent 100%);
  opacity: 0.3;
}

.emoji-navbar .nav-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--nav-title-font-size);
  font-weight: var(--nav-title-font-weight);
  color: var(--text-primary);
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.emoji-navbar .nav-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--brand-primary);
  cursor: pointer;
  border-radius: 12px;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.emoji-navbar .nav-btn i {
  font-size: 18px;
}

.emoji-navbar .nav-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.emoji-navbar .nav-btn:hover {
  background: var(--bg-hover);
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.emoji-navbar .nav-btn:active {
  background: var(--bg-active);
  transform: scale(0.95);
}

.emoji-navbar .nav-right {
  display: flex;
  gap: 8px;
}

/* 标签页 */
.emoji-tabs {
  display: flex;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  flex-shrink: 0;
}

.emoji-tabs .tab-btn {
  flex: 1;
  min-width: 120px;
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: var(--font-size-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.emoji-tabs .tab-btn:hover {
  color: var(--color-text);
  background: var(--color-bg);
}

.emoji-tabs .tab-btn.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

.emoji-tabs .tab-btn i {
  font-size: 14px;
}

/* 内容区 */
.emoji-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  height: 100%;
}

/* ==================== 表情选择弹窗 ==================== */
/* 遮罩层 - 使用全局变量色，适配日夜模式，专为手机优化 */
.emoji-picker-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: emojiOverlayIn 0.2s ease forwards;
}

.emoji-picker-overlay.closing {
  animation: emojiOverlayOut 0.18s ease forwards;
}

@keyframes emojiOverlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes emojiOverlayOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* 弹窗面板 - 手机优化，与其他弹窗风格一致 */
.emoji-picker-panel {
  width: min(640px, 92vw);
  max-width: 92vw;
  max-height: 78vh;
  background: var(--bg-card);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-light);
  overflow: hidden;
  animation: modalScaleIn 0.2s;
}

/* 头部区域 - 手机优化 */
.emoji-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.emoji-picker-header h3 {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  flex: 1;
}

/* 工具按钮组 - 手机触摸优化 */
.emoji-picker-tools {
  display: flex;
  gap: 4px;
  align-items: flex-start;
  flex-shrink: 0;
}

.emoji-picker-tools button {
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  font-size: var(--font-size-sm);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
  white-space: nowrap;
  min-height: 40px; /* 手机触摸目标最小尺寸 */
  min-width: 40px;
  justify-content: center;
}

.emoji-picker-tools button:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.emoji-picker-tools button:active {
  background: var(--bg-active);
  transform: scale(0.95);
}

.emoji-picker-manage {
  padding: 8px 12px;
  font-size: var(--font-size-xs);
}

.emoji-picker-manage i {
  font-size: var(--font-size-sm);
}

.emoji-picker-close {
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-picker-close i {
  font-size: var(--font-size-lg);
}

/* 标签页导航 - 手机优化 */
.emoji-picker-tabs {
  display: flex;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.emoji-picker-tabs::-webkit-scrollbar {
  display: none;
}

.emoji-picker-tab {
  flex: 0 0 auto;
  min-width: 72px;
  padding: 10px 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  font-weight: 500;
  min-height: 38px; /* 手机触摸目标 */
}

.emoji-picker-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.emoji-picker-tab:active {
  background: var(--bg-active);
}

.emoji-picker-tab.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
  font-weight: 600;
}

/* 搜索框 - 手机优化 */
.emoji-picker-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--bg-input);
  flex-shrink: 0;
  transition: all var(--transition-fast);
  min-height: 40px; /* 手机触摸目标 */
}

.emoji-picker-search:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(var(--accent-color-rgb), 0.1);
}

.emoji-picker-search i {
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
  flex-shrink: 0;
}

.emoji-picker-search input {
  border: none;
  background: transparent;
  flex: 1;
  font-family: inherit;
  font-size: var(--font-size-base);
  color: var(--text-primary);
  outline: none;
  min-height: 24px;
}

.emoji-picker-search input::placeholder {
  color: var(--text-tertiary);
}

/* 内容区域 - 手机优化 */
.emoji-picker-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 12px;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
  -webkit-overflow-scrolling: touch;
  display: flex;
  justify-content: center;
}

.emoji-picker-body::-webkit-scrollbar {
  width: 6px;
}

.emoji-picker-body::-webkit-scrollbar-track {
  background: transparent;
}

.emoji-picker-body::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.emoji-picker-body::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ==================== 表情网格 - 微信风格，统一间距 ==================== */
.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  row-gap: 16px;
  column-gap: 4px;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  position: relative;
}

/* 表情项 - 微信风格，完全扁平，统一间距 */
.emoji-picker-item {
  /* 重置所有可能影响布局的属性 */
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  box-shadow: none;
  border-radius: 0;
  
  /* 布局 */
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  
  /* 尺寸 */
  width: 100%;
  aspect-ratio: 1;
  min-height: 40px;
  max-height: none;
  
  /* 交互 */
  cursor: pointer;
  transition: background-color var(--transition-fast);
  
  /* 确保无变换和层级 */
  transform: none;
  z-index: 1;
  box-sizing: border-box;
}

.emoji-picker-item:hover {
  background: var(--bg-hover);
  transform: none;
  box-shadow: none;
  z-index: 1;
}

.emoji-picker-item:active {
  background: var(--bg-active);
  transform: none;
  box-shadow: none;
  z-index: 1;
}

/* 表情缩略图容器 */
.emoji-picker-item .emoji-thumb {
  width: 100%;
  height: 100%;
  padding: 4px;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transform: none;
  box-shadow: none;
}

/* 表情图片 */
.emoji-picker-item .emoji-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  transform: none;
  box-shadow: none;
  box-sizing: border-box;
}

/* 空状态 - 手机优化 */
.emoji-picker-empty {
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  padding: 40px 20px;
  line-height: 1.6;
}
.chat-selection-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-primary, #fff);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 5;
  gap: 12px;
}

.chat-selection-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.selection-cancel-btn {
  border: 1px solid rgba(var(--accent-color-rgb), 0.2);
  background: rgba(var(--accent-color-rgb), 0.08);
  width: 32px;
  height: 32px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--brand-primary);
  transition: all var(--transition-fast);
}

.selection-cancel-btn:hover {
  background: rgba(var(--accent-color-rgb), 0.14);
  box-shadow: 0 4px 12px rgba(var(--accent-color-rgb), 0.18);
}

.selection-count {
  font-size: 14px;
  color: var(--text-secondary, #666);
}

.chat-selection-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.selection-action-btn {
  border: 1px solid rgba(var(--accent-color-rgb), 0.25);
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background: rgba(var(--accent-color-rgb), 0.12);
  color: var(--brand-primary);
  transition: background 0.2s ease;
}

.selection-action-btn:hover:not(:disabled) {
  background: rgba(var(--accent-color-rgb), 0.2);
  box-shadow: 0 6px 16px rgba(var(--accent-color-rgb), 0.22);
}

.selection-action-btn.danger {
  background: rgba(255, 59, 48, 0.15);
  color: #ff3b30;
}

.selection-action-btn.danger:hover:not(:disabled) {
  background: rgba(255, 59, 48, 0.25);
}

.selection-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.message-bubble.selected {
  position: relative;
  box-shadow:
    0 0 0 2px rgba(var(--accent-color-rgb), 0.16),
    0 8px 22px rgba(var(--accent-color-rgb), 0.12);
  border-radius: inherit;
}

.message-bubble.selected::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 12px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  box-shadow:
    0 0 0 2px var(--bg-primary, #fff),
    0 0 0 4px rgba(var(--accent-color-rgb), 0.2);
}

.message-bubble.user.selected::after {
  right: auto;
  left: 12px;
}

.share-card-segment {
  width: 100%;
}

.share-card-container {
  position: relative;
  background: var(--bubble-ai, var(--bg-secondary, #f6f6f6));
  border-radius: 16px;
  padding: 12px;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.2s ease, box-shadow var(--transition-fast), transform var(--transition-fast);
  border: 1px solid rgba(var(--accent-color-rgb), 0.16);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.12);
  width: 100%;
  max-width: min(320px, 70vw);
}

.share-card-container::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 18px;
  background: linear-gradient(135deg,
    rgba(var(--accent-color-rgb), 0.2),
    rgba(var(--accent-color-rgb), 0.08));
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 0;
  pointer-events: none;
}

.share-card-container:hover {
  background: var(--bg-card, #fff);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 12px 28px rgba(var(--accent-color-rgb), 0.18);
}

.share-card-container:hover::before {
  opacity: 1;
}

.share-card-container > * {
  position: relative;
  z-index: 1;
}

.share-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.share-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.share-card-title i {
  color: var(--brand-primary);
}

.share-card-meta {
  font-size: 12px;
  color: var(--text-secondary, #888);
}

.share-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  max-height: 140px;
  overflow: hidden;
}

.share-card-preview-line {
  display: flex;
  gap: 6px;
  font-size: 13px;
  color: var(--text-primary, #333);
}

.share-card-role {
  font-weight: 600;
  color: var(--brand-primary);
}

.share-card-footer {
  font-size: 12px;
  color: var(--brand-primary);
  text-align: right;
  font-weight: 600;
  text-shadow: 0 0 6px rgba(var(--accent-color-rgb), 0.18);
  cursor: pointer;
}

.article-share-segment {
  width: 100%;
}

.article-share-card {
  position: relative;
  background: var(--bg-card, #fff);
  border-radius: 16px;
  padding: 12px;
  border: 1px solid rgba(var(--accent-color-rgb), 0.16);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 12px 28px rgba(0, 0, 0, 0.12);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  cursor: pointer;
  pointer-events: auto;
  width: 100%;
  max-width: min(240px, 70vw);
}

.article-share-card:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 14px 32px rgba(var(--accent-color-rgb), 0.2);
}

.article-share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.article-share-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: rgba(var(--accent-color-rgb), 0.08);
  color: var(--brand-primary);
  border-radius: 10px;
  font-weight: 600;
  font-size: 12px;
}

.article-share-meta-line {
  font-size: 12px;
  color: var(--text-secondary, #888);
  text-align: right;
  flex: 1;
}

.article-share-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary, #222);
  line-height: 1.5;
  margin-bottom: 6px;
}

.article-share-summary {
  font-size: 14px;
  color: var(--text-primary, #333);
  line-height: 1.6;
  background: var(--bg-secondary, #f8f8f8);
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.06));
  margin-bottom: 6px;
}

.article-share-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--brand-primary);
  word-break: break-all;
}

.article-share-footer {
  font-size: 12px;
  color: var(--brand-primary);
  text-align: right;
  font-weight: 600;
  margin-top: 6px;
}

.share-composer-actions-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.share-composer-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.share-composer-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.chat-session-picker {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  pointer-events: none;
}

.chat-session-picker.show {
  display: flex;
  pointer-events: auto;
}

.chat-session-picker .picker-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
}

.chat-session-picker .picker-panel {
  position: relative;
  width: min(420px, 92vw);
  max-height: 82vh;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow:
    0 18px 42px rgba(var(--accent-color-rgb), 0.18),
    0 10px 26px rgba(0, 0, 0, 0.16);
}

.picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--text-primary);
}

.picker-close {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.picker-close:hover {
  color: var(--brand-primary);
}

.picker-list {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.picker-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-secondary, rgba(0, 0, 0, 0.04));
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.06));
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.picker-item:hover {
  border-color: rgba(var(--accent-color-rgb), 0.35);
  box-shadow: 0 8px 20px rgba(var(--accent-color-rgb), 0.16);
  background: rgba(var(--accent-color-rgb), 0.06);
}

.picker-item input {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  accent-color: var(--brand-primary);
}

.picker-item-body {
  flex: 1;
}

.picker-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #222);
}

.picker-item-meta {
  font-size: 12px;
  color: var(--text-secondary, #777);
  margin-top: 2px;
  line-height: 1.4;
}

.picker-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.picker-footer button {
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 6px 14px;
  cursor: pointer;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.picker-footer button.primary {
  background: var(--brand-primary);
  color: var(--text-on-primary);
  border-color: var(--brand-primary);
}

.picker-footer button:hover {
  background: var(--bg-hover);
  border-color: var(--brand-primary);
}

.share-card-detail-modal {
  z-index: 3000;
}

.share-card-detail-modal .modal-content {
  width: min(480px, 94vw);
  max-height: 72vh;
  box-shadow:
    0 22px 46px rgba(var(--accent-color-rgb), 0.18),
    0 12px 26px rgba(0, 0, 0, 0.18);
}

.share-card-detail-modal .modal-header {
  align-items: center;
  gap: 12px;
}

.share-card-detail-modal .modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.share-card-detail-modal .modal-subtitle {
  font-size: 12px;
  color: var(--text-secondary, #888);
}

.share-card-detail-modal .modal-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-height: 0;
}

.share-card-detail-modal .modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: all var(--transition-fast);
}

.share-card-detail-modal .modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.share-card-detail-modal .detail-entry {
  background: linear-gradient(180deg,
    var(--bg-card, #fff),
    rgba(var(--accent-color-rgb), 0.02));
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.06));
  display: flex;
  gap: 8px;
}

.share-card-detail-modal .detail-entry-role {
  font-weight: 600;
  color: var(--brand-primary);
}

.share-card-detail-modal .detail-entry-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary, #222);
  line-height: 1.4;
}

.share-card-detail-modal .detail-empty {
  font-size: 14px;
  color: var(--text-secondary, #666);
  text-align: center;
  padding: 24px 0;
}

.article-share-detail-modal {
  z-index: 3200;
}

.article-share-detail-modal .modal-content {
  width: min(560px, 94vw);
  max-height: 78vh;
  box-shadow:
    0 22px 48px rgba(var(--accent-color-rgb), 0.2),
    0 12px 28px rgba(0, 0, 0, 0.18);
}

.article-share-detail-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.article-share-detail-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--brand-primary);
  word-break: break-all;
}

.article-share-detail-link a {
  color: inherit;
  text-decoration: underline;
}

.article-share-detail-summary {
  background: linear-gradient(180deg,
    rgba(var(--accent-color-rgb), 0.08),
    rgba(var(--accent-color-rgb), 0.03));
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(var(--accent-color-rgb), 0.14);
  line-height: 1.6;
  font-size: 14px;
}

.article-share-detail-content {
  font-size: 14px;
  color: var(--text-primary, #222);
  line-height: 1.7;
}

.article-share-detail-content p {
  margin: 0 0 10px;
}

.article-share-detail-content p:last-child {
  margin-bottom: 0;
}

.article-share-empty {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary, #777);
}

.favorites-tab-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 0 50px; /* 🔥🔥🔥 最关键！解决滚动回弹问题！ */
  background: var(--bg-primary, #fff);
  color: var(--text-primary, #111);
}

.favorites-refresh-btn {
  border: 1px solid rgba(var(--accent-color-rgb), 0.18);
  background: rgba(var(--accent-color-rgb), 0.08);
  color: var(--brand-primary, #007aff);
  width: 32px;
  height: 32px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform var(--transition-fast, 0.15s ease), box-shadow var(--transition-fast, 0.15s ease);
  position: relative;
  z-index: 1;
}

.favorites-refresh-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md, 0 8px 18px rgba(0, 0, 0, 0.15));
}

.favorites-refresh-btn:active {
  transform: scale(0.96);
}

.favorites-character-row {
  display: flex;
  gap: 8px;
  padding: 0 16px;
  overflow-x: auto;
}

.favorite-chip {
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
  background: var(--bg-secondary, rgba(0, 0, 0, 0.06));
  border-radius: 18px;
  padding: 6px 12px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-primary, #111);
}

.favorite-chip.active {
  background: rgba(var(--accent-color-rgb), 0.14);
  color: var(--brand-primary, #007aff);
  border-color: rgba(var(--accent-color-rgb), 0.35);
  box-shadow: 0 6px 14px rgba(var(--accent-color-rgb), 0.16);
}

.favorite-chip-count {
  font-weight: 600;
  color: inherit;
}

.favorites-sections {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.favorite-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 17px;
  font-weight: 700;
  padding: 0 16px 10px 16px;
  color: var(--text-primary, #222);
  position: relative;
  letter-spacing: 0.15px;
}

.favorite-section-title::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 5px;
  width: 3px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg,
    rgba(var(--accent-color-rgb), 0.8),
    rgba(var(--accent-color-rgb), 0.35));
}

.favorite-section-title > span {
  margin-left: 8px;
}

.favorite-section-title--books .favorites-refresh-btn {
  margin-left: 12px;
}

.favorite-list-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 16px 4px;
}

.favorite-card {
  background: linear-gradient(180deg,
    var(--bg-card, #fff),
    rgba(var(--accent-color-rgb), 0.02));
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.06));
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-md, 0 10px 22px rgba(0, 0, 0, 0.12));
  transition: transform var(--transition-fast, 0.15s ease), box-shadow var(--transition-fast, 0.15s ease);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.favorite-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg, 0 12px 26px rgba(0, 0, 0, 0.16));
}

.favorite-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.favorite-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg,
    rgba(var(--accent-color-rgb), 0.22),
    rgba(var(--accent-color-rgb), 0.06));
  border: 1px solid rgba(var(--accent-color-rgb), 0.25);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.favorite-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.favorite-meta {
  flex: 1;
}

.favorite-name {
  font-weight: 700;
  color: var(--text-primary, #111);
}

.favorite-source {
  font-size: 12px;
  color: var(--text-secondary, #777);
}

.favorite-time {
  font-size: 12px;
  color: var(--text-secondary, #888);
}

.favorite-card-content {
  font-size: 14px;
  color: var(--text-primary, #222);
  line-height: 1.5;
}

.favorite-inline-preview {
  border-radius: 12px;
  padding: 10px;
  background: var(--bg-primary, #fff);
  box-shadow: inset 0 0 0 1px var(--border-light, rgba(0, 0, 0, 0.03));
}

.favorite-voice-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(var(--accent-color-rgb), 0.12);
  color: var(--brand-primary, #007aff);
}

.favorite-image-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary, #555);
}

.favorite-card-actions {
  display: flex;
  gap: 10px;
}

.favorite-card-actions button {
  flex: none;
  border: 1px solid rgba(var(--accent-color-rgb), 0.22);
  border-radius: 16px;
  padding: 6px 12px;
  background: rgba(var(--accent-color-rgb), 0.08);
  cursor: pointer;
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  color: var(--brand-primary, #007aff);
}

.favorite-card-actions button.danger {
  background: rgba(var(--semantic-error-rgb), 0.1);
  color: var(--semantic-error, #ff3b30);
  border-color: rgba(var(--semantic-error-rgb), 0.25);
}

.favorite-card-actions button:active {
  transform: scale(0.98);
}

.favorite-gallery-body {
  padding: 0 16px 16px;
}

.favorite-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 14px;
}

.polaroid-item {
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
  background: var(--widget-polaroid-bg, var(--bg-card, #fff));
  border-radius: 12px;
  padding: 10px 10px 14px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  transform: rotate(-1deg);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform var(--transition-fast, 0.15s ease), box-shadow var(--transition-fast, 0.15s ease);
}

.polaroid-item:nth-child(2n) {
  transform: rotate(1.2deg);
}

.polaroid-item:hover {
  transform: translateY(-2px) rotate(0deg);
  box-shadow: var(--shadow-lg, 0 12px 26px rgba(0, 0, 0, 0.18));
}

.polaroid-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-secondary, rgba(0, 0, 0, 0.05));
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px var(--border-light, rgba(0, 0, 0, 0.06));
}

.polaroid-photo-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-secondary, #777);
}

.polaroid-photo-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.polaroid-caption {
  color: var(--widget-polaroid-text, var(--text-secondary, #555));
  text-align: center;
  line-height: 1.45;
  max-height: 32px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
}

.favorite-gallery-empty,
.favorite-empty-hint {
  font-size: 14px;
  color: var(--text-secondary, #777);
  text-align: center;
  padding: 24px 0;
}

.favorite-books-section {
  padding: 0 0 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.favorite-books-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  position: relative;
  z-index: 1;
  min-height: 180px;
  padding: 0 16px;
}

.favorite-book-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(var(--accent-color-rgb), 0.25);
  background: linear-gradient(145deg,
    rgba(var(--accent-color-rgb), 0.04),
    var(--bg-card, #fff));
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 10px 24px var(--shadow-color, rgba(0, 0, 0, 0.12));
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform var(--transition-fast, 0.15s ease), box-shadow var(--transition-fast, 0.15s ease);
  isolation: isolate;
  min-height: 220px;
}

.favorite-book-card::before {
  content: '';
  position: absolute;
  /* 缩短横线长度，减少两端留白 */
  inset: 12px 20px auto 20px;
  height: 8px;
  background: linear-gradient(90deg,
    rgba(var(--accent-color-rgb), 0.16),
    rgba(255, 255, 255, 0.7),
    rgba(var(--accent-color-rgb), 0.16));
  border-radius: 8px;
  opacity: 0.6;
  pointer-events: none;
}

.favorite-book-card.active {
  box-shadow: 0 12px 28px rgba(var(--accent-color-rgb), 0.28);
  transform: translateY(-3px);
  border-color: var(--brand-primary, #007aff);
}

.favorite-book-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  background: linear-gradient(145deg,
    rgba(var(--accent-color-rgb), 0.12),
    rgba(var(--accent-color-rgb), 0.06));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgba(var(--accent-color-rgb), 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--text-on-primary, #fff);
  font-weight: 700;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.favorite-book-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg,
    rgba(var(--accent-color-rgb), 0.08),
    rgba(0, 0, 0, 0.18));
  mix-blend-mode: soft-light;
  pointer-events: none;
}

.favorite-book-cover span {
  position: relative;
  z-index: 1;
  color: var(--text-on-primary, #fff);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.favorite-book-spine {
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg,
    rgba(var(--accent-color-rgb), 0.14),
    rgba(0, 0, 0, 0.08),
    rgba(var(--accent-color-rgb), 0.14));
  border-radius: 999px;
  /* 轻微上移，让下方横线更贴近封面 */
  margin-top: -14px;
}

.favorite-book-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
}

.favorite-book-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary, #4a2d16);
  letter-spacing: 0.2px;
}

.favorite-book-count {
  font-size: 12px;
  color: var(--text-secondary, rgba(74, 45, 22, 0.7));
}

/* === 转账卡片 === */
.transfer-segment {
  /* 跟随全局日夜变量 */
  --transfer-bg: var(--bg-card, #fff);
  --transfer-border: var(--border-card, #f0f0f0);
  --transfer-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
  --transfer-title: var(--text-primary, #111);
  --transfer-amount: var(--text-primary, #111);
  --transfer-note: var(--text-secondary, #555);
  --transfer-status-bg: var(--chip-bg, #f7f7f7);
  --transfer-status-text: var(--text-secondary, #555);
  --transfer-heart: var(--accent-danger, #f55264);
  --transfer-pending-border: var(--brand-primary, #f5a623);
  --transfer-pending-badge-bg: #fff7e6;
  --transfer-pending-badge-text: #d97706;
  --transfer-accepted-border: #22c55e;
  --transfer-accepted-badge-bg: #ecfdf3;
  --transfer-accepted-badge-text: #15803d;
  --transfer-refund-border: #ef4444;
  --transfer-refund-badge-bg: #fef2f2;
  --transfer-refund-badge-text: #b91c1c;
}

/* 手动主题切换（data-theme="dark"） */
[data-theme="dark"] .transfer-segment {
  --transfer-bg: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 100%);
  --transfer-border: #2a2f36;
  --transfer-shadow: 0 6px 14px rgba(0, 0, 0, 0.5);
  --transfer-title: #f8fafc;
  --transfer-amount: #f1f5f9;
  --transfer-note: #cbd5e1;
  --transfer-status-bg: #1f242c;
  --transfer-status-text: #e2e8f0;
  --transfer-heart: #fca5a5;
  --transfer-pending-border: var(--brand-primary, #f5a623);
  --transfer-pending-badge-bg: rgba(245, 166, 35, 0.12);
  --transfer-pending-badge-text: #f5c062;
  --transfer-accepted-border: #22c55e;
  --transfer-accepted-badge-bg: rgba(34, 197, 94, 0.15);
  --transfer-accepted-badge-text: #6ee7b7;
  --transfer-refund-border: #ef4444;
  --transfer-refund-badge-bg: rgba(239, 68, 68, 0.12);
  --transfer-refund-badge-text: #fca5a5;
}

.transfer-segment .transfer-card {
  background: var(--transfer-bg);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--transfer-shadow);
  border: 1px solid var(--transfer-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.transfer-segment .transfer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.transfer-segment .transfer-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--transfer-status-bg);
  color: var(--transfer-status-text);
  white-space: nowrap;
}

.transfer-segment .transfer-card.pending {
  border-style: dashed;
  border-color: var(--transfer-pending-border);
  background: var(--transfer-bg);
  color: var(--transfer-title);
}

.transfer-segment .transfer-card.pending .transfer-status {
  background: var(--transfer-pending-badge-bg);
  border-color: var(--transfer-pending-border);
  color: var(--transfer-pending-badge-text);
}

.transfer-segment .transfer-card.pending .transfer-title,
.transfer-segment .transfer-card.pending .transfer-amount,
.transfer-segment .transfer-card.pending .transfer-note {
  color: inherit;
}

.transfer-segment .transfer-card.accepted {
  border-color: var(--transfer-accepted-border);
}

.transfer-segment .transfer-card.accepted .transfer-status {
  background: var(--transfer-accepted-badge-bg);
  border-color: var(--transfer-accepted-border);
  color: var(--transfer-accepted-badge-text);
}

.transfer-segment .transfer-card.declined {
  border-color: var(--transfer-refund-border);
  opacity: 0.95;
}

.transfer-segment .transfer-card.declined .transfer-status,
.transfer-segment .transfer-card.refunded .transfer-status {
  background: var(--transfer-refund-badge-bg);
  border-color: var(--transfer-refund-border);
  color: var(--transfer-refund-badge-text);
}

.transfer-segment .transfer-card.refunded {
  border-style: solid;
  border-color: var(--transfer-refund-border);
  opacity: 0.95;
}

.transfer-segment .transfer-card.transfer-clickable {
  cursor: pointer;
}

.transfer-segment .transfer-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.transfer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--transfer-title);
  font-weight: 600;
}

.transfer-title svg {
  width: 18px;
  height: 18px;
  color: var(--transfer-heart);
}

.transfer-amount {
  font-size: 22px;
  font-weight: 700;
  color: var(--transfer-amount);
  letter-spacing: 0.5px;
}

.transfer-note {
  font-size: 12px;
  color: var(--transfer-note);
}

/* 夜间主题若使用 data-theme=dark 或其它全局方案，只需在全局覆写上述变量 */

/* === 位置卡片 === */
.location-segment .location-share-card {
  background: var(--bg-card, #fff);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  display: grid;
  grid-template-columns: 0.9fr 1.1fr; /* 文字窄一点，图片更宽 */
  height: 120px;
  width: 240px;
  min-width: 240px;
  max-width: 240px;
}

.location-segment .card-text-area {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  overflow: hidden;
}

.location-segment .card-text-primary {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary, #111);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.location-segment .card-text-secondary {
  font-size: 12px;
  color: var(--text-secondary, #666);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.location-segment .card-map-area {
  position: relative;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  height: 100%;
}

.location-segment .card-pin-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f55264;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.08));
}

.location-segment .card-pin-icon svg {
  width: 28px;
  height: 28px;
}

/* === 功能弹窗（转账/位置） === */
.feature-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
}

.feature-dialog {
  background: #fff;
  border-radius: 16px;
  width: min(420px, 92vw);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.14);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.feature-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  gap: 12px;
}

.feature-dialog-title {
  font-size: 16px;
  font-weight: 700;
}

.feature-dialog-subtitle {
  font-size: 12px;
  color: #777;
}

.feature-tabs {
  display: flex;
  padding: 0 16px;
  gap: 8px;
  margin-top: 6px;
}

.feature-tab {
  flex: 1;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 8px 10px;
  background: #f7f7f7;
  font-size: 13px;
  cursor: pointer;
}

.feature-tab.active {
  background: #24d37a;
  color: #fff;
  border-color: #24d37a;
}

.gps-field .gps-row {
  display: flex;
  gap: 10px;
  font-size: 13px;
  color: #444;
}

.gps-field .gps-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.gps-status {
  font-size: 12px;
  color: #666;
}

.gps-status.error {
  color: #ef4444;
}

.feature-dialog-close {
  border: none;
  background: #f5f5f5;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #555;
}

.feature-dialog-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feature-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #444;
}

.feature-field input {
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}

.feature-dialog-actions {
  padding: 12px 16px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.feature-btn {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
}

.feature-btn.ghost {
  background: #f5f5f5;
  color: #444;
}

.feature-btn.primary {
  background: #24d37a;
  color: #fff;
}

/* === 钱包弹窗 === */
.wallet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 998;
  padding: 16px;
}

.wallet-panel {
  width: min(460px, 94vw);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wallet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wallet-title {
  font-size: 16px;
  font-weight: 700;
}

.wallet-desc {
  font-size: 12px;
  color: #777;
}

.wallet-close {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: none;
  background: #f5f5f5;
  display: grid;
  place-items: center;
}

.wallet-balance {
  background: linear-gradient(135deg, #24d37a, #0fb881);
  color: #fff;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wallet-balance-label {
  font-size: 12px;
  opacity: 0.9;
}

.wallet-balance-value {
  font-size: 24px;
  font-weight: 800;
}

.wallet-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wallet-recharge {
  display: flex;
  gap: 10px;
}

.wallet-recharge input {
  flex: 1;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
}

.wallet-btn {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
}

.wallet-btn.primary {
  background: #24d37a;
  color: #fff;
}

.wallet-history {
  border-top: 1px solid #f0f0f0;
  padding-top: 10px;
}

.wallet-history-title {
  font-size: 13px;
  color: #555;
  margin-bottom: 6px;
}

.wallet-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.wallet-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
  border-radius: 10px;
  padding: 10px;
  gap: 10px;
}

.wallet-history-note {
  font-size: 14px;
  font-weight: 600;
  color: #222;
}

.wallet-history-time {
  font-size: 11px;
  color: #888;
}

.wallet-history-amount {
  font-size: 14px;
  font-weight: 700;
}

.wallet-history-amount.in {
  color: #22c55e;
}

.wallet-history-amount.out {
  color: #f97316;
}

.wallet-history-empty {
  padding: 10px;
  font-size: 13px;
  color: #777;
}

.call-overlay {
  --call-backdrop: none;
  --call-surface: var(--bg-primary, #0b0b0b);
  --call-surface-panel: var(--bg-secondary, rgba(255, 255, 255, 0.92));
  --call-surface-muted: var(--bg-tertiary, rgba(0, 0, 0, 0.03));
  --call-border: var(--border-subtle, rgba(0, 0, 0, 0.08));
  --call-shadow: var(--shadow-xl, 0 10px 40px rgba(0, 0, 0, 0.18));
  position: fixed;
  inset: 0;
  background: var(--modal-scrim, rgba(0, 0, 0, 0.45));
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  overflow: hidden;
  color: var(--text-primary, #111);
}

.call-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--call-backdrop);
  background-size: cover;
  background-position: center;
  filter: blur(22px) brightness(0.8);
  transform: scale(1.05);
  opacity: 0.9;
}

.call-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(0, 0, 0, 0.35) 0%,
    rgba(0, 0, 0, 0.55) 100%);
  mix-blend-mode: multiply;
}

.call-modal {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-height: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.55) 100%),
    var(--call-backdrop) center / cover no-repeat,
    var(--call-surface);
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: inherit;
}

.call-header {
  padding: 36px 24px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid var(--call-border);
  background:
    var(--call-header-gradient),
    color-mix(in srgb, var(--call-surface-panel) 95%, transparent);
  backdrop-filter: blur(4px);
}

.call-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.call-auto-tts {
  border: 1px solid var(--call-border);
  background: color-mix(in srgb, var(--call-surface-panel) 80%, transparent);
  color: var(--text-secondary, #94a3b8);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.call-auto-tts.active {
  background: var(--accent-color, #22c55e);
  color: #fff;
  border-color: transparent;
}

.call-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent-color, #22c55e);
}

.call-subtitle {
  font-size: 13px;
  color: var(--text-secondary, #666);
}

.call-close {
  border: none;
  background: transparent;
  color: var(--text-secondary, #666);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

.call-body {
  padding: 8px 24px 0;
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.call-status {
  font-size: 13px;
  color: var(--text-secondary, #cbd5e1);
  margin-bottom: 8px;
}

.call-history {
  flex: 0 1 320px;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--call-border);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 4px;
  margin-top: auto;
  background: color-mix(in srgb, var(--call-surface-panel) 25%, transparent);
  backdrop-filter: blur(4px);
}

.call-line {
  padding: 12px 14px;
  border-radius: 16px;
  margin-bottom: 12px;
  background: color-mix(in srgb, var(--call-surface-panel) 35%, transparent);
  box-shadow: none;
}

.call-line.user {
  border-left: 3px solid var(--accent-color, #22c55e);
}

.call-line.assistant {
  border-left: 3px solid var(--text-secondary, #94a3b8);
}

.call-line-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary, #666);
  margin-bottom: 6px;
}

.call-line-text {
  font-size: 15px;
  color: var(--text-primary, #e2e8f0);
  line-height: 1.6;
  white-space: pre-wrap;
}

.call-line-extra {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-secondary, #94a3b8);
}

.call-line-image img {
  width: 100%;
  margin-top: 10px;
  border-radius: 12px;
  object-fit: cover;
}

.call-line-tools {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.call-field {
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
}

.call-field label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary, #111);
}

.call-input {
  border-radius: 12px;
  border: 1px solid var(--call-border);
  padding: 10px 12px;
  font-size: 14px;
  background: color-mix(in srgb, var(--call-surface-panel) 72%, transparent);
  resize: none;
  color: var(--text-primary, #e2e8f0);
}

.call-hint {
  font-size: 12px;
  color: var(--text-tertiary, #94a3b8);
  margin-top: 4px;
}

.call-footer {
  padding: 16px 24px 24px;
  border-top: none;
  background: transparent;
  backdrop-filter: none;
}

.call-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.call-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.call-btn.primary {
  background: var(--accent-color, #22c55e);
  color: #fff;
}

.call-btn.danger {
  background: #ff5757;
  color: #fff;
}

.call-btn.ghost {
  background: var(--bg-soft, rgba(255, 255, 255, 0.06));
  color: var(--text-secondary, #cbd5e1);
}

.call-btn.mini {
  padding: 6px 12px;
  font-size: 12px;
}

.call-btn:disabled {
  opacity: 0.6;
  pointer-events: none;
}

.call-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.call-video-preview {
  border: 1px solid var(--call-border);
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 14px;
  background: var(--call-surface-muted);
}

.call-video-preview img {
  width: 100%;
  border-radius: 8px;
  display: block;
}

.call-video-caption {
  font-size: 12px;
  color: var(--text-secondary, #94a3b8);
  display: block;
  margin-top: 6px;
  word-break: break-word;
}

.call-line.streaming .call-line-text {
  opacity: 0.75;
}
