/* ═══════════════ Sommify — UI v3 ═══════════════ */

:root {
  --bg: #f3f1fa;
  --bg-alt: #ffffff;
  --card: #ffffff;
  --text: #1e1b2e;
  --text-dim: #746a94;
  --muted: #a79bc9;
  --border: #e6e1f5;
  --border-strong: #d3c9ef;

  --wine: #8b7cc8;
  --wine-dark: #6a58a8;
  --wine-tint: #f1eefa;
  --wine-shade: #e3ddf5;

  --gold: #a99adf;
  --gold-tint: #f1eefa;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(90, 70, 130, 0.05);
  --shadow: 0 2px 10px rgba(107, 88, 168, 0.06), 0 10px 30px rgba(107, 88, 168, 0.08);
  --shadow-hover: 0 4px 18px rgba(107, 88, 168, 0.10), 0 14px 36px rgba(107, 88, 168, 0.12);
  --shadow-glow: 0 0 0 3px rgba(139, 124, 200, 0.2), 0 6px 22px rgba(139, 124, 200, 0.2);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at 10% 8%, rgba(255,255,255,0.95) 0%, transparent 40%),
    radial-gradient(circle at 85% 5%, rgba(255,255,255,0.85) 0%, transparent 36%),
    radial-gradient(circle at 88% 20%, rgba(200,195,225,0.55) 0%, transparent 42%),
    radial-gradient(circle at 5% 55%, rgba(210,208,222,0.5) 0%, transparent 42%),
    radial-gradient(circle at 95% 65%, rgba(184,168,232,0.4) 0%, transparent 45%),
    radial-gradient(circle at 30% 90%, rgba(225,220,235,0.5) 0%, transparent 45%),
    radial-gradient(circle at 60% 40%, rgba(255,255,255,0.5) 0%, transparent 30%),
    linear-gradient(160deg, #f9f8fc 0%, #f2f0f7 45%, #eeecf3 100%);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ─── Hero headline ─── */
.hero-headline {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 32px 4px;
}

.hero-headline h2 {
  font-size: 34px;
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 6px;
}

.hero-headline h2 b {
  font-weight: 800;
  background: linear-gradient(120deg, var(--wine-dark), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-headline p {
  margin: 0;
  font-size: 13px;
  font-style: italic;
  color: var(--gold);
  letter-spacing: 0.01em;
}

@media (max-width: 640px) {
  .hero-headline { padding: 20px 16px 2px; }
  .hero-headline h2 { font-size: 24px; }
}

button, input, textarea, select { font-family: inherit; }

.ic { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.icon-slot { display: inline-flex; align-items: center; }

/* ─── Topbar ─── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(160deg, rgba(255,255,255,0.88) 0%, rgba(255,255,255,0.6) 70%, rgba(243,241,250,0.55) 100%);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid rgba(255,255,255,0.7);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 2px 12px rgba(139,124,200,0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  overflow: hidden;
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 14px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.topbar::before {
  content: '';
  position: absolute; top: -60%; left: -10%; width: 42%; height: 220%;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,0.5) 48%, rgba(255,255,255,0.12) 56%, transparent 72%);
  transform: rotate(8deg);
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 0 8px rgba(169,154,223,0.5));
}

.brand-mark img { width: 100%; height: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 12px; display: block; }
.brand-mark svg { width: 22px; height: 22px; }

.brand-text h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

.brand-slogan {
  font-style: italic;
  color: var(--gold) !important;
  font-size: 11px !important;
  letter-spacing: 0.02em;
}

/* ─── Layout ─── */
.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 32px 64px;
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .results-sticky {
    position: sticky;
    top: 64px;
    z-index: 15;
    padding: 12px;
    margin: -12px 0;
  }
  .results-card { max-height: 60vh; }
}

@media (max-width: 900px) {
  .topbar-inner .site-links { display: none; }
}

@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .app { padding: 16px 12px 48px; gap: 16px; }
  .brand-text h1 { font-size: 16px; }
  .brand-text p { display: none; }
  .brand-mark { width: 36px; height: 36px; }
}

.settings {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ─── Card ─── */
.card {
  background: linear-gradient(165deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.32) 100%);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.75);
  box-shadow: 0 10px 34px rgba(139,124,200,0.14), inset 0 1px 0 rgba(255,255,255,0.85);
  overflow: hidden;
  transition: box-shadow 0.2s;
  position: relative;
}

.card:hover { box-shadow: var(--shadow-hover), inset 0 1px 0 rgba(255,255,255,0.9); }

.card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  background: linear-gradient(to bottom, var(--wine-tint), transparent);
  border-bottom: 1px solid var(--border);
}

.step-badge {
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  background: linear-gradient(135deg, #c9a6d4 0%, var(--wine) 60%, var(--wine-dark) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.05em;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(139,124,200,0.35), inset 0 1px 0 rgba(255,255,255,0.4);
}

.step-info h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.step-info p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

.card-body {
  padding: 20px 24px 24px;
}

.section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-label svg { color: var(--text-dim); }

.hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
}

.hint-callout {
  background: var(--wine-tint);
  border: 1px solid var(--wine-shade);
  color: var(--wine);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: 16px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ─── Fields ─── */
.field {
  display: block;
  margin-bottom: 12px;
}

.field > span {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.field input[type="text"],
.field textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--bg-alt);
  color: var(--text);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.field input[type="text"]:focus,
.field textarea:focus,
select:focus {
  outline: none;
  border-color: var(--wine);
  background: #fff;
  box-shadow: var(--shadow-glow);
}

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

.field-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.field-inline > span { margin: 0; min-width: 60px; }
.field-inline select { flex: 1; max-width: 180px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 6px;
}

/* ─── Fused stat bar (generation count) ─── */
.stat-fuse {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(160deg, rgba(255,255,255,0.75) 0%, var(--wine-tint) 100%);
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin: 0 0 20px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.stat-fuse-text { display: flex; flex-direction: column; gap: 2px; }

.stat-fuse-label {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}

.stat-fuse-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.stat-fuse-select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(139,124,200,0.25);
  background: rgba(255,255,255,0.6);
  border-radius: 10px;
  font-size: 24px;
  font-weight: 600;
  color: var(--wine-dark);
  padding: 4px 30px 4px 10px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.stat-fuse-select:hover {
  border-color: var(--gold);
  background: #fff;
  box-shadow: 0 2px 8px rgba(139,124,200,0.2);
}

.stat-fuse-select:focus {
  outline: none;
  border-color: var(--wine);
  box-shadow: var(--shadow-glow);
}

.stat-fuse-select-wrap::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 8px; height: 8px;
  border-right: 2px solid var(--wine);
  border-bottom: 2px solid var(--wine);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.stat-fuse-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--wine);
  box-shadow: 0 3px 10px rgba(139,124,200,0.3);
  flex-shrink: 0;
}

.stat-fuse-circle svg { width: 16px; height: 16px; }

/* ─── Upload Zone ─── */
.label-preview-thumb {
  margin-top: 10px;
  max-width: 100%;
  max-height: 120px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  object-fit: contain;
  background: var(--bg-alt);
  display: block;
}

.flacon-preview-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-alt);
  padding: 16px;
  margin-bottom: 16px;
}
.flacon-preview-label {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 10px;
}
.flacon-preview-stage {
  position: relative;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #f7f6fb 0%, #efedf7 100%);
  border-radius: var(--radius);
}
.flacon-preview-svg {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  filter: drop-shadow(0 8px 14px rgba(107,88,168,0.18));
}
.flacon-preview-color-badges { display: flex; flex-direction: column; gap: 6px; }
.flacon-color-chip {
  display: block; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
}
.flacon-preview-label-overlay {
  position: absolute;
  width: 50px;
  height: 64px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.flacon-preview-tags {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
  flex-wrap: wrap;
}
.flacon-tag {
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--wine-tint);
  color: var(--wine-dark);
  font-weight: 600;
}
.flacon-tag:empty { display: none; }
.flacon-result-img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
}

/* Flacon: visual chips (icon/color-dot inside option buttons) */
.chip.chip-visual { padding-top: 10px; }
.chip-icon { color: var(--wine-dark); margin-bottom: 4px; display: flex; justify-content: center; align-items: flex-end; height: 98px; overflow: visible; }
.color-dot {
  display: inline-block;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.15);
  margin: 2px auto 4px;
}

/* Flacon: color sub-picker (for colorable closures/caps) + WSET wine-color groups */
.color-sub-picker {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border);
}
.color-picker-label { font-size: 12.5px; color: var(--text-dim); margin-right: 2px; }
.color-swatch-btn {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
  cursor: pointer; padding: 0;
}
.color-swatch-btn.lg { width: 34px; height: 34px; }
.color-swatch-btn.selected { box-shadow: 0 0 0 2px var(--wine-dark); }
.wine-color-cat { margin-bottom: 16px; }
.wine-color-cat:last-child { margin-bottom: 0; }
.wine-color-cat-label { font-size: 13px; font-weight: 700; color: var(--wine-dark); margin-bottom: 8px; }
.wine-color-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* Flacon: custom hex color input (self-serve color for any color-picking touchpoint) */
.custom-color-slot { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.custom-color-input { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.custom-color-swatch { width: 32px; height: 32px; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.15); border-radius: 8px; padding: 0; cursor: pointer; background: none; }
.custom-color-hex { width: 90px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: monospace; }
.custom-color-apply { flex-shrink: 0; }

/* Flacon: self-serve label position/zoom adjuster */
.label-adjuster { margin-top: 10px; }
.label-adjuster input[type="range"] { width: 100%; margin-top: 4px; }
.upload-zone {
  position: relative;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 26px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: linear-gradient(165deg, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0.5) 100%);
  overflow: hidden;
}

.upload-zone::before {
  content: '';
  position: absolute; top: -50%; left: -20%; width: 40%; height: 200%;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,0.55) 48%, transparent 66%);
  transform: rotate(10deg);
  pointer-events: none;
}

.upload-zone.small { padding: 18px; }
.upload-zone.compact { padding: 16px 10px; }
.upload-zone.compact .upload-title { font-size: 12px; }
.upload-zone.compact .upload-sub { font-size: 10px; }

/* ─── 3-column upload row ─── */
.upload-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 4px;
}

.upload-col {
  background: rgba(255,255,255,0.4);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 18px;
  padding: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

.upload-col .section-label {
  font-size: 12px;
  gap: 4px;
}

.upload-col .hint {
  font-size: 11px;
  margin-bottom: 8px;
  min-height: 28px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.upload-col .preview-list { margin-top: 8px; }

.upload-col { display: flex; flex-direction: column; }
.upload-col .upload-zone.compact { flex: 0 0 auto; }
.upload-col .section-label { min-height: 18px; }

.opt {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-alt);
  color: var(--muted);
  margin-left: 4px;
}

.tag-critical {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: linear-gradient(120deg, #e5556b, #d13a52);
  color: #fff;
  margin-left: 4px;
  box-shadow: 0 1px 4px rgba(209,58,82,0.35);
}

.tag-recommend {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: linear-gradient(120deg, #e3f5ea, #d1eedc);
  color: #2a8f5e;
  margin-left: 4px;
  border: 1px solid rgba(42,143,94,0.25);
}

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

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--wine);
  background: var(--wine-tint);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  color: var(--text-dim);
}

.upload-hint svg { color: var(--wine); }

.upload-title {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.upload-sub {
  font-size: 11px;
  color: var(--muted);
}

.preview-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.preview-list:empty { margin-top: 0; }

.preview-item {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  transition: transform 0.15s;
  cursor: zoom-in;
}

.preview-item:hover { transform: scale(1.03); }

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

.preview-item .remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, transform 0.15s;
}

.preview-item .remove:hover {
  background: var(--wine);
  transform: scale(1.1);
}

.preview-item .remove svg { width: 12px; height: 12px; }

/* ─── Option groups ─── */
.option-group {
  margin-bottom: 20px;
}

.option-group:last-child { margin-bottom: 0; }

.group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.group-title svg { color: var(--wine); }

.group-title h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.req {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--wine-shade);
  color: var(--wine);
}

.multi-hint {
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
}

.multi-status {
  margin-top: 8px;
  font-size: 12px;
  color: var(--gold);
  font-weight: 500;
}

/* Chips (small options) */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--border-strong);
  background: rgba(255,255,255,0.55);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  position: relative;
  font-family: inherit;
}

.chip:hover {
  border-color: var(--wine);
  background: var(--wine-tint);
}

.chip.selected {
  background: linear-gradient(120deg, #fff 0%, var(--wine-tint) 100%);
  color: var(--wine-dark);
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(169, 154, 223, 0.2), inset 0 1px 0 rgba(255,255,255,0.9);
  font-weight: 700;
  padding-right: 26px;
}

.chip.selected::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 6px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--wine));
  box-shadow: 0 1px 4px rgba(139,124,200,0.4);
}

.chip.selected::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 10.5px;
  width: 5px;
  height: 8px;
  margin-top: -5.5px;
  border-right: 1.6px solid #fff;
  border-bottom: 1.6px solid #fff;
  transform: rotate(45deg);
  z-index: 1;
}

.variant-panel .chip.selected::after {
  background: linear-gradient(135deg, #b0b6c4, #6a7080);
  box-shadow: 0 1px 4px rgba(106,112,128,0.35);
}

.chip .label {
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
}

.chip .desc {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
}

.chip.selected .desc {
  color: rgba(106, 88, 168, 0.8);
}

/* Cards (big options: scene, style) */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.big-card {
  padding: 14px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: #fff;
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  font-family: inherit;
  color: var(--text);
}

.big-card:hover {
  border-color: var(--wine);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.big-card.selected {
  border-color: var(--gold);
  background: linear-gradient(160deg, #fff 0%, var(--wine-tint) 100%);
  box-shadow: var(--shadow-glow), 0 4px 16px rgba(139, 124, 200, 0.15), inset 0 1px 0 rgba(255,255,255,0.9);
}

.big-card .thumb {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--wine-tint), var(--gold-tint));
  color: var(--wine);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}

.big-card .card-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.big-card .card-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
}

.big-card .check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--wine);
  color: #fff;
  display: none;
  place-items: center;
}

.big-card .check svg { width: 14px; height: 14px; }
.big-card.selected .check { display: grid; }

/* Style variants panel — silver-gray sub-level hierarchy */
.variant-panel {
  margin: 10px 0 0 14px;
  padding: 12px 14px;
  background: linear-gradient(120deg, rgba(232,234,240,0.55), rgba(255,255,255,0.35));
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-left: 2px solid rgba(140, 148, 165, 0.5);
}

.variant-panel:empty { display: none; padding: 0; margin: 0; }

.variant-panel::before {
  content: "▸ 具体机型 / 器材（上一项的子选项）";
  width: 100%;
  font-size: 11px;
  font-weight: 700;
  color: #5c6270;
  margin-bottom: 2px;
}

.gift-occasion-panel::before {
  content: "▸ 具体节日（“节日礼赠”的子选项）";
}

.variant-panel .chip {
  background: rgba(255,255,255,0.6);
  border-color: rgba(140, 148, 165, 0.35);
  padding: 6px 12px;
  font-size: 12px;
}

.variant-panel .chip:hover { border-color: #8c94a5; background: #fff; }

.variant-panel .chip.selected {
  background: linear-gradient(120deg, #fff, #eef0f4);
  color: #4a4f5c;
  border-color: #8c94a5;
  box-shadow: 0 0 0 1px #8c94a5;
}

.variant-panel .chip.selected .desc { color: #6a7080; }

.variant-panel .chip .label { font-size: 12px; }
.variant-panel .chip .desc { font-size: 10px; }

/* ─── Results studio ─── */
.results { position: relative; }

.results-sticky {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: linear-gradient(165deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.32) 100%);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.75);
  border-radius: var(--radius-xl);
  box-shadow: 0 10px 34px rgba(139,124,200,0.14), inset 0 1px 0 rgba(255,255,255,0.85);
  padding: 18px;
}

.generate-btn {
  width: 100%;
  padding: 16px 20px;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--gold) 0%, var(--wine) 45%, var(--wine-dark) 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 18px rgba(139, 124, 200, 0.4), inset 0 1px 0 rgba(255,255,255,0.4);
  position: relative;
  overflow: hidden;
}

.generate-btn::before {
  content: '';
  position: absolute; top: -60%; left: -20%; width: 36%; height: 220%;
  background: linear-gradient(105deg, transparent 20%, rgba(255,255,255,0.55) 45%, transparent 65%);
  transform: rotate(12deg);
  pointer-events: none;
}

.generate-btn:hover:not(:disabled) {
  box-shadow: 0 6px 26px rgba(139, 124, 200, 0.5), inset 0 1px 0 rgba(255,255,255,0.5);
  transform: translateY(-1px);
}

.generate-btn:active:not(:disabled) { transform: translateY(0); }

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

.btn-icon svg { width: 18px; height: 18px; }

.generate-btn.loading .btn-icon {
  animation: spin 1.2s linear infinite;
}

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

.results-card {
  background: transparent;
  border-radius: var(--radius-lg);
  padding: 0;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
}

/* Empty state: light welcome */
.empty-state {
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
}

.welcome {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.hero-orb {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,0.95) 0%, transparent 42%),
    radial-gradient(circle at 75% 70%, var(--wine-shade) 0%, transparent 55%),
    linear-gradient(160deg, #fbf9fd 0%, var(--wine-tint) 60%, #fdf7fa 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 8px 26px rgba(139,124,200,0.22);
  border: 1px solid rgba(255,255,255,0.85);
}

.hero-orb::before {
  content: '';
  position: absolute; top: -50%; left: -15%; width: 45%; height: 220%;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,0.7) 48%, transparent 68%);
  transform: rotate(12deg);
}

.welcome-art {
  width: 60px;
  height: 60px;
  color: var(--wine);
  opacity: 0.7;
  position: relative;
}

.welcome-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 100px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
}

.welcome-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wine);
  box-shadow: 0 0 0 3px rgba(139, 124, 200, 0.18);
  animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 3px rgba(139, 124, 200, 0.18); }
  50% { box-shadow: 0 0 0 6px rgba(139, 124, 200, 0.06); }
}

.welcome-hint {
  font-size: 12px;
  color: var(--muted);
}

/* Result body */
.result-body.hidden,
.empty-state.hidden { display: none; }
.option-group.hidden { display: none; }
.variant-panel.hidden { display: none; }

.result-block {
  margin-bottom: 20px;
}

.result-block:last-child { margin-bottom: 0; }

.block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.block-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.block-head h3 svg { color: var(--wine); }

.copy-box {
  background: var(--gold-tint);
  border: 1px solid rgba(169, 154, 223, 0.25);
  border-radius: var(--radius);
  padding: 14px;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.7;
  max-height: 320px;
  overflow-y: auto;
  color: var(--text);
}

.ghost-btn {
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-dim);
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}

.ghost-btn.small { padding: 5px 10px; font-size: 11px; }

.ghost-btn:hover {
  border-color: var(--wine);
  color: var(--wine);
}

.ghost-btn svg { width: 12px; height: 12px; }

.image-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.tracking-id-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.4);
  border: 1px solid rgba(140,148,165,0.25);
  backdrop-filter: blur(6px);
  font-size: 12px;
}
.tracking-id-label {
  color: var(--muted, #7a7a8a);
  white-space: nowrap;
}
.tracking-id-value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color: var(--text, #2a2a35);
  font-size: 11.5px;
}

.image-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 1;
  position: relative;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
}

.image-card:hover:not(.pending):not(.error) {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(28, 21, 18, 0.15);
}

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

.image-card .meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  color: #fff;
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.image-card:hover .meta { opacity: 1; }

.image-card a {
  color: #fff;
  text-decoration: none;
  padding: 2px 8px;
  background: rgba(255,255,255,0.2);
  border-radius: 6px;
  font-size: 10px;
  transition: background 0.15s;
}

.image-card a:hover { background: var(--wine); }

/* Pending: gradient breathing */
.image-card.pending {
  display: grid;
  place-items: center;
  color: var(--wine);
  font-size: 11px;
  font-weight: 500;
  cursor: default;
  background: linear-gradient(120deg, var(--wine-tint) 0%, var(--gold-tint) 50%, var(--wine-tint) 100%);
  background-size: 200% 100%;
  animation: shimmer 2.4s ease-in-out infinite;
  padding: 12px;
  text-align: center;
}

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

.image-card.pending .pending-num {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
  opacity: 0.6;
}

.image-card.error {
  display: grid;
  place-items: center;
  color: var(--wine);
  font-size: 12px;
  padding: 10px;
  text-align: center;
  cursor: default;
  background: var(--wine-tint);
  border-color: var(--wine-shade);
}

/* Copy typewriter */
.copy-box.typing::after {
  content: "▋";
  color: var(--wine);
  animation: blink 0.9s steps(1) infinite;
  margin-left: 2px;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ─── Invite gate (direct/external deployment only) ─── */
.invite-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 10% 8%, rgba(255,255,255,0.9) 0%, transparent 40%),
    radial-gradient(circle at 88% 20%, rgba(200,195,225,0.5) 0%, transparent 42%),
    radial-gradient(circle at 95% 65%, rgba(184,168,232,0.4) 0%, transparent 45%),
    linear-gradient(160deg, #f9f8fc 0%, #f2f0f7 45%, #eeecf3 100%);
}

.invite-gate.hidden { display: none; }

.invite-gate-card {
  background: linear-gradient(165deg, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0.55) 100%);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 60px rgba(139,124,200,0.2), inset 0 1px 0 rgba(255,255,255,0.9);
  padding: 40px 36px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.invite-gate-card h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.invite-gate-card p {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--text-dim);
}

#inviteGateForm {
  display: flex;
  gap: 8px;
}

#inviteGateInput {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: rgba(255,255,255,0.7);
}

#inviteGateInput:focus {
  outline: none;
  border-color: var(--wine);
  box-shadow: var(--shadow-glow);
}

#inviteGateForm button {
  padding: 12px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--gold) 0%, var(--wine) 60%, var(--wine-dark) 100%);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.invite-gate-error {
  margin: 12px 0 0 !important;
  color: #d13a52 !important;
  font-size: 12px !important;
  min-height: 14px;
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  max-width: 400px;
}

.toast.show { transform: translateX(-50%) translateY(0); }

/* ─── Lightbox ─── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  cursor: zoom-out;
}

.lightbox.show { display: flex; }

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s;
}

.lightbox-close:hover { background: rgba(255, 255, 255, 0.3); }
.lightbox-close svg { width: 20px; height: 20px; }
