/* ============================================
   全局样式 / 整体配色（深色风格，让封面更突出）
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #0a0a0a;
  color: #f5f5f5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* 顶部导航 */
header {
  padding: 20px 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-family: "Playfair Display", serif;
  font-weight: 900;
  font-size: 28px;
  letter-spacing: -1px;
}
.logo span {
  color: #ff3a3a;
}
.tagline {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.5px;
}

/* 主内容区：左控制面板 + 右预览 */
main {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 0;
  min-height: calc(100vh - 70px);
}
@media (max-width: 900px) {
  main {
    grid-template-columns: 1fr;
  }
  /* 窄屏下控制面板限制最大宽度居中，避免内容被拉得过宽 */
  .controls {
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
    border-right: none;
  }
  .preview {
    padding: 24px 16px;
  }
}

/* ============================================
   左侧控制面板
   ============================================ */
.controls {
  padding: 28px;
  background: #111;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
}
.section {
  margin-bottom: 28px;
}
.section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 12px;
  font-weight: 600;
}

/* 上传区 */
.dropzone {
  display: block;            /* label 默认 inline，给 block 子元素会渲染异常 */
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}
.dropzone:hover,
.dropzone.dragging {
  border-color: #ff3a3a;
  background: rgba(255, 58, 58, 0.05);
}
.dropzone-icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.4;
}
.dropzone-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}
.dropzone-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 4px;
}
.dropzone.has-preview {
  padding: 0;
  border-style: solid;
  background: #0f0f0f;
}
.upload-preview {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: center;
  padding: 12px;
  text-align: left;
}
.upload-preview-img {
  width: 96px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #050505;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.upload-preview-title {
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
}
.upload-preview-meta {
  color: rgba(255, 255, 255, 0.48);
  font-size: 11px;
  margin-top: 4px;
  line-height: 1.5;
}
.upload-preview-action {
  color: #ff6b6b;
  font-size: 11px;
  font-weight: 700;
  margin-top: 8px;
}
#fileInput {
  display: none;
}

/* 风格选择 - 用网格展示杂志，按地区分类，可折叠 */
.style-category {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  letter-spacing: 0.2px;
  color: rgba(255, 255, 255, 0.76);
  margin: 10px 0;
  padding: 13px 14px;
  min-height: 48px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}
.style-category:hover {
  color: #fff;
  border-color: rgba(255, 58, 58, 0.45);
  background: rgba(255, 58, 58, 0.08);
}
.style-category:first-child {
  margin-top: 0;
}
.style-category::before,
.style-category::after {
  content: none;
}
.style-category .flag {
  font-size: 17px;
  flex-shrink: 0;
}
.style-category .chevron {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.style-category.collapsed .chevron {
  transform: rotate(-90deg);
}
.style-grid.hidden {
  display: none;
}
.style-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 8px 0 16px;
}
.style-card {
  min-height: 78px;
  padding: 16px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  background: rgba(255, 255, 255, 0.035);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.style-card:hover {
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.06);
}
.style-card.active {
  border-color: #ff3a3a;
  background: rgba(255, 58, 58, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 58, 58, 0.18) inset;
}
.style-card-name {
  font-weight: 900;
  font-size: 16px;
  margin-bottom: 5px;
  color: #fff;
}
.style-card-desc {
  font-size: 12px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.56);
  letter-spacing: 0.3px;
}

/* 表单元素 */
.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 6px;
}
.field input[type="text"],
.field select {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: #ff3a3a;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* 滑块 */
.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.slider-row label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  min-width: 60px;
}
.slider-row input[type="range"] {
  flex: 1;
  accent-color: #ff3a3a;
}
.slider-row .value {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  min-width: 36px;
  text-align: right;
}

/* 按钮 */
.btn {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary {
  background: #ff3a3a;
  color: #fff;
}
.btn-primary:hover {
  background: #ff5252;
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  margin-top: 8px;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ============================================
   右侧预览区
   ============================================ */
.preview {
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #1a1a1a 0%, #0a0a0a 100%);
}
.canvas-wrap {
  position: relative;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  max-width: 100%;
}
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}
.preview-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}
.preview-actions .btn {
  width: auto;
  padding: 10px 20px;
}

/* 空状态提示 */
.empty-hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.3);
  text-align: center;
  pointer-events: none;
}
.empty-hint h3 {
  font-family: "Playfair Display", serif;
  font-size: 28px;
  margin-bottom: 8px;
  font-weight: 700;
}
.empty-hint p {
  font-size: 13px;
}

/* 即将上线的提示 */
.coming-soon {
  opacity: 0.4;
  pointer-events: none;
}
.coming-soon::after {
  content: "Soon";
  display: inline-block;
  font-size: 9px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ============================================
   设置按钮 + 弹窗（顶栏齿轮）
   ============================================ */
.settings-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.settings-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}
.account-btn {
  background: rgba(255, 58, 58, 0.12);
  border: 1px solid rgba(255, 58, 58, 0.35);
  color: #fff;
  height: 38px;
  min-width: 76px;
  padding: 0 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  transition: all 0.15s;
}
.account-btn:hover {
  background: rgba(255, 58, 58, 0.2);
  border-color: #ff3a3a;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.open {
  display: flex;
}
.modal {
  background: #161616;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
}
.modal-auth {
  max-width: 420px;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}
.auth-tab {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
}
.auth-tab.active {
  border-color: #ff3a3a;
  color: #fff;
  background: rgba(255, 58, 58, 0.14);
}
.auth-message {
  min-height: 18px;
  margin-top: 12px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
}
.auth-message.error {
  color: #ff6b6b;
}
.auth-message.success {
  color: #57d68d;
}
.redeem-box {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.redeem-row {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 8px;
}
.redeem-row input {
  margin-bottom: 0;
}
.redeem-row .btn {
  padding: 0;
  min-height: 42px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.modal-title {
  font-size: 18px;
  font-weight: 700;
}
.modal-close {
  background: rgba(255, 255, 255, 0.06);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-size: 16px;
}
.modal-close:hover {
  background: rgba(255, 255, 255, 0.14);
}
.modal .field input[type="password"],
.modal .field input[type="text"],
.modal .field select {
  width: 100%;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
}
.modal .field input:focus,
.modal .field select:focus {
  outline: none;
  border-color: #ff3a3a;
}
.modal-help {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 6px;
  line-height: 1.5;
}
.modal-help a {
  color: #ff7a7a;
  text-decoration: none;
}
.modal-help a:hover {
  text-decoration: underline;
}
.warning-box {
  background: rgba(255, 200, 50, 0.08);
  border: 1px solid rgba(255, 200, 50, 0.2);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12px;
  color: rgba(255, 220, 150, 0.95);
  line-height: 1.6;
  margin-top: 14px;
}
.saved-indicator {
  display: inline-block;
  font-size: 11px;
  color: #66dd88;
  margin-left: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}
.saved-indicator.show {
  opacity: 1;
}

/* 素材库弹窗 - 比设置弹窗大 */
.modal-gallery {
  max-width: 1100px;
  width: 92vw;
}
.gallery-empty {
  text-align: center;
  padding: 60px 20px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
}
.gallery-empty .empty-icon {
  font-size: 48px;
  opacity: 0.3;
  margin-bottom: 14px;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 4px;
}
.gallery-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.15s;
  cursor: pointer;
  position: relative;
}
.gallery-card:hover {
  border-color: rgba(255, 58, 58, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}
.gallery-card-img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  background: #1a1a1a;
}
.gallery-card-info {
  padding: 10px;
}
.gallery-card-title {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gallery-card-meta {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gallery-card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.gallery-card:hover .gallery-card-actions {
  opacity: 1;
}
.gallery-action-btn {
  width: 28px;
  height: 28px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.gallery-action-btn:hover {
  background: rgba(255, 58, 58, 0.7);
  border-color: rgba(255, 58, 58, 1);
}
.gallery-action-btn.delete:hover {
  background: rgba(255, 58, 58, 0.85);
}
.gallery-header-info {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 14px;
}
.gallery-header-info strong {
  color: rgba(255, 255, 255, 0.75);
}

/* 顶栏的素材库按钮（和齿轮按钮对应） */
.gallery-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.gallery-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}
.gallery-btn .badge {
  background: #ff3a3a;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 日志弹窗 */
.modal-log {
  max-width: 980px;
  width: 92vw;
}
.log-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.log-filter-btn {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-family: inherit;
}
.log-filter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
.log-filter-btn.active {
  background: rgba(255, 58, 58, 0.15);
  border-color: rgba(255, 58, 58, 0.5);
  color: #fff;
}
.log-clear-btn {
  margin-left: auto;
  color: rgba(255, 122, 122, 0.7);
}
.log-list {
  max-height: 65vh;
  overflow-y: auto;
  padding-right: 4px;
}
.log-entry {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  transition: border-color 0.15s;
}
.log-entry.safety {
  border-left-color: #ff7a7a;
}
.log-entry.network {
  border-left-color: #ffbb55;
}
.log-entry.api {
  border-left-color: #c89aff;
}
.log-entry.success {
  border-left-color: #66dd88;
}
.log-entry-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.log-icon {
  flex-shrink: 0;
  font-size: 16px;
}
.log-summary-text {
  flex: 1;
  min-width: 0;
}
.log-summary-title {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.log-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
}
.log-summary-meta {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
}
.log-expand-icon {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  transition: transform 0.2s;
}
.log-entry.expanded .log-expand-icon {
  transform: rotate(90deg);
}
.log-entry-details {
  display: none;
  margin-top: 12px;
}
.log-entry.expanded .log-entry-details {
  display: block;
}
.log-detail-block {
  margin-bottom: 10px;
}
.log-detail-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.log-copy-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
  font-family: inherit;
  text-transform: none;
  letter-spacing: 0;
}
.log-copy-btn:hover {
  background: rgba(255, 58, 58, 0.15);
  color: #fff;
}
.log-detail-content {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 12px;
  border-radius: 5px;
  font-family: "SF Mono", "Monaco", "Menlo", monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  max-height: 280px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}
.log-detail-content.error-content {
  color: #ffaaaa;
}
.log-empty {
  text-align: center;
  padding: 40px 20px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
}

/* ============================================
   AI 改造区块 + 加载状态
   ============================================ */
.ai-section {
  background: linear-gradient(135deg, rgba(255, 58, 58, 0.08), rgba(180, 60, 220, 0.06));
  border: 1px solid rgba(255, 58, 58, 0.18);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 28px;
}
.ai-section .section-title {
  color: #ff8888;
  margin-bottom: 10px;
}
.ai-section-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.5;
  margin-bottom: 12px;
}
.btn-ai {
  background: linear-gradient(135deg, #ff3a3a, #b53cdc);
  color: #fff;
  font-weight: 700;
}
.btn-ai:hover {
  filter: brightness(1.1);
}
.btn-ai:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ai-status {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 8px;
  min-height: 14px;
}
.ai-status.error {
  color: #ff7a7a;
}
.ai-status.success {
  color: #66dd88;
}

/* 任务队列列表 */
.task-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}
.task-list:empty {
  display: none;
}
/* 滚动条美化 */
.task-list::-webkit-scrollbar {
  width: 6px;
}
.task-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 3px;
}
.task-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}
.task-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}
.task-list-header {
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 14px;
  margin-bottom: 8px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.task-list-header.hidden {
  display: none;
}
.task-clear-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 10px;
  cursor: pointer;
  padding: 0;
  text-transform: none;
  letter-spacing: 0;
}
.task-clear-btn:hover {
  color: #ff7a7a;
}
.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  font-size: 11px;
  transition: all 0.15s;
}
.task-row.running {
  border-color: rgba(255, 58, 58, 0.35);
  background: rgba(255, 58, 58, 0.06);
}
.task-row.done {
  cursor: pointer;
  border-color: rgba(102, 221, 136, 0.2);
}
.task-row.done:hover {
  background: rgba(102, 221, 136, 0.08);
}
.task-row.done.active {
  border-color: rgba(102, 221, 136, 0.55);
  background: rgba(102, 221, 136, 0.12);
}
.task-row.error {
  border-color: rgba(255, 122, 122, 0.3);
  background: rgba(255, 122, 122, 0.05);
}
.task-row.pending {
  opacity: 0.7;
}
.task-status {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
}
.task-info {
  flex: 1;
  min-width: 0;
}
.task-name {
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-meta {
  color: rgba(255, 255, 255, 0.5);
  font-size: 10px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-remove {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  flex-shrink: 0;
}
.task-remove:hover {
  color: #ff7a7a;
}
.task-spin-sm {
  width: 14px;
  height: 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-top-color: #ff3a3a;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* AI 改造区块里的美颜选择行 */
.ai-beauty-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
}
.ai-beauty-row > span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
}
.ai-beauty-row select {
  flex: 1;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  color: #fff;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.ai-beauty-row select:focus {
  outline: none;
}
.ai-beauty-row select:focus-visible {
  outline: none;
  border-color: #ff3a3a;
}

.photo-toggle {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  padding: 3px;
  margin-top: 10px;
}
.photo-toggle button {
  flex: 1;
  padding: 6px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
}
.photo-toggle button.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.photo-toggle button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* 模板叠加开关（iOS 风格 switch） */
.template-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
}
.template-switch-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.4;
}
.template-switch-sub {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 2px;
}
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
  margin-left: 12px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  transition: 0.2s;
}
.switch-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .switch-slider {
  background: #ff3a3a;
}
.switch input:checked + .switch-slider::before {
  transform: translateX(16px);
}

/* 后台任务浮动指示器（不阻塞 UI） */
.task-indicator {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(10, 10, 10, 0.92);
  border: 1px solid rgba(255, 58, 58, 0.4);
  border-radius: 10px;
  padding: 10px 14px;
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 10;
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5);
  max-width: 280px;
  min-width: 240px;
  animation: slideIn 0.25s ease;
}
.task-indicator > div:not(.task-spinner) {
  flex: 1;
  min-width: 0;
}
.task-indicator.show {
  display: flex;
}
.task-indicator.success {
  border-color: rgba(102, 221, 136, 0.5);
}
.task-indicator.error {
  border-color: rgba(255, 122, 122, 0.5);
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.task-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: #ff3a3a;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  flex-shrink: 0;
}
.task-indicator.success .task-spinner {
  border: 2px solid #66dd88;
  border-top-color: #66dd88;
  animation: none;
  position: relative;
}
.task-indicator.success .task-spinner::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #66dd88;
  font-weight: 700;
}
.task-indicator.error .task-spinner {
  border: 2px solid #ff7a7a;
  border-top-color: #ff7a7a;
  animation: none;
  position: relative;
}
.task-indicator.error .task-spinner::after {
  content: "✗";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff7a7a;
  font-weight: 700;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.task-text {
  font-size: 12px;
  color: #fff;
  line-height: 1.3;
}
.task-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}
.task-progress {
  height: 5px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}
.task-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff3a3a, #ff7a3a);
  box-shadow: 0 0 14px rgba(255, 58, 58, 0.45);
  transition: width 0.65s ease;
}
.task-indicator.success .task-progress-bar {
  background: linear-gradient(90deg, #66dd88, #9dffb6);
  box-shadow: 0 0 14px rgba(102, 221, 136, 0.45);
}
.task-indicator.error .task-progress-bar {
  background: linear-gradient(90deg, #ff7a7a, #ff3a3a);
  box-shadow: 0 0 14px rgba(255, 122, 122, 0.45);
}

@media (max-width: 900px) {
  header {
    padding: 18px 16px 14px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: start;
  }
  .logo {
    font-size: 30px;
    line-height: 1.08;
    letter-spacing: -0.5px;
    max-width: 100%;
  }
  .logo span {
    display: inline;
    white-space: nowrap;
  }
  .header-right {
    width: 100%;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .header-right::-webkit-scrollbar {
    display: none;
  }
  .tagline {
    display: none;
  }
  .gallery-btn,
  .account-btn,
  .settings-btn {
    height: 42px;
    flex: 0 0 auto;
    border-radius: 10px;
  }
  .gallery-btn {
    min-width: 88px;
    justify-content: center;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
  }
  .account-btn {
    min-width: 92px;
    font-size: 13px;
    white-space: nowrap;
  }
  .settings-btn {
    width: 42px;
  }
  .controls {
    max-width: none;
    padding: 24px 16px;
  }
  .dropzone {
    padding: 36px 16px;
  }
}

@media (max-width: 520px) {
  .logo {
    font-size: 26px;
  }
  .gallery-btn {
    min-width: 78px;
    padding: 0 10px;
  }
  .account-btn {
    min-width: 82px;
    padding: 0 10px;
  }
  .style-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .style-card {
    min-height: 74px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}
