/* 06_studio.css — частина style.css, винесена без перестановки правил.
   Studio.
   Порядок підключення в index.html повторює порядок частин:
   каскад від розділення не змінився (перевірено побайтно). */
/* ── Studio ───────────────────────────────────────────────────────────── */
.st-toolbar{ display: flex; justify-content: flex-end; margin-bottom: 14px; }

.st-stepper{ display: flex; gap: var(--sp-8); flex-wrap: wrap; margin-bottom: 22px; }
.st-step{
  flex: 1; min-width: 88px; display: flex; flex-direction: column; align-items: center; gap: var(--sp-6);
  padding: 10px 6px; border-radius: var(--radius-sm); background: var(--panel); border: 1px solid var(--border-soft);
  color: var(--text-mute); font: 600 var(--fs-11)/1.2 var(--sans); text-align: center; transition: var(--t-fast) var(--ease);
}
.st-step-num{
  width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--panel-2); border: 1px solid var(--border); font: 700 var(--fs-11)/1 var(--mono); color: var(--text-dim);
}
.st-step.active{
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, var(--accent-t-edge), var(--accent-t-wash-3));
  box-shadow: inset 0 0 0 1px var(--accent-t-edge);
}
.st-step.active .st-step-num{ background: var(--grad-brand); color: #fff; border-color: transparent; }
.st-step.done{ color: var(--ok); }
.st-step.done .st-step-num{ background: rgba(var(--ok-rgb),.15); color: var(--ok); border-color: rgba(var(--ok-rgb),.3); }

.st-panel{ margin-bottom: 10px; }

.st-format-grid{ display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-14); }
.st-format-card{
  background: var(--panel); border: 1.5px solid var(--border-soft); border-radius: var(--radius-lg);
  padding: 30px 16px; display: flex; flex-direction: column; align-items: center; gap: var(--sp-10); text-align: center;
  cursor: pointer; transition: var(--t-fast) var(--ease); color: var(--text);
}
.st-format-card:hover{ border-color: var(--border-hover); transform: translateY(-2px); }
.st-format-card.selected{
  border-color: transparent;
  background: linear-gradient(var(--panel), var(--panel)) padding-box, var(--grad-brand) border-box;
  box-shadow: var(--shadow-soft);
}
.st-format-ic{ font-size: 36px; }
.st-format-label{ font: 700 var(--fs-14)/1.3 var(--sans); }
.st-format-desc{ font: 500 var(--fs-12)/1.4 var(--sans); color: var(--text-mute); }

.st-subhead{ font: 700 var(--fs-12)/1 var(--sans); color: var(--text-dim); margin: 22px 0 12px; }
.st-subhead:first-child{ margin-top: 0; }
.st-opt-tag{
  font: 600 var(--fs-11)/1 var(--sans); color: var(--text-mute); background: var(--panel-2); border: 1px solid var(--border);
  padding: 2px 7px; border-radius: 999px; margin-left: 6px;
}

.st-pick-grid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-12); margin-bottom: 4px; }
.st-pick-card{
  background: var(--panel); border: 2px solid var(--border-soft); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: var(--t-fast) var(--ease); display: flex; flex-direction: column;
}
.st-pick-card:hover{ border-color: var(--border-hover); }
.st-pick-card.selected{ border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-t-edge); }
.st-pick-thumb{ position: relative; aspect-ratio: 1; background: var(--bg-soft); display: flex; align-items: center; justify-content: center; }
.st-pick-thumb img{ width: 100%; height: 100%; object-fit: cover; display: block; }
.st-pick-thumb-ph{ font-size:  var(--fs-32); opacity: .5; }
.st-pick-body{ padding: 8px 10px; display: flex; flex-direction: column; gap: var(--sp-4); }
.st-pick-name{ font: 700 var(--fs-12)/1.3 var(--sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-pick-none .st-pick-thumb{ font-size: 26px; background: var(--bg-soft); }
.st-pick-none .st-pick-thumb::after{
  content: ""; position: absolute; top: 4px; right: 4px; bottom: 4px; left: 4px; border: 1.5px dashed var(--border-soft); border-radius: var(--radius-xs); pointer-events: none;
}
.st-pick-none .st-pick-thumb-ph{ opacity: .55; }

/* Small warning mark on buttons that trigger a paid AI-agent run (Library's
   "Оновити дослідження" / "Догенерувати фото") — the button's title attr
   carries the full tooltip text. */
.btn-cost-warn{ font-size:  var(--fs-11); opacity: .9; margin-left: 2px; }

.st-field{ margin-bottom: 20px; }
.st-count{ display: flex; align-items: center; gap: var(--sp-14); }
.st-count-btn{
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text); font: 700 16px/1 var(--sans); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.st-count-btn:hover{ border-color: var(--border-hover); background: var(--elevated); }
.st-count-val{ font: 700 16px/1 var(--mono); min-width: 20px; text-align: center; }

.st-aspect-grid{ display: flex; align-items: center; gap: var(--sp-8); flex-wrap: wrap; }
.st-aspect-btn{
  display: inline-flex; align-items: center; justify-content: center;
  height: 32px; padding: 0 16px; border-radius: 999px; box-sizing: border-box;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text-dim); font: 600 var(--fs-12)/normal var(--mono); cursor: pointer; transition: var(--t-fast) var(--ease);
}
.st-aspect-btn:hover{ border-color: var(--border-hover); color: var(--text); }
.st-aspect-btn:active{ transform: scale(.96); }
.st-aspect-btn.active{ color: #fff; border-color: transparent; background: var(--grad-li); }

.st-error{ color: var(--danger); font: 500 var(--fs-12)/1.5 var(--sans); margin-bottom: 12px; }
/* Той самий вузол у «робочому» тоні — очікування, а не збій. */
.st-error-busy{
  display: flex; align-items: center; gap: var(--sp-8); color: var(--text);
  background: rgba(var(--accent-rgb, 90,140,255),.07); border: 1px solid rgba(var(--accent-rgb, 90,140,255),.26);
  border-radius: var(--radius-sm); padding: 9px 12px;
}
.st-btn-spin{
  display: inline-block; width: 12px; height: 12px; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  opacity: .8; animation: st-btn-spin .7s linear infinite;
}
@keyframes st-btn-spin{ to{ transform: rotate(360deg); } }
.st-panel-foot{ display: flex; gap: var(--sp-10); justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }

.st-ap-status{ margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.st-ap-status .st-progress-status{ margin-bottom: 10px; }

.st-progress{ display: flex; flex-direction: column; align-items: center; gap: var(--sp-14); padding: 36px 10px 24px; text-align: center; }
/* Смуга кадрів замість кільця. Кільце нічого не каже про те, що коїться;
   тут з окремих кадрів збирається ролик, і анімація показує саме це — хвиля
   йде зліва направо, як плівка крізь проєктор.
   Анімуються ТІЛЬКИ transform і колір: жодного layout-властивості, тож
   двадцять секунд очікування не гріють процесор. */
.st-spinner{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: auto;
  height: 40px;
  border: 0;
  border-radius: 0;
  animation: none;
}
.st-spinner i{
  display: block;
  width: 10px;
  height: 34px;
  border-radius: var(--radius-xs);
  background: var(--fill-3);
  transform: scaleY(.5);
  animation: stFilmstrip 1.5s cubic-bezier(.4, 0, .2, 1) infinite;
}
.st-spinner i:nth-child(1){ animation-delay: 0s; }
.st-spinner i:nth-child(2){ animation-delay: .12s; }
.st-spinner i:nth-child(3){ animation-delay: .24s; }
.st-spinner i:nth-child(4){ animation-delay: .36s; }
.st-spinner i:nth-child(5){ animation-delay: .48s; }
@keyframes stFilmstrip{
  0%, 70%, 100%{ transform: scaleY(.5); background: var(--fill-3); }
  28%{
    transform: scaleY(1);
    background: var(--accent);
    box-shadow: 0 0 14px -2px var(--accent-glow);
  }
}
/* Кому рух заважає — лишається сама смуга: статична, але зрозуміла. */
@media (prefers-reduced-motion: reduce){
  .st-spinner i{ animation: none; transform: scaleY(.75); }
  .st-spinner i:nth-child(3){ background: var(--accent); transform: scaleY(1); }
}
.st-progress-status{ font: 700 var(--fs-13)/1.4 var(--sans); color: var(--text); }
.st-progress-status.error{ color: var(--danger); }
.st-progress-status.stopped{ color: var(--warn); }

.st-concept{ background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 14px 16px; margin: 16px 0; }
.st-concept-head{ font: 700 var(--fs-12)/1 var(--sans); color: var(--text-dim);letter-spacing: .04em; margin-bottom: 8px; }
.st-concept-body.md-body p{ margin: 0 0 8px; font-size:  var(--fs-13); line-height: 1.6; color: var(--text); }
.st-concept-body.md-body ul, .st-concept-body.md-body ol{ margin: 0 0 8px; padding-left: 20px; font-size:  var(--fs-13); color: var(--text); }

.st-variants{ display: flex; flex-direction: column; gap: 18px; }
.st-variant-grid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-12); }
.st-variant-action{
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-8);
  aspect-ratio: 1; border: 1.5px dashed var(--border); border-radius: var(--radius); cursor: pointer;
  color: var(--text-dim); font: 600 var(--fs-12)/1.3 var(--sans); padding: 14px; text-align: center; transition: var(--t-fast) var(--ease);
}
.st-variant-action:hover{ border-color: var(--accent); color: var(--text); }
.st-variant-tile{ position: relative; }

.st-carousel-group{ border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 12px; transition: var(--t-fast) var(--ease); cursor: pointer; }
.st-carousel-group.selected{ border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-t-wash-3); }
.st-carousel-group-head{ font: 700 var(--fs-12)/1 var(--sans); color: var(--text-dim); margin-bottom: 10px; display: flex; align-items: center; gap: var(--sp-8); }
.st-carousel-strip{ display: flex; gap: var(--sp-10); overflow-x: auto; padding-bottom: 4px; }
.st-carousel-tile{ flex: none; width: 120px; aspect-ratio: 4/5; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border-soft); background: var(--bg-soft); }
.st-carousel-tile img{ width: 100%; height: 100%; object-fit: cover; display: block; }

/* Video variants: centered "phone" cards, not full-width black bars —
   a 9:16 clip is contained inside a capped-width frame so it reads like a
   reel preview instead of stretching across the whole panel. */
.st-video-list{ display: flex; flex-wrap: wrap; gap: var(--sp-16); justify-content: center; }
.st-video-tile{ width: 260px; max-width: 100%; border: 2px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; cursor: pointer; background: var(--panel-2); box-shadow: var(--shadow-1); transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.st-video-tile:hover{ transform: translateY(-2px); box-shadow: var(--shadow-2); }
.st-video-tile.selected{ border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-t-wash-3), var(--shadow-2); }
.st-video-tile video{ width: 100%; height: 420px; max-height: 62vh; display: block; object-fit: contain; background: #0b0b0d; }
.st-video-tile-label{ padding: 9px 12px 4px; font: 600 var(--fs-12)/1.35 var(--sans); color: var(--text-dim); text-align: center; }
.st-video-hint{ margin: 0 0 12px; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px dashed var(--border-soft); font: 500 var(--fs-12)/1.45 var(--sans); color: var(--text-dim); text-align: center; }
.st-video-pick{ padding: 3px 9px; border-radius: 999px; background: var(--accent); color: #fff; font: 700 var(--fs-11)/1 var(--sans); box-shadow: 0 2px 8px var(--accent-t-edge-hi); }
.st-video-actions{ display: flex; gap: var(--sp-8); padding: 4px 10px 11px; }
.st-vid-act{ flex: 1; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-soft); background: var(--surface, transparent); font: 700 var(--fs-12)/1 var(--sans); color: var(--text); cursor: pointer; transition: var(--t-fast) var(--ease); }
.st-vid-act.pick:hover{ border-color: var(--accent); color: var(--accent); }
.st-vid-act.trash{ flex: 0 0 auto; min-width: 44px; color: var(--text-dim); }
.st-vid-act.trash:hover{ border-color: var(--danger); color: var(--danger); }
.st-video-tile.selected .st-vid-act.pick{ background: var(--accent); color: #fff; border-color: var(--accent); }

/* Step-3 settings as a compact 2-column grid instead of one long column.
   Wide fields (platforms, notes, reference URL) span the full row. */
.st-settings-grid{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 22px; align-items: start; }
.st-settings-grid > .st-field{ margin: 0; min-width: 0; }
.st-field-wide{ grid-column: 1 / -1; }
@media (max-width: 680px){ .st-settings-grid{ grid-template-columns: 1fr; } }

/* Autopilot: collapsed accordion tucked under recent sessions so it stops
   crowding the wizard. */
.st-autopilot{ margin-top: 22px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--panel-2); overflow: hidden; }
.st-autopilot > summary{ list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--sp-14); padding: 16px 18px; user-select: none; transition: background var(--t-fast) var(--ease); }
.st-autopilot > summary::-webkit-details-marker{ display: none; }
.st-autopilot > summary:hover{ background: var(--elevated); }
.st-autopilot-summary .ic{ font-size: 22px; line-height: 1; }
.st-autopilot-summary-text{ display: flex; flex-direction: column; gap: var(--sp-2); flex: 1; min-width: 0; }
.st-autopilot-summary-text .lbl{ font: 800 var(--fs-15)/1.2 var(--sans); color: var(--text); }
.st-autopilot-summary-text .sub{ font: 500 var(--fs-12)/1.35 var(--sans); color: var(--text-dim); }
.st-autopilot-summary .chev{ font-size:  var(--fs-15); color: var(--text-dim); transition: transform var(--t-fast) var(--ease); }
.st-autopilot[open] > summary .chev{ transform: rotate(180deg); }
.st-autopilot[open] > summary{ border-bottom: 1px solid var(--border-soft); }
.st-autopilot .st-autopilot-card{ margin: 0; border: none; border-radius: 0; background: transparent; }

/* Balance pill in the Studio header + inline run-cost estimate by the start button. */
.st-shead{ display: flex; align-items: center; gap: var(--sp-12); flex-wrap: wrap; }
.st-shead .n{ flex: 1 1 auto; }
.st-balance-pill{ display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border-soft); font: 700 var(--fs-13)/1 var(--sans); color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-balance-pill .ic{ font-size:  var(--fs-14); }
.st-balance-pill.low{ border-color: var(--warn); color: var(--warn); }
/* Панель дій кроку «Налаштування» — ЛИПКА, і ціна в ній герой.
   Було: звичайний рядок у потоці, ціна 13.5px сірим поруч із кнопкою. Тобто
   найважливіше число екрана було найдрібнішим текстом на ньому, та ще й
   їхало вниз разом зі сторінкою. Патерн узятий із fal.ai: панель дій
   прибита до низу панелі, головна дія завжди під рукою. */
.st-foot-cost{
  position: sticky; bottom: 0; z-index: 3;
  display: flex; align-items: center; gap: var(--sp-14);
  margin: 18px -18px -18px; padding: 14px 18px;
  border-top: 1px solid var(--border-soft);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(8px);
}
/* ── ЦІНА: ЧИСЛО-ГЕРОЙ І РОЗКЛАДКА ──────────────────────────────────────
   Було 24px в один рядок із написом «кр» тим самим шрифтом — тобто ціна
   виглядала як підпис біля кнопки. На екрані, де кожне натискання списує
   гроші, ціна мусить бути найбільшим числом у своєму куті.

   Колонка, а не рядок: число, під ним чотири рядки розкладки, під ними
   залишок. Читається згори вниз як рахунок — скільки, за що, і що
   лишиться. */
.st-cost-inline{
  display: flex; flex-direction: column; align-items: flex-end;
  gap: var(--sp-4); margin-left: auto; text-align: right;
}
.st-cost-inline-est{
  display: inline-flex; align-items: baseline; gap: 5px;
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  line-height: 1; color: var(--accent);
}
/* Число й одиниця РІЗНОГО кегля. Набрані однаково, «111 кр» читається як
   напис; окремо число стає предметом, а «кр» — його підписом. */
.st-cost-inline-est b{ font-weight: 700; font-size: 38px; letter-spacing: -.04em; }
.st-cost-inline-est i{ font-style: normal; font-weight: 600; font-size:  var(--fs-13); color: var(--text-mute); }
.st-cost-inline-est .lbl{ color: var(--text-mute); font-weight: 500; font-size:  var(--fs-15); }

.st-cost-parts{
  display: flex; flex-direction: column; gap: 1px;
  font: 500 var(--fs-11)/1.5 var(--sans); color: var(--text-mute);
}
.st-cost-parts span{ display: flex; align-items: baseline; gap: var(--sp-8); justify-content: flex-end; }
.st-cost-parts em{ font-style: normal; }
.st-cost-parts b{
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-weight: 600; color: var(--text-dim); min-width: 26px; text-align: right;
}
.st-cost-left{
  margin-top: 2px; font: 500 var(--fs-12)/1.4 var(--sans); color: var(--text-mute);
}
.st-cost-left b{
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-weight: 700; color: var(--text-dim);
}
.st-cost-inline-note{ font: 600 var(--fs-12)/1.3 var(--sans); color: var(--warn); white-space: nowrap; }
.st-foot-cost .btn-primary{ margin-left: 0; }

@media (max-width: 640px){
  /* На 390 колонка ціни стає рядком: вертикальний рахунок з'їдав би
     половину рядка дії, а він унизу екрана й має лишатись 64px. */
  .st-cost-inline{ flex-direction: row; align-items: baseline; gap: var(--sp-8); }
  .st-cost-inline-est b{ font-size: 26px; }
  .st-cost-parts{ display: none; }
  .st-foot-cost{ gap: var(--sp-10); }
}
/* run timer / credits-spent (step 4). */
.st-run-meta{ display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 6px 0 10px; }
.st-run-chip{ display: inline-flex; align-items: center; gap: var(--sp-6); padding: 6px 12px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border-soft); font: 700 var(--fs-13)/1 var(--sans); color: var(--text); font-variant-numeric: tabular-nums; }
.st-run-chip .lbl{ font-weight: 600; color: var(--text-dim); }
.st-run-chip.live{ border-color: var(--accent); }
.st-run-chip.live .dot{ width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: stPulse 1.1s ease-in-out infinite; }
@keyframes stPulse{ 0%,100%{ opacity: .35; } 50%{ opacity: 1; } }

.st-zoom-btn{
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; border: none; font-size:  var(--fs-11); cursor: pointer;
  display: flex; align-items: center; justify-content: center; z-index: 2;
}

.st-ready-grid{ display: grid; grid-template-columns: 1fr 300px; gap: var(--sp-20); align-items: start; }
.st-ready-side{ position: sticky; top: calc(var(--topbar-h) + 20px); }
.st-media-grid.readonly .media-item{ cursor: default; }
.st-scheduled-note{ margin-top: 10px; font: 600 var(--fs-12)/1.5 var(--sans); color: var(--ok); display: flex; align-items: center; gap: var(--sp-10); flex-wrap: wrap; }

.st-recent-grid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-12); }
.st-recent-card{ background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 12px 14px; transition: var(--t-fast) var(--ease); }
.st-recent-card.clickable{ cursor: pointer; }
.st-recent-card.clickable:hover{ border-color: var(--border-hover); transform: translateY(-3px); box-shadow: var(--shadow-2); }
.st-recent-top{ display: flex; align-items: center; gap: var(--sp-8); margin-bottom: 6px; }
.st-recent-fmt{ font-size: 16px; }
.st-recent-name{ font: 700 var(--fs-12)/1.3 var(--sans); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-recent-meta{ font: 500 var(--fs-11)/1.4 var(--mono); color: var(--text-mute); margin-top: 4px; }

@media (max-width: 860px){
  .st-format-grid{ grid-template-columns: 1fr; }
  .st-pick-grid{ grid-template-columns: repeat(2, 1fr); }
  .st-ready-grid{ grid-template-columns: 1fr; }
  .st-ready-side{ position: static; }
  .st-stepper{ gap: var(--sp-6); }
  .st-step{ min-width: 70px; font-size:  var(--fs-10); padding: 8px 4px; }
}
@media (max-width: 640px){
  .st-variant-grid{ grid-template-columns: repeat(2, 1fr); }
  .st-pick-grid{ grid-template-columns: repeat(2, 1fr); }
}

