:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #6b7280;
  --secondary-hover: #4b5563;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --success: #10b981;
  --error: #ef4444;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #eff6ff 0%, var(--bg) 40%);
  color: var(--text);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

/* Header */
.header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 60%, #3b82f6 100%);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left { flex-shrink: 0; }

.header-brand { text-align: center; flex: 1; }

.header-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.header h1 { font-size: 1.15rem; font-weight: 700; color: #fff; line-height: 1.2; }
.subtitle { color: rgba(255,255,255,0.65); font-size: 0.72rem; margin-top: 1px; }

/* ── 功能切换按钮 ─────────────────────────────────────────────────── */
.feature-switch-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 0 12px;
  height: 36px;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 20px;
  background: rgba(255,255,255,0.12);
  color: #fff; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
  flex-shrink: 0;
  box-sizing: border-box;
}
.feature-switch-btn:hover { background: rgba(255,255,255,0.22); }
.feature-switch-icon { font-size: 1rem; }

/* ── 登录按钮 ─────────────────────────────────────────────────────── */
.btn-login {
  padding: 8px 18px;
  height: 36px;
  border: 1.5px solid rgba(255,255,255,0.5);
  border-radius: 20px;
  background: rgba(255,255,255,0.15);
  color: #fff; font-size: 0.875rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
  white-space: nowrap;
}
.btn-login:hover { background: rgba(255,255,255,0.25); }

/* ── 用户信息面板（已登录） ──────────────────────────────────────── */
.user-info-panel {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip-wrap {
  position: relative;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  padding: 4px 12px 4px 4px;
  height: 36px;
  box-sizing: border-box;
  cursor: pointer;
  color: #fff;
  transition: background 0.15s;
}
.user-chip:hover { background: rgba(255,255,255,0.22); }

.user-avatar {
  width: 38px;
  height: 28px;
  /*border-radius: 50%;*/
  /*background: linear-gradient(135deg, #2563eb, #60a5fa);*/
  color: #fff; font-size: 0.75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  /*border: 2px solid rgba(255,255,255,0.5);*/
}

.user-chip-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  line-height: 1.15;
}
.user-chip-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,0.95);
  line-height: 1.15;
}
.user-chip-phone {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.15;
}

.user-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-points {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 20px;
  padding: 4px 10px;
  height: 36px;
  box-sizing: border-box;
}
.points-gem { color: rgba(255,220,100,0.9); font-size: 0.65rem; }
#points-display { font-weight: 700; color: #fff; }
.points-unit { color: rgba(255,255,255,0.65); font-size: 0.72rem; }

.btn-history-link {
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  height: 36px;
  box-sizing: border-box;
}
.btn-history-link:hover { background: rgba(255,255,255,0.22); }

/* ── 账户菜单（右上角 hamburger） ─────────────────────────────────── */
.account-menu { position: relative; }

.account-menu-btn {
  width: 34px; height: 34px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.account-menu-btn:hover { background: rgba(255,255,255,0.22); }

/* ── 下拉菜单 ─────────────────────────────────────────────────────── */
.account-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  min-width: 160px;
  overflow: hidden;
  z-index: 500;
}
.dropdown-item {
  display: block; width: 100%;
  padding: 12px 16px;
  border: none; background: none;
  text-align: left; font-size: 0.9rem;
  color: var(--text); cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.dropdown-item:hover { background: #f1f5f9; }
.dropdown-item--danger { color: var(--error); }
.dropdown-item--danger:hover { background: #fef2f2; }
.dropdown-divider { height: 1px; background: var(--border); margin: 2px 0; }

@keyframes points-flash {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.25); color: var(--error); }
  100% { transform: scale(1); }
}
.points-deduct { animation: points-flash 0.4s ease; }

/* Container */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* Step Indicator */
.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  gap: 0;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.3s;
}

.step span {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.step.active .step-circle {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,0.35);
}

.step.active span {
  color: var(--primary);
  font-weight: 600;
}

.step.done .step-circle {
  background: linear-gradient(135deg, #10b981, #34d399);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}

.step-line {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--border), rgba(37,99,235,0.15));
  min-width: 20px;
  max-width: 60px;
  margin-bottom: 20px;
}

/* Card */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--primary);
  position: relative;
  overflow: hidden;
}

.card h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.hint {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 20px;
}

.hidden {
  display: none !important;
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 16px;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: #eff6ff;
}

.dropzone-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.dropzone p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.link {
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
}

.hint-small {
  font-size: 0.75rem !important;
  margin-top: 6px;
}

/* Requirement input */
.requirement-box {
  margin-bottom: 16px;
}

.requirement-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.requirement-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--card-bg);
  resize: vertical;
  line-height: 1.5;
  transition: border-color 0.15s;
}

.requirement-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* Thumbnails */
.thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.thumb-wrapper {
  position: relative;
  width: 80px;
  height: 80px;
}

.thumb-wrapper img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.thumb-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--error);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Buttons */
.btn {
  padding: 10px 22px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

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

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  box-shadow: 0 4px 12px rgba(37,99,235,0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #f8fafc;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: #e2e8f0;
}

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

/* Loading */
.loading-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  gap: 12px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Progress */
.progress-bar {
  width: 100%;
  max-width: 360px;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  width: 0%;
  transition: width 0.5s ease;
}

.progress-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Product Info */
.product-info {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 0.875rem;
}

.product-info strong {
  color: var(--text);
}

.product-info p {
  color: var(--text-muted);
  margin-top: 4px;
}

/* Step 0 header (title + DEV toggle) */
.step0-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.step0-header h2 { margin-bottom: 4px; }
.step0-header .hint { margin-bottom: 0; }

/* Dev notes list */
.dev-notes-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dev-notes-list li {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 6px 10px;
  background: #f1f5f9;
  border-radius: 6px;
  border-left: 3px solid var(--primary);
  line-height: 1.4;
}
.dev-notes-list li strong {
  color: var(--text);
}

/* Generation prompt blocks in Step 2 dev panel */
.gen-prompt-block + .gen-prompt-block {
  margin-top: 10px;
}
.gen-prompt-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}
.gen-prompt-text {
  margin: 0;
}

/* Options Grid */
.step2-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.step2-header h2 { margin-bottom: 0; }

.btn-dev-toggle {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #f1f5f9;
  color: var(--text-muted);
  cursor: pointer;
  letter-spacing: 0.05em;
}
.btn-dev-toggle.active {
  background: #fef9c3;
  border-color: #fcd34d;
  color: #92400e;
}

/* Dev Panel */
.dev-panel {
  margin-top: 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  background: #fafafa;
}

.dev-section + .dev-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.dev-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.prompt-display {
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  max-height: 300px;
  overflow-y: auto;
  color: var(--text);
  margin: 0;
}

.product-group-header {
  grid-column: 1 / -1;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 0 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}

/* Multi-product drag layout */
.options-grid.options-grid--multi {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.product-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--card-bg);
}

.product-row-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.drag-hint {
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.6;
}

.product-row-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  min-height: 80px;
  border-radius: 6px;
  padding: 4px;
  transition: background 0.15s, outline 0.15s;
}

.product-row-cards .option-card {
  width: 100%;
}

.product-row-cards.dropover {
  background: #eff6ff;
  outline: 2px dashed var(--primary);
}

.option-card.dragging {
  opacity: 0.35;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.option-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: center;
}

.option-card:hover {
  border-color: var(--primary);
  background: #eff6ff;
}

.option-card.selected {
  border-color: var(--primary);
  background: #eff6ff;
  position: relative;
}

.option-card.selected::after {
  content: "\2713";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.option-card img {
  width: 100%;
  height: 120px;
  object-fit: contain;
  border-radius: 6px;
  margin-bottom: 10px;
  background: var(--bg);
}

.option-card .option-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.option-card .quality-warn {
  font-size: 0.7rem;
  color: #d97706;
  background: #fef3c7;
  border-radius: 4px;
  padding: 2px 6px;
  margin-top: 4px;
  line-height: 1.3;
}

.option-card .option-angle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Unusable Photos Section */
.unusable-section {
  margin-top: 12px;
  margin-bottom: 4px;
}

.unusable-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 4px 0;
  font-weight: 600;
}

.unusable-toggle:hover {
  color: var(--text);
}

.unusable-arrow {
  font-size: 0.7rem;
}

.unusable-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.option-card--unusable {
  opacity: 0.55;
  cursor: default;
  border-style: dashed;
  border-color: var(--border);
}

.option-card--unusable:hover {
  border-color: var(--border);
  background: transparent;
}

.unusable-reason {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
  text-align: left;
}

/* Result image */
.result-item img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
  margin: 0 auto;
}

/* Task Counter */
.task-counter {
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 600;
  margin-top: 4px;
}

/* Results Grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 8px;
}

.result-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--bg);
  position: relative;
}

.result-item .result-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  text-align: center;
}

.result-item.result-error {
  border-color: var(--error);
  background: #fef2f2;
}

.result-item.result-error .result-label {
  color: var(--error);
}

/* Toast Banner */
.toast-banner {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow);
  z-index: 1000;
  font-size: 0.875rem;
  opacity: 1;
  transition: opacity 0.3s ease;
  max-width: calc(100vw - 32px);
  width: max-content;
}

.toast-banner span {
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 20;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
  word-break: break-all;
  white-space: normal;
  line-height: 1.5;
  max-height: calc(20 * 1.5em);
}

.toast-banner.toast-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--error);
}

.toast-banner.toast-success {
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  color: #065f46;
}

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.6;
}
.toast-close:hover {
  opacity: 1;
}

.toast-banner.toast-error .toast-close {
  color: var(--error);
}

.toast-banner.toast-success .toast-close {
  color: #065f46;
}

/* Composite selection state on result cards */
.result-item.composite-selected {
  border: 2px solid var(--primary);
  background: #eff6ff;
  cursor: pointer;
  position: relative;
}

/* ── #5 Numbered composite badge ─────────────────────────────────────────── */
.composite-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.result-item:not(.result-error) {
  cursor: pointer;
}

.result-item:not(.result-error):hover {
  border-color: var(--primary);
}

/* Composite section */
.composite-section {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.composite-divider {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* Composite result preview */
.composite-result {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.composite-result img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
}

/* ── #1 Per-card action buttons ─────────────────────────────────────────── */
.result-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: flex-end;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
}

/* ============================================================
   Mobile Responsive (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
  /* Header：三栏布局，功能左 / 标题居中 / 用户信息右 */
  .header { padding: 10px 14px; gap: 6px; }
  .header h1 { font-size: 1rem; }
  .subtitle { display: none; }
  .header-brand { flex: 0 0 auto; text-align: center; }
  .header-left, .header-right { flex: 0 0 auto; }
  /* 功能按钮只显示图标 */
  .feature-switch-label { display: none; }
  .feature-switch-btn { padding: 0 10px; }
  /* 登录按钮 */
  .btn-login { padding: 0 14px; height: 36px; font-size: 0.875rem; }
  /* 用户信息面板：头像+昵称+手机号，积分，历史直接显示 */
  .user-info-panel { gap: 6px; }
  .user-chip { padding: 0 10px 0 3px; height: 36px; }
  .user-chip-text { display: none; }  /* 移动端隐藏文字，只留头像 */
  .user-meta { gap: 4px; }
  .user-points { font-size: 0.72rem; padding: 0 8px; height: 36px; }
  .btn-history-link { padding: 0 8px; font-size: 0.72rem; height: 36px; }

  /* Container */
  .container { padding: 10px 14px; }

  /* 步骤条 */
  .steps { margin-bottom: 12px; }
  .step span { display: none; }
  .step-circle { width: 26px; height: 26px; font-size: 0.72rem; }
  .step-line { min-width: 10px; max-width: 28px; margin-bottom: 0; }

  /* Card */
  .card { padding: 14px 12px; border-radius: 14px; }

  /* 隐藏桌面拖拽区，显示移动端上传按钮 */
  .dropzone { display: none !important; }
  .mobile-upload-panel { display: flex !important; }

  /* 移动端上传面板 */
  .mobile-upload-panel {
    flex-direction: column;
    align-items: center;
    margin-bottom: 14px;
    gap: 10px;
  }
  .mobile-upload-tip {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
  }
  .mobile-upload-btns {
    display: flex;
    gap: 12px;
    width: 100%;
  }
  .btn-upload-source {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 8px;
    border: 2px dashed var(--border);
    border-radius: 14px;
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
  }
  .btn-upload-source:active { transform: scale(0.97); background: #f1f5f9; }
  .btn-upload-source:hover { border-color: var(--primary); border-style: solid; background: #eff6ff; }
  .upload-source-icon { font-size: 2.2rem; line-height: 1; }

  /* 缩略图 */
  .thumb-wrapper { width: 64px; height: 64px; }
  .thumb-wrapper img { width: 64px; height: 64px; }

  /* 选项网格 */
  .options-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .option-card { padding: 8px; }
  .option-card img { height: 80px; }
  .option-card .option-label { font-size: 0.78rem; }

  /* 多商品行 */
  .product-row-cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .drag-hint { display: none; }

  /* 结果网格 */
  .results-grid { grid-template-columns: 1fr; gap: 10px; }
  .result-item { padding: 10px; }

  /* 操作按钮行 */
  .actions { flex-direction: column; gap: 8px; }
  .actions .btn { width: 100%; padding: 13px; font-size: 0.95rem; }
  .result-actions { flex-wrap: wrap; }

  /* Toast 提示 */
  .toast-banner {
    top: 12px;
    font-size: 0.82rem; padding: 10px 12px;
    max-width: calc(100vw - 24px);
  }

  /* 弹窗 */
  .tom-box { padding: 18px 14px; width: 95vw; }
  .feature-box { padding: 18px 14px; }

  /* 聚合图 */
  .composite-result img { max-width: 100%; }
  .progress-bar { max-width: 100%; }
}

/* ============================================================
   Tablet Responsive (481px - 768px)
   ============================================================ */
@media (min-width: 481px) and (max-width: 768px) {
  .container { max-width: 100%; }
  /* 平板用桌面拖拽区，隐藏移动端按钮 */
  .dropzone { display: flex !important; }
  .mobile-upload-panel { display: none !important; }
  .options-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .results-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── 版本切换器（卡片左上角） ────────────────────────────────────────────── */
.version-switcher {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(0,0,0,0.45);
  border-radius: 20px;
  padding: 2px 6px;
  z-index: 2;
}
.ver-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 2px;
  line-height: 1;
}
.ver-btn:disabled { opacity: 0.35; cursor: default; }
.ver-label {
  font-size: 0.72rem;
  color: #fff;
  font-weight: 600;
  min-width: 2.5ch;
  text-align: center;
}

/* ── 卡片 loading 遮罩 ─────────────────────────────────────────────────── */
.card-loading-overlay {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

/* ── 重新生成确认条 ────────────────────────────────────────────────────── */
.regen-confirm {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.regen-feedback-input {
  width: 100%;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  resize: vertical;
  font-family: inherit;
  box-sizing: border-box;
}
.regen-confirm-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.regen-confirm-row span {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex: 1;
}

/* ── 聚合图操作按钮行 ────────────────────────────────────────────────────── */
.composite-result-actions {
  display: flex;
  gap: 8px;
}

/* ��─ 文字叠加弹窗 ─────────────────────────────────────────────────────── */
.text-overlay-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
}
.tom-box {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px 28px;
  width: min(420px, 92vw);
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.tom-title { font-size: 1.05rem; font-weight: 600; margin: 0; }
.tom-hint  { font-size: 0.82rem; color: var(--text-muted); margin: 0; }
.tom-textarea {
  width: 100%; box-sizing: border-box;
  padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 0.9rem; resize: vertical;
  font-family: inherit;
}
.tom-actions { display: flex; justify-content: flex-end; gap: 8px; }
.tom-loading { display: flex; align-items: center; gap: 10px;
               font-size: 0.88rem; color: var(--text-muted); }

/* 移动端上传面板（桌面隐藏） */
.mobile-upload-panel {
  display: none;
  flex-direction: column;
  align-items: center;
  margin-bottom: 16px;
  gap: 10px;
}

/* 登录弹窗 */
.auth-modal {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.auth-box {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 32px 36px;
  width: min(400px, 95vw);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  display: flex; flex-direction: column; gap: 18px;
}
.auth-title {
  font-size: 1.35rem; font-weight: 700; text-align: center; margin: 0;
}
.auth-subtitle { font-size: 0.88rem; color: var(--text-muted); text-align: center; margin: -10px 0 0; }
.auth-field { display: flex; flex-direction: column; gap: 10px; }
.auth-label { font-size: 1rem; font-weight: 600; color: var(--text); line-height: 1.4; }
.auth-input {
  width: 100%; box-sizing: border-box;
  padding: 13px 14px; border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 1rem; font-family: inherit; color: var(--text);
  background: var(--card-bg); transition: border-color 0.15s;
}
.auth-input:focus { outline: none; border-color: var(--primary); }
.auth-row { display: flex; gap: 10px; align-items: stretch; }
.auth-row .auth-input { flex: 1; align-self: stretch; }
.auth-send-btn {
  padding: 13px 18px; border: 1.5px solid var(--primary); border-radius: 10px;
  background: transparent; color: var(--primary); font-size: 1rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.auth-send-btn:hover:not(:disabled) { background: var(--primary); color: #fff; }
.auth-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.auth-submit { width: 100%; padding: 14px; font-size: 1rem; margin-top: 6px; }
.auth-close {
  position: absolute; top: 14px; right: 18px;
  background: none; border: none; cursor: pointer;
  font-size: 1.4rem; color: var(--text-muted); line-height: 1;
}
.auth-error { font-size: 0.88rem; color: var(--error); text-align: center; min-height: 1.2em; }
.auth-loading { text-align: center; padding: 24px; font-size: 0.95rem; color: var(--text-muted); }
.auth-mock-hint {
  font-size: 0.8rem; color: #065f46;
  text-align: center; background: #d1fae5; border-radius: 8px;
  padding: 8px 12px; border: 1px solid #6ee7b7;
}
.auth-mock-hint code { font-weight: 700; }

/* 密码登录/注册模式 Tab */
.pw-auth-box { min-width: 320px; }
.pw-auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}
.pw-auth-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 10px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.pw-auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* 管理员用户列表 */
.admin-user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  gap: 12px;
}
.admin-user-info { flex: 1; }
.admin-user-phone { font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; }
.admin-user-meta { display: flex; gap: 10px; font-size: 0.78rem; color: var(--text-muted); flex-wrap: wrap; }
.admin-user-points { color: var(--primary); font-weight: 600; }
.status-approved { color: var(--success); }
.status-pending { color: var(--error); }
.admin-user-actions { display: flex; gap: 6px; flex-shrink: 0; }

@media (max-width: 480px) {
  .admin-user-item { flex-direction: column; align-items: flex-start; }
  .admin-user-actions { width: 100%; }
  .admin-user-actions .btn { flex: 1; }
}

/* 移动端登录弹窗 */
@media (max-width: 480px) {
  .auth-box { padding: 24px 20px; }
  .auth-row { flex-direction: column; }
  .auth-send-btn { width: 100%; text-align: center; }
}

/* ── 历史记录弹窗 ─────────────────────────────────────────────────────────── */
.history-modal {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.history-box {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px 28px;
  width: min(520px, 95vw);
  max-height: 80vh;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  overflow: hidden;
}
.history-title { font-size: 1.05rem; font-weight: 700; margin: 0; display: flex; align-items: center; justify-content: space-between; }
.history-list { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.history-empty { text-align: center; padding: 32px 16px; color: var(--text-muted); font-size: 0.9rem; }
.history-item {
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.history-item-time { font-size: 0.78rem; color: var(--text-muted); }
.history-item-stats { font-size: 0.8rem; color: var(--text); display: flex; gap: 12px; }
.history-item-stats span { display: flex; flex-direction: column; align-items: center; }
.history-item-stats strong { font-size: 1rem; font-weight: 700; }
.history-item-points { color: var(--primary); font-weight: 700; font-size: 0.9rem; }
.history-loading { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px; color: var(--text-muted); font-size: 0.88rem; }
.history-more { text-align: center; padding: 8px; }

/* ── 历史页面（step-5）─────────────────────────────────────────────── */
.history-page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.history-page-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
#history-page-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 200px;
}
.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.history-item > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.history-item--clickable {
  cursor: pointer;
  transition: background 0.15s;
}
.history-item--clickable:hover {
  background: var(--bg-hover);
}
.history-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.history-item-arrow {
  font-size: 1.2rem;
  color: var(--text-muted);
  line-height: 1;
}
.history-item--clickable:hover .history-item-arrow {
  color: var(--primary);
}
.history-item-time { font-size: 0.78rem; color: var(--text-muted); }
.history-item-stats { font-size: 0.8rem; color: var(--text); display: flex; gap: 12px; }
.history-item-stats span { display: flex; flex-direction: column; align-items: center; }
.history-item-stats strong { font-size: 1rem; font-weight: 700; }

@media (max-width: 480px) {
  .history-box { padding: 16px; max-height: 90vh; }
}
.tom-loading .spinner { width: 24px; height: 24px; border-width: 3px; }

/* ── 充值套餐 ─────────────────────────────────────────────────────────── */
#recharge-packages {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.recharge-pkg-btn {
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  line-height: 1.4;
  text-align: center;
  border-radius: var(--radius);
}
.recharge-pkg-btn strong { font-size: 0.95rem; }
.recharge-pkg-btn small { color: var(--text-muted); font-size: 0.75rem; }
.recharge-pkg-btn:hover { border-color: var(--primary); color: var(--primary); }
#recharge-points { font-size: 0.85rem; color: var(--text-muted); text-align: center; margin: -8px 0 12px; }
#recharge-points strong { color: var(--primary); }

@media (max-width: 480px) {
  #recharge-packages { grid-template-columns: repeat(2, 1fr); }
}

/* ── 功能选择弹窗 ─────────────────────────────────────────────────── */
.feature-modal {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.feature-box {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 28px 32px;
  width: min(480px, 95vw);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  display: flex; flex-direction: column; gap: 16px;
}
.feature-box-title { font-size: 1.1rem; font-weight: 700; text-align: center; margin: 0; }
.feature-list { display: flex; flex-direction: column; gap: 10px; }
.feature-item {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.feature-item:hover { border-color: var(--primary); background: #eff6ff; }
.feature-item.active { border-color: var(--primary); background: #eff6ff; }
.feature-item-icon { font-size: 2rem; line-height: 1; flex-shrink: 0; }
.feature-item-info { flex: 1; }
.feature-item-name { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.feature-item-desc { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.feature-item-badge {
  font-size: 0.7rem; padding: 2px 8px; border-radius: 10px;
  background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; font-weight: 600;
}
.feature-item-badge.done { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.feature-item-badge.coming { background: #ede9fe; color: #5b21b6; border-color: #c4b5fd; }

@media (max-width: 480px) {
  .feature-box { padding: 20px 16px; }
  .header { padding: 12px 12px; }
  .feature-switch-label { display: none; }
}
