/* ════════════════════════════════════════════════════════════════════
   ReklamAI Studio — clean app-shell design system.
   One source of truth for /create and the generation flow. Replaces the
   three stacked generator themes. Tokens mirror the marketing landing
   (Instrument Serif · IBM Plex Sans · JetBrains Mono · lava accent).
   Rule of the house: no !important (single exception: .hidden, which is
   a JS state contract inherited from reklamai.js).
   ════════════════════════════════════════════════════════════════════ */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap");
@import url("tokens.css");

:root {
  /* ── WARM-LIGHT override (mirrors the landing) — wins over tokens.css.
        Only .studio-shell pages load this file, so the shared tokens.css
        stays dark for the other shells. Change the brand here = studio only. */
  --bg: #FBFAF7;
  --surface-1: #F4F2ED;
  --surface-2: #EAE7E0;
  --surface-3: #FFFFFF;
  --line-1: rgba(40, 36, 30, 0.10);
  --line-2: rgba(40, 36, 30, 0.18);
  --ink: #28241E;
  --ink-dim: #615C53;
  --ink-faint: #8E887D;
  --accent: #F1581E;
  --accent-ink: #B83E12;
  --accent-soft: #FCEFE7;
  --accent-line: rgba(241, 88, 30, 0.30);
  --ok: #2F9D5B;
  --ok-soft: rgba(47, 157, 91, 0.12);
  --c-accent: #F1581E;
  --c-cta-from: #F8743E;
  --c-cta-to: #E04E18;
  --font-display: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* rhythm */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --r-pill: 999px;
  --header-h: 64px;
  --gap: 14px;
  --pad: 18px;

  --shadow-1: 0 16px 40px -26px rgba(40, 36, 30, 0.20);
  --shadow-2: 0 30px 70px -32px rgba(40, 36, 30, 0.26);
  --glow: 0 0 44px -10px rgba(241, 88, 30, 0.12);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── base ─────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { background: var(--bg); }
body.studio-shell {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(90% 60% at 50% -10%, rgba(241, 88, 30, 0.05), transparent 62%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.studio-shell a { color: inherit; text-decoration: none; }
.studio-shell button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
.studio-shell input, .studio-shell textarea, .studio-shell select { font: inherit; color: var(--ink); }
.studio-shell img { display: block; max-width: 100%; }

/* JS state contract (reklamai.js toggles this class everywhere) */
.hidden { display: none !important; }

/* ── primitives ───────────────────────────────────────────────────── */
.st-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.st-serif { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.015em; }

.st-card {
  background: var(--surface-1);
  border: 1px solid var(--line-1);
  border-radius: var(--r-lg);
  padding: var(--pad);
}
.st-card.is-elevated { background: var(--surface-3); backdrop-filter: blur(18px); box-shadow: var(--shadow-1); }

.st-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 20px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-1);
  background: var(--surface-2);
  font-weight: 600;
  font-size: 13.5px;
  transition: border-color 0.2s, background 0.2s, transform 0.25s var(--ease), box-shadow 0.25s;
}
.st-btn:hover { border-color: var(--line-2); background: rgba(40, 36, 30, 0.05); transform: translateY(-1px); }
.st-btn:active { transform: translateY(0) scale(0.99); }
.st-btn:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 3px; }
.st-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.st-btn.is-primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--c-cta-from), var(--c-cta-to));
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 217, 196, 0.55), 0 14px 30px -14px rgba(241, 88, 30, 0.38);
}
.st-btn.is-primary:hover { box-shadow: inset 0 1px 0 rgba(255, 217, 196, 0.55), 0 18px 40px -14px rgba(241, 88, 30, 0.48); background: linear-gradient(135deg, var(--c-accent), var(--c-cta-from)); }
.st-btn.is-quiet { background: transparent; }
.st-btn.is-accent-ghost { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-ink); }

.st-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-1);
  background: var(--surface-1);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
  transition: all 0.2s;
}
.st-chip:hover { border-color: var(--accent-line); color: var(--accent-ink); }
.st-chip.is-active, .st-chip.text-orange-400 { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-ink); }

.st-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.st-dot.is-ok { background: var(--ok); }

/* ── top bar ──────────────────────────────────────────────────────── */
.st-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
  padding: 0 clamp(18px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line-1);
}
.st-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 20px; letter-spacing: -0.01em; }
.st-topbar nav { display: flex; gap: 4px; }
.st-topbar nav a { padding: 8px 13px; border-radius: var(--r-sm); font-size: 13.5px; color: var(--ink-dim); transition: all 0.2s; }
.st-topbar nav a:hover { color: var(--ink); background: var(--surface-1); }
.st-top-actions { display: flex; align-items: center; gap: 9px; }

/* ── stage layout ─────────────────────────────────────────────────── */
.st-stage {
  width: min(1180px, calc(100% - clamp(28px, 6vw, 72px)));
  margin: 0 auto;
  padding: clamp(26px, 4.5vh, 52px) 0 70px;
}

/* intake hero */
.st-intake-head { text-align: center; margin-bottom: 26px; }
.st-intake-head h1 {
  margin: 10px 0 8px;
  font-family: var(--font-display);
  font-size: clamp(38px, 5.2vw, 62px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  font-weight: 800;
}
.st-intake-head h1 em { font-style: normal; color: var(--accent); }
.st-intake-head p { margin: 0 auto; max-width: 560px; color: var(--ink-dim); font-size: 15.5px; }

.st-desk {
  max-width: 860px;
  margin: 0 auto;
  background: var(--surface-3);
  border: 1px solid var(--line-1);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-2), var(--glow);
  backdrop-filter: blur(20px);
  overflow: hidden;
}
.st-desk-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 18px 0; }
.st-desk-body { padding: 14px 18px 18px; }

/* dropzone */
.ra-photo-dropzone {
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-lg);
  background: radial-gradient(110% 180% at 8% 50%, rgba(255, 87, 15, 0.07), transparent 55%);
  cursor: pointer;
  transition: border-color 0.25s, background-color 0.25s, transform 0.25s var(--ease);
  outline: none;
}
.ra-photo-dropzone:hover, .ra-photo-dropzone:focus-visible { border-color: var(--accent-line); }
.ra-photo-dropzone:focus-visible { box-shadow: 0 0 0 3px rgba(255, 87, 15, 0.22); }
.ra-photo-dropzone.is-dragover { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.004); }
.ra-dz-empty, .ra-dz-done { display: flex; align-items: center; gap: 15px; padding: 16px 18px; }
.ra-dz-icon { width: 36px; height: 36px; flex: none; color: var(--accent-ink); }
.ra-dz-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ra-dz-text strong { font-size: 14.5px; font-weight: 700; }
.ra-dz-text span { font-size: 12.5px; color: var(--ink-faint); }
.ra-dz-cta {
  flex: none;
  padding: 9px 15px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-1);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
}
.ra-photo-dropzone:hover .ra-dz-cta { border-color: var(--accent-line); color: var(--accent-ink); }
.ra-dz-done img { width: 54px; height: 54px; flex: none; object-fit: cover; border-radius: var(--r-md); border: 1px solid var(--line-2); }
.ra-dz-ok { color: var(--ok); }
.ra-dz-clear {
  flex: none;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-1);
  color: var(--ink-faint);
  transition: all 0.2s;
}
.ra-dz-clear:hover { border-color: var(--accent-line); color: var(--accent-ink); }

/* brief */
.st-desk textarea[data-prompt] {
  width: 100%;
  min-height: 96px;
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line-1);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.st-desk textarea[data-prompt]::placeholder { color: var(--ink-dim); }
.st-desk textarea[data-prompt]:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px rgba(255, 87, 15, 0.14); }

/* action row: source chips · meta · CTA */
.ra-prompt-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 13px;
}
.ra-source-row { display: flex; gap: 7px; }
.ra-source-chip { composes: none; }
.ra-source-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-1);
  background: var(--surface-1);
  font-size: 12.5px;
  color: var(--ink-dim);
  transition: all 0.2s;
}
.ra-source-chip .material-symbols-outlined { font-size: 16px; }
.ra-source-chip:hover { border-color: var(--line-2); color: var(--ink); }
.ra-source-chip.is-active { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-ink); }
.st-action-spacer { flex: 1; }
[data-char-count] { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-faint); letter-spacing: 0.08em; }

[data-generate-btn] { min-width: 210px; }
[data-generate-btn] .st-cost {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.16);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
}

/* fidelity hint (Law #1) — JS injects, classes here are the contract */
[data-fidelity-hint-text] {
  display: flex; align-items: flex-start; gap: 9px;
  margin: 12px 0 0;
  padding: 11px 14px;
  border-radius: var(--r-md);
  font-size: 12.5px;
  font-weight: 550;
  line-height: 1.45;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-ink);
}
[data-fidelity-hint-text].border-emerald-500\/30,
[data-fidelity-hint-text][class*="emerald"] {
  border-color: rgba(52, 211, 153, 0.35);
  background: var(--ok-soft);
  color: var(--ok);
}

/* examples row */
.st-examples { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.st-deliver { margin-top: 13px; padding: 11px 14px; border-radius: var(--r-md); border: 1px solid var(--line-1); background: var(--surface-1); font-size: 12.5px; color: var(--ink-faint); }

/* mode toggle under desk */
.st-mode-row { display: flex; justify-content: center; gap: 8px; margin: 22px 0 0; }

/* ── flow stage (generation room) ─────────────────────────────────── */
.st-flow-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
[data-flow-main-title] {
  margin: 6px 0 4px;
  font-family: var(--font-display);
  font-size: clamp(30px, 3.6vw, 44px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--ink);
}
[data-flow-substatus] { margin: 0; max-width: 640px; color: var(--ink-dim); font-size: 14px; }
[data-flow-status-pill] {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* step rail */
.st-steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; }
[data-generation-step] {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-1);
  background: var(--surface-1);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  transition: all 0.25s;
}
[data-generation-step] .num {
  width: 18px; height: 18px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 9.5px;
}
[data-generation-step].is-active { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-ink); animation: st-step-glow 2.2s ease-in-out infinite; }
[data-generation-step].is-active::before { content: "● "; }
[data-generation-step].is-done .num::after { content: ""; }
@keyframes st-step-glow { 0%,100% { box-shadow: 0 0 0 0 rgba(255,90,54,0); } 50% { box-shadow: 0 0 0 4px rgba(255,90,54,0.08); } }
[data-generation-step].is-active .num { background: var(--accent); color: #fff; }
[data-generation-step].is-done { color: var(--ink-dim); }
[data-generation-step].is-done .num { background: var(--ok-soft); color: var(--ok); }

/* workbench grid */
.st-workbench { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: var(--gap); align-items: start; }
.st-col { display: grid; gap: var(--gap); min-width: 0; }

.ra-artifact-card {
  background: var(--surface-3);
  border: 1px solid var(--line-1);
  border-radius: var(--r-lg);
  padding: var(--pad);
  backdrop-filter: blur(14px);
}
.ra-artifact-card h3 { margin: 6px 0 10px; font-size: 14.5px; font-weight: 700; }
.ra-artifact-kicker { margin: 0; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-faint); }
.ra-artifact-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ra-artifact-head .count { font-family: var(--font-mono); font-size: 10.5px; color: var(--accent-ink); }
.ra-artifact-placeholder { position: relative; padding: 14px 4px; color: var(--ink-faint); font-size: 13px; }
body.ra-generation-room:not(.ra-flow-result):not(.ra-flow-selection-required) .ra-artifact-placeholder::after {
  content: ""; position: absolute; inset: 0; border-radius: var(--r-md);
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,0.65) 50%, transparent 80%);
  background-size: 220% 100%; animation: st-shimmer 1.7s linear infinite; pointer-events: none;
}
@keyframes st-shimmer { from { background-position: 220% 0; } to { background-position: -120% 0; } }

.ra-workflow-fields { display: grid; gap: 8px; }
.ra-workflow-field {
  padding: 11px 13px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-1);
  background: var(--surface-1);
}
.ra-workflow-field span { display: block; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 3px; }
.ra-workflow-field strong { font-size: 13.5px; font-weight: 550; line-height: 1.4; }

/* live preview */
.ra-live-preview {
  position: relative;
  min-height: 300px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-1);
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
[data-flow-preview-empty] { text-align: center; padding: 26px; }
[data-flow-preview-empty] .icon-box {
  margin: 0 auto 14px;
  width: 72px; height: 72px;
  display: grid; place-items: center;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--ink-faint);
}
[data-flow-preview-empty] .icon-box .material-symbols-outlined { font-size: 30px; animation: st-breathe 2.4s ease-in-out infinite; }
[data-flow-preview-empty] strong { display: block; font-family: var(--font-display); font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
[data-flow-preview-empty] p { margin: 8px auto 0; max-width: 300px; color: var(--ink-faint); font-size: 13px; }
[data-flow-preview-media] { width: 100%; }
[data-flow-preview-media] img, [data-flow-preview-media] video { width: 100%; height: auto; display: block; }
@keyframes st-breathe { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

/* image variants grid */
[data-flow-images] { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
[data-flow-images] img { border-radius: var(--r-md); border: 1px solid var(--line-1); cursor: pointer; transition: transform 0.25s var(--ease), border-color 0.2s; width: 100%; aspect-ratio: 3/4; object-fit: cover; }
[data-flow-images] img:hover { transform: translateY(-3px); border-color: var(--accent-line); }
[data-flow-images] .is-selected img, [data-flow-images] img.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* copy list (JS renders .flow-copy-item buttons) */
[data-flow-copy] { display: grid; gap: 8px; max-height: 360px; overflow: auto; }
.flow-copy-item {
  width: 100%;
  text-align: left;
  padding: 13px 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-1);
  background: var(--surface-1);
  transition: border-color 0.2s, background 0.2s;
  color: var(--ink);
}
.flow-copy-item:hover { border-color: var(--accent-line); }
.flow-copy-item.create-selected-ring,
.flow-copy-item.border-orange-300\/55 { border-color: var(--accent-line); background: var(--accent-soft); }
.flow-copy-item p { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--ink-dim); }
.flow-copy-item p:first-child { font-weight: 700; font-size: 13.5px; color: var(--ink); margin-bottom: 3px; }

/* director strip */
.st-director { display: flex; gap: 13px; align-items: flex-start; }
.st-director .avatar {
  flex: none;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-ink);
}
[data-flow-director-status] { color: var(--ink-faint); font-size: 12.5px; }
[data-flow-director-step] { font-weight: 700; font-size: 13.5px; color: var(--accent-ink); }
.ra-director-card { margin-top: 10px; padding: 11px 13px; border-radius: var(--r-md); border: 1px solid var(--line-1); background: var(--surface-1); font-size: 12.5px; color: var(--ink-dim); }
.ra-director-card p { margin: 0 0 3px; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); }

/* export panel */
.ra-export-panel {
  background: linear-gradient(180deg, var(--accent-soft), var(--surface-3) 60%);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-xl);
  padding: 22px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-2), 0 0 60px -20px rgba(241,88,30,0.18);
}
[data-flow-selection-title] { font-family: var(--font-display); font-size: 27px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 6px; }
[data-flow-selection-meta] { color: var(--ink-dim); font-size: 13px; }
.ra-export-panel .st-btn { width: 100%; margin-top: 10px; }

[data-infographic-block] { margin-top: 10px; display: grid; gap: 9px; }
[data-infographic-thumb] { border-radius: var(--r-md); border: 1px solid var(--line-1); box-shadow: var(--shadow-1); width: 100%; height: auto; }

/* result summary («почему это работает») */
.ra-result-director-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: var(--gap);
  margin-top: var(--gap);
  padding: var(--pad);
  border-radius: var(--r-lg);
  border: 1px solid var(--line-1);
  background: var(--surface-3);
  backdrop-filter: blur(16px);
}
.ra-result-director-kicker { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--accent-ink); margin: 0 0 6px; }
.ra-result-director-summary h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.ra-result-director-summary .fields { display: grid; gap: 8px; align-content: start; }

/* progress bars */
[data-flow-image-progress], [data-flow-video-progress], [data-progress-ring] { accent-color: var(--accent); }
.st-bar { height: 5px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.st-bar > span { display: block; height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, #ff7a42, var(--accent)); transition: width 0.5s var(--ease); }

/* ── responsive ───────────────────────────────────────────────────── */
@media (max-width: 920px) {
  .st-workbench { grid-template-columns: 1fr; }
  .st-topbar nav { display: none; }
  [data-flow-images] { grid-template-columns: repeat(2, 1fr); }
  .ra-result-director-summary { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .ra-dz-cta { display: none; }
  .ra-prompt-action-row { align-items: stretch; }
  [data-generate-btn] { width: 100%; }
  .st-action-spacer { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms; transition-duration: 0.01ms; }
}

/* ── stage switching: intake ⇄ flow (body class driven by reklamai.js) ─ */
.st-flow { display: none; }
body.ra-generation-room .st-intake { display: none; }
body.ra-generation-room .st-flow { display: block; }
/* When [data-flow-active] still carries .hidden on first paint, respect it */
.st-flow.hidden { display: none !important; }

/* ════════════════════════════════════════════════════════════════════
   BLOCK 2 — theatre: reveal, selection state, waiting tiles.
   Targets the live markup reklamai.js produces (Tailwind class names in
   that markup are inert here — no Tailwind build — so we own these fully).
   ════════════════════════════════════════════════════════════════════ */

/* result reveal — fresh <img>/<video> node fires this on every new result */
[data-flow-preview-media] img,
[data-flow-preview-media] video {
  width: 100%; height: auto; display: block;
  border-radius: var(--r-md);
  animation: st-reveal 0.62s var(--ease) both;
}
@keyframes st-reveal {
  from { opacity: 0; transform: scale(0.94) translateY(10px); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}

/* image variant tiles (JS renders <button data-flow-image-id>) */
[data-flow-images] [data-flow-image-id] {
  position: relative;
  display: block;
  padding: 0;
  border-radius: var(--r-md);
  border: 1px solid var(--line-1);
  background: var(--surface-1);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s var(--ease), border-color 0.2s, box-shadow 0.3s, opacity 0.3s;
}
[data-flow-images] [data-flow-image-id] img {
  width: 100%; aspect-ratio: 3 / 4; height: auto; object-fit: cover; display: block;
  animation: st-reveal 0.5s var(--ease) both;
}
[data-flow-images] [data-flow-image-id]:hover { transform: translateY(-4px); border-color: var(--accent-line); box-shadow: var(--shadow-1); }

/* selected: lift + ring + accent glow; injected "Выбрано" pill scales in */
[data-flow-images] [data-flow-image-id].create-selected-ring {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft), 0 16px 40px -16px rgba(255,90,54,0.4);
  transform: translateY(-3px);
}
[data-flow-images] [data-flow-image-id].create-selected-ring span {
  animation: st-pop 0.32s var(--ease) both;
  background: var(--c-accent) !important;
  border-color: var(--accent-line) !important;
  color: #fff !important;
}
@keyframes st-pop { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }

/* dim the non-chosen once a choice is made — focuses the eye on the pick */
[data-flow-images]:has(.create-selected-ring) [data-flow-image-id]:not(.create-selected-ring) { opacity: 0.5; }
[data-flow-images]:has(.create-selected-ring) [data-flow-image-id]:not(.create-selected-ring):hover { opacity: 0.85; }

/* "Выбрать" hint pill on unselected tiles → light warm glass */
[data-flow-images] [data-flow-image-id] span {
  position: absolute; bottom: 8px; left: 8px; z-index: 2;
  padding: 4px 9px; border-radius: var(--r-pill);
  background: rgba(251,250,247,0.85); backdrop-filter: blur(8px);
  border: 1px solid var(--line-2);
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink);
}

/* waiting tiles (were light-theme white) → dark + shimmer */
.ra-image-waiting-tile {
  position: relative; min-height: 96px; overflow: hidden;
  border-radius: var(--r-md);
  border: 1px solid var(--line-1);
  background: var(--surface-2);
}
.ra-image-waiting-tile::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,0.65) 50%, transparent 80%);
  background-size: 220% 100%; animation: st-shimmer 1.6s linear infinite;
}
.ra-image-waiting-tile span {
  position: absolute; bottom: 8px; left: 8px; z-index: 1;
  padding: 4px 8px; border-radius: var(--r-pill);
  background: rgba(251,250,247,0.82); border: 1px solid var(--line-1);
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim);
}

/* choice helper line */
.ra-choice-helper {
  grid-column: 1 / -1;
  padding: 9px 13px; border-radius: var(--r-md);
  border: 1px solid var(--accent-line); background: var(--accent-soft);
  font-size: 12px; color: var(--accent-ink);
}

/* director avatar — alive while the room is generating */
body.ra-generation-room:not(.ra-flow-result):not(.ra-flow-selection-required):not(.ra-flow-export-ready) .st-director .avatar {
  animation: st-think 2s ease-in-out infinite;
}
@keyframes st-think {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,90,54,0.0); }
  50%      { box-shadow: 0 0 0 6px rgba(255,90,54,0.12), 0 0 20px rgba(255,90,54,0.25); }
}
.st-director .avatar .material-symbols-outlined {
  transition: transform 0.4s var(--ease);
}
body.ra-generation-room:not(.ra-flow-result):not(.ra-flow-selection-required) .st-director .avatar .material-symbols-outlined {
  animation: st-think-icon 2.4s ease-in-out infinite;
}
@keyframes st-think-icon { 0%,100% { opacity: 0.7; } 50% { opacity: 1; } }

/* ── shelf mockup: «как увидят на полке WB» ───────────────────────── */
.st-shelf { margin: 4px 0 12px; }
.st-shelf-head {
  display: flex; align-items: center; gap: 7px; margin-bottom: 9px;
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-faint);
}
.st-shelf-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.st-shelf-grid { display: grid; grid-template-columns: 0.5fr 1fr 0.5fr; gap: 8px; align-items: center; }
.st-shelf-cell { border-radius: var(--r-sm); aspect-ratio: 3 / 4; overflow: hidden; }
.st-shelf-cell.is-ghost {
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 8px, transparent 8px 16px);
  border: 1px solid var(--line-1);
  opacity: 0.5;
}
.st-shelf-cell.is-hero {
  position: relative;
  border: 1px solid var(--accent-line);
  box-shadow: 0 14px 36px -16px rgba(255,90,54,0.45);
  background: var(--surface-2);
  animation: st-pop 0.4s var(--ease) both;
}
.st-shelf-cell.is-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-shelf-price {
  position: absolute; left: 6px; bottom: 6px;
  padding: 3px 7px; border-radius: var(--r-sm);
  background: rgba(251,250,247,0.85); backdrop-filter: blur(6px);
  font-size: 11px; font-weight: 700; color: var(--ink);
}
.st-shelf-price s { font-size: 9px; font-weight: 400; color: var(--ink-faint); margin-left: 3px; }


/* ── motion polish (auto) ── */

/* focus-visible rings everywhere interactive — accent ring, no layout shift */
.st-chip:focus-visible,
.ra-source-chip:focus-visible,
.flow-copy-item:focus-visible,
.ra-dz-clear:focus-visible,
.st-topbar nav a:focus-visible,
[data-generation-step]:focus-visible,
[data-flow-images] [data-flow-image-id]:focus-visible,
.ra-workflow-field:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(241, 88, 30, 0.4);
}

/* chip press feedback */
.st-chip {
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease),
    background 0.2s var(--ease), transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.st-chip:hover { transform: translateY(-2px); }
.st-chip:active { transform: translateY(0) scale(0.98); }

/* source chips — lift + press, ring already covered above */
.ra-source-chip {
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease),
    background 0.2s var(--ease), transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.ra-source-chip:hover { transform: translateY(-2px); box-shadow: var(--shadow-1); }
.ra-source-chip:active { transform: translateY(0) scale(0.98); }

/* copy-result cards — designed hover lift + accent depth + press */
.flow-copy-item {
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease),
    transform 0.28s var(--ease), box-shadow 0.28s var(--ease);
}
.flow-copy-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-1); }
.flow-copy-item:active { transform: translateY(-1px) scale(0.992); }

/* artifact cards — quiet lift on hover, brings surface forward */
.ra-artifact-card {
  transition: transform 0.32s var(--ease), box-shadow 0.32s var(--ease), border-color 0.2s var(--ease);
}
.ra-artifact-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-2);
  box-shadow: var(--shadow-1);
}

/* workflow fields — subtle accent wake on hover */
.ra-workflow-field {
  transition: border-color 0.2s var(--ease), transform 0.24s var(--ease), box-shadow 0.24s var(--ease);
}
.ra-workflow-field:hover {
  transform: translateY(-1px);
  border-color: var(--accent-line);
  box-shadow: var(--shadow-1);
}

/* top nav — press + smoother motion (hover colour already defined) */
.st-topbar nav a { transition: color 0.2s var(--ease), background 0.2s var(--ease), transform 0.18s var(--ease); }
.st-topbar nav a:active { transform: scale(0.96); }

/* dropzone clear button — press feedback */
.ra-dz-clear { transition: border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.ra-dz-clear:hover { transform: scale(1.06); }
.ra-dz-clear:active { transform: scale(0.94); }

/* artifact count badge — gentle spring-in on each render */
.ra-artifact-head .count { animation: st-pop 0.4s var(--ease) both; }

/* shelf hero — answers the eye on hover */
.st-shelf-cell.is-hero { transition: transform 0.34s var(--ease), box-shadow 0.34s var(--ease); }
.st-shelf-cell.is-hero:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 20px 46px -16px rgba(255, 90, 54, 0.5);
}

/* idle breathing — ONE soft glow on the key elevated surface (intake desk) */
.st-card.is-elevated { animation: st-mp-breathe 7s ease-in-out infinite; }
@keyframes st-mp-breathe {
  0%, 100% { box-shadow: var(--shadow-1); }
  50%      { box-shadow: var(--shadow-1), 0 0 38px -12px rgba(241, 88, 30, 0.16); }
}

/* honour reduced-motion for every rule added in this block */
@media (prefers-reduced-motion: reduce) {
  .st-chip,
  .st-chip:hover,
  .st-chip:active,
  .ra-source-chip,
  .ra-source-chip:hover,
  .ra-source-chip:active,
  .flow-copy-item,
  .flow-copy-item:hover,
  .flow-copy-item:active,
  .ra-artifact-card,
  .ra-artifact-card:hover,
  .ra-workflow-field,
  .ra-workflow-field:hover,
  .st-topbar nav a,
  .st-topbar nav a:active,
  .ra-dz-clear,
  .ra-dz-clear:hover,
  .ra-dz-clear:active,
  .st-shelf-cell.is-hero,
  .st-shelf-cell.is-hero:hover,
  .ra-artifact-head .count,
  .st-card.is-elevated {
    animation: none;
    transition: none;
    transform: none;
  }
}
