
/* ================= 1. 变量与基础 ================= */
:root {
  --bg: #0e1016;
  --bg-pop: #1c1f2a; /* 弹出层背景 */
  --panel: rgba(255, 255, 255, 0.045);
  --panel-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #eceef4;
  --text-dim: #9aa1b3;
  --accent: #6c5ce7;
  --accent-light: #8e7cf5; /* 主色渐变的亮端 */
  --accent-2: #00cec9;
  --danger: #ff6b6b;
  --radius: 16px;
  --radius-sm: 10px;
}

html, body { height: 100%; }

body {
  font-family: "Verdana", "Microsoft YaHei", "Segoe UI", "Arial", "sans-serif";
  color: var(--text);
  background: radial-gradient(1100px 700px at 75% -10%, rgba(108, 92, 231, 0.22), transparent 60%),
    radial-gradient(900px 600px at 8% 110%, rgba(0, 206, 201, 0.14), transparent 55%),
    var(--bg); display: flex; flex-direction: column; min-height: 100vh; overflow: hidden;
}

/* 全局滚动条(细窄) */
html, body, textarea, div {
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

html, body, textarea, div, ul, dl, li, p, h1, h2, h3, h4, h5, h6 { margin: 0; padding: 0; box-sizing: border-box; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; border-radius: 4px; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.35); }
::-webkit-scrollbar-button {
  display: block;
  height: 16px;
  background-repeat: no-repeat;
  background-position: center;
}
::-webkit-scrollbar-button:start:decrement {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M5 8L1 2h8z' fill='rgba(255,255,255,0.4)'/%3E%3C/svg%3E");
}
::-webkit-scrollbar-button:end:increment {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M5 2L1 8h8z' fill='rgba(255,255,255,0.4)'/%3E%3C/svg%3E");
}

/* 统一自定义小滚动条(用于弹窗/面板内部滚动容器) */
.scroll-thin,
.select-dropdown,
.prompt-popover,
.task-popover .task-list,
.action-style-submenu .action-sub-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.scroll-thin::-webkit-scrollbar,
.select-dropdown::-webkit-scrollbar,
.prompt-popover::-webkit-scrollbar,
.task-popover .task-list::-webkit-scrollbar,
.action-style-submenu .action-sub-list::-webkit-scrollbar {
  width: 6px; height: 6px;
}
.scroll-thin::-webkit-scrollbar-track,
.select-dropdown::-webkit-scrollbar-track,
.prompt-popover::-webkit-scrollbar-track,
.task-popover .task-list::-webkit-scrollbar-track,
.action-style-submenu .action-sub-list::-webkit-scrollbar-track {
  background: transparent;
}
.scroll-thin::-webkit-scrollbar-thumb,
.select-dropdown::-webkit-scrollbar-thumb,
.prompt-popover::-webkit-scrollbar-thumb,
.task-popover .task-list::-webkit-scrollbar-thumb,
.action-style-submenu .action-sub-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}
.scroll-thin::-webkit-scrollbar-thumb:hover,
.select-dropdown::-webkit-scrollbar-thumb:hover,
.prompt-popover::-webkit-scrollbar-thumb:hover,
.task-popover .task-list::-webkit-scrollbar-thumb:hover,
.action-style-submenu .action-sub-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}
.scroll-thin::-webkit-scrollbar-button,
.select-dropdown::-webkit-scrollbar-button,
.prompt-popover::-webkit-scrollbar-button,
.task-popover .task-list::-webkit-scrollbar-button,
.action-style-submenu .action-sub-list::-webkit-scrollbar-button {
  display: block;
  height: 14px;
  background-repeat: no-repeat;
  background-position: center;
}
.scroll-thin::-webkit-scrollbar-button:start:decrement,
.select-dropdown::-webkit-scrollbar-button:start:decrement,
.prompt-popover::-webkit-scrollbar-button:start:decrement,
.task-popover .task-list::-webkit-scrollbar-button:start:decrement,
.action-style-submenu .action-sub-list::-webkit-scrollbar-button:start:decrement {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M5 8L1 2h8z' fill='rgba(255,255,255,0.4)'/%3E%3C/svg%3E");
}
.scroll-thin::-webkit-scrollbar-button:end:increment,
.select-dropdown::-webkit-scrollbar-button:end:increment,
.prompt-popover::-webkit-scrollbar-button:end:increment,
.task-popover .task-list::-webkit-scrollbar-button:end:increment,
.action-style-submenu .action-sub-list::-webkit-scrollbar-button:end:increment {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M5 2L1 8h8z' fill='rgba(255,255,255,0.4)'/%3E%3C/svg%3E");
}

/* 通用隐藏工具类 */
.hidden { display: none !important; }

/* ================= 2. 顶部栏 ================= */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
  background: rgba(14, 16, 22, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-right: auto;
  min-width: 110px;
}
.logo .logo-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(108, 92, 231, 0.45);
}
.logo .logo-mark svg {
  width: 22px; height: 22px;
  display: block;
}

.tabs {
  display: flex;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}
.tab {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  padding: 5px 18px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  box-shadow: 0 4px 14px rgba(108, 92, 231, 0.4);
}
/* 平台不支持的功能: 禁用态(opacity 降低 + 禁止光标 + 不响应 hover) */
.tab.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.platform-box {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
}
.platform-box label { white-space: nowrap; }

#select-platform   { width: 92px; }
#select-model      { width: 156px; }
#select-resolution { width: 156px; }

/* ================= 下拉组件 ================= */
.select { position: relative; }
.select-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  width: 100%;
  min-height: 26px;
  background: var(--panel-strong);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  font-size: 12px;
  line-height: 16px;
  padding: 6px 8px;
  text-align: left;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}
.select-trigger:hover,
.select.open .select-trigger { border-color: var(--accent); }
.select-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-arrow {
  width: 12px; height: 12px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: transform 0.18s;
  stroke: var(--text-dim);
}
.select.open .select-arrow { transform: rotate(180deg); }

.select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  max-height: 320px;
  overflow-y: auto;
  background: var(--bg-pop);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 4px;
  z-index: 60;
  display: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.select.open .select-dropdown { display: block; }
.select-option {
  list-style: none;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.12s;
}
.select-option:hover { background: var(--panel-strong); }
.select-option.active { background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: #fff; }

/* ─── 操作下拉(含二级子菜单) ─────────────────────────────── */
.action-select { min-width: 72px; }
.action-style-submenu {
  position: absolute;
  min-width: 160px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 9999;
  border-radius: 8px;
  background: #1a1d24;
  border: 1px solid var(--border-strong);   /* 与操作下拉边框一致 */
  box-shadow: 0 4px 24px rgba(0,0,0,.35);
}
.action-style-submenu .action-sub-header {
  padding: 6px 12px;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border-dim);
  user-select: none;
}
.action-style-submenu .action-sub-list {
  padding: 4px;
}
.action-style-submenu .action-sub-item {
  padding: 5px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.action-style-submenu .action-sub-item:hover { background: var(--panel-strong); }
.action-style-submenu .action-sub-item.selected { background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: #fff; }

/* ================= 主预览区 ================= */

.app {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  min-height: 0;
}

.stage {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.stage > .view { width: 100%; }

.view { display: none; width: 100%; height: 100%; }
.view.active { display: flex; }

/* 历史页 / 相册样式见 static/pictures.css (按页面模块拆分, 减少主样式表体积) */

/* ================= 结果图片展示 ================= */

.big-frame {
  position: relative;
  flex: 1;
  height: 100%;
  min-height: 360px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.2s;
}
.big-frame.has-image { border-style: solid; border-color: var(--border); }
.big-frame img.result-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 空状态占位 */
.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  user-select: none;
  text-align: center;
  padding: 20px;
}
.placeholder .ph-icon {
  width: 64px; height: 64px;
  border-radius: 20px;
  background: var(--panel-strong);
  display: grid; place-items: center;
  font-size: 28px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.placeholder .ph-icon svg { display: block; }
.placeholder p { font-size: 14px; }

/* 加载动画 */
.loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(14, 16, 22, 0.72);
  backdrop-filter: blur(4px);
  border-radius: var(--radius);
  z-index: 5;
}

/* textarea 容器 */
.textarea-wrap {
  position: relative;
}

/* 提示语 浮层 */
.gen-loading {
  position: absolute;
  left: 50%;
  bottom: 75px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  padding: 0;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  pointer-events: none;
  z-index: 8;
}
.gen-spinner {
  width: 12px;
  height: 12px;
  border: 1.6px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 错误状态(在 big-frame 中替代占位符, 比 toast 更醒目) */
.error-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  color: var(--text-dim);
  z-index: 4;
  box-sizing: border-box;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
  max-width: 100%;
}
.error-state::before {
  content: "⚠";
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(231, 76, 60, 0.12);
  border: 1px solid rgba(231, 76, 60, 0.3);
  color: #ff6b6b;
  display: grid;
  place-items: center;
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}
.spinner {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 3px solid var(--panel-strong);
  border-top-color: var(--accent);
  border-right-color: var(--accent-2);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading p { font-size: 14px; color: var(--text-dim); }

/* ================= 图片编辑 ================= */
.editor {
  display: flex;
  gap: 14px;
  width: 100%;
  height: 100%;
  min-height: 0;
}
.editor-left {
  width: 210px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex-shrink: 0;
}
.editor-right {
  flex: 1;
  display: flex;
  min-height: 0;
  height: 100%;
}

/* 参考图上传框 */
.small-frame {
  position: relative;
  flex: 1;
  min-height: 100px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.2s;
}
.small-frame:hover { border-color: var(--accent); background: var(--panel-strong); }
.small-frame.has-image { border-style: solid; }

/* 禁用槽位(超出 maxImages 的) */
.small-frame.disabled {
  opacity: 0.35;
  pointer-events: none;
  cursor: default;
  border-color: var(--border);
}
.small-frame.disabled .small-ph { color: var(--text-dim); }
.small-frame img.preview-img {
  width: 100%; height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.small-frame .small-ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 22px;
  pointer-events: none;
}
.small-frame .small-ph p { font-size: 12px; font-weight: normal; }
.small-frame .file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.small-frame .remove-btn {
  position: absolute;
  top: 6px; right: 6px;
  width: 22px; height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
  z-index: 3;
  transition: background 0.2s;
}
.small-frame .remove-btn:hover { background: var(--danger); }

/* ================= 输入区 ================= */
.input-bar {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0 12px 12px;
  box-sizing: border-box;
  border-top: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.input-bar > .input-card {
  max-width: 100%;
  margin: 0;
}

/* 顶部拖动手柄:可上下拖动调节高度 */
.resize-handle {
  height: 10px;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  user-select: none;
}
.resize-handle::before {
  content: "";
  width: 44px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-strong);
  transition: background 0.2s, width 0.2s;
}
.resize-handle:hover::before,
.resize-handle.dragging::before {
  background: var(--accent);
  width: 60px;
}

/* 输入卡片 */
.input-card {
  position: relative;             /* 供 .gen-loading 浮层 absolute 定位参考 */
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 10px;
  /* overflow: visible 允许下拉列表(.select-dropdown)溢出显示, 不被裁切 */
  overflow: visible;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
/* 圆角补偿: textarea 顶部圆角 */
.input-card textarea {
  border-radius: 9px 9px 0 0;
}
/* 圆角补偿: 工具栏底部圆角 */
.input-toolbar {
  border-radius: 0 0 9px 9px;
}
.input-card:focus-within {
  border-color: var(--border-strong);
  box-shadow: none;
}

.input-card textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  font-family: Verdana, "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  resize: none;
  /* 提示词文本框默认高度 */
  height: 66px;
  min-height: 66px;
  line-height: 18px;
  padding: 6px 12px;
  overflow-y: auto;
  box-sizing: border-box;
}
.input-card textarea::placeholder { color: var(--text-dim); }

/* 工具栏 */
.input-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 10px;
  border-top: 1px solid var(--border);
}
.input-toolbar .spacer { flex: 1; }
.input-toolbar .divider { width: 1px; height: 20px; background: var(--border-strong); margin: 0 6px; }

/* 工具栏内的语言下拉: 透明样式 + 向上弹出 */
.input-toolbar .lang-select { width: auto; flex-shrink: 0; margin-right: 0; }
.input-toolbar .lang-select .select-dropdown {
  z-index: 70;
  top: auto;
  bottom: calc(100% + 4px);
}
.input-toolbar .lang-select .select-trigger {
  position: relative;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-dim);
  padding: 4px 24px 4px 8px;
  font-size: 13px;
  width: auto;
}
.input-toolbar .lang-select .select-trigger:hover,
.input-toolbar .lang-select.select.open .select-trigger {
  background: var(--panel-strong);
  color: var(--text);
  border-color: transparent;
}
.input-toolbar .lang-select .select-trigger .select-arrow {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  pointer-events: none;
}
.input-toolbar .lang-select .select-trigger:hover .select-arrow,
.input-toolbar .lang-select.select.open .select-arrow { stroke: var(--text); }
.input-toolbar .lang-select .lang-icon {
  display: inline-flex;
  align-items: center;
  color: var(--text-dim);
  flex-shrink: 0;
}
.input-toolbar .lang-select .select-trigger:hover .lang-icon,
.input-toolbar .lang-select.select.open .lang-icon { color: var(--text); }

/* 操作下拉(样式与语言下拉一致, 无边框, 向上弹出) */
.input-toolbar .action-select { width: auto; flex-shrink: 0; margin-right: 0; }
.input-toolbar .action-select .select-dropdown {
  z-index: 70;
  /* 向上弹出(与语言下拉一致), 在 .input-card 上方展开 */
  top: auto;
  bottom: calc(100% + 6px);
}
.input-toolbar .action-select .select-trigger {
  position: relative;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-dim);
  padding: 4px 24px 4px 8px;
  font-size: 13px;
  width: auto;
}
.input-toolbar .action-select .select-trigger:hover,
.input-toolbar .action-select.select.open .select-trigger {
  background: var(--panel-strong);
  color: var(--text);
  border-color: transparent;
}
.input-toolbar .action-select .select-trigger .select-arrow {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  pointer-events: none;
}
.input-toolbar .action-select .select-trigger:hover .select-arrow,
.input-toolbar .action-select.select.open .select-arrow { stroke: var(--text); }
.input-toolbar .action-select .action-icon {
  display: inline-flex;
  align-items: center;
  color: var(--text-dim);
  flex-shrink: 0;
}
.input-toolbar .action-select .select-trigger:hover .action-icon,
.input-toolbar .action-select.select.open .action-icon { color: var(--text); }

/* 工具栏图标按钮 */
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.icon-btn:hover,
.icon-btn.active { background: var(--panel-strong); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; stroke-width: 1.8; }
.icon-btn .arrow { width: 12px; height: 12px; margin-left: 2px; opacity: 0.7; }
.icon-btn.active .arrow { transform: rotate(180deg); }

/* 任务按钮的徽标(显示 pending+running 数量) */
.task-badge {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

/* 批量张数输入框 */
.batch-input {
  width: 32px;
  height: 25px;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  text-align: center;
  padding: 0 2px;
  margin: 0 4px;
  outline: none;
  transition: border-color 0.18s;
  -moz-appearance: textfield;
  appearance: textfield;
}
.batch-input::-webkit-outer-spin-button,
.batch-input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.batch-input:hover { border-color: rgba(255, 255, 255, 0.18); }
.batch-input:focus { border-color: rgba(255, 255, 255, 0.1); outline: none; }
.batch-input:disabled { opacity: 0.4; cursor: not-allowed; }

/* 发送按钮 */
.send-btn {
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.send-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); color: var(--text); }
.send-btn:disabled { cursor: not-allowed; opacity: 0.5; }
.send-btn.active { background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: #fff; }
.send-btn.active:hover { background: linear-gradient(135deg, #7a6cf0, #a094ff); }

/* 提示词弹层(快捷提示词 / 风格共用) —
   与 .task-popover 统一: position:fixed, 底部与 .stage 底部重合, 最高与 .stage 顶部重合;
   具体 top/left/width/height 由 JS(syncPopoverSize)按 .stage 计算: 默认高 200px, 随内容加高, 上限 = stage 高度;
   同一时刻只显示一个弹层 */
.prompt-popover {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  min-height: 200px;
  background: var(--bg-pop);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  z-index: 50;
  display: none;
  overflow: auto;
  box-sizing: border-box;
}
.prompt-popover.show { display: flex; flex-direction: column; }
.prompt-popover h4 {
  flex: 0 0 auto;
  margin: 4px 6px 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.4px;
  color: var(--text-dim);
}
.prompt-tags {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
}
.prompt-tag {
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 12px;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.15s;
  align-self: flex-start;
  max-width: 100%;
}
.prompt-tag:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.prompt-tag.active { background: linear-gradient(135deg, var(--accent), var(--accent-light)); border-color: transparent; color: #fff; }

/* 任务队列弹层(覆盖整个预览区: 底部与 stage 底部重合, 顶部与 stage 顶部重合)
   用 fixed 定位, 具体 top/left/width/height 由 JS(syncTaskPopoverSize)按 .stage 计算 */
.task-popover {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  min-height: 60px;            /* 最小高度 60px */
  background: var(--bg-pop);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  z-index: 60;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}
.task-popover.show { display: flex; }

.task-popover-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.task-popover-header h4 {
  margin: 0 6px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.4px;
  color: var(--text-dim);
}
.task-cancel-all {
  background: transparent;
  border: 1px solid rgba(255, 103, 103, 0.35);
  color: #ff6f6f;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.task-cancel-all:hover:not(:disabled) {
  background: rgba(255, 107, 107, 0.12);
  border-color: var(--danger);
  color: var(--danger);
}
.task-cancel-all:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 任务列表(默认走流式加载, 不再提供模式切换按钮) */
.task-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 6px;
}
.task-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 40px 0;
  font-size: 13px;
}

/* 单条任务: 左缩略图 / 中描述 / 右侧状态+取消按钮 */
.task-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  background: var(--panel);
  margin-bottom: 6px;
  transition: background 0.15s;
}
.task-item:last-child { margin-bottom: 0; }
.task-item:hover { background: var(--panel-strong); }

/* 缩略图: img2img 时贴参考图, 文生图时给一个示意画板 */
.task-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--text-dim);
  flex-shrink: 0;
  overflow: hidden;
}
.task-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.task-thumb svg { width: 22px; height: 22px; stroke-width: 1.6; }

.task-info { min-width: 0; }
.task-prompt {
  font-size: 13px;
  line-height: 16px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
}
/* 图生图子任务名前缀 (如"生成相似图：") */
.task-action-tag {
  flex-shrink: 0;
}
.task-meta {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.task-id, .task-time { color: var(--text-dim); }
.task-time { font-variant-numeric: tabular-nums; }
.task-status {
  display: inline-block;
  padding: 0px 6px;
  border-radius: 5px;
  font-size: 11px;
  line-height: 18px;
  height: 19px;
  box-sizing: border-box;
}
.task-status.pending  { background: rgba(154, 161, 179, 0.15); color: var(--text-dim); }
.task-status.running  { background: rgba(108, 92, 231, 0.18); color: var(--accent-light); }
.task-status.succeeded{ background: rgba(0, 206, 201, 0.18); color: var(--accent-2); }
.task-status.failed   { background: rgba(255, 107, 107, 0.18); color: var(--danger); }
.task-status.cancelled{ background: rgba(154, 161, 179, 0.10); color: var(--text-dim); opacity: 0.7; }

.task-actions { display: flex; align-items: center; gap: 6px; }
.task-cancel-btn {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.task-cancel-btn:hover:not(:disabled) {
  border-color: var(--danger);
  color: var(--danger);
}
.task-cancel-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* 小屏: 让弹层贴边自适应 */
@media (max-width: 640px) {
  .task-popover { width: calc(100% - 24px); min-width: 0; }
}

/* Toast 提示条 */
.toast {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  background: #262a38;
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 100;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 文本框中间临时提示(发送后显示 "已发送任务") */
.sent-tip {
  position: fixed;
  padding: 8px 16px;
  background: var(--bg-pop);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.35s ease;
  z-index: 120;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.sent-tip.fade-out { opacity: 0; }

/* ================= 后端连接状态 ================= */

/* 后端不可达全屏遮罩 */
.offline-mask {
  position: fixed;
  inset: 0;
  background: rgba(14, 16, 22, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.offline-card {
  max-width: 420px;
  background: var(--bg-pop);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 28px 32px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.offline-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--panel-strong);
  display: grid;
  place-items: center;
  color: var(--danger);
  border: 1px solid var(--border);
}
.offline-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}
.offline-card p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 20px;
}
.offline-card code {
  background: var(--panel-strong);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 12px;
  color: var(--text);
}
.retry-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  border: none;
  padding: 9px 22px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.retry-btn:hover { box-shadow: 0 4px 14px rgba(108, 92, 231, 0.4); transform: translateY(-1px); }
.retry-btn:active { transform: translateY(0); }

/* ================= 访问密码弹窗 ================= */
.auth-mask {
  position: fixed;
  inset: 0;
  background: rgba(14, 16, 22, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 20px;
}
.auth-card {
  max-width: 420px;
  width: 100%;
  background: var(--bg-pop);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 28px 32px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.auth-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--panel-strong);
  display: grid;
  place-items: center;
  color: var(--accent);
  border: 1px solid var(--border);
}
.auth-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}
.auth-card p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 20px;
}
.auth-input {
  width: 100%;
  margin: 30px 0;
  box-sizing: border-box;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.18);
}
.auth-error {
  margin-top: 10px;
  font-size: 12px;
  color: var(--danger);
}
.auth-card .retry-btn {
  margin-top: 18px;
  width: 100%;
}
.auth-card .retry-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ================= 响应式 ================= */
@media (max-width: 750px) {
  .topbar { padding: 10px 16px; gap: 12px; flex-wrap: wrap; }
  .logo { display: none; }
  .tabs { order: 1; }
  .platform-box { order: 2; margin-left: auto; }
  .editor { flex-direction: column; }
  .editor-left { width: 100%; flex-direction: row; height: 90px; }
  .small-frame { min-height: 0; }
}

/* 渐进式隐藏标签文字 */
@media (max-width: 900px) {
  .platform-box label { display: none; }
}
@media (max-width: 640px) {
  .lang-select .select-value { display: none; }
  .input-toolbar #btn-clear > span { display: none; }
}
@media (max-width: 560px) {
  .input-toolbar #btn-prompts > span,
  .input-toolbar #btn-style > span { display: none; }
}
