/* ================================================================
   style.css — 琉璃微语 · 共鸣对话页
   设计理念：厚重多层次 · 柔光玻璃 · 沉浸体验 · 高级质感
   ================================================================ */

/* --- 背景渐变层（白天米白 / 夜晚深邃蓝） --- */
#agent-stage {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.04) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 80%, rgba(56, 189, 248, 0.03) 0%, transparent 45%),
    linear-gradient(160deg, #ffffff 0%, #f8f9fb 30%, #f2f4f8 60%, #ffffff 100%);
  transition: background var(--duration-slow) var(--ease-in-out);
}

/* 纹理层：CSS 噪点模拟（增加厚重感和质感） */
#agent-stage::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  opacity: 0.3;
  background-image:
    repeating-conic-gradient(rgba(0, 0, 0, 0.02) 0% 25%, transparent 0% 50%);
  background-size: 4px 4px;
  pointer-events: none;
  mix-blend-mode: multiply;
}

/* 微光装饰层 */
#agent-stage::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background:
    radial-gradient(circle at 30% 70%, rgba(200, 180, 130, 0.05) 0%, transparent 30%),
    radial-gradient(circle at 70% 30%, rgba(210, 190, 140, 0.04) 0%, transparent 25%);
  animation: stage-glow 8s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes stage-glow {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* 深色主题背景（深邃蓝 + 品牌辉光） */
.theme-dark #agent-stage {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(60, 90, 180, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(90, 70, 200, 0.12) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 80%, rgba(40, 90, 200, 0.10) 0%, transparent 45%),
    linear-gradient(160deg, #0a1020 0%, #0c1526 30%, #111a30 60%, #0a1020 100%);
}

.theme-dark #agent-stage::before {
  opacity: 0.15;
  background-image:
    repeating-conic-gradient(rgba(255, 255, 255, 0.03) 0% 25%, transparent 0% 50%);
  mix-blend-mode: screen;
}

.theme-dark #agent-stage::after {
  background:
    radial-gradient(circle at 30% 70%, rgba(60, 90, 180, 0.10) 0%, transparent 30%),
    radial-gradient(circle at 70% 30%, rgba(90, 70, 200, 0.08) 0%, transparent 25%);
}

/* --- 豆包式外壳 --- */
.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  height: 100vh;
  height: 100dvh;
}

/* --- 左侧会话栏 --- */
.conv-sidebar {
  flex-shrink: 0;
  width: 280px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border-right: 1px solid var(--glass-border);
  z-index: 30;
}

.cs-top {
  padding: var(--space-5) var(--space-5) var(--space-3);
}

.cs-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.0625rem;
}

.cs-logo {
  font-size: 1.25rem;
  line-height: 1;
}

.cs-logo img {
  width: 1.5rem;
  height: 1.5rem;
  object-fit: contain;
  border-radius: 6px;
}

.cs-brand-name {
  letter-spacing: 0.02em;
}

.cs-new {
  margin: var(--space-2) var(--space-4) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px var(--space-4);
  background: var(--brand-grad);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(var(--brand-rgb), 0.3);
  transition: all var(--duration-fast) var(--ease-out);
}

.cs-new:hover {
  box-shadow: 0 6px 20px rgba(var(--brand-rgb), 0.4);
  transform: translateY(-1px);
}

.cs-new:active {
  transform: scale(0.98);
}

.cs-new-ic {
  font-size: 1.125rem;
  line-height: 1;
}

.cs-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-2) var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  scrollbar-width: none;
}

.cs-scroll::-webkit-scrollbar {
  display: none;
}

.cs-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.cs-block-grow {
  flex: 1;
  min-height: 60px;
}

.cs-block-title {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
  padding: var(--space-1) var(--space-2);
}

/* 共鸣者列表 */
.cs-agent-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.cs-agent {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  transition: all var(--duration-fast) var(--ease-out);
}

.cs-agent:hover {
  background: var(--surface-2);
}

.cs-agent.active {
  background: var(--brand-soft);
  border-color: rgba(var(--brand-rgb), 0.2);
}

.cs-agent-avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #fff;
  overflow: hidden;
}

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

.cs-agent-meta {
  min-width: 0;
  flex: 1;
}

.cs-agent-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-agent-sub {
  font-size: 0.6875rem;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 历史会话列表 */
.cs-history {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.cs-hist-item {
  position: relative;
  padding: 8px 10px;
  padding-right: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: all var(--duration-fast) var(--ease-out);
}

.cs-hist-item:hover {
  background: var(--brand-soft);
  border-color: rgba(var(--brand-rgb), 0.2);
}

.cs-hist-item:active {
  transform: scale(0.99);
}

/* 单条删除按钮（hover 显示，移动端常显） */
.cs-hist-del {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-soft);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: all var(--duration-fast) var(--ease-out);
}

.cs-hist-item:hover .cs-hist-del,
.cs-hist-del:focus-visible {
  opacity: 1;
}

.cs-hist-del:hover {
  background: #fef2f2;
  color: #ef4444;
}

/* 标题行：标题 + 清空按钮 */
.cs-block-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding-right: 2px;
}

.cs-clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-2);
  font-family: var(--font-main);
  font-size: 0.625rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.cs-clear-btn:hover {
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
  background: #fef2f2;
}

/* 移动端：删除按钮常显，清空按钮更大触摸 */
@media (max-width: 480px) {
  .cs-hist-del {
    opacity: 1;
    width: 26px;
    height: 26px;
  }
  .cs-clear-btn {
    padding: 5px 10px;
    font-size: 0.6875rem;
  }
}

.cs-hist-q {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-hist-a {
  font-size: 0.75rem;
  color: var(--text-soft);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.cs-hist-time {
  font-size: 0.6875rem;
  color: var(--text-soft);
  margin-top: 4px;
}

.cs-history-empty {
  font-size: 0.8125rem;
  color: var(--text-soft);
  padding: var(--space-2) var(--space-1);
}

.cs-bottom {
  flex-shrink: 0;
  display: flex;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
}

.cs-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-soft);
  font-size: 0.6875rem;
  font-weight: 600;
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
  border: none;
  background: transparent;
}

.cs-nav:hover {
  background: var(--surface-2);
  color: var(--brand);
}

.cs-nav-ic {
  font-size: 1rem;
  line-height: 1;
}

/* --- 主对话区 --- */
.chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

/* 顶栏（厚重感：磨砂玻璃 + 多层阴影 + 内高光） */
.chat-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  /* 兜底：旧 X5 内核不认 env()/calc 组合时回退到基础内边距，避免顶栏顶进刘海 */
  padding-top: var(--space-4);
  padding-top: calc(var(--space-4) + env(safe-area-inset-top, 0px));
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border-bottom: 1px solid var(--glass-border);
  box-shadow:
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  position: relative;
}

/* 顶栏底部高光线 */
.chat-topbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.2), transparent);
}

/* 深色主题顶栏 */
.theme-dark .chat-topbar {
  background: rgba(15, 23, 42, 0.85);
  border-bottom-color: rgba(99, 102, 241, 0.15);
  box-shadow:
    var(--shadow-lg),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.theme-dark .chat-topbar::after {
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.15), transparent);
}

.ct-menu {
  display: none;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 1.125rem;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.ct-menu:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

.ct-avatar {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(var(--brand-rgb), 0.3);
  transition: all var(--duration-normal) var(--ease-out);
}

.ct-avatar-img {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ct-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ct-avatar.thinking {
  animation: ct-bob 1.4s ease-in-out infinite;
}

.ct-avatar.speaking {
  transform: scale(1.06);
  box-shadow: 0 0 0 4px rgba(var(--brand-rgb), 0.18), 0 6px 18px rgba(var(--brand-rgb), 0.4);
}

@keyframes ct-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.ct-info {
  flex: 1;
  min-width: 0;
}

.ct-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ct-status {
  font-size: 0.75rem;
  color: var(--text-soft);
  margin-top: 1px;
}

.ct-status::before {
  content: '●';
  color: #22c55e;
  margin-right: 4px;
  font-size: 0.625rem;
  vertical-align: middle;
}

.ct-status.thinking::before {
  color: #f59e0b;
}

.ct-status.speaking::before {
  color: var(--brand);
}

.ct-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* --- 气泡滚动区（随主题切换背景） --- */
.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-6) var(--space-4) var(--space-4);
  padding: var(--space-6) clamp(var(--space-4), 5vw, var(--space-16)) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  scroll-behavior: smooth;
  background: rgba(var(--brand-rgb), 0.015);
  transition: background var(--duration-slow) var(--ease-in-out);
}

/* 深色主题聊天区背景 */
.theme-dark .chat-scroll {
  background: rgba(0, 0, 0, 0.12);
}

.chat-inner {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* --- 气泡通用 --- */
.bubble {
  display: flex;
  gap: var(--space-3);
  max-width: 100%;
  align-items: flex-start;
  animation: bubble-in var(--duration-normal) var(--ease-out) both;
}

@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bubble .b-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(var(--brand-rgb), 0.25);
}

.bubble .b-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.bubble .b-content {
  min-width: 0;
  max-width: min(76%, 640px);
}

.bubble .b-name {
  font-size: 0.75rem;
  color: var(--text-soft);
  margin: 0 0 4px 2px;
  font-weight: 600;
}

.bubble .b-text {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius) var(--radius-lg) var(--radius-lg) var(--radius-lg);
  padding: var(--space-3) var(--space-5);
  box-shadow:
    0 2px 8px rgba(var(--brand-rgb), 0.06),
    0 1px 2px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  -webkit-user-select: text;
  user-select: text;
  transition: all var(--duration-fast) var(--ease-out);
}

/* 深色主题气泡 */
.theme-dark .bubble .b-text {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(99, 102, 241, 0.12);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* 用户气泡 */
.bubble.user {
  flex-direction: row-reverse;
  align-items: flex-end;
}

.bubble.user .b-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.bubble.user .b-text {
  background: var(--brand-grad);
  border-color: transparent;
  color: #fff;
  border-radius: var(--radius-lg) var(--radius) var(--radius-lg) var(--radius-lg);
  box-shadow:
    0 4px 16px rgba(var(--brand-rgb), 0.35),
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
}

/* 用户气泡光泽层 */
.bubble.user .b-text::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.15), transparent);
  border-radius: var(--radius-lg) var(--radius) var(--radius-lg) var(--radius-lg);
  pointer-events: none;
}

.bubble.user .b-name {
  display: none;
}

/* 打字机光标 */
.b-text.cursor-blink::after {
  content: '|';
  display: inline-block;
  margin-left: 2px;
  animation: blink 1s infinite;
  color: var(--brand);
  font-weight: bold;
}

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

/* --- 底部输入区（随主题切换背景） --- */
.chat-compose {
  flex-shrink: 0;
  /* 兜底：旧 X5 内核不认 env()/calc/clamp 组合时回退到基础内边距，避免底部输入区被 Home 指示条遮挡 */
  padding: var(--space-2) var(--space-4) var(--space-4);
  padding: var(--space-2) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  padding: var(--space-2) clamp(var(--space-4), 5vw, var(--space-16)) calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border-top: 1px solid var(--glass-border);
  transition: background var(--duration-slow) var(--ease-in-out), border-color var(--duration-slow) var(--ease-in-out);
}

/* 深色主题输入区背景 */
.theme-dark .chat-compose {
  background: rgba(15, 23, 42, 0.85);
  border-top-color: rgba(99, 102, 241, 0.12);
}

/* 推荐问题 */
.suggestions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

/* 建议问题（高级感：磨砂玻璃 + 柔和交互） */
.suggestion-chip {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  color: var(--text-2);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  white-space: nowrap;
  cursor: pointer;
  box-shadow:
    0 2px 8px rgba(var(--brand-rgb), 0.06),
    0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all var(--duration-normal) var(--ease-out);
}

.suggestion-chip:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow:
    0 4px 16px rgba(var(--brand-rgb), 0.35),
    0 2px 4px rgba(0, 0, 0, 0.1);
}

.suggestion-chip:active {
  transform: translateY(0) scale(0.97);
}

/* 深色主题建议问题 */
.theme-dark .suggestion-chip {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(99, 102, 241, 0.15);
}

.theme-dark .suggestion-chip:hover {
  background: var(--brand);
  border-color: var(--brand);
  box-shadow:
    0 4px 16px rgba(var(--brand-rgb), 0.4),
    0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 输入框（高级感：磨砂玻璃 + 聚焦发光 + 柔和阴影） */
.compose-bar {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-border);
  padding: 8px 10px;
  border-radius: var(--radius-xl);
  box-shadow:
    0 2px 8px rgba(var(--brand-rgb), 0.06),
    0 1px 2px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: all var(--duration-normal) var(--ease-out);
}

.compose-bar:focus-within {
  border-color: rgba(var(--brand-rgb), 0.4);
  box-shadow:
    0 4px 16px rgba(var(--brand-rgb), 0.12),
    0 2px 4px rgba(0, 0, 0, 0.06),
    0 0 0 4px rgba(var(--brand-rgb), 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transform: translateY(-1px);
}

/* 深色主题输入框 */
.theme-dark .compose-bar {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(99, 102, 241, 0.15);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.theme-dark .compose-bar:focus-within {
  border-color: rgba(var(--brand-rgb), 0.4);
  box-shadow:
    0 4px 16px rgba(var(--brand-rgb), 0.2),
    0 0 0 4px rgba(var(--brand-rgb), 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.main-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 8px 10px;
  font-family: var(--font-main);
  font-size: 0.9375rem;
  outline: none;
  color: var(--text);
}

.main-input::placeholder {
  color: var(--text-soft);
}

.send-btn {
  background: var(--brand-grad);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow:
    0 4px 12px rgba(var(--brand-rgb), 0.3),
    0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}

/* 按钮光泽层 */
.send-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.send-btn:hover::before {
  left: 100%;
}

.send-btn .ic {
  font-size: 1.125rem;
  line-height: 1;
}

.send-btn:hover {
  box-shadow:
    0 6px 20px rgba(var(--brand-rgb), 0.4),
    0 4px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.send-btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow:
    0 2px 8px rgba(var(--brand-rgb), 0.3),
    0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 深色主题发送按钮 */
.theme-dark .send-btn {
  box-shadow:
    0 4px 12px rgba(var(--brand-rgb), 0.4),
    0 2px 4px rgba(0, 0, 0, 0.3);
}

.theme-dark .send-btn:hover {
  box-shadow:
    0 6px 20px rgba(var(--brand-rgb), 0.5),
    0 4px 8px rgba(0, 0, 0, 0.4);
}

/* 语音按钮（高级感：磨砂玻璃 + 柔和交互） */
.voice-btn {
  width: auto;
  min-width: 42px;
  height: 42px;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
  transition: all var(--duration-normal) var(--ease-out);
}

.voice-btn:hover {
  background: var(--brand-soft);
  border-color: rgba(var(--brand-rgb), 0.3);
  color: var(--brand);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.voice-btn:active {
  transform: translateY(0) scale(0.96);
}

.voice-btn.listening {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-color: transparent;
  color: #fff;
  animation: pulse-red 1.5s infinite;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* 深色主题语音按钮 */
.theme-dark .voice-btn {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(99, 102, 241, 0.15);
}

.theme-dark .voice-btn:hover {
  background: rgba(var(--brand-rgb), 0.15);
  border-color: rgba(var(--brand-rgb), 0.3);
}

@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* 音色选择器 */
.voice-selector {
  position: relative;
  flex-shrink: 0;
}

/* 音色选择器（高级感：磨砂玻璃 + 柔和交互） */
.voice-select-btn {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  color: var(--text-2);
  padding: 7px 12px;
  border-radius: var(--radius);
  font-family: var(--font-main);
  font-size: 0.8125rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: var(--shadow-xs);
  transition: all var(--duration-normal) var(--ease-out);
}

.voice-select-btn:hover {
  background: var(--brand-soft);
  border-color: rgba(var(--brand-rgb), 0.3);
  color: var(--brand);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.voice-select-btn:active {
  transform: translateY(0) scale(0.97);
}

/* 深色主题音色选择器 */
.theme-dark .voice-select-btn {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(99, 102, 241, 0.15);
}

.theme-dark .voice-select-btn:hover {
  background: rgba(var(--brand-rgb), 0.15);
  border-color: rgba(var(--brand-rgb), 0.3);
}

.voice-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: var(--space-1) 0;
  width: 160px;
  max-height: 220px;
  overflow-y: auto;
  display: none;
  z-index: 50;
}

.voice-dropdown.show {
  display: block;
  animation: pop-fade-down var(--duration-normal) var(--ease-out);
}

.voice-option {
  padding: 8px 14px;
  font-size: 0.875rem;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.voice-option:hover {
  background: var(--brand-soft);
  color: var(--brand);
}

.voice-option.active {
  background: var(--brand);
  color: #fff;
}

/* 顶栏图标按钮（高级感：磨砂玻璃 + 柔和交互） */
.icon-btn {
  width: auto;
  min-width: 40px;
  height: 40px;
  padding: 6px 10px;
  border-radius: var(--radius);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 2px 6px rgba(var(--brand-rgb), 0.05),
    0 1px 2px rgba(0, 0, 0, 0.03);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.0625rem;
  line-height: 1;
  transition: all var(--duration-normal) var(--ease-out);
}

.icon-btn:hover {
  transform: translateY(-1px) scale(1.05);
  color: var(--brand);
  border-color: rgba(var(--brand-rgb), 0.3);
  background: var(--brand-soft);
  box-shadow:
    0 4px 12px rgba(var(--brand-rgb), 0.12),
    0 2px 4px rgba(0, 0, 0, 0.06);
}

.icon-btn:active {
  transform: translateY(0) scale(0.96);
  box-shadow:
    0 1px 3px rgba(var(--brand-rgb), 0.08),
    0 1px 2px rgba(0, 0, 0, 0.04);
}

/* 深色主题图标按钮 */
.theme-dark .icon-btn {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(99, 102, 241, 0.12);
}

.theme-dark .icon-btn:hover {
  background: rgba(var(--brand-rgb), 0.15);
  border-color: rgba(var(--brand-rgb), 0.3);
}

.sound-toggle.off {
  opacity: 0.6;
}

.sound-toggle.off .ic {
  filter: grayscale(1);
}

.sound-toggle.off:hover {
  opacity: 0.85;
}

/* --- 悬浮菜单 --- */
.floating-menu {
  position: fixed;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  pointer-events: auto;
  z-index: 40;
}

.floating-menu.side-left {
  right: auto;
  left: 296px;
}

/* 悬浮菜单按钮（高级感：磨砂玻璃 + 柔和交互） */
.float-btn {
  width: auto;
  min-width: 48px;
  max-width: 80px;
  height: auto;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  border: 1px solid var(--glass-border);
  box-shadow:
    0 4px 12px rgba(var(--brand-rgb), 0.08),
    0 2px 4px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: all var(--duration-normal) var(--ease-out);
}

.float-btn .fb-ic {
  font-size: 1.25rem;
  line-height: 1;
}

.float-btn .fb-lbl {
  font-size: 0.5625rem;
  line-height: 1.15;
  font-weight: 600;
  color: var(--text-2);
  text-align: center;
  word-break: break-word;
  max-width: 72px;
}

.float-btn:hover {
  transform: scale(1.08) rotate(3deg);
  background: var(--brand-soft);
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
}

.float-btn:hover .fb-lbl {
  color: var(--brand);
}

/* --- 模态框 --- */
.modal-screen {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(15, 23, 42, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-normal) var(--ease-out);
}

.modal-screen.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: min(800px, 92vw);
  max-height: 85vh;
  max-height: 85dvh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  transform: scale(0.92) translateY(10px);
  transition: transform var(--duration-normal) var(--ease-out);
}

.modal-screen.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  background: var(--brand);
  border-bottom: 1px solid var(--brand-700);
  color: #fff;
  padding: var(--space-4) var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-head-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  min-width: 0;
}

.modal-copyright-tip {
  flex: 1 1 260px;
  min-width: 190px;
  font-size: 0.75rem;
  line-height: 1.5;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, 0.15);
  border-left: 3px solid rgba(255, 255, 255, 0.8);
}

.modal-copyright-tip[hidden] {
  display: none;
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  background: var(--surface);
  color: var(--text);
}

.modal-body img,
.modal-body video {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: var(--space-1) 0;
  display: block;
}

.modal-body img.rte-media-thumb {
  max-height: 150px;
  width: auto;
  object-fit: cover;
  cursor: zoom-in;
}

.modal-body video.rte-media-thumb {
  max-height: 170px;
  width: auto;
  object-fit: cover;
  cursor: pointer;
}

.modal-subtabs {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.modal-subtab {
  flex-shrink: 0;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--font-main);
  font-size: 0.875rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-out);
}

.modal-subtab:hover {
  background: var(--brand-soft);
  border-color: rgba(var(--brand-rgb), 0.2);
}

.modal-subtab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

.close-modal {
  background: none;
  border: none;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-xs);
  transition: all var(--duration-fast);
}

.close-modal:hover {
  background: rgba(255, 255, 255, 0.2);
}

.close-modal .lbl {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
}

.site-logo-img {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 6px;
  object-fit: contain;
  vertical-align: middle;
}

/* --- PhotoSwipe --- */
.pswp-video-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.pswp-video-wrap video {
  max-width: 92vw;
  max-height: 82vh;
  width: auto;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  background: #000;
}

/* --- 响应式 --- */
@media (min-width: 901px) {
  .ct-menu { display: none; }
  .floating-menu.side-left { left: 296px; }
}

@media (max-width: 900px) {
  /* ================================================================
     移动端侧边栏抽屉 — X5 / QQ 内核完全兼容版
     设计原则：硬编码实色背景、零透明度、零 backdrop-filter、
     零 CSS 变量依赖（关键属性）、显式四边定位。
     ================================================================ */

  /* ---- 抽屉容器 ---- */
  .conv-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    /* 硬编码白色：X5 下 CSS 变量可能解析异常，直接写死最安全 */
    background-color: #ffffff;
    /* 右边框分隔线（不用变量） */
    border-right: 1px solid #e5e7eb;
    /* 阴影：用标准值代替变量 */
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.12);
    /* 宽度：固定值兜底 + min() 增强（旧 X5 不认 min 则用固定值） */
    width: 280px;
    width: min(82vw, 300px);
    /* 层级：必须高于 body 级悬浮元素 */
    z-index: 200;
    /* 安全区内边距：两参 env 兜底 */
    padding-top: 20px;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: 16px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    /* 滑入动画：translate3d 强制 GPU 合成层，避免 X5 重绘闪烁 */
    -webkit-transform: translate3d(-100%, 0, 0);
    transform: translate3d(-100%, 0, 0);
    -webkit-transition: -webkit-transform 0.3s ease-out;
    transition: transform 0.3s ease-out;
    /* 布局方向保持纵向 flex */
    display: flex;
    flex-direction: column;
    /* 彻底清除桌面端残留的玻璃效果 */
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  /* 抽屉打开状态：滑入可见 */
  .app-shell.sidebar-open .conv-sidebar {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }

  /* ---- 抽屉内部子元素：全部强制实色背景 ---- */

  /* 顶部品牌区 */
  .cs-top {
    padding: 16px 16px 8px;
    background-color: #ffffff;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  /* 新建对话按钮 */
  .cs-new {
    margin: 8px 16px 12px;
    /* 保持渐变按钮外观，但确保无透明度泄漏 */
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }

  /* 中间滚动区域：核心内容区，必须实色 */
  .cs-scroll {
    /* 显式高度计算：X5 内核对 flex:1 + overflow 的组合可能无法正确分配剩余空间，
       用 calc 确保滚动区有确定高度，避免内容被裁切或只显示部分 */
    height: 0;
    height: calc(100vh - 160px);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 12px 12px;
    background-color: #ffffff;
    -webkit-overflow-scrolling: touch; /* iOS/X5 惯性滚动 */
    scrollbar-width: none;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .cs-scroll::-webkit-scrollbar { display: none; }

  /* 区块容器 */
  .cs-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background-color: transparent;
  }

  /* 区块标题 */
  .cs-block-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: #94a3b8;
    padding: 2px 6px;
  }

  /* 共鸣者卡片项 */
  .cs-agent {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    background-color: #f8fafc;
    border: 1px solid transparent;
  }
  .cs-agent:hover,
  .cs-agent.active {
    background-color: #eef2ff;
    border-color: rgba(99, 102, 241, 0.25);
  }

  /* ---- 共鸣者头像：硬编码渐变圆（X5 不认 var(--brand-grad) 变量中的 gradient）---- */
  .cs-agent-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    /* 硬编码紫色渐变：X5 对 CSS 变量内嵌 gradient 解析不稳定 */
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #ffffff;
    overflow: hidden;
    /* 确保圆形可见 */
    min-width: 36px;
    min-height: 36px;
  }

  /* 共鸣者名称/副标题 */
  .cs-agent-meta {
    min-width: 0;
    flex: 1;
  }
  .cs-agent-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .cs-agent-sub {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ---- 聊天回忆标题行（含清空按钮）---- */
  .cs-block-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-right: 2px;
  }

  /* 清空按钮：硬编码全部视觉属性（X5 下 var() 可能解析异常导致不可见） */
  .cs-clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 4px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    background-color: #ffffff;
    color: #94a3b8;
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .cs-clear-btn:hover,
  .cs-clear-btn:active {
    border-color: #fecaca;
    color: #ef4444;
    background-color: #fef2f2;
  }

  /* 暂无历史提示文字 */
  .cs-history-empty {
    font-size: 13px;
    color: #94a3b8;
    padding: 8px 4px;
  }

  /* 聊天回忆列表项（.cs-hist-item 是 HTML 实际使用的类名） */
  .cs-hist-item {
    padding: 10px 12px;
    padding-right: 30px;
    border-radius: 8px;
    background-color: #f8fafc;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    margin-bottom: 6px;
    position: relative;
  }
  .cs-hist-item:hover,
  .cs-hist-item:active {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
  }

  /* 删除按钮（移动端常显） */
  .cs-hist-del {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 1; /* 移动端常显 */
  }

  /* 底部导航栏 */
  .cs-bottom {
    padding: 8px 12px;
    background-color: #ffffff;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-around;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  .cs-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    text-decoration: none;
    color: #64748b;
    font-size: 11px;
    border-radius: 6px;
    transition: background-color 0.15s;
  }
  .cs-nav:hover,
  .cs-nav:active {
    background-color: #f1f5f9;
    color: #475569;
  }
  .cs-nav-ic {
    font-size: 18px;
  }

  /* ---- 遮罩层（点击关闭抽屉）---- */
  .app-shell.sidebar-open::after {
    content: '';
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 150;
    /* 纯实色半透明黑遮罩：不用 blur，X5 渲染最稳定 */
    background-color: rgba(0, 0, 0, 0.45);
  }

  /* ---- 堆叠上下文修复 ---- */
  /* .app-shell{z-index:1} 形成堆叠上下文，内部抽屉(z:200)/遮罩(z:150)
     被「封顶」在层级 1，无法盖过 body 级 .floating-menu(z:40)。
     打开抽屉时把整个 shell 抬到 60，使抽屉+遮罩浮于悬浮菜单之上。
     page-loader:9990 / modal-screen:10001 均 > 60，不受影响。 */
  .app-shell.sidebar-open {
    z-index: 60;
  }

  /* ---- 其他移动端适配（非侧边栏） ---- */
  .app-shell {
    padding-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .ct-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .floating-menu {
    right: 12px;
    top: 64px;
    transform: none;
    gap: 8px;
  }

  .floating-menu.side-left {
    right: 12px;
    left: auto;
  }

  .chat-scroll {
    padding: 16px 16px 12px;
  }

  .chat-compose {
    padding-left: 16px;
    padding-right: 16px;
  }

  .bubble .b-content {
    max-width: 84%;
  }
}

@media (max-width: 480px) {
  /* 小屏侧边栏更宽：固定值兜底 + min() 增强 */
  .conv-sidebar {
    width: 260px;
    width: min(88vw, 320px);
  }

  .cs-top {
    padding: var(--space-4) var(--space-4) var(--space-2);
  }

  .cs-scroll {
    padding: var(--space-2) var(--space-2) var(--space-3);
  }

  .cs-bottom {
    padding: var(--space-2) var(--space-2);
  }

  .cs-brand {
    font-size: 1rem;
  }

  .ct-avatar {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .ct-name {
    font-size: 0.875rem;
  }

  .bubble .b-avatar {
    width: 30px;
    height: 30px;
    font-size: 0.875rem;
  }

  .bubble .b-text {
    font-size: 0.875rem;
    padding: 8px 12px;
  }

  .voice-select-btn {
    font-size: 0.75rem;
    padding: 5px 8px;
  }

  .voice-select-btn span#currentVoiceName {
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
  }

  .floating-menu {
    top: 58px;
    gap: var(--space-2);
  }

  .float-btn {
    min-width: 42px;
    max-width: 68px;
  }

  .float-btn .fb-ic {
    font-size: 1rem;
  }

  .float-btn .fb-lbl {
    font-size: 0.5rem;
  }
}

/* ================================================================
   移动端触摸优化（触摸目标 ≥ 44px，间距舒适）
   ================================================================ */
@media (max-width: 480px) {
  /* 顶栏图标按钮触摸目标扩大 */
  .icon-btn,
  .ct-menu {
    min-width: 44px;
    height: 44px;
  }

  /* 语音按钮 / 发送按钮触摸目标 */
  .voice-btn {
    min-width: 44px;
    height: 44px;
  }

  .send-btn {
    min-width: 44px;
    height: 44px;
    padding: 0 14px;
  }

  /* 输入框容器内边距加大，触摸舒适 */
  .compose-bar {
    padding: 6px;
    gap: 6px;
  }

  .main-input {
    padding: 8px;
    font-size: 1rem;
  }

  /* 建议问题胶囊更大，便于点击 */
  .suggestion-chip {
    padding: 10px 16px;
    font-size: 0.875rem;
  }

  /* 模态框移动端占满宽度 */
  .modal-content {
    width: 94vw;
    border-radius: var(--radius-lg);
  }

  .modal-body {
    padding: var(--space-5);
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .bubble .b-text {
    font-size: 0.875rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bubble { animation: none; }
  .ct-avatar.thinking,
  .ct-avatar.speaking { transition: none; }
}
