/* ==========================================================================
   AI快站 — 样式
   ========================================================================== */

:root {
  /* 商务蓝体系：主色负责「可信」，紫色 `--accent-2` 只做 AI 点缀。
     页面底色用极浅灰蓝，不再用大面积浅紫渐变（会让内容发蒙）。 */
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-soft: #fbfcfe;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #94a3b8;
  --accent: #3b82f6;
  --accent-ink: #2563eb;     /* 文字/图标用深一档，小字号也够对比度 */
  --accent-soft: #eff4ff;    /* 极浅蓝底：选中态、标签、hover */
  --accent-2: #2563eb;       /* AI 语义用深一档蓝（紫色已按用户要求去掉） */
  --ok: #059669;
  --warn: #d97706;
  --err: #dc2626;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 6px 24px -8px rgba(15, 23, 42, .14), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 24px 64px -20px rgba(15, 23, 42, .28), 0 2px 6px rgba(15, 23, 42, .06);
  /* 预览画布底：左上一点品牌蓝 + 右下一点 AI 紫，两团都极淡，再叠一层冷调渐晕 ——
     远看仍是白纸，近看有光和色在流动。
     单独抽成变量是因为空状态、生成中、修改中必须是**同一块纸**：以前只有空状态有它，
     一进生成/修改就换成纯白面板，画布像被抽走了。 */
  --canvas-skin:
    radial-gradient(46% 54% at 10% 2%, rgba(147, 197, 253, .30) 0%, rgba(147, 197, 253, 0) 62%),
    radial-gradient(44% 52% at 92% 100%, rgba(196, 181, 253, .26) 0%, rgba(196, 181, 253, 0) 64%),
    radial-gradient(120% 92% at 50% 30%, #fff 0%, #f8fafd 55%, #eef3fa 100%);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d3d7e2; border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b9bece; background-clip: content-box; border: 3px solid transparent; }

.app { display: flex; flex-direction: column; height: 100vh; }

/* ============================ 顶栏 ============================ */

.topbar {
  flex: 0 0 58px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; }
.brand:hover .brand-text strong { color: var(--accent); }
.brand-logo { height: 28px; width: auto; display: block; flex: none; }
.msg-avatar.ai { background: transparent; } /* 头像换成 logo 图片后不再需要紫底 */
.msg-avatar.ai img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; display: block; }
/* 登录用户上传的头像同样填满方块 */
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; display: block; }
.brand-text strong { transition: color .16s; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 14.5px; letter-spacing: -.2px; }
.brand-text em {
  font-style: normal; font-size: 13.5px; font-weight: 500;
  color: var(--text-2); letter-spacing: .01em;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* hidden 属性必须无条件生效：否则 .btn 这类自带 display 的元素
   会把 UA 样式表里的 [hidden]{display:none} 覆盖掉，设了 hidden 还是显示 */
[hidden] { display: none !important; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 13px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px; font-weight: 500;
  white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .08s;
}
.btn svg { width: 15px; height: 15px; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--panel); border-color: var(--line); color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-soft); border-color: var(--line-strong); color: var(--text); }
.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px -4px rgba(59, 130, 246, .55);
}
.btn.primary:hover { box-shadow: 0 6px 20px -4px rgba(59, 130, 246, .7); }
/* 描边的强调按钮：给「就近入口」用（如预览条的发布上线）。
   一屏里已经有一个实心蓝的主按钮时，第二个同样重的按钮会让人停下来比较，
   所以这里用蓝边蓝字表达「可以点」，但不抢顶栏那个的层级。 */
.btn.accent-ghost {
  background: var(--panel);
  border-color: rgba(59, 130, 246, .38);
  color: var(--accent-ink);
}
.btn.accent-ghost:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn:disabled { opacity: .45; pointer-events: none; }

/* ============================ 主体 ============================ */

.main { flex: 1; display: flex; min-height: 0; }

/* ---------- 预览舞台 ---------- */

.stage { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.stage-bar {
  flex: 0 0 46px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.tabs { display: flex; gap: 2px; background: #eff1f6; border-radius: 9px; padding: 3px; }

.stage-title {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 600; color: var(--text-2, #4b5563);
}
.stage-dot {
  width: 7px; height: 7px; border-radius: 99px;
  background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .16);
}
.tab {
  border: 0; background: transparent; color: var(--muted);
  height: 26px; padding: 0 14px; border-radius: 7px;
  font-size: 12.5px; font-weight: 500;
  transition: background .15s, color .15s;
}
.tab:hover { color: var(--text-2); }
.tab.is-active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

.devices { display: flex; gap: 2px; }

.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 0; background: transparent; border-radius: 8px;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: #eff1f6; color: var(--text); }
.icon-btn.is-active { background: var(--accent-soft); color: var(--accent); }
.icon-btn:disabled { opacity: .35; pointer-events: none; }

/* 定位上下文给悬停提示用；z-index 要压过 stage-body 里的提示条（6） */
.stage-bar { position: relative; z-index: 7; }

.stage-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; position: relative; }
/* 舞台顶栏高度只有 46px：这里用紧凑版按钮，文字按钮也不撑高 */
.btn.mini { height: 30px; padding: 0 11px; font-size: 12.5px; gap: 5px; }
.btn.mini svg { width: 14px; height: 14px; }
.site-meta { font-size: 11.5px; color: var(--muted); margin-right: 6px; font-variant-numeric: tabular-nums; }

/* 「改文字」的悬停说明：默认藏着，鼠标移上去 / 键盘聚焦才浮出来。
   按钮被 hidden 或置灰时连同提示一起消失，免得指着一个点不了的东西。 */
.pick-tip {
  position: absolute; top: calc(100% + 9px); right: 0; z-index: 2;
  display: flex; flex-direction: column; gap: 3px;
  width: max-content; max-width: 260px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  font-size: 12px; line-height: 1.55; color: var(--text-2);
  opacity: 0; visibility: hidden; transform: translateY(-3px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
  pointer-events: none;
}
.pick-tip b { font-size: 12.5px; font-weight: 600; color: var(--text); }
#btnPickText:hover + .pick-tip,
#btnPickText:focus-visible + .pick-tip {
  opacity: 1; visibility: visible; transform: translateY(0);
}
#btnPickText[hidden] + .pick-tip,
#btnPickText:disabled + .pick-tip { display: none; }
/* 已经进了选取态就别再挂说明：光标移进预览时，父窗口会保留「鼠标还在按钮上」这个
   旧状态（指针在 iframe 里，事件不再回到本文档），浮层会一直盖在预览上方。
   那时提示条已经在讲同一件事，收起来正好。 */
#btnPickText.is-picking + .pick-tip { display: none; }
@media (prefers-reduced-motion: reduce) { .pick-tip { transition: none; } }

.stage-body { flex: 1; min-height: 0; position: relative; padding: 18px; overflow: auto; }

.frame-shell { position: relative; height: 100%; min-height: 320px; }

.frame-inner {
  height: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin: 0 auto;
  transition: width .3s cubic-bezier(.4, 0, .2, 1), max-width .3s;
  display: flex;
}
.frame-inner[data-device="desktop"] { width: 100%; }
.frame-inner[data-device="tablet"] { width: 834px; max-width: 100%; }
.frame-inner[data-device="mobile"] { width: 390px; max-width: 100%; }

#preview { flex: 1; border: 0; width: 100%; height: 100%; background: #fff; display: block; }
#preview.is-hidden { visibility: hidden; }

/* ---- 点选定位 ---------------------------------------------------------- */
/* 选取态的提示条：浮在预览上沿。整条不吃鼠标事件，只有按钮吃 ——
   否则它会在预览最上面挡住一条，用户想点那里的文字反而点不到。 */
.pick-bar {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  z-index: 6;
  display: flex; align-items: center; gap: 8px;
  max-width: calc(100% - 24px);
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: var(--shadow);
  font-size: 12.5px; color: var(--text-2);
  pointer-events: none;
  animation: pick-in .18s ease-out;
}
.pick-bar > * { pointer-events: none; }
.pick-bar #btnPickCancel { pointer-events: auto; flex: 0 0 auto; height: 26px; padding: 0 10px; }
.pick-dot {
  width: 7px; height: 7px; border-radius: 99px; flex: 0 0 auto;
  background: var(--accent-ink);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .16);
  animation: pick-pulse 1.6s ease-in-out infinite;
}
.pick-kbd {
  flex: 0 0 auto;
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 4px; background: var(--panel-soft);
}
/* 提示条里的文字会被换（点到了没文字的东西时改口），限一下别撑破 */
#pickBarText { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 「然后干什么」这半句一直挂着，别让人点完才发现下一步。
   颜色跟前半句一样（继承 .pick-bar 的 --text-2）—— 之前用 --muted 试过，
   同一行里两个灰度，浅的那半句像被禁用或已失效，读起来像注释。 */
.pick-hint {
  flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: inherit;
}
.pick-hint::before { content: '·'; margin-right: 7px; color: var(--line-strong); }
/* 改口提示（点到了没文字的地方）时，这半句会显得答非所问，先收起来 */
.pick-bar.is-note .pick-hint { display: none; }
/* 选取中：按钮本身设成按下态，回到工作台一眼能看出「现在点的是页面」 */
.btn.is-picking {
  background: var(--accent-soft);
  border-color: var(--accent-ink);
  color: var(--accent-ink);
}
@keyframes pick-in { from { opacity: 0; transform: translate(-50%, -6px); } }
@keyframes pick-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  .pick-bar, .pick-dot { animation: none; }
}

.empty-state {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; text-align: center; padding: 24px;
  /* 画布底见 :root 的 --canvas-skin（生成中 / 修改中用的也是它） */
  background: var(--canvas-skin);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  pointer-events: none;
}
/* 极淡的点阵：只在画面中部透出来，边缘淡出 —— 有质感但不抢内容。
   .gen-progress 也挂这一条：底是同一张，纹理也得跟着一起留住。 */
.empty-state::before,
.gen-progress::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;   /* 跟着容器的圆角走，免得点阵探到框外 */
  background-image: radial-gradient(rgba(37, 63, 111, .12) 1.1px, transparent 1.1px);
  background-size: 20px 20px;
  -webkit-mask-image: radial-gradient(ellipse 78% 74% at 50% 44%, #000 16%, transparent 72%);
  mask-image: radial-gradient(ellipse 78% 74% at 50% 44%, #000 16%, transparent 72%);
  pointer-events: none;
}
/* 内容压在纹理之上 */
.empty-state > * { position: relative; z-index: 1; }
.empty-state h2 { margin: 16px 0 0; font-size: 17px; font-weight: 700; color: var(--text); }
.empty-state p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.8; }
/* 这段是空状态里最该被读到的话（新手第一次进来全靠它），
   所以从 13px 灰字提到 14.5px 深灰，并把关键动作加粗。 */
.empty-lead {
  margin-top: 12px !important;
  font-size: 14.5px !important; color: #3f4d66 !important;
  line-height: 1.9 !important;
  /* 宽屏让它自然排成一行整句（手工断行 + 均衡断行都会在「网/站」中间断开，反而难看）；
     窄屏再靠自然折行。 */
  max-width: 620px;
}
.empty-lead b { color: var(--text); font-weight: 600; }
.empty-lead-2 {
  margin-top: 8px !important;
  font-size: 13.5px !important; color: #64748b !important;
  max-width: 620px;
}
.empty-tip {
  margin-top: 10px !important;
  /* 两行是写死的（<br>），宽度只负责别让它再折一层 */
  max-width: 520px;
  padding: 8px 14px;
  border-radius: 9px;
  background: #f4f6fd;
  border: 1px solid #e7ebf8;
  color: #5b6b9a !important;
  font-size: 12.5px !important;
}
.empty-art { width: 180px; max-width: 60%; }
.empty-art svg { width: 100%; height: auto; }

.gen-badge {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 14px;
  background: rgba(20, 22, 28, .86);
  backdrop-filter: blur(8px);
  color: #fff; font-size: 12.5px;
  border-radius: 99px;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.gen-badge.is-on { opacity: 1; }

.spinner {
  width: 13px; height: 13px; border-radius: 99px;
  border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 代码视图 ---------- */

.code-shell {
  height: 100%; min-height: 320px;
  display: flex; flex-direction: column;
  background: #171922;
  border: 1px solid #23263a;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.code-head {
  flex: none; height: 36px; padding: 0 12px;
  display: flex; align-items: center; justify-content: space-between;
  background: #1d2030; border-bottom: 1px solid #262a3d;
  color: #8b93ad; font-size: 12px; font-family: var(--mono);
}
.code-pre {
  flex: 1; margin: 0; padding: 14px 16px;
  overflow: auto;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.65;
  color: #d8dced; white-space: pre; tab-size: 2;
}
.code-pre code { display: block; }

.mini-btn {
  height: 26px; padding: 0 10px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 7px; font-size: 12px; color: var(--text-2);
  transition: background .15s, border-color .15s;
}
.mini-btn:hover { background: var(--panel-soft); border-color: var(--line-strong); }
.code-head .mini-btn { background: #262a3d; border-color: #313650; color: #b8bfd6; }
.code-head .mini-btn:hover { background: #2e3350; color: #fff; }
.mini-btn:disabled { opacity: .45; pointer-events: none; }

/* ---------- 对话面板 ---------- */

.chat {
  /* 对话栏宽度按屏宽浮动：小屏不至于挤掉预览，大屏也不会无限变宽。
     min-width:0 让 flex 真的能压到 340（默认 min-width:auto 会被内容顶住）。 */
  flex: 0 0 clamp(340px, 26vw, 420px);
  min-width: 0;
  position: relative;
  display: flex; flex-direction: column;
  /* 对话区不再用纯白：给一层极淡的冷调渐变，让白色气泡与输入框能「浮」起来；
     和左侧预览画布同一色系，两块看起来是一整套 */
  background:
    radial-gradient(130% 46% at 50% 0%, rgba(255, 255, 255, .96) 0%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, #f7f9fd 0%, #f5f8fd 55%, #eff4fb 100%);
  border-left: 1px solid var(--line);
  min-height: 0;
}

.chat-head {
  flex: none; padding: 14px 16px 12px;
  background: var(--panel);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  border-bottom: 1px solid var(--line);
}
.chat-head-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chat-head-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.chat-logo { height: 24px; width: auto; display: block; flex: none; }
.chat-head-text strong { font-size: 13.5px; }
.chat-head-text span { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }

.msg { display: flex; gap: 9px; max-width: 100%; animation: rise .28s cubic-bezier(.3, 0, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.msg-avatar {
  flex: none; width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  background: #eff1f6; color: var(--muted);
}
.msg-avatar.ai { background: var(--accent-2); color: #fff; } /* AI 头像：深蓝，与用户灰头像区分 */
.msg-avatar.user { background: var(--accent-ink); color: #fff; }
/* 未登录访客：头像用一个小人图标，弱化处理，别抢蓝底方块的分量 */
.msg-avatar.user.is-anon { background: #eef1f6; color: #94a3b8; }
.msg-avatar.user.is-anon svg { width: 15px; height: 15px; }
.msg-avatar svg { width: 14px; height: 14px; }

.msg-body { min-width: 0; flex: 1; padding-top: 3px; }
.msg-who { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.msg-text {
  font-size: 13px; line-height: 1.72; color: var(--text-2);
  word-break: break-word; white-space: pre-wrap;
}
.msg.user .msg-text {
  background: #e6eeff; color: #1e40af;
  border: 1px solid #d3e2ff;
  padding: 9px 12px; border-radius: 10px 10px 10px 3px;
  display: inline-block;
}
.msg.error .msg-text {
  background: #fef2f2; color: #991b1b;
  padding: 9px 12px; border-radius: 10px; font-size: 12.5px;
}
/* 报错也保留 AI 的 logo 头像，红圈只表示「这条是报错」，不要把头像换成感叹号 */
.msg-avatar.ai.is-error { box-shadow: 0 0 0 2px #fecaca; }
/* 「额度用完」这类温和提醒：不用红色错误样式，跟正常回复同一套观感 */
.msg-quiet { color: var(--text-2); }
/* 额度用完的提示里跟一个动作按钮（例如匿名 → 登录） */
.msg-cta { margin-top: 12px; }
/* 首次生成完指路用：让预览条那个「发布上线」轻轻亮两下，视线跟过去就找到位置了。
   一次性动画（JS 在 animationend 里摘掉这个类），不做常驻闪烁 —— 常闪等于没闪。 */
@keyframes hint-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); background: var(--panel); }
  45%      { box-shadow: 0 0 0 5px rgba(59, 130, 246, .16); background: var(--accent-soft); }
}
.btn.is-hint { animation: hint-ring 1.15s ease-in-out 2; }
@media (prefers-reduced-motion: reduce) { .btn.is-hint { animation: none; } }

.msg-card {
  margin-top: 8px; padding: 10px 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px; color: var(--text-2);
}
.msg-card b { color: var(--text); font-weight: 600; }

.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 5px; height: 5px; border-radius: 99px; background: var(--muted); animation: blink 1.3s infinite; }
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

.chips { flex: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; overflow: hidden; }
.chips:empty { display: none; }
.chip {
  height: 27px; padding: 0 11px;
  background: var(--panel-soft); border: 1px solid var(--line);
  border-radius: 99px; font-size: 12px; color: var(--text-2);
  transition: all .15s;
  /* 短胶囊，宽度跟着文字走；一行放不下就省略号，完整内容靠 title 悬停提示 */
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------------------- 素材上传 ---------------------- */

.attach-tray {
  flex: none;
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 0 16px 10px;
}
.attach-chip {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  max-width: 218px;
  padding: 6px 26px 6px 6px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  box-shadow: var(--shadow-sm);
}
.attach-chip > img {
  width: 34px; height: 34px;
  flex: none;
  object-fit: cover;
  border-radius: 7px;
  background: var(--panel-soft);
}
.attach-ext {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--accent-soft); color: var(--accent-ink);
  font-size: 10px; font-weight: 700; letter-spacing: .02em;
}
.attach-meta { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.attach-name {
  font-size: 12px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.attach-sub { font-size: 10.5px; font-style: normal; color: var(--muted); }
.attach-del {
  position: absolute; top: 4px; right: 4px;
  width: 17px; height: 17px; padding: 0;
  display: grid; place-items: center;
  border: 0; border-radius: 99px;
  background: #eceef4; color: var(--text-2);
  font-size: 13px; line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.attach-del:hover { background: #fde8e8; color: var(--err); }

.attach-btn {
  flex: none;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s;
}
.attach-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.attach-btn:active { transform: scale(.94); }
.attach-btn svg { width: 16px; height: 16px; }

.chat.is-dropping::after {
  content: "松开即可添加素材";
  position: absolute; inset: 10px;
  display: grid; place-items: center;
  border: 2px dashed var(--accent);
  border-radius: 12px;
  background: rgba(59, 130, 246, .06);
  color: var(--accent);
  font-size: 13px; font-weight: 600;
  pointer-events: none;
  z-index: 6;
}

/* 对话气泡里的素材缩略图 */
.msg-attach { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.msg-attach img {
  width: 74px; height: 74px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.msg-file {
  display: inline-flex; align-items: center;
  padding: 5px 9px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11.5px; color: var(--text-2);
  max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.composer {
  flex: none; margin: 0 16px;
  display: flex; align-items: flex-end; gap: 8px;
  background: #fff;
  border: 1px solid var(--line-strong);
  box-shadow: 0 2px 10px -6px rgba(15, 23, 42, .18);
  border-radius: 12px;
  padding: 8px 8px 8px 12px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3.5px rgba(59, 130, 246, .12); background: #fff; }
.composer textarea {
  flex: 1; border: 0; outline: 0; background: transparent; resize: none;
  font-size: 13.5px; line-height: 1.6; max-height: 132px; min-height: 22px;
  padding: 5px 0;
}
.composer textarea::placeholder { color: #a4a9b7; }

.send-btn {
  flex: none; width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 0; border-radius: 9px;
  /* 发送钮用主色实心蓝：AI 不再用紫色，靠形状和位置区分 */
  background: var(--accent);
  color: #fff;
  box-shadow: 0 3px 10px -3px rgba(59, 130, 246, .6);
  transition: opacity .15s, transform .1s;
}
.send-btn svg { width: 16px; height: 16px; }
.send-btn:active { transform: scale(.94); }
.send-btn:disabled { opacity: .35; box-shadow: none; }
.send-btn.is-stop { background: #ef4444; box-shadow: none; }
.send-btn.is-stop svg { display: none; }
.send-btn.is-stop::after { content: ""; width: 10px; height: 10px; background: #fff; border-radius: 2px; }

.composer-hint { flex: none; text-align: center; font-size: 11px; color: #a4a9b7; padding: 7px 16px 12px; }
kbd {
  font-family: var(--font); font-size: 10.5px; padding: 1px 4px;
  background: #eff1f6; border-radius: 4px; color: var(--muted);
}

/* ============================ 弹窗 ============================ */

.overlay {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(20, 22, 28, .42);
  backdrop-filter: blur(3px);
  animation: fade .18s;
}
@keyframes fade { from { opacity: 0; } }
.overlay[hidden] { display: none; }

.modal {
  width: 100%; max-width: 540px; max-height: 90vh;
  display: flex; flex-direction: column;
  background: var(--panel);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop .22s cubic-bezier(.3, 1.2, .5, 1);
}
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.modal-head {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }

.modal-body { flex: 1; overflow-y: auto; padding: 4px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.modal-foot {
  flex: none; display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--line); background: var(--panel-soft);
}

.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 12.5px; font-weight: 500; color: var(--text-2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.label-note { font-size: 11px; color: var(--muted); font-weight: 400; }

.field input[type="text"] {
  height: 38px; padding: 0 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: 0;
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3.5px rgba(59, 130, 246, .12); background: #fff; }

.input-row { display: flex; gap: 8px; align-items: center; }
.input-row input { flex: 1; }

.pub-block {
  padding: 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel-soft);
  display: flex; flex-direction: column; gap: 8px;
}
.pub-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.pub-tag {
  font-size: 10.5px; padding: 2px 7px; border-radius: 99px;
  background: var(--accent); color: #fff; font-weight: 500;
}
.pub-desc { margin: 0; font-size: 12px; line-height: 1.7; color: var(--muted); }
.pub-desc code { font-family: var(--mono); font-size: 11.5px; background: #fff; border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }
.btn-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pub-note { font-size: 11px; color: var(--muted); line-height: 1.5; }
.pub-note.is-warn { color: var(--warn); }

/* ============================ Toast ============================ */

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 200;
  padding: 10px 18px;
  background: rgba(20, 22, 28, .92);
  color: #fff; font-size: 13px;
  border-radius: 99px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s cubic-bezier(.3, 1.2, .5, 1);
}
.toast[hidden] { display: none; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ============================ 改动待确认提示条 ============================ */
/*
   已上线的网站被改过、但还没确认替换时出现。
   放在顶栏下面、占满整行：这是「你以为改了其实线上没变」这类误解的唯一防线，
   不做得显眼就没有意义。
*/
.pending-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  background: linear-gradient(90deg, #fff8ea, #fffdf8);
  border-bottom: 1px solid #f2e2c0;
  font-size: 12.5px;
  color: #8a5a12;
  animation: pendingIn .22s ease;
}
.pending-bar[hidden] { display: none; }
@keyframes pendingIn { from { opacity: 0; transform: translateY(-4px); } }

.pending-dot {
  flex: none; width: 8px; height: 8px; border-radius: 50%;
  background: #f0a020;
  box-shadow: 0 0 0 3px rgba(240, 160, 32, .18);
}
.pending-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; min-width: 0; }
.pending-text b { font-weight: 600; color: #955f0c; }
.pending-text span { color: #9a7433; }
.pending-acts { display: flex; gap: 6px; margin-left: auto; flex: none; }

.pending-btn {
  height: 26px; padding: 0 11px;
  border-radius: 8px;
  border: 1px solid #f0dcb4;
  background: #fff;
  color: #8a5a12;
  font-size: 12px; font-weight: 500;
  transition: background .15s, border-color .15s;
}
.pending-btn:hover { background: #fffaf0; border-color: #e6cc9a; }
.pending-btn.primary {
  background: linear-gradient(135deg, #f0a020, #e8890c);
  border-color: transparent; color: #fff;
  box-shadow: 0 3px 10px -3px rgba(232, 137, 12, .6);
}
.pending-btn.primary:hover { box-shadow: 0 5px 16px -3px rgba(232, 137, 12, .7); }

@media (max-width: 860px) {
  .pending-bar { flex-wrap: wrap; }
  .pending-acts { margin-left: 0; width: 100%; }
}

.hidden { display: none !important; }

/* ============================ 响应式 ============================ */

@media (max-width: 1080px) {
  .topbar-mid { display: none; }
}

@media (max-width: 860px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100vh; }
  .main { flex-direction: column; }
  .stage { height: 62vh; flex: none; }
  .chat { flex: none; border-left: 0; border-top: 1px solid var(--line); height: auto; }
  .chat-list { max-height: 300px; }
  .brand-text em { display: none; }
  .stage-body { padding: 12px; }
  .frame-inner[data-device="desktop"] { width: 100%; }
}

/* ============================ 生成进度 ============================ */

.gen-progress {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 跟空状态同一张画布底：生成 / 修改期间只是「纸上多了一块进度」，
     不再换成一整块纯白 —— 那是用户眼里「背景没了」的那一刻。 */
  background: var(--canvas-skin);
  /* 第三层色标本身不透明；这行只是兜底：万一哪天末色被改浅，面板底下是
     iframe 的白，也不至于透出脏色。 */
  background-color: #f8fafd;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.gen-progress[hidden] { display: none; }
/* 纹理见上面 .empty-state::before 的共用规则；进度面板本身压在纹理之上 */
.gen-progress > * { position: relative; z-index: 1; }

/* --- 实时进度：进度条 + 阶段 + 已产出文件 + 剩余时间 --- */

.gen-live {
  width: min(430px, 82%);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.gen-live[hidden] { display: none; }

.gl-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.gl-title {
  font-size: 17px;
  font-weight: 600;
  color: #2b3140;
  letter-spacing: .01em;
}
.gl-pct {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.gl-track {
  height: 7px;
  border-radius: 99px;
  background: #eceef5;
  overflow: hidden;
}
.gl-fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  /* 生成进度条：同色系由深到浅，全站不再出现紫色 */
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  transition: width .45s cubic-bezier(.22, .61, .36, 1);
}

/* 闲聊轮：面板上不出现百分比。
   「回答到 37% 了」对用户没有意义，反而让人以为要等一个网站产出；
   条本身退化成不确定态，只表示「还在处理，没卡」。 */
.gen-live.is-chat .gl-pct { display: none; }
.gen-live.is-chat .gl-fill {
  width: 32%;
  transition: none;
  animation: glChatSweep 1.9s cubic-bezier(.45, .05, .55, .95) infinite;
}
@keyframes glChatSweep {
  0%   { transform: translateX(-110%); opacity: 0; }
  18%  { opacity: 1; }
  82%  { opacity: 1; }
  100% { transform: translateX(320%); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .gen-live.is-chat .gl-fill {
    animation: none;
    width: 100%;
    opacity: .5;
  }
}

.gl-stage {
  font-size: 13.5px;
  color: #5b6472;
  line-height: 1.6;
  min-height: 22px;
}

/* 滚动的代码行：截真实输出的尾巴展示，配一个闪烁光标，像正在敲代码 */
.gl-code {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.7;
  color: #76829f;
  background: #f3f5fc;
  border: 1px solid #e4e8f6;
  border-radius: 6px;
  padding: 4px 9px;
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: .2px;
}
.gl-code[hidden] { display: none; }
.gl-code::after {
  content: '▌';
  margin-left: 1px;
  color: #3b82f6;
  animation: gl-blink 1s steps(1) infinite;
}
@keyframes gl-blink { 50% { opacity: 0; } }

/* 已完成的步骤：保留在面板上、灰化，让用户看到进度是真的一步步走上来的 */
.gl-steps {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: -2px 0 0;
}
.gl-steps[hidden] { display: none; }
.gl-done {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #98a1b0;
  animation: gl-pop .26s ease-out;
}
.gl-tick {
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #dde2ec;
  border-radius: 50%;
  background: #f7f8fb;
  color: #a8b1c0;
  font-size: 9px;
  font-weight: 700;
}
.gl-done-text { min-width: 0; word-break: break-word; }

/* 当前这一步：蓝点 + 正常字色，和上面灰掉的已完成步骤形成对照 */
.gl-stage {
  position: relative;
  padding-left: 24px;
}
.gl-stage::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .14);
  animation: gl-breathe 1.6s ease-in-out infinite;
}
@keyframes gl-breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: .42; }
}

.gl-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
  border-top: 1px dashed #e8eaf2;
  margin-top: 2px;
  padding-top: 12px;
}
.gl-eta {
  font-size: 12.5px;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
}
.gl-hint {
  font-size: 12px;
  color: #9aa1b0;
  text-align: right;
}

@keyframes gl-pop {
  from { opacity: 0; transform: translateY(3px) scale(.96); }
  to { opacity: 1; transform: none; }
}

/* 后续修改：一个圆圈加载图标 + 文案 */
.gen-modify {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.gen-modify[hidden] { display: none; }
.ring-svg {
  width: 48px;
  height: 48px;
  animation: spin .9s linear infinite;
}
.gen-modify-text {
  font-size: 15px;
  font-weight: 500;
  color: #5b6472;
  letter-spacing: .02em;
}

.gen-steps {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 40px 24px;
}
.gen-steps[hidden] { display: none; }

.gp-item {
  display: flex;
  align-items: center;
  gap: 18px;
}

.gp-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eef0f5;
  color: #b8bdc9;
  transition: background .35s, color .35s;
  flex: none;
}
.gp-icon svg { width: 21px; height: 21px; }
.gp-icon .gp-t { font: 700 20px/1 Georgia, "Times New Roman", serif; }

.gp-label {
  font-size: 16.5px;
  color: #b8bdc9;
  transition: color .35s;
  letter-spacing: .01em;
}

/* 进行中 */
.gp-item.is-active .gp-icon {
  background: #e4eeff;
  color: #4f7df9;
  animation: gp-pulse 1.4s ease-in-out infinite;
}
.gp-item.is-active .gp-label { color: #4b5563; }

/* 已完成 */
.gp-item.is-done .gp-icon {
  background: #e2f6e9;
  color: #23a55a;
  animation: none;
}
.gp-item.is-done .gp-label { color: #27a35c; }

@keyframes gp-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@media (max-width: 860px) {
  .gen-steps { gap: 18px; padding: 24px 12px; }
  .gp-icon { width: 38px; height: 38px; }
  .gp-label { font-size: 14.5px; }
}
