:root {
  --bg: #f6f1e8;
  --paper: rgba(255, 255, 255, 0.78);
  --ink: #17313a;
  --muted: #546f79;
  --accent: #1f9f8f;
  --accent-deep: #126c66;
  --sand: #d9b36f;
  --line: rgba(23, 49, 58, 0.12);
  --shadow: 0 30px 80px rgba(18, 54, 59, 0.18);
  --radius: 0.25rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 20%, rgba(31, 159, 143, 0.18), transparent 28%),
    radial-gradient(circle at 85% 12%, rgba(217, 179, 111, 0.18), transparent 24%),
    linear-gradient(135deg, #f3eee3 0%, #ecf5f3 55%, #f8f2ea 100%);
  font-family: "IBM Plex Sans", sans-serif;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 32px auto;
  display: grid;
  gap: 24px;
}

.hero {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--radius) + 10px);
  background: linear-gradient(135deg, rgba(15, 73, 79, 0.96), rgba(33, 130, 122, 0.92));
  color: #f7f7f3;
  padding: 34px;
  box-shadow: var(--shadow);
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(10px);
  opacity: 0.7;
}

.hero::before {
  width: 240px;
  height: 240px;
  right: -60px;
  top: -80px;
  background: rgba(217, 179, 111, 0.34);
}

.hero::after {
  width: 180px;
  height: 180px;
  left: -40px;
  bottom: -60px;
  background: rgba(255, 255, 255, 0.09);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  opacity: 0.82;
  margin-bottom: 18px;
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 10px 22px rgba(14, 52, 59, 0.2);
  flex: 0 0 auto;
}

h1 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(36px, 6vw, 72px);
  line-height: 0.96;
  max-width: 780px;
  letter-spacing: -0.04em;
}

.hero p {
  max-width: 720px;
  margin: 18px 0 0;
  color: rgba(247, 247, 243, 0.86);
  font-size: 16px;
  line-height: 1.7;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hero-badges span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.hero-card {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  padding: 18px;
  backdrop-filter: blur(10px);
}

.hero-card strong {
  display: block;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.68;
  margin-bottom: 8px;
}

.hero-card span {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.88);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.wallet-banner {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.wallet-stat {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
}

.wallet-stat span {
  display: block;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.68;
}

.wallet-stat strong {
  display: block;
  margin-top: 10px;
  font-family: "Fraunces", serif;
  font-size: 34px;
  letter-spacing: -0.04em;
}

.wallet-stat small {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(247, 247, 243, 0.82);
}

.wallet-stat.compact strong {
  font-size: 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.metric {
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.metric strong {
  display: block;
  font-family: "Fraunces", serif;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.metric span {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(247, 247, 243, 0.78);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}

.panel {
  background: var(--paper);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.history-panel {
  padding: 28px;
}

.history-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.history-empty {
  margin-top: 10px;
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(23, 49, 58, 0.16);
  color: var(--muted);
  line-height: 1.7;
}

.history-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
  margin-bottom: 24px;
}

.history-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 16px;
  border-top: 1px solid rgba(23, 49, 58, 0.05);
}

.pagination-btn {
  appearance: none;
  border: 1px solid rgba(23, 49, 58, 0.1);
  background: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(31, 159, 143, 0.05);
}

.pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 13px;
  color: var(--muted);
}

.history-item {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(17, 57, 62, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.history-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(17, 57, 62, 0.1);
}

.history-item.is-loading {
  border-color: rgba(31, 159, 143, 0.32);
  box-shadow: 0 16px 44px rgba(31, 159, 143, 0.14);
}

.history-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, rgba(31, 159, 143, 0.1), rgba(217, 179, 111, 0.1));
  overflow: hidden;
}

.history-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.history-preview.is-clickable {
  cursor: zoom-in;
  position: relative;
}

.history-preview-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  z-index: 5;
  pointer-events: none;
}

.history-item:hover .history-preview img {
  transform: scale(1.05);
}

.history-preview.no-img {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  opacity: 0.5;
}

.history-preview.no-img.loading {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 20%, rgba(217, 179, 111, 0.22), transparent 34%),
    linear-gradient(135deg, rgba(31, 159, 143, 0.18), rgba(17, 57, 62, 0.08));
  color: var(--accent-deep);
  opacity: 1;
}

.history-preview.no-img.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: historyLoadingSweep 1.8s ease-in-out infinite;
}

.history-preview.no-img.loading strong,
.history-preview.no-img.loading small {
  position: relative;
  z-index: 1;
}

.history-preview.no-img.loading small {
  max-width: 72%;
  color: var(--muted);
  text-align: center;
}

.history-loading-dot {
  position: relative;
  z-index: 1;
  width: 26px;
  height: 26px;
  border: 3px solid rgba(31, 159, 143, 0.18);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 0.85s linear infinite;
}

@keyframes historyLoadingSweep {
  to {
    transform: translateX(100%);
  }
}

.history-body {
  padding: 18px;
  flex: 1;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.history-chip {
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(31, 159, 143, 0.08);
  color: var(--accent-deep);
  font-size: 11px;
  font-weight: 700;
}

.history-chip.status-loading {
  background: rgba(217, 179, 111, 0.2);
  color: #7a5013;
}

.history-chip.status-warning {
  background: rgba(217, 179, 111, 0.18);
  color: #7a5013;
}

.history-chip.status-failed {
  background: rgba(196, 73, 64, 0.12);
  color: #a33930;
}

.history-time {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.history-title {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-actions {
  padding: 0 18px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-link {
  display: block;
  text-align: center;
  padding: 10px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  transition: filter 0.2s ease;
}

.history-link:hover {
  filter: brightness(1.1);
}

.history-btn-sm {
  flex: 1 1 0;
  padding: 8px 4px;
  font-size: 12px;
  text-decoration: none;
  text-align: center;
  border-radius: 0.25rem;
  white-space: nowrap;
}

.form-panel {
  padding: 30px;
}

.commerce-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 20px;
}

.commerce-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.68);
  box-shadow: 0 18px 40px rgba(17, 57, 62, 0.08);
}

.commerce-card strong {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.commerce-inline {
  display: flex;
  gap: 10px;
  align-items: center;
}

.commerce-inline input {
  flex: 1 1 auto;
}

.quote-breakdown {
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
}

.secondary-button {
  border: 1px solid rgba(23, 49, 58, 0.12);
  border-radius: 0.25rem;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button.light {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.12);
  color: #f7f7f3;
}

.link-button {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.side-panel {
  padding: 28px;
  position: sticky;
  top: 20px;
}

.pricing-stack {
  display: grid;
  gap: 12px;
  margin: 0 0 18px;
}

.pricing-card,
.pricing-placeholder {
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.68);
}

.pricing-card strong {
  display: block;
  font-size: 20px;
  font-family: "Fraunces", serif;
  letter-spacing: -0.03em;
}

.pricing-card span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
}

.pricing-card em {
  display: inline-flex;
  margin-top: 10px;
  font-style: normal;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(31, 159, 143, 0.12);
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 700;
}

.section-title {
  font-family: "Fraunces", serif;
  font-size: 30px;
  margin: 0 0 6px;
  letter-spacing: -0.03em;
}

.section-copy {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.field,
.field-wide {
  display: grid;
  gap: 8px;
}

.field-wide,
.field-2col {
  grid-column: 1 / -1;
}

@media (min-width: 981px) {
  .field-2col {
    grid-column: span 2;
  }
}

.composer-field textarea {
  min-height: 180px;
  padding: 20px;
  font-size: 16px;
  line-height: 1.7;
}

.prompt-mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.prompt-mode-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.prompt-mode-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.prompt-mode-option span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(23, 49, 58, 0.1);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.prompt-mode-option input:checked + span {
  background: linear-gradient(135deg, rgba(31, 159, 143, 0.16), rgba(217, 179, 111, 0.14));
  border-color: rgba(31, 159, 143, 0.34);
  color: var(--ink);
  transform: translateY(-1px);
}

.prompt-batch-block {
  margin-top: 8px;
}

.prompt-batch-block textarea {
  min-height: 180px;
}

.mode-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.mode-card {
  appearance: none;
  border: 1px solid rgba(23, 49, 58, 0.1);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 0.25rem;
  padding: 18px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.mode-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.mode-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.mode-card:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 159, 143, 0.32);
  box-shadow: 0 14px 30px rgba(18, 54, 59, 0.08);
}

.mode-card.is-active {
  background: linear-gradient(135deg, rgba(31, 159, 143, 0.14), rgba(217, 179, 111, 0.14));
  border-color: rgba(31, 159, 143, 0.42);
  box-shadow: 0 16px 36px rgba(18, 54, 59, 0.12);
}

.suggestion-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.suggestion-chip {
  appearance: none;
  border: 1px solid rgba(23, 49, 58, 0.1);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 0.25rem;
  padding: 10px 14px;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.suggestion-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 159, 143, 0.34);
  background: rgba(255, 255, 255, 1);
}

label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  margin-top: -2px;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 15px 16px;
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

textarea {
  min-height: 132px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(31, 159, 143, 0.68);
  box-shadow: 0 0 0 4px rgba(31, 159, 143, 0.14);
  transform: translateY(-1px);
}

.capsule-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.capsule {
  border-radius: 999px;
  border: 1px solid rgba(23, 49, 58, 0.1);
  background: rgba(255, 255, 255, 0.72);
  padding: 9px 13px;
  font-size: 12px;
  color: var(--muted);
}

.submit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
}

.loading-panel {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1 1 100%;
  padding: 18px 20px;
  border-radius: 24px;
  border: 1px solid rgba(23, 49, 58, 0.08);
  background: linear-gradient(135deg, rgba(31, 159, 143, 0.12), rgba(217, 179, 111, 0.14));
  box-shadow: 0 16px 34px rgba(18, 54, 59, 0.08);
}

.loading-panel[hidden] {
  display: none !important;
}

.loading-spinner {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 3px solid rgba(18, 108, 102, 0.18);
  border-top-color: var(--accent-deep);
  animation: spin 0.9s linear infinite;
  flex: 0 0 auto;
}

.loading-copy {
  display: grid;
  gap: 4px;
}

.loading-copy strong {
  font-size: 15px;
  letter-spacing: 0.01em;
}

.loading-copy span,
.loading-copy small {
  color: var(--muted);
  line-height: 1.6;
}

.loading-copy small {
  font-size: 12px;
}

.button {
  appearance: none;
  border: 0;
  border-radius: 0.25rem;
  padding: 16px 24px;
  min-width: 210px;
  cursor: pointer;
  color: #f4f8f6;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  box-shadow: 0 14px 30px rgba(22, 108, 102, 0.26);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(22, 108, 102, 0.3);
}

.button:disabled {
  cursor: wait;
  opacity: 0.88;
  transform: none;
  box-shadow: 0 12px 28px rgba(18, 54, 59, 0.18);
}

.footnote {
  font-size: 12px;
  color: var(--muted);
  max-width: 460px;
  line-height: 1.7;
}

.submit-row.is-submitting {
  align-items: flex-start;
}

.submit-row.is-submitting .footnote {
  display: none;
}

.upload-zone {
  border: 1px dashed rgba(23, 49, 58, 0.2);
  border-radius: 22px;
  padding: 30px 20px;
  background: rgba(255, 255, 255, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transition: all 0.2s ease;
}

.upload-zone.dragging {
  border-color: var(--accent);
  background: rgba(31, 159, 143, 0.08);
  border-style: solid;
  transform: translateY(-2px);
}

.upload-zone::after {
  content: "💡 支持直接拖入图片或 Ctrl+V 粘贴图片";
  font-size: 12px;
  color: var(--muted);
  opacity: 0.8;
}

.image-preview {
  margin-top: 8px;
  border-radius: 22px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px dashed rgba(23, 49, 58, 0.16);
}

.advanced-panel {
  border-radius: 24px;
  border: 1px solid rgba(23, 49, 58, 0.08);
  background: rgba(255, 255, 255, 0.62);
  padding: 4px 18px 18px;
}

.advanced-panel summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.advanced-panel summary::-webkit-details-marker {
  display: none;
}

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding-top: 6px;
}

.preview-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.preview-header strong {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.preview-header span {
  color: var(--muted);
  font-size: 12px;
}

.preview-header-actions {
  display: flex;
  align-items: center;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 10px;
}

.preview-card {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(23, 49, 58, 0.08);
  box-shadow: 0 6px 14px rgba(18, 54, 59, 0.06);
}

.preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: opacity 0.3s ease;
}

.preview-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.preview-error {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  font-size: 10px;
  padding: 4px;
  text-align: center;
  z-index: 6;
}

.preview-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.preview-card span {
  display: block;
  padding: 6px 6px 8px;
  font-size: 10px;
  line-height: 1.3;
  color: var(--muted);
  word-break: break-all;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.mini-item {
  border-top: 1px solid rgba(23, 49, 58, 0.08);
  padding-top: 14px;
}

.mini-item strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.mini-item span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.status-note {
  margin-top: 18px;
  border-radius: 22px;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(31, 159, 143, 0.10), rgba(217, 179, 111, 0.12));
  color: var(--ink);
  font-size: 13px;
  line-height: 1.7;
  border: 1px solid rgba(23, 49, 58, 0.08);
}

.info-stack {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.info-card {
  border-radius: 22px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(23, 49, 58, 0.08);
}

.info-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.info-card span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.info-card.accent {
  background: linear-gradient(135deg, rgba(31, 159, 143, 0.12), rgba(217, 179, 111, 0.14));
}

.toggle-block[hidden] {
  display: none !important;
}

body.is-submitting .shell {
  opacity: 0.96;
}

body.is-submitting .form-panel {
  box-shadow: 0 36px 90px rgba(18, 54, 59, 0.22);
}

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

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

  .side-panel {
    position: static;
  }

  .hero-grid,
  .hero-metrics,
  .wallet-banner,
  .commerce-strip,
  .history-list,
  .mode-picker,
  .advanced-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .commerce-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .history-head {
    flex-direction: column;
  }
}

/* Collapsible Sections Support */
.hero-details, .commerce-details, .history-details {
  margin: 14px 0;
  border-radius: var(--radius);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-details summary, .commerce-details summary, .history-details summary {
  cursor: pointer;
  outline: none;
  list-style: none; /* Hide default arrow */
  user-select: none;
  display: flex;
  align-items: center;
}

/* For browsers that don't support list-style: none on summary */
.hero-details summary::-webkit-details-marker,
.commerce-details summary::-webkit-details-marker,
.history-details summary::-webkit-details-marker {
  display: none;
}

.hero-details summary::before,
.commerce-details summary::before,
.history-details summary::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-right: 12px;
  flex-shrink: 0;
}

.hero-details[open] summary::before,
.commerce-details[open] summary::before,
.history-details[open] summary::before {
  transform: rotate(45deg);
}

.hero-details summary {
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
}

.hero-details summary:hover {
  color: #fff;
}

.hero-collapsible {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  animation: slideDown 0.4s ease-out forwards;
}

.commerce-details {
  background: rgba(255, 255, 255, 0.4);
  padding: 0 16px;
  border: 1px solid var(--line);
}

.commerce-details .section-title {
  margin: 0;
  padding: 16px 0;
  font-size: 22px; /* Slightly smaller for the summary */
}

.commerce-details[open] {
  background: transparent;
  padding: 0;
  border: none;
}

.commerce-details[open] .section-title {
  padding-bottom: 0;
}

.history-details summary.history-head {
  display: flex; /* Override summary default if needed */
  align-items: flex-start;
  gap: 24px;
  padding: 0;
  background: transparent;
  border: none;
}

/* Ensure the chevron is aligned with the title text */
.history-details summary.history-head::before {
  margin-top: 14px;
}

.history-collapsible {
  margin-top: 24px;
  animation: slideDown 0.4s ease-out forwards;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── NEW STEP-BY-STEP FLOW STYLES ─── */
.channel-top-section {
  background: var(--surface-low);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.channel-config-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.channel-status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-lowest);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.model-select-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.model-select-wrapper select {
  flex: 1;
  padding: 8px;
}

.form-step {
  margin-bottom: 32px;
  animation: fadeIn 0.4s ease;
}

.step-title {
  font-family: "Fraunces", serif;
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-title::before {
  content: "";
  width: 4px;
  height: 18px;
  background: var(--accent);
  border-radius: 2px;
}

/* Mode Picker (Step 1) */
.mode-picker-new {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.mode-card-new {
  cursor: pointer;
  position: relative;
}

.mode-card-new input {
  position: absolute;
  opacity: 0;
}

.mode-card-new .card-content {
  padding: 24px;
  border-radius: 12px;
  border: 2px solid rgba(23, 49, 58, 0.08);
  background: var(--paper);
  text-align: center;
  transition: all 0.2s ease;
  height: 100%;
}

.mode-card-new .icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.mode-card-new strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.mode-card-new span {
  font-size: 0.85rem;
  color: var(--muted);
}

.mode-card-new input:checked + .card-content {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(31, 159, 143, 0.1), rgba(217, 179, 111, 0.05));
  box-shadow: 0 10px 30px rgba(31, 159, 143, 0.12);
}

/* Scale Picker (Step 2) */
.scale-picker {
  display: flex;
  gap: 12px;
}

.scale-option {
  flex: 1;
  cursor: pointer;
}

.scale-option input {
  position: absolute;
  opacity: 0;
}

.scale-option span {
  display: block;
  padding: 14px;
  text-align: center;
  border-radius: 8px;
  border: 1px solid rgba(23, 49, 58, 0.12);
  background: white;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.scale-option input:checked + span {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.scale-picker.mini .scale-option span {
  padding: 8px 12px;
  font-size: 0.85rem;
}

/* Individual Prompts */
.individual-list {
  display: grid;
  gap: 16px;
  margin-top: 12px;
}

.individual-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  border-radius: 10px;
  align-items: center;
}

.individual-item img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.individual-item textarea {
  flex: 1;
  min-height: 60px;
  padding: 10px;
  font-size: 0.9rem;
}

/* Advanced Step */
.advanced-step {
  margin-bottom: 24px;
  background: rgba(23, 49, 58, 0.03);
  border-radius: 8px;
}

.advanced-step summary {
  padding: 12px;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
}

.advanced-grid {
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* 强制统一待处理队列的图片预览大小 */
.preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.preview-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: white;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-item.uploading::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.6);
  z-index: 1;
}

.error-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #ff4d4f;
  color: white;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

.loader-mini {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  margin-left: -12px;
  border: 2px solid rgba(18, 108, 102, 0.2);
  border-top-color: var(--accent-deep);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 5;
}

/* API Channel Config */
.channel-inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

@media (min-width: 600px) {
  .channel-inputs {
    flex-direction: row;
    align-items: flex-end;
  }
}

.channel-inputs input {
  flex: 1;
}

.channel-inputs button {
  white-space: nowrap;
}

.suggestion-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

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

.text-link {
  background: none;
  border: none;
  color: var(--accent-deep);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
}

@media (max-width: 600px) {
  .mode-picker-new {
    grid-template-columns: 1fr;
  }
}

/* Lightbox Enhanced Gallery Style */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0; 
  animation: fadeIn 0.3s ease;
}

.lightbox:not([hidden]) {
  display: flex;
}

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(12px);
}

.lightbox-container {
  position: relative;
  z-index: 2;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.lightbox-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
  flex-shrink: 0;
}

.lightbox-title-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.lightbox-close-minimal {
  position: absolute;
  top: -22px;
  right: -22px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.lightbox-close-minimal:hover {
  background: var(--accent);
  transform: scale(1.1);
  box-shadow: 0 0 15px var(--accent);
}

.lightbox-prompt {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 6px 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  max-width: 60vw;
}

.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 20px;
}

.lightbox-btn-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
}

.lightbox-btn-action:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.lightbox-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.lightbox-sidebar {
  width: 90px;
  background: rgba(0, 0, 0, 0.3);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 12px;
  overflow-y: auto;
  scrollbar-width: none;
}

.lightbox-sidebar::-webkit-scrollbar {
  display: none;
}

.lightbox-thumb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  opacity: 0.6;
}

.lightbox-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lightbox-thumb:hover {
  opacity: 1;
  transform: scale(1.04);
}

.lightbox-thumb.is-active {
  border-color: var(--accent);
  opacity: 1;
  box-shadow: 0 0 15px rgba(31, 159, 143, 0.4);
}

.lightbox-viewer {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lightbox-stage {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
  background: #0b0b0b;
}

.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 32px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  z-index: 5;
}

.lightbox-nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-nav-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

.lightbox-nav-btn.prev { left: 40px; }
.lightbox-nav-btn.next { right: 40px; }

.lightbox-footer {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

@media (max-width: 768px) {
  .lightbox-sidebar {
    width: 100%;
    height: 80px;
    flex-direction: row;
    position: absolute;
    bottom: 0;
    left: 0;
    border-right: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
  }
  
  .lightbox-thumb {
    width: 56px;
    height: 56px;
  }
  
  .lightbox-viewer {
    margin-bottom: 80px;
  }
  
  .lightbox-nav-btn {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }
}

/* 增强预览图可点击提示 */
.preview-item {
  cursor: zoom-in;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.preview-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ── Channel Config Section (V2 Premium) ── */
.channel-config-section {
  background: white;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.04);
  border: 1px solid #eee;
  margin-bottom: 32px;
}

.section-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #999;
  margin-bottom: 20px;
}

.channel-tabs-container {
  display: flex;
  background: #f4f4f7;
  padding: 6px;
  border-radius: 14px;
  gap: 6px;
  margin-bottom: 24px;
}

.channel-tab-item {
  flex: 1;
  position: relative;
  cursor: pointer;
}

.channel-tab-item input {
  position: absolute;
  opacity: 0;
}

.channel-tab-item .tab-content {
  padding: 12px;
  text-align: center;
  border-radius: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: #666;
  font-weight: 600;
  font-size: 0.9rem;
}

.channel-tab-item input:checked + .tab-content {
  background: white;
  color: var(--accent-deep);
  box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}

.channel-manual-inputs {
  margin-bottom: 20px;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.channel-manual-inputs .input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.channel-status-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-top: 20px;
  border-top: 1px solid #f0f0f0;
}

.btn-test-channel {
  background: #333;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-test-channel:hover {
  background: #000;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-test-channel:active {
  transform: scale(0.98);
}

.test-feedback {
  font-size: 0.9rem;
  color: #888;
  flex: 1;
}

.test-feedback b {
  color: #333;
}

/* 本地结果预览弹窗 */
.local-result-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.local-result-content {
  background: var(--card-bg, #fff);
  width: 100%;
  max-width: 600px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
}

.local-result-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color, #eee);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.local-result-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.local-result-header button {
  background: none;
  border: none;
  color: var(--text-muted, #888);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.local-result-body {
  padding: 24px;
  overflow-y: auto;
  max-height: 70vh;
}

.local-result-image {
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg-body, #f4f4f4);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.local-result-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.local-result-info label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted, #888);
  margin-bottom: 8px;
}

.local-result-info p {
  margin: 0;
  line-height: 1.6;
  color: var(--text-main, #333);
}

.local-result-footer {
  padding: 16px 24px;
  background: rgba(0,0,0,0.05);
  text-align: center;
}

.secondary-link {
  font-size: 0.85rem;
  color: var(--text-muted, #888);
  text-decoration: underline;
}

.history-link-btn {
  background: var(--btn-primary-bg, #1f9f8f);
  color: var(--btn-primary-text, #fff);
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1 1 calc(50% - 4px);
  min-width: 120px;
}

.history-link-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}
