/* ═══════════════════════════════════════════
   FLEMSTER — Product Image Generator Page
   ═══════════════════════════════════════════ */

:root {
  /* Custom palette — NOT default Tailwind colors */
  --c-bg:        #08080d;
  --c-bg2:       #0d0d14;
  --c-bg3:       #14141d;
  --c-bg4:       #1a1a25;
  --c-border:    rgba(255,255,255,0.06);
  --c-border2:   rgba(255,255,255,0.12);
  --c-border3:   rgba(255,255,255,0.18);

  --c-text:      #f4f4f7;
  --c-muted:     #b8b8c8;
  --c-subtle:    #8a8a9e;

  --c-violet:    #7C3AED;
  --c-violet-l:  #A78BFA;
  --c-violet-d:  #5B21B6;
  --c-cyan:      #22D3EE;
  --c-cyan-l:    #67E8F9;

  --c-ozon:      #005BFF;
  --c-wb:        #CB11AB;

  --c-success:   #10b981;
  --c-warn:      #fb923c;
  --c-danger:    #f43f5e;

  /* Layered shadows — color-tinted, not flat */
  --sh-soft:    0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(124,58,237,0.06);
  --sh-mid:     0 2px 4px rgba(0,0,0,0.4), 0 12px 32px rgba(124,58,237,0.10), 0 1px 0 rgba(255,255,255,0.04) inset;
  --sh-strong:  0 4px 12px rgba(0,0,0,0.5), 0 24px 64px rgba(124,58,237,0.18), 0 0 0 1px rgba(124,58,237,0.15);
  --sh-glow:    0 0 0 1px rgba(124,58,237,0.4), 0 8px 32px rgba(124,58,237,0.35), 0 2px 8px rgba(34,211,238,0.18);

  /* Radii */
  --r-sm:  6px;
  --r-md:  12px;
  --r-lg:  18px;
  --r-xl:  24px;

  /* Typography */
  --font-h: 'Syne', system-ui, sans-serif;
  --font-b: 'DM Sans', system-ui, sans-serif;

  /* Spring transitions on transform/opacity ONLY */
  --t-fast:    0.18s cubic-bezier(.34,1.56,.64,1);
  --t-base:    0.28s cubic-bezier(.34,1.56,.64,1);
  --ease-out:  cubic-bezier(.22,1,.36,1);
}

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

html { -webkit-text-size-adjust: 100%; background: var(--c-bg); color-scheme: dark; }

body {
  font-family: var(--font-b);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.55;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Ambient background (multiple radial gradients + grain) ── */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 70% 0%, rgba(124,58,237,0.18), transparent 60%),
    radial-gradient(ellipse 60% 40% at 0% 50%, rgba(34,211,238,0.10), transparent 60%),
    radial-gradient(ellipse 100% 60% at 50% 100%, rgba(124,58,237,0.08), transparent 70%),
    var(--c-bg);
}
.ambient__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  pointer-events: none;
}
.ambient__orb--violet {
  width: 480px; height: 480px;
  background: var(--c-violet);
  top: -180px; right: -120px;
}
.ambient__orb--cyan {
  width: 380px; height: 380px;
  background: var(--c-cyan);
  bottom: -160px; left: -120px;
  opacity: 0.25;
}
.ambient__grain {
  position: absolute;
  inset: 0;
  filter: url(#grain);
  opacity: 0.6;
  mix-blend-mode: overlay;
}

/* ── Selection ── */
::selection { background: rgba(124,58,237,0.4); color: #fff; }

/* ════════════════════════════════════════════
   TOP BAR
   ════════════════════════════════════════════ */
.topbar {
  position: sticky;
  top: 0; z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: rgba(8,8,13,0.7);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--c-border);
}
.topbar__logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
  color: var(--c-text);
  font-family: var(--font-h);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
  transition: opacity var(--t-fast);
}
.topbar__logo:hover { opacity: 0.8; }
.topbar__logo:focus-visible { outline: 2px solid var(--c-violet-l); outline-offset: 4px; border-radius: 4px; }
.topbar__logo-mark {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  width: 22px; height: 22px;
}
.topbar__logo-mark span { border-radius: 2px; }
.topbar__logo-mark span:nth-child(1) { background: var(--c-violet-l); }
.topbar__logo-mark span:nth-child(2) { background: var(--c-cyan); }
.topbar__logo-mark span:nth-child(3) { background: var(--c-cyan); opacity: 0.5; }
.topbar__logo-mark span:nth-child(4) { background: var(--c-violet); }

.topbar__divider {
  width: 1px; height: 24px;
  background: var(--c-border2);
}
.topbar__title {
  font-family: var(--font-h);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--c-text);
  white-space: nowrap;
}
.topbar__platforms {
  margin-left: auto;
  display: flex; gap: 6px;
}
.topbar__platform {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid var(--c-border2);
}
.topbar__platform--ozon { color: #4d8cff; border-color: rgba(0,91,255,0.4); background: rgba(0,91,255,0.08); }
.topbar__platform--wb { color: #e055c2; border-color: rgba(203,17,171,0.4); background: rgba(203,17,171,0.08); }

/* ════════════════════════════════════════════
   WORKSPACE
   ════════════════════════════════════════════ */
.workspace {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(360px, 460px) 1fr;
  gap: 24px;
  min-height: calc(100vh - 110px);
}

/* ── Panel base ── */
.panel {
  background: linear-gradient(180deg, rgba(26,26,37,0.85) 0%, rgba(18,18,27,0.85) 100%);
  border: 1px solid var(--c-border2);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-mid);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
}
.panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--r-lg);
  pointer-events: none;
  background: radial-gradient(ellipse at top, rgba(124,58,237,0.06), transparent 50%);
}

.panel--input {
  padding: 32px 28px;
  display: flex; flex-direction: column;
  position: relative;
  z-index: 1;
}

.panel--result {
  /* Keeps a grid layout so the result panel matches the form column's
     height (placeholder feels at home in a tall panel beside the form).
     The 1fr row holds .result, but .result's content (variant grid) now
     pins to the top so a single 3:4 portrait doesn't float in the middle
     of a 1000px-tall panel — see the .result rules below. */
  display: grid;
  grid-template-rows: 1fr auto auto;
  min-height: 600px;
  padding: 20px;
  gap: 16px;
}

.panel__h {
  font-family: var(--font-h);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 6px;
  text-align: center;
}
.panel__sub {
  font-size: 0.8125rem;
  color: var(--c-muted);
  line-height: 1.6;
  margin-bottom: 28px;
}

/* ════════════════════════════════════════════
   FIELDS
   ════════════════════════════════════════════ */
.field {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--c-border);
  position: relative;
}
.field:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}
.field--row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.field__half { display: flex; flex-direction: column; }

.field__label {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-h);
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 14px;
  color: #ffffff;
}
.field__label-hint {
  font-family: var(--font-b);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--c-subtle);
  opacity: 0;
  transition: opacity var(--t-fast), color var(--t-fast);
  margin-left: -4px;
}
.field__label-hint.is-visible { opacity: 1; }
.field__label-hint.is-overridden { color: var(--c-violet-l); }
.field__num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: 8px;
  font-family: var(--font-b);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  background: rgba(124,58,237,0.14);
  color: var(--c-violet-l);
  border: 1px solid rgba(124,58,237,0.32);
  flex-shrink: 0;
}
.field__opt {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-subtle);
  opacity: 0.7;
}
.field__count {
  display: inline-block;
  margin-bottom: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--c-subtle);
  background: var(--c-bg3);
  border: 1px solid var(--c-border);
  border-radius: 999px;
  padding: 3px 10px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.field__hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--c-violet-l);
  line-height: 1.4;
  margin-top: 10px;
  padding: 6px 11px;
  background: rgba(124,58,237,0.08);
  border: 1px solid rgba(124,58,237,0.22);
  border-radius: 999px;
  font-weight: 500;
}
.field__hint:empty { display: none; }
.field__hint--alert {
  color: #ffd0c2;
  background: rgba(244,63,94,0.10);
  border-color: rgba(244,63,94,0.35);
}
.field__hint--alert::before {
  background: #f43f5e;
  box-shadow: 0 0 6px #f43f5e;
}
.field__hint::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--c-violet-l);
  box-shadow: 0 0 6px var(--c-violet-l);
  flex-shrink: 0;
}
.field__warn {
  font-size: 0.75rem;
  color: var(--c-warn);
  line-height: 1.5;
  margin-top: 7px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: rgba(251,146,60,0.06);
  border: 1px solid rgba(251,146,60,0.2);
}
.field__sublabel {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-subtle);
  margin: 14px 0 8px;
}

/* ════════════════════════════════════════════
   MARKETPLACE TOGGLE
   ════════════════════════════════════════════ */
.mkt-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  background: var(--c-bg3);
  padding: 4px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
}
.mkt-toggle__opt {
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 12px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  color: var(--c-muted);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--t-fast), opacity var(--t-fast);
  position: relative;
}
.mkt-toggle__opt:hover { color: var(--c-text); }
.mkt-toggle__opt:focus-visible { outline: 2px solid var(--c-violet-l); outline-offset: 2px; }
.mkt-toggle__opt:active { transform: scale(0.97); }
.mkt-toggle__opt.is-active {
  background: linear-gradient(180deg, rgba(124,58,237,0.45) 0%, rgba(124,58,237,0.28) 100%) !important;
  border-color: var(--c-violet-l) !important;
  color: #fff !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.15),
    0 0 0 2px rgba(124,58,237,0.55),
    0 6px 18px rgba(124,58,237,0.40),
    0 0 22px rgba(34,211,238,0.18) !important;
  transform: translateY(-1px);
}
.mkt-toggle__opt.is-active .mkt-toggle__dot {
  box-shadow: 0 0 12px currentColor;
  transform: scale(1.15);
}
.mkt-toggle__opt.is-active::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--c-cyan);
  text-shadow: 0 0 8px var(--c-cyan);
}
.mkt-toggle__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mkt-toggle__dot--ozon { background: var(--c-ozon); box-shadow: 0 0 6px var(--c-ozon); }
.mkt-toggle__dot--wb { background: var(--c-wb); box-shadow: 0 0 6px var(--c-wb); }
.mkt-toggle__dot--both {
  background: linear-gradient(135deg, var(--c-ozon) 0%, var(--c-ozon) 50%, var(--c-wb) 50%, var(--c-wb) 100%);
}

/* ════════════════════════════════════════════
   UPLOADER
   ════════════════════════════════════════════ */
.uploader {
  border: 1.5px dashed var(--c-border3);
  border-radius: var(--r-md);
  background: var(--c-bg3);
  padding: 24px 16px;
  cursor: pointer;
  transition: transform var(--t-fast), opacity var(--t-fast);
  position: relative;
}
.uploader:hover { border-color: var(--c-violet-l); }
.uploader:focus-visible { outline: 2px solid var(--c-violet-l); outline-offset: 2px; }
.uploader.is-drag {
  border-color: var(--c-cyan);
  background: rgba(34,211,238,0.04);
  transform: scale(1.005);
}
.uploader.is-disabled { opacity: 0.5; pointer-events: none; }
.uploader.is-locked {
  border-color: rgba(124,58,237,0.55);
  border-style: dashed;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(124,58,237,0.16) 0%, transparent 60%),
    rgba(124,58,237,0.05);
  cursor: pointer;
}
.uploader.is-locked:hover { border-color: var(--c-violet-l); }
.uploader.is-locked .uploader__icon {
  color: var(--c-violet-l);
  opacity: 1;
  animation: lockArrow 1.8s ease-in-out infinite;
}
@keyframes lockArrow {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}
.uploader__inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px;
  text-align: center;
}
.uploader__icon {
  width: 32px; height: 32px;
  color: var(--c-violet-l);
  opacity: 0.6;
}
.uploader__title {
  font-family: var(--font-b);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--c-text);
}
.uploader__sub {
  font-size: 0.75rem;
  color: var(--c-subtle);
  line-height: 1.5;
  margin-top: 0;
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--c-bg3);
  border: 1px solid var(--c-border2);
}
.thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.thumb__del {
  position: absolute;
  top: 4px; right: 4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--c-text);
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform var(--t-fast), opacity var(--t-fast);
}
.thumb__del:hover { background: var(--c-danger); transform: scale(1.1); }
.thumb__del:focus-visible { outline: 2px solid var(--c-violet-l); outline-offset: 1px; }

/* ════════════════════════════════════════════
   PROMPT
   ════════════════════════════════════════════ */
.prompt {
  width: 100%;
  background: var(--c-bg3);
  border: 1px solid var(--c-border2);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font: inherit;
  font-size: 0.875rem;
  color: var(--c-text);
  resize: vertical;
  min-height: 84px;
  line-height: 1.55;
  transition: opacity var(--t-fast);
}
.prompt:hover { border-color: var(--c-border3); }
.prompt:focus {
  outline: none;
  border-color: var(--c-violet-l);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}
.prompt::placeholder { color: var(--c-subtle); }

/* ════════════════════════════════════════════
   PROMPT STATE MACHINE (Phase 3 — redesigned)
   States: waiting · analyzing · success · refine · manual
   ════════════════════════════════════════════ */

.prompt-state {
  animation: fadeIn var(--t-fast);
}
.prompt-state.hidden {
  display: none;
}

/* ── State A: empty/waiting hint ───────────────────── */
.empty-hint {
  text-align: center;
  padding: 22px 16px 18px;
  background: var(--c-bg2);
  border: 1px dashed var(--c-border2);
  border-radius: var(--r-md);
}
.empty-hint__icon {
  width: 28px;
  height: 28px;
  margin: 0 auto 8px;
  color: var(--c-violet-l);
  opacity: 0.7;
  filter: drop-shadow(0 0 12px rgba(124,58,237,0.4));
}
.empty-hint__icon svg { width: 100%; height: 100%; display: block; }
.empty-hint__title {
  font-family: var(--font-b);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--c-text);
  margin: 0 0 6px;
}
.empty-hint__sub {
  font-size: 0.8125rem;
  color: var(--c-subtle);
  margin: 0;
  line-height: 1.5;
}

.prompt-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-subtle);
}
.prompt-divider::before,
.prompt-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--c-border2);
  opacity: 0.6;
}

/* ── Status pill (analyzing + success states) ──────── */
.prompt-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid rgba(124, 58, 237, 0.4);
  background: rgba(124, 58, 237, 0.10);
  border-radius: var(--r-md);
  font-size: 0.9375rem;
  font-weight: 600;
  color: #c4b5fd;
  flex-wrap: wrap;
  row-gap: 6px;
}
.prompt-status--success {
  border-color: rgba(124, 58, 237, 0.5);
  background: rgba(124, 58, 237, 0.14);
}
.prompt-status__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--c-violet-l);
  flex-shrink: 0;
}
.prompt-status__icon svg { width: 100%; height: 100%; display: block; }
.prompt-status__text {
  color: #ddd6fe;
  font-weight: 600;
}
.prompt-status__timer {
  margin-left: auto;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  color: var(--c-muted);
  font-weight: 500;
}

/* ── Progress bar (analyzing state) ────────────────── */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--c-bg2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 12px;
}
.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, #7C3AED 0%, #22D3EE 100%);
  animation: progress 3s ease-in-out infinite;
}
@keyframes progress {
  0%   { width: 20%; }
  50%  { width: 70%; }
  100% { width: 90%; }
}

/* ── Success state: scenes block ───────────────────── */
.scenes-block {
  margin-top: 12px;
  padding: 14px;
  border: 0.5px solid var(--c-border2);
  border-radius: var(--r-md);
  background: var(--c-bg3);
}
.scenes-block__hint {
  font-size: 0.875rem;
  color: var(--c-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}
.scenes-list {
  font-size: 0.9rem;
  line-height: 1.7;
}
/* Legacy static scene list (kept for back-compat with any non-picker uses) */
.scenes-list:not(.scenes-list--picker) .scene-item {
  color: var(--c-text);
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
}
.scenes-list:not(.scenes-list--picker) .scene-item::before {
  content: "→";
  color: #7C3AED;
  font-weight: 600;
  flex-shrink: 0;
}

/* Picker variant: scene cards are interactive toggle buttons.
   - Unselected: dimmed, no fill, hollow check circle.
   - Selected:   violet tint, filled check, photo-slot badges in cyan.
   The badges (→ Фото 1, Фото 2…) make the mapping from scenes to output
   tiles obvious — when the seller changes Количество фото, badges shift
   live to reflect cycling. */
.scenes-list--picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.scene-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--c-border2);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--c-muted);
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast),
              color var(--t-fast), transform var(--t-fast);
}
.scene-card:hover {
  background: rgba(255,255,255,0.04);
  border-color: rgba(124,58,237,0.35);
}
.scene-card:focus-visible {
  outline: 2px solid var(--c-violet-l);
  outline-offset: 2px;
}
.scene-card:active { transform: scale(0.995); }
.scene-card.is-selected {
  background: rgba(124,58,237,0.10);
  border-color: rgba(124,58,237,0.45);
  color: var(--c-text);
}
.scene-card[data-locked="1"] {
  cursor: default;
  opacity: 0.95;
}
.scene-card[data-locked="1"]:hover {
  background: rgba(124,58,237,0.10);
  border-color: rgba(124,58,237,0.45);
}
.scene-card__check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid rgba(255,255,255,0.20);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.scene-card.is-selected .scene-card__check {
  background: #7C3AED;
  border-color: #7C3AED;
  color: #fff;
}
.scene-card__title {
  flex: 1;
  line-height: 1.4;
  min-width: 0;
}
.scene-card__slots {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex-shrink: 0;
  justify-content: flex-end;
}
.scene-card__slot {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(34,211,238,0.10);
  border: 1px solid rgba(34,211,238,0.30);
  color: #22D3EE;
  font-family: var(--font-b);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* ── Главное фото (белый фон) card variant ─────────
   Visually distinct from lifestyle scene cards so it reads as a
   different *kind* of choice (studio main photo) rather than just
   another scene. Cyan-tinted accent — separates from violet lifestyle. */
.scene-card--main {
  background: linear-gradient(180deg,
    rgba(34,211,238,0.05) 0%,
    rgba(34,211,238,0.025) 100%);
  border-color: rgba(34,211,238,0.30);
}
.scene-card--main:hover {
  background: linear-gradient(180deg,
    rgba(34,211,238,0.08) 0%,
    rgba(34,211,238,0.04) 100%);
  border-color: rgba(34,211,238,0.50);
}
.scene-card--main.is-selected {
  background: rgba(34,211,238,0.10);
  border-color: rgba(34,211,238,0.55);
}
.scene-card--main.is-selected .scene-card__check {
  background: #22D3EE;
  border-color: #22D3EE;
  color: #062a31;
}
.scene-card__icon--main {
  flex-shrink: 0;
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15) inset,
              0 2px 4px rgba(0,0,0,0.25);
}

/* ── Refine panel (state D) ────────────────────────── */
.refine-panel {
  border: 1px solid var(--c-border2);
  padding: 20px;
  border-radius: var(--r-md);
  background: var(--c-bg3);
}
.refine-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}
.refine-panel__intro {
  font-size: 0.9375rem;
  color: var(--c-text);
  margin: 0;
  line-height: 1.5;
  flex: 1;
}
.refine-panel__error {
  background: rgba(226, 75, 74, 0.1);
  border: 0.5px solid rgba(226, 75, 74, 0.3);
  border-radius: var(--r-md);
  padding: 8px 12px;
  font-size: 0.82rem;
  color: #e24b4a;
  margin-bottom: 14px;
}

.refine-field {
  margin-bottom: 16px;
}
.refine-field:last-of-type {
  margin-bottom: 0;
}
.refine-field__label {
  display: block;
  font-family: var(--font-h);
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
  margin-bottom: 10px;
}
.refine-field__label-opt {
  font-family: var(--font-b);
  font-weight: 400;
  color: var(--c-subtle);
  font-size: 0.8125rem;
}
.refine-field__input {
  width: 100%;
  background: var(--c-bg2);
  border: 1px solid var(--c-border2);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 0.9375rem;
  color: var(--c-text);
  font-family: inherit;
  resize: vertical;
  min-height: 64px;
  line-height: 1.5;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.refine-field__input:hover {
  border-color: var(--c-border3);
}
.refine-field__input:focus-visible {
  outline: none;
  border-color: var(--c-violet-l);
  background: var(--c-bg2);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}
.refine-field__input::placeholder {
  color: var(--c-subtle);
  opacity: 0.7;
}
.refine-field__hint {
  font-size: 0.75rem;
  color: var(--c-subtle);
  margin: 6px 0 0;
}
.refine-field__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* Soft chip (audience examples) */
.chip {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--c-border2);
  color: var(--c-muted);
  cursor: pointer;
  transition: transform var(--t-fast), color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
  white-space: nowrap;
}
.chip--soft:hover {
  color: var(--c-text);
  border-color: var(--c-violet-l);
  background: rgba(124,58,237,0.08);
}
.chip--soft:active { transform: scale(0.96); }
.chip--soft:focus-visible { outline: 2px solid var(--c-violet-l); outline-offset: 2px; }

.refine-panel__actions {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 0.5px solid var(--c-border2);
}
.refine-panel__alt {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

/* ── Manual panel (state E) ────────────────────────── */
.manual-panel {
  border: 1px solid var(--c-border2);
  padding: 20px;
  border-radius: var(--r-md);
  background: var(--c-bg3);
}
.manual-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.manual-panel__intro {
  font-size: 0.9375rem;
  color: var(--c-text);
  margin: 0;
  line-height: 1.5;
  flex: 1;
}
.manual-panel__textarea {
  width: 100%;
  background: var(--c-bg2);
  border: 1px solid var(--c-border2);
  border-radius: var(--r-md);
  padding: 14px 16px;
  font-size: 0.9375rem;
  color: var(--c-text);
  font-family: inherit;
  line-height: 1.55;
  resize: vertical;
  min-height: 110px;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.manual-panel__textarea:hover {
  border-color: var(--c-border3);
}
.manual-panel__textarea:focus-visible {
  outline: none;
  border-color: var(--c-violet-l);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}
.manual-panel__textarea::placeholder {
  color: var(--c-subtle);
  opacity: 0.7;
}
.manual-panel__warn {
  font-size: 0.72rem;
  color: var(--c-subtle);
  margin: 8px 0 0;
  line-height: 1.5;
}
.manual-panel__warn.is-blocking {
  color: #e24b4a;
  font-weight: 500;
}
.manual-panel__presets {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 0.5px solid var(--c-border2);
}
.manual-panel__presets--top {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  margin-bottom: 18px;
}
.manual-panel__describe {
  padding-top: 16px;
  border-top: 0.5px solid var(--c-border2);
}
.manual-panel__describe .refine-field__label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-subtle);
  margin-bottom: 10px;
}
.manual-panel__presets .refine-field__label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-subtle);
  margin-bottom: 10px;
}
.manual-presets__more-toggle {
  margin-top: 10px;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}
.manual-presets__more {
  margin-top: 10px;
}
.preset--custom {
  font-style: italic;
  color: var(--c-subtle);
}
.preset--custom:hover { color: var(--c-text); }
.preset--custom.is-active {
  font-style: normal;
}

/* ── Footer rows (links below each state) ──────────── */
.prompt-state__footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.prompt-state__footer--split {
  margin-top: 14px;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* ── Link button (text-link style) ─────────────────── */
.link-btn {
  background: none;
  border: none;
  padding: 4px 0;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: #a78bfa;
  cursor: pointer;
  transition: color var(--t-fast);
}
.link-btn:hover {
  color: #c4b5fd;
}
.link-btn:focus-visible {
  outline: 2px solid var(--c-violet-l);
  outline-offset: 3px;
  border-radius: 2px;
}
.link-btn--muted {
  color: var(--c-subtle);
}
.link-btn--muted:hover {
  color: var(--c-text);
}

/* Stacked link button — title line + faint sublabel underneath.
   Used in the success state to clarify what each path does without
   stretching the button copy itself. */
.link-btn--stacked {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  line-height: 1.35;
}
.link-btn__title {
  font-size: 0.875rem;
  font-weight: 600;
}
.link-btn__sub {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--c-subtle);
  opacity: 0.85;
}
.link-btn--stacked:hover .link-btn__sub {
  opacity: 1;
}

/* ── Full-width buttons (used in refine/manual entry) ── */
.btn--full {
  width: 100%;
}
.btn--ghost {
  background: transparent;
  border: 0.5px dashed var(--c-border2);
  color: var(--c-muted);
}
.btn--ghost:hover {
  background: rgba(124, 58, 237, 0.06);
  border-color: var(--c-violet-l);
  color: var(--c-text);
}

/* ── Refine variant of presets (no nowrap, more breathable) ── */
.presets--refine,
.presets--manual {
  gap: 6px;
}

/* Legacy vision-panel classes kept as inert no-ops to avoid breakage on any
   leftover references (none in current markup). Safe to remove later. */
.vision-panel {
  border: 0.5px solid var(--c-border2);
  padding: 16px;
  border-radius: var(--r-md);
  background: var(--c-bg3);
}

.vision-panel__error {
  background: rgba(226, 75, 74, 0.1);
  border: 0.5px solid rgba(226, 75, 74, 0.3);
  color: #e24b4a;
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.vision-panel__guidance {
  font-size: 0.875rem;
  color: var(--c-text);
  margin: 0 0 1rem 0;
  line-height: 1.6;
}

.vision-panel__textarea {
  width: 100%;
  padding: 10px 12px;
  border: 0.5px solid var(--c-border2);
  border-radius: var(--r-md);
  background: var(--c-bg3);
  color: var(--c-text);
  font-family: inherit;
  font-size: 0.875rem;
  resize: vertical;
  min-height: 50px;
  margin-bottom: 1rem;
  transition: border-color var(--t-fast);
}

.vision-panel__textarea:hover {
  border-color: var(--c-border3);
}

.vision-panel__textarea:focus {
  outline: none;
  border-color: #7C3AED;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.vision-panel__textarea::placeholder {
  color: var(--c-subtle);
}

/* Examples section */
.vision-panel__examples {
  background: var(--c-bg2);
  padding: 10px 12px;
  border-radius: var(--r-md);
  margin-bottom: 1rem;
  font-size: 0.75rem;
  color: var(--c-subtle);
}

.vision-panel__examples-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  color: var(--c-subtle);
}

.vision-panel__example {
  margin-bottom: 4px;
  color: var(--c-subtle);
}

.vision-panel__example::before {
  content: "→ ";
  color: #7C3AED;
  margin-right: 4px;
}

/* Button groups */
.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1rem;
}

.btn {
  padding: 10px 16px;
  border: 0.5px solid var(--c-border2);
  border-radius: var(--r-md);
  background: var(--c-bg3);
  color: var(--c-text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
}

.btn:hover {
  background: var(--c-bg2);
  border-color: var(--c-border3);
}

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

.btn--secondary {
  background: var(--c-bg3);
  border-color: var(--c-border2);
  color: var(--c-text);
}

.btn--secondary:hover {
  background: var(--c-bg2);
  border-color: var(--c-border3);
}

.btn--primary {
  background: #7C3AED;
  color: white;
  border-color: #7C3AED;
}

.btn--primary:hover {
  background: #6d28d9;
  border-color: #6d28d9;
}

.btn--warning {
  background: rgba(226, 75, 74, 0.1);
  color: #e24b4a;
  border-color: rgba(226, 75, 74, 0.3);
}

.btn--warning:hover {
  background: rgba(226, 75, 74, 0.15);
  border-color: rgba(226, 75, 74, 0.5);
}

/* Details panel */
.details-panel {
  background: var(--c-bg2);
  padding: 12px;
  border-radius: var(--r-md);
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--c-subtle);
  font-family: monospace;
  line-height: 1.5;
  max-height: 300px;
  overflow-y: auto;
}

.details-panel.hidden {
  display: none;
}

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

/* ════════════════════════════════════════════
   PRESETS
   ════════════════════════════════════════════ */
.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.preset {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--c-bg3);
  border: 1px solid var(--c-border2);
  color: var(--c-muted);
  cursor: pointer;
  transition: transform var(--t-fast), opacity var(--t-fast);
  white-space: nowrap;
}
.preset:hover {
  color: var(--c-text);
  border-color: var(--c-violet-l);
  background: rgba(124,58,237,0.08);
}
.preset:active { transform: scale(0.96); }
.preset:focus-visible { outline: 2px solid var(--c-violet-l); outline-offset: 2px; }
.preset.is-active {
  background: rgba(124,58,237,0.18);
  border-color: var(--c-violet-l);
  color: var(--c-text);
}

/* ════════════════════════════════════════════
   SELECT
   ════════════════════════════════════════════ */
.select {
  width: 100%;
  background: var(--c-bg3);
  border: 1px solid var(--c-border2);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--c-text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'><path d='M3 4.5L6 7.5L9 4.5' stroke='%23b8b8c8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  transition: opacity var(--t-fast);
}
.select:hover { border-color: var(--c-border3); }
.select:focus {
  outline: none;
  border-color: var(--c-violet-l);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}
.select option { background: var(--c-bg2); color: var(--c-text); }

/* ════════════════════════════════════════════
   SOURCE PANE HEADER + URL TOGGLE
   ════════════════════════════════════════════ */
.src-pane__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.url-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 4px 0;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--c-muted);
  cursor: pointer;
  transition: color var(--t-fast);
}
.url-toggle:hover { color: var(--c-violet-l); }
.url-toggle:focus-visible { outline: 2px solid var(--c-violet-l); outline-offset: 2px; border-radius: 4px; }
.url-toggle.is-active { color: var(--c-violet-l); }

/* ════════════════════════════════════════════
   URL PANE BACK NAVIGATION
   ════════════════════════════════════════════ */
.urlbar__nav {
  margin-bottom: 8px;
}
.url-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 4px 0;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--c-muted);
  cursor: pointer;
  transition: color var(--t-fast);
}
.url-back-btn:hover { color: var(--c-violet-l); }
.url-back-btn:focus-visible { outline: 2px solid var(--c-violet-l); outline-offset: 2px; border-radius: 4px; }

/* ════════════════════════════════════════════
   URL BAR
   ════════════════════════════════════════════ */
.urlbar {
  display: flex;
  gap: 8px;
}
.urlbar__input {
  flex: 1;
  background: var(--c-bg3);
  border: 1px solid var(--c-border2);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--c-text);
  transition: opacity var(--t-fast);
}
.urlbar__input:hover { border-color: var(--c-border3); }
.urlbar__input:focus {
  outline: none;
  border-color: var(--c-violet-l);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}
.urlbar__input::placeholder { color: var(--c-subtle); }
.urlbar__add {
  padding: 9px 16px;
  background: var(--c-bg3);
  border: 1px solid var(--c-border3);
  border-radius: var(--r-md);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--c-text);
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--t-fast), opacity var(--t-fast);
}
.urlbar__add:hover {
  border-color: var(--c-violet-l);
  background: rgba(124,58,237,0.08);
}
.urlbar__add:active { transform: scale(0.97); }
.urlbar__add:focus-visible { outline: 2px solid var(--c-violet-l); outline-offset: 2px; }
.urlbar__add:disabled { opacity: 0.4; cursor: not-allowed; }

.url-help {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--c-bg3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  font-size: 0.75rem;
}
.url-help summary {
  cursor: pointer;
  color: var(--c-violet-l);
  font-weight: 600;
  user-select: none;
  list-style: none;
  outline: none;
}
.url-help summary::marker { display: none; }
.url-help summary::-webkit-details-marker { display: none; }
.url-help summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform var(--t-fast);
}
.url-help[open] summary::before { transform: rotate(90deg); }
.url-help summary:focus-visible { outline: 2px solid var(--c-violet-l); outline-offset: 2px; border-radius: 2px; }
.url-help ol {
  margin: 10px 0 8px 18px;
  padding: 0;
  color: var(--c-muted);
  line-height: 1.7;
}
.url-help ol li { margin-bottom: 2px; }
.url-help b { color: var(--c-text); }
.url-help code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--c-bg);
  color: var(--c-cyan-l);
  border: 1px solid var(--c-border);
}
.url-help__note {
  margin-top: 6px;
  padding: 8px 10px;
  background: rgba(251,146,60,0.06);
  border: 1px solid rgba(251,146,60,0.2);
  border-radius: var(--r-sm);
  color: var(--c-warn);
  line-height: 1.5;
}

/* ════════════════════════════════════════════
   VARIANTS COUNT TOGGLE
   ════════════════════════════════════════════ */
.var-toggle {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  background: var(--c-bg3);
  padding: 4px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
}
.var-toggle__opt {
  padding: 11px 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-family: var(--font-h);
  font-size: 1rem;
  font-weight: 700;
  color: var(--c-muted);
  cursor: pointer;
  transition: transform var(--t-fast), opacity var(--t-fast);
}
.var-toggle__opt:hover { color: var(--c-text); }
.var-toggle__opt:focus-visible { outline: 2px solid var(--c-violet-l); outline-offset: 2px; }
.var-toggle__opt:active { transform: scale(0.95); }
.var-toggle__opt.is-active {
  background: var(--c-bg);
  border-color: var(--c-border3);
  color: var(--c-violet-l);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4), 0 0 0 1px rgba(124,58,237,0.4);
}

/* ════════════════════════════════════════════
   RICH SELECT (model)
   ════════════════════════════════════════════ */
.select--rich {
  font-size: 0.8125rem;
  font-weight: 500;
}

/* ════════════════════════════════════════════
   VARIANT GRID (results)
   ════════════════════════════════════════════ */
.vgrid {
  width: 100%;
  display: grid;
  gap: 12px;
  padding: 12px;
}
.vgrid--n1 { grid-template-columns: 1fr; }
.vgrid--n2 { grid-template-columns: 1fr 1fr; }
.vgrid--n3 { grid-template-columns: repeat(3, 1fr); }
.vgrid--n4 { grid-template-columns: 1fr 1fr; }
.vgrid--n5 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 700px) {
  .vgrid--n2, .vgrid--n3, .vgrid--n4, .vgrid--n5 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .vgrid { grid-template-columns: 1fr !important; }
}

/* ════════════════════════════════════════════
   HERO + THUMBS (multi-variant: n>=3)
   The selected variant fills a large hero pane.
   The full row of variants sits below as small,
   clickable thumbnails. Clicking a thumbnail
   promotes it into the hero.
   ════════════════════════════════════════════ */
.hgrid {
  width: 100%;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}

.hero {
  position: relative;
  width: 100%;
  max-width: 100%;        /* defensive — never exceed the container */
  min-width: 0;           /* allow flex parent to shrink us */
  max-height: 72vh;
  aspect-ratio: var(--hero-ar, 3 / 4);
  margin: 0 auto;
  background: var(--c-bg);
  border: 1.5px solid var(--c-cyan);
  box-shadow: 0 0 0 1px var(--c-cyan), 0 8px 24px rgba(34, 211, 238, 0.18);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero.is-loading {
  border-color: var(--c-border2);
  box-shadow: none;
  background:
    radial-gradient(ellipse at center, rgba(124,58,237,0.06), transparent 60%),
    var(--c-bg2);
}
.hero__img-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hero__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hero__loading-inner {
  text-align: center;
}
.hero__loading-label {
  margin-top: 12px;
  font-family: var(--font-b);
  font-size: 0.8125rem;
  color: var(--c-muted);
  letter-spacing: 0.01em;
}

.hero__num {
  position: absolute;
  top: 12px; left: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: 999px;
  background: var(--c-cyan);
  color: #08080d;
  font-family: var(--font-h);
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--c-cyan);
  z-index: 2;
}
.hero__dim {
  position: absolute;
  top: 12px;
  right: 52px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(8,8,13,0.85);
  border: 1px solid var(--c-border2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  color: var(--c-muted);
  backdrop-filter: blur(4px);
  z-index: 2;
}
.hero__info {
  position: absolute;
  top: 12px; right: 12px;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: rgba(8,8,13,0.85);
  border: 1px solid var(--c-border2);
  color: var(--c-text);
  font-family: var(--font-h);
  font-style: italic;
  font-weight: 700;
  font-size: 0.8125rem;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: transform var(--t-fast), border-color var(--t-fast);
  z-index: 2;
}
.hero__info:hover { border-color: var(--c-violet-l); }
.hero__info.is-open {
  background: var(--c-violet-l);
  color: #fff;
  border-color: var(--c-violet-l);
}
.hero__details {
  position: absolute;
  top: 50px;
  right: 12px;
  max-width: min(320px, calc(100% - 24px));
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: rgba(8,8,13,0.92);
  border: 1px solid var(--c-violet-l);
  color: var(--c-text);
  font-family: var(--font-b);
  font-size: 0.75rem;
  line-height: 1.5;
  backdrop-filter: blur(8px);
  z-index: 3;
}
.hero__details[hidden] { display: none; }
.hero__dl {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 22px;
  background: rgba(8,8,13,0.85);
  border: 1px solid var(--c-border2);
  border-radius: 10px;
  color: var(--c-text);
  font-family: var(--font-h);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform var(--t-fast), border-color var(--t-fast), background var(--t-fast);
  z-index: 2;
}
.hero__dl:hover {
  border-color: var(--c-violet-l);
  background: rgba(124,58,237,0.18);
}
.hero__dl:active { transform: translateX(-50%) scale(0.96); }
.hero__dl:focus-visible { outline: 2px solid var(--c-violet-l); outline-offset: 2px; }

.vthumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  scrollbar-width: thin;
}
.vthumbs::-webkit-scrollbar { height: 6px; }
.vthumbs::-webkit-scrollbar-thumb {
  background: var(--c-border2);
  border-radius: 999px;
}

/* Thumb-flavour variants: smaller, simpler, no Скачать bar, no info button.
   The thumb's job is navigation — click it to swap into the hero. */
.variant--thumb {
  flex: 0 0 auto;
  width: 96px;
  aspect-ratio: 3 / 4;
  border-width: 1.5px;
  border-radius: var(--r-sm);
}
.variant--thumb.is-loading {
  width: 96px;
  aspect-ratio: 3 / 4;
}
.variant--thumb .variant__img-wrap {
  width: 100%;
  height: 100%;
}
.variant--thumb .variant__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.variant--thumb .variant__num {
  top: 4px; left: 4px;
  width: 18px; height: 18px;
  font-size: 0.625rem;
  z-index: 2;
}
.variant--thumb.is-selected .variant__num {
  background: var(--c-cyan);
  color: #08080d;
  border-color: var(--c-cyan);
}
.variant--thumb .variant__loading-inner { transform: scale(0.6); }
.variant--thumb .variant__spinner-label,
.variant--thumb .variant__prog-label {
  display: none;
}
.variant--thumb .variant__prog {
  width: 60px;
  margin-top: 6px;
}

@media (max-width: 700px) {
  .variant--thumb { width: 84px; }
  .hero__dl { padding: 9px 18px; font-size: 0.78125rem; }
}
@media (max-width: 480px) {
  .variant--thumb { width: 72px; }
  .hero__num { width: 22px; height: 22px; font-size: 0.6875rem; }
}

.variant {
  position: relative;
  background: var(--c-bg);
  border: 1.5px solid var(--c-border2);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: transform var(--t-fast), opacity var(--t-fast);
  display: flex;
  flex-direction: column;
  cursor: pointer;
}
.variant:focus-visible {
  outline: 2px solid var(--c-cyan);
  outline-offset: 3px;
}
.variant.is-selected {
  border-color: var(--c-cyan);
  box-shadow: 0 0 0 1px var(--c-cyan), 0 8px 24px rgba(34,211,238,0.18);
}
.variant.is-loading {
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at center, rgba(124,58,237,0.06), transparent 60%),
    var(--c-bg2);
  aspect-ratio: 3/4;
  border-style: dashed;
  cursor: default;
}
.variant.is-fail {
  display: flex; align-items: center; justify-content: center;
  background: rgba(244,63,94,0.04);
  border-color: rgba(244,63,94,0.3);
  aspect-ratio: 3/4;
  font-size: 0.75rem;
  color: var(--c-danger);
  text-align: center;
  padding: 12px;
  cursor: default;
}

.variant__img-wrap {
  position: relative;
  width: 100%;
  background: var(--c-bg);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.variant__img-wrap img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform var(--t-base);
}
.variant:hover .variant__img-wrap img { transform: scale(1.02); }

.variant__num {
  position: absolute;
  top: 8px; left: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 999px;
  background: rgba(8,8,13,0.85);
  border: 1px solid var(--c-border3);
  color: var(--c-text);
  font-family: var(--font-h);
  font-size: 0.6875rem;
  font-weight: 700;
  backdrop-filter: blur(4px);
}
.variant.is-selected .variant__num {
  background: var(--c-cyan);
  color: #08080d;
  border-color: var(--c-cyan);
}

.variant__dim {
  position: absolute;
  top: 8px; right: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(8,8,13,0.85);
  border: 1px solid var(--c-border2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.6875rem;
  color: var(--c-muted);
  backdrop-filter: blur(4px);
}

.variant__bar {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid var(--c-border);
  background: rgba(13,13,20,0.6);
}
.variant__btn {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 5px;
  padding: 7px 10px;
  background: var(--c-bg3);
  border: 1px solid var(--c-border2);
  border-radius: 8px;
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--c-text);
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--t-fast), opacity var(--t-fast);
}
.variant__btn:hover {
  border-color: var(--c-violet-l);
  background: rgba(124,58,237,0.1);
}
.variant__btn:active { transform: scale(0.96); }
.variant__btn:focus-visible { outline: 2px solid var(--c-violet-l); outline-offset: 1px; }

.variant__spinner {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2.5px solid var(--c-border2);
  border-top-color: var(--c-violet-l);
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.variant__spinner-label {
  margin-top: 10px;
  font-size: 0.6875rem;
  color: var(--c-muted);
  text-align: center;
}
.variant__loading-inner { text-align: center; }

/* ── Per-tile progress bar ── */
.variant__prog {
  margin-top: 14px;
  width: 100%;
  max-width: 120px;
  height: 3px;
  border-radius: 100px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  position: relative;
}
.variant__prog-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--c-violet-l), var(--c-cyan));
  transition: width 0.4s cubic-bezier(.22,1,.36,1);
}
/* Stalling: pulse the bar */
.variant__prog.is-stalling .variant__prog-fill {
  animation: prog-pulse 1.6s ease-in-out infinite;
}
@keyframes prog-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}
/* Done: flash full green */
.variant__prog.is-done .variant__prog-fill {
  background: linear-gradient(90deg, #22c55e, var(--c-cyan));
  transition: width 0.3s cubic-bezier(.22,1,.36,1);
}
/* Fail: show red */
.variant__prog.is-fail .variant__prog-fill {
  background: #ef4444;
}
.variant__prog-label {
  margin-top: 6px;
  font-size: 0.625rem;
  color: var(--c-subtle);
  text-align: center;
  letter-spacing: 0.01em;
  min-height: 1em;
  transition: color 0.2s;
}
.variant__prog.is-done + .variant__prog-label {
  color: #22c55e;
}


/* ════════════════════════════════════════════
   GENERATE BUTTON
   ════════════════════════════════════════════ */
.generate-btn {
  margin-top: 8px;
  width: 100%;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--c-violet) 0%, var(--c-violet-d) 100%);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--r-md);
  font: inherit;
  font-family: var(--font-h);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: white;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  transition: transform var(--t-fast), opacity var(--t-fast);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.15) inset,
    0 4px 16px rgba(124,58,237,0.4),
    0 1px 4px rgba(0,0,0,0.4);
}
.generate-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.15) inset,
    0 8px 24px rgba(124,58,237,0.55),
    0 2px 6px rgba(34,211,238,0.15);
}
.generate-btn:active:not(:disabled) { transform: scale(0.985); }
.generate-btn:focus-visible { outline: 2px solid var(--c-violet-l); outline-offset: 3px; }
.generate-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.footnote {
  margin-top: 14px;
  font-size: 0.75rem;
  color: var(--c-subtle);
  text-align: center;
  line-height: 1.5;
}

/* ════════════════════════════════════════════
   RESULT
   ════════════════════════════════════════════ */
.result {
  position: relative;
  /* Flex column pinned to the top of the result row — so when a 3:4
     portrait variant grid renders, the image sits flush at the top of the
     panel without the old vertical-center whitespace band. The
     placeholder/loading/error states are CENTERED via the special rule
     below (using :has) so they don't look stranded at the top of an empty
     panel. */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  border-radius: var(--r-md);
  background:
    radial-gradient(ellipse at center, rgba(124,58,237,0.04), transparent 60%),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.012) 0 2px, transparent 2px 12px),
    var(--c-bg);
  border: 1px solid var(--c-border);
  overflow: hidden;
  min-height: 460px;
}
/* When the result block contains only a placeholder/loading/error state
   (no real variant grid yet), center its contents — that empty-state
   chrome looks deliberate in the middle of the panel, not stuck to the
   top. Once a variant grid (.vgrid or .hgrid) becomes visible the rule
   stops matching and content top-aligns naturally. */
.result:has(> #placeholder:not(.hidden)),
.result:has(> #loading:not(.hidden)):not(:has(> #vgrid:not(.hidden))):not(:has(> #hgrid:not(.hidden))),
.result:has(> #errorBox:not(.hidden)) {
  justify-content: center;
  align-items: center;
}

.result__placeholder {
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
  gap: 12px;
  color: var(--c-subtle);
  padding: 40px;
}
.result__placeholder-icon { color: var(--c-violet-l); opacity: 0.5; }
.result__placeholder-title {
  font-family: var(--font-h);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--c-muted);
}
.result__placeholder-sub { font-size: 0.8125rem; color: var(--c-subtle); }

/* ── Loading state ── */
.result__loading {
  display: flex; flex-direction: column; align-items: center;
  gap: 18px;
  text-align: center;
}
.result__loading-orbit {
  position: relative;
  width: 64px; height: 64px;
}
.result__loading-orbit span {
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 50%;
  top: 50%; left: 50%;
  margin: -6px 0 0 -6px;
}
.result__loading-orbit span:nth-child(1) {
  background: var(--c-violet-l);
  animation: orbit 1.4s ease-in-out infinite;
}
.result__loading-orbit span:nth-child(2) {
  background: var(--c-cyan);
  animation: orbit 1.4s ease-in-out infinite;
  animation-delay: -0.47s;
}
.result__loading-orbit span:nth-child(3) {
  background: var(--c-violet);
  animation: orbit 1.4s ease-in-out infinite;
  animation-delay: -0.93s;
}
@keyframes orbit {
  0%, 100% { transform: translate(-22px, 0) scale(0.7); opacity: 0.5; }
  50% { transform: translate(22px, 0) scale(1); opacity: 1; }
}
.result__loading-status {
  font-family: var(--font-h);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--c-text);
}
.result__loading-detail {
  font-size: 0.8125rem;
  color: var(--c-muted);
}

/* ── Image state ── */
.result__image {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 16px;
  gap: 12px;
}
.result__image img {
  max-width: 100%;
  max-height: 480px;
  border-radius: var(--r-md);
  box-shadow: 0 12px 36px rgba(0,0,0,0.5), 0 0 0 1px var(--c-border2);
  transition: transform var(--t-base);
}
.result__image img:hover { transform: scale(1.01); }
.result__actions {
  display: flex; gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.result-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--c-bg3);
  border: 1px solid var(--c-border2);
  border-radius: var(--r-md);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--c-text);
  cursor: pointer;
  transition: transform var(--t-fast), opacity var(--t-fast);
}
.result-btn:hover {
  border-color: var(--c-violet-l);
  background: rgba(124,58,237,0.08);
  transform: translateY(-1px);
}
.result-btn:active { transform: scale(0.97); }
.result-btn:focus-visible { outline: 2px solid var(--c-violet-l); outline-offset: 2px; }
.result__rec {
  font-size: 0.6875rem;
  color: var(--c-subtle);
  text-align: center;
}

/* ── Error state ── */
.result__error {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px;
  text-align: center;
  padding: 30px;
}
.result__error-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(244,63,94,0.1);
  border: 1px solid rgba(244,63,94,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  color: var(--c-danger);
}
.result__error-title {
  font-family: var(--font-h);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.result__error-msg {
  font-size: 0.8125rem;
  color: var(--c-muted);
  max-width: 320px;
  line-height: 1.55;
}

/* ════════════════════════════════════════════
   HISTORY
   ════════════════════════════════════════════ */
.history {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--c-bg3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
}
.history__title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-subtle);
  margin-bottom: 8px;
}
.history__strip {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.history__strip::-webkit-scrollbar { height: 4px; }
.history__strip::-webkit-scrollbar-thumb { background: var(--c-border3); border-radius: 4px; }
.history-item {
  flex-shrink: 0;
  width: 56px; height: 70px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--c-bg);
  border: 2px solid var(--c-border);
  cursor: pointer;
  transition: transform var(--t-fast), opacity var(--t-fast);
  position: relative;
}
.history-item:hover { transform: translateY(-2px); border-color: var(--c-violet-l); }
.history-item:focus-visible { outline: 2px solid var(--c-violet-l); outline-offset: 2px; }
.history-item.is-current { border-color: var(--c-cyan); }
.history-item img { width: 100%; height: 100%; object-fit: cover; }

/* ════════════════════════════════════════════
   EDIT BAR
   ════════════════════════════════════════════ */
.editbar {
  margin-top: 14px;
  padding: 14px 16px;
  background: linear-gradient(180deg, var(--c-bg3), var(--c-bg2));
  border: 1px solid rgba(124,58,237,0.25);
  border-radius: var(--r-md);
  box-shadow: 0 8px 24px rgba(124,58,237,0.06);
}
.editbar__title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-violet-l);
  margin-bottom: 8px;
}
.editbar__row {
  display: flex; gap: 8px;
  align-items: center;
}
.editbar__input {
  flex: 1;
  background: var(--c-bg);
  border: 1px solid var(--c-border2);
  border-radius: var(--r-md);
  padding: 9px 12px;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--c-text);
  transition: opacity var(--t-fast);
  resize: none;
  field-sizing: content;  /* Chrome 123+ — grows with content */
  min-height: 38px;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.45;
}
.editbar__input:hover { border-color: var(--c-border3); }
.editbar__input:focus {
  outline: none;
  border-color: var(--c-violet-l);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}
.editbar__input::placeholder { color: var(--c-subtle); }

.editbar__ref-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  background: var(--c-bg);
  border: 1px dashed var(--c-border3);
  border-radius: var(--r-md);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--c-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--t-fast), opacity var(--t-fast);
}
.editbar__ref-btn:hover { color: var(--c-text); border-color: var(--c-violet-l); }
.editbar__ref-btn:active { transform: scale(0.97); }
.editbar__ref-btn:focus-visible { outline: 2px solid var(--c-violet-l); outline-offset: 2px; }
.editbar__ref-btn.has-ref { border-style: solid; border-color: var(--c-cyan); color: var(--c-cyan-l); }

.editbar__apply {
  padding: 9px 16px;
  background: linear-gradient(135deg, var(--c-violet), var(--c-violet-d));
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--r-md);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: transform var(--t-fast), opacity var(--t-fast);
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset, 0 2px 8px rgba(124,58,237,0.3);
}
.editbar__apply:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset, 0 4px 12px rgba(124,58,237,0.45);
}
.editbar__apply:active:not(:disabled) { transform: scale(0.97); }
.editbar__apply:focus-visible { outline: 2px solid var(--c-violet-l); outline-offset: 2px; }
.editbar__apply:disabled { opacity: 0.4; cursor: not-allowed; }

.editbar__refprev {
  margin-top: 10px;
  display: flex; align-items: center; gap: 8px;
  font-size: 0.75rem;
  color: var(--c-muted);
}
.editbar__refprev img {
  width: 36px; height: 36px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--c-border2);
}
.editbar__refprev button {
  margin-left: auto;
  background: none; border: none;
  color: var(--c-subtle);
  font-size: 0.6875rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.editbar__refprev button:hover { color: var(--c-danger); }

.editbar__sel {
  margin-top: 8px;
  font-size: 0.6875rem;
  color: var(--c-subtle);
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ════════════════════════════════════════════
   BOTTOM
   ════════════════════════════════════════════ */
.bottom {
  max-width: 1320px;
  margin: 0 auto;
  padding: 16px 24px 32px;
  display: flex; justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--c-subtle);
}
.bottom a {
  color: var(--c-muted);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: opacity var(--t-fast);
}
.bottom a:hover { color: var(--c-text); border-bottom-color: var(--c-violet-l); }

/* ════════════════════════════════════════════
   UTILITY
   ════════════════════════════════════════════ */
.hidden { display: none !important; }

/* ════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .panel--result { min-height: 500px; }
}

@media (max-width: 640px) {
  /* Stack the topbar into two rows on phones: logo row, then full-width title.
     A single-row flex was forcing ellipsis on a long Russian title next to the
     logo + divider; stacking gives the title room to breathe and keeps the
     brand legible. */
  .topbar {
    padding: 10px 14px;
    gap: 6px;
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .topbar__logo {
    font-size: 1rem;
  }
  .topbar__divider { display: none; }
  .topbar__title {
    order: 3;
    flex: 1 0 100%;
    width: 100%;
    font-size: 0.9375rem;
    white-space: normal;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--c-muted);
  }
  .topbar__platforms { display: none; }

  .workspace {
    padding: 14px;
    gap: 14px;
  }
  .panel--input { padding: 22px 18px; }
  .panel--result { padding: 14px; }

  .panel__h { font-size: 1.25rem; }

  .field { margin-bottom: 24px; padding-bottom: 24px; }
  .field__label { font-size: 1.1875rem; margin-bottom: 12px; gap: 10px; }
  .field__num { width: 24px; height: 24px; font-size: 0.6875rem; }
  .field__half { min-width: 0; }
  .field--row { grid-template-columns: 1fr; }

  .uploader { padding: 20px 14px; }
  .uploader__icon { width: 28px; height: 28px; }
  .uploader__title { font-size: 0.875rem; }

  .mkt-toggle { gap: 4px; }
  .mkt-toggle__opt { padding: 12px 6px; font-size: 0.8125rem; gap: 6px; min-width: 0; }

  .result { min-height: 360px; }
  .result__image img { max-height: 360px; }

  /* Hero — on phones, derive size strictly from the container width via
     aspect-ratio. Dropping max-height removes the desktop trick where a
     72vh cap could (in some browsers, with some aspect ratios) end up
     widening the box past the container. Tightening hgrid padding gives
     the hero a touch more room on narrow phones. */
  .hgrid { padding: 8px; gap: 10px; }
  .hero {
    max-height: none;
    width: 100%;
    max-width: 100%;
  }
  .hero__img-wrap,
  .hero__img-wrap img { max-width: 100%; }
  .hero__details {
    max-width: calc(100% - 24px);  /* keep the popover inside the hero */
  }

  /* Edit bar — re-tuned for phones. Default layout (input + ref + apply in
     one row) cramps below ~420px and the input ends up too short to type
     into. Mobile gets a 2-row layout: input full-width row 1, then the two
     action buttons share row 2. Apply is the primary CTA so it gets more
     weight; ref-btn is secondary. All controls hit ≥44px so they're
     tappable, and the input font is 16px so iOS doesn't auto-zoom on
     focus. */
  .editbar { padding: 14px; }
  .editbar__row {
    flex-wrap: wrap;
    gap: 10px;
  }
  .editbar__input {
    flex: 1 0 100%;
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;       /* 16px — kills iOS focus-zoom */
  }
  .editbar__ref-btn {
    flex: 1 1 0;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 0.8125rem;
    justify-content: center;
  }
  .editbar__apply {
    flex: 2 1 0;           /* primary action — wider than ref */
    min-height: 44px;
    padding: 12px 16px;
    font-size: 0.875rem;
  }
  .editbar__refprev {
    flex-wrap: wrap;
    row-gap: 6px;
  }
  .editbar__sel {
    text-align: left;       /* right-align reads as a stray fragment on phones */
    margin-top: 10px;
  }
}

/* ═══════════════════════════════════════════════════════════
   AUTO-FEATURE CALLOUT — static always-visible banner that
   explains the AI auto-prompt feature before photos are added.
   ═══════════════════════════════════════════════════════════ */
.auto-feature-callout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  margin: 0 0 10px;
  border-radius: var(--r-md);
  background:
    linear-gradient(135deg, rgba(124, 58, 237, 0.13) 0%, rgba(34, 211, 238, 0.07) 100%),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(124, 58, 237, 0.28);
}
.auto-feature-callout__icon {
  flex-shrink: 0;
  font-size: 0.9rem;
  color: #a78bfa;
  line-height: 1;
}
.auto-feature-callout__text {
  font-family: var(--font-b);
  font-size: 0.78125rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.72);
}

/* ═══════════════════════════════════════════════════════════
   AUTO-PROMPT STATUS — visible signal that the AI is analysing
   the uploaded photo and that the resulting prompt is in use.
   ═══════════════════════════════════════════════════════════ */
.auto-status {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  row-gap: 8px;
  padding: 10px 12px;
  margin: 0 0 10px;
  border: 1px solid rgba(124, 58, 237, 0.35);
  border-radius: var(--r-md, 12px);
  background:
    linear-gradient(135deg, rgba(124, 58, 237, 0.18), rgba(34, 211, 238, 0.10)),
    rgba(255, 255, 255, 0.02);
  font-family: var(--font-b);
  font-size: 0.78125rem;
  line-height: 1.5;
  letter-spacing: 0.005em;
  color: var(--c-text);
  max-width: 100%;
}
.auto-status.is-analysing {
  border-color: rgba(34, 211, 238, 0.45);
}
.auto-status.is-ready {
  border-color: rgba(124, 58, 237, 0.55);
}
.auto-status.is-failed {
  border-color: rgba(255, 180, 100, 0.55);
  background: rgba(40, 28, 16, 0.55);
}
.auto-status.is-failed .auto-status__spark { color: #FFB464; }
.auto-status__spark {
  font-size: 0.95rem;
  line-height: 1.25;
  flex-shrink: 0;
}
.auto-status.is-analysing .auto-status__spark {
  animation: autoPulse 1.4s ease-in-out infinite;
}
@keyframes autoPulse {
  0%, 100% { opacity: 0.55; transform: scale(0.92); }
  50%      { opacity: 1;    transform: scale(1.08); }
}
.auto-status__text {
  min-width: 0;
  flex: 1 1 0;
  word-break: normal;
  overflow-wrap: anywhere;
}
.auto-status__hint {
  display: none;
  flex-basis: 100%;
  margin-left: 26px;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--c-muted, rgba(232, 230, 240, 0.55));
}
.auto-status.is-ready .auto-status__hint {
  display: block;
}
.auto-status__toggle {
  background: transparent;
  border: 0;
  padding: 2px 6px 2px 0;
  margin-left: 26px;
  flex-basis: 100%;
  text-align: left;
  color: var(--c-accent, #22D3EE);
  font: inherit;
  font-size: 0.75rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  border-radius: 4px;
}
.auto-status__toggle:hover { color: #fff; }
.auto-status__toggle:focus-visible {
  outline: 2px solid var(--c-accent, #22D3EE);
  outline-offset: 2px;
}
.auto-detail {
  margin: -4px 0 12px;
  padding: 10px 12px;
  border: 1px dashed rgba(124, 58, 237, 0.35);
  border-radius: var(--r-md);
  background: rgba(124, 58, 237, 0.05);
  font-family: var(--font-b);
  font-size: 0.78125rem;
  line-height: 1.55;
  color: var(--c-subtle);
}
.auto-detail strong {
  display: block;
  color: var(--c-text);
  font-weight: 600;
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* Note shown below modelHint when we auto-switch the model (e.g. for infographic) */
.field__note {
  margin-top: 8px;
  padding: 10px 12px;
  border-left: 3px solid var(--c-accent, #22D3EE);
  background: rgba(34, 211, 238, 0.07);
  border-radius: 0 8px 8px 0;
  font-family: var(--font-b);
  font-size: 0.8125rem;
  color: var(--c-text);
  line-height: 1.5;
}
.field__note button {
  margin-left: 6px;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--c-accent, #22D3EE);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.field__note button:hover { color: #fff; }
.field__note button:focus-visible {
  outline: 2px solid var(--c-accent, #22D3EE);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════════
   MODEL CARDS — pick model + resolution at a glance
   3-card row replacing the model dropdown. Each card shows
   model name + tagline + tier chips (1K/2K/4K) + live final
   pixel dimensions + per-image price. Active card highlighted.
   ═══════════════════════════════════════════════════════════ */
.mcards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 4px;
}
.mcard {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  grid-template-areas:
    "head tiers"
    "stat stat";
  column-gap: 14px;
  row-gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--c-border2);
  border-radius: var(--r-md);
  background: var(--c-bg3);
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.34,1.56,0.64,1),
              border-color 0.18s ease,
              background 0.18s ease,
              box-shadow 0.18s ease;
  min-width: 0;
}
.mcard__head { grid-area: head; min-width: 0; }
.mcard__tiers { grid-area: tiers; }
.mcard__stat { grid-area: stat; }
.mcard:hover {
  border-color: var(--c-border3);
  transform: translateY(-1px);
}
.mcard:focus-visible {
  outline: 2px solid var(--c-violet-l);
  outline-offset: 3px;
}
.mcard.is-active {
  border-color: var(--c-violet);
  background:
    linear-gradient(180deg, rgba(124,58,237,0.10), rgba(34,211,238,0.04)),
    var(--c-bg3);
  box-shadow:
    0 0 0 1px var(--c-violet) inset,
    0 8px 22px -10px rgba(124,58,237,0.55);
}
.mcard__head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.mcard__title {
  font-family: var(--font-d, var(--font-b));
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  color: var(--c-text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mcard__tag {
  font-family: var(--font-b);
  font-size: 0.8125rem;
  color: var(--c-muted);
  line-height: 1.4;
  /* Single line in horizontal layout — full text remains readable */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mcard__tiers {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.mcard__tier {
  appearance: none;
  border: 1px solid var(--c-border2);
  background: rgba(255,255,255,0.02);
  color: var(--c-muted);
  border-radius: 999px;
  padding: 4px 11px;
  font-family: var(--font-b);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.mcard__tier:hover {
  border-color: var(--c-border3);
  color: var(--c-text);
}
.mcard__tier:focus-visible {
  outline: 2px solid var(--c-violet-l);
  outline-offset: 2px;
}
.mcard__tier.is-active {
  background: var(--c-violet);
  border-color: var(--c-violet);
  color: #fff;
}
.mcard__tier--solo {
  cursor: default;
  opacity: 0.85;
}
.mcard__tier--solo:hover {
  border-color: var(--c-border2);
}
.mcard__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 6px;
  border-top: 1px dashed var(--c-border);
  font-family: var(--font-b);
  min-width: 0;
}
.mcard__dim {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mcard__price {
  font-size: 0.875rem;
  font-weight: 700;
  color: #22D3EE;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
  white-space: nowrap;
}

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

/* Compliance markers shown next to the dim inside the ACTIVE card,
   plus the single warning line below the picker when 3:4 < 2000px. */
.mcard__ok {
  color: #22D3EE;
  margin-left: 4px;
  font-weight: 700;
}
.mcard__warn {
  color: #FFB464;
  margin-left: 4px;
  font-weight: 700;
}
.field__compliance {
  margin: 12px 0 0;
  padding: 0;
  font-family: var(--font-b);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--c-muted);
}
.field__compliance:empty { display: none; }
.field__compliance.is-warn {
  color: #FFB464;
}

/* ─── Variant tile: "show details" toggle (Phase 2.4) ──────────
   Reveals which archetype + scene Gemini used to generate this
   variant. Only rendered when sceneInfo is attached (auto-prompt
   path, no explicit white-bg/infographic chip override). */
.variant__details-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: rgba(8,8,13,0.85);
  border: 1px solid var(--c-border3);
  color: var(--c-text);
  font-family: var(--font-h);
  font-size: 0.75rem;
  font-weight: 700;
  font-style: italic;
  cursor: pointer;
  padding: 0;
  backdrop-filter: blur(4px);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.variant__details-toggle:hover {
  background: rgba(24,24,36,0.95);
  border-color: var(--c-border2);
  transform: scale(1.08);
}
.variant__details-toggle:focus-visible {
  outline: 2px solid var(--c-cyan);
  outline-offset: 2px;
}
.variant__details-toggle.is-open {
  background: var(--c-cyan);
  color: #08080d;
  border-color: var(--c-cyan);
}
/* When the details toggle is present, shift the dim badge left so they don't overlap. */
.variant.has-details .variant__dim { right: 38px; }

.variant__details {
  position: absolute;
  top: 38px;
  right: 8px;
  left: 8px;
  z-index: 3;
  padding: 10px 12px;
  background: rgba(8,8,13,0.92);
  border: 1px solid var(--c-border2);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  font-size: 0.6875rem;
  line-height: 1.4;
  color: var(--c-text);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.variant__details[hidden] { display: none; }
.variant__details-row { margin-bottom: 3px; }
.variant__details-row:last-child { margin-bottom: 0; }
.variant__details-row span {
  display: inline-block;
  margin-right: 4px;
  color: var(--c-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.625rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ─── Auto-status progress bar (analysis phase) ───────────────
   Thin time-based progress track shown inside the auto-status
   pill while Gemini analyses the photo. Tells the seller the
   action is real and gives a usable sense of remaining wait.
   Matches the visual language of the variant tile progress bar. */
.auto-status__prog {
  flex-basis: 100%;
  height: 3px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  position: relative;
  margin: 2px 0 0 26px;
}
.auto-status__prog-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--c-violet-l), var(--c-cyan));
  transition: width 0.4s cubic-bezier(.22, 1, .36, 1);
}
/* Stalling — past expected duration, gentle pulse to signal "still working" */
.auto-status__prog.is-stalling .auto-status__prog-fill {
  animation: prog-pulse 1.6s ease-in-out infinite;
}

/* Marketplace toggle attention nudge — fires when seller tries to upload
   without picking a marketplace first. */
@keyframes mktNudge {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
.mkt-toggle--nudge {
  animation: mktNudge 0.5s ease-in-out;
  box-shadow: 0 0 0 2px rgba(244,63,94,0.45), 0 0 16px rgba(244,63,94,0.25);
  border-radius: 14px;
}

/* When no marketplace is picked, lock steps 3-6 interactively but keep
   content readable. Earlier attempt used opacity 0.32 + saturate(0.5)
   which made all text invisible — sections looked empty/broken.
   Now: just block interaction + light fade. Headers stay fully visible. */
.panel--awaiting-mkt #promptSection,
.panel--awaiting-mkt #promptSection ~ .field {
  opacity: 0.72;
  pointer-events: none;
  transition: opacity var(--t-fast);
}
.panel--awaiting-mkt #promptSection .field__label,
.panel--awaiting-mkt #promptSection ~ .field .field__label {
  opacity: 1;
}
.panel--awaiting-mkt .generate-bar,
.panel--awaiting-mkt #generateBtn,
.panel--awaiting-mkt .compliance-note {
  opacity: 0.6;
  pointer-events: none;
}

/* ════════════════════════════════════════════════════════
   INFOGRAPHIC FUNNEL BUILDER  (see Infographics.md)
   slide-type picker (reuses .scene-card) + editable labels
   ════════════════════════════════════════════════════════ */
.info-block { margin-top: 14px; }
.info-block.hidden { display: none; }
.info-block__hint {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--c-muted);
  margin-bottom: 10px;
}

/* slide-type cards reuse .scene-card; add a description sub-line */
.scene-card__desc {
  display: block;
  width: 100%;
  font-size: 11px;
  line-height: 1.35;
  color: var(--c-subtle);
  margin-top: 2px;
}

/* Info slide-type cards: top-aligned, two-line body (title + desc) stacked
   in a flex column so the description never overlaps a wrapped title. */
.scene-card--info {
  align-items: flex-start;
}
.scene-card--info .scene-card__check {
  margin-top: 1px;
}
.scene-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.scene-card--info .scene-card__title {
  flex: none;
  font-weight: 700;
  color: var(--c-text);
  line-height: 1.25;
}
.scene-card--info .scene-card__desc {
  margin-top: 0;
}
.scene-card--info .scene-card__slots {
  margin-top: 1px;
}

/* Defensive fallback: if a cached/old build renders title + desc as direct
   siblings of .scene-card (no __body wrapper), force them to wrap to their
   own lines instead of overlapping in the row flex. */
.scene-card--info { flex-wrap: wrap; }
.scene-card--info > .scene-card__title,
.scene-card--info > .scene-card__desc {
  flex: 1 1 100%;
  min-width: 0;
}

.info-editor { margin-top: 12px; display: grid; gap: 10px; }
.info-editor:empty { margin-top: 0; }
.info-editor__slide {
  border: 0.5px solid var(--c-border2);
  border-radius: var(--r-md);
  background: var(--c-bg3);
  padding: 12px 13px;
}
.info-editor__slide-title {
  font-family: var(--font-h);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 9px;
}
.info-editor__fields { display: grid; gap: 9px; }
.info-editor__field { display: grid; gap: 4px; }
.info-editor__hint {
  font-size: 10.5px;
  color: var(--c-subtle);
  letter-spacing: 0.01em;
}
.info-editor__input {
  width: 100%;
  font-family: var(--font-b);
  font-size: 13px;
  color: var(--c-text);
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--c-border2);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.info-editor__input::placeholder { color: var(--c-subtle); }
.info-editor__input:hover { background: rgba(255,255,255,0.04); }
.info-editor__input:focus-visible {
  outline: none;
  border-color: rgba(124,58,237,0.55);
  background: rgba(124,58,237,0.06);
}
.info-editor__input.is-bad {
  border-color: rgba(244,63,94,0.6);
  background: rgba(244,63,94,0.06);
}
.info-editor__warn {
  font-size: 10.5px;
  color: var(--c-danger);
  line-height: 1.3;
}
.info-editor__warn.hidden { display: none; }

/* ── Direction toggle (success panel): Сцены / Инфографика ── */
.dir-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin: 0 0 14px;
  background: var(--c-bg2);
  border: 0.5px solid var(--c-border2);
  border-radius: var(--r-md);
}
.dir-toggle__btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font-b);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--c-muted);
  background: transparent;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  transition: color var(--t-fast), background var(--t-fast);
}
.dir-toggle__btn:hover { color: var(--c-text); }
.dir-toggle__btn.is-active {
  color: #fff;
  background: var(--c-violet);
}
.dir-toggle__btn:focus-visible {
  outline: 2px solid var(--c-violet-l);
  outline-offset: 2px;
}
