/* Мастер создания персонажа: прогресс шагов → шаг (карточки с живыми примерами, чипы, голос) →
   нижняя панель «Назад/Далее» (.dock дизайн-системы: липкая, при открытой клавиатуре — обычный блок в конце).
   Заголовка шага нет — шаг называет прогресс. Десктоп (≥1024) — справа липкое превью анкеты.
   Ожидание аватара и результат — .create-wait / .create-result (create/wait.js). */

.create { min-height: 100%; display: flex; flex-direction: column; }
.create__layout { flex: 1; width: 100%; max-width: var(--page-max); margin-inline: auto; padding: 0 var(--gutter) 12px; }
.create__main { min-width: 0; }
.create__aside { display: none; }

/* ---------- Шаги ---------- */
.create__progress { width: 100%; max-width: var(--page-max); margin-inline: auto; padding: 4px var(--gutter) 8px; }
.create-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
/* Все шаги одной высоты 44 px (тап-зона пройденного шага), поэтому появление кнопки не сдвигает вёрстку */
.create-steps__item { display: flex; flex-direction: column; min-width: 0; min-height: 44px; }
/* Кнопка пройденного шага: вся ячейка — зона касания, содержимое сверху (кнопка центрирует его по вертикали) */
.create-steps__btn { flex: 1; display: flex; flex-direction: column; justify-content: flex-start; width: 100%; min-height: 44px; padding-top: 4px; border-radius: var(--r-xs); text-align: left; color: inherit; }
.create-steps__item > .create-steps__bar { margin-top: 4px; }
.create-steps__bar { display: block; height: 4px; border-radius: 2px; background: var(--card-3); transition: background var(--t); }
.create-steps__item.is-done .create-steps__bar,
.create-steps__item.is-current .create-steps__bar { background: var(--grad); }
.create-steps__item.is-current .create-steps__bar { box-shadow: 0 0 12px rgba(255, 45, 120, 0.45); }
.create-steps__label { display: block; margin-top: 7px; font-size: 12px; font-weight: 600; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.create-steps__item.is-done .create-steps__label { color: var(--muted); }
.create-steps__item.is-current .create-steps__label { color: var(--text); font-weight: 700; }

.create-step { padding-top: 4px; animation: rise-in 260ms var(--ease) both; }
.create__step-sub { margin: 0 0 14px; font-size: 13px; line-height: 1.4; color: var(--muted); }

/* ---------- Группы полей и ошибки ---------- */
.create__group { margin-bottom: 18px; }
.create__group:last-child { margin-bottom: 8px; }
.create__group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.create__group-title { font-size: 13px; font-weight: 700; color: var(--muted); }
.create__counter { font-size: 12px; font-weight: 600; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.create__hint { margin-top: 6px; font-size: 12px; line-height: 1.4; color: var(--muted-2); }
.create__error { display: flex; align-items: flex-start; gap: 6px; margin-top: 8px; font-size: 13px; font-weight: 600; line-height: 1.35; color: var(--red); }
.create__error::before { content: "!"; flex: 0 0 auto; width: 16px; height: 16px; display: grid; place-items: center; margin-top: 1px; border-radius: 50%; font-size: 11px; font-weight: 900; color: #fff; background: var(--red); }
.create__group.has-error .create__group-title { color: var(--red); }
.create__group.has-error .input,
.create__group.has-error .textarea { border-color: var(--red); box-shadow: 0 0 0 3px rgba(255, 77, 94, 0.18); }
.create__group.has-error { animation: create-shake 360ms var(--ease); }

/* Плашка ошибки сервера вверху шага */
.create-alert { display: flex; gap: 12px; margin-bottom: 18px; padding: 12px 14px; border-radius: var(--r); background: rgba(255, 77, 94, 0.1); border: 1px solid rgba(255, 77, 94, 0.4); animation: rise-in 260ms var(--ease) both; }
.create-alert--limit { background: rgba(255, 181, 71, 0.1); border-color: rgba(255, 181, 71, 0.4); }
.create-alert__icon { flex: 0 0 auto; display: inline-flex; color: var(--red); }
.create-alert--limit .create-alert__icon { color: var(--amber); }
.create-alert__icon .icon { width: 22px; height: 22px; }
.create-alert__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.create-alert__body b { font-size: 15px; }
.create-alert__body span { font-size: 13px; line-height: 1.45; color: var(--text-2, rgba(242, 240, 255, 0.8)); overflow-wrap: anywhere; }

/* ---------- Карточки выбора: стиль (крупно, живой пример) и пол ---------- */
.create-check {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 4px 12px rgba(255, 45, 120, 0.45);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity var(--t-fast), transform var(--t) var(--ease);
}
.create-check .icon { width: 15px; height: 15px; }
.is-active > .create-check,
.is-active .create-check { opacity: 1; transform: none; }

.create-styles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.create-style {
  position: relative;
  display: block;
  aspect-ratio: 3 / 2; /* низкие карточки: на первом экране и стиль, и пол, и имя */
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--r-lg);
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line-2);
  transition: transform var(--t-fast) var(--ease), border-color var(--t), box-shadow var(--t);
}
.create-style:active { transform: scale(0.98); }
.create-style.is-active { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(255, 45, 120, 0.25), 0 12px 30px rgba(255, 45, 120, 0.25); }
.create-style__media, .create-gender__media { position: absolute; inset: 0; display: block; }
.create-media { position: absolute; inset: 0; }
/* Пример в карточке стиля 3:2 — кадр по лицу, а не по центру портрета */
.create-style .create-media img,
.create-style .create-media video { object-position: center 22%; }
.create-media__ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 44px;
  background: radial-gradient(80% 60% at 50% 30%, rgba(255, 45, 120, 0.18), transparent 70%), linear-gradient(160deg, var(--card-2), var(--card));
}
.create-style::after { content: ""; position: absolute; inset: 40% 0 0; z-index: 1; background: linear-gradient(180deg, transparent, rgba(11, 10, 20, 0.85)); pointer-events: none; }
.create-style__label { position: absolute; left: 10px; right: 10px; bottom: 8px; z-index: 2; display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 800; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6); }

/* Пол — три карточки в ряд (Женщина / Мужчина / Транс): на 360 px в ряд с аватаром подпись не влезает,
   поэтому аватар сверху, подпись под ним */
.create-genders { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.create-gender {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 60px;
  padding: 9px 6px 8px;
  border-radius: var(--r);
  text-align: center;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line-2);
  transition: border-color var(--t), background var(--t), transform var(--t-fast) var(--ease);
}
.create-gender:active { transform: scale(0.98); }
.create-gender.is-active { border-color: var(--pink); background: rgba(255, 45, 120, 0.1); box-shadow: 0 0 0 3px rgba(255, 45, 120, 0.2); }
.create-gender__media { position: relative; inset: auto; flex: 0 0 auto; width: 44px; height: 44px; overflow: hidden; border-radius: 50%; }
.create-gender__media .create-media__ph { font-size: 22px; }
.create-gender__label { max-width: 100%; min-width: 0; font-size: 14px; font-weight: 700; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Галочка — на нижнем правом углу аватара (аватар по центру карточки) */
.create-gender .create-check { top: 35px; right: auto; left: calc(50% + 8px); bottom: auto; width: 22px; height: 22px; border: 2px solid var(--bg-2); }
.create-gender .create-check .icon { width: 12px; height: 12px; }

.age-row { display: flex; align-items: center; gap: 12px; }
.age-row .input { width: 84px; flex: 0 0 auto; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.age-row .range { min-height: 44px; } /* ползунок: тап-зона по высоте, а не 16px дорожки */

/* Образец цвета на чипе (волосы, глаза) */
.create-swatch { flex: 0 0 auto; width: 14px; height: 14px; margin-left: -3px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.35); box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.25); }

/* ---------- Голос: плитки с ▶ ---------- */
.create-voice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.create-voice__tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 8px 8px 10px;
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--line-2);
  transition: border-color var(--t), background var(--t);
}
.create-voice__tile.is-active { border-color: var(--pink); background: rgba(255, 45, 120, 0.1); box-shadow: 0 0 0 3px rgba(255, 45, 120, 0.18); }
.create-voice__tile .vplay { flex: 0 0 auto; width: 44px; height: 44px; }
.create-voice__pick { position: static; flex: 1; min-width: 0; min-height: 44px; display: flex; flex-direction: column; justify-content: center; gap: 1px; padding-right: 26px; text-align: left; color: var(--text); }
/* Вся плитка — зона выбора (кроме ▶): растягиваем кнопку выбора под неё */
.create-voice__pick::before { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.create-voice__tile .vplay { position: relative; z-index: 1; }
.create-voice__name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.create-voice__sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.create-voice__tile .create-check { top: 50%; right: 8px; margin-top: -13px; width: 22px; height: 22px; }
.create-voice__tile .create-check .icon { width: 13px; height: 13px; }
/* Подсказка под голосом: выбор сброшен на «по умолчанию» (смена пола, отказ сервера) */
.create__voice-note { color: var(--amber); }

/* ---------- Превью анкеты (итог и боковая панель) ---------- */
.create__summary { margin-top: 24px; }
.create__summary .section-title { margin-top: 0; }
/* «По умолчанию» — на всю строку: подпись не обрезается, голоса ниже парами */
.create-voice__tile[data-id=""] { grid-column: 1 / -1; }
.create__aside-title { margin-bottom: 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.create-preview { padding: 16px; border-radius: var(--r-lg); background: radial-gradient(120% 80% at 100% 0%, rgba(255, 45, 120, 0.14), transparent 60%), var(--card); border: 1px solid var(--line-2); }
.create-preview__top { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.create-preview__avatar { flex: 0 0 auto; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; font-size: 22px; font-weight: 900; color: #fff; background: var(--grad-diag); box-shadow: var(--glow); }
.create-preview__who { min-width: 0; }
.create-preview__name { font-size: 18px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.create-preview__name span { color: var(--muted); font-weight: 700; }
.create-preview__meta { margin-top: 2px; font-size: 13px; color: var(--muted); }
.create-preview__row { padding-top: 12px; }
.create-preview__row--inline { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.create-preview__key { margin-bottom: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-2); }
.create-preview__row--inline .create-preview__key { margin-bottom: 0; }
.create-preview__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.create-preview__chip { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--text); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); }
.create-preview__empty { font-size: 13px; color: var(--muted-2); }
.create-preview__extra { margin-top: 8px; font-size: 13px; font-style: italic; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
.create-preview__voice { font-size: 14px; font-weight: 700; }
.create-preview__price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.create-preview__price b { font-size: 18px; font-weight: 900; color: var(--gem); }
.create-preview__price.is-free b { color: var(--green); }
.create-preview__balance { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; }
.create-preview__price.is-short .create-preview__balance { color: var(--red); font-weight: 700; }

/* ---------- Нижняя панель ----------
   .dock (chrome.css, К4): липкая к низу, сплошной фон, отступ под полосу «домой»; при открытой клавиатуре — обычный
   блок в конце формы (поле в фокусе не закрыто). Здесь — только раскладка кнопок мастера */
.create__footer { margin-top: 8px; }
.create__footer-inner { display: flex; gap: 10px; }
.create__next { flex: 1; min-width: 0; }
.create__back { flex: 0 0 auto; padding: 0 18px; }

/* ---------- Ожидание аватара ---------- */
.create--wait { justify-content: center; }
.create-wait { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 440px; margin: 0 auto; padding: calc(var(--sat) + 28px) 24px calc(var(--sab) + 28px); text-align: center; }
.create-wait__portrait {
  position: relative;
  width: min(220px, 58vw);
  aspect-ratio: 3 / 4;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--r-xl);
  background:
    radial-gradient(80% 60% at 50% 25%, rgba(255, 45, 120, 0.22), transparent 70%),
    linear-gradient(160deg, var(--card-2), var(--card));
  border: 1px solid var(--line-2);
  animation: create-glow 2.6s ease-in-out infinite;
}
/* Шиммер скелетона по всей карточке */
.create-wait__portrait::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.07) 50%, transparent 70%);
  background-size: 250% 100%;
  animation: shimmer 1.8s linear infinite;
}
.create-wait__initial { position: absolute; inset: 0; display: grid; place-items: center; font-size: 96px; font-weight: 900; color: rgba(255, 255, 255, 0.16); animation: create-breathe 3s ease-in-out infinite; }
/* Сканирующая полоса света: «проявляет» портрет сверху вниз */
.create-wait__scan {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 34%;
  background: linear-gradient(180deg, transparent, rgba(255, 45, 120, 0.22) 70%, rgba(255, 255, 255, 0.55) 98%, transparent);
  animation: create-scan 2.4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
.create-wait__spark { position: absolute; font-size: 16px; color: var(--amber); animation: create-twinkle 2.2s ease-in-out infinite; }
.create-wait__spark--s1 { top: 14%; left: 16%; }
.create-wait__spark--s2 { top: 30%; right: 14%; font-size: 12px; color: var(--pink); animation-delay: 0.7s; }
.create-wait__spark--s3 { bottom: 20%; left: 26%; font-size: 13px; color: var(--focus); animation-delay: 1.3s; }
.create-wait__portrait.is-failed { animation: none; }
.create-wait__portrait.is-failed::before { display: none; }
.create-wait__portrait.is-failed .create-wait__initial { font-size: 64px; color: inherit; animation: none; }

.create-wait__title { margin-top: 22px; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; overflow-wrap: anywhere; }
.create-wait__title span { color: var(--muted); }
.create-wait__stage { min-height: 22px; margin-top: 6px; font-size: 15px; color: var(--text-2, rgba(242, 240, 255, 0.8)); }
.create-wait__progress { width: 100%; max-width: 280px; height: 6px; margin-top: 18px; overflow: hidden; border-radius: 3px; background: var(--card-3); }
.create-wait__fill { display: block; height: 100%; background: var(--grad); transform: scaleX(0); transform-origin: left center; transition: transform 1s linear; }
.create-wait__time { display: flex; justify-content: space-between; width: 100%; max-width: 280px; margin-top: 6px; font-size: 12px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.create-wait__tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 64px;
  margin-top: 22px;
  padding: 12px 14px;
  border-radius: var(--r);
  text-align: left;
  font-size: 14px;
  line-height: 1.4;
  background: var(--card);
  border: 1px solid var(--line);
}
.create-wait__tip-icon { flex: 0 0 auto; display: inline-flex; color: var(--amber); }
.create-wait__tip-icon .icon { width: 20px; height: 20px; }
.create-wait__tip-text.is-in { animation: rise-in 360ms var(--ease) both; }
.create-wait__status:empty { display: none; }
.create-wait__slow { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 16px; padding: 14px; border-radius: var(--r); background: rgba(255, 181, 71, 0.1); border: 1px solid rgba(255, 181, 71, 0.35); font-size: 14px; }
.create-wait__leave { margin-top: 18px; }
.create-wait__note { margin-top: 6px; font-size: 12px; color: var(--muted-2); }

/* ---------- Результат ---------- */
.create-result { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 440px; margin: 0 auto; padding: calc(var(--sat) + 24px) 24px calc(var(--sab) + 28px); text-align: center; }
.create-result__stage { position: relative; }
.create-result__burst {
  position: absolute;
  inset: -48px;
  z-index: -1;
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg, rgba(255, 45, 120, 0.16) 0 8deg, transparent 8deg 24deg),
    radial-gradient(circle, rgba(255, 45, 120, 0.35), transparent 65%);
  -webkit-mask-image: radial-gradient(circle, #000 35%, transparent 70%);
  mask-image: radial-gradient(circle, #000 35%, transparent 70%);
  animation: create-rays 14s linear infinite, fade-in 600ms var(--ease) both;
}
.create-result__card {
  position: relative;
  width: min(280px, 70vw);
  aspect-ratio: 3 / 4;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--r-xl);
  border: 1px solid rgba(255, 45, 120, 0.45);
  box-shadow: 0 20px 60px rgba(255, 45, 120, 0.35), var(--shadow);
  animation: create-pop 620ms var(--ease-spring, var(--ease)) both;
}
.create-result__media { position: absolute; inset: 0; }
.create-result__shade { position: absolute; inset: 50% 0 0; background: linear-gradient(180deg, transparent, rgba(11, 10, 20, 0.88)); pointer-events: none; }
.create-result__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(11, 10, 20, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.create-result__name { position: absolute; left: 14px; right: 14px; bottom: 12px; display: flex; align-items: baseline; gap: 8px; text-align: left; font-size: 22px; }
.create-result__name b { min-width: 0; font-weight: 900; overflow-wrap: anywhere; }
.create-result__name span { color: rgba(242, 240, 255, 0.75); font-weight: 700; }
.create-result__title { margin-top: 26px; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.create-result__bio { max-width: 360px; margin-top: 8px; font-size: 15px; line-height: 1.5; color: var(--text-2, rgba(242, 240, 255, 0.8)); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.create-result.is-failed .create-wait__portrait { margin-bottom: 0; }
.create-wait__actions { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 340px; margin-top: 22px; }

@keyframes create-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
@keyframes create-glow {
  0%, 100% { box-shadow: 0 0 30px rgba(255, 45, 120, 0.25); }
  50% { box-shadow: 0 0 60px rgba(180, 41, 249, 0.5); }
}
@keyframes create-breathe { 0%, 100% { transform: scale(1); opacity: 0.8; } 50% { transform: scale(1.06); opacity: 1; } }
@keyframes create-scan { from { transform: translateY(-100%); } to { transform: translateY(300%); } }
@keyframes create-twinkle { 0%, 100% { opacity: 0.15; transform: scale(0.7) rotate(0); } 50% { opacity: 1; transform: scale(1.15) rotate(20deg); } }
@keyframes create-pop { from { opacity: 0; transform: scale(0.86) translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes create-rays { to { transform: rotate(360deg); } }

/* ---------- Планшет ---------- */
@media (min-width: 600px) {
  .create-wait__portrait { width: 240px; }
  .create-result__card { width: 300px; }
}

/* ---------- Десктоп: форма + липкое превью справа ---------- */
@media (min-width: 1024px) {
  .screen[data-screen="create"] { --page-max: 1040px; }
  .create__layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
  .create__aside { display: block; position: sticky; top: calc(var(--topbar-h, 56px) + 12px); }
  .create__summary { display: none; }
  .create__footer-inner { padding-right: calc(320px + 32px); }
}
