/* 觅火MIIFIRE · 「个人名片短视频」创作 —— 样式表 */

/* 字体策略：不再自托管字体（曾用 5.67MB 全量思源宋体，拖慢页面加载 8~16s）。
 * 思源宋体各系统内置同源字体（Noto Serif SC / Songti SC），字形一致且零下载开销。 */
:root {
  --bg: #0b0d12;
  --panel: #12151c;
  --card: #171a22;
  --card-hover: #1c2029;
  --border: #262b37;
  --border-soft: #1d222d;
  --text: #e8eaf0;
  --text-2: #8a90a0;
  --text-3: #5c6270;
  --accent: #FE2C55;
  --accent-hover: #E82548;
  --accent-soft: rgba(254, 44, 85, 0.12);
  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #f87171;
  --r-lg: 14px;
  --r-md: 10px;
  --r-sm: 8px;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
/* 键盘焦点可见性（无障碍）：仅键盘导航时显示，鼠标点击不显示 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
body {
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

/* ── 启动闪屏：刷新时品牌 loading 覆盖层，会话恢复完成后淡出移除 ── */
.boot-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.25s ease;
}
.boot-splash.hidden {
  opacity: 0;
  pointer-events: none;
}
.boot-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.boot-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.boot-name {
  font-family: "Noto Serif SC", "Source Han Serif SC", serif;
  font-size: 18px;
  color: var(--text);
  letter-spacing: 0.5px;
}
.boot-name .boot-en {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 18px; /* 与中文等大（用户要求） */
  color: var(--text-2);
  margin-left: 6px;
  letter-spacing: 1.5px;
}
.boot-spinner {
  width: 18px;
  height: 18px;
  margin-top: 8px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: bootSpin 0.8s linear infinite;
}
@keyframes bootSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ── 顶栏 ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  flex-shrink: 0;
  background: rgba(13, 15, 21, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
}
.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text);
  font-family:
    "Source Han Serif SC", "Noto Serif CJK SC", "Noto Serif SC", "思源宋体", "Songti SC", serif;
}
.brand-en {
  font-weight: 650;
  letter-spacing: 0.2px;
}
.brand-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
}
.brand-tag {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 400;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
/* 会话操作区与身份区之间的视觉分区线 */
.top-divider {
  width: 1px;
  height: 18px;
  flex: none;
  margin: 0 6px;
  background: rgba(232, 234, 240, 0.09);
}
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.icon-btn:hover {
  background: var(--panel);
  border-color: var(--border);
  color: var(--text);
}
.ghost-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.ghost-btn:hover {
  background: var(--panel);
  border-color: #353b4a;
}

/* 未登录「登录」入口：主色描边，顶栏视觉焦点 */
.auth-login-btn {
  border-color: var(--accent);
  color: var(--accent);
}
.auth-login-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── 聊天主区 ── */
.chat-stage {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden; /* 杜绝内容横向溢出延伸（无滚动条的"加宽"由下方 .md 换行兜底解决） */
  min-height: 0;
}
.chat-area {
  max-width: 1320px;
  margin: 0 auto;
  padding: 32px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 100%;
}

/* 欢迎区——标题置顶居中，下方左右两栏：左=上传，右=已选+提交。
 * 张小龙式克制：去面板、轻边框、大留白、信息层级分明。 */
.welcome {
  margin: auto;
  width: 100%;
  max-width: 1320px;
  padding: 48px 24px 48px;
}
.welcome.hidden {
  display: none;
}

/* 新建会话反馈（无 toast，状态即反馈）：
 * 欢迎卡 0.4s 淡入上浮+缩放重放，形成明确的「卡片重新进入」纵深感（不似页面刷新） */
.welcome.nsc-reenter {
  animation: nscWelcomeReenter 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes nscWelcomeReenter {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.welcome-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1.4;
  text-align: center;
  margin: 0 0 10px;
}
.welcome-sub {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-2);
  text-align: center;
  margin: 0 0 44px;
}
.welcome-grid {
  display: grid;
  grid-template-columns: 400px 560px;
  gap: 24px;
  justify-content: center;
  align-items: stretch;
}
/* 左右两栏：精致卡片（与应用内气泡/面板的视觉语言一致） */
.welcome-left,
.welcome-right {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 8px 24px rgba(0, 0, 0, 0.06);
  padding: 20px;
}

/* 大上传入口：占满左卡内部，hover/拖入整体泛品牌色 */
.drop-zone {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 12px;
  padding: 40px 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.18s ease;
  outline: none;
}
.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.dragover {
  background: var(--accent-soft);
}
.drop-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.drop-main {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.drop-hint {
  font-size: 12px;
  color: var(--text-3);
}

/* ── 右栏：轻量列表 + CTA（卡片内：标题分隔线 + 文件列表 + 提交按钮） ── */
.welcome-right {
  min-height: 300px;
}
.queue-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 16px;
}
.queue-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.queue-summary {
  font-size: 12px;
  color: var(--text-3);
}
.upload-queue {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  text-align: left;
}
.queue-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-3);
}
/* 文件行：微信列表式，细分隔线，hover 极浅 */
.queue-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  color: var(--text);
  transition: background 0.12s;
}
.queue-row:hover {
  background: rgba(255, 255, 255, 0.03);
}
/* 待发送附件 chips（输入框上方，豆包式待发附件区） */
.queue-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
}
.queue-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.queue-size {
  color: var(--text-3);
  font-size: 12px;
  flex: none;
}
.queue-del {
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: inline-flex;
  padding: 4px;
  border-radius: 4px;
  flex: none;
}
.queue-del:hover {
  color: var(--err);
  background: rgba(248, 113, 113, 0.1);
}
.launch-btn {
  width: 100%;
  height: 48px;
  margin-top: 24px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, opacity 0.15s;
}
.launch-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}
.launch-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
/* 「重新加载已上传素材」：与主按钮并列的次级入口（阅读失败/中断后恢复用） */
.launch-btn.resume-btn {
  margin-top: 10px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 550;
}
.launch-btn.resume-btn:hover:not(:disabled) {
  background: var(--accent-soft);
}
/* 窄屏回退单列（移动端/小窗口） */
@media (max-width: 760px) {
  .welcome-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .welcome {
    max-width: 560px;
  }
}

/* 消息 */
.msg {
  line-height: 1.75;
  word-break: break-word;
}

/* ── AI 消息内 Markdown 结构化展示 ── */
.md h1,
.md h2,
.md h3,
.md h4 {
  margin: 18px 0 8px;
  font-weight: 650;
  line-height: 1.4;
}
.md h2 {
  font-size: 16px;
}
.md h3 {
  font-size: 14.5px;
}
.md h1:first-child,
.md h2:first-child,
.md h3:first-child {
  margin-top: 0;
}
.md p {
  margin: 8px 0;
}
.md ul,
.md ol {
  margin: 8px 0;
  padding-left: 22px;
}
.md li {
  margin: 4px 0;
}
.md strong {
  font-weight: 650;
  color: #fff;
}
.md hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}
.md table {
  width: 100%;
  margin: 12px 0;
  border-collapse: collapse;
  font-size: 13px;
}
.md th,
.md td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.md th {
  background: var(--panel);
  font-weight: 600;
  color: var(--text);
  white-space: normal; /* 表头允许换行：长表头不把表格撑破气泡 */
  overflow-wrap: break-word;
}
.md td {
  color: var(--text-2);
  line-height: 1.6;
  overflow-wrap: break-word;
  word-break: break-word;
}
.md code {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12.5px;
  overflow-wrap: break-word; /* 行内长代码自动换行，不撑破气泡 */
  word-break: break-all;
}
/* 代码块：自动换行（用户诉求），保留代码缩进感；不因长行溢出 */
.md pre {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 12px 0;
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
}
.md pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: inherit;
}
.md img {
  max-width: 100%;
}
.md a {
  overflow-wrap: break-word; /* 长 URL 链接自动换行，不撑破气泡 */
  word-break: break-all;
}
.md blockquote {
  margin: 10px 0;
  padding: 4px 12px;
  border-left: 3px solid var(--accent);
  color: var(--text-2);
}
/* ── 消息区：user 左（品牌色）/ LLM 右（面板色） ──
 * 大厂级处理：头像与昵称是「元信息」用次级色，不抢内容；消息头与气泡间留足呼吸；
 * 气泡大圆角 + 柔和多层阴影；消息出现有轻动效。 */
.msg {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0; /* flex 子项允许收缩：内容的最小宽度不撑破 max-width 气泡 */
  animation: msgIn 0.18s ease-out;
}
@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.msg.user {
  align-self: flex-start;
  align-items: flex-start;
  max-width: min(85%, 640px);
}
.msg.assistant {
  align-self: flex-end;
  align-items: flex-end;
  max-width: min(92%, 860px);
}

/* 消息头：头像 + 昵称（元信息，次级灰，不抢内容） */
.msg-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 0 4px;
}
.msg.assistant .msg-head {
  flex-direction: row-reverse;
}
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}
.avatar.me {
  background: linear-gradient(135deg, var(--accent) 0%, #ff6b81 100%);
  color: #fff;
  box-shadow: 0 2px 10px rgba(254, 44, 85, 0.28);
}
.avatar.llm {
  background: transparent;
  border: none;
  overflow: hidden; /* 配合 border-radius: 50% 把品牌 logo 裁切成圆形 */
  padding: 0;
}
.avatar-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.2px;
}

/* 气泡：大圆角 + 柔和阴影 */
.bubble {
  padding: 13px 16px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.8;
  word-break: break-word;
}
.msg.user .bubble {
  background: linear-gradient(135deg, var(--accent) 0%, #ff4d6d 100%);
  color: #fff;
  border-top-left-radius: 4px;
  box-shadow: 0 4px 14px rgba(254, 44, 85, 0.2);
}
.msg.assistant .bubble {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-top-right-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 8px 24px rgba(0, 0, 0, 0.06);
}
/* 上传文件记录（聊天记录里的文件消息）：与普通文字气泡区分，浅色附件卡片样式 */
.msg.user .bubble.file-upload {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.bubble.file-upload .file-size {
  color: var(--text-3);
}
/* 深度思考（DeepSeek reasoning）：AI 气泡正文上方可折叠区块，默认收起 */
.reasoning-wrap {
  margin-bottom: 8px;
}
.reasoning-head {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.reasoning-head::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.15s;
}
.reasoning-head.open::before {
  transform: rotate(90deg);
}
.reasoning-head:hover {
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.05);
}
.reasoning-body {
  display: none;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
}
.reasoning-body.open {
  display: block;
}
/* 生成中断提示（流式未正常完成的消息） */
.stream-note {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.2);
  color: var(--warn);
  font-size: 12px;
  text-align: center;
}
.msg.system {
  align-self: center;
  max-width: 86%;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  color: var(--text-2);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  text-align: center;
}
/* 省略号：无衬线字体渲染，三点贴基线底部（衬线宋体的 U+2026 是垂直居中字形） */
.ellipsis {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}
.msg.error {
  align-self: center;
  color: var(--err);
  font-size: 13px;
}
.typing {
  align-self: stretch;
  color: var(--text-3);
  font-size: 13px;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.typing .dots {
  display: inline-flex;
  gap: 4px;
}
.typing .dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-3);
  animation: blink 1.2s infinite;
}
.typing .dots i:nth-child(2) {
  animation-delay: 0.2s;
}
.typing .dots i:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 1;
  }
}

/* AI 选项卡 */
.option-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  border-top: 1px solid var(--border-soft);
  padding-top: 14px;
}
.option-btn {
  text-align: left;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.5;
}
.option-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.option-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ── 输入区 ── */
.composer-wrap {
  flex-shrink: 0;
  padding: 12px 24px 18px;
  background: linear-gradient(180deg, transparent, var(--bg) 30%);
}
.composer {
  max-width: 860px;
  margin: 0 auto;
}
.load-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-self: flex-start;
  width: min(100%, 400px);
  padding: 6px 4px 2px;
}
.load-bar.hidden {
  display: none;
}
.load-info {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
}
.load-track {
  height: 2px;
  border-radius: 999px;
  background: var(--border-soft);
  overflow: hidden;
}
.load-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #ff5b77);
  transition: width 0.3s ease;
}

.attach-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
/* 待发送附件区（豆包式：上传≠发送，点发送才随消息一起给大模型） */
.pending-append {
  padding-left: 8px;
  border-left: 1px solid var(--border);
}
.uploaded-files {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.input-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
#inputBox {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14.5px;
  padding: 10px 6px;
  resize: none;
  outline: none;
  max-height: 160px;
  line-height: 1.6;
  font-family: inherit;
}
#inputBox::placeholder {
  color: var(--text-3);
  /* 省略号贴底：placeholder 继承 body 衬线字体时，「…」渲染成居中圆点（视觉不贴底）；
     改用无衬线西文栈渲染省略号（中文 fallback 到系统黑体，保持弱化提示感） */
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.send-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.send-btn:hover {
  background: var(--accent-hover);
}
.send-btn:disabled {
  background: var(--border);
  color: var(--text-3);
  cursor: not-allowed;
}
/* 生成中变「停止」：与发送同款实心容器，仅图标从箭头切方块（ChatGPT 式状态切换，视觉连贯不跳动） */
.send-btn.stop {
  background: var(--accent);
  color: #fff;
}
.send-btn.stop:hover {
  background: var(--accent-hover);
}

#fileInput {
  display: none;
}
.attach-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  border: none;
  flex-shrink: 0;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.attach-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.attach-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ── 会话列表抽屉 ── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.drawer-overlay.hidden {
  display: none;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 330px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
}
.drawer.open {
  transform: translateX(0);
}
.drawer-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.drawer-head .tt {
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
/* 会话数量徽标 */
.session-count {
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 500;
  line-height: 16px;
  text-align: center;
}
.session-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.session-empty {
  padding: 48px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.6;
}
.session-item {
  position: relative;
  padding: 14px 14px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 0.12s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.session-item:hover {
  background: var(--card);
}
.session-item.active {
  background: var(--accent-soft);
}
/* 当前会话：左侧品牌色强调条，列表定位一眼可见 */
.session-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}
.session-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.row-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.session-item .t {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-item.active .t {
  color: var(--accent);
}
.session-item .time {
  flex-shrink: 0;
  font-size: 11.5px;
  color: var(--text-3);
}
.row-material {
  display: flex;
  min-width: 0;
}
.row-material .material {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12.5px;
  color: var(--text-2);
}
.row-material .material.empty {
  color: var(--text-3);
}
/* 第三行元信息：对话轮次 · 素材数量（单行弱化） */
.row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
}
.row-meta .meta + .meta::before {
  content: "·";
  margin-right: 6px;
}
.material::before {
  content: "";
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: url('data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20stroke=%22%23000%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Cpath%20d=%22M14%202H6a2%202%200%200%200-2%202v16a2%202%200%200%200%202%202h12a2%202%200%200%200%202-2V8z%22/%3E%3Cpolyline%20points=%2214%202%2014%208%2020%208%22/%3E%3Cline%20x1=%2216%22%20y1=%2213%22%20x2=%228%22%20y2=%2213%22/%3E%3Cline%20x1=%2216%22%20y1=%2217%22%20x2=%228%22%20y2=%2217%22/%3E%3C/svg%3E') center / contain no-repeat;
  mask: url('data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20stroke=%22%23000%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Cpath%20d=%22M14%202H6a2%202%200%200%200-2%202v16a2%202%200%200%200%202%202h12a2%202%200%200%200%202-2V8z%22/%3E%3Cpolyline%20points=%2214%202%2014%208%2020%208%22/%3E%3Cline%20x1=%2216%22%20y1=%2213%22%20x2=%228%22%20y2=%2213%22/%3E%3Cline%20x1=%2216%22%20y1=%2217%22%20x2=%228%22%20y2=%2217%22/%3E%3C/svg%3E') center / contain no-repeat;
}
.session-del {
  opacity: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.12s;
}
.session-item:hover .session-del {
  opacity: 1;
}
.session-del:hover {
  color: var(--err);
  background: rgba(248, 113, 113, 0.12);
}
/* 会话行内重命名：铅笔 hover 显示，与删除按钮同款弱化入口 */
.session-rename {
  opacity: 0;
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}
.session-item:hover .session-rename {
  opacity: 1;
}
.session-rename:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
/* 重命名输入框：标题行内编辑态 */
.rename-input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 2px 6px;
  outline: none;
}
.drawer .drawer-new {
  margin: 12px 14px;
}
.drawer-new {
  height: 40px;
  border-radius: var(--r-md);
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.drawer-new:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* ── 模态弹窗（删除确认 / 登录） ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
.modal-overlay.hidden {
  display: none;
}
.modal {
  width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 26px;
  box-shadow: var(--shadow);
  animation: popIn 0.18s cubic-bezier(0.32, 0.72, 0, 1);
}
.modal-title {
  font-size: 16px;
  font-weight: 650;
  margin-bottom: 10px;
}
.modal-desc {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.7;
}
.modal-desc .del-name {
  color: var(--text);
  font-weight: 550;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}
.danger-btn {
  height: 36px;
  padding: 0 18px;
  border-radius: var(--r-sm);
  background: #ef4444; /* 标准危险红：常态即明确「可点击的危险操作」（浅红 #f87171 会被误读为禁用态） */
  color: #fff;
  border: none;
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.15s;
}
.danger-btn:hover {
  filter: brightness(1.12); /* 与 primary-btn 同款 hover 手法：增亮即「确认响应」 */
}
.danger-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.modal .primary-btn {
  height: 36px;
  padding: 0 18px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.modal .primary-btn:hover {
  filter: brightness(1.12);
}
.modal .primary-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ── 登录状态与登录弹窗 ── */
.auth-status {
  font-size: 12.5px;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px 3px 3px;
  border-radius: 999px;
  white-space: nowrap;
  transition: background 0.15s;
}
.auth-status.online:hover {
  background: rgba(255, 255, 255, 0.05);
}
.auth-status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
  flex: none;
}
/* 已登录头像：品牌渐变圆 + 首字 */
.auth-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent) 0%, #ff5b77 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}
.auth-status .auth-name {
  color: var(--text);
  font-weight: 550;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 已登录下拉箭头 */
.auth-caret {
  display: inline-flex;
  color: var(--text-2);
  margin-left: 2px;
}
/* 账号下拉菜单（点击头像弹出） */
.account-menu {
  position: fixed;
  min-width: 170px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  z-index: 1100;
  animation: menuIn 0.12s ease-out;
}
@keyframes menuIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.account-menu-info {
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-2);
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-menu-config {
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
}
.account-menu-config:hover {
  background: rgba(232, 234, 240, 0.12);
}
.account-menu-logout {
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--err);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
}
.account-menu-logout:hover {
  background: rgba(248, 113, 113, 0.1);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #333a4a;
}

/* ── 响应式（窄屏适配） ── */
@media (max-width: 720px) {
  .topbar {
    padding: 0 12px;
  }
  .brand-tag {
    display: none;
  }
  .brand-name {
    font-size: 15px;
  }
  .auth-status {
    padding-right: 8px;
  }
  .auth-status .auth-name {
    max-width: 72px;
  }
  .chat-area {
    padding: 20px 14px 14px;
  }
  .composer-wrap {
    padding: 10px 12px 14px;
  }
  .drawer {
    width: 100%;
  }
  .msg.user {
    max-width: 88%;
  }
  .modal {
    width: calc(100vw - 32px);
  }
}

/* ── 消息操作条（复制 / 引用） ── */
.msg-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.msg:hover .msg-actions,
.msg-actions:hover {
  opacity: 1;
}
.msg-action-btn {
  background: none;
  border: none;
  color: #8891a7;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.msg-action-btn:hover {
  color: #e2e6f0;
  background: rgba(255, 255, 255, 0.06);
}
/* 「开始创作」引导卡片：操作条常显（默认操作条 hover 才出现）+ 实心品牌红主按钮 */
.msg-actions.always {
  opacity: 1;
}
.msg-action-btn.start-btn {
  color: #fff;
  background: var(--accent);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 30px;
  border-radius: 10px;
}
.msg-action-btn.start-btn:hover {
  color: #fff;
  background: var(--accent-hover);
}

/* ── 引用条（输入框上方，展示被引用的 AI 内容） ── */
.quote-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: rgba(254, 44, 85, 0.08);
  border: 1px solid rgba(254, 44, 85, 0.22);
  border-radius: 10px;
}
.quote-bar.hidden {
  display: none;
}
.quote-bar-label {
  flex-shrink: 0;
  color: #fe2c55;
  font-size: 12px;
  font-weight: 600;
}
.quote-bar-text {
  flex: 1;
  color: #aab3c7;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quote-bar-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #8891a7;
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
}
.quote-bar-close:hover {
  color: #e2e6f0;
  background: rgba(255, 255, 255, 0.06);
}

/* 登录弹窗输入框：对齐主应用登录页 .field-input 样式。
   关键：无衬线字体（Inter/PingFang SC）→ 密码点渲染正常；
   浅灰底 + 直角 + focus 红色光晕，与主应用登录界面视觉一致。 */
#loginRoot .lm-input {
  height: 44px;
  padding: 0 16px;
  font-size: 14px;
  background: #f0f2f5;
  border: none;
  border-radius: 0;
  font-family: "Inter", "PingFang SC", "Helvetica Neue", sans-serif !important;
  color: #1f2937;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
}
#loginRoot .lm-input:hover {
  background: #eaecf0;
}
#loginRoot .lm-input:focus {
  background: #fff;
  box-shadow: 0 0 0 3px rgba(254, 44, 85, 0.1), 0 0 0 1px rgba(254, 44, 85, 0.2);
}
#loginRoot .lm-input::placeholder {
  color: #9ca3af;
  font-weight: 400;
  font-style: normal;
}

/* ── 用户消息引用块（发送时携带的引用内容） ── */
.quote-block {
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid #fe2c55;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 13px;
  color: #aab3c7;
  white-space: pre-wrap;
}

/* ── 轻提示 toast（复制成功等） ── */
.toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translate(-50%, 8px);
  background: rgba(20, 24, 36, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e6f0;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── 系统错误横幅（独立于聊天消息流，角色=alert） ── */
.error-banner {
  position: fixed;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 560px;
  width: calc(100% - 40px);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(40, 18, 22, 0.96);
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: #fecaca;
  font-size: 13px;
  line-height: 1.6;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 400;
  animation: fadeInDown 0.18s ease;
}
.error-banner.hidden {
  display: none;
}
.error-banner-msg {
  flex: 1;
  word-break: break-word;
}
.error-banner-close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: inherit;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.7;
  padding: 2px 6px;
  border-radius: 6px;
}
.error-banner-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translate(-50%, -6px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
