/* Конструктор видео (Хаб генерации, MVP). ТЗ: docs/specs/2026-08-13_webapp_generation_hub.md
   (репо бота). Переиспользует переменные и компоненты уже существующей
   дизайн-системы (styles.css: --surface/--line/--text/--muted/--brand,
   .segment/.icon-button/.primary-btn/.ghost-btn) и паттерн студийного
   тумблера (studio.css: .studio-toggle-row/.studio-switch) — новых
   визуальных примитивов не изобретаем. */

#pageVideoConstructor,
#pageMidjourneyConstructor,
#pageAvatarConstructor,
#pagePhotoConstructor {
  padding-bottom: calc(var(--vc-price-strip-space, 96px) + 12px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ── «Создать» — сетка 4 продуктов (единая навигация, Full). ────────────
   docs/specs/2026-08-13_webapp_generation_hub_navigation_full.md, раздел 1.3.
   Переиспользует .vc-model-chip как визуальную базу (тот же язык, крупнее
   тап-зона под плитку продукта). */

.create-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.create-tile {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 16px;
  padding: 22px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.create-tile:hover {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
}

.create-tile:active {
  transform: scale(0.97);
}

/* Нечётное число ВИДИМЫХ плиток (сегодня 5, но какие-то могут быть скрыты
   &features=) оставляло последнюю видимую плитку одну в пустой строке —
   класс ставится/снимается в JS (applyGenerationHubFeaturesFromUrl,
   app.js), т.к. чистым CSS-селектором нельзя корректно посчитать «нечётное
   число НЕскрытых» — nth-child считает DOM-позицию, не видимость. */
.create-tile--span-full {
  grid-column: 1 / -1;
}

.create-tile-icon {
  font-size: 30px;
  line-height: 1;
}

.create-tile-label {
  font-size: 13.5px;
  font-weight: 700;
  text-align: center;
}

.vc-board-note {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
}

.vc-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vc-block-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.vc-model-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.vc-model-chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  padding: 9px 10px;
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  cursor: pointer;
}

.vc-model-chip:hover {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
}

.vc-model-chip.active {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}

.vc-model-blurb {
  margin: 0;
  padding: 0 2px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.vc-seg {
  flex-wrap: wrap;
}

.vc-custom-duration {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 8px 12px;
  width: fit-content;
}

.vc-custom-duration input {
  width: 56px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.vc-custom-duration input:focus {
  outline: none;
}

.vc-custom-duration-suffix {
  font-size: 12px;
  color: var(--muted);
}

.vc-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vc-toggle-row {
  flex: 1 1 auto;
}

.vc-toggle-label {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.vc-toggle-sub {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 1px;
}

.vc-info-btn {
  flex: 0 0 auto;
}

.vc-textarea {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.5;
  min-height: 64px;
  resize: vertical;
  font-family: inherit;
}

.vc-textarea::placeholder {
  color: var(--muted);
}

.vc-textarea:focus {
  outline: none;
  border-color: var(--brand);
}

.vc-refs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.vc-refs:empty {
  display: none;
}

.vc-ref-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.vc-ref-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vc-ref-thumb button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 0;
  background: rgba(16, 19, 31, 0.7);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.vc-block-btn {
  width: 100%;
  display: block;
  text-align: center;
}

/* Список сохранённых аватаров (экран «Аватар», &avatars= от бота) — карточки
   тапабельны, неактивный тап шлёт set_active_avatar/saa и мгновенно
   переключает без формы создания ниже. */
.av-existing-row {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 2px 2px 6px;
}

.av-existing-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  width: 76px;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.av-existing-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--line);
  transition: border-color 0.15s ease, opacity 0.15s ease;
}

.av-existing-thumb.is-active {
  border-color: var(--brand);
}

.av-existing-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.av-existing-card:active .av-existing-thumb {
  opacity: 0.7;
}

.av-existing-check {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}

.av-existing-label {
  font-size: 12px;
  text-align: center;
  color: var(--muted);
  max-width: 76px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.av-existing-label.is-active {
  color: var(--text);
  font-weight: 600;
}

.vc-price-strip {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 60px; /* высота .tab-bar, тот же приём, что .studio-cart */
  z-index: 14;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}

.vc-price-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.vc-price-cap {
  font-size: 12px;
  color: var(--muted);
}

.vc-price-amount {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
