/* ================================================================
   QBot Web — 全局样式
   这个文件管页面的"外貌"：颜色、大小、阴影、动画等。
   index.html 通过 <link rel="stylesheet" href="styles.css"> 引用它。
   ================================================================ */

/* -------- 背景渐变：页面中央的渐变光晕（颜色由 --bg-macaron 控制，可在偏好设置选择马卡龙色系） -------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--bg-macaron, radial-gradient(ellipse 70% 60% at 55% 55%, rgba(170, 210, 255, 0.65) 0%, transparent 70%), radial-gradient(ellipse 40% 40% at 70% 40%, rgba(150, 195, 255, 0.40) 0%, transparent 60%));
  pointer-events: none;
  z-index: 0;
}
/* 【偏好设置 → 背景】关闭时隐藏渐变光晕 → 纯白背景
   （与深色模式兼容：深色模式光晕本来就隐藏，此开关只影响浅色模式） */
body.no-bg-glow::before {
  opacity: 0;
}

/* -------- 输入框的柔和阴影 -------- */
.input-shadow {
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 4px 16px rgba(0, 0, 0, 0.04),
    0 8px 32px rgba(0, 0, 0, 0.03);
}

.session-active {
  background: #e8f0fe !important;
  font-weight: 500;
}
body.dark .session-active {
  background: #2d3a5c !important;
}

/* ================================================================
   发送按钮蓝色主题 —— 当按钮处于 "send"（有文字待发送）状态时，
   按钮背景变为浅蓝色（#e8f0fe），图标变为深蓝色（#1967d2）
   与右上角「升级」按钮的颜色保持一致，视觉语言统一
   ================================================================ */
.action-btn-send {
  background-color: #e8f0fe;  /* 浅蓝色背景 */
  color: #1967d2;             /* 深蓝色文字/图标颜色 */
}
.action-btn-send:hover {
  background-color: #d9e8ff;  /* 鼠标悬浮时稍深一点的蓝 */
}

/* -------- AI Logo 四角星多彩渐变色 -------- */
.ai-logo-gradient {
  background: linear-gradient(135deg, #4285f4, #ea4335, #fbbc04, #34a853);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ================================================================
   侧边栏专用样式
   Tailwind Play CDN 的 @apply 不支持 absolute/opacity/invisible
   等关键类，导致 tooltip 退化为普通行内文字撑破布局。
   以下全部使用原生 CSS 属性。
   ================================================================ */

/* -------- 每个图标按钮的包裹容器（relative 定位，子绝父相） -------- */
.sidebar-btn-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* -------- 图标按钮本体 -------- */
.sidebar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;          /* w-10 */
  height: 2.5rem;         /* h-10 */
  border-radius: 0.75rem; /* rounded-xl */
  color: #6b7280;         /* text-gray-500 */
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.sidebar-btn:hover {
  background-color: #e3e8ef; /* hover:bg-[#e3e8ef] */
  color: #111827;            /* text-gray-900 */
}

/* -------- 通用的黑色 Tooltip（默认隐藏，hover 时淡入）-------- */
.sidebar-tooltip {
  position: absolute;
  left: calc(100% + 12px);   /* left-full + ml-3 */
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  padding: 0.375rem 0.625rem; /* px-2.5 py-1.5 */
  border-radius: 0.375rem;    /* rounded-md */
  background-color: #2d2d2d;
  color: #fff;
  font-size: 0.8125rem;       /* text-sm */
  line-height: 1.125rem;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease-out, visibility 0.15s ease-out, transform 0.15s ease-out;
  z-index: 999;
}
.sidebar-btn-wrap:hover .sidebar-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}



.msg-actions {
  display: flex;
  flex-direction: row;
  gap: 4px;
  justify-content: flex-end;
  margin-top: 4px;
}

.msg-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #6b7280;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.12s ease;
}

.msg-action-btn:hover {
  background: #f0f0f0;
  color: #374151;
}

.msg-action-btn svg {
  width: 16px;
  height: 16px;
}

/* 消息行容器 */
.msg-row {
  display: flex;
  width: 100%;
  margin-bottom: 16px;
}

.model-switch-note-row {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 8px 0;
}
.model-switch-note {
  display: inline-block;
  background: #f0f2f5;
  color: #8a94a6;
  font-size: 12px;
  padding: 4px 14px;
  border-radius: 999px;
  max-width: 90%;
  text-align: center;
}
body.dark .model-switch-note {
  background: #2d2d4a;
  color: #9ca3af;
}

/* 消息区域滚动条 */
#chat-messages {
  scroll-behavior: smooth;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.msg-ai, .msg-user {
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
}
.msg-ai img, .msg-user img {
  max-width: 100%;
  height: auto;
}

#chat-messages::-webkit-scrollbar {
  width: 6px;
}
#chat-messages::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}
#chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

/* ================================================================
   详情页卡片样式
   ================================================================ */

.detail-feature-card {
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.detail-feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

/* 订阅卡片悬浮突起效果 */
.subscription-card {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.subscription-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

/* 主按钮悬浮突起效果（免费体验、去订阅） */
.btn-lift {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.btn-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* 详情页左侧正方形卡片 */
.card-square {
  width: 120px;
  height: 120px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  line-height: 1.3;
  text-align: center;
  user-select: none;
}
.card-square:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

/* 详情页可滚动区域滚动条（与聊天消息区风格一致） */
#detail-scroll::-webkit-scrollbar {
  width: 6px;
}
#detail-scroll::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}
#detail-scroll::-webkit-scrollbar-track {
  background: transparent;
}


/* ================================================================
   Markdown 渲染样式（AI 消息气泡内）
   marked.js 生成的 HTML 标签样式
   ================================================================ */

/* 代码块：灰色背景 + 圆角 + 等宽字体 */
.msg-ai pre {
  background: #f4f5f7;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 10px 0;
  overflow-x: auto;
  font-size: 15px;
  line-height: 1.6;
}
.msg-ai pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  color: #1f2937;
}

/* 行内代码 */
.msg-ai code {
  background: #f0f1f3;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 17px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  color: #d63384;
}

/* 表格 */
.msg-ai table {
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 16px;
  width: 100%;
}
.msg-ai th, .msg-ai td {
  border: 1px solid #d1d5db;
  padding: 8px 14px;
  text-align: left;
}
.msg-ai th {
  background: #f3f4f6;
  font-weight: 600;
}
.msg-ai tr:nth-child(even) {
  background: #fafafa;
}

/* 引用块 */
.msg-ai blockquote {
  border-left: 4px solid #d1d5db;
  padding: 6px 16px;
  margin: 10px 0;
  color: #6b7280;
  background: #f9fafb;
  border-radius: 0 8px 8px 0;
}

/* 分割线 */
.msg-ai hr {
  border: none;
  border-top: 2px solid #e5e7eb;
  margin: 16px 0;
}

/* 列表间距 */
.msg-ai ul, .msg-ai ol {
  padding-left: 24px;
  margin: 8px 0;
}
.msg-ai li {
  margin: 4px 0;
}

/* 标题 */
.msg-ai h2 { font-size: 22px; margin: 16px 0 8px; font-weight: 600; }
.msg-ai h3 { font-size: 19px; margin: 14px 0 6px; font-weight: 600; }
.msg-ai h4 { font-size: 17px; margin: 12px 0 4px; font-weight: 600; }

/* 链接 */
.msg-ai a {
  color: #2563eb;
  text-decoration: underline;
}
.msg-ai a:hover {
  color: #1d4ed8;
}

/* 段落间距 */
.msg-ai p {
  margin: 8px 0;
}

/* 代码块右上角复制按钮 */
.msg-ai pre .code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  color: #9ca3af;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
  z-index: 2;
}
.msg-ai pre:hover .code-copy-btn {
  opacity: 1;
}
.msg-ai pre .code-copy-btn:hover {
  color: #374151;
  background: #f3f4f6;
}

/* 模型选择器下拉面板（打开方向朝上，不会被输入框挡住） */
#model-dropdown {
  max-height: 340px;
  overflow-y: auto;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06);
}
#model-dropdown::-webkit-scrollbar {
  width: 4px;
}
#model-dropdown::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 2px;
}
#model-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

/* ================================================================
   笔记编辑器样式
   ================================================================ */

/* contenteditable 空状态占位符 */
#note-content:empty::before {
  content: attr(data-placeholder);
  color: #bbb;
  pointer-events: none;
}

/* 笔记编辑器中的图片最大宽度限制 */
#note-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 8px 0;
  display: block;
}

/* 笔记编辑器滚动条 */
#note-content::-webkit-scrollbar {
  width: 6px;
}
#note-content::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}
#note-content::-webkit-scrollbar-track {
  background: transparent;
}

/* 最后更新：2026-07-04 */

/* ================================================================
   图片文件缩略图 Chip 样式
   ================================================================ */
.file-chip-image {
  border-radius: 12px;
  padding: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f5f5;
  border: 1px solid #eee;
}
.file-chip-image .file-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f0f0f0;
}
.file-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 48px;
  min-width: 48px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}
.file-badge-pdf   { background: #fee2e2; color: #dc2626; }
.file-badge-word  { background: #dbeafe; color: #2563eb; }
.file-badge-excel { background: #dcfce7; color: #16a34a; }
.file-badge-ppt   { background: #fef3c7; color: #d97706; }
.file-badge-txt   { background: #f3f4f6; color: #6b7280; }
.file-badge-zip   { background: #f3e8ff; color: #9333ea; }
.file-badge-audio { background: #fce7f3; color: #db2777; }
.file-badge-video { background: #e0f2fe; color: #0284c7; }
.file-badge-code  { background: #ecfdf5; color: #059669; }
.file-badge-other { background: #f3f4f6; color: #9ca3af; }

/* ================================================================
   用户消息气泡内的图片样式
   ================================================================ */
.msg-user .msg-img-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.msg-user .msg-img-grid img {
  height: 120px;
  width: auto;
  max-width: 100%;
  border-radius: 10px;
  object-fit: contain;
  flex: 0 0 auto;
  background: #fafafa;
}
.msg-user .msg-img-grid.msg-img-single img {
  height: 240px;
  max-width: 400px;
  border-radius: 12px;
  object-fit: contain;
}
.msg-user img {
  max-width: 400px;
  border-radius: 12px;
  margin: 4px 0;
  display: block;
}

/* ================================================================
   统计图表样式
   ================================================================ */
.stats-bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 100%;
  padding: 0 8px;
  gap: 6px;
}
.stats-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
  height: 100%;
  justify-content: flex-end;
}
.stats-bar {
  width: 100%;
  max-width: 36px;
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: height 0.4s ease;
  cursor: pointer;
  position: relative;
}
.stats-bar:hover {
  opacity: 0.8;
}
.stats-bar-label {
  font-size: 10px;
  color: #9ca3af;
  margin-top: 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 54px;
}
.stats-bar-value {
  font-size: 9px;
  color: #9ca3af;
  margin-bottom: 2px;
  text-align: center;
}

/* ================================================================
   知识库网格样式
   ================================================================ */
#kb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  align-content: start;
}
.kb-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 12px;
  padding: 12px 8px 8px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}
.kb-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}
.kb-item-thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #6b7280;
  flex-shrink: 0;
}
.kb-item-name {
  font-size: 12px;
  color: #374151;
  margin-top: 8px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
  width: 100%;
  word-break: break-all;
}
.kb-item-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
}
.kb-item:hover .kb-item-delete {
  display: flex;
}
body.dark .kb-item {
  background: #242440;
  border-color: #363654;
}
body.dark .kb-item-thumb {
  background: #2d2d4a;
  color: #9ca3af;
}
body.dark .kb-item-name {
  color: #e5e7eb;
}
body.dark #kb-empty svg {
  color: #4a4a6a;
}
body.dark #kb-empty p {
  color: #6b7280;
}

/* ================================================================
   暗色模式
   ================================================================ */
body.dark {
  background: #16162a !important;
  color: #e5e7eb;
}
/* 隐藏渐变光晕和装饰性蓝色模糊圆 */
body.dark::before {
  opacity: 0;
}
body.dark .bg-blue-200\/30,
body.dark .bg-blue-100\/25 {
  opacity: 0;
  display: none;
}

/* 页面容器 */
body.dark #auth-page,
body.dark #detail-page {
  background: #16162a !important;
}
body.dark #detail-page {
  background: #16162a !important;
}
body.dark #main-layout {
  background: #16162a;
}

/* 背景色覆盖 */
body.dark .bg-white,
body.dark .msg-user,
body.dark .msg-ai,
body.dark .detail-feature-card,
body.dark .subscription-card,
body.dark .card-square {
  background: #242440;
  border-color: #363654;
  color: #e5e7eb;
}
body.dark .bg-gray-50,
body.dark .bg-gray-100 {
  background: #2d2d4a;
}
body.dark .bg-gray-200,
body.dark .bg-gray-200\/60 {
  background: #363654;
}

/* 文字颜色 */
body.dark .text-gray-800,
body.dark .text-gray-900,
body.dark .text-gray-700 {
  color: #e5e7eb;
}
body.dark .text-gray-500,
body.dark .text-gray-600 {
  color: #9ca3af;
}
body.dark .text-gray-400 {
  color: #6b7280;
}
body.dark .text-gray-950 {
  color: #e5e7eb;
}

/* 边框颜色 */
body.dark .border-gray-100,
body.dark .border-gray-200,
body.dark .border-gray-200\/30 {
  border-color: #363654;
}

/* 阴影 */
body.dark .input-shadow {
  box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 4px 16px rgba(0,0,0,0.2);
}
body.dark .shadow-sm,
body.dark .shadow-xl {
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
}

/* 侧边栏按钮悬浮 */
body.dark .sidebar-btn {
  color: #6b7280;
}
body.dark .sidebar-btn:hover {
  background-color: #2d2d4a;
  color: #e5e7eb;
}

/* 边栏和抽屉内部悬浮态 */
body.dark .hover\:bg-gray-100:hover {
  background: #2d2d4a;
}
body.dark .hover\:bg-gray-200:hover,
body.dark .hover\:bg-gray-200\/60:hover {
  background: #363654;
}
body.dark .group:hover .group-hover\:opacity-100 {
  opacity: 1;
}

/* 抽屉 */
body.dark #drawer {
  background: #1a1a30;
  border-color: #363654;
}
body.dark #drawer .bg-gray-100 {
  background: #2d2d4a;
}
body.dark #drawer .bg-gray-100:hover {
  background: #363654;
}

/* 设置面板 */
body.dark .settings-panel-content table thead tr {
  background: #2d2d4a;
}
body.dark .settings-panel-content table tbody tr {
  background: #242440;
}
body.dark .settings-panel-content table tbody tr td {
  color: #d1d5db;
}
body.dark .settings-option.active {
  background: #2d2d4a;
}

/* 用户信息弹窗 */
body.dark #profile-popup {
  background: #1a1a30;
  border-color: #363654;
}
body.dark #profile-popup .bg-gray-50 {
  background: #2d2d4a;
}
body.dark #profile-popup .bg-gray-100 {
  background: #2d2d4a;
}

/* 输入框 */
body.dark #chat-input {
  color: #e5e7eb;
}
body.dark #chat-input::placeholder {
  color: #6b7280;
}
body.dark .input-bar-width {
  background: #242440;
  border-color: #363654;
}

/* 模型选择器下拉 */
body.dark #model-dropdown {
  background: #1a1a30;
  border-color: #363654;
}
body.dark #model-dropdown .bg-blue-50 {
  background: #1e2240;
}
body.dark #model-dropdown .text-gray-700 {
  color: #d1d5db;
}
body.dark #model-dropdown .text-gray-900 {
  color: #e5e7eb;
}
body.dark #model-dropdown .hover\:bg-gray-50:hover {
  background: #2d2d4a;
}
body.dark #model-dropdown .bg-gray-50 {
  background: #2d2d4a;
}

/* 三点菜单弹出 */
body.dark #popover-menu {
  background: #1a1a30;
  border-color: #363654;
}
body.dark #popover-menu .hover\:bg-gray-100:hover {
  background: #2d2d4a;
}
body.dark #popover-menu .text-gray-700 {
  color: #d1d5db;
}

/* 详情页弹窗 */
body.dark [id^="popup-"] > div {
  background: #1a1a30;
  border-color: #363654;
}
body.dark [id^="popup-"] .bg-gray-50 {
  background: #2d2d4a;
}
body.dark [id^="popup-"] .bg-gray-100 {
  background: #2d2d4a;
}
body.dark [id^="popup-"] .text-gray-800 {
  color: #e5e7eb;
}
body.dark [id^="popup-"] .text-gray-600 {
  color: #9ca3af;
}
body.dark [id^="popup-"] .text-gray-400 {
  color: #6b7280;
}

/* 详情页导航 Tab */
body.dark .detail-tab.bg-white {
  background: #2d2d4a;
}

/* 详情页用户指南弹窗 */
body.dark #popup-guide .bg-blue-50 {
  background: #1e2240;
}
body.dark #popup-guide .text-blue-800 {
  color: #93c5fd;
}
body.dark #popup-guide .text-blue-600 {
  color: #60a5fa;
}

/* 搜索框 */
body.dark #search-box .bg-gray-100 {
  background: #2d2d4a;
}
body.dark #search-input {
  color: #e5e7eb;
}
body.dark #search-input::placeholder {
  color: #6b7280;
}

/* 笔记编辑器 */
body.dark #note-content {
  color: #e5e7eb;
}
body.dark #note-title-input {
  color: #e5e7eb;
}
body.dark #note-title-input::placeholder {
  color: #6b7280;
}

/* 文件列表 chip */
body.dark .file-chip-image,
body.dark #file-list .bg-gray-100 {
  background: #2d2d4a;
}
body.dark .file-chip-image:hover,
body.dark #file-list .bg-gray-100:hover {
  background: #363654;
}

/* 置顶条目样式 */
.pinned {
  background-color: #eef2ff;
}
body.dark .pinned {
  background-color: #2a2a48;
}
.pinned .truncate {
  font-weight: 500;
}

/* 当前选中笔记行高亮 */
.active-note {
  background-color: #eef2ff !important;
}
body.dark .active-note {
  background-color: #2a2a48 !important;
}

/* ================================================================
   聊天字体大小
   ================================================================ */
.chat-font-small .msg-user,
.chat-font-small .msg-ai {
  font-size: 16px;
}
.chat-font-medium .msg-user,
.chat-font-medium .msg-ai {
  font-size: 20px;
}
.chat-font-large .msg-user,
.chat-font-large .msg-ai {
  font-size: 24px;
}

/* ================================================================
   设置面板滚动
   ================================================================ */
#panel-preferences,
#panel-recharge,
#panel-stats {
  max-height: 65vh;
  overflow-y: auto;
  padding-right: 4px;
}
#panel-preferences::-webkit-scrollbar,
#panel-recharge::-webkit-scrollbar,
#panel-stats::-webkit-scrollbar {
  width: 4px;
}
#panel-preferences::-webkit-scrollbar-thumb,
#panel-recharge::-webkit-scrollbar-thumb,
#panel-stats::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 2px;
}
#panel-preferences::-webkit-scrollbar-track,
#panel-recharge::-webkit-scrollbar-track,
#panel-stats::-webkit-scrollbar-track {
  background: transparent;
}

/* ================================================================
   生图加载动画（骨架 + 旋转圆环 + Shimmer）
   ================================================================ */
.img-gen-skeleton {
  width: 360px;
  height: 360px;
  border-radius: 16px;
  background: #f0f1f3;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-gen-skeleton::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
  animation: shimmer 2s infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.img-gen-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 4px solid #e5e7eb;
  border-top-color: #3b82f6;
  animation: img-gen-spin 1s linear infinite;
  z-index: 1;
}
@keyframes img-gen-spin {
  to { transform: rotate(360deg); }
}
.img-gen-label {
  position: absolute;
  bottom: 24px;
  font-size: 13px;
  color: #9ca3af;
  z-index: 1;
}
body.dark .img-gen-skeleton {
  background: #2d2d4a;
}
body.dark .img-gen-ring {
  border-color: #363654;
  border-top-color: #60a5fa;
}
body.dark .img-gen-label {
  color: #6b7280;
}

/* ================================================================
   生图结果 & Lightbox
   ================================================================ */
.msg-ai .gen-image {
  max-width: 360px;
  border-radius: 14px;
  cursor: pointer;
  display: block;
  transition: transform 0.2s ease;
}
.msg-ai .gen-image:hover {
  transform: scale(1.02);
}
.msg-ai .gen-image-caption {
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
  margin-top: 4px;
}

/* Lightbox 遮罩层 */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
#lightbox.show {
  display: flex;
}
#lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
#lightbox-close {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
#lightbox-close:hover {
  background: rgba(255,255,255,0.3);
}

/* 流式输出光标闪烁动画 */
@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.msg-ai .streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: #2563eb;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink-cursor 0.8s step-end infinite;
}
