* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ---------- 深色模式（默认） ---------- */
body {
  background: #0f0e0d;
  background-image: radial-gradient(circle at 20% 30%, #1b1714, #0a0908 80%);
  color: #eae5de;
}

body .app-container {
  width: 100%;
  height: 100vh;
  background: rgba(20, 18, 16, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 20px 28px 24px;
  display: flex;
  flex-direction: column;
  transition: background 0.3s ease;
}

/* ---------- 顶部导航（三栏布局） ---------- */
.header {
  /* 三段式网格：左右各 1fr、中间 auto → 中间 LOGO 恒定居中，不受左右宽度影响 */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 215, 140, 0.40);
  margin-bottom: 20px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  justify-content: flex-start;
  justify-self: start;
}

.header-center {
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  justify-self: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  justify-content: flex-end;
  justify-self: end;
}

/* 顶栏图标 + 下方文字（反馈 / 水印 / 公告） */
.header-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
/* 圆按钮自带 margin-right:8px，会把下面的文字挤偏，这里去掉 */
.header-action .announcement-button {
  margin-right: 0;
}
.header-action-label {
  font-size: 0.66rem;
  line-height: 1;
  color: #8a7a6a;
  letter-spacing: 0.02em;
  user-select: none;
  text-align: center;
}
body.light-mode .header-action-label {
  color: #8a7a6a;
}

.logo-icon {
  width: 52px;
  height: 52px;
  object-fit: contain;
  display: inline-block;
  flex: 0 0 52px;
}

.logo-text {
  font-family: 'Georgia', 'Times New Roman', 'Noto Serif SC', serif;
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  background: linear-gradient(135deg, #f5e8d8, #e8c86a, #d4a030);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

.badge {
  font-size: 0.6rem;
  padding: 2px 10px;
  border-radius: 100px;
  background: rgba(232, 184, 76, 0.15);
  color: #e8b84c;
  border: 1px solid rgba(232, 184, 76, 0.15);
  white-space: nowrap;
  margin-left: 8px;
  vertical-align: middle;
}

body .panel {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 215, 140, 0.05);
}

body .field-group input,
body .field-group textarea,
body .field-group select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 215, 140, 0.1);
  color: #eae5de;
}

body .canvas-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px dashed rgba(255, 215, 140, 0.08);
}

body .placeholder {
  color: #4a3f35;
}

body .history-empty {
  color: #4a3f35;
}

/* ---------- 浅色模式 ---------- */
body.light-mode {
  background: #f5f0eb;
  background-image: radial-gradient(circle at 20% 30%, #faf6f0, #e8e0d8 80%);
  color: #1a1612;
}

body.light-mode .app-container {
  background: rgba(255, 252, 248, 0.85);
  backdrop-filter: blur(20px);
}

body.light-mode .header {
  border-bottom-color: rgba(0, 0, 0, 0.18);
}

body.light-mode .logo-text {
  background: linear-gradient(135deg, #6a5f52, #d4a030, #b8892a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

body.light-mode .badge {
  color: #8a7a6a;
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.08);
}

body.light-mode .panel {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.04);
}

body.light-mode .panel-title {
  color: #6a5f52;
}

body.light-mode .field-group label {
  color: #6a5f52;
}

body.light-mode .field-group input,
body.light-mode .field-group textarea,
body.light-mode .field-group select {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.1);
  color: #1a1612;
}

body.light-mode .field-group input:focus,
body.light-mode .field-group textarea:focus,
body.light-mode .field-group select:focus {
  border-color: #d4a030;
  background: rgba(255, 255, 255, 0.9);
}

body.light-mode .btn-ghost {
  color: #6a5f52;
  border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .btn-ghost:hover {
  border-color: #d4a030;
  color: #1a1612;
}

body.light-mode .canvas-box {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.06);
}

body.light-mode .placeholder {
  color: #b0a090;
}

body.light-mode .placeholder-hint {
  color: #c0b0a0;
}

body.light-mode .badge-idle {
  color: #8a7a6a;
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.04);
}

body.light-mode .history-section {
  border-top-color: rgba(0, 0, 0, 0.06);
}

body.light-mode .history-header {
  color: #8a7a6a;
}

body.light-mode .history-empty {
  color: #b0a090;
}

body.light-mode .btn-secondary {
  color: #6a5f52;
  border-color: rgba(0, 0, 0, 0.08);
}

body.light-mode .btn-secondary:hover {
  border-color: #d4a030;
  color: #1a1612;
}

body.light-mode .status-text {
  color: #6a5f52;
}

body.light-mode .announcement-button {
  border-color: rgba(0, 0, 0, 0.18);
}

body.light-mode .error-box {
  color: #c0392b;
}

body.light-mode .history-thumb {
  border-color: rgba(0, 0, 0, 0.06);
}

body.light-mode .history-quality-label {
  background: rgba(255, 255, 255, 0.85);
  color: #d4a030;
}

/* ---------- 通用组件样式 ---------- */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: #a09080;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4caf50;
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
}

/* ===== 主体布局：左右两列 ===== */
.main-grid {
  display: flex;
  gap: 20px;
  flex: 1;
  min-height: 0;
  justify-content: center;
  align-items: flex-start;
}

/* ===== 左侧控制台（固定侧边栏） ===== */
.control-panel {
  width: 320px;
  flex-shrink: 0;
  gap: 10px;
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  border-radius: 0;
  z-index: 100;
  background: rgba(20, 18, 16, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow-y: auto;
}

.control-panel .panel-title {
  flex-shrink: 0;
  margin-bottom: 10px;
}

/* ===== 右侧列 ===== */
.right-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 1200px;
  flex-shrink: 0;
  min-height: 0;
  margin-left: 340px;
}

/* ===== 面板通用 ===== */
.panel {
  border-radius: 20px;
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.panel-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: #b8a692;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
  flex-shrink: 0;
}

/* ===== 生成结果面板 ===== */
.result-panel {
  flex: 0 0 auto;
  min-height: 0;
  padding: 14px 18px 16px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.result-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.result-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.result-col-title {
  font-size: 0.7rem;
  color: #8a7a6a;
  font-weight: 500;
}

/* ===== 参考图导航 ===== */
.ref-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ref-nav-btn {
  background: transparent;
  border: 1px solid rgba(255, 215, 140, 0.12);
  border-radius: 4px;
  color: #8a7a6a;
  padding: 0px 6px;
  font-size: 0.6rem;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.6;
}

.ref-nav-btn:hover {
  border-color: #e8b84c;
  color: #eae5de;
}

.ref-index {
  font-size: 0.6rem;
  color: #6a5f52;
  min-width: 28px;
  text-align: center;
}

/* ===== 画布（参考图和生成图共用） ===== */
.result-canvas {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px dashed rgba(255, 215, 140, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* ===== 按钮里的下载图标（用 mask，颜色跟随文字）===== */
.dl-ico {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: -2px;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3Cpath d='M12 15V3'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3Cpath d='M12 15V3'/%3E%3C/svg%3E");
}

/* ===== 按钮里的删除图标（垃圾桶，颜色跟随文字）===== */
.del-ico {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: -2px;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'/%3E%3Cpath d='M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6'/%3E%3Cpath d='M10 11v6M14 11v6'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'/%3E%3Cpath d='M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6'/%3E%3Cpath d='M10 11v6M14 11v6'/%3E%3C/svg%3E");
}

/* ===== 一键详情：空框里的插画图标 ===== */
.md-box-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.md-box-empty::before {
  content: "";
  display: block;
  width: 84px;
  height: 72px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.9;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 104'%3E%3Cellipse cx='60' cy='88' rx='46' ry='11' fill='%232f5cff' opacity='0.20'/%3E%3Crect x='26' y='28' width='64' height='56' rx='12' fill='%231f3363'/%3E%3Crect x='18' y='16' width='72' height='60' rx='13' fill='%232b4a99'/%3E%3Ccircle cx='38' cy='34' r='5' fill='%23809fff'/%3E%3Cpath d='M23 70l15-18 12 13 9-9 19 14z' fill='%23809fff'/%3E%3Cpath d='M93 6l4.6 12.8L110 23.4l-12.4 4.6L93 40.8l-4.6-12.8L76 23.4l12.4-4.6z' fill='%23f0b429'/%3E%3C/svg%3E");
}

/* ===== 参考图 ===== */
.ref-placeholder {
  text-align: center;
  color: #e0d8cd;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* 金色图片图标（与上传区同款，内联 SVG） */
.ref-placeholder-icon {
  display: block;
  width: 56px;
  height: 56px;
  margin-bottom: 12px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e8b84c' stroke-width='1.8' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='4.5'/%3E%3Ccircle cx='9' cy='9' r='1.15' fill='%23e8b84c' stroke='none'/%3E%3Ccircle cx='14.2' cy='9' r='1.15' fill='%23e8b84c' stroke='none'/%3E%3Cpath d='M5.2 17.6l3.6-4.2 2.7 2.9 2.3-2.4 4.9 5.1z' fill='%23e8b84c' stroke='none'/%3E%3C/svg%3E");
}

.ref-placeholder p {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e0d8cd;
  margin: 0;
}

.ref-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

/* ===== 生成图（原有） ===== */
.placeholder {
  text-align: center;
  color: #e0d8cd;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* 生成图空状态：图片图标（灰，内联 SVG） */
.placeholder::before {
  content: "";
  display: block;
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238f8a84' stroke-width='1.8' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='4.5'/%3E%3Ccircle cx='9' cy='9' r='1.15' fill='%238f8a84' stroke='none'/%3E%3Ccircle cx='14.2' cy='9' r='1.15' fill='%238f8a84' stroke='none'/%3E%3Cpath d='M5.2 17.6l3.6-4.2 2.7 2.9 2.3-2.4 4.9 5.1z' fill='%238f8a84' stroke='none'/%3E%3C/svg%3E");
}

.placeholder p {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e0d8cd;
  margin: 0;
}

.result-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-shrink: 0;
  margin-top: 8px;
}

.btn-secondary {
  background: transparent;
  border: 1px solid rgba(255, 215, 140, 0.12);
  border-radius: 12px;
  color: #b8a692;
  padding: 8px 18px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-secondary:hover {
  border-color: #e8b84c;
  color: #eae5de;
}

/* ===== 任务队列面板 ===== */
.task-panel {
  flex-shrink: 0;
  padding: 10px 18px 12px;
  max-height: 140px;
}

.task-queue {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.task-queue-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #8a7a6a;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.task-count {
  color: #b8a692;
  font-weight: 500;
}

.task-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}

.task-list::-webkit-scrollbar {
  width: 4px;
}

.task-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
}

.task-list::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 140, 0.2);
  border-radius: 4px;
}

.task-empty {
  color: #6a5f52;
  font-size: 0.8rem;
  text-align: center;
  padding: 12px 0 14px;
}

/* 空状态：文件夹图标 + 暂无任务 */
.task-empty::before {
  content: "";
  display: block;
  width: 42px;
  height: 36px;
  margin: 0 auto 10px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.85;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%234a3f35' d='M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z'/%3E%3C/svg%3E");
}

/* ===== 任务网格 ===== */
.task-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  padding-bottom: 2px;
}

.task-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.task-grid-thumb-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 215, 140, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-grid-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.task-grid-thumb-placeholder {
  font-size: 1rem;
  opacity: 0.3;
}

.task-grid-status-block {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.45rem;
  font-weight: 500;
  color: #fff;
}

.task-grid-status-block.done {
  background: rgba(76, 175, 80, 0.7);
}

.task-grid-status-block.failed {
  background: rgba(200, 50, 50, 0.7);
}

.task-grid-status-badge {
  position: absolute;
  bottom: 1px;
  right: 1px;
  font-size: 0.35rem;
  padding: 0px 3px;
  border-radius: 2px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.3;
}

.task-grid-status-badge.queued {
  background: rgba(255, 215, 140, 0.15);
  color: #8a7a6a;
}

.task-grid-status-badge.running {
  background: rgba(232, 184, 76, 0.2);
  color: #e8b84c;
  animation: statusPulse 1s ease-in-out infinite;
}

.task-grid-prompt {
  font-size: 0.4rem;
  color: #6a5f52;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
  line-height: 1.1;
}

.task-grid-delete {
  position: absolute;
  top: 1px;
  right: 2px;
  background: rgba(200, 50, 50, 0.8);
  border: none;
  border-radius: 2px;
  color: #fff;
  width: 12px;
  height: 12px;
  font-size: 0.35rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 3;
  line-height: 1;
  padding: 0;
  opacity: 0.6;
}

.task-grid-delete:hover {
  background: rgba(220, 30, 30, 1);
  opacity: 1;
  transform: scale(1.1);
}

.task-grid-retry {
  background: transparent;
  border: 1px solid rgba(200, 50, 50, 0.3);
  color: #e8745a;
  cursor: pointer;
  font-size: 0.4rem;
  padding: 0px 3px;
  border-radius: 2px;
  transition: all 0.2s ease;
  line-height: 1.2;
}

.task-grid-retry:hover {
  background: rgba(200, 50, 50, 0.15);
  border-color: #e8745a;
}

.task-grid-timer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  pointer-events: none;
  display: none;
}

.task-grid-timer-circle {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  box-shadow: 0 0 10px rgba(232, 184, 76, 0.08);
  animation: taskTimerGlow 2s ease-in-out infinite;
}

.task-grid-timer-ring {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #e8b84c;
  border-bottom-color: #e8b84c;
  animation: taskTimerSpin 1.8s linear infinite;
}

.task-grid-timer-ring::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-left-color: rgba(232, 184, 76, 0.3);
  border-right-color: rgba(232, 184, 76, 0.3);
  animation: taskTimerSpinReverse 2.4s linear infinite;
}

.task-grid-timer-content {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1px;
  z-index: 2;
}

.task-grid-timer-seconds {
  font-size: 0.65rem;
  font-weight: 700;
  color: #e8b84c;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.task-grid-timer-unit {
  font-size: 0.35rem;
  color: #b8a692;
  font-weight: 400;
}

@keyframes taskTimerGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(232, 184, 76, 0.04); }
  50% { box-shadow: 0 0 16px rgba(232, 184, 76, 0.12); }
}

@keyframes taskTimerSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes taskTimerSpinReverse {
  0% { transform: rotate(360deg); }
  100% { transform: rotate(0deg); }
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== 历史记录面板 ===== */
.history-panel {
  flex-shrink: 0;
  padding: 10px 18px 12px;
  /* 完全自动高度，完整展示，不限制高度 */
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.history-header .panel-title {
  margin-bottom: 0;
}

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

.history-count {
  font-size: 0.7rem;
  color: #5a4f42;
}

.history-btn {
  background: transparent;
  border: 1px solid rgba(255, 215, 140, 0.12);
  border-radius: 6px;
  color: #8a7a6a;
  padding: 2px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.history-btn:hover {
  border-color: #e8b84c;
  color: #eae5de;
}

.history-btn.danger:hover {
  border-color: #e8745a;
  color: #e8745a;
}

body.light-mode .history-btn {
  border-color: rgba(0, 0, 0, 0.08);
  color: #8a7a6a;
}

body.light-mode .history-btn:hover {
  border-color: #d4a030;
  color: #1a1612;
}

body.light-mode .history-btn.danger:hover {
  border-color: #c0392b;
  color: #c0392b;
}

/* ---- 记录区右上角分页按钮（紧凑版 history-btn；抠图与详情共用） ---- */
.cutout-history-pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-wrap: wrap;            /* 按钮变多，窄屏时换行而不是溢出 */
  justify-content: flex-end;
}

.cutout-history-pagination .history-btn {
  padding: 2px 8px;
  font-size: 0.7rem;
  line-height: 1.5;
}

.cutout-history-pagination .history-btn[data-cutout-page],
.hist-page-btn {
  padding: 2px 9px;
  font-size: 0.7rem;
  line-height: 1.5;
}

.cutout-history-pagination .cutout-page-indicator,
.hist-page-indicator {
  font-size: 0.7rem;
  color: #8a7a6a;
  min-width: 36px;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---- 历史缩略图区域（完全自动高度，完整展示，不滚动） ---- */
.history-strip {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  padding-bottom: 2px;
  /* 去掉高度上限与滚动 */
}

.history-strip::-webkit-scrollbar {
  width: 4px;
}

.history-strip::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
}

.history-strip::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 140, 0.2);
  border-radius: 4px;
}

.history-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #4a3f35;
  font-size: 0.8rem;
  padding: 4px 0;
}

.history-item {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  gap: 1px;
}

.history-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 215, 140, 0.06);
  cursor: pointer;
  transition: all 0.2s ease;
  display: block;
}

.history-thumb:hover {
  border-color: #e8b84c;
  transform: scale(1.04);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* ---- 分辨率数字（取代原来的 1K/2K/4K 标签） ---- */
.history-resolution {
  font-size: 0.55rem;
  color: #b8a692;
  text-align: center;
  line-height: 1.2;
  margin-top: 1px;
}

body.light-mode .history-resolution {
  color: #8a7a6a;
}

/* ---- 旧版质量标签（兼容旧记录，可保留） ---- */
.history-quality-label {
  position: absolute;
  bottom: 1px;
  right: 3px;
  background: rgba(0, 0, 0, 0.75);
  color: #e8b84c;
  font-size: 0.55rem;
  font-weight: 600;
  padding: 0px 4px;
  border-radius: 2px;
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.history-duration {
  font-size: 0.55rem;
  color: #6a5f52;
  text-align: center;
  margin-top: 0px;
  line-height: 1.1;
}

body.light-mode .history-duration {
  color: #8a7a6a;
}

/* ===== 主计时器（画布中心） ===== */
.timer-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  pointer-events: none;
}

.timer-circle {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  box-shadow: 0 0 40px rgba(232, 184, 76, 0.12);
  animation: timerGlow 2s ease-in-out infinite;
}

.timer-ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #e8b84c;
  border-bottom-color: #e8b84c;
  animation: timerSpin 1.8s linear infinite;
  box-shadow: 0 0 20px rgba(232, 184, 76, 0.08);
}

.timer-ring::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-left-color: rgba(232, 184, 76, 0.3);
  border-right-color: rgba(232, 184, 76, 0.3);
  animation: timerSpinReverse 2.4s linear infinite;
}

.timer-content {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  z-index: 2;
}

.timer-content #timerSeconds {
  font-size: 2rem;
  font-weight: 700;
  color: #e8b84c;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.timer-content .timer-unit {
  font-size: 0.8rem;
  color: #b8a692;
  font-weight: 400;
}

@keyframes timerGlow {
  0%, 100% { box-shadow: 0 0 30px rgba(232, 184, 76, 0.06); }
  50% { box-shadow: 0 0 60px rgba(232, 184, 76, 0.2); }
}

@keyframes timerSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes timerSpinReverse {
  0% { transform: rotate(360deg); }
  100% { transform: rotate(0deg); }
}

body.light-mode .timer-circle {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 40px rgba(212, 160, 48, 0.1);
}

body.light-mode .timer-content #timerSeconds {
  color: #d4a030;
}

body.light-mode .timer-content .timer-unit {
  color: #8a7a6a;
}

body.light-mode .timer-ring {
  border-top-color: #d4a030;
  border-bottom-color: #d4a030;
}

body.light-mode .timer-ring::after {
  border-left-color: rgba(212, 160, 48, 0.25);
  border-right-color: rgba(212, 160, 48, 0.25);
}

/* ===== 积分信息 ===== */
.credit-info {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  padding: 4px 0 6px 0;
  font-size: 0.8rem;
  color: #b8a692;
  border-bottom: 1px solid rgba(255, 215, 140, 0.06);
  margin-bottom: 8px;
}

.credit-label {
  color: #8a7a6a;
}

.credit-remaining {
  font-weight: 700;
  color: #e8b84c;
  font-size: 0.95rem;
}

body.light-mode .credit-info {
  color: #6a5f52;
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

body.light-mode .credit-label {
  color: #8a7a6a;
}

body.light-mode .credit-remaining {
  color: #d4a030;
}

/* ===== 积分消耗提示 ===== */
.cost-hint {
  font-size: 0.7rem;
  color: #8a7a6a;
  text-align: center;
  padding: 2px 0 0px 0;
  letter-spacing: 0.02em;
}

.cost-hint #costAmount {
  color: #e8b84c;
  font-weight: 600;
}

.cost-hint #costResolution {
  color: #b8a692;
  font-weight: 500;
}

body.light-mode .cost-hint {
  color: #8a7a6a;
}

body.light-mode .cost-hint #costAmount {
  color: #d4a030;
}

body.light-mode .cost-hint #costResolution {
  color: #6a5f52;
}

/* ===== 上传区域 ===== */
.upload-zone {
  border: 1px dashed rgba(255, 215, 140, 0.2);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
}

.upload-zone:hover {
  border-color: rgba(255, 215, 140, 0.4);
  background: rgba(255, 255, 255, 0.04);
}

.upload-zone.dragover {
  border-color: #e8b84c;
  background: rgba(232, 184, 76, 0.08);
}

/* 上传区空状态：竖排 + 居中（JS 会把它设成 display:flex，这里固定方向，避免图标与文字横向错位） */
.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
}

/* 上传区空状态：金色图片图标（内联 SVG） */
.upload-placeholder::before {
  content: "";
  display: block;
  width: 46px;
  height: 46px;
  margin: 2px auto 10px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e8b84c' stroke-width='1.8' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='4.5'/%3E%3Ccircle cx='9' cy='9' r='1.15' fill='%23e8b84c' stroke='none'/%3E%3Ccircle cx='14.2' cy='9' r='1.15' fill='%23e8b84c' stroke='none'/%3E%3Cpath d='M5.2 17.6l3.6-4.2 2.7 2.9 2.3-2.4 4.9 5.1z' fill='%23e8b84c' stroke='none'/%3E%3C/svg%3E");
}

.upload-placeholder p {
  color: #e0d8cd;
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0;
  text-align: center;
}

.upload-hint {
  color: #6a5f52;
  font-size: 0.68rem;
  display: block;
  margin-top: 5px;
  text-align: center;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
}

.upload-grid-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 215, 140, 0.1);
  background: rgba(0, 0, 0, 0.3);
}

.upload-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-grid-item .index-label {
  position: absolute;
  bottom: 2px;
  right: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.5rem;
  padding: 0px 6px;
  border-radius: 3px;
  font-weight: 500;
  z-index: 2;
}

.upload-grid-item .remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(200, 50, 50, 0.9);
  border: none;
  border-radius: 2px;
  color: #fff;
  width: 14px;
  height: 14px;
  font-size: 0.45rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 3;
  line-height: 1;
  padding: 0;
}

.upload-grid-item .remove-btn:hover {
  background: rgba(220, 30, 30, 1);
  transform: scale(1.1);
}

.upload-grid-item.clear-all-item {
  border: 2px dashed rgba(255, 215, 140, 0.15);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.upload-grid-item.clear-all-item:hover {
  border-color: rgba(200, 50, 50, 0.4);
  background: rgba(200, 50, 50, 0.06);
}

.clear-all-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.clear-all-icon {
  font-size: 1rem;
  opacity: 0.6;
  color: #8a7a6a;
}

.clear-all-text {
  font-size: 0.5rem;
  color: #8a7a6a;
  opacity: 0.7;
}

.upload-grid-item.clear-all-item:hover .clear-all-icon {
  opacity: 1;
  color: #e8745a;
}

.upload-grid-item.clear-all-item:hover .clear-all-text {
  color: #e8745a;
  opacity: 1;
}

/* ===== 拖拽排序样式 ===== */
.upload-grid-item.drag-over {
  border-color: #e8b84c;
  box-shadow: 0 0 16px rgba(232, 184, 76, 0.15);
  transform: scale(1.02);
}

.upload-grid-item.dragging {
  opacity: 0.4;
}

body.light-mode .upload-grid-item.drag-over {
  border-color: #d4a030;
  box-shadow: 0 0 16px rgba(212, 160, 48, 0.1);
}

body.light-mode .upload-zone {
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.02);
}

body.light-mode .upload-zone:hover {
  border-color: rgba(0, 0, 0, 0.25);
  background: rgba(0, 0, 0, 0.04);
}

body.light-mode .upload-placeholder p {
  color: #6a5f52;
}

body.light-mode .upload-hint {
  color: #a09080;
}

body.light-mode .upload-grid-item.clear-all-item {
  border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .upload-grid-item.clear-all-item:hover {
  border-color: rgba(200, 50, 50, 0.35);
}

body.light-mode .clear-all-text {
  color: #8a7a6a;
}

body.light-mode .upload-grid-item.clear-all-item:hover .clear-all-text {
  color: #c0392b;
}

/* ===== 分辨率/尺寸按钮 ===== */
.quality-options {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.quality-btn {
  flex: 1;
  padding: 0 12px;
  height: 36px;
  border: 1px solid rgba(255, 215, 140, 0.12);
  border-radius: 10px;
  background: transparent;
  color: #a09080;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  white-space: nowrap;
}

.quality-btn:hover {
  border-color: #e8b84c;
  color: #eae5de;
}

.quality-btn.active {
  background: linear-gradient(145deg, #e8b84c, #d49a2e);
  border-color: #e8b84c;
  color: #0f0e0d;
  box-shadow: 0 4px 12px rgba(212, 154, 46, 0.2);
}

body.light-mode .quality-btn {
  border-color: rgba(0, 0, 0, 0.08);
  color: #8a7a6a;
}

body.light-mode .quality-btn:hover {
  border-color: #d4a030;
  color: #1a1612;
}

body.light-mode .quality-btn.active {
  background: linear-gradient(145deg, #e8b84c, #d49a2e);
  border-color: #e8b84c;
  color: #0f0e0d;
}

/* ===== 2K 推荐标识 ===== */
.quality-btn.recommended {
  position: relative;
}

.quality-btn.recommended::after {
  content: "推荐";
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 0.5rem;
  font-weight: 700;
  background: #e8745a;
  color: #fff;
  padding: 1px 6px;
  border-radius: 10px;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(232, 116, 90, 0.3);
  white-space: nowrap;
}

body.light-mode .quality-btn.recommended::after {
  background: #d94f3a;
  box-shadow: 0 2px 8px rgba(217, 79, 58, 0.3);
}

/* ===== 模型按钮 ===== */
.model-options {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.model-btn {
  flex: 1;
  padding: 0 12px;
  height: 34px;
  border: 1px solid rgba(255, 215, 140, 0.40);
  border-radius: 10px;
  background: transparent;
  color: #a09080;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  white-space: nowrap;
}

.model-btn:hover {
  border-color: #e8b84c;
  color: #eae5de;
}

.model-btn.active {
  background: linear-gradient(145deg, #e8b84c, #d49a2e);
  border-color: #e8b84c;
  color: #0f0e0d;
  box-shadow: 0 4px 12px rgba(212, 154, 46, 0.2);
}

body.light-mode .model-btn {
  border-color: rgba(0, 0, 0, 0.18);
  color: #8a7a6a;
}

body.light-mode .model-btn:hover {
  border-color: #d4a030;
  color: #1a1612;
}

body.light-mode .model-btn.active {
  background: linear-gradient(145deg, #e8b84c, #d49a2e);
  border-color: #e8b84c;
  color: #0f0e0d;
}

/* ===== 尺寸按钮 ===== */
.size-options {
  display: flex;
  gap: 4px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.size-btn {
  flex: 1;
  padding: 0 6px;
  height: 32px;
  border: 1px solid rgba(255, 215, 140, 0.1);
  border-radius: 8px;
  background: transparent;
  color: #a09080;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  white-space: nowrap;
}

.size-btn:hover {
  border-color: #e8b84c;
  color: #eae5de;
}

.size-btn.active {
  background: linear-gradient(145deg, #e8b84c, #d49a2e);
  border-color: #e8b84c;
  color: #0f0e0d;
  box-shadow: 0 4px 12px rgba(212, 154, 46, 0.2);
}

body.light-mode .size-btn {
  border-color: rgba(0, 0, 0, 0.08);
  color: #8a7a6a;
}

body.light-mode .size-btn:hover {
  border-color: #d4a030;
  color: #1a1612;
}

body.light-mode .size-btn.active {
  background: linear-gradient(145deg, #e8b84c, #d49a2e);
  border-color: #e8b84c;
  color: #0f0e0d;
}

/* ===== 提示词模板标签 ===== */
.prompt-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 6px 0;
  align-items: center;
  min-height: 28px;
}

.prompt-templates .template-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 215, 140, 0.08);
  color: #b8a692;
  border: 1px solid rgba(255, 215, 140, 0.08);
  white-space: nowrap;
  line-height: 1.6;
}

.prompt-templates .template-tag:hover {
  background: rgba(232, 184, 76, 0.15);
  border-color: #e8b84c;
  color: #eae5de;
  transform: scale(1.03);
}

body.light-mode .prompt-templates .template-tag {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.06);
  color: #6a5f52;
}

body.light-mode .prompt-templates .template-tag:hover {
  background: rgba(212, 160, 48, 0.1);
  border-color: #d4a030;
  color: #1a1612;
}

.prompt-templates .template-empty {
  font-size: 0.65rem;
  color: #5a4f42;
  padding: 2px 0;
}

.prompt-templates .template-manage-btn {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  color: #6a5f52;
  border: 1px solid rgba(255, 215, 140, 0.08);
  white-space: nowrap;
  line-height: 1.6;
  margin-left: auto;
}

.prompt-templates .template-manage-btn:hover {
  border-color: #e8b84c;
  color: #e8b84c;
}

body.light-mode .prompt-templates .template-manage-btn {
  color: #8a7a6a;
  border-color: rgba(0, 0, 0, 0.06);
}

body.light-mode .prompt-templates .template-manage-btn:hover {
  border-color: #d4a030;
  color: #d4a030;
}

/* ===== 提示词管理弹窗 ===== */
.prompt-modal-overlay {
  position: fixed;
  z-index: 9998;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
}

.prompt-modal-overlay.active {
  display: flex;
}

.prompt-modal {
  background: #1a1714;
  border-radius: 16px;
  padding: 24px 28px;
  width: 520px;
  max-width: 94%;
  max-height: 80vh;
  border: 1px solid rgba(255, 215, 140, 0.08);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
}

body.light-mode .prompt-modal {
  background: #f5f0eb;
  border-color: rgba(0, 0, 0, 0.06);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.prompt-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.prompt-modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #eae5de;
}

body.light-mode .prompt-modal-header h3 {
  color: #1a1612;
}

.prompt-modal-close {
  background: transparent;
  border: none;
  color: #8a7a6a;
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: all 0.2s ease;
}

.prompt-modal-close:hover {
  color: #eae5de;
  transform: rotate(90deg);
}

body.light-mode .prompt-modal-close:hover {
  color: #1a1612;
}

.prompt-modal-body {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.prompt-modal-body::-webkit-scrollbar {
  width: 4px;
}

.prompt-modal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
}

.prompt-modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 140, 0.15);
  border-radius: 4px;
}

.prompt-modal-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 215, 140, 0.04);
  gap: 12px;
}

body.light-mode .prompt-modal-item {
  border-bottom-color: rgba(0, 0, 0, 0.04);
}

.prompt-modal-item .info {
  flex: 1;
  min-width: 0;
}

.prompt-modal-item .info .title {
  font-size: 0.85rem;
  font-weight: 500;
  color: #eae5de;
}

body.light-mode .prompt-modal-item .info .title {
  color: #1a1612;
}

.prompt-modal-item .info .content {
  font-size: 0.7rem;
  color: #8a7a6a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.light-mode .prompt-modal-item .info .content {
  color: #8a7a6a;
}

.prompt-modal-item .actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.prompt-modal-item .actions button {
  background: transparent;
  border: 1px solid rgba(255, 215, 140, 0.08);
  border-radius: 4px;
  color: #8a7a6a;
  padding: 2px 10px;
  font-size: 0.6rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.prompt-modal-item .actions button:hover {
  border-color: #e8b84c;
  color: #eae5de;
}

.prompt-modal-item .actions button.danger:hover {
  border-color: #e8745a;
  color: #e8745a;
}

body.light-mode .prompt-modal-item .actions button {
  border-color: rgba(0, 0, 0, 0.06);
}

body.light-mode .prompt-modal-item .actions button:hover {
  border-color: #d4a030;
  color: #1a1612;
}

body.light-mode .prompt-modal-item .actions button.danger:hover {
  border-color: #c0392b;
  color: #c0392b;
}

.prompt-modal-add {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 215, 140, 0.04);
  flex-shrink: 0;
  flex-wrap: wrap;
}

body.light-mode .prompt-modal-add {
  border-top-color: rgba(0, 0, 0, 0.04);
}

.prompt-modal-add input {
  flex: 1;
  min-width: 80px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 215, 140, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #eae5de;
  font-size: 0.75rem;
  outline: none;
}

body.light-mode .prompt-modal-add input {
  border-color: rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.7);
  color: #1a1612;
}

.prompt-modal-add input:focus {
  border-color: #e8b84c;
}

.prompt-modal-add .add-btn {
  padding: 6px 16px;
  border: none;
  border-radius: 6px;
  background: linear-gradient(145deg, #e8b84c, #d49a2e);
  color: #0f0e0d;
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.prompt-modal-add .add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(212, 154, 46, 0.2);
}

.prompt-modal .modal-error {
  font-size: 0.7rem;
  color: #e8745a;
  margin-top: 6px;
}

/* ===== 其他表单元素 ===== */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
}

.field-group label {
  font-size: 0.65rem;
  font-weight: 500;
  color: #a09080;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field-group input,
.field-group textarea,
.field-group select {
  border-radius: 10px;
  font-size: 0.8rem;
  padding: 8px 12px;
  outline: none;
  transition: all 0.2s ease;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 215, 140, 0.08);
  color: #eae5de;
}

.field-group input:focus,
.field-group textarea:focus,
.field-group select:focus {
  border-color: #e8b84c;
  box-shadow: 0 0 0 3px rgba(232, 184, 76, 0.06);
}

.field-group textarea {
  resize: vertical;
  min-height: 60px;
  flex: 1;
}

.key-input-row {
  display: flex;
  gap: 6px;
}

.key-input-row input {
  flex: 1;
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 215, 140, 0.1);
  border-radius: 10px;
  color: #a09080;
  padding: 0 12px;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-ghost:hover {
  border-color: #e8b84c;
  color: #eae5de;
}

.btn-primary {
  background: linear-gradient(145deg, #e8b84c, #d49a2e);
  border: none;
  border-radius: 14px;
  color: #0f0e0d;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-top: 4px;
  box-shadow: 0 4px 16px rgba(212, 154, 46, 0.15);
  flex-shrink: 0;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(212, 154, 46, 0.25);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.error-box {
  color: #e8745a;
  font-size: 0.75rem;
  border-left: 3px solid #e8745a;
  padding-left: 10px;
  margin-top: 2px;
  flex-shrink: 0;
  min-height: 20px;
}

/* ===== 图片放大查看模态框 ===== */
.image-modal {
  position: fixed;
  z-index: 9999;
  padding: 40px 20px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.image-modal .modal-content {
  max-width: 92%;
  max-height: 92%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  animation: modalFadeIn 0.25s ease;
  cursor: default;
  transition: transform 0.15s ease;
}

.image-modal .modal-close {
  position: fixed;
  top: 20px;
  right: 28px;
  color: #fff;
  font-size: 2.6rem;
  font-weight: 300;
  cursor: pointer;
  transition: all 0.25s ease;
  line-height: 1;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.4);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  border: none;
  padding: 0;
}

.image-modal .modal-close:hover {
  color: #e8b84c;
  background: rgba(0, 0, 0, 0.7);
  transform: rotate(90deg);
}

@keyframes modalFadeIn {
  0% { opacity: 0; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1); }
}

body.light-mode .image-modal {
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

body.light-mode .image-modal .modal-close {
  color: #1a1612;
  background: rgba(0, 0, 0, 0.06);
}

body.light-mode .image-modal .modal-close:hover {
  color: #d4a030;
  background: rgba(0, 0, 0, 0.1);
}

/* ===== 图片鼠标悬停提示 ===== */
.result-image,
.ref-image,
.history-thumb {
  cursor: pointer;
}

/* ===== 强制隐藏田字框 ===== */
.frame-corner {
  display: none !important;
}

/* ===== 加载状态 ===== */
.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  border-radius: 12px;
  color: #b8a692;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 2px solid rgba(232, 184, 76, 0.1);
  border-top-color: #e8b84c;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
  .control-panel {
    width: 280px;
  }
  .right-column {
    width: 600px;
  }
  .task-grid {
    grid-template-columns: repeat(8, 1fr);
  }
  .history-strip {
    grid-template-columns: repeat(8, 1fr);
  }
}

@media (max-width: 900px) {
  .main-grid {
    flex-direction: column;
  }
  .control-panel {
    width: 100%;
    flex-shrink: 0;
    max-height: none;
    position: static;
  }
  .right-column {
    width: 100%;
    flex-shrink: 1;
    margin-left: 0;
  }
  .result-grid {
    grid-template-columns: 1fr 1fr;
  }
  .task-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  .history-strip {
    grid-template-columns: repeat(6, 1fr);
  }
  .header-center .logo-text {
    font-size: 1.4rem;
  }
}

/* ===== 手机端适配（完整版，含上传缩略图修复） ===== */
@media (max-width: 1024px) {
  html, body {
    overflow: auto !important;
    height: auto !important;
    min-height: 100vh;
  }

  .app-container {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
    min-height: 100vh;
    padding: 16px;
  }

  .main-grid {
    flex-direction: column !important;
    gap: 16px !important;
  }

  .control-panel {
    width: 100% !important;
    max-height: none !important;
    height: auto !important;
    padding: 14px 16px 16px !important;
    position: static !important;
  }

  .right-column {
    width: 100% !important;
    flex-shrink: 0 !important;
    gap: 12px;
    margin-left: 0 !important;
  }

  .result-panel {
    padding: 12px 14px 14px !important;
  }

  .result-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
  }

  .result-canvas {
    min-height: 180px !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
  }

  .result-actions {
    flex-wrap: wrap;
    justify-content: center;
  }

  .task-panel {
    max-height: none !important;
    padding: 10px 14px 12px !important;
  }

  .task-grid {
    grid-template-columns: repeat(6, 1fr) !important;
  }

  .history-panel {
    max-height: none !important;
    padding: 10px 14px 12px !important;
  }

  .history-strip {
    grid-template-columns: repeat(5, 1fr) !important;
    max-height: none !important;
  }

  .history-thumb {
    width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    height: auto !important;
  }

  .history-item {
    width: 100% !important;
  }

  .result-col-header {
    flex-wrap: wrap;
    gap: 4px;
  }

  .ref-nav {
    gap: 4px;
  }

  .ref-nav-btn {
    padding: 0 4px;
    font-size: 0.5rem;
  }

  .upload-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .upload-grid-item {
    position: relative !important;
    aspect-ratio: 1 / 1 !important;
    min-height: 60px !important;
    border-radius: 6px !important;
    overflow: hidden !important;
    border: 1px solid rgba(255, 215, 140, 0.1) !important;
    background: rgba(0, 0, 0, 0.3) !important;
  }

  .upload-grid-item img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  .upload-zone {
    min-height: 100px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .upload-placeholder {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 80px !important;
    padding: 8px 0 !important;
  }

  .upload-placeholder p {
    display: block !important;
    font-size: 0.8rem !important;
    color: #8a7a6a !important;
    margin: 4px 0 !important;
  }

  .upload-hint {
    display: block !important;
    font-size: 0.65rem !important;
    color: #5a4f42 !important;
  }

  .upload-grid-item.clear-all-item {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px dashed rgba(255, 215, 140, 0.15) !important;
    cursor: pointer !important;
  }

  .clear-all-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 2px !important;
  }
}

/* 小手机 */
@media (max-width: 600px) {
  .app-container {
    padding: 12px;
  }

  .control-panel {
    padding: 8px 10px 12px !important;
    position: static !important;
  }

  .right-column {
    gap: 8px;
    margin-left: 0 !important;
  }

  .result-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  .result-canvas {
    min-height: 120px !important;
  }

  .result-col-header {
    font-size: 0.7rem;
  }

  .result-col-title {
    font-size: 0.6rem;
  }

  .task-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }

  .history-strip {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  .field-group textarea {
    min-height: 40px;
  }

  .quality-options {
    gap: 4px;
  }

  .quality-btn {
    font-size: 0.65rem;
    height: 28px;
    padding: 0 6px;
  }

  .size-options {
    gap: 3px;
  }

  .size-btn {
    font-size: 0.55rem;
    height: 26px;
    padding: 0 4px;
  }

  .btn-primary {
    font-size: 0.8rem;
    padding: 10px;
  }

  .header-center .logo-text {
    font-size: 1.1rem;
  }

  .upload-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 4px !important;
  }

  .upload-grid-item {
    min-height: 50px !important;
  }

  .upload-grid-item img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  .upload-zone {
    min-height: 100px !important;
    padding: 12px 8px !important;
  }

  .upload-placeholder {
    min-height: 60px !important;
  }

  .upload-placeholder p {
    font-size: 0.7rem !important;
  }
}

/* 公告入口与弹窗 */
.announcement-button {
  width: 36px;
  height: 36px;
  margin-right: 8px;
  border: 1px solid rgba(255, 215, 140, 0.40);
  border-radius: 50%;
  background: var(--panel-bg, transparent);
  color: inherit;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  transition: transform .2s ease, background .2s ease;
}
.announcement-button:hover {
  background: var(--hover-bg, rgba(127, 127, 127, .12));
  transform: translateY(-1px);
}
.announcement-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, .52);
}
.announcement-modal.is-open { display: flex; }
.announcement-dialog {
  position: relative;
  width: min(560px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  overflow: auto;
  padding: 30px 32px 34px;
  border: 1px solid rgba(255, 215, 140, .18);
  border-radius: 16px;
  background: #1a1714;
  color: #eae5de;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
}
/* 浅色模式才用白底 */
body.light-mode .announcement-dialog {
  background: #ffffff;
  border-color: rgba(0, 0, 0, .12);
  color: #222222;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .22);
}
.announcement-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}
.announcement-close:hover { background: rgba(255, 215, 140, .12); }
body.light-mode .announcement-close:hover { background: rgba(0, 0, 0, .06); }
.announcement-eyebrow {
  margin-bottom: 8px;
  color: #e8b84c;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
}
body.light-mode .announcement-eyebrow { color: #c8801a; }
.announcement-dialog h2 {
  margin: 0;
  padding-right: 32px;
  font-size: 24px;
  line-height: 1.35;
}
.announcement-time {
  margin-top: 8px;
  color: #8a7a6a;
  font-size: 13px;
}
.announcement-content {
  margin-top: 22px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
  line-height: 1.8;
}
.announcement-signature {
  margin-top: 26px;
  text-align: right;
  white-space: pre-line;
  font-size: 14px;
  line-height: 1.7;
  color: #8a7a6a;
}
body.light-mode .announcement-time,
body.light-mode .announcement-signature { color: #8a8f98; }
body.announcement-open { overflow: hidden; }
@media (max-width: 600px) {
  .announcement-modal { padding: 16px; }
  .announcement-dialog { padding: 26px 22px 28px; border-radius: 14px; }
  .announcement-dialog h2 { font-size: 21px; }
}

/* ===== 右侧内容区：常驻可拖动下拉条（仅桌面端） ===== */
@media (min-width: 1025px) {
  .main-grid {
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 215, 140, 0.45) rgba(255, 255, 255, 0.06);
  }

  .main-grid::-webkit-scrollbar {
    width: 12px;
  }

  .main-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
  }

  .main-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 140, 0.45);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
  }

  .main-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 140, 0.7);
    background-clip: padding-box;
  }
}

/* ===== 一键详情：预览灯箱小一号 ===== */
#imageModal.md-preview .modal-content {
  max-width: 680px;
  max-height: 72vh;
}

/* ===== 一键详情：贴底记录区（结构与生图/抠图的记录区一致） ===== */
#mdWBHistBar {
  max-height: 62vh;
  overflow-y: auto;
}

#mdWBHistBar .md-his-del {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  font-size: 11px;
  border-radius: 50%;
  background: rgba(214, 72, 72, 0.9);
  color: #fff;
  cursor: pointer;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.15s ease;
}

#mdWBHistBar .history-thumb-wrapper:hover .md-his-del {
  opacity: 1;
}

/* 一键详情记录区：每张图下方的单张下载按钮 */
.md-his-dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  margin-top: 5px;
  padding: 4px 6px;
  border: 1px solid rgba(255, 215, 140, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  color: #a09080;
  font-size: 0.68rem;
  font-family: inherit;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.md-his-dl:hover {
  border-color: #e8b84c;
  color: #eae5de;
  background: rgba(232, 184, 76, 0.10);
}
.md-his-dl .dl-ico {
  width: 12px;
  height: 12px;
  margin-right: 4px;
  vertical-align: -1px;
}

.field-group .pref-item {
  margin-bottom: 8px;
}

.field-group .pref-item:last-child {
  margin-bottom: 0;
}

.field-group .pref-item > label {
  display: block;
  font-size: 0.72rem;
  color: #8a7a6a;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.field-group .pref-item .pref-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 26px 8px 10px;
  font-size: 0.8rem;
  font-family: inherit;
  border-radius: 10px;
  border: 1px solid rgba(255, 215, 140, 0.12);
  background-color: rgba(255, 255, 255, 0.04);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a7a6a'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  color: #eae5de;
  cursor: pointer;
  outline: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.field-group .pref-item .pref-select:hover {
  border-color: rgba(255, 215, 140, 0.35);
}

.field-group .pref-item .pref-select:focus {
  border-color: #e8b84c;
  box-shadow: 0 0 0 3px rgba(232, 184, 76, 0.06);
}

.field-group .pref-item .pref-select option {
  background: #1d1914;
  color: #eae5de;
}

body.light-mode .field-group .pref-item > label {
  color: #6a5f52;
}

body.light-mode .field-group .pref-item .pref-select {
  background-color: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.1);
  color: #1a1612;
}

body.light-mode .field-group .pref-item .pref-select option {
  background: #ffffff;
  color: #1a1612;
}

/* 「清空」按钮 */
.field-group .info-clear {
  flex: 0 0 auto;
  margin-left: 8px;
  font-size: 0.72rem;
  font-weight: 400;
  color: #8a7a6a;
  text-decoration: underline;
  cursor: pointer;
  user-select: none;
}

.field-group .info-clear:hover {
  color: #e8b84c;
}

body.light-mode .field-group .info-clear {
  color: #6a5f52;
}

/* ===== 线框统一加亮（暗色 0.40 / 亮色 0.18）===== */
.quality-btn,
.size-btn,
.prompt-templates .template-tag,
.prompt-templates .template-manage-btn,
body .field-group input,
body .field-group textarea,
body .field-group select,
.upload-zone,
.btn-secondary,
.btn-ghost {
  border-color: rgba(255, 215, 140, 0.40);
}

/* 参考图小方格：原规则带 !important，这里同样加 */
.upload-grid-item,
.upload-grid-item.clear-all-item {
  border-color: rgba(255, 215, 140, 0.40) !important;
}

/* 参考图虚线区：底色 0.40、悬停 0.60（保持悬停有反馈） */
.upload-zone:hover {
  border-color: rgba(255, 215, 140, 0.60);
}

body.light-mode .quality-btn,
body.light-mode .size-btn,
body.light-mode .prompt-templates .template-tag,
body.light-mode .prompt-templates .template-manage-btn,
body.light-mode .field-group input,
body.light-mode .field-group textarea,
body.light-mode .field-group select,
body.light-mode .upload-zone,
body.light-mode .btn-secondary,
body.light-mode .btn-ghost {
  border-color: rgba(0, 0, 0, 0.18);
}

body.light-mode .upload-grid-item,
body.light-mode .upload-grid-item.clear-all-item {
  border-color: rgba(0, 0, 0, 0.18) !important;
}

/* ===== 一键详情：详情页拼接预览弹框 ===== */
.stitch-ico {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: -2px;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='7' rx='1.5'/%3E%3Crect x='3' y='14' width='18' height='7' rx='1.5'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='7' rx='1.5'/%3E%3Crect x='3' y='14' width='18' height='7' rx='1.5'/%3E%3C/svg%3E");
}

.stitch-overlay {
  position: fixed;
  inset: 0;
  z-index: 3200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.62);
}
.stitch-overlay.is-open { display: flex; }
body.stitch-open { overflow: hidden; }

.stitch-box {
  width: min(940px, 100%);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: #1a1714;
  border: 1px solid rgba(255, 215, 140, 0.18);
  border-radius: 14px;
  overflow: hidden;
  color: #eae5de;
}

.stitch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255, 215, 140, 0.10);
}
.stitch-title { font-size: 0.95rem; font-weight: 600; color: #e8c98a; }
.stitch-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #a09080;
  font-size: 1.1rem;
  cursor: pointer;
}
.stitch-close:hover { background: rgba(255, 215, 140, 0.12); color: #eae5de; }

.stitch-body {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  min-height: 0;
  height: min(70vh, 620px);
}

/* 左：9:21 竖屏预览，内部可上下滚动 */
.stitch-preview {
  flex: 0 0 auto;
  height: 100%;
  aspect-ratio: 9 / 21;
  overflow-y: auto;
  overflow-x: hidden;
  background: #0f0e0d;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 10px;
  position: relative;
}
.stitch-preview img { display: block; width: 100%; height: auto; }
.stitch-preview-inner { display: block; background: #fff; min-height: 100%; }

/* 长框里每一张：悬停显示 上移 / 下移 / 移除 */
.stitch-cell { position: relative; line-height: 0; }

/* 重叠过渡：这一张的尾部渐隐 + 下一张往上收，头尾交叉淡化
   重叠像素由 JS 写入 --stitch-ov（30 / 50 / 80px） */
.stitch-cell.ov-fade img {
  -webkit-mask-image: linear-gradient(to bottom, #000000 calc(100% - var(--stitch-ov, 80px)), rgba(0, 0, 0, 0));
  mask-image: linear-gradient(to bottom, #000000 calc(100% - var(--stitch-ov, 80px)), rgba(0, 0, 0, 0));
}
.stitch-cell.ov-pull { margin-top: calc(-1 * var(--stitch-ov, 80px)); }

/* 主图拼接（横向）：图片统一高度、左右排列，横向滚动；重叠改为左右方向 */
/* 主图拼接：整框改成 21:9 横屏展示，素材区移到下方 */
.stitch-box.h-mode { width: min(1100px, 96vw); }
.stitch-body.h-mode {
  flex-direction: column;
  height: min(56vh, 500px);     /* 主图拼接：整体压低，别留大片空白 */
}
.stitch-preview.h-mode {
  width: 100%;
  flex: 0 0 auto;
  height: min(22vh, 220px);     /* 横屏条：压低高度，别占太多竖向空间 */
  aspect-ratio: auto;
  max-height: none;
  overflow: auto;
}
.stitch-body.h-mode .stitch-side {
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
  align-content: stretch;      /* 两栏撑满高度，空状态文字才会垂直居中 */
}
.stitch-body.h-mode .stitch-side .stitch-bar { flex: 1 1 100%; align-self: flex-start; }
.stitch-body.h-mode .stitch-side .stitch-sec { flex: 1 1 100%; min-width: 0; min-height: 0; }
.stitch-body.h-mode .stitch-side #mdWBStitchListSec { flex: 0 0 auto; }
.stitch-body.h-mode .stitch-side .stitch-picker { flex: 1 1 100%; }
.stitch-preview.h-mode .stitch-preview-inner {
  display: flex;
  flex-direction: row;
  align-items: center;              /* 横屏条里图片垂直居中 */
  height: 100%;
  min-height: 0;
  width: max-content;               /* 跟着内容撑开，白底才不会在右边断开露出深色 */
  min-width: 100%;
  gap: var(--stitch-hgap, 20px);      /* 每张之间留白间隔，不拼在一起 */
  padding: var(--stitch-hgap, 20px);
  box-sizing: border-box;
}
.stitch-preview.h-mode .stitch-cell { height: calc(100% - var(--stitch-hgap, 20px) * 2); flex: 0 0 auto; }
.stitch-preview.h-mode .stitch-cell img { height: 100%; width: auto; }
/* 长图查看层的横向模式：左右滚动，一张张看 */
.stitch-view-box.h-mode {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: auto;
  height: 62vh;
  margin: 0 auto;
  gap: var(--stitch-hgap, 20px);
  padding: var(--stitch-hgap, 20px);
  box-sizing: content-box;
}
.stitch-view-box.h-mode .stitch-cell { height: 100%; flex: 0 0 auto; }
.stitch-view-box.h-mode .stitch-cell img { height: 100%; width: auto; }

.stitch-seam-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: #8a7a6a;
}
.stitch-seam-label select {
  padding: 6px 9px;
  border: 1px solid rgba(255, 215, 140, 0.15);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: #eae5de;
  font-size: 0.75rem;
  outline: none;
  color-scheme: dark;
}
.stitch-seam-label select option { background-color: #1b1815; color: #eae5de; }

/* 长图全屏查看：整张详情长图，可上下滚动 */
.stitch-view {
  position: fixed;
  inset: 0;
  z-index: 3300;
  display: none;
  background: rgba(0, 0, 0, 0.9);
}
.stitch-view.is-open { display: block; }
.stitch-view-scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 46px 16px 70px;
  box-sizing: border-box;
}
.stitch-view-box {
  width: min(750px, 88vw);
  margin: 0 auto;
  background: #ffffff;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.55);
}
.stitch-view-box .stitch-cell img { display: block; width: 100%; height: auto; }
.stitch-view-close {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 2;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 215, 140, 0.45);
  border-radius: 50%;
  background: rgba(20, 18, 16, 0.85);
  color: #eae5de;
  font-size: 1.05rem;
  cursor: pointer;
}
.stitch-view-close:hover { background: #e8b84c; border-color: #e8b84c; color: #0f0e0d; }
.stitch-cell-tools {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.stitch-cell:hover .stitch-cell-tools { opacity: 1; }
.stitch-cell-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  line-height: 1;
  border: 1px solid rgba(255, 215, 140, 0.5);
  border-radius: 6px;
  background: rgba(15, 14, 13, 0.82);
  color: #eae5de;
  font-size: 0.8rem;
  cursor: pointer;
}
.stitch-cell-btn:hover:not(:disabled) { background: #e8b84c; border-color: #e8b84c; color: #0f0e0d; }
.stitch-cell-btn:disabled { opacity: 0.32; cursor: default; }
.stitch-cell-del:hover:not(:disabled) { background: #d64848; border-color: #d64848; color: #fff; }
.stitch-preview-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.76rem;
  line-height: 1.8;
  color: #6a5f52;
  padding: 16px;
}

.stitch-side {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stitch-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stitch-hint { font-size: 0.72rem; color: #8a7a6a; }
.stitch-msg { font-size: 0.72rem; color: #e8745a; margin-right: auto; }

/* 右侧两个分区：上=素材库，下=已加入拼接 */
.stitch-sec {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  flex: 1 1 0;
}
.stitch-sec .stitch-list { flex: 1 1 auto; }
/* 已加入拼接那一块只剩一行提示（列表已隐藏），不参与撑高 */
#mdWBStitchListSec { flex: 0 0 auto; }
/* 空态：内容在区域内居中展示 */
.stitch-list.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
}
.stitch-list.is-empty > div {
  text-align: center;
  color: #6a5f52;
  font-size: 0.74rem;
  line-height: 1.9;
  padding: 8px;
}

/* 素材缩略图：不再有「＋ 添加」浮层（上传即自动拼入），只保留右上角删除 */
.stitch-preview.dragging { border-color: #e8b84c; box-shadow: 0 0 0 2px rgba(232, 184, 76, 0.35) inset; }
.stitch-box.dragging { border-color: #e8b84c; box-shadow: 0 0 0 2px rgba(232, 184, 76, 0.25); }

.stitch-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 8px;
  align-content: start;
  padding: 2px;
}
.stitch-item {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 6px;
  overflow: hidden;
  cursor: grab;
  aspect-ratio: 3 / 4;
  background: rgba(255, 255, 255, 0.04);
}
.stitch-item img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.stitch-item-no {
  position: absolute;
  top: 2px;
  left: 2px;
  z-index: 2;
  font-size: 0.6rem;
  font-weight: 700;
  color: #0f0e0d;
  background: #e8b84c;
  padding: 0 5px;
  border-radius: 4px;
}
.stitch-item-del {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 5;              /* 高于图片与渐变层，保证点得到 */
  width: 20px;
  height: 20px;
  line-height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(214, 72, 72, 0.92);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.stitch-item:hover .stitch-item-del { opacity: 1; }
.stitch-item-del:hover { background: #d64848; }

.stitch-picker {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.stitch-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 8px;
  margin: 8px 0;
}
.stitch-pick {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 3 / 4;
  background: rgba(255, 255, 255, 0.04);
}
.stitch-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stitch-pick.on { border-color: #e8b84c; box-shadow: 0 0 0 2px rgba(232, 184, 76, 0.35) inset; }
.stitch-pick-no {
  position: absolute;
  bottom: 2px;
  left: 2px;
  font-size: 0.6rem;
  color: #0f0e0d;
  background: rgba(232, 184, 76, 0.9);
  padding: 0 5px;
  border-radius: 4px;
}
.stitch-picker-foot { display: flex; gap: 8px; justify-content: flex-end; padding-bottom: 4px; }

.stitch-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 215, 140, 0.10);
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .stitch-overlay { padding: 10px; }
  .stitch-body { flex-direction: column; height: auto; max-height: 62vh; overflow-y: auto; }
  .stitch-preview { width: auto; height: auto; max-height: 46vh; aspect-ratio: 9 / 21; margin: 0 auto; }
  .stitch-list, .stitch-picker { max-height: 30vh; }
}
