/* Мини-приложение Пранкоинатора — оформление один в один по прототипу docs/design/miniapp.html.
   Цвета, скругления и размеры — переменные ниже: одна правка меняет всё приложение
   (docs/SPEC_MINIAPP.md, «Как строить»). Значения — как прототип показывает на экране. */

/* Шрифт SF Compact Rounded отдаёт наш сервер (/fonts/); файлов нет — swap сразу показывает
   запасной: на iPhone — скруглённый системный (ui-rounded), на остальных — обычный системный. */
@font-face {
  font-family: "SF Compact Rounded";
  src: url("/fonts/SF-Compact-Rounded-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SF Compact Rounded";
  src: url("/fonts/SF-Compact-Rounded-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SF Compact Rounded";
  src: url("/fonts/SF-Compact-Rounded-Semibold.otf") format("opentype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SF Compact Rounded";
  src: url("/fonts/SF-Compact-Rounded-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SF Compact Rounded";
  src: url("/fonts/SF-Compact-Rounded-Heavy.otf") format("opentype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Чёрное небо с мерцающими звёздами, непрозрачные плитки, белые главные кнопки. Свечение у
     рамок одно (рамка 1,5px и мягкое свечение снизу): фиолетовое — выбранная плитка «Фото /
     Оживление», пакет L, поле в фокусе; красное — ошибки. Одна колонка до 480px, нижнее меню из
     двух вкладок: «Создать» и «Профиль». */
  --bg: #000000;
  --text: #ffffff;
  --text-2: #8e8e95;
  --text-3: #5d5d64;
  --accent: #a568ee;
  --gold: #f5a524;
  --surface: #161616; /* карточки и плитки */
  --surface-solid: #161616; /* карточки документов (как --surface) */
  --surface-2: rgba(255, 255, 255, 0.09); /* плитки баланса */
  --surface-3: #1a1a1a; /* баланс, логотип в шапке, «Генерации / Оживления» */
  --surface-btn: #1c1c1c; /* тёмная кнопка */
  --icon-tile: #26262a; /* значок в плитке баланса */
  --big-icon: #1b1b1e; /* большой значок в пустом состоянии */
  --separator: rgba(255, 255, 255, 0.14);
  --tabbar: #0a0a0c; /* нижняя панель */
  --tab-icon: #6b6b72;
  --header-fade: rgba(0, 0, 0, 0.94);
  --avatar-from: #3a3a40;
  --avatar-to: #151517;
  --primary: #ffffff;
  --on-primary: #000000;
  --primary-glow: rgba(255, 255, 255, 0.35);
  --disabled: #222225;
  --on-disabled: #6b6b72;
  /* Пополнение (PR 2 «Оплата») — значения прототипа */
  --line: rgba(255, 255, 255, 0.08); /* обводка уведомления */
  --seg-selected: #2a2a2e; /* выбранный «Генерации / Оживления» */
  --tier-hl: #1a1126; /* карточка L и выбранная плитка «Фото / Оживление» — фиолетовые */
  --tier-hl-line: rgba(165, 104, 238, 0.55); /* фиолетовая рамка */
  --tier-hl-glow: rgba(165, 104, 238, 0.6); /* свечение под ней */
  --stats: rgba(255, 255, 255, 0.09); /* строка состава в карточке пакета */
  --stats-key: rgba(255, 255, 255, 0.6);
  --stats-div: rgba(255, 255, 255, 0.1);
  --chev: rgba(255, 255, 255, 0.45);
  --sheet: rgba(24, 24, 27, 0.94); /* окно снизу */
  --sheet-list: rgba(255, 255, 255, 0.07);
  --sheet-line: rgba(255, 255, 255, 0.06);
  --sheet-close: rgba(255, 255, 255, 0.08);
  --sheet-text: #a7a7ae;
  --grab: rgba(255, 255, 255, 0.2);
  --backdrop: rgba(0, 0, 0, 0.6);
  --toast: #1f1f23;
  --row-hover: rgba(255, 255, 255, 0.03);
  /* Генерация и оживление (PR 3) — значения прототипа */
  --field: #18181b; /* плитка фото, место под результат */
  --surface-input: rgba(0, 0, 0, 0.35); /* поле описания и промокода */
  --surface-add: rgba(255, 255, 255, 0.07); /* «+» к фото, выбор фото для оживления */
  --chip: rgba(255, 255, 255, 0.09); /* кнопка формата */
  --chip-text: #a3a3aa;
  /* Рамка со свечением снизу — одна на всё: фиолетовая (поле в фокусе) и красная (ошибка) */
  --hl-ring: inset 0 0 0 1.5px var(--tier-hl-line), 0 5px 16px -7px var(--tier-hl-glow);
  --focus-ring: var(--hl-ring);
  --danger: #ff6b6b; /* текст ошибки */
  --danger-line: rgba(255, 107, 107, 0.75); /* красная рамка */
  --danger-glow: rgba(255, 90, 90, 0.6); /* свечение под ней */
  --danger-ring: inset 0 0 0 1.5px var(--danger-line), 0 5px 16px -7px var(--danger-glow);
  --scrollbar: rgba(255, 255, 255, 0.16); /* полоса прокрутки (где её показывает система) */
  --scrollbar-hover: rgba(255, 255, 255, 0.28);
  --overlay: rgba(0, 0, 0, 0.6); /* кнопка «убрать фото», «Заменить» */
  --overlay-tag: rgba(0, 0, 0, 0.55); /* длительность видео */
  --play: rgba(255, 255, 255, 0.92);
  --dim: 0.45; /* поля во время генерации */

  --radius-card: 22px;
  --radius-tile: 16px;
  --radius-button: 14px;
  --radius-icon: 10px;
  --radius-pill: 19px;
  --radius-pack: 20px; /* карточка пакета и список ссылок */
  --radius-seg: 13px;
  --radius-sheet: 28px;
  --radius-media: 18px; /* результат и выбор фото */
  --radius-chip: 12px;
  --radius-mode: 24px; /* плитки «Фото / Оживление» */

  --app-width: 480px;
  --gutter: 16px;
  --tabbar-height: 58px;
  --button-height: 52px;

  --font: "SF Compact Rounded", ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  --font-logo: var(--font);

  /* Безопасные зоны: вырез и полоска «домой» на iPhone (env) и то, что сообщает Telegram
     (--tg-…, Bot API 8.0: системные зоны и свои кнопки Telegram в полноэкранном режиме). */
  --safe-top: max(
    env(safe-area-inset-top, 0px),
    calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px))
  );
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));

  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); overscroll-behavior: none; }
body { font-family: var(--font); font-size: 16px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#sky { position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.app { position: relative; z-index: 1; max-width: var(--app-width); margin: 0 auto; padding: 0 var(--gutter) calc(104px + var(--safe-bottom)); }

/* Шапка: логотип с названием по центру на тёмной «таблетке». Не липкая — уезжает при прокрутке;
   звёзды под ней чуть притушены. */
.top { position: relative; z-index: 5; display: flex; align-items: center; justify-content: center; gap: 12px; min-height: calc(var(--safe-top) + 64px); margin: 0 calc(var(--gutter) * -1); padding: calc(var(--safe-top) + 12px) var(--gutter) 14px; background: linear-gradient(to bottom, var(--header-fade) 55%, rgba(0, 0, 0, 0)); }
.logo { display: flex; align-items: center; gap: 7px; font-family: var(--font-logo); font-weight: 800; font-size: 20px; letter-spacing: -0.01em; }
.logo-av { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; display: block; flex: none; }
.top .logo { height: 32px; padding: 0 11px 0 5px; gap: 6px; font-size: 16px; border-radius: var(--radius-pill); background: var(--surface-3); }
.top .logo-av { width: 22px; height: 22px; }
/* Полноэкранный Telegram (Bot API 8.0): шапка — строка кнопок Telegram «Закрыть» и «⋯» (её высоту
   сообщает Telegram), логотип — по центру между ними. */
html.tg-fullscreen .top { min-height: 0; height: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 46px)); padding: var(--tg-safe-area-inset-top, 0px) var(--gutter) 0; }
html.tg-fullscreen .top .logo { height: 28px; padding: 0 10px 0 4px; gap: 5px; font-size: 14px; }
html.tg-fullscreen .top .logo-av { width: 20px; height: 20px; }
/* Баланс — справа в строке заголовка («Создать» / «Профиль») */
main { position: relative; }
main > .balance { position: absolute; top: 3px; right: 0; z-index: 2; }
.balance { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 4px 0 12px; border-radius: var(--radius-pill); background: var(--surface-3); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.balance .ic { width: 16px; height: 16px; color: var(--text-2); }
.balance .sep { width: 1px; height: 14px; margin: 0 2px; background: var(--separator); }
.balance .plus { width: 30px; height: 30px; margin-left: 3px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; }
.balance .plus svg { width: 16px; height: 16px; }

/* экраны */
.view { display: none; }
.view.active { display: block; animation: rise .28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view-head { padding: 6px 0 18px; }
.view-head h1 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -0.025em; text-wrap: balance; }
.view-head p { margin: 6px 0 0; font-size: 15px; color: var(--text-2); }

.card { background: var(--surface); border-radius: var(--radius-card); padding: 16px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* Большой значок: пустой выбор фото, «Не получилось» */
.big-ic { width: 52px; height: 52px; margin-bottom: 6px; border-radius: var(--radius-tile); background: var(--big-icon); color: var(--text); display: grid; place-items: center; }
.big-ic svg { width: 24px; height: 24px; }

/* профиль */
.user { display: flex; align-items: center; gap: 14px; }
.avatar { width: 52px; height: 52px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 20px; font-weight: 600; background: linear-gradient(145deg, var(--avatar-from), var(--avatar-to)); }
.user b { display: block; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.user span { font-size: 14px; color: var(--text-2); }
.bal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bal { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--radius-tile); background: var(--surface-2); }
.bal .bi { width: 32px; height: 32px; border-radius: var(--radius-icon); background: var(--icon-tile); color: var(--text); display: grid; place-items: center; }
.bal .bi svg { width: 17px; height: 17px; }
.bal .n { font-size: 30px; line-height: 1; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.bal .l { margin-top: -4px; font-size: 13px; color: var(--text-2); }

/* кнопки */
.btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: var(--button-height); padding: 0 18px; border-radius: var(--radius-button); font-size: 16px; font-weight: 600; text-decoration: none; overflow: hidden; transition: transform .12s ease, background-color .2s, color .2s; }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn svg { position: relative; width: 19px; height: 19px; flex: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 10px 30px -12px var(--primary-glow); }
.btn-primary:disabled { background: var(--disabled); color: var(--on-disabled); box-shadow: none; cursor: default; }
.btn-dark { background: var(--surface-btn); color: var(--text); }

/* нижнее меню */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding-bottom: var(--safe-bottom); background: var(--tabbar); }
.tabbar-inner { max-width: var(--app-width); margin: 0 auto; display: grid; grid-template-columns: repeat(2, 1fr); height: var(--tabbar-height); }
.tab-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--tab-icon); font-size: 11px; font-weight: 600; transition: color .2s; }
.tab-btn .ti { width: 60px; height: 38px; display: grid; place-items: center; }
.tab-btn svg { width: 25px; height: 25px; }
/* Выбранная вкладка — белая иконка, без кругов и подложек; невыбранная — серая. */
.tab-btn[aria-selected="true"] { color: var(--text); }

.btn-ghost { height: 44px; color: var(--text-2); font-weight: 500; }
.btn .label { position: relative; }
.btn .gold { color: currentColor; }
/* Кнопка ждёт ответа: просто не нажимается и выглядит как была. У «Генерируем» и «Оживляем»
   вместо значка — три подпрыгивающие точки (без полосок). Те же точки, крупнее, — загрузка
   приложения, сайта и страницы /pay. */
.btn.loading { pointer-events: none; }
.dots { display: none; position: relative; align-items: center; gap: 4px; height: 18px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: hop 1.1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
.btn.loading .dots, .dots.on { display: inline-flex; }
.btn.loading .dots + svg { display: none; }
.loader-dots { gap: 7px; height: 26px; }
.loader-dots i { width: 9px; height: 9px; }
@keyframes hop { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Пополнение (PR 2 «Оплата»): «Генерации / Оживления», «У меня нет звёзд», карточки S, M, L —
   один в один по прототипу. */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 12px; scroll-margin-top: 76px; }
.section-head h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.seg { display: inline-flex; padding: 3px; border-radius: var(--radius-seg); background: var(--surface-3); }
.seg button { height: 32px; padding: 0 12px; border-radius: var(--radius-icon); font-size: 13px; font-weight: 500; color: var(--text-2); transition: background-color .2s, color .2s; }
.seg button[aria-selected="true"] { background: var(--seg-selected); color: var(--text); font-weight: 600; }
.packs { display: flex; flex-direction: column; gap: 16px; }
.no-stars { margin-bottom: 16px; }
.tcard { display: flex; flex-direction: column; gap: 16px; padding: 24px; border-radius: var(--radius-pack); background: var(--surface); }
.tcard.hl { background: var(--tier-hl); box-shadow: var(--hl-ring); }
.t-head { display: inline-flex; align-items: center; gap: 4px; align-self: center; font-size: 20px; font-weight: 600; letter-spacing: -0.03em; line-height: 28px; }
.t-head .t-ic { width: 28px; height: 28px; display: grid; place-items: center; margin-right: 4px; }
.t-head .t-ic svg { width: 24px; height: 24px; }
.t-head .t-chev { width: 18px; height: 18px; color: var(--chev); }
.t-ic.hl { color: var(--accent); filter: drop-shadow(0 0 6px var(--tier-hl-glow)); }
.t-stats { display: flex; align-items: center; justify-content: center; gap: 0; height: 44px; padding: 12px 16px; border-radius: var(--radius-tile); background: var(--stats); font-size: 14px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.t-stat { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.t-stat .k { color: var(--stats-key); }
.t-stat svg { width: 16px; height: 16px; color: var(--text); }
.t-stat svg.ico { width: 18px; height: 18px; color: var(--stats-key); }
.t-div { width: 1px; height: 18px; flex: none; border-radius: 24px; background: var(--stats-div); }
.t-buy { display: flex; align-items: center; justify-content: center; height: 46px; padding: 0 16px; border-radius: var(--radius-tile); background: var(--primary); color: var(--on-primary); font-size: 14px; font-weight: 600; letter-spacing: -0.03em; transition: transform .12s; }
.t-buy:active { transform: scale(0.98); }
.t-buy .t-price { display: inline-flex; align-items: center; gap: 4px; }
.t-buy svg { width: 15px; height: 15px; color: var(--on-primary); }
.packs-empty { margin: 0; padding: 8px 0; text-align: center; font-size: 14px; color: var(--text-2); }

/* Ссылки профиля: поддержка и документы */
.list { margin-top: 12px; padding: 4px; border-radius: var(--radius-pack); background: var(--surface); }
.row { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 8px 10px; border-radius: var(--radius-tile); text-align: left; font-size: 15px; font-weight: 500; color: var(--text); text-decoration: none; }
.row:hover { background: var(--row-hover); }
.row .ri { flex: none; width: 34px; height: 34px; border-radius: var(--radius-icon); background: var(--surface-2); display: grid; place-items: center; }
.row .ri svg { width: 17px; height: 17px; }
.row .grow { flex: 1; min-width: 0; }
/* Серая вторая строка под названием (почта поддержки на сайте) — целиком, без обрезки */
.row .row-sub { display: block; margin-top: 2px; font-size: 13px; font-weight: 400; color: var(--text-3); overflow-wrap: anywhere; }
.row .chev { width: 17px; height: 17px; color: var(--text-3); }

/* Окно снизу: пакет, «Успешная оплата», промокод */
.backdrop { position: fixed; inset: 0; z-index: 20; background: var(--backdrop); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .25s; }
.backdrop.open { opacity: 1; pointer-events: auto; }
/* Закрытое окно — ещё и невидимо (visibility — после анимации): в браузере телефона при
   прячущейся панели адреса край окна не выглянет снизу, и закрытое окно не читается вслух. */
.sheet { position: fixed; left: 0; right: 0; bottom: var(--kb, 0px); z-index: 21; max-width: var(--app-width); margin: 0 auto; padding: 28px 20px calc(18px + var(--safe-bottom)); background: var(--sheet); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; transform: translateY(110%); visibility: hidden; transition: transform .34s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .34s; outline: none; }
.sheet.open { transform: translateY(0); visibility: visible; transition: transform .34s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
.grab { position: absolute; top: 9px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: var(--grab); }
.sheet-head { display: flex; align-items: center; gap: 10px; }
.sheet-head .t-ic { width: 30px; height: 30px; display: grid; place-items: center; }
.sheet-head .t-ic svg { width: 26px; height: 26px; }
.sheet-head > div { flex: 1; min-width: 0; }
.sheet-head h3 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.sheet-head p { margin: 2px 0 0; font-size: 13px; color: var(--text-2); }
.x { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--sheet-close); color: var(--text-2); display: grid; place-items: center; }
.x svg { width: 15px; height: 15px; }
.sheet-desc { margin: 14px 0 0; font-size: 15px; line-height: 1.45; color: var(--sheet-text); }
.sheet-list { margin: 16px 0; padding: 2px 16px; border-radius: var(--radius-tile); background: var(--sheet-list); }
.sl-row { display: flex; align-items: center; justify-content: space-between; height: 46px; font-size: 15px; color: var(--text-2); }
.sl-row + .sl-row { border-top: 1px solid var(--sheet-line); }
.sl-row b { display: inline-flex; align-items: center; gap: 4px; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.sl-row svg { width: 15px; height: 15px; color: var(--text); }
.success { padding: 10px 0 16px; text-align: center; }
.burst { position: relative; width: 120px; height: 92px; margin: 0 auto 10px; }
.burst .ok { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; box-shadow: 0 0 40px rgba(255, 255, 255, 0.25); animation: pop .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.burst .ok svg { width: 30px; height: 30px; }
/* «Успешная оплата»: розетка с галочкой, без круга */
.burst .ok.verified { background: none; box-shadow: none; color: var(--text); }
.burst .ok.verified svg { width: 64px; height: 64px; filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.25)); }
.burst .s { position: absolute; color: var(--text); animation: twinkle 2.4s ease-in-out infinite; }
.success h3 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.success p { margin: 6px 0 0; font-size: 15px; color: var(--text-2); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* Уведомление внизу: ширина — по тексту, до краёв экрана с отступом (без width: max-content оно
   сжималось до половины экрана — из-за left: 50%); \n в тексте — перенос строки. Открыта
   клавиатура — над ней (--kb, app.js). */
.toast { position: fixed; left: 50%; bottom: calc(80px + var(--safe-bottom) + var(--kb, 0px)); z-index: 30; width: max-content; max-width: calc(100% - 32px); padding: 11px 16px; border-radius: var(--radius-button); background: var(--toast); border: 1px solid var(--line); font-size: 14px; text-align: center; white-space: pre-line; text-wrap: balance; opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Загрузка (три точки), «Технические работы», «Доступ ограничен», «Нет связи» и другие экраны во
   весь экран — заголовок, текст, белая кнопка, без большого логотипа. Такой экран занимает ровно
   один экран и не листается (body.full-state — app.js). */
.state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-height: calc(100vh - 160px - var(--safe-top) - var(--safe-bottom)); padding: 8px 8px 48px; text-align: center; animation: rise .28s ease both; }
.state h1 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -0.025em; text-wrap: balance; }
.state p { max-width: 320px; margin: 8px 0 0; font-size: 15px; color: var(--text-2); text-wrap: balance; }
.state .btn { max-width: 320px; margin-top: 26px; }
body.full-state .app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; padding-bottom: var(--safe-bottom); }
body.full-state .state { flex: 1; min-height: 0; padding-bottom: 64px; }
@keyframes twinkle { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: none; } }

/* «Создать» (прототип владельца 24.11.2026): форма — в одной плитке (фото, описание, формат),
   кнопка — под ней; результат и выбор фото для оживления. */
.form-card { padding: 20px; }
.split .field { display: flex; flex-direction: column; gap: 12px; transition: opacity .2s; }
.split .field + .field { margin-top: 24px; }
.split .go { margin-top: 16px; }
.busy .field { opacity: var(--dim); pointer-events: none; }
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.field-head .muted { font-size: 13px; font-weight: 500; color: var(--text-3); }

.photos-row { display: flex; align-items: center; gap: 12px; }
.photos { display: flex; flex-wrap: wrap; gap: 10px; }
.tile { position: relative; width: 72px; height: 72px; flex: none; border-radius: var(--radius-tile); overflow: hidden; background: var(--field); }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .rm { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--overlay); color: var(--text); display: grid; place-items: center; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.tile .rm svg { width: 12px; height: 12px; }
.tile.add { display: grid; place-items: center; cursor: pointer; color: var(--text-2); background: var(--surface-add); transition: color .2s, transform .12s; }
.tile.add:hover { color: var(--text); }
.tile.add:active { transform: scale(0.96); }
.tile.add svg { width: 24px; height: 24px; }
/* Фото не подошло — красная рамка со свечением (рамка — поверх фото) */
.tile.bad { box-shadow: 0 5px 16px -7px var(--danger-glow); }
.tile.bad::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1.5px var(--danger-line); pointer-events: none; }

.prompt { display: flex; align-items: flex-start; gap: 8px; padding: 13px 14px; border-radius: var(--radius-tile); background: var(--surface-input); cursor: text; transition: box-shadow .2s; }
.prompt:focus-within { box-shadow: var(--focus-ring); }
/* Описание слишком длинное — красная рамка (и красный текст под полем) */
.prompt.bad, .prompt.bad:focus-within { box-shadow: var(--danger-ring); }
.prompt textarea { flex: 1; min-width: 0; display: block; min-height: 76px; resize: none; padding: 0; margin: 0; border: 0; background: transparent; font-size: 16px; line-height: 23px; outline: none; }
.prompt textarea.short { min-height: 46px; }
.prompt textarea::placeholder { color: var(--text-3); }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 0 20px; }
.chips::-webkit-scrollbar { display: none; }
/* Своя аккуратная полоса прокрутки — где система её показывает (компьютер) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 10px; background: var(--scrollbar) padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--scrollbar-hover); }
::-webkit-scrollbar-button { display: none; }
@supports not selector(::-webkit-scrollbar) { * { scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; } }
.chip { flex: none; height: 36px; padding: 0 15px; border-radius: var(--radius-chip); background: var(--chip); color: var(--chip-text); font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; transition: background-color .2s, color .2s; }
.chip[aria-checked="true"] { background: var(--primary); color: var(--on-primary); font-weight: 600; }

.result-media { position: relative; overflow: hidden; border-radius: var(--radius-media); background: var(--field); aspect-ratio: 4 / 5; }
.result-media img, .result-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.play { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: var(--play); color: var(--on-primary); display: grid; place-items: center; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.play svg { width: 22px; height: 22px; margin-left: 3px; }
.tag { position: absolute; right: 10px; bottom: 10px; padding: 5px 9px; border-radius: var(--radius-icon); background: var(--overlay-tag); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; pointer-events: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Оживление: выбор фото */
.drop { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; border-radius: var(--radius-media); overflow: hidden; cursor: pointer; background: var(--surface-add); }
.drop-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--text-2); font-size: 13px; }
.drop-empty strong { color: var(--text); font-size: 16px; font-weight: 600; }
.drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.drop .replace { position: absolute; right: 10px; bottom: 10px; display: none; padding: 7px 12px; border-radius: 11px; background: var(--overlay); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); font-size: 13px; font-weight: 600; }
.drop.has { aspect-ratio: 1 / 1; }
.drop.has img, .drop.has .replace { display: block; }
.drop.has .drop-empty { display: none; }
/* Фото для оживления не подошло — красная рамка со свечением у большого фото */
.drop.bad { box-shadow: 0 5px 16px -7px var(--danger-glow); }
.drop.bad::after { content: ''; position: absolute; inset: 0; z-index: 2; border-radius: inherit; box-shadow: inset 0 0 0 1.5px var(--danger-line); pointer-events: none; }

/* «Не получилось»: значок — крестик (отклонено) или «!» (сбой, не успела), заголовок и текст */
.fail-box { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 8px 8px; text-align: center; font-size: 14px; color: var(--text-2); }
.fail-box strong { color: var(--text); font-size: 17px; font-weight: 600; }

/* «Создать»: заголовок и выбор «Фото / Оживление» плитками; выбранная — фиолетовая, как пакет L */
.create-head { padding: 6px 0 0; }
.create-head h1 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -0.025em; }
.modes { display: flex; gap: 12px; margin: 16px 0 20px; }
.mode { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 84px; }
.mode-ic { width: 84px; height: 84px; border-radius: var(--radius-mode); background: var(--surface); color: var(--text-2); display: grid; place-items: center; transition: background-color .2s, box-shadow .2s, color .2s, transform .12s; }
.mode-ic svg { width: 32px; height: 32px; }
.mode-l { font-size: 14px; font-weight: 600; color: var(--text-2); transition: color .2s; }
.mode[aria-selected="true"] .mode-ic { background: var(--tier-hl); color: var(--text); box-shadow: var(--hl-ring); }
.mode[aria-selected="true"] .mode-l { color: var(--text); }
.mode:active .mode-ic { transform: scale(0.97); }
/* Заголовок результата и «Не получилось» — под плитками */
.sub-head { padding: 0 0 14px; }
.sub-head h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.sub-head p { margin: 4px 0 0; font-size: 15px; color: var(--text-2); }

/* Ошибка у поля, промокод */
.err { margin: 0; font-size: 12.5px; line-height: 1.35; letter-spacing: -0.005em; color: var(--danger); white-space: pre-line; }
.input { width: 100%; height: 52px; padding: 0 16px; border-radius: var(--radius-button); border: 0; background: var(--surface-input); font-size: 16px; letter-spacing: .04em; text-transform: uppercase; outline: none; }
.input::placeholder { text-transform: none; letter-spacing: 0; color: var(--text-3); }
.input:focus { box-shadow: var(--focus-ring); }
/* Промокод не подошёл (или поле пустое) — красная рамка */
.input.bad, .input.bad:focus { box-shadow: var(--danger-ring); }
.toast-ic { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; }

/* Открыта клавиатура на телефоне (html.kb-open — app.js): нижняя панель не поднимается вместе с
   ней — прячется до закрытия клавиатуры; снизу — место, чтобы поле можно было поднять над ней. */
html.kb-open .tabbar { display: none; }
html.kb-open .app { padding-bottom: calc(var(--kb, 0px) + 24px); }

/* Узкие экраны (до 359px, например iPhone SE первого поколения): заголовок и баланс в одной
   строке — чуть плотнее баланс. На остальных — как в прототипе. */
@media (max-width: 359px) {
  .balance { gap: 5px; padding-left: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
