/* =========================================================
   Seedance Studio · 方向 A·深色创作台
   即梦 App 风:深色画布 + 底部居中浮起创作栏 + 上方画廊
   单一 accent 紫 / 4 档圆角 / 400·600·700 三档字重
   ========================================================= */

:root {
  /* ---- 深色调色板 ---- */
  --bg:        #0E0F13;   /* 画布底 */
  --bg-2:      #121319;   /* 次级底(顶栏/dock 渐隐) */
  --surface:   #181A22;   /* 卡片面 */
  --surface-2: #1F2230;   /* 控件面 / 抬升面 */
  --surface-3: #262A39;   /* hover 面 */
  --ink:       #F1F2F6;   /* 主文字 */
  --ink-2:     #C7CAD4;   /* 次文字 */
  --muted:     #8A8F9C;   /* 弱文字 */
  --faint:     #5C616E;   /* 极弱 / 占位 */
  --line:      rgba(255, 255, 255, 0.08);   /* 描边 */
  --line-2:    rgba(255, 255, 255, 0.14);   /* 强描边 */

  /* ---- 单一强调色(紫) ---- */
  --accent:        #7B61FF;
  --accent-press:  #6A4FF0;
  --accent-soft:   rgba(123, 97, 255, 0.16);  /* 浅 accent 底 */
  --accent-softer: rgba(123, 97, 255, 0.10);
  --accent-ring:   rgba(123, 97, 255, 0.28);  /* focus 光圈 */
  --accent-ink:    #C9BEFF;                    /* accent 上的文字 */

  /* ---- 语义色(克制) ---- */
  --danger:      #E5484D;
  --danger-soft: rgba(229, 72, 77, 0.14);
  --ok:          #2BD9A8;

  /* ---- 圆角(4 档) ---- */
  --r-card: 20px;   /* 主创作卡 / 结果卡 */
  --r-media: 16px;  /* 视频 / 缩略图 / 上传区 */
  --r-ctrl: 11px;   /* 按钮 / select / textarea / details */
  --r-pill: 999px;  /* 胶囊 */

  /* ---- 字体栈 ---- */
  --font: "Inter", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei",
          system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Consolas", "Menlo", monospace;

  /* ---- dock 高度变量(给 gallery 留底部空间) ---- */
  --dock-reserve: 320px;
}

* { box-sizing: border-box; }

/* app.js 给 #apiKeyField 等设 hidden 时必须真隐藏,否则留塌陷 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  /* 顶部柔光,营造创作台纵深;克制,不喧宾 */
  background:
    radial-gradient(1200px 520px at 50% -8%, rgba(123, 97, 255, 0.10), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

::selection { background: var(--accent-soft); color: #fff; }

textarea, input, select, button { font-family: inherit; }

/* 滚动条(深色细) */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* =========================================================
   外壳:单列居中 · 上下大留白 · dock 底部预留
   ========================================================= */
.app {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* =========================================================
   ① 极薄顶栏:透明、无边框无阴影,scroll 不抢戏
   ========================================================= */
.topbar {
  position: relative;
  z-index: 30;
  flex: none;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(to bottom, var(--bg) 55%, transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0;
  flex: none;
}
.brand-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.brand-dim { color: var(--muted); font-weight: 400; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ---- 设置弹层(details):鉴权收纳 ---- */
.settings-pop { position: relative; }
.settings-pop > summary { list-style: none; cursor: pointer; }
.settings-pop > summary::-webkit-details-marker { display: none; }

.settings-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  user-select: none;
  transition: background .15s, border-color .15s, color .15s;
}
.settings-trigger:hover { background: var(--surface-3); border-color: var(--line-2); color: var(--ink); }
.settings-pop[open] .settings-trigger { background: var(--surface-3); border-color: var(--line-2); color: var(--ink); }
.gear-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.settings-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-card);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  padding: 18px;
  z-index: 40;
}
.settings-panel-title { margin: 0 0 14px; font-size: 14px; font-weight: 700; color: var(--ink); }

/* =========================================================
   通用表单原子(用于设置弹层 / 更多素材抽屉 / 高级 JSON)
   ========================================================= */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field-tip, .field-hint { font-size: 11px; color: var(--faint); font-weight: 400; }

input[type="password"],
input[type="text"],
input[type="number"],
.field textarea,
.advanced textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-ctrl);
  color: var(--ink);
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field textarea, .advanced textarea {
  resize: vertical;
  min-height: 56px;
  line-height: 1.6;
  font-family: var(--mono);
  font-size: 12px;
}
input[type="password"]:focus,
input[type="text"]:focus,
input[type="number"]:focus,
.field textarea:focus,
.advanced textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
  background: var(--surface);
}
input::placeholder, textarea::placeholder { color: var(--faint); }

/* 文件输入(精简深色) */
input[type="file"] {
  width: 100%;
  font-size: 12px;
  color: var(--ink-2);
}
input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 7px 12px;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
input[type="file"]::file-selector-button:hover { background: var(--surface-3); border-color: var(--line-2); color: var(--ink); }

/* checkbox(强调态填 accent) */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 17px; height: 17px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--surface-2);
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  flex: none;
  transition: background .15s, border-color .15s;
}
input[type="checkbox"]::after {
  content: "";
  width: 9px; height: 9px;
  transform: scale(0);
  transition: transform .12s;
  background: #fff;
  clip-path: polygon(14% 44%, 0 65%, 43% 100%, 100% 16%, 84% 0, 39% 70%);
}
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::after { transform: scale(1); }
input[type="checkbox"]:focus-visible { box-shadow: 0 0 0 3px var(--accent-ring); }

.check-line { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-2); margin-bottom: 14px; cursor: pointer; }

/* =========================================================
   ② 模式 Tab 行:文字 tab + accent 下划线(非实心 pill)
   ========================================================= */
.mode-tabs {
  display: flex;
  flex: none;
  gap: 26px;
  padding: 6px 2px 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.mode-tab {
  position: relative;
  background: none;
  border: none;
  padding: 6px 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s;
}
.mode-tab:hover { color: var(--ink-2); }
.mode-tab.is-active { color: var(--ink); }
.mode-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -23px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* =========================================================
   ④ 画廊 / 结果区(创作栏【上方】,默认弱化占位)
   ========================================================= */
.gallery { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-bottom: 16px; display: flex; flex-direction: column; }

.result-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 18px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.result-head-main { display: flex; align-items: baseline; gap: 12px; min-width: 0; flex-wrap: wrap; }
.result-status { font-size: 20px; font-weight: 700; color: var(--ink); }
.result-taskid { font-family: var(--mono); font-size: 12px; color: var(--muted); word-break: break-all; }
.result-head-actions { display: flex; gap: 8px; flex: none; }

/* 状态机色:轮询/失败时由 app.js 改 statusText 文本;此处给容器留色钩子 */
.result-card.is-running .result-status { color: var(--accent-ink); }
.result-card.is-error  .result-status,
.result-status.is-error { color: var(--danger); }

/* 视频舞台:未出片时占位 */
.result-stage {
  position: relative;
  border-radius: var(--r-media);
  background: #0A0B0F;
  border: 1px solid var(--line);
  overflow: hidden;
  flex: 1;
  min-height: 200px;
  display: grid;
  place-items: center;
}
#videoPlayer {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--r-media);
  background: #000;
}
/* 无 src 时隐藏 video、露占位;有 src(app.js 设 .src)后 video 撑开、占位让位 */
#videoPlayer:not([src]) { display: none; }
.result-placeholder {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--faint);
  font-size: 14px;
  padding: 60px 20px;
}
#videoPlayer[src] ~ .result-placeholder { display: none; }

/* 放大观看(影院模式) */
.theater {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(5, 6, 9, 0.94);
  display: grid;
  place-items: center;
  padding: 20px;
}
.theater-stage {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}
.theater #videoPlayer,
.theater video {
  width: auto;
  height: auto;
  max-width: 96vw;
  max-height: 94vh;
  border-radius: 10px;
  background: #000;
}
.theater-close {
  position: fixed;
  top: 16px;
  right: 20px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.theater-close:hover { background: var(--surface-3); border-color: var(--accent); }
.ph-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--line-2);
}
.result-card.is-running .ph-dot {
  background: var(--accent);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--accent-ring); }
  50%      { opacity: .55; box-shadow: 0 0 0 6px transparent; }
}

.result-actions { display: flex; gap: 10px; margin-top: 16px; }

/* 运行日志:默认折叠的调试件 */
.log-drawer { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.log-drawer > summary {
  list-style: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  user-select: none;
}
.log-drawer > summary::-webkit-details-marker { display: none; }
.log-drawer > summary::before {
  content: "›";
  display: inline-block;
  transition: transform .15s;
  font-size: 15px;
  color: var(--faint);
}
.log-drawer[open] > summary::before { transform: rotate(90deg); }
#logBox {
  margin: 12px 0 0;
  background: #08090C;
  border: 1px solid var(--line);
  border-radius: var(--r-ctrl);
  color: #B7E4C7;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  padding: 12px 14px;
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* =========================================================
   ③ 主创作栏 composer-dock:底部居中浮起
   ========================================================= */
.composer-dock {
  flex: none;
  padding-top: 10px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}

.composer {
  position: relative;
  max-height: 42vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-card);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 2px 0 rgba(255,255,255,0.02) inset;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color .18s, box-shadow .18s;
}
/* prompt focus 时整卡描边转 accent + 光圈 */
.composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 0 0 3px var(--accent-ring);
}

/* (a) Prompt 主体:绝对主角,无内描边 */
.composer-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.7;
  resize: none;
  min-height: 88px;
  max-height: 220px;
  padding: 2px 2px 0;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: text;
}
.composer-input::placeholder { color: var(--faint); }
/* 富文本空态占位 */
.composer-input.is-empty::before {
  content: attr(data-placeholder);
  color: var(--faint);
  pointer-events: none;
}
/* 提示词一键展开放大(长提示词不用滚轮) */
.prompt-max-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: color .14s, border-color .14s, background .14s;
}
.prompt-max-btn:hover { color: var(--ink); border-color: var(--line-2); background: var(--surface-3); }
.composer-input.is-expanded { min-height: 46vh; max-height: 64vh; }
.composer.prompt-open { max-height: 84vh !important; }
/* 出片后:压缩创作栏,把竖向空间让给视频(看片时视频更大) */
.app.has-result .composer { max-height: 30vh; }
/* 内联引用芯片:富文本里 @ 出来的图文小芯片(整体一个原子) */
.ref-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
  height: 26px;
  padding: 0 10px 0 4px;
  margin: 0 2px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  user-select: none;
}
.ref-inline img {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  object-fit: cover;
  flex: none;
}
.ref-inline .ref-ico { font-size: 13px; line-height: 1; padding-left: 4px; }
.ref-inline .ref-tag { line-height: 1; }

/* (b) referenceChips:紧贴 prompt 的可点 @标签行 */
.reference-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  min-height: 52px;
  scrollbar-width: none;
}
.reference-chips::-webkit-scrollbar { display: none; }
.chips-placeholder { font-size: 13px; color: var(--faint); white-space: nowrap; }

/* 参考素材缩略卡片(点击插入到 Prompt) */
.ref-card {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 12px 0 5px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  cursor: pointer;
  font: inherit;
  transition: border-color .14s, background .14s, transform .08s;
}
.ref-card:hover { border-color: var(--accent-ring); background: var(--surface-3); }
.ref-card:active { transform: scale(0.97); }
.ref-card img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  flex: none;
}
.ref-card-ico {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  font-size: 17px;
  flex: none;
}
.ref-card-tag { font-size: 13px; font-weight: 700; color: var(--accent-ink); white-space: nowrap; }

/* .mention-chip:app.js 注入的可点击 @标签(浅 accent 胶囊) */
.mention-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 29px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background .14s, border-color .14s, transform .08s;
}
.mention-chip:hover { background: rgba(123, 97, 255, 0.26); }
.mention-chip:active { transform: scale(0.96); }
.mention-chip.is-error {
  background: var(--danger-soft);
  border-color: rgba(229, 72, 77, 0.4);
  color: #F2999B;
}

/* @ 直接引用弹层:Prompt 内打 @ 弹出可选素材(JS 注入 .mention-pop 到 body) */
.mention-pop {
  position: fixed;
  z-index: 60;
  min-width: 200px;
  max-height: 264px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctrl);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mention-pop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--ink-2);
  font: inherit;
}
.mention-pop-item:hover,
.mention-pop-item.is-active { background: var(--accent-soft); color: var(--accent-ink); }
.mention-pop-item .mp-tag { font-weight: 700; color: var(--accent-ink); white-space: nowrap; flex: none; }
.mention-pop-item .mp-meta {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mention-pop-item.is-active .mp-meta { color: var(--accent-ink); opacity: .85; }
.mp-thumb {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  font-size: 14px;
  overflow: hidden;
}
.mp-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* (c) 素材行:加图卡 + 缩略图 + 更多素材抽屉 */
.material-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex-wrap: wrap;
}

/* 拖拽区(app.js 钩子:.upload-drop[data-input=imageFiles]) */
.upload-drop {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  cursor: pointer;
}

/* 缩略图舞台(app.js 钩子:.image-stage,内含 #imagePreviewStage) */
.image-stage {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 76px;
  padding: 8px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-media);
  background: var(--surface-2);
  transition: border-color .15s, background .15s;
  scrollbar-width: thin;
}
.upload-drop:hover .image-stage { border-color: var(--accent-ring); background: var(--surface-3); }

/* 拖拽态高亮(app.js 增删 .is-dragging) */
.upload-drop.is-dragging .image-stage,
.image-stage.is-dragging {
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent-softer);
  box-shadow: 0 0 0 3px var(--accent-ring) inset;
}
/* 错误态(app.js 增删 .is-error) */
.upload-drop.is-error .image-stage,
.image-stage.is-error {
  border-color: var(--danger);
  background: var(--danger-soft);
}

/* 空态占位(app.js:.empty-state) */
.empty-state {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0 6px;
  color: var(--muted);
  pointer-events: none;
}
.add-plus {
  width: 30px; height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  flex: none;
}
.add-text { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }

/* 预览卡(app.js 注入:.preview-card),含其内 img / 删除钮 / 角标 */
.preview-card {
  position: relative;
  flex: none;
  width: 60px;
  height: 60px;
  border-radius: 12px;
  overflow: hidden;
  background: #0A0B0F;
  border: 1px solid var(--line-2);
  cursor: pointer;
  transition: border-color .14s, box-shadow .14s, transform .08s;
}
.preview-card:hover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring); }
.preview-card:active { transform: scale(0.96); }

/* "+"再加一张图块 */
.add-more-tile {
  flex: none;
  width: 60px;
  height: 60px;
  border-radius: 12px;
  border: 1px dashed var(--line-2);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 26px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color .14s, color .14s, background .14s;
}
.add-more-tile:hover { border-color: var(--accent); color: var(--ink-2); background: var(--surface-3); }
.preview-card img,
.preview-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.preview-card.is-error { border-color: var(--danger); box-shadow: 0 0 0 2px var(--danger-soft); }
/* app.js 常见的删除按钮/角标兜底样式 */
.preview-card button {
  position: absolute;
  top: 3px; right: 3px;
  width: 18px; height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(8, 9, 12, 0.78);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.preview-card button:hover { background: var(--danger); }
.preview-card .badge,
.preview-card figcaption,
.preview-card .preview-tag {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(to top, rgba(8,9,12,0.85), transparent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 8px 5px 3px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 更多素材抽屉 */
.more-assets { flex: none; align-self: stretch; position: relative; }
.more-assets > summary { list-style: none; cursor: pointer; height: 100%; }
.more-assets > summary::-webkit-details-marker { display: none; }
.more-summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 76px;
  height: 100%;
  min-height: 76px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-media);
  background: var(--surface-2);
  color: var(--muted);
  user-select: none;
  transition: background .15s, border-color .15s, color .15s;
}
.more-assets:hover .more-summary,
.more-assets[open] .more-summary { background: var(--surface-3); border-color: var(--line-2); color: var(--ink-2); }
.more-plus { font-size: 18px; line-height: 1; font-weight: 400; }
.more-label { font-size: 11px; font-weight: 600; }

/* 抽屉就地展开成整行(嫁接 B 方向):打开时占满创作栏宽度、向下展开,
   不再用向上弹出的绝对定位浮层 —— 矮屏不再顶出视口 */
.more-assets[open] { flex: 1 1 100%; }
.more-assets[open] .more-summary {
  width: 100%;
  height: auto;
  min-height: 40px;
  flex-direction: row;
  gap: 8px;
  justify-content: flex-start;
  padding: 0 12px;
}
.more-panel {
  width: 100%;
  margin-top: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-ctrl);
  padding: 14px;
}
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.more-grid .field { margin-bottom: 14px; }

/* 素材清单 + 计数 */
.asset-summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 16px;
}
.asset-count { font-size: 12px; font-weight: 600; color: var(--muted); flex: none; }
.asset-list { font-size: 12px; color: var(--faint); word-break: break-word; }

/* 我的资产库 */
.asset-library {
  border: 1px solid var(--line);
  border-radius: var(--r-ctrl);
  background: var(--surface-2);
  padding: 2px 12px;
}
.lib-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
}
.lib-summary::-webkit-details-marker { display: none; }
.lib-summary::before { content: "›"; color: var(--faint); font-size: 15px; transition: transform .15s; }
.asset-library[open] .lib-summary::before { transform: rotate(90deg); }
.lib-title { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.lib-sub { font-size: 11px; color: var(--muted); }
.lib-body { padding: 2px 0 12px; }
.lib-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.lib-upload {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--accent-ring);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.lib-refresh {
  height: 30px;
  padding: 0 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.lib-refresh:hover { border-color: var(--line-2); color: var(--ink); }
.lib-grid { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.lib-hint { font-size: 12px; color: var(--faint); }
.lib-item {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  background: #0A0B0F;
  flex: none;
}
.lib-item img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; }
.lib-item:hover { border-color: var(--accent); }
.lib-badge {
  position: absolute;
  left: 0;
  bottom: 0;
  background: rgba(8, 9, 12, 0.8);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 5px;
  border-top-right-radius: 6px;
}
.lib-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(8, 9, 12, 0.78);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.lib-del:hover { background: var(--danger); }

/* (d) 底部参数条:pill 风横带 */
.settings-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 9px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
}

/* 紧凑胶囊式 select:无标签框,标签做内联极小前缀 */
.param-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color .14s, background .14s;
}
.param-pill:hover { border-color: var(--line-2); }
.param-pill:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.param-name { font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.param-unit { font-size: 11px; color: var(--muted); }

.param-pill select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 4.5L6 7.5L9 4.5' stroke='%238A8F9C' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>")
    no-repeat right center;
  background-size: 12px;
  border: none;
  outline: none;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  padding: 0 16px 0 0;
  cursor: pointer;
}
.param-pill select option { background: var(--surface); color: var(--ink); }

.param-pill-num input[type="number"] {
  width: 48px;
  background: transparent;
  border: none;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  padding: 0;
  text-align: right;
  -moz-appearance: textfield;
}
.param-pill-num input[type="number"]::-webkit-outer-spin-button,
.param-pill-num input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.param-pill-num input[type="number"]:focus { box-shadow: none; }

/* 勾选胶囊:打勾态填浅 accent */
.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background .14s, border-color .14s, color .14s;
  user-select: none;
}
.check-pill:hover { border-color: var(--line-2); color: var(--ink-2); }
.check-pill:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent-ring);
  color: var(--accent-ink);
}
.check-pill input[type="checkbox"] { width: 15px; height: 15px; }

/* 高级 JSON 抽屉 */
.advanced { flex: none; position: relative; }
.advanced[open] { flex: 1 1 100%; }
.advanced > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  user-select: none;
  transition: background .14s, border-color .14s, color .14s;
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::before { content: "{ }"; font-family: var(--mono); font-size: 11px; color: var(--faint); }
.advanced:hover > summary, .advanced[open] > summary { border-color: var(--line-2); color: var(--ink-2); }
.advanced > textarea {
  width: 100%;
  margin-top: 10px;
  display: block;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-ctrl);
  padding: 12px 14px;
  min-height: 110px;
}

/* (e) 主按钮:生成 —— 参数条内右侧主角 */
.generate-btn {
  margin-left: auto;
  height: 40px;
  padding: 0 22px;
  border: none;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, transform .08s, box-shadow .15s;
  box-shadow: 0 4px 16px rgba(123, 97, 255, 0.35);
}
.generate-btn:hover { background: var(--accent-press); box-shadow: 0 6px 20px rgba(123, 97, 255, 0.45); }
.generate-btn:active { transform: scale(0.97); }
.generate-btn:disabled,
.generate-btn[disabled] {
  background: var(--surface-3);
  color: var(--faint);
  box-shadow: none;
  cursor: not-allowed;
}
/* app.js 提交中常切 .is-loading / disabled */
.generate-btn.is-loading { color: transparent; position: relative; }
.generate-btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.composer-foot { display: flex; align-items: center; justify-content: center; }
.composer-foot-tip { font-size: 11px; color: var(--faint); }

/* =========================================================
   通用按钮族(结果区动作)
   ========================================================= */
.btn-mini {
  height: 30px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s, border-color .14s, color .14s;
}
.btn-mini:hover:not(:disabled) { background: var(--surface-3); border-color: var(--line-2); color: var(--ink); }

.btn-ghost-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 18px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .14s, border-color .14s, color .14s;
}
.btn-ghost-sm:hover:not(:disabled) { background: var(--surface-2); border-color: var(--accent-ring); color: var(--ink); }

/* 解禁态 vs disabled:点亮用 accent,禁用降透明 + 禁手势 */
.btn-mini:not(:disabled).is-ready,
.btn-ghost-sm:not(:disabled).is-ready {
  border-color: var(--accent);
  color: var(--accent-ink);
}
button:disabled,
a.btn-ghost-sm[disabled],
.btn-ghost-sm:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
}
/* downloadButton 是 <button>;openVideoLink 是 <a> —— a 无 disabled 语义,app.js 用 aria-disabled 控制(未出片时 aria-disabled=true),.is-disabled 也兜底 */
a.btn-ghost-sm.is-disabled,
a#openVideoLink.is-disabled,
a#openVideoLink[aria-disabled="true"] { opacity: 0.42; pointer-events: none; cursor: not-allowed; }

/* =========================================================
   响应式:窄屏单列已成立,dock 占满宽、参数条 wrap、缩略图行横滚
   ========================================================= */
@media (max-width: 720px) {
  .app { padding: 0 14px; }
  .composer-dock { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .mode-tabs { gap: 20px; }
  .result-card { padding: 16px; }
  .result-status { font-size: 18px; }
  .more-grid { grid-template-columns: 1fr; }
  .generate-btn { flex: 1 1 100%; margin-left: 0; }
  .settings-bar { gap: 7px; }
}

@media (max-width: 420px) {
  .brand-name { font-size: 15px; }
  .settings-trigger-label { display: none; }
  .settings-trigger { padding: 0 11px; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* =========================================================
   追加(2026-07):① 登录闸(全屏)  ② 页面更大更宽松、字号更小
   ========================================================= */

/* —— ① 登录闸:站点设了访问密码时,登录后才进创作台 —— */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  overflow-y: auto;              /* 视口过矮(横屏/软键盘顶起)时可滚动,不裁掉卡片 */
  padding: 24px;
  background:
    radial-gradient(1200px 760px at 50% -12%, rgba(123, 97, 255, 0.16), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 384px;
  margin: auto;                  /* 空间够则居中,不够则随 overflow 滚动而非裁切 */
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 36px 32px 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
}
.login-brand { display: flex; align-items: center; gap: 10px; }
.login-title { margin: 2px 0 8px; font-size: 15px; font-weight: 600; color: var(--ink-2); }
.login-input {
  width: 100%;
  font-size: 15px;
  padding: 13px 15px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctrl);
  transition: border-color .14s, box-shadow .14s;
}
.login-input::placeholder { color: var(--faint); }
.login-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.login-remember {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; color: var(--muted); cursor: pointer; user-select: none;
}
.login-remember input { width: 15px; height: 15px; accent-color: var(--accent); }
.login-btn {
  width: 100%;
  margin-top: 2px;
  padding: 13px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--r-ctrl);
  cursor: pointer;
  transition: background .14s;
}
.login-btn:hover:not(:disabled) { background: var(--accent-press); }
.login-btn:disabled { opacity: .6; cursor: default; }
.login-error { min-height: 18px; margin: 0; font-size: 13px; text-align: center; color: var(--danger); }
body.is-gated { overflow: hidden; }

/* —— ② 更大更宽松:加宽主容器 + 缩小基础字号 + 放大留白 —— */
:root { --dock-reserve: 348px; }
html, body { font-size: 13px; }              /* 基础字号 14 → 13,整体更小更清爽 */
.app { max-width: 1200px; padding: 0 40px; } /* 主容器 920 → 1200,不再挤成窄条 */

.topbar { padding: 18px 0 12px; }
.mode-tabs { gap: 30px; padding: 8px 2px 12px; }

.gallery { padding-bottom: 26px; }
.result-card { padding: 26px 30px; }
.result-head { margin-bottom: 20px; }
.result-status { font-size: 18px; }

.composer { padding: 24px 28px 20px; gap: 14px; }
.composer-input { font-size: 15px; }
.settings-bar { gap: 12px; padding-top: 6px; }
.material-row { gap: 14px; }
.asset-summary { padding: 4px 2px; }

/* 宽屏再给一档呼吸感 */
@media (min-width: 1120px) {
  .app { padding: 0 52px; }
  .result-card { padding: 30px 36px; }
  .composer { padding: 26px 34px 22px; }
}

/* =========================================================
   三栏创作台(2026-07 即梦式重构):左控制台 · 中生成流 · 右生成记录
   ========================================================= */
html, body { height: 100%; }
body { overflow: hidden; }              /* 各栏内部各自滚动 */

.studio {
  display: grid;
  grid-template-columns: 372px minmax(0, 1fr) 306px;
  height: 100vh;
  background: var(--bg);
}

/* —— 左:控制台 —— */
.console { display: flex; flex-direction: column; min-height: 0; background: var(--bg-2); border-right: 1px solid var(--line); }
.console-head { display: flex; align-items: center; gap: 9px; padding: 15px 18px 12px; border-bottom: 1px solid var(--line); }
.console-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 15px 18px 6px; }
.ctl-block { margin-bottom: 17px; }
.ctl-label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.ctl-hint { font-weight: 400; color: var(--faint); font-size: 11px; }
.ctl-select { width: 100%; font-size: 13px; padding: 9px 12px; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-ctrl); }
.prompt-wrap { position: relative; }
.console .composer-input { min-height: 120px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-media); padding: 12px 40px 12px 14px; }
.console .composer-input.is-expanded { min-height: 260px; }

/* 首/尾帧 */
.frame-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.frame-slot { position: relative; aspect-ratio: 1 / 1; border-radius: var(--r-media); border: 1px dashed var(--line-2); background: var(--surface); cursor: pointer; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.frame-slot:hover { border-color: var(--accent-ring); }
.frame-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.frame-empty i { display: block; font-style: normal; font-size: 10px; color: var(--faint); margin-top: 2px; }
.frame-plus { font-size: 22px; line-height: 1; color: var(--faint); }
.frame-fill { position: absolute; inset: 0; }
.frame-fill img { width: 100%; height: 100%; object-fit: cover; }
.frame-badge { position: absolute; left: 6px; top: 6px; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; }
.frame-del { position: absolute; right: 5px; top: 5px; width: 20px; height: 20px; border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 13px; line-height: 1; }

/* 参数 */
.param-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.param-grid .param-pill, .param-grid .check-pill { margin: 0; }

/* sticky 生成 */
.console-foot { padding: 12px 18px 15px; border-top: 1px solid var(--line); background: var(--bg-2); }
.generate-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px; margin: 0; border: none; border-radius: var(--r-ctrl); cursor: pointer; font-size: 15px; font-weight: 700; color: #fff; background: linear-gradient(120deg, #7B61FF, #9B6BFF); }
.generate-btn:hover:not(:disabled) { filter: brightness(1.07); }
.generate-btn:disabled { opacity: .7; cursor: default; }
.gen-cost { font-size: 12px; font-weight: 500; color: rgba(255,255,255,.85); }
.foot-tip { text-align: center; margin-top: 8px; font-size: 12px; color: var(--faint); }
#footHint.is-warn { color: var(--danger); }

/* —— 中:生成流 —— */
.feed { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.feed-head { display: flex; align-items: baseline; gap: 10px; padding: 16px 20px 10px; }
.feed-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.feed-count { font-size: 12px; color: var(--muted); }
.feed-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 20px 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; align-content: start; }
.feed-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 340px; color: var(--faint); text-align: center; }
.fe-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); opacity: .5; }
.fe-text { font-size: 13px; line-height: 1.7; }

/* 任务卡 */
.job-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-media); overflow: hidden; }
.job-media { position: relative; width: 100%; background: #0b0c10; }
.job-inner { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
/* loading */
.job-inner.is-loading .job-ghost { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .16; filter: blur(1px); }
.job-shimmer { position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.06) 50%, transparent 70%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.job-progress { position: relative; width: 60px; height: 60px; }
.ring { width: 60px; height: 60px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,.12); stroke-width: 4; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 163.36; stroke-dashoffset: 163.36; transition: stroke-dashoffset .9s linear; }
.job-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: var(--ink); }
.job-statusline { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.job-chip { font-size: 11px; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); }
.job-elapsed { font-size: 11px; color: var(--muted); }
/* done */
.job-inner.is-done { cursor: pointer; }
.job-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.job-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 46px; height: 46px; border-radius: 50%; border: none; background: rgba(0,0,0,.5); color: #fff; font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.job-inner.is-done:hover .job-play { background: var(--accent); }
.job-badge { position: absolute; right: 8px; bottom: 8px; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; }
/* failed */
.job-inner.is-failed { flex-direction: column; gap: 8px; color: var(--danger); padding: 12px; text-align: center; }
.fail-ico { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--danger); display: flex; align-items: center; justify-content: center; }
.fail-text { font-size: 12px; }

.job-foot { padding: 10px 12px 12px; }
.job-prompt { font-size: 12px; color: var(--ink-2); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.job-meta { margin-top: 6px; font-size: 11px; color: var(--faint); }
.job-actions { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.job-act { font-size: 11px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); cursor: pointer; }
.job-act:hover { border-color: var(--accent); color: var(--accent-ink); }

/* 首/尾帧缩小版(放全能参考下面):不占方块,一行两个矮位 */
.frame-slots-sm { gap: 8px; }
.frame-slots-sm .frame-slot { aspect-ratio: auto; height: 58px; border-radius: var(--r-ctrl); }
.frame-slots-sm .frame-empty { flex-direction: row; gap: 6px; font-size: 12px; }
.frame-slots-sm .frame-plus { font-size: 15px; }
.frame-slots-sm .frame-empty i { display: inline; margin: 0 0 0 4px; }
.frame-slots-sm .frame-badge { font-size: 10px; padding: 0 6px; }

/* —— 右:生成记录 —— */
.history { display: flex; flex-direction: column; min-height: 0; background: var(--bg-2); border-left: 1px solid var(--line); overflow: hidden; }
.history-head { display: flex; align-items: center; gap: 8px; padding: 16px 16px 8px; }
.history-head .history-refresh { margin-left: auto; }
.acct-badge { font-size: 11px; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); white-space: nowrap; }
.console-head .acct-badge { margin-left: auto; }
.logout-btn { font-size: 11px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap; }
.logout-btn:hover { border-color: var(--danger); color: var(--danger); }

/* ==== 左栏下半压缩(全能参考/资产库/首尾帧更矮,给生图腾地方) ==== */
.console-scroll .ctl-block { margin-bottom: 12px; }
.console .image-stage { min-height: 52px; padding: 6px; }
.console .add-plus { width: 26px; height: 26px; font-size: 17px; border-radius: 8px; }
.console .add-text { font-size: 12px; }
.console .preview-card { width: 48px; height: 48px; }
.console .lib-item { width: 48px; height: 48px; }
.console .lib-summary { padding: 8px 10px; }
.console .lib-sub { font-size: 11px; }
.frame-slots-sm .frame-slot { height: 50px; }

/* ==== 生图(一个大提示词框 + 可选参考图) ==== */
.imggen-block .imggen-prompt { width: 100%; font-size: 13px; padding: 11px 13px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-ctrl); color: var(--ink); resize: vertical; min-height: 104px; line-height: 1.6; }
.imggen-block .imggen-prompt::placeholder { color: var(--faint); }
.imggen-row { display: flex; gap: 8px; margin-top: 8px; }
.imggen-ref { flex: 0 0 auto; display: inline-flex; align-items: center; padding: 8px 13px; border: 1px dashed var(--line-2); border-radius: var(--r-ctrl); color: var(--muted); font-size: 12px; cursor: pointer; white-space: nowrap; max-width: 50%; overflow: hidden; }
.imggen-ref:hover { border-color: var(--accent-ring); color: var(--ink-2); }
.imggen-ref.has-ref { border-style: solid; border-color: var(--accent); color: var(--accent-ink); }
.imggen-btn { flex: 1; padding: 9px; border: none; border-radius: var(--r-ctrl); background: var(--surface-3); color: var(--ink); font-weight: 700; cursor: pointer; }
.imggen-btn:hover:not(:disabled) { background: var(--accent); color: #fff; }
.imggen-btn:disabled { opacity: .6; cursor: default; }
.imggen-cost { font-size: 11px; font-weight: 500; opacity: .85; }
.imggen-result { margin-top: 10px; }
.imggen-loading, .imggen-err { font-size: 12px; color: var(--muted); padding: 8px; text-align: center; }
.imggen-err { color: var(--danger); }
.imggen-card { border: 1px solid var(--line); border-radius: var(--r-media); overflow: hidden; background: var(--surface); }
.imggen-card img { width: 100%; display: block; max-height: 240px; object-fit: contain; background: #0b0c10; }
.imggen-acts { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; }
.imggen-act { font-size: 12px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--accent); background: transparent; color: var(--accent-ink); cursor: pointer; }
.imggen-act:hover { background: var(--accent); color: #fff; }
.imggen-tip { font-size: 11px; color: var(--ok); }
/* 生图完成:左栏只留小状态行(缩略图可点放大),大图在中间任务流 */
.imggen-done { display: flex; align-items: center; gap: 8px; padding: 6px 2px; font-size: 12px; color: var(--ok); line-height: 1.5; }
.imggen-done img { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); cursor: zoom-in; background: #0b0c10; }
.history-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.history-refresh { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); cursor: pointer; font-size: 14px; }
.history-refresh:hover { border-color: var(--accent-ring); color: var(--ink); }
.history-balance { padding: 0 16px 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
.history-balance b { color: var(--ok); font-size: 13px; }
.history-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 8px; }
.history-empty { padding: 30px 12px; text-align: center; color: var(--faint); font-size: 12px; }
.hist-row { display: flex; gap: 10px; padding: 8px; border-radius: 12px; cursor: pointer; }
.hist-row:hover { background: var(--surface); }
.hist-thumb { position: relative; width: 52px; height: 52px; flex: 0 0 52px; border-radius: 9px; overflow: hidden; background: #0b0c10; display: flex; align-items: center; justify-content: center; }
.hist-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hist-play { position: absolute; font-size: 11px; color: #fff; background: rgba(0,0,0,.5); width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.hist-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hist-body { min-width: 0; flex: 1; }
.hist-prompt { font-size: 12px; color: var(--ink-2); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hist-sub { margin-top: 3px; font-size: 11px; color: var(--faint); }

/* theater */
.theater-video { max-width: 92vw; max-height: 88vh; border-radius: 12px; }
.theater-img { max-width: 92vw; max-height: 88vh; border-radius: 12px; object-fit: contain; }

/* 生图结果卡(中间任务流):正方形媒体位,整图 contain 展示 */
.image-card .job-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

/* 响应式 */
@media (max-width: 1080px) { .studio { grid-template-columns: 340px minmax(0,1fr); } .history { display: none; } }
@media (max-width: 760px) {
  .studio { grid-template-columns: 1fr; grid-template-rows: auto minmax(0,1fr); height: 100vh; }
  .console { border-right: none; border-bottom: 1px solid var(--line); max-height: 52vh; }
}
