/* Extracted from index.html. Auto Task layout, upload strip, result gallery, and project state styles. */

/* ── Auto Task（亚马逊素材 MVP）：布局与超级香蕉 区共用设计语言 ── */
#ai-auto.panel.clean {
  padding-top: 8px;
}

.ai-auto-panel-stack {
  position: relative;
  min-height: 240px;
}

.ai-auto-admin-gate {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  box-sizing: border-box;
  background: color-mix(in srgb, var(--surface, #fff) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 12px;
}

html.theme-dark .ai-auto-admin-gate {
  background: color-mix(in srgb, var(--surface, #1c1c1e) 92%, transparent);
}

.ai-auto-admin-gate[hidden] {
  display: none !important;
}

.ai-auto-admin-gate-msg {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  letter-spacing: 0.02em;
}

.auto-task-layout.ai-auto-content-root--locked {
  pointer-events: none;
  user-select: none;
  filter: grayscale(0.25) opacity(0.45);
}

.auto-task-layout {
  max-width: 950px;
  margin: 0 auto;
  padding: 0 0 56px;
}

.auto-task-header {
  margin-bottom: 24px;
}

.auto-task-title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.auto-task-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 800px) {
  .auto-task-grid {
    grid-template-columns: 1fr;
  }
}

.auto-task-card {
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  padding: 18px 18px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

html.theme-dark .auto-task-card {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.auto-task-card--wide {
  grid-column: 1 / -1;
}

.auto-task-card h3 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

/* Auto Task：上传区高度随内容（105px 槽 + 按钮约 36px + 间距），避免固定高度 < 实际高度导致裁切与竖向滚动条 */
#ai-auto {
  --auto-task-slot-px: 105px;
  --auto-task-strip-gap: 10px;
  /* 固定为 8 格总宽：一键出图始终对齐第 8 张参考图右缘 */
  --auto-task-strip-8-cols-width: calc(
    8 * var(--auto-task-slot-px) + 7 * var(--auto-task-strip-gap)
  );
  /* 可选：仅设置「最低高度」，不设死外框，避免中间被 flex 撑出大空白 */
  --auto-task-upload-block-min-height: 0;
  /* 一键出图成功后下方展示区域高度，可改为任意 px */
  --auto-task-post-run-block-height: 480px;
  /* 自由发挥开关打开态 */
  --auto-task-switch-on: #35c759;
  /* 参考行固定高度：与输入框一致，切换文案/输入时不撑高外框、不挤动一键出图 */
  --auto-task-ref-control-height: 36px;
}

.auto-task-upload-block {
  min-height: var(--auto-task-upload-block-min-height);
  height: auto;
  max-height: none;
  box-sizing: border-box;
  padding-bottom: 5px;
  overflow-x: hidden;
  overflow-y: visible;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 0;
  flex-shrink: 0;
}

/* 固定 8 列总宽：一键出图右缘对齐第 8 张图，不随当前张数变窄 */
#ai-auto .auto-task-strip-stack {
  width: var(--auto-task-strip-8-cols-width);
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  box-sizing: border-box;
}

/* 自由发挥 + 一键出图：同一行、同一栏宽（与上传条 stack 对齐） */
#ai-auto .auto-task-bottom-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: var(--auto-task-ref-control-height);
  flex-shrink: 0;
  box-sizing: border-box;
}

#ai-auto .auto-task-bottom-row .auto-task-ref-row {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

#ai-auto .auto-task-bottom-row .auto-task-actions {
  flex: 0 0 auto;
  width: auto;
  margin-top: 0;
}

#ai-auto .auto-task-bottom-row .auto-task-model-select {
  flex: 0 0 168px;
  width: 168px;
  height: var(--auto-task-ref-control-height);
  min-height: var(--auto-task-ref-control-height);
  box-sizing: border-box;
  padding: 0 30px 0 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  outline: none;
}

#ai-auto .auto-task-bottom-row .auto-task-model-select:focus {
  border-color: rgba(0, 113, 227, 0.45);
  box-shadow: 0 0 0 2px rgba(0, 113, 227, 0.12);
}

html.theme-dark #ai-auto .auto-task-bottom-row .auto-task-model-select {
  border-color: rgba(255, 255, 255, 0.12);
  background: #242424;
}

/* 上传条与一键出图之间：参考链接 / 自由发挥 */
.auto-task-ref-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: var(--auto-task-ref-control-height);
  flex-shrink: 0;
}

.auto-task-ios-switch {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  cursor: pointer;
  vertical-align: middle;
}

.auto-task-ios-switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}

/* 小号 iOS 风格开关，打开色 #35c759 */
.auto-task-ios-switch-track {
  display: block;
  width: 40px;
  height: 24px;
  border-radius: 12px;
  background: #e9e9ea;
  transition: background 0.22s ease;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.auto-task-ios-switch-input:focus-visible + .auto-task-ios-switch-track {
  outline: 2px solid var(--blue, #0071e3);
  outline-offset: 2px;
}

.auto-task-ios-switch-input:checked + .auto-task-ios-switch-track {
  background: var(--auto-task-switch-on, #35c759);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.auto-task-ios-switch-track::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.14),
    0 1px 1px rgba(0, 0, 0, 0.06);
}

.auto-task-ios-switch-input:checked + .auto-task-ios-switch-track::after {
  transform: translateX(16px);
}

html.theme-dark .auto-task-ios-switch-track {
  background: #39393d;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

html.theme-dark .auto-task-ios-switch-input:checked + .auto-task-ios-switch-track {
  background: var(--auto-task-switch-on, #35c759);
}

.auto-task-ref-right {
  flex: 1;
  min-width: 0;
  height: var(--auto-task-ref-control-height);
  min-height: var(--auto-task-ref-control-height);
  display: flex;
  align-items: center;
  overflow: hidden;
}

.auto-task-ref-free-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: var(--auto-task-ref-control-height);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auto-task-ref-url-input {
  width: 33.333%;
  max-width: 100%;
  min-width: 0;
  flex-shrink: 0;
  height: var(--auto-task-ref-control-height);
  box-sizing: border-box;
  padding: 0 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

.auto-task-ref-url-input::placeholder {
  color: var(--muted);
}

.auto-task-ref-url-input:focus {
  outline: none;
  border-color: rgba(0, 113, 227, 0.45);
}

html.theme-dark .auto-task-ref-url-input {
  border-color: rgba(255, 255, 255, 0.12);
  background: #242424;
}

.auto-task-ref-url-input[hidden],
.auto-task-ref-free-label[hidden] {
  display: none !important;
}

/* 与上传条紧排，不用 margin-top:auto（否则固定高度时中间会出现大块留白） */
.auto-task-upload-block .auto-task-actions {
  margin-top: 0;
  flex-shrink: 0;
}

html.theme-dark #ai-auto .auto-task-upload-strip {
  scrollbar-color: rgba(255, 255, 255, 0.28) rgba(0, 0, 0, 0.25);
}

/* 收紧一键出图下方：空状态不占行；有文案时再留一点间距 */
#ai-auto .auto-task-status {
  margin: 0;
  min-height: 0;
}

#ai-auto .auto-task-status:not(:empty) {
  margin-top: 8px;
}

#ai-auto .auto-task-project-body .auto-task-card.auto-task-card--wide {
  padding-bottom: 8px;
}

.auto-task-post-run-block {
  display: none;
  margin-top: 12px;
  box-sizing: border-box;
}

.auto-task-post-run-block.auto-task-post-run-block--open {
  display: block;
  height: var(--auto-task-post-run-block-height);
  max-height: var(--auto-task-post-run-block-height);
  overflow-x: hidden;
  overflow-y: auto;
}

.auto-task-post-run-block--open .auto-task-results {
  margin-top: 0;
}

.auto-task-ai-images-panel {
  margin-top: 10px;
  width: 100%;
  max-width: var(--auto-task-strip-8-cols-width);
  box-sizing: border-box;
}

.auto-task-ai-images-panel[hidden] {
  display: none !important;
}

.auto-task-generated-images-inner {
  margin: 0;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--soft);
  box-sizing: border-box;
  padding: 10px;
}

html.theme-dark .auto-task-generated-images-inner {
  border-color: rgba(255, 255, 255, 0.08);
}

.auto-task-generated-images-inner .auto-task-results {
  margin-top: 0;
}

.auto-task-results-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.preview-modal.preview-modal--gallery {
  flex-direction: column;
  gap: 10px;
}

.preview-modal.preview-modal--gallery .preview-modal-gallery-img-wrap {
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.preview-modal.preview-modal--gallery img {
  max-width: min(90vw, 900px);
  max-height: calc(85vh - 48px);
}

.preview-modal-gallery-meta {
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  text-align: center;
  user-select: none;
}

/* Auto Task 上传条：预览与上传格固定 105×105px；缩略图在左、上传格始终在最后一栏；超出可横向滚动 */

#ai-auto .auto-task-upload-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--auto-task-slot-px);
  grid-template-rows: var(--auto-task-slot-px);
  gap: var(--auto-task-strip-gap);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  justify-content: start;
  align-items: start;
  overflow-x: auto;
  overflow-y: visible;
  padding: 2px 0 4px;
  scrollbar-width: thin;
}

#ai-auto .auto-task-upload-strip.auto-task-upload-strip--drag {
  outline: 1px dashed rgba(0, 113, 227, 0.35);
  outline-offset: 2px;
  border-radius: 12px;
}

#ai-auto .auto-task-add-slot.upload-slot {
  box-sizing: border-box;
  padding: 6px;
  width: var(--auto-task-slot-px);
  height: var(--auto-task-slot-px);
  min-width: var(--auto-task-slot-px);
  max-width: var(--auto-task-slot-px);
  min-height: var(--auto-task-slot-px);
  max-height: var(--auto-task-slot-px);
}

#ai-auto .auto-task-add-slot.upload-slot.auto-task-add-slot--hidden {
  display: none !important;
}

#ai-auto .auto-task-add-slot-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  pointer-events: none;
}

#ai-auto .auto-task-upload-strip--has-files .auto-task-add-slot-inner {
  gap: 2px;
}

#ai-auto .auto-task-upload-strip--has-files .auto-task-dropzone-title {
  font-size: 11px;
  line-height: 1.2;
}

#ai-auto .auto-task-upload-strip--has-files .auto-task-dropzone-sub {
  display: none;
}

#ai-auto .auto-task-dropzone-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.25;
}

#ai-auto .auto-task-dropzone-sub {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.2;
}

#ai-auto .auto-task-thumbs {
  display: contents;
}

#ai-auto .auto-task-upload-strip > .upload-slot.has-image {
  box-sizing: border-box;
  width: var(--auto-task-slot-px);
  height: var(--auto-task-slot-px);
  min-width: var(--auto-task-slot-px);
  max-width: var(--auto-task-slot-px);
  min-height: var(--auto-task-slot-px);
  max-height: var(--auto-task-slot-px);
  overflow: hidden;
}

#ai-auto .auto-task-upload-strip > .upload-slot.has-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform-origin: center center;
}

/* 悬停放大：须写明默认 transform，否则会被后面 .upload-slot img { translateZ(0) } 抢走层叠 */
#ai-auto .auto-task-thumb-wrap.has-image > img {
  transform: translateZ(0);
  transition: transform 0.22s ease;
  will-change: transform;
}

#ai-auto .auto-task-thumb-wrap.has-image:hover > img {
  transform: translateZ(0) scale(1.1);
}

#ai-auto .auto-task-thumb-wrap.has-image {
  cursor: zoom-in;
}

#ai-auto .field-group + .field-group {
  margin-top: 12px;
}

#ai-auto .auto-task-input {
  height: 36px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  width: 100%;
}

#ai-auto .auto-task-input:focus {
  outline: none;
  border-color: rgba(0, 0, 0, 0.2);
}

html.theme-dark #ai-auto .auto-task-input {
  background: #242424;
  border-color: rgba(255, 255, 255, 0.12);
}

#ai-auto .auto-task-textarea {
  width: 100%;
  min-height: 160px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

#ai-auto .auto-task-textarea:focus {
  outline: none;
  border-color: rgba(0, 0, 0, 0.2);
}

html.theme-dark #ai-auto .auto-task-textarea {
  background: #242424;
  border-color: rgba(255, 255, 255, 0.12);
}

.auto-task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  justify-content: flex-end;
}

.auto-task-results {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.auto-task-result-cell {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: var(--soft);
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

html.theme-dark .auto-task-result-cell {
  border-color: rgba(255, 255, 255, 0.1);
}

.auto-task-result-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  flex: 1;
  min-height: 0;
}

.auto-task-result-label {
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  text-align: center;
}

html.theme-dark .auto-task-result-label {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.auto-task-result-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}

.auto-task-result-cell--thumb {
  cursor: pointer;
  padding: 0;
  position: relative;
}

.auto-task-result-cell--thumb:focus-visible {
  outline: 2px solid var(--accent, #3b82f6);
  outline-offset: 2px;
}

.auto-task-result-cell--generating {
  cursor: wait;
  pointer-events: none;
  padding: 0;
}

.auto-task-generating-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  text-align: center;
  background: linear-gradient(
    110deg,
    var(--soft) 0%,
    rgba(128, 128, 128, 0.12) 45%,
    var(--soft) 90%
  );
  background-size: 200% 100%;
  animation: auto-task-gen-shimmer 1.35s ease-in-out infinite;
}

.auto-task-generating-status {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.auto-task-generating-time {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

html.theme-dark .auto-task-generating-inner {
  background: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.1) 45%,
    rgba(255, 255, 255, 0.04) 90%
  );
  background-size: 200% 100%;
}

@keyframes auto-task-gen-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.auto-task-result-spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: rgba(0, 0, 0, 0.45);
  animation: auto-task-gen-spin 0.75s linear infinite;
  box-sizing: border-box;
}

html.theme-dark .auto-task-result-spinner {
  border-color: rgba(255, 255, 255, 0.12);
  border-top-color: rgba(255, 255, 255, 0.55);
}

@keyframes auto-task-gen-spin {
  to {
    transform: rotate(360deg);
  }
}

.auto-task-result-cell--failed {
  cursor: default;
  padding: 0;
}

.auto-task-result-fail-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--soft);
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  text-align: center;
}

.auto-task-result-fail-mark {
  font-size: 28px;
  line-height: 1;
}

.auto-task-result-fail-text {
  font-size: 11px;
  line-height: 1.4;
}

.auto-task-status {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
  min-height: 1.4em;
}

/* 一键出图正下方：临时展示 AI 生成卖点原文 */
#ai-auto .auto-task-chatgpt-panel {
  margin-top: 10px;
  width: 100%;
  max-width: var(--auto-task-strip-8-cols-width);
  box-sizing: border-box;
}

#ai-auto .auto-task-chatgpt-panel[hidden] {
  display: none !important;
}

.auto-task-chatgpt-panel-head {
  margin-bottom: 6px;
}

.auto-task-chatgpt-panel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* 外框：无内部滚动条；默认折叠高度，仅编辑态展开 */
.auto-task-chatgpt-body-wrap {
  position: relative;
  margin: 0;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--soft);
  box-sizing: border-box;
}

/* 浏览态：限制高度，底部渐变提示还有更多 */
.auto-task-chatgpt-panel:not(.auto-task-chatgpt-panel--editing) .auto-task-chatgpt-body-wrap {
  max-height: 96px;
  overflow: hidden;
}

.auto-task-chatgpt-panel:not(.auto-task-chatgpt-panel--editing) .auto-task-chatgpt-body-wrap::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 36px;
  pointer-events: none;
  border-radius: 0 0 9px 9px;
  background: linear-gradient(to bottom, transparent, var(--soft));
}

html.theme-dark
  .auto-task-chatgpt-panel:not(.auto-task-chatgpt-panel--editing)
  .auto-task-chatgpt-body-wrap::after {
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(255, 255, 255, 0.04)
  );
}

.auto-task-chatgpt-panel.auto-task-chatgpt-panel--editing .auto-task-chatgpt-body-wrap {
  max-height: none;
  overflow: visible;
}

.auto-task-chatgpt-panel.auto-task-chatgpt-panel--editing .auto-task-chatgpt-body-wrap::after {
  display: none;
}

html.theme-dark .auto-task-chatgpt-body-wrap {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.auto-task-chatgpt-panel:not(.auto-task-chatgpt-panel--editing) .auto-task-chatgpt-body-wrap {
  cursor: pointer;
  outline: none;
}

.auto-task-chatgpt-panel:not(.auto-task-chatgpt-panel--editing) .auto-task-chatgpt-body-wrap:hover {
  border-color: rgba(0, 0, 0, 0.14);
}

html.theme-dark
  .auto-task-chatgpt-panel:not(.auto-task-chatgpt-panel--editing)
  .auto-task-chatgpt-body-wrap:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.auto-task-chatgpt-panel:not(.auto-task-chatgpt-panel--editing) .auto-task-chatgpt-body-wrap:focus-visible {
  box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.35);
}

.auto-task-chatgpt-body {
  margin: 0;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  overflow: visible;
  max-height: none;
}

.auto-task-chatgpt-panel:not(.auto-task-chatgpt-panel--editing) .auto-task-chatgpt-body {
  cursor: pointer;
}

/* 须强制隐藏：否则 display:block 会盖掉 [hidden] 的默认 none，导致与 <pre> 重复显示两段相同内容 */
.auto-task-chatgpt-editor[hidden] {
  display: none !important;
}

.auto-task-chatgpt-editor {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 12px;
  min-height: 120px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  resize: none;
  overflow-y: hidden;
}

.auto-task-chatgpt-editor:focus {
  outline: 2px solid rgba(10, 132, 255, 0.35);
  outline-offset: 0;
}

.auto-task-results.auto-task-results--seven {
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}

/* Auto Task：折叠「项目」条（后期并列多条任务时复用 .auto-task-project） */
.auto-task-projects {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.auto-task-project {
  width: 100%;
  margin: 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  box-sizing: border-box;
}

/* Auto Task 内避免裁切下移的按钮；横向仍收敛，圆角由子卡片与 summary 承担 */
#ai-auto .auto-task-project {
  overflow-x: hidden;
  overflow-y: visible;
}

html.theme-dark .auto-task-project {
  border-color: rgba(255, 255, 255, 0.12);
}

.auto-task-project > summary.auto-task-project-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  min-height: 40px;
  box-sizing: border-box;
  user-select: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--soft);
  border-bottom: 1px solid transparent;
}

.auto-task-delete-project-btn {
  width: 18px;
  height: 18px;
  margin-left: 0;
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  background: #ff5c60;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  line-height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 1;
  pointer-events: auto;
  padding: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
  transition: transform 0.16s ease, box-shadow 0.2s ease, filter 0.2s ease;
  box-sizing: border-box;
}

.auto-task-project:not([data-auto-task-record-id]) .auto-task-delete-project-btn {
  display: none;
}

.auto-task-project.auto-task-project--blank .auto-task-delete-project-btn {
  display: none;
}

.auto-task-delete-project-btn:hover {
  transform: scale(1.16);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
  filter: brightness(1.03);
}

html.theme-dark .auto-task-delete-project-btn {
  background: #ff5c60;
  color: #fff;
}

.auto-task-project > summary.auto-task-project-summary::-webkit-details-marker {
  display: none;
}

.auto-task-project[open] > summary.auto-task-project-summary {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

html.theme-dark .auto-task-project[open] > summary.auto-task-project-summary {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.auto-task-project-chevron {
  display: inline-flex;
  width: 1.2em;
  flex-shrink: 0;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
  color: var(--muted);
  transition: transform 0.18s ease;
  transform: rotate(-90deg);
}

.auto-task-project[open] .auto-task-project-chevron {
  transform: rotate(0deg);
}

/* 任务卡标题行右侧：转圈与对勾同尺寸叠放（absolute），槽位尽量小以免挤 summary */
.auto-task-summary-indicator {
  position: relative;
  margin-left: auto;
  margin-right: 4px;
  flex-shrink: 0;
  width: 20px;
  min-width: 20px;
  height: 20px;
  min-height: 20px;
  box-sizing: border-box;
}

.auto-task-summary-indicator[hidden] {
  display: none !important;
}

/* 与 .auto-task-summary-done 同为 18×18 外廓 */
.auto-task-spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border: 2px solid rgba(0, 0, 0, 0.12);
  border-top-color: rgba(10, 132, 255, 0.85);
  border-radius: 50%;
  animation: auto-task-spin 0.65s linear infinite;
  box-sizing: border-box;
}

.auto-task-spinner[hidden] {
  display: none !important;
}

html.theme-dark .auto-task-spinner {
  border-color: rgba(255, 255, 255, 0.15);
  border-top-color: rgba(100, 180, 255, 0.9);
}

@keyframes auto-task-spin {
  to {
    transform: rotate(360deg);
  }
}

.auto-task-summary-done {
  position: absolute;
  left: 50%;
  top: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border-radius: 50%;
  background: #34c759;
  color: #fff;
  box-sizing: border-box;
}

.auto-task-summary-done[hidden] {
  display: none !important;
}

.auto-task-done-icon {
  width: 10px;
  height: 10px;
  color: #fff;
}

html.theme-dark .auto-task-summary-done {
  background: #30d158;
}

@media (prefers-reduced-motion: reduce) {
  .auto-task-spinner {
    animation: none;
    border-color: rgba(10, 132, 255, 0.5);
  }
}

/* 进行中提示：不再使用文字 status，仅出错时短暂显示 */
#ai-auto .auto-task-status {
  display: none !important;
  margin: 0 !important;
  min-height: 0 !important;
}

#ai-auto .auto-task-status.auto-task-status--error {
  display: block !important;
  margin-top: 8px !important;
  font-size: 13px;
  color: #c62828;
}

html.theme-dark #ai-auto .auto-task-status.auto-task-status--error {
  color: #ff8a80;
}

/* 分段生图：部分失败但已有成功图 — 用提示色，避免与「全盘失败」红字混淆 */
#ai-auto .auto-task-status.auto-task-status--partial {
  display: block !important;
  margin-top: 8px !important;
  font-size: 13px;
  line-height: 1.45;
  color: #9a3412;
}

html.theme-dark #ai-auto .auto-task-status.auto-task-status--partial {
  color: #fcd34d;
}

/* 仅占文字宽度；inline-flex + 固定行高，与编辑态输入框对齐避免整条 summary 跳动 */
.auto-task-project-name {
  flex: 0 1 auto;
  max-width: calc(100% - 2.5rem);
  min-width: 0;
  min-height: 1.35em;
  display: inline-flex;
  align-items: center;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}

.auto-task-project-name-input {
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1.35;
  color: inherit;
  max-width: min(100%, 260px);
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-sizing: border-box;
  outline: none;
  box-shadow: none;
  vertical-align: baseline;
}

.auto-task-project-name-input:focus {
  outline: none;
  box-shadow: none;
}

html.theme-dark .auto-task-project-name-input {
  background: transparent;
}

.auto-task-project-body {
  padding: 0;
}

.auto-task-project-body .auto-task-card {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* 一键出图：先收缩当前任务卡 body，再让新任务卡入场 */
#ai-auto .auto-task-project.auto-task-project--collapsing {
  overflow: hidden !important;
}

.auto-task-project-body.auto-task-body-collapsing {
  transition:
    height 0.38s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.32s ease;
}

/* 用户点击标题栏：展开 / 收缩 body（由脚本驱动高度） */
.auto-task-project-body.auto-task-body-toggle-anim {
  transition:
    height 0.34s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.28s ease;
}

.auto-task-project.auto-task-project--enter {
  opacity: 0;
  transform: translateY(-14px);
}

.auto-task-project.auto-task-project--enter.auto-task-project--enter-active {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.44s ease,
    transform 0.44s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
  .auto-task-project-body.auto-task-body-collapsing {
    transition: none;
  }

  .auto-task-project-body.auto-task-body-toggle-anim {
    transition: none;
  }

  .auto-task-project.auto-task-project--enter.auto-task-project--enter-active {
    transition: none;
  }
}

/* 一键出图进行中：主按钮切换为「停止」 */
#ai-auto .auto-task-actions button.auto-task-run-btn--stop {
  background: linear-gradient(180deg, #ff6b6b 0%, #e53935 100%);
  border-color: rgba(200, 40, 40, 0.35);
  color: #fff;
}

#ai-auto .auto-task-actions button.auto-task-run-btn--stop:hover {
  filter: brightness(1.06);
}

html.theme-dark #ai-auto .auto-task-actions button.auto-task-run-btn--stop {
  background: linear-gradient(180deg, #ff5252 0%, #c62828 100%);
  border-color: rgba(255, 120, 120, 0.25);
}

.auto-task-legal {
  margin-top: 28px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 52em;
}
