/* ========================================== */
/* 炭火 AI - DeepSeek 风格界面 */
/* ========================================== */
:root {
  --brand-blue: #3B82F6;
  --brand-blue-hover: #2563EB;
  --brand-blue-light: #EFF6FF;
  --bg-white: #FFFFFF;
  --bg-sidebar: #F7F7F8;
  --bg-hover: #ECECF1;
  --bg-active: #E5E5EA;
  --text-primary: #1A1A1A;
  --text-secondary: #6B6B7B;
  --text-muted: #9B9BA8;
  --border-light: #E5E5E8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition: 0.15s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-white);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

/* ========================================== */
/* 布局 */
/* ========================================== */
.app-container {
  display: flex;
  height: 100vh;
  position: relative;
}

/* ========================================== */
/* 左侧边栏 */
/* ========================================== */
.sidebar {
  width: 280px;
  min-width: 280px;
  height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-light);
  z-index: 100;
  transition: transform var(--transition);
}

/* 侧边栏顶部 */
.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 4px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.sidebar-logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

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

.btn-sidebar-action {
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.btn-sidebar-action:hover {
  background: var(--bg-hover);
}

/* 新对话按钮 */
.btn-new-chat {
  margin: 8px 16px;
  padding: 10px 16px;
  border: 1px solid var(--border-light);
  background: var(--bg-white);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
  font-family: inherit;
}

.btn-new-chat:hover {
  background: var(--bg-hover);
  border-color: #D1D1D8;
}

/* 对话列表 */
.conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.12) transparent;
}

.conversation-list::-webkit-scrollbar { width: 4px; }
.conversation-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 4px; }

/* 时间分组 */
.conversation-group {
  margin-bottom: 4px;
}

.conversation-group-label {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* 对话项 */
.conversation-item {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: background var(--transition);
  position: relative;
  gap: 8px;
}

.conversation-item:hover { background: var(--bg-hover); }
.conversation-item.active { background: var(--bg-active); }
.conversation-item.pinned { background: var(--brand-blue-light); }

.conversation-item.streaming::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--brand-blue);
  border-radius: 50%;
  margin-right: 8px;
  animation: pulse-dot 1.2s ease infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.conversation-item .conv-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--brand-blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  flex-shrink: 0;
}

.conversation-item .conv-icon svg {
  width: 14px;
  height: 14px;
  color: var(--brand-blue);
}

.conversation-item .conv-preview {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* conversation-preview（新版 flex 布局） */
.conversation-preview {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.conversation-item .conv-delete {
  opacity: 0;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}

.conversation-item:hover .conv-delete { opacity: 1; }
.conversation-item .conv-delete:hover { background: #FEE2E2; color: #EF4444; }

.no-conversations {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* 对话项时间 */
.conversation-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
  padding-left: 8px;
  flex-shrink: 0;
}

/* 时间分组 */
.conversation-group {
  margin-bottom: 4px;
}

.conversation-group-label {
  padding: 10px 12px 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* 置顶标记 */
.conversation-pin-icon {
  color: var(--brand-blue);
  margin-right: 2px;
  font-size: 11px;
}

/* 侧边栏底部 */
.sidebar-bottom {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
}

.btn-download-record {
  width: 100%;
  padding: 8px 0;
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  border-radius: var(--radius-sm);
  padding-left: 8px;
  margin-bottom: 8px;
}

.btn-download-record:hover { background: var(--bg-hover); }

/* 未登录用户区域 */
.sidebar-user-unauth {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px;
}

.sidebar-user-avatar-default {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.btn-sidebar-login {
  flex: 1;
  padding: 6px 12px;
  border: none;
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition);
}

.btn-sidebar-login:hover { background: var(--bg-hover); }

/* 已登录用户区域 */
.sidebar-user-auth {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.sidebar-user-name {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-sidebar-logout {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-sidebar-logout:hover { background: var(--bg-hover); color: #EF4444; }

/* ========================================== */
/* 遮罩层 */
/* ========================================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 99;
}

/* ========================================== */
/* 侧边栏切换按钮 */
/* ========================================== */
.btn-sidebar-toggle {
  position: fixed;
  top: 12px;
  left: 12px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-light);
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.btn-sidebar-toggle:hover { background: var(--bg-hover); }
.btn-sidebar-toggle.show { display: flex; }

/* PC 端侧边栏折叠 */
.sidebar.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-right: none;
}

/* PC端折叠后输入框左边缘归零 */
.sidebar.collapsed ~ .sidebar-overlay,
.app-container:has(.sidebar.collapsed) .fixed-input-container {
  left: 0;
}

/* ========================================== */
/* 消息头部（发送者 + 复制按钮 + 时间） */
/* ========================================== */
.message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.message-header .message-sender { margin-bottom: 0; }

/* 复制按钮 */
.msg-copy-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  opacity: 0;
}

.message-bubble:hover .msg-copy-btn,
.msg-copy-btn.copied { opacity: 1; }
.msg-copy-btn:hover { background: var(--bg-hover); color: var(--brand-blue); }
.msg-copy-btn.copied { color: #10B981; }

/* 消息时间戳居中 */
.message-meta {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  width: 100%;
  margin-top: 4px;
}

/* ========================================== */
/* 思考过程 */
/* ========================================== */
.reasoning-section {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  overflow: hidden;
}

.reasoning-section.collapsed .reasoning-text { display: none; }
.reasoning-section.collapsed .reasoning-toggle { transform: rotate(0deg); }

.reasoning-header {
  padding: 8px 12px;
  background: var(--bg-sidebar);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.reasoning-toggle {
  font-size: 10px;
  transition: transform var(--transition);
  transform: rotate(180deg);
}

.reasoning-text {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  border-top: 1px solid var(--border-light);
  white-space: pre-wrap;
  word-break: break-word;
}

/* 思考深度加载动画 */
.thinking-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.dot-pulse {
  display: flex;
  gap: 3px;
}

.dot-pulse span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brand-blue);
  animation: dot-bounce 1.4s ease infinite;
}

.dot-pulse span:nth-child(2) { animation-delay: 0.2s; }
.dot-pulse span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0.4); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
}

.chat-area {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 140px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.12) transparent;
}

.chat-area::-webkit-scrollbar { width: 4px; }
.chat-area::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 4px; }

/* ========================================== */
/* 欢迎区域 */
/* ========================================== */
.welcome-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  padding: 40px 20px;
  text-align: center;
}

.welcome-section.hidden { display: none; }

.welcome-logo {
  margin-bottom: 16px;
}

.welcome-logo img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

#welcome-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

/* 模式切换 */
.mode-switcher {
  display: flex;
  gap: 8px;
  margin: 20px 0 28px;
}

.mode-btn {
  padding: 8px 16px;
  border: 1px solid var(--border-light);
  background: var(--bg-white);
  border-radius: var(--radius-full);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  transition: all var(--transition);
}

.mode-btn:hover { background: var(--bg-hover); }

.mode-btn.active {
  background: var(--brand-blue);
  color: #fff;
  border-color: var(--brand-blue);
}

/* 示例按钮 */
.welcome-examples {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 640px;
}

.example-btn {
  padding: 12px 16px;
  border: 1px solid var(--border-light);
  background: var(--bg-white);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all var(--transition);
  line-height: 1.4;
}

.example-btn:hover { background: var(--bg-hover); border-color: #D1D1D8; }

/* ========================================== */
/* 聊天消息区域 */
/* ========================================== */
.chat-messages-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

.chat-messages-container.hidden { display: none; }

.chat-messages {
  padding: 20px 0;
}

/* 消息气泡 */
.message-bubble {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  max-width: 100%;
}

.message-bubble.user { justify-content: flex-end; flex-direction: row-reverse; }

.message-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
}

.message-avatar.ai {
  background: var(--brand-blue);
  color: #fff;
}

.message-bubble.user .message-avatar {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.message-content {
  flex: 1;
  min-width: 0;
}

.message-sender {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.message-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.message-text pre {
  background: #1E1E1E;
  color: #D4D4D4;
  padding: 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.5;
}

.message-text code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
}

.message-text p code {
  background: var(--bg-sidebar);
  padding: 2px 6px;
  border-radius: 4px;
  color: #E11D48;
}

.message-text table {
  border-collapse: collapse;
  margin: 8px 0;
  width: 100%;
  font-size: 13px;
}

.message-text th, .message-text td {
  border: 1px solid var(--border-light);
  padding: 8px 12px;
  text-align: left;
}

.message-text th { background: var(--bg-sidebar); font-weight: 600; }

/* 用户消息样式 */
.message-bubble.user .message-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.message-bubble.user .message-text {
  background: var(--bg-sidebar);
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  display: inline-block;
  max-width: 85%;
  text-align: left;
}

.message-bubble.user .message-meta {
  text-align: right;
}

/* 推理过程（可折叠） */
.thinking-section {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  overflow: hidden;
}

.thinking-header {
  padding: 10px 14px;
  background: var(--bg-sidebar);
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.thinking-header:hover { background: var(--bg-hover); }

.thinking-body {
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  border-top: 1px solid var(--border-light);
  display: none;
}

.thinking-section.open .thinking-body { display: block; }

/* 流式输出动画 */
.streaming-cursor::after {
  content: '▍';
  animation: blink 1s step-end infinite;
  color: var(--brand-blue);
}

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

/* ========================================== */
/* 固定输入框 */
/* ========================================== */
.fixed-input-container {
  position: fixed;
  bottom: 0;
  left: 280px;
  right: 0;
  padding: 0 20px 20px;
  background: linear-gradient(transparent, var(--bg-white) 30%);
  z-index: 50;
}

.input-wrapper {
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition);
}

.input-wrapper:focus-within {
  border-color: var(--brand-blue);
  box-shadow: 0 4px 16px rgba(59,130,246,0.1);
}

#chat-input {
  width: 100%;
  min-height: 48px;
  max-height: 200px;
  padding: 12px 16px 8px;
  border: none;
  background: transparent;
  resize: none;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
  color: var(--text-primary);
  scrollbar-width: none;
}

#chat-input::-webkit-scrollbar { display: none; }
#chat-input::placeholder { color: var(--text-muted); }

/* 输入底部操作区 */
.input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px 8px;
}

.input-tags {
  display: flex;
  gap: 6px;
}

.input-tag {
  padding: 4px 10px;
  border: 1px solid var(--border-light);
  background: var(--bg-white);
  border-radius: var(--radius-full);
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  transition: all var(--transition);
}

.input-tag:hover { background: var(--bg-hover); }

.input-tag.active {
  background: var(--brand-blue-light);
  color: var(--brand-blue);
  border-color: var(--brand-blue);
}

.input-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-send {
  width: 34px;
  height: 34px;
  border: none;
  background: var(--brand-blue);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.btn-send:hover { background: var(--brand-blue-hover); transform: scale(1.05); }
.btn-send:active { transform: scale(0.95); }

.btn-send:disabled {
  background: #D1D5DB;
  cursor: not-allowed;
  transform: none;
}

.input-notice {
  max-width: 800px;
  margin: 8px auto 0;
  text-align: center;
}

.input-notice p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ========================================== */
/* 停止生成按钮 */
/* ========================================== */
.btn-stop-stream {
  width: 34px;
  height: 34px;
  border: none;
  background: #FEE2E2;
  border-radius: 50%;
  color: #EF4444;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.btn-stop-stream:hover { background: #FECACA; }

/* ========================================== */
/* Toast */
/* ========================================== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: #fff;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-size: 13px;
  z-index: 999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.toast.show { opacity: 1; }
.toast.hidden { opacity: 0; }
.toast.info { background: var(--brand-blue); }
.toast.success { background: #10B981; }
.toast.error { background: #EF4444; }

/* 下载进度条 */
.download-toast {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  box-shadow: var(--shadow-md);
  z-index: 998;
  min-width: 320px;
}

.download-toast.hidden { display: none; }

.download-toast-inner {
  display: flex;
  gap: 12px;
  align-items: center;
}

.download-toast-icon { color: var(--brand-blue); flex-shrink: 0; }

.download-toast-info { flex: 1; }

.download-toast-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.download-toast-bar-track {
  height: 4px;
  background: var(--bg-hover);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}

.download-toast-bar-fill {
  height: 100%;
  background: var(--brand-blue);
  border-radius: 2px;
  transition: width 0.3s;
  width: 0%;
}

.download-toast-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* ========================================== */
/* 下载记录面板 */
/* ========================================== */
.download-records-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 200;
}

.download-records-panel {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100vh;
  background: var(--bg-white);
  box-shadow: var(--shadow-md);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
}

.download-records-overlay.show {
  display: block;
}

.download-records-panel.show {
  right: 0;
}

.download-records-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}

.download-records-header h3 { font-size: 16px; font-weight: 600; }

.download-records-header-actions { display: flex; align-items: center; gap: 10px; }

.download-records-clear {
  height: 28px;
  padding: 0 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
}

.download-records-clear:hover { background: var(--bg-hover); color: #e74c3c; }

.download-records-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.download-records-close:hover { background: var(--bg-hover); }

.download-records-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.download-records-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.download-records-empty p { font-weight: 600; }
.download-records-empty span { font-size: 12px; }

/* 下载记录列表项 */
.download-record-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.download-record-item:hover { background: var(--bg-hover); }

.download-record-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--bg-sidebar);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.download-record-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.download-record-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.download-record-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.download-record-platform {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: var(--bg-hover);
}

.download-record-status.completed { color: #10B981; }
.download-record-status.downloading { color: var(--brand-blue); }
.download-record-status.failed { color: #EF4444; }

/* ========================================== */
/* 登录模态框 */
/* ========================================== */
.auth-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  align-items: center;
  justify-content: center;
}

.auth-modal-overlay.show { display: flex; }

.auth-modal {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 400px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.auth-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-modal-close:hover { background: var(--bg-hover); }

.auth-tabs {
  display: flex;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}

.auth-tab {
  flex: 1;
  padding: 12px;
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}

.auth-tab.active {
  color: var(--brand-blue);
  border-bottom-color: var(--brand-blue);
}

.auth-form { display: none; }
.auth-form.active { display: block; }

.auth-field { margin-bottom: 16px; }

.auth-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.auth-field input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}

.auth-field input:focus { border-color: var(--brand-blue); }

.auth-code-row {
  display: flex;
  gap: 8px;
}

.auth-code-row input { flex: 1; }

.auth-code-btn {
  padding: 10px 16px;
  border: 1px solid var(--border-light);
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--brand-blue);
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.auth-code-btn:hover { background: var(--brand-blue-light); }

.auth-code-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.auth-submit-btn {
  width: 100%;
  padding: 12px;
  border: none;
  background: var(--brand-blue);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition);
}

.auth-submit-btn:hover { background: var(--brand-blue-hover); }

.auth-error {
  color: #EF4444;
  font-size: 12px;
  margin-top: 8px;
  min-height: 18px;
}

.auth-alt-link { text-align: center; margin-top: 12px; }
.auth-alt-link a { color: var(--brand-blue); font-size: 13px; text-decoration: none; }

.auth-forgot-link { text-align: center; margin-top: 12px; }
.auth-forgot-link a { color: var(--text-muted); font-size: 12px; text-decoration: none; }

.auth-forgot-header { margin-bottom: 16px; }

.auth-back-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}

.auth-forgot-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ========================================== */
/* 选择遮罩 */
/* ========================================== */
.selection-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
}

.selection-overlay.show { display: block; }

/* ========================================== */
/* 弹出菜单（长按 / 右键） */
/* ========================================== */
.popup-menu {
  position: fixed;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 200;
  min-width: 160px;
  padding: 6px 0;
  animation: popup-in 0.15s ease;
}

@keyframes popup-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.popup-menu-item {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background var(--transition);
  user-select: none;
}

.popup-menu-item:hover { background: var(--bg-hover); }

.popup-menu-item.danger,
.popup-menu-item.danger:hover { color: #EF4444; }

.popup-menu-separator {
  height: 1px;
  background: var(--border-light);
  margin: 4px 12px;
}

/* 项选中状态 */
.conversation-item.selected,
.download-record-item.selected {
  background: var(--bg-active);
  border-radius: var(--radius-sm);
}

/* 列表虚化 */
.conversation-list.dimmed .conversation-item:not(.selected),
.download-records-list.dimmed .download-record-item:not(.selected) {
  opacity: 0.4;
  pointer-events: none;
}

/* ========================================== */
/* 隐藏元素 */
/* ========================================== */
.hidden { display: none !important; }

/* 静态上下文菜单（JS动态创建popup-menu，此部分仅兜底） */
.context-menu { display: none !important; }

/* ========================================== */
/* 响应式 */
/* ========================================== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
  }

  .sidebar.show { transform: translateX(0); }
  .sidebar.collapsed { transform: translateX(-100%); }

  .sidebar-overlay.show { display: block; }

  /* 移动端始终显示侧边栏切换按钮 */
  .btn-sidebar-toggle { display: flex; }

  .fixed-input-container { left: 0; padding: 0 12px 16px; }

  .welcome-examples { grid-template-columns: 1fr; }

  #welcome-title { font-size: 22px; }

  .download-records-panel { width: 100%; right: -100%; }

  .chat-messages-container { padding: 0 12px; }

  .message-bubble { padding: 12px 0; }
}

@media (max-width: 480px) {
  .fixed-input-container { padding: 0 8px 12px; }
  .input-wrapper { border-radius: var(--radius-md); }
  .mode-switcher { flex-direction: column; align-items: center; }
  .mode-btn { width: 160px; justify-content: center; }
}

/* ========================================== */
/* 视频播放结果（聊天消息内） */
/* ========================================== */
.video-result {
  max-width: 100%;
  overflow: hidden;
  border-radius: 8px;
}

.video-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 10px 0;
}

.video-platform-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  flex-shrink: 0;
}

.video-platform-tag.douyin { background: #FE2C55; color: #fff; }
.video-platform-tag.weibo { background: #E6162D; color: #fff; }
.video-platform-tag.xhs { background: #FF2442; color: #fff; }

.video-title {
  font-size: 14px;
  font-weight: 500;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.video-player-container {
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  max-width: 320px;
  width: 100%;
}

.chat-video-player {
  width: 100%;
  max-height: 240px;
  display: block;
  background: #000;
}

.video-actions {
  padding: 10px 0 0 0;
}

.video-error {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg-sidebar);
  border-radius: 8px;
}