/* ==========================================================================
   AI工具通用操作台布局
   三栏结构：左侧导航列 + 配置面板 + 右侧主体画布
   ========================================================================== */

.ai-ws {
  --ws-nav-w: 72px;
  --ws-sidebar-w: 300px;
  --ws-primary: #2563eb;
  --ws-primary-soft: #eff6ff;
  --ws-ink: #0f172a;
  --ws-muted: #64748b;
  --ws-line: #e2e8f0;
  --ws-bg: #f8fafc;
  --ws-radius: 14px;
  --ws-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
  font-family: "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ws-ink);
  display: flex;
  height: calc(100vh - 74px);
  margin-top: -1.5rem;
  overflow: hidden;
  background: var(--ws-bg);
}

/* ── 左侧导航列（统一） ── */
.ai-ws-nav {
  width: var(--ws-nav-w);
  min-width: var(--ws-nav-w);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1rem 0;
  background: #ffffff;
  border-right: 1px solid var(--ws-line);
}

.ws-nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  width: 60px;
  padding: 0.6rem 0.25rem;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--ws-muted);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-align: center;
  line-height: 1.3;
}

.ws-nav-tab svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.ws-nav-tab:hover {
  background: #f1f5f9;
  color: #334155;
}

.ws-nav-tab.is-active {
  background: var(--ws-primary-soft);
  color: var(--ws-primary);
}

/* ── 配置面板 ── */
.ai-ws-sidebar {
  width: var(--ws-sidebar-w);
  min-width: var(--ws-sidebar-w);
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-right: 1px solid var(--ws-line);
  overflow: hidden;
}

.ai-ws-sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.1rem 1.25rem 0.9rem;
  border-bottom: 1px solid var(--ws-line);
}

.ai-ws-sidebar-header .ws-tool-icon {
  font-size: 1.3rem;
}

.ai-ws-sidebar-header h1 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}

.ai-ws-sidebar-header .ws-tool-desc {
  font-size: 0.78rem;
  color: var(--ws-muted);
  margin: 0;
}

/* 侧边栏内容滚动区 */
.ai-ws-sidebar-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Tab 面板切换 */
.ws-tab-panel {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 0;
}

.ws-tab-panel.is-active {
  display: flex;
}

/* 工具配置面板可滚动；生成记录面板占满剩余高度 */
.ws-tab-panel[data-ws-panel="tool"].is-active {
  overflow-y: auto;
  flex: 1;
}

.ws-tab-panel[data-ws-panel="history"].is-active {
  flex: 1;
  overflow: hidden;
}

/* ── 配置区块 ── */
.ws-config-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ws-config-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  margin: 0;
}

.ws-config-hint {
  font-size: 0.74rem;
  color: var(--ws-muted);
  margin: 0;
  line-height: 1.5;
}

/* 模型选择级联 */
.ws-model-select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--ws-line);
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  font-size: 0.88rem;
  color: var(--ws-ink);
  background: #fff;
  transition: border-color 0.15s;
}

.ws-model-select:focus {
  outline: none;
  border-color: var(--ws-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 上传区域 */
.ws-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 100px;
  padding: 1rem;
  border: 2px dashed #cbd5e1;
  border-radius: var(--ws-radius);
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: center;
}

.ws-upload-zone:hover,
.ws-upload-zone.is-dragover {
  border-color: var(--ws-primary);
  background: var(--ws-primary-soft);
}

.ws-upload-zone svg {
  color: #94a3b8;
}

.ws-upload-zone p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ws-muted);
}

.ws-upload-zone .ws-upload-btn {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ws-primary);
}

/* 文本输入 */
.ws-textarea {
  width: 100%;
  min-height: 72px;
  border: 1px solid var(--ws-line);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  resize: vertical;
  transition: border-color 0.15s;
}

.ws-textarea:focus {
  outline: none;
  border-color: var(--ws-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 开关选项 */
.ws-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.ws-toggle-row label {
  font-size: 0.84rem;
  color: #334155;
  margin: 0;
  cursor: pointer;
}

.ws-switch {
  position: relative;
  width: 40px;
  height: 22px;
  min-width: 40px;
  border-radius: 999px;
  background: #cbd5e1;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.ws-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.2s;
}

.ws-switch.is-on {
  background: var(--ws-primary);
}

.ws-switch.is-on::after {
  transform: translateX(18px);
}

/* 操作按钮 */
.ws-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 44px;
  border: none;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.ws-action-btn--primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.3);
}

.ws-action-btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
}

.ws-action-btn--primary:active {
  transform: translateY(0);
}

.ws-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* 高级选项折叠 */
.ws-advanced-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  background: none;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ws-primary);
  cursor: pointer;
  padding: 0.3rem 0;
}

.ws-advanced-toggle svg {
  transition: transform 0.2s;
}

.ws-advanced-toggle.is-open svg {
  transform: rotate(90deg);
}

.ws-advanced-panel {
  display: none;
  flex-direction: column;
  gap: 0.65rem;
  padding-top: 0.5rem;
}

.ws-advanced-panel.is-open {
  display: flex;
}

/* 清晰度宫格：两行两列（图标 + 文字） */
.ws-clarity-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.ws-clarity-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 38px;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--ws-line);
  border-radius: 10px;
  background: #fff;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}

.ws-clarity-option:hover {
  border-color: #93c5fd;
  color: #1d4ed8;
}

.ws-clarity-option.is-selected {
  border-color: var(--ws-primary);
  background: var(--ws-primary-soft);
  color: var(--ws-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 原画质信息提示图标 & tooltip */
.ws-clarity-info {
  display: inline-flex;
  align-items: center;
  margin-left: 0.25rem;
  cursor: help;
  color: #94a3b8;
  transition: color 0.15s;
}

.ws-clarity-info:hover {
  color: #64748b;
}

.ws-clarity-info-icon {
  width: 13px;
  height: 13px;
}

.ws-clarity-info-tip {
  position: fixed;
  width: max-content;
  max-width: 190px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.5;
  white-space: normal;
  word-break: break-all;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.08);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
  z-index: 10000;
}

.ws-clarity-info-tip.is-visible {
  opacity: 1;
  visibility: visible;
}

.ws-ai-exec-cascade-item.is-disabled,
.ws-ai-exec-sheet-item.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  color: #94a3b8;
}

.ws-ai-exec-cascade-item.is-disabled:hover,
.ws-ai-exec-sheet-item.is-disabled:hover {
  background: transparent;
  color: #94a3b8;
}

/* 目标尺寸单选（一行两列） */
.ws-size-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.ws-size-mode-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 40px;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--ws-line);
  border-radius: 10px;
  background: #fff;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}

.ws-size-mode-option svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.ws-size-mode-option:hover {
  border-color: #93c5fd;
  color: #1d4ed8;
}

.ws-size-mode-option.is-selected {
  border-color: var(--ws-primary);
  background: var(--ws-primary-soft);
  color: var(--ws-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 高级选项下拉（清晰度 / 尺寸） */
.ws-select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--ws-line);
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  font-size: 0.88rem;
  color: var(--ws-ink);
  background: #fff;
  transition: border-color 0.15s;
  appearance: auto;
}

.ws-select:focus {
  outline: none;
  border-color: var(--ws-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ws-select:disabled {
  color: var(--ws-muted);
  background: #f8fafc;
  cursor: not-allowed;
}

/* ── 生成记录区 ── */
.ws-history-section {
  border-top: 1px solid var(--ws-line);
  padding-top: 1rem;
}

.ws-history-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  margin: 0 0 0.6rem;
}

.ws-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

.ws-history-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--ws-line);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.ws-history-item:hover {
  background: var(--ws-primary-soft);
  border-color: #bfdbfe;
}

/* 当前正在画布中查看的记录 → 高亮标识 */
.ws-history-item.is-active {
  background: var(--ws-primary-soft);
  border-color: var(--ws-primary);
}

.ws-history-item.is-active .ws-history-meta strong {
  color: var(--ws-primary);
}

.ws-history-thumb {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #e2e8f0;
}

.ws-history-item img,
.ws-history-thumb img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.ws-history-item.is-processing {
  border-color: #93c5fd;
  background: linear-gradient(90deg, #eff6ff 0%, #f8fafc 50%, #eff6ff 100%);
  background-size: 200% 100%;
  animation: wsHistoryPulse 1.4s ease-in-out infinite;
}

.ws-history-item.is-processing .ws-history-thumb img {
  filter: brightness(0.72);
}

.ws-history-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  animation: wsFilmSpin 0.8s linear infinite;
  z-index: 1;
}

.ws-history-item.is-processing .ws-history-meta span {
  color: var(--ws-primary);
}

@keyframes wsHistoryPulse {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.ws-history-item .ws-history-meta {
  flex: 1;
  min-width: 0;
}

.ws-history-item .ws-history-meta strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-history-item .ws-history-meta span {
  font-size: 0.72rem;
  color: var(--ws-muted);
}

.ws-history-actions {
  flex-shrink: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-left: 0.15rem;
}

.ws-history-detail,
.ws-history-delete {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.ws-history-item:hover .ws-history-detail,
.ws-history-item:hover .ws-history-delete,
.ws-history-item:focus-within .ws-history-detail,
.ws-history-item:focus-within .ws-history-delete,
.ws-history-detail:focus-visible,
.ws-history-delete:focus-visible {
  opacity: 1;
}

.ws-history-detail:hover {
  background: var(--ws-primary-soft);
  color: var(--ws-primary);
}

.ws-history-delete:hover {
  background: #fee2e2;
  color: #dc2626;
}

.ws-history-delete:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ws-history-detail svg,
.ws-history-delete svg {
  width: 15px;
  height: 15px;
}

/* 生成记录详情弹窗（展示关联平台任务列表，只读） */
.ws-history-tasks-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.ws-history-tasks-modal.is-open {
  display: flex;
}

.ws-history-tasks-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.ws-history-tasks-dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  max-height: min(78vh, 720px);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.ws-history-tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid var(--ws-line);
}

.ws-history-tasks-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.ws-history-tasks-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
}

.ws-history-tasks-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.ws-history-tasks-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 1.1rem 1.15rem;
}

.ws-history-tasks-body .history-card {
  cursor: default;
}

.ws-history-tasks-body .history-card:hover {
  border-color: var(--brand-border, var(--ws-line));
  box-shadow: none;
}

.ws-history-tasks-empty {
  margin: 0;
  padding: 1.5rem 0.5rem;
  text-align: center;
  font-size: 0.88rem;
  color: #94a3b8;
}

.ws-history-empty {
  font-size: 0.8rem;
  color: #94a3b8;
  text-align: center;
  padding: 1rem 0;
}

/* ── 右侧画布区 ── */
.ai-ws-canvas-area {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(37, 99, 235, 0.03), transparent 60%),
    #f1f5f9;
}

/* 画布容器 */
.ai-ws-stage-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}

.ai-ws-stage-wrap .konvajs-content {
  width: 100% !important;
  height: 100% !important;
}

/* 画布空状态 */
.ws-canvas-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  color: #94a3b8;
  pointer-events: none;
}

.ws-canvas-empty svg {
  opacity: 0.5;
}

.ws-canvas-empty p {
  margin: 0;
  font-size: 0.9rem;
}

/* 画布图片加载中占位（原图下载中，区别于上传引导空状态） */
.ws-canvas-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  color: #94a3b8;
  pointer-events: none;
}

.ws-canvas-loading svg {
  opacity: 0.5;
  animation: wsCanvasLoadingPulse 1.4s ease-in-out infinite;
}

.ws-canvas-loading p {
  margin: 0;
  font-size: 0.9rem;
}

@keyframes wsCanvasLoadingPulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.75; }
}

/* ── 悬浮组件 ── */

/* 右上角：原图开关 + 导出下拉。默认隐藏，由 JS 在存在结果图时显示。 */
.ws-float-export {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 30;
  display: none;
  align-items: center;
  gap: 0.5rem;
}

.ws-original-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--ws-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transition: border-color 0.15s, box-shadow 0.15s, color 0.15s, background 0.15s;
}

.ws-original-toggle svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.ws-original-toggle:hover {
  border-color: #bfdbfe;
  color: #334155;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.12);
}

.ws-original-toggle.is-active {
  border-color: #93c5fd;
  background: var(--ws-primary-soft);
  color: var(--ws-primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
}

/* 原图隐藏时：按住对比（原图覆盖结果图） */
.ws-compare-hold {
  display: none;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--ws-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transition: border-color 0.15s, box-shadow 0.15s, color 0.15s, background 0.15s;
}

.ws-compare-hold.is-visible {
  display: inline-flex;
}

.ws-compare-hold svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.ws-compare-hold:hover {
  border-color: #bfdbfe;
  color: #334155;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.12);
}

.ws-compare-hold.is-holding {
  border-color: #93c5fd;
  background: var(--ws-primary-soft);
  color: var(--ws-primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
}

.ws-export-dropdown {
  position: relative;
}

.ws-export-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--ws-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ws-export-trigger:hover {
  border-color: #bfdbfe;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.12);
}

.ws-export-trigger svg {
  width: 15px;
  height: 15px;
}

.ws-export-trigger .ws-caret {
  width: 12px;
  height: 12px;
  transition: transform 0.2s;
}

.ws-float-export.is-open .ws-caret {
  transform: rotate(180deg);
}

.ws-export-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  padding: 0.35rem;
  border: 1px solid var(--ws-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.ws-float-export.is-open .ws-export-menu {
  display: block;
}

.ws-export-menu button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: background 0.12s;
}

.ws-export-menu button:hover {
  background: var(--ws-primary-soft);
  color: var(--ws-primary);
}

.ws-export-menu button svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* 右下角信息栏（图标式） */
.ws-float-status {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.7rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--ws-line);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.ws-status-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: var(--ws-muted);
  white-space: nowrap;
}

.ws-status-item svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.ws-status-item strong {
  font-weight: 700;
  color: #334155;
}

.ws-status-divider {
  width: 1px;
  height: 14px;
  background: var(--ws-line);
}

.ws-status-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: var(--ws-muted);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.ws-status-help:hover {
  background: var(--ws-primary-soft);
  color: var(--ws-primary);
}

.ws-status-help svg {
  width: 14px;
  height: 14px;
}

/* 左下角主体统计与左右切换 */
.ws-float-contour-nav {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.45rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--ws-line);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.ws-float-contour-nav[hidden] {
  display: none;
}

.ws-contour-nav-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--ws-line);
  border-radius: 999px;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.ws-contour-nav-btn:hover {
  background: var(--ws-primary-soft);
  border-color: #bfdbfe;
  color: var(--ws-primary);
}

.ws-contour-nav-btn svg {
  width: 14px;
  height: 14px;
}

.ws-contour-nav-count {
  min-width: 52px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

/* 底部多图预览横轴 */
.ws-float-filmstrip {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  right: auto;
  top: auto;
  transform: translateX(-50%);
  z-index: 20;
  display: none;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  max-width: min(92%, 420px);
  max-height: none;
  overflow: visible;
  padding: 0.4rem 0.45rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--ws-line);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
}

.ws-float-filmstrip.is-visible {
  display: flex;
}

.ws-filmstrip-track {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  max-width: calc(6 * 52px + 5 * 0.4rem);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.ws-filmstrip-track::-webkit-scrollbar {
  display: none;
}

.ws-filmstrip-nav {
  flex-shrink: 0;
  display: none;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--ws-line);
  border-radius: 999px;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
}

.ws-float-filmstrip.has-nav .ws-filmstrip-nav {
  display: inline-flex;
}

.ws-filmstrip-nav:hover:not(:disabled) {
  background: var(--ws-primary-soft);
  border-color: #bfdbfe;
  color: var(--ws-primary);
}

.ws-filmstrip-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.ws-filmstrip-nav svg {
  width: 14px;
  height: 14px;
}

.ws-filmstrip-item {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
  flex-shrink: 0;
}

.ws-filmstrip-item:hover {
  transform: scale(1.06);
}

.ws-filmstrip-item.is-active {
  border-color: var(--ws-primary);
}

.ws-filmstrip-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 胶片条上的处理中 / 已完成状态徽标 */
.ws-filmstrip-item.is-processing img {
  filter: brightness(0.6);
}

.ws-filmstrip-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  animation: wsFilmSpin 0.8s linear infinite;
}

@keyframes wsFilmSpin {
  to { transform: rotate(360deg); }
}

.ws-filmstrip-done {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #16a34a
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E")
    center / 11px no-repeat;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* 草稿图删除：悬停时右上角红叉 */
.ws-filmstrip-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  transition: opacity 0.12s, transform 0.12s, background 0.12s;
}

.ws-filmstrip-item:hover .ws-filmstrip-remove,
.ws-filmstrip-item:focus-within .ws-filmstrip-remove,
.ws-filmstrip-remove:focus-visible {
  opacity: 1;
}

.ws-filmstrip-remove:hover {
  background: #dc2626;
  transform: scale(1.08);
}

/* ==========================================================================
   通用 AI 执行按钮组件（模型选择 + 操作按钮组合）
   用法：<div class="ws-ai-exec" data-display="icon-text|icon-only">
   ========================================================================== */

.ws-ai-exec {
  --exec-radius: 12px;
  --exec-h: 46px;
  display: inline-flex;
  align-items: stretch;
  border-radius: var(--exec-radius);
  overflow: visible;
  position: relative;
  width: auto;
}

/* 全宽模式（侧边栏内使用） */
.ws-ai-exec--block {
  width: 100%;
}

/* ── 左侧：模型选择触发器 ── */
.ws-ai-exec-model {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 96px;
  min-width: 96px;
}

.ws-ai-exec-model-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  width: 100%;
  padding: 0 0.42rem;
  height: var(--exec-h);
  border: 1px solid var(--ws-line);
  border-right: none;
  border-radius: var(--exec-radius) 0 0 var(--exec-radius);
  background: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
  overflow: hidden;
}

.ws-ai-exec-model-trigger:hover {
  background: #f8fafc;
  border-color: #bfdbfe;
}

.ws-ai-exec-model-trigger .ws-exec-caret {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.ws-ai-exec-model.is-open .ws-exec-caret {
  transform: rotate(180deg);
}

/* 模型图标（仅通用 / 专家等顶层选项；自定义级联模型不占位） */
.ws-exec-model-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.ws-exec-model-icon.is-hidden,
.ws-exec-model-icon:empty {
  display: none;
  width: 0;
  height: 0;
}

.ws-exec-model-icon svg {
  width: 13px;
  height: 13px;
}

.ws-ai-exec-model-trigger .ws-exec-model-name {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
}

/* ── 模型下拉面板（可挂到 body；用自身 .is-open 控制显隐） ── */
.ws-ai-exec-dropdown {
  display: none;
  position: fixed;
  min-width: 240px;
  padding: 0.4rem;
  border: 1px solid var(--ws-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.14);
  z-index: 10050;
}

.ws-ai-exec-model.is-open .ws-ai-exec-dropdown,
.ws-ai-exec-dropdown.is-open {
  display: block;
  animation: wsExecDropIn 0.16s ease-out;
}

@keyframes wsExecDropIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 模型选项 */
.ws-ai-exec-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}

.ws-ai-exec-option:hover {
  background: var(--ws-primary-soft);
}

.ws-ai-exec-option.is-selected {
  background: var(--ws-primary-soft);
}

.ws-ai-exec-option.is-selected::after {
  content: "";
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

/* 选项图标 */
.ws-exec-option-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.ws-exec-option-icon svg {
  width: 18px;
  height: 18px;
}

.ws-exec-option-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
}

.ws-ai-exec-option strong {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ws-ink);
}

.ws-ai-exec-option span {
  font-size: 0.72rem;
  color: var(--ws-muted);
}

/* 自定义选择 - 级联（JS 用 is-cascade-open 控制，避免移入子菜单间隙时丢失 hover） */
.ws-ai-exec-option--cascade {
  position: relative;
}

.ws-ai-exec-cascade {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
  min-width: 240px; /* 原 160px，加宽 50% 便于阅读长模型名 */
  padding: 0.35rem;
  margin-left: 0;
  border: 1px solid var(--ws-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  z-index: 110;
}

/* 桥接选项与子菜单之间的空隙，降低移入时丢失命中 */
.ws-ai-exec-cascade::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 0;
  bottom: 0;
  width: 10px;
}

.ws-ai-exec-option--cascade.is-cascade-open .ws-ai-exec-cascade,
.ws-ai-exec-option--cascade:hover .ws-ai-exec-cascade {
  display: block;
  animation: wsExecDropIn 0.14s ease-out;
}

.ws-ai-exec-cascade-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: none;
  border-radius: 7px;
  background: transparent;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}

.ws-ai-exec-cascade-item:hover {
  background: var(--ws-primary-soft);
  color: var(--ws-primary);
}

.ws-ai-exec-cascade-item.is-selected {
  color: var(--ws-primary);
}

.ws-exec-cascade-loading {
  display: block;
  padding: 0.5rem 0.65rem;
  font-size: 0.75rem;
  color: var(--ws-muted);
}

/* 级联箭头指示 */
.ws-ai-exec-option--cascade > .ws-exec-cascade-arrow {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  color: var(--ws-muted);
}

/* 移动端：自定义模型底部选择弹层 */
.ws-ai-exec-sheet {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.ws-ai-exec-sheet.is-open {
  pointer-events: auto;
  opacity: 1;
}

.ws-ai-exec-sheet-scrim {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
}

.ws-ai-exec-sheet-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  max-height: min(72vh, 520px);
  display: flex;
  flex-direction: column;
  border-radius: 16px 16px 0 0;
  background: #fff;
  box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.18);
  transform: translateY(100%);
  transition: transform 0.2s ease;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.ws-ai-exec-sheet.is-open .ws-ai-exec-sheet-panel {
  transform: translateY(0);
}

.ws-ai-exec-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem 0.65rem;
  border-bottom: 1px solid var(--ws-line);
}

.ws-ai-exec-sheet-header strong {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ws-ink);
}

.ws-ai-exec-sheet-close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.ws-ai-exec-sheet-list {
  overflow-y: auto;
  padding: 0.45rem 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ws-ai-exec-sheet-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.78rem 0.85rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  font-size: 0.9rem;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.ws-ai-exec-sheet-item:active,
.ws-ai-exec-sheet-item:hover {
  background: var(--ws-primary-soft);
  color: var(--ws-primary);
}

.ws-ai-exec-sheet-item.is-selected {
  background: var(--ws-primary-soft);
  color: var(--ws-primary);
}

.ws-ai-exec-sheet-empty {
  padding: 1.25rem 0.85rem;
  text-align: center;
  color: var(--ws-muted);
  font-size: 0.85rem;
}

/* ── 右侧：AI 操作按钮 ── */
.ws-ai-exec-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  height: var(--exec-h);
  padding: 0 0.8rem;
  border: none;
  border-radius: 0 var(--exec-radius) var(--exec-radius) 0;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s, padding 0.2s;
  user-select: none;
  overflow: hidden;
}

/* ── 中间：AI 提示词图标（仅画布悬浮场景插入） ── */
.ws-ai-exec-prompt {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  min-width: 36px;
  height: var(--exec-h);
  padding: 0;
  border: 1px solid var(--ws-line);
  border-left: none;
  border-right: none;
  background: #fff;
  color: #4f46e5;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.ws-ai-exec-prompt:hover {
  background: #eef2ff;
  color: #4338ca;
}

.ws-ai-exec-prompt > svg {
  width: 16px;
  height: 16px;
}

.ws-ai-exec-action:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.ws-ai-exec-action:active:not(:disabled) {
  transform: translateY(0);
}

.ws-ai-exec-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.ws-ai-exec-action > svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* 按钮文字 */
.ws-ai-exec-action-text {
  display: inline-block;
  max-width: 7.5em;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: max-width 0.25s ease, opacity 0.2s ease;
  opacity: 1;
}

/* 预计积分：图标 + 数字（对齐顶部导航 flash 积分图，保持完整比例） */
.ws-ai-exec-points {
  display: inline-flex;
  align-items: center;
  gap: 0.14rem;
  margin-left: 0.05rem;
  padding-left: 0.38rem;
  border-left: 1px solid rgba(255, 255, 255, 0.32);
  line-height: 1;
  flex-shrink: 0;
}

.ws-ai-exec-points-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  overflow: visible;
}

.ws-ai-exec-points-icon {
  width: 14px;
  height: 14px;
  max-width: 14px;
  max-height: 14px;
  display: block;
  object-fit: contain;
  object-position: center;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
}

.ws-ai-exec-points-value {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  min-width: 0.75em;
  line-height: 1;
}

/* 仅图标策略 */
.ws-ai-exec[data-display="icon-only"] .ws-ai-exec-action {
  padding: 0 0.75rem;
}

.ws-ai-exec[data-display="icon-only"] .ws-ai-exec-action-text,
.ws-ai-exec[data-display="icon-only"] .ws-ai-exec-points {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
  border: none;
}

.ws-ai-exec[data-display="icon-only"] .ws-ai-exec-action:hover .ws-ai-exec-action-text,
.ws-ai-exec[data-display="icon-only"] .ws-ai-exec-action:hover .ws-ai-exec-points {
  max-width: 200px;
  opacity: 1;
}

.ws-ai-exec[data-display="icon-only"] .ws-ai-exec-action:hover .ws-ai-exec-points {
  margin-left: 0.05rem;
  padding-left: 0.38rem;
  border-left: 1px solid rgba(255, 255, 255, 0.32);
}

.ws-ai-exec[data-display="icon-only"] .ws-ai-exec-action:hover {
  padding: 0 0.85rem;
}

/* 全宽模式下按钮撑满剩余空间 */
.ws-ai-exec--block .ws-ai-exec-action {
  flex: 1;
}

/* 加载中状态 */
.ws-ai-exec-action.is-loading {
  pointer-events: none;
  opacity: 0.75;
}

.ws-ai-exec-action.is-loading .ws-ai-exec-action-text::after {
  content: "…";
}

/* ── AI扩图：跟随图片容器右上角的悬浮操作条 ── */
.ws-expand-toolbar {
  position: absolute;
  z-index: 36;
  display: none;
  align-items: center;
  gap: 0.4rem;
  width: max-content;
  max-width: none;
  padding: 0.3rem;
  border: 1px solid var(--ws-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  pointer-events: auto;
  overflow: visible;
}

.ws-expand-toolbar.is-visible {
  display: inline-flex;
}

.ws-expand-exec-host {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  flex: 0 0 auto;
}

.ws-expand-exec-host .ws-ai-exec {
  --exec-radius: 10px;
  --exec-h: 36px;
  height: var(--exec-h);
  box-shadow: none;
}

/* 画布场景：提示词按钮默认收起，悬停/展开时与模型选择一并露出 */
.ws-expand-exec-host .ws-ai-exec-prompt {
  display: inline-flex;
  width: 0;
  min-width: 0;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  border: none;
  padding: 0;
  pointer-events: none;
  transition: max-width 0.22s ease, width 0.22s ease, min-width 0.22s ease, opacity 0.18s ease, border-color 0.15s, background 0.15s;
}

.ws-expand-exec-host .ws-ai-exec--has-prompt .ws-ai-exec-action {
  border-radius: var(--exec-radius);
}

/* 默认收起：只显示功能图标；悬停/展开时露出模型选择 + 提示词 + 文案 */
.ws-expand-exec-host .ws-ai-exec-model {
  width: 0;
  min-width: 0;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  border: none;
  transition: max-width 0.22s ease, width 0.22s ease, min-width 0.22s ease, opacity 0.18s ease;
  pointer-events: none;
}

.ws-expand-exec-host:hover .ws-ai-exec-model,
.ws-expand-exec-host:focus-within .ws-ai-exec-model,
.ws-expand-exec-host.is-open .ws-ai-exec-model {
  width: 96px;
  min-width: 96px;
  max-width: 96px;
  opacity: 1;
  overflow: visible;
  pointer-events: auto;
}

.ws-expand-exec-host:hover .ws-ai-exec-prompt,
.ws-expand-exec-host:focus-within .ws-ai-exec-prompt,
.ws-expand-exec-host.is-open .ws-ai-exec-prompt {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  opacity: 1;
  overflow: visible;
  pointer-events: auto;
  border: 1px solid var(--ws-line);
  border-left: none;
  border-right: none;
  border-radius: 0;
}

.ws-expand-exec-host:hover .ws-ai-exec--has-prompt .ws-ai-exec-action,
.ws-expand-exec-host:focus-within .ws-ai-exec--has-prompt .ws-ai-exec-action,
.ws-expand-exec-host.is-open .ws-ai-exec--has-prompt .ws-ai-exec-action {
  border-radius: 0 var(--exec-radius) var(--exec-radius) 0;
}

.ws-expand-exec-host .ws-ai-exec-model-trigger {
  height: var(--exec-h);
  border-color: var(--ws-line);
}

/* 仅图标态：正方形按钮，去掉右侧空隙 */
.ws-expand-exec-host .ws-ai-exec-action {
  height: var(--exec-h);
  width: 36px;
  min-width: 36px;
  padding: 0;
  gap: 0;
  border-radius: var(--exec-radius);
  transition: border-radius 0.2s ease, padding 0.2s ease, min-width 0.2s ease, width 0.2s ease, gap 0.2s ease;
}

.ws-expand-exec-host .ws-ai-exec[data-display="icon-only"] .ws-ai-exec-action-text {
  display: none;
  max-width: 0;
  opacity: 0;
}

.ws-expand-exec-host .ws-ai-exec[data-display="icon-only"] .ws-ai-exec-points {
  display: none;
  max-width: 0;
  opacity: 0;
  margin: 0;
  padding: 0;
  border: none;
}

.ws-expand-exec-host:hover .ws-ai-exec-action,
.ws-expand-exec-host:focus-within .ws-ai-exec-action,
.ws-expand-exec-host.is-open .ws-ai-exec-action {
  width: auto;
  min-width: 72px;
  padding: 0 0.72rem;
  gap: 0.28rem;
  border-radius: 0 var(--exec-radius) var(--exec-radius) 0;
}

.ws-expand-exec-host:hover .ws-ai-exec[data-display="icon-only"] .ws-ai-exec-action-text,
.ws-expand-exec-host:focus-within .ws-ai-exec[data-display="icon-only"] .ws-ai-exec-action-text,
.ws-expand-exec-host.is-open .ws-ai-exec[data-display="icon-only"] .ws-ai-exec-action-text {
  display: inline-block;
  max-width: 200px;
  opacity: 1;
}

.ws-expand-exec-host:hover .ws-ai-exec[data-display="icon-only"] .ws-ai-exec-points,
.ws-expand-exec-host:focus-within .ws-ai-exec[data-display="icon-only"] .ws-ai-exec-points,
.ws-expand-exec-host.is-open .ws-ai-exec[data-display="icon-only"] .ws-ai-exec-points {
  display: inline-flex;
  max-width: 200px;
  opacity: 1;
  margin-left: 0.05rem;
  padding-left: 0.32rem;
  border-left: 1px solid rgba(255, 255, 255, 0.32);
}

.ws-expand-exec-host .ws-ai-exec-points-icon-wrap {
  width: 12px;
  height: 12px;
  flex-basis: 12px;
}

.ws-expand-exec-host .ws-ai-exec-points-icon {
  width: 12px;
  height: 12px;
  max-width: 12px;
  max-height: 12px;
}

.ws-expand-exec-host .ws-ai-exec-points-value {
  font-size: 0.7rem;
}

/* 覆盖全局 icon-only hover 加宽，避免仅图标态右侧留白 */
.ws-expand-exec-host .ws-ai-exec[data-display="icon-only"] .ws-ai-exec-action:hover {
  padding: 0;
}

.ws-expand-exec-host:hover .ws-ai-exec[data-display="icon-only"] .ws-ai-exec-action:hover,
.ws-expand-exec-host:focus-within .ws-ai-exec[data-display="icon-only"] .ws-ai-exec-action:hover,
.ws-expand-exec-host.is-open .ws-ai-exec[data-display="icon-only"] .ws-ai-exec-action:hover {
  padding: 0 0.72rem;
}

.ws-expand-restore {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--ws-line);
  border-radius: 10px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  flex: 0 0 auto;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.ws-expand-restore svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.ws-expand-restore:hover {
  border-color: #cbd5e1;
  color: #0f172a;
  background: #f8fafc;
}

.ws-config-tip {
  margin: 0;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  color: var(--ws-muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

/* 桌面端隐藏移动端返回/底部面板；移动端在下方 media 中显示 */
.ws-nav-back,
.ws-mobile-dock,
.ws-mobile-batch-sheet {
  display: none;
}

/* ── 响应式 ── */
@media (max-width: 992px) {
  .ai-ws {
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    min-height: 0;
    margin-top: 0;
    padding-top: env(safe-area-inset-top, 0px);
    box-sizing: border-box;
    overflow: hidden;
  }

  .ai-ws-nav {
    position: relative;
    width: 100%;
    min-width: 100%;
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    padding: 0.7rem 0.75rem 0.55rem;
    border-right: none;
    border-bottom: 1px solid var(--ws-line);
  }

  .ws-nav-tab {
    width: auto;
    padding: 0.45rem 0.75rem;
  }

  .ws-nav-back {
    display: flex;
  }

  .ws-nav-close {
    display: none !important;
  }

  .ai-ws-sidebar {
    width: 100%;
    min-width: 100%;
    flex: 0 1 auto;
    max-height: 42vh;
    border-right: none;
    border-bottom: 1px solid var(--ws-line);
    overflow: hidden;
  }

  /* 上半部分内容可滑，但不显示滚动条 */
  .ai-ws-sidebar-body,
  .ws-tab-panel[data-ws-panel="tool"].is-active,
  .ws-tab-panel[data-ws-panel="history"].is-active,
  .ws-history-list {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .ai-ws-sidebar-body::-webkit-scrollbar,
  .ws-tab-panel[data-ws-panel="tool"].is-active::-webkit-scrollbar,
  .ws-tab-panel[data-ws-panel="history"].is-active::-webkit-scrollbar,
  .ws-history-list::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }

  .ai-ws-canvas-area {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
  }

  .ai-ws-stage-wrap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  /* 悬浮控件改由底部面板承载 */
  .ai-ws-canvas-area > .ws-float-export,
  .ai-ws-canvas-area > .ws-float-status,
  .ws-float-filmstrip {
    display: none !important;
  }

  .ws-mobile-dock {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    min-height: 56px;
    padding: 0.45rem 0.7rem;
    padding-bottom: max(0.45rem, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--ws-line);
    z-index: 40;
  }

  .ws-mobile-dock-thumb {
    position: relative;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 2px solid var(--ws-line);
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
    cursor: pointer;
  }

  .ws-mobile-dock-thumb.is-batch {
    border-color: #93c5fd;
  }

  .ws-mobile-dock-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .ws-mobile-dock-thumb-badge {
    position: absolute;
    right: 2px;
    bottom: 2px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    line-height: 14px;
    text-align: center;
  }

  .ws-mobile-dock-thumb-badge.is-spinner {
    inset: auto;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: 16px;
    height: 16px;
    min-width: 16px;
    margin: -8px 0 0 -8px;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    animation: wsFilmSpin 0.8s linear infinite;
  }

  .ws-mobile-dock-thumb.is-processing img {
    filter: brightness(0.6);
  }

  .ws-mobile-dock-thumb-badge.is-done {
    right: 2px;
    bottom: 2px;
    width: 14px;
    height: 14px;
    min-width: 14px;
    padding: 0;
    background: #16a34a
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E")
      center / 10px no-repeat;
  }

  .ws-mobile-dock-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
  }

  .ws-mobile-dock .ws-float-export {
    position: static;
    top: auto;
    right: auto;
    display: none;
    align-items: center;
    gap: 0.35rem;
    z-index: auto;
  }

  .ws-mobile-dock .ws-original-toggle,
  .ws-mobile-dock .ws-export-trigger {
    padding: 0.4rem 0.55rem;
    font-size: 0.72rem;
    border-radius: 8px;
    box-shadow: none;
    backdrop-filter: none;
    background: #fff;
  }

  .ws-mobile-dock .ws-original-toggle svg,
  .ws-mobile-dock .ws-export-trigger svg {
    width: 13px;
    height: 13px;
  }

  .ws-mobile-dock .ws-export-menu {
    top: auto;
    bottom: calc(100% + 6px);
    right: 0;
  }

  .ws-mobile-dock-meta {
    margin-left: auto;
    display: flex;
    align-items: center;
    min-width: 0;
  }

  .ws-mobile-dock .ws-float-status {
    position: static;
    bottom: auto;
    right: auto;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .ws-mobile-dock .ws-status-item {
    gap: 0.2rem;
  }

  .ws-mobile-dock .ws-status-item svg {
    width: 12px;
    height: 12px;
  }

  .ws-mobile-dock .ws-size-label,
  .ws-mobile-dock .ws-zoom-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #475569;
  }

  .ws-mobile-dock .ws-status-help,
  .ws-mobile-dock .ws-float-status > .ws-status-divider:nth-last-child(2) {
    display: none;
  }

  /* 批量图片底部弹层 */
  .ws-mobile-batch-sheet {
    position: fixed;
    inset: 0;
    z-index: 1210;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s ease;
  }

  .ws-mobile-batch-sheet.is-open {
    pointer-events: auto;
    opacity: 1;
  }

  .ws-mobile-batch-scrim {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
  }

  .ws-mobile-batch-panel {
    position: relative;
    z-index: 1;
    width: min(100%, 480px);
    max-height: min(70vh, 520px);
    display: flex;
    flex-direction: column;
    border-radius: 16px 16px 0 0;
    background: #fff;
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.18);
    transform: translateY(100%);
    transition: transform 0.2s ease;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .ws-mobile-batch-sheet.is-open .ws-mobile-batch-panel {
    transform: translateY(0);
  }

  .ws-mobile-batch-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem 0.65rem;
    border-bottom: 1px solid var(--ws-line);
  }

  .ws-mobile-batch-header strong {
    font-size: 0.95rem;
    font-weight: 800;
  }

  .ws-mobile-batch-close {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
  }

  .ws-mobile-batch-list {
    overflow-y: auto;
    padding: 0.45rem 0.65rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    scrollbar-width: none;
  }

  .ws-mobile-batch-list::-webkit-scrollbar {
    display: none;
  }

  .ws-mobile-batch-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid transparent;
    border-radius: 12px;
    background: #f8fafc;
    text-align: left;
    cursor: pointer;
  }

  .ws-mobile-batch-item.is-active {
    border-color: #93c5fd;
    background: var(--ws-primary-soft);
  }

  .ws-mobile-batch-item img {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
  }

  .ws-mobile-batch-item-text {
    min-width: 0;
    display: grid;
    gap: 0.12rem;
    flex: 1;
  }

  .ws-mobile-batch-item-text strong {
    font-size: 0.86rem;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ws-mobile-batch-item-text small {
    font-size: 0.72rem;
    color: #64748b;
  }

  .ws-mobile-batch-item .ws-filmstrip-spinner,
  .ws-mobile-batch-item .ws-filmstrip-done {
    position: static;
    flex-shrink: 0;
    margin-left: auto;
  }

  .ws-mobile-batch-remove {
    flex-shrink: 0;
    margin-left: auto;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #fee2e2;
    color: #dc2626;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
  }

  /* 移动端：自定义选择不显示右侧级联箭头/子菜单，改用底部列表 */
  .ws-exec-cascade-arrow,
  .ws-ai-exec-cascade {
    display: none !important;
  }
}

/* ── AI换背景：模板选择 ── */
.ws-template-slot {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ws-template-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 92px;
  padding: 0.85rem;
  border: 1.5px dashed #cbd5e1;
  border-radius: var(--ws-radius);
  background: #f8fafc;
  color: var(--ws-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.ws-template-empty:hover {
  border-color: var(--ws-primary);
  background: var(--ws-primary-soft);
  color: var(--ws-primary);
}

.ws-template-selected {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 0.7rem;
  padding: 0.55rem;
  border: 1px solid var(--ws-line);
  border-radius: var(--ws-radius);
  background: #fff;
}

.ws-template-selected-cover {
  width: 72px;
  height: 90px;
  border-radius: 8px;
  overflow: hidden;
  background: #f1f5f9;
}

.ws-template-selected-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ws-template-selected-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
  min-width: 0;
}

.ws-template-selected-meta strong {
  font-size: 0.86rem;
  color: var(--ws-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-template-selected-meta span {
  font-size: 0.74rem;
  color: var(--ws-muted);
}

.ws-template-change {
  align-self: flex-start;
  margin-top: 0.2rem;
  border: none;
  background: none;
  padding: 0;
  color: var(--ws-primary);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.ws-template-change:hover {
  text-decoration: underline;
}

body.ws-tpl-modal-open {
  overflow: hidden;
}

.ws-tpl-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.ws-tpl-modal[hidden] {
  display: none !important;
}

.ws-tpl-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.ws-tpl-modal-card {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: min(88vh, 820px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.ws-tpl-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem 0.85rem;
  border-bottom: 1px solid var(--ws-line);
}

.ws-tpl-modal-head h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--ws-ink);
}

.ws-tpl-modal-head p {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--ws-muted);
}

.ws-tpl-modal-close {
  border: none;
  background: #f1f5f9;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #64748b;
  cursor: pointer;
}

.ws-tpl-modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.ws-tpl-modal-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  padding: 0.85rem 1.25rem;
}

.ws-tpl-modal-body {
  flex: 1;
  overflow: auto;
  padding: 0 1.25rem 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.85rem;
  align-content: start;
}

.ws-tpl-empty {
  grid-column: 1 / -1;
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--ws-muted);
  font-size: 0.88rem;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
}

.ws-tpl-card {
  display: flex;
  flex-direction: column;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  padding: 0;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.ws-tpl-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.ws-tpl-card.is-selected {
  border-color: var(--ws-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.ws-tpl-card-cover {
  display: block;
  aspect-ratio: 4 / 5;
  background: #f1f5f9;
  overflow: hidden;
}

.ws-tpl-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ws-tpl-card-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #94a3b8;
  font-size: 0.75rem;
}

.ws-tpl-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.65rem 0.7rem;
  min-width: 0;
}

.ws-tpl-card-body strong {
  font-size: 0.8rem;
  color: var(--ws-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-tpl-card-body span {
  font-size: 0.72rem;
  color: var(--ws-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-tpl-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem 1rem;
  border-top: 1px solid var(--ws-line);
}

.ws-tpl-page-info {
  margin-right: auto;
  font-size: 0.78rem;
  color: var(--ws-muted);
}

@media (max-width: 640px) {
  .ws-tpl-modal-card {
    max-height: 92vh;
  }
  .ws-tpl-modal-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── AI改文字：贴图片右侧的悬浮文字列表 ── */
.ws-text-edit-panel {
  --ws-text-panel-width: 280px;
  --ws-text-row-h: 44px;
  position: absolute;
  z-index: 36;
  display: none;
  flex-direction: column;
  width: var(--ws-text-panel-width);
  max-width: calc(100% - 16px);
  max-height: min(calc(52px + 10 * var(--ws-text-row-h)), calc(100% - 16px));
  padding: 0;
  border: 1px solid var(--ws-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  pointer-events: auto;
  overflow: hidden;
}

.ws-text-edit-panel.is-visible {
  display: flex;
}

.ws-text-edit-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--ws-line);
  flex: 0 0 auto;
}

.ws-text-edit-toolbar .ws-expand-exec-host {
  flex: 0 0 auto;
}

.ws-text-edit-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(10 * var(--ws-text-row-h));
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.55rem 0.6rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overscroll-behavior: contain;
}

.ws-text-edit-empty {
  margin: 0;
  padding: 0.9rem 0.75rem;
  color: var(--ws-muted);
  font-size: 0.82rem;
  text-align: center;
}

.ws-text-edit-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 0.35rem;
  align-items: start;
  flex: 0 0 auto;
}

.ws-text-edit-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  margin-top: 4px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--ws-muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.ws-text-edit-input {
  width: 100%;
  min-height: 36px;
  max-height: 72px;
  resize: none;
  overflow: auto;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--ws-line);
  border-radius: 10px;
  background: #fff;
  color: var(--ws-text);
  font-size: 0.84rem;
  line-height: 1.35;
  font-family: inherit;
}

.ws-text-edit-input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.ws-text-edit-row.is-changed .ws-text-edit-input {
  border-color: rgba(234, 179, 8, 0.65);
  background: rgba(254, 243, 199, 0.35);
}

.ws-text-edit-row.is-changed .ws-text-edit-index {
  background: rgba(234, 179, 8, 0.18);
  color: #92400e;
}

@media (max-width: 992px) {
  .ws-text-edit-panel {
    --ws-text-panel-width: 240px;
  }
}

/* 画布悬浮执行按钮：text-only 默认只显示文字（无图标），悬停展开模型/提示词 */
.ws-expand-exec-host .ws-ai-exec[data-display="text-only"] .ws-ai-exec-action {
  width: auto;
  min-width: 64px;
  padding: 0 0.72rem;
  gap: 0.28rem;
}

.ws-expand-exec-host .ws-ai-exec[data-display="text-only"] .ws-ai-exec-action > svg {
  display: none;
}

.ws-expand-exec-host .ws-ai-exec[data-display="text-only"] .ws-ai-exec-action-text,
.ws-expand-exec-host .ws-ai-exec[data-display="text-only"] .ws-ai-exec-points {
  display: inline-flex;
  max-width: 200px;
  opacity: 1;
  overflow: visible;
}

.ws-expand-exec-host .ws-ai-exec[data-display="text-only"] .ws-ai-exec-points {
  margin-left: 0.05rem;
  padding-left: 0.32rem;
  border-left: 1px solid rgba(255, 255, 255, 0.32);
}

.ws-expand-exec-host:hover .ws-ai-exec[data-display="text-only"] .ws-ai-exec-action,
.ws-expand-exec-host:focus-within .ws-ai-exec[data-display="text-only"] .ws-ai-exec-action,
.ws-expand-exec-host.is-open .ws-ai-exec[data-display="text-only"] .ws-ai-exec-action {
  width: auto;
  min-width: 72px;
  padding: 0 0.72rem;
  gap: 0.28rem;
  border-radius: 0 var(--exec-radius) var(--exec-radius) 0;
}

/* ── AI改图：选中轮廓操作条 ── */
.ws-edit-toolbar {
  position: absolute;
  z-index: 36;
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: max-content;
  max-width: min(96vw, 560px);
  padding: 0;
  border: 1px solid var(--ws-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  pointer-events: auto;
  overflow: visible;
}

.ws-edit-toolbar.is-visible {
  display: flex;
}

.ws-edit-toolbar-row {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0.3rem;
}

.ws-edit-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ws-edit-action-btn {
  height: 36px;
  padding: 0 0.7rem;
  border: 1px solid var(--ws-line);
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ws-edit-action-btn:hover:not(:disabled) {
  background: #f8fafc;
  border-color: rgba(59, 130, 246, 0.45);
  color: #1d4ed8;
}

.ws-edit-action-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* 图标按钮：消除 / 抠除 / 标记 */
.ws-edit-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  padding: 0;
  color: #334155;
}

.ws-draw-prompt-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.42);
}

.ws-draw-prompt-overlay.is-open,
.ws-draw-prompt-overlay:not([hidden]) {
  display: flex;
}

.ws-draw-prompt-card {
  width: min(420px, 100%);
  padding: 1.1rem 1.15rem 1rem;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
}

.ws-draw-prompt-card h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

.ws-draw-prompt-hint {
  margin: 0.45rem 0 0.7rem;
  font-size: 0.86rem;
  color: #64748b;
}

.ws-draw-prompt-card .ws-textarea {
  width: 100%;
  min-height: 96px;
}

.ws-draw-prompt-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

/* ── AI 提示词弹窗（画布执行按钮中间入口） ── */
.ws-ai-prompt-overlay {
  position: fixed;
  inset: 0;
  z-index: 1210;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.ws-ai-prompt-overlay.is-open,
.ws-ai-prompt-overlay:not([hidden]) {
  display: flex;
}

.ws-ai-prompt-scrim {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
}

.ws-ai-prompt-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  padding: 1.05rem 1.15rem 1rem;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
}

.ws-ai-prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.ws-ai-prompt-header strong {
  font-size: 1.02rem;
  font-weight: 700;
  color: #0f172a;
}

.ws-ai-prompt-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.ws-ai-prompt-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.ws-ai-prompt-hint {
  margin: 0.4rem 0 0.65rem;
  font-size: 0.84rem;
  color: #64748b;
}

.ws-ai-prompt-input {
  width: 100%;
  min-height: 104px;
  resize: vertical;
}

.ws-ai-prompt-footer {
  display: flex;
  margin-top: 0.9rem;
}

.ws-ai-prompt-footer .ws-ai-exec {
  width: 100%;
  --exec-h: 46px;
  --exec-radius: 12px;
}

.ws-ai-exec.is-in-prompt-dialog .ws-ai-exec-prompt {
  display: none !important;
}

.ws-ai-exec.is-in-prompt-dialog .ws-ai-exec-model {
  width: 96px;
  min-width: 96px;
  max-width: 96px;
  opacity: 1;
  overflow: visible;
  pointer-events: auto;
}

/* 与标准 AI 执行按钮左侧模型区保持一致 */
.ws-ai-exec.is-in-prompt-dialog .ws-ai-exec-model-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  width: 100%;
  height: var(--exec-h);
  padding: 0 0.42rem;
  border: 1px solid var(--ws-line);
  border-right: none;
  border-radius: var(--exec-radius) 0 0 var(--exec-radius);
  background: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  color: #334155;
  box-shadow: none;
}

.ws-ai-exec.is-in-prompt-dialog .ws-ai-exec-model-trigger:hover {
  background: #f8fafc;
  border-color: #bfdbfe;
}

.ws-ai-exec.is-in-prompt-dialog .ws-ai-exec-action {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  height: var(--exec-h);
  padding: 0 0.8rem;
  gap: 0.28rem;
  border-radius: 0 var(--exec-radius) var(--exec-radius) 0;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.ws-ai-exec.is-in-prompt-dialog .ws-ai-exec-action-text,
.ws-ai-exec.is-in-prompt-dialog .ws-ai-exec-points {
  display: inline-flex;
  max-width: none;
  opacity: 1;
  overflow: visible;
}

.ws-ai-exec.is-in-prompt-dialog[data-display="icon-only"] .ws-ai-exec-action-text {
  display: inline-block;
  max-width: 200px;
  opacity: 1;
  overflow: visible;
  margin: 0;
  padding: 0;
}

.ws-ai-exec.is-in-prompt-dialog[data-display="icon-only"] .ws-ai-exec-points {
  display: inline-flex;
  max-width: 200px;
  opacity: 1;
  overflow: visible;
  margin-left: 0.05rem;
  padding-left: 0.38rem;
  border-left: 1px solid rgba(255, 255, 255, 0.32);
}

/* ── AI改图：标记改图窗口 UI ── */
.ws-mark-window {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  z-index: 37;
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  width: max-content;
  min-width: 180px;
  max-width: min(84vw, 320px);
  padding: 0.6rem;
  border: 1px solid var(--ws-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16);
  pointer-events: auto;
}

.ws-mark-window.is-visible {
  display: flex;
}

/* 标记号绝对定位在文本域内开头，输入文本通过 JS 顶部内边距从其下方换行开始 */
.ws-mark-input-wrap {
  position: relative;
}

.ws-mark-input {
  display: block;
  width: 240px;
  max-width: 100%;
  min-height: 96px;
  max-height: 220px;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--ws-line);
  border-radius: 8px;
  background: #f8fafc;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #0f172a;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s ease;
}

.ws-mark-input:focus {
  border-color: #93c5fd;
  background: #fff;
}

/* 标记队列：绝对定位于文本域内顶部，输入文本与其换行显示 */
.ws-mark-queue {
  position: absolute;
  top: 0.4rem;
  left: 0.5rem;
  right: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  pointer-events: none;
}

.ws-mark-queue:empty {
  display: none;
}

.ws-mark-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  pointer-events: auto;
}

.ws-mark-chip-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 0.3rem;
  border: none;
  border-radius: 50%;
  background: #0ea5e9;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s;
}

.ws-mark-chip-num:hover,
.ws-mark-chip.is-open .ws-mark-chip-num {
  background: #0284c7;
}

/* 点击标记展开的预览弹层 */
.ws-mark-chip-pop {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  width: 180px;
  padding: 0.55rem;
  border: 1px solid var(--ws-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
}

.ws-mark-chip.is-open .ws-mark-chip-pop {
  display: block;
}

.ws-mark-pop-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #0369a1;
  margin-bottom: 0.4rem;
  padding-right: 1.9rem;
}

.ws-mark-pop-img {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 128px;
  border-radius: 8px;
  background: #f1f5f9;
  overflow: hidden;
}

.ws-mark-pop-img img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* 预览弹层右上角删除按钮 */
.ws-mark-pop-del {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--ws-line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.94);
  color: #ef4444;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.ws-mark-pop-del:hover {
  background: #fef2f2;
  border-color: #fecaca;
}

/* 标记场景 AI改图执行按钮：宽度占满整行 */
.ws-mark-actions {
  display: flex;
}

.ws-mark-exec-host {
  width: 100%;
}

.ws-mark-exec-host .ws-ai-exec {
  width: 100%;
}

/* 标记场景 AI改图按钮：默认展开模型选择 */
.ws-mark-exec-host .ws-ai-exec-model {
  width: 96px;
  min-width: 96px;
  max-width: 96px;
  opacity: 1;
  overflow: visible;
  pointer-events: auto;
}

.ws-mark-exec-host .ws-ai-exec-model-trigger {
  height: var(--exec-h);
  border: 1px solid var(--ws-line);
  border-right: none;
  border-radius: var(--exec-radius) 0 0 var(--exec-radius);
}

.ws-mark-exec-host .ws-ai-exec-action {
  flex: 1 1 auto;
  width: auto;
  min-width: 72px;
  padding: 0 0.72rem;
  gap: 0.28rem;
  border-radius: 0 var(--exec-radius) var(--exec-radius) 0;
}

.ws-mark-exec-host .ws-ai-exec-action-text,
.ws-mark-exec-host .ws-ai-exec-points {
  display: inline-flex;
  max-width: 200px;
  opacity: 1;
  overflow: visible;
}

.ws-mark-exec-host .ws-ai-exec-points {
  margin-left: 0.05rem;
  padding-left: 0.32rem;
  border-left: 1px solid rgba(255, 255, 255, 0.32);
}
