/* ═══════════════════════════════════════════════════════════════════════
   Smart Studio Pixel — Premium Dark Glassmorphism Theme v2.3
   ═══════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────────────────────────────── */
:root {
  --bg-deep: #050409;
  --bg-glass: rgba(15, 12, 25, 0.65);
  --bg-card: rgba(20, 16, 35, 0.7);
  --neon-cyan: #00F5FF;
  --neon-cyan-dim: rgba(0, 245, 255, 0.15);
  --neon-cyan-glow: rgba(0, 245, 255, 0.4);
  --neon-red: #FF3366;
  --neon-red-dim: rgba(255, 51, 102, 0.2);
  --neon-purple: #A855F7;
  --neon-gold: #FFBF47;
  --neon-gold-dim: rgba(255, 191, 71, 0.15);
  --neon-gold-glow: rgba(255, 191, 71, 0.4);
  --neon-green: #22FF88;
  --text-primary: #F0F0F5;
  --text-secondary: rgba(240, 240, 245, 0.6);
  --text-muted: rgba(240, 240, 245, 0.35);
  --border-glass: rgba(255, 255, 255, 0.05);
  --border-glass-hover: rgba(255, 255, 255, 0.12);
  --glass-blur: 22px;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

/* ── 3D Параллакс-фоны ────────────────────────────────────────────────── */
.parallax-root {
  position: fixed;
  inset: 0;
  z-index: 0;
  perspective: 1000px;
  overflow: hidden;
}

.bg-layer {
  position: absolute;
  inset: -5%;
  width: 110%;
  height: 110%;
  will-change: transform;
  transform: scale(1.1);
  backface-visibility: hidden;
}

.bg-layer-deep {
  z-index: 1;
  background: radial-gradient(ellipse at 30% 20%, #0a0818 0%, #050409 50%, #020105 100%);
}

.bg-layer-particles {
  z-index: 2;
  opacity: 0.6;
  pointer-events: none;
}

/* Неоновые частицы */
.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat 8s infinite ease-in-out;
}

.p1  { width: 4px; height: 4px; background: var(--neon-cyan); top: 15%; left: 20%; animation-delay: 0s; }
.p2  { width: 3px; height: 3px; background: var(--neon-purple); top: 35%; left: 75%; animation-delay: 1s; }
.p3  { width: 5px; height: 5px; background: var(--neon-cyan); top: 60%; left: 10%; animation-delay: 2s; }
.p4  { width: 3px; height: 3px; background: var(--neon-green); top: 80%; left: 60%; animation-delay: 3s; }
.p5  { width: 4px; height: 4px; background: var(--neon-red); top: 25%; left: 50%; animation-delay: 0.5s; }
.p6  { width: 6px; height: 6px; background: var(--neon-cyan); top: 45%; left: 35%; animation-delay: 1.5s; }
.p7  { width: 3px; height: 3px; background: var(--neon-purple); top: 70%; left: 85%; animation-delay: 2.5s; }
.p8  { width: 4px; height: 4px; background: var(--neon-green); top: 10%; left: 90%; animation-delay: 4s; }
.p9  { width: 5px; height: 5px; background: var(--neon-cyan); top: 55%; left: 45%; animation-delay: 3.5s; }
.p10 { width: 3px; height: 3px; background: var(--neon-red); top: 90%; left: 25%; animation-delay: 5s; }
.p11 { width: 4px; height: 4px; background: var(--neon-purple); top: 40%; left: 65%; animation-delay: 6s; }
.p12 { width: 5px; height: 5px; background: var(--neon-cyan); top: 75%; left: 15%; animation-delay: 7s; }

@keyframes particleFloat {
  0%, 100% { opacity: 0; transform: translateY(0) scale(1); }
  50% { opacity: 0.7; transform: translateY(-30px) scale(1.5); }
}

.bg-layer-glass {
  z-index: 3;
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-glass);
}

/* ── Экраны ────────────────────────────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  display: flex;
}

/* Скроллбары системные прячем (Mini App выглядит как приложение; жесты остаются) */
.screen {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.screen::-webkit-scrollbar {
  display: none;
}

/* ── Topbar ────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(5, 4, 9, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-glass);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.header-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
  filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.45))
          drop-shadow(0 0 18px rgba(0, 242, 254, 0.2));
  flex-shrink: 0;
}

.app-title {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.4px;
  white-space: nowrap;
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 50%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 0 6px rgba(0, 242, 254, 0.35));
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.balance-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--neon-cyan-dim);
  border: 1px solid rgba(0, 245, 255, 0.2);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--neon-cyan);
  /* Балансовый бейдж кликабелен — открывает окно покупки планов (modal-no-credits). */
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.08s ease;
}

.balance-badge:hover,
.balance-badge:active {
  background: rgba(0, 245, 255, 0.18);
  border-color: rgba(0, 245, 255, 0.45);
}

.balance-badge:active {
  transform: scale(0.97);
}

/* ═══ 4.7.12: переключатель языка RU/EN ═══ */
.lang-toggle {
  margin-left: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #00f5ff;
  background: rgba(0, 245, 255, 0.08);
  border: 1px solid rgba(0, 245, 255, 0.35);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.lang-toggle:hover { background: rgba(0, 245, 255, 0.18); border-color: rgba(0, 245, 255, 0.55); }
.lang-toggle:active { transform: scale(0.95); }

.balance-icon {
  font-size: 12px;
}

.btn-back {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.2s;
}

.btn-back:active {
  background: rgba(255,255,255,0.1);
}

/* Полноразмерная кнопка «← Назад» под кнопкой генерации (замена стрелки в шапке).
   Высота — из единой шкалы: как .btn-secondary (48px), чтобы пара
   «действие + назад» смотрелась одним рядом. */
.btn-back-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: calc(100% - 32px);
  height: 48px;
  margin: 10px auto 24px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #b0b0cc;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.btn-back-bar:hover,
.btn-back-bar:active {
  background: rgba(255, 255, 255, 0.15);
}

/* ── Кнопки ──────────────────────────────────────────────────────────────
   Единая шкала высот (всё полноширинное): hero .btn-generate 72px (резерв
   под 2 строки) · действия .btn-primary/.btn-secondary/.btn-back-bar 48px ·
   тогглы движков 62px (резерв под 2 строки цен) · чипы auto. */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--neon-cyan), #00C4CC);
  color: #050409;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  /* Фикс «прыгающих» кнопок: высота не зависит от метрик fallback-шрифта
     до загрузки Inter и от переноса текста (резерв под 1 строку). */
  line-height: 1.2;
  min-height: 48px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px var(--neon-cyan-glow);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  padding: 14px 24px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  /* Фикс «прыгающих» кнопок: см. .btn-primary. */
  line-height: 1.2;
  min-height: 48px;
  border: 1px solid var(--border-glass-hover);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Trial-модалка: «Сгенерировать без ватермарки (N ⚡)» на узких экранах
   переносится на 2 строки — резервируем высоту, чтобы кнопка не прыгала. */
#btn-trial-paid {
  min-height: 66px;
}

.btn-secondary:active {
  transform: scale(0.97);
  background: rgba(255,255,255,0.08);
}

/* Glow-on-hover эффект */
.glow-on-hover {
  position: relative;
  overflow: hidden;
}

.glow-on-hover::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: conic-gradient(from 0deg, transparent 0%, var(--neon-cyan) 10%, transparent 20%);
  opacity: 0;
  z-index: -1;
  transition: opacity 0.4s;
  animation: glowSpin 3s linear infinite;
}

.glow-on-hover:active::after {
  opacity: 0.5;
}

@keyframes glowSpin {
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════════════
   ЭКРАН 1: ПЕЙВОЛЛ
   ═══════════════════════════════════════════════════════════════════════ */

.paywall-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  /* v4.8.13: нижний отступ 56px вместо 40px — колонка пейволла приподнята,
     кнопка «Запустить» стабильно выше нижнего края на разных телефонах. */
  padding: 40px 24px 56px;
  text-align: center;
}

.paywall-glow {
  position: absolute;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, var(--neon-cyan-glow) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  pointer-events: none;
}

.paywall-logo {
  position: relative;
  margin-bottom: 20px;
}

.logo-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 16px;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 0 12px rgba(0, 242, 254, 0.5))
          drop-shadow(0 0 30px rgba(0, 242, 254, 0.25));
  animation: logoPulse 3s ease-in-out infinite;
}

/* old .logo-icon kept for backwards compat but hidden */
.logo-icon {
  font-size: 64px;
  display: none;
  animation: logoPulse 3s ease-in-out infinite;
}

.logo-ring {
  position: absolute;
  inset: -20px;
  border: 2px solid var(--neon-cyan-dim);
  border-radius: 50%;
  animation: ringPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.15); opacity: 0.6; }
}

.paywall-title {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 50%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.35));
}

.paywall-sub {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.paywall-features {
  width: 100%;
  max-width: 360px;
  margin-bottom: 32px;
}

.paywall-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.feature-icon {
  font-size: 20px;
}

/* Пакеты цен */
.paywall-deficit-banner {
  display: block;
  width: 100%;
  margin: 10px 0 4px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 176, 32, 0.45);
  background: linear-gradient(145deg, rgba(255, 176, 32, 0.16), rgba(255, 92, 92, 0.10));
  color: var(--text-primary, #fff);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
}
.paywall-deficit-banner.hidden {
  display: none;
}

.paywall-price-block {
  width: 100%;
  max-width: 360px;
  margin-bottom: 24px;
}

.paywall-price-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.paywall-packages {
  /* 4 карточки ВСЕГДА в один горизонтальный ряд на любом экране (320px..480px+).
     nowrap — никогда не переносим вертикально; карточки сжимаются через min-width:0
     и уменьшают шрифт/отступы в медиа-запросах ниже. */
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin-top: 10px;
}

.paywall-pkg {
  flex: 1 1 0;
  min-width: 0;            /* разрешаем сжиматься ниже контента, чтобы 4 влезли */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  /* padding-top увеличен под плашки скидок/«Хит» — они теперь ВНУТРИ карточки
     (раньше были на top:-10px и обрезались из-за overflow:hidden). */
  padding: 24px 6px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.paywall-pkg.selected {
  border-color: var(--neon-cyan);
  background: var(--neon-cyan-dim);
  box-shadow: 0 0 20px var(--neon-cyan-dim);
}

.paywall-pkg.popular {
  border-color: rgba(255, 100, 50, 0.3);
}

.pkg-badge {
  position: absolute;
  top: 4px;                 /* ВНУТРИ карточки — раньше top:-10px обрезался overflow:hidden */
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 800;
  color: #050409;
  background: linear-gradient(135deg, #FF8008, #FFC837);
  padding: 2px 7px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 6px rgba(255, 100, 50, 0.4);
  white-space: nowrap;
  line-height: 1.2;
  z-index: 2;
}

/* Плашка «популярный» — оранжевая (бывший .pkg-badge). */
.pkg-badge-popular { /* наследует base .pkg-badge */ }

/* Плашка скидки «🔥 -N%» — розово-красная, чтобы отличаться от популяр.
   Стоит в ПРАВОМ верхнем углу ВНУТРИ карточки (раньше top:-10px/right:-6px
   вылезала за границу и обрезалась). */
.pkg-badge-discount {
  top: 4px;
  right: 4px;
  left: auto;
  transform: none;
  background: linear-gradient(135deg, #FF3D6E, #FF8A3D);
  box-shadow: 0 2px 6px rgba(255, 61, 110, 0.45);
}

/* Когда у popular-карточки есть и плашка скидки — «Хит» уходит в ЛЕВЫЙ верхний
   угол, скидка в ПРАВЫЙ — две плашки больше не перекрываются. */
.paywall-pkg.popular .pkg-badge-popular {
  left: 4px;
  transform: none;
}

.pkg-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Зачёркнутая базовая цена (без скидки). */
.pkg-base-stars {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: rgba(255, 80, 80, 0.7);
  text-decoration-thickness: 1.5px;
  margin-top: 2px;
}

.pkg-credits {
  font-size: 28px;
  font-weight: 800;
  color: var(--neon-cyan);
  line-height: 1.1;
  white-space: nowrap;
}

.pkg-credit-icon {
  margin-left: 2px;
  font-size: 0.52em;
  vertical-align: 0.18em;
}

.pkg-separator {
  font-size: 10px;
  color: var(--text-secondary);
}

.pkg-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-paywall {
  margin-bottom: 12px;
}

.btn-gyroscope {
  margin-bottom: 12px;
  font-size: 13px;
}

.paywall-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* Кнопка «🚀 Запустить ИИ-Студию» на пейволле — ПРЕМИАЛЬНАЯ АКЦЕНТНАЯ.
   Яркий градиент Cyan→Purple/Blue + неоновое свечение. Стоит под «Купить пакет»,
   открывает Экран 2 только по явному тапу.
   Owner decision 2026-10-08 (v4.8.13): фиксированная min-height — кнопка не
   «гуляет» по высоте на разных телефонах (разные стартовые метрики системного
   шрифта Telegram WebView), сама поднята чуть выше нижнего края. */
.btn-paywall-launch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 360px;
  margin: 0 auto 18px;
  min-height: 48px;      /* единая шкала действий: как .btn-secondary */
  padding: 12px 24px;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: #ffffff;
  background: linear-gradient(135deg, #00F5FF 0%, #5B8CFF 50%, #A855F7 100%);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow:
    0 4px 20px rgba(0, 245, 255, 0.45),
    0 4px 30px rgba(168, 85, 247, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.btn-paywall-launch:active {
  transform: scale(0.97);
  box-shadow:
    0 2px 12px rgba(0, 245, 255, 0.6),
    0 2px 18px rgba(168, 85, 247, 0.5);
}

/* ═══════════════════════════════════════════════════════════════════════
   ШТОРКА ПОПОЛНЕНИЯ БАЛАНСА (ТЗ FIX баги #2 / #3)
   ═══════════════════════════════════════════════════════════════════════ */
#modal-topup {
  padding: 8px 12px;
}

.modal-card.topup-card {
  max-width: 420px;
  width: calc(100vw - 24px);
  max-height: min(92dvh, 760px);
  overflow-y: auto;
  padding: 0;
  position: relative;
  border-radius: 24px;
  text-align: left;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 245, 255, 0.42) transparent;
}

.topup-card::-webkit-scrollbar {
  width: 4px;
}

.topup-card::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: rgba(0, 245, 255, 0.42);
}

.topup-header {
  padding: 22px 52px 13px 20px;
  background:
    radial-gradient(circle at 12% 15%, rgba(0, 245, 255, 0.14), transparent 42%),
    radial-gradient(circle at 85% 15%, rgba(217, 70, 239, 0.14), transparent 44%);
}

.topup-eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--neon-cyan);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.11em;
}

.topup-title {
  margin: 0 0 5px;
  color: var(--text-primary);
  font-size: 21px;
  line-height: 1.15;
}

.topup-sub {
  max-width: 300px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
}

.topup-rate {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin: 0 14px 14px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 215, 0, 0.24);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 215, 0, 0.09), rgba(168, 85, 247, 0.08)),
    rgba(255, 255, 255, 0.02);
}

.topup-rate-equation {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(5, 4, 9, 0.56);
  white-space: nowrap;
  font-size: 13px;
  font-weight: 850;
}

.topup-rate-stars {
  color: #ffe66d;
}

.topup-rate-arrow {
  color: var(--text-muted);
}

.topup-rate-actions {
  color: var(--neon-cyan);
}

.topup-rate-copy {
  min-width: 0;
}

.topup-rate-copy strong,
.topup-rate-copy span {
  display: block;
}

.topup-rate-copy strong {
  margin-bottom: 2px;
  color: var(--text-primary);
  font-size: 11px;
}

.topup-rate-copy span {
  color: var(--text-secondary);
  font-size: 9px;
  line-height: 1.35;
}

#btn-topup-close-x {
  position: absolute;
  top: 14px;
  right: 14px;
  left: auto;
  z-index: 3;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.topup-packages {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
  padding: 0 14px;
}

.topup-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 16px 9px;
}

.topup-section-head strong {
  color: var(--text-primary);
  font-size: 12px;
}

.topup-section-head span {
  color: #ffe66d;
  font-size: 9px;
  font-weight: 750;
  white-space: nowrap;
}

.topup-secure {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 12px 16px 0;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.35;
}

.topup-secure-icon {
  display: grid;
  flex: 0 0 16px;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(0, 245, 255, 0.35);
  border-radius: 50%;
  color: var(--neon-cyan);
  font-size: 9px;
  font-weight: 900;
}

.topup-loading {
  padding: 28px 12px;
  color: var(--text-secondary);
  text-align: center;
  font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════
   INFO-MODAL (ТЗ ЧАСТЬ 4) — универсальное окно-инструкция по режиму
   ═══════════════════════════════════════════════════════════════════════ */

/* Кругляшок (i) рядом с заголовком режима в шапке каждого экрана.
   Крупный (30px) и контрастный — чётко тапается на мобильных. */
.info-btn {
  position: relative;
  width: 48px;
  height: 48px;
  margin: -5px 0 -5px 5px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
  filter:
    drop-shadow(0 0 7px rgba(255, 32, 54, 0.72))
    drop-shadow(0 0 11px rgba(0, 245, 255, 0.42));
  transition: transform 0.15s ease, filter 0.2s ease;
}

.info-btn img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.info-btn::after {
  content: '';
  position: absolute;
  inset: 3px;
  z-index: -1;
  border: 1px solid rgba(0, 245, 255, 0.72);
  border-radius: 50%;
  opacity: 0;
  animation: info-attention-pulse 2.2s ease-out infinite;
}

.info-btn:hover {
  transform: translateY(-1px) scale(1.08);
  filter:
    drop-shadow(0 0 9px rgba(255, 32, 54, 0.9))
    drop-shadow(0 0 15px rgba(0, 245, 255, 0.62));
}

.info-btn:active {
  transform: scale(0.9);
  filter:
    drop-shadow(0 0 5px rgba(255, 32, 54, 0.8))
    drop-shadow(0 0 8px rgba(0, 245, 255, 0.5));
}

@keyframes info-attention-pulse {
  0%, 34% {
    opacity: 0;
    transform: scale(0.86);
  }
  52% {
    opacity: 0.8;
  }
  76%, 100% {
    opacity: 0;
    transform: scale(1.3);
  }
}

@media (max-width: 360px) {
  .info-btn {
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .info-btn::after {
    animation: none;
  }
}

#info-modal {
  padding: 8px 12px;
}

.modal-card.info-card {
  max-width: 420px;
  width: calc(100vw - 24px);
  max-height: min(90dvh, 760px);
  overflow-y: auto;
  padding: 0;
  position: relative;
  text-align: left;
  border-radius: 24px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 245, 255, 0.45) transparent;
}

.info-card::-webkit-scrollbar {
  width: 4px;
}

.info-card::-webkit-scrollbar-thumb {
  background: rgba(0, 245, 255, 0.45);
  border-radius: 99px;
}

.info-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 180px;
  overflow: hidden;
  border-radius: 23px 23px 0 0;
  background: #090715;
}

.info-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 4, 9, 0.04) 38%, rgba(5, 4, 9, 0.88) 100%);
  pointer-events: none;
}

.info-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.info-kicker {
  position: absolute;
  left: 18px;
  bottom: 14px;
  z-index: 1;
  padding: 6px 10px;
  border: 1px solid rgba(0, 245, 255, 0.42);
  border-radius: 999px;
  background: rgba(5, 4, 9, 0.72);
  color: #bcfbff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: 0 0 16px rgba(0, 245, 255, 0.18);
  backdrop-filter: blur(10px);
}

.info-close-x {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  background: rgba(5, 4, 9, 0.72);
  border-color: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(10px);
}

.info-copy {
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
}

.info-title {
  margin: 0 0 8px;
  font-size: 21px;
  text-align: left;
}

.info-summary {
  margin: 0 0 13px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.48;
}

.info-use-cases {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.info-use-cases span {
  padding: 6px 9px;
  border-radius: 9px;
  border: 1px solid rgba(168, 85, 247, 0.27);
  background: rgba(168, 85, 247, 0.1);
  color: #e7dcff;
  font-size: 10px;
  font-weight: 650;
}

.info-steps {
  counter-reset: info-step;
  list-style: none;
  text-align: left;
  margin: 0 0 14px;
  padding: 0;
}

.info-steps li {
  counter-increment: info-step;
  position: relative;
  min-height: 36px;
  margin-bottom: 11px;
  padding-left: 44px;
}

.info-steps li::before {
  content: counter(info-step);
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 10px;
  border: 1px solid rgba(0, 245, 255, 0.36);
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.17), rgba(168, 85, 247, 0.16));
  color: var(--neon-cyan);
  font-size: 12px;
  font-weight: 800;
  box-shadow: inset 0 0 12px rgba(0, 245, 255, 0.08);
}

.info-steps strong,
.info-steps span {
  display: block;
}

.info-steps strong {
  margin-bottom: 2px;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.25;
}

.info-steps span {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
}

.info-price {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 2px 0 14px;
  padding: 11px 12px;
  border-radius: 13px;
  border: 1px solid rgba(255, 215, 0, 0.25);
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.09), rgba(168, 85, 247, 0.08));
}

.info-price-value {
  color: #ffe66d;
  font-size: 12px;
  font-weight: 800;
}

.info-price-note {
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.35;
}

#btn-info-close {
  width: 100%;
}

.info-cta {
  min-height: 46px;
}

@media (max-height: 700px) {
  .modal-card.info-card {
    max-height: calc(100dvh - 16px);
  }
  .info-hero {
    aspect-ratio: 2 / 1;
    min-height: 158px;
  }
}
/* ═══════════════════════════════════════════════════════════════════════
   ЭКРАН 2: ГЛАВНОЕ МЕНЮ
   ═══════════════════════════════════════════════════════════════════════ */

.menu-wrap {
  flex: 1;
  padding: 8px 16px 16px;
}

.menu-heading {
  font-size: 21px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2px;
}

.menu-subheading {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 14px;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 420px;
  margin: 0 auto;
}

/* Карточка режима — плотная, тёмно-синяя, со скруглением 20px.
   Мягкое свечение «за иконкой» реализовано прямо в фоне карточки
   (radial 50% 30%, alpha 0.08 → fade к rgba(22,22,34,0.85) 70%).
   Никаких CSS-теней/drop-shadow на img — именно они давали «дешёвый»
   квадратный ореол вокруг 384×384 PNG. mix-blend-mode: screen на img —
   костыль против чёрного фона иконок (PNG без alpha-канала). */
.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 12px;
  background: radial-gradient(circle at 50% 30%,
              rgba(0, 229, 255, 0.08) 0%,
              rgba(22, 22, 34, 0.85) 70%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  cursor: pointer;
/* NEW-бейдж новых фич внутри режима (v4.8.28, owner decision) */
.mode-badge-new {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  color: #fff;
  background: #4c8cff;
  border-radius: 999px;
  padding: 2px 8px;
}
  transition: all 0.25s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.mode-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: radial-gradient(ellipse at 50% 0%, rgba(0, 245, 255, 0.06), transparent 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mode-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  /* Сохраняем мягкое радиальное свечение в фоне (чуть интенсивнее при hover) */
  background: radial-gradient(circle at 50% 30%,
              rgba(0, 229, 255, 0.14) 0%,
              rgba(28, 28, 44, 0.85) 70%);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 245, 255, 0.1);
}

.mode-card:hover::after {
  opacity: 1;
}

.mode-card:active {
  transform: scale(0.96);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 24px var(--neon-cyan-dim), inset 0 0 12px rgba(0, 245, 255, 0.05);
  transition: all 0.1s ease;
}

/* Контейнер 3D-иконки. Контейнер почти равен иконке (95×95 при иконке 85×85):
   запас ≈10% на floating-анимацию (translateY ±6px) и hover scale(1.08).
   Раньше was 126×126 → большой пустой зазор между иконкой и текстом/краем
   карточки. БЕЗ фона/рамок/радиального свечения. Мягкое свечение «за
   иконкой» живёт в .mode-card (radial). */
.mode-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 95px;
  height: 95px;
  margin-bottom: 0;
  position: relative;
  /* без border-radius / background / box-shadow */
}

/* Сама иконка: рендерится ЧИСТО, без CSS-теней (drop-shadow создавал
   «квадратную рамку» вокруг 384×384 PNG). mix-blend-mode: screen —
   костыль для удаления чёрного фона; оставлен и для GIF/APNG/WebP с
   прозрачным фоном (он безвреден).
   Размер +15%×2: 64 → 74 → 85px.

   Чтобы переключиться на «честное» вращение GIF-файла — уберите класс
   .icon-3d-spin с <img> в index.html: CSS-вращение отпадёт, останется
   только собственная анимация GIF. */
.menu-3d-icon {
  width: 85px;
  height: 85px;
  object-fit: contain;
  mix-blend-mode: screen;
  border-radius: 50%;
  clip-path: circle(48% at 50% 50%);
  -webkit-mask-image: radial-gradient(circle, #000 58%, rgba(0, 0, 0, 0.92) 68%, transparent 74%);
  mask-image: radial-gradient(circle, #000 58%, rgba(0, 0, 0, 0.92) 68%, transparent 74%);
  /* без filter: drop-shadow */
  will-change: transform;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 1;
}

.menu-3d-icon.roulette-icon {
  mix-blend-mode: normal;
  border-radius: 0;
  clip-path: none;
  -webkit-mask-image: none;
  mask-image: none;
}

/* CSS-вращение существующих PNG: эффект «3D-облёт» по оси Y + лёгкое
   парение вверх-вниз. Применяется ТОЛЬКО когда у <img> есть класс
   .icon-3d-spin (см. HTML). Чтобы видеть вращение GIF вместо этого —
   снимите класс в HTML; CSS-вращение перестанет работать.
   Длительность 8s — медленное, без рывков, как в эталоне Image 2. */
.menu-3d-icon.icon-3d-spin {
  animation: icon3dSpin 8s linear infinite,
             floating 4s ease-in-out infinite;
}

.mode-card:hover .menu-3d-icon {
  /* hover-scale делаем через отдельный transform — он сработает только
     если CSS-вращение не активно (.icon-3d-spin нет): иначе aнимация
     держит transform и scale проигнорируется (known CSS conflict). */
  transform: scale(1.08);
}
.mode-card:hover .menu-3d-icon.icon-3d-spin {
  /* При активном CSS-вращении hover просто слегка ускоряет оборот —
     эффект «иконка оживает под пальцем». */
  animation-duration: 4s, 2s;
}

@keyframes icon3dSpin {
  0%   { transform: rotateY(0deg)   translateY(0); }
  25%  { transform: rotateY(90deg)  translateY(-4px); }
  50%  { transform: rotateY(180deg) translateY(0); }
  75%  { transform: rotateY(270deg) translateY(-4px); }
  100% { transform: rotateY(360deg) translateY(0); }
}

@keyframes floating {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0px); }
}

.mode-icon svg {
  width: 36px;
  height: 36px;
  stroke: var(--neon-cyan);
  /* без drop-shadow (по доп. ТЗ: убрать CSS-свечение с иконок) */
  transition: transform 0.3s ease;
}

.mode-card:active .mode-icon svg {
  transform: scale(1.15) rotate(5deg);
}

/* Заголовок карточки с эмодзи — крупнее, белым. */
.mode-name {
  font-size: 16px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.2px;
  line-height: 1.25;
  /* Ограничиваем 2 строки, чтобы длинное название с эмодзи не разрывало сетку */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mode-desc {
  font-size: 12px;
  font-weight: 400;
  color: #8E8E93;
  line-height: 1.3;
  max-width: 150px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mode-cost {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--neon-cyan);
  letter-spacing: 0.2px;
}

.cost-value {
  font-weight: 800;
  font-size: 15px;
}

/* ═══════════════════════════════════════════════════════════════════════
   ЭКРАН 3: ИИ-ХОЛСТ
   ═══════════════════════════════════════════════════════════════════════ */

#screen-canvas {
  background: rgba(5, 4, 9, 0.95);
}

/* Зона загрузки */
.upload-zone {
  position: relative;
  margin: 12px 16px;
  min-height: 180px;
  border: 2px dashed var(--border-glass-hover);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  overflow: hidden;
}

.upload-zone.drag-over {
  border-color: var(--neon-cyan);
  background: var(--neon-cyan-dim);
}

.upload-placeholder {
  text-align: center;
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.upload-title {
  font-size: 16px;
  font-weight: 600;
}

.upload-sub {
  font-size: 13px;
  color: var(--text-secondary);
}

.preview-img {
  width: 100%;
  height: 180px;
  object-fit: contain;
}

/* Единственное крупное превью загруженного фото для Умного редактора.
   После загрузки upload-zone скрывается, а клик по превью позволяет заменить фото. */
.photo-preview-wrap {
  position: relative;
  margin: 12px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  background: #0a0818;
  cursor: pointer;
}
.photo-preview-large {
  display: block;
  width: 100%;
  max-height: 45vh;
  object-fit: contain;
  border-radius: inherit;
}
.photo-preview-change {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(5, 4, 9, 0.78);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

.hidden {
  display: none !important;
}

/* ═══ STYLE_BALLOON: компактные строки выбора ═══
   owner decision 2026-10-08 (v4.8.11, «вариант D»):
   2026-10-07 лейбл стоял фиксированной колонкой слева (84px) — на чипы
   оставалось ~238px, «⚫ Чёрный студийный» (~175px) не влезал в пару и
   «Формат» разваливался на 3 строки, а слева напротив чипов 2–3 пустовал
   жёлоб. Теперь лейбл — тонкой каптион-строкой сверху (flex-basis 100%,
   DOM-порядок «лейбл → чипы» не менялся), чипы идут во всю ширину блока
   и компактнее. Замерено на проде: сумма высот групп 1030 → 703 px (−32%),
   «Формат» 3 → 1 строка, сирота «🌃 Ночной город» в «Стиле» убрана. */
.lb-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  column-gap: 8px;
  margin-bottom: 7px;
}
.lb-row-label {
  flex: 1 0 100%;
  margin-bottom: 5px;
  font-size: 10px;
  line-height: 1.2;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
}
.lb-row-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 0 100%;
  min-width: 0;
}
/* Компактный размер чипов — ТОЛЬКО balloon/neon-студия.
   Общий .macro-chip (макросы редактора в .macro-chips) не трогаем. */
#balloon-preset-block .macro-chip {
  padding: 6px 10px;
  font-size: 12px;
}

/* Промпт */
.prompt-wrap {
  padding: 0 16px;
  margin-bottom: 8px;
}

.prompt-textarea {
  width: 100%;
  min-height: 60px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  resize: none;
  overflow-y: auto;
  outline: none;
  transition: border-color 0.3s;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.prompt-textarea:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 15px var(--neon-cyan-dim);
}

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

/* Подсказка над кнопкой «✨ Авто-промпт» */
.prompt-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  margin: 6px 0;
}

.colorize-mode-note {
  padding: 13px 14px;
  border: 1px solid rgba(0, 245, 255, 0.3);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.1), rgba(168, 85, 247, 0.08));
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Кнопка генерации */
.btn-generate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 32px);
  margin: 8px auto 24px;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--neon-cyan), #00C4CC);
  color: #050409;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  /* Фикс «прыгающих» кнопок: самая длинная надпись («Сгенерировать
     бесплатно») на узких экранах переносится на 2 строки — резервируем
     высоту под 2 строки, чтобы кнопка никогда не меняла размер. */
  line-height: 1.2;
  min-height: 72px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px var(--neon-cyan-glow);
}

.btn-generate:active {
  transform: scale(0.97);
}

.btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-cost {
  font-weight: 400;
  font-size: 14px;
  opacity: 0.8;
}

/* ═══════════════════════════════════════════════════════════════════════
   ЭКРАН 4: ОЖИДАНИЕ (ЛАЗЕРНЫЙ ЛОАДЕР)
   ═══════════════════════════════════════════════════════════════════════ */

#screen-loading {
  display: none;
  align-items: center;
  justify-content: center;
}

#screen-loading.active {
  display: flex;
}

.loading-wrap {
  text-align: center;
  padding: 40px 24px;
}

.laser-loader {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 32px;
  border-radius: 50%;
  border: 2px solid var(--border-glass);
  overflow: hidden;
}

.loading-artist {
  position: absolute;
  inset: 14px;
  width: calc(100% - 28px);
  height: calc(100% - 28px);
  object-fit: contain;
  border-radius: 50%;
  animation: loadingArtistPulse 2.4s ease-in-out infinite;
}

@keyframes loadingArtistPulse {
  0%, 100% { transform: scale(0.96); opacity: 0.82; }
  50% { transform: scale(1.02); opacity: 1; }
}

.laser-beam {
  position: absolute;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--neon-cyan);
  box-shadow:
    0 0 15px var(--neon-cyan),
    0 0 40px var(--neon-cyan-glow),
    0 0 80px var(--neon-cyan-dim);
  animation: laserVertical 2s ease-in-out infinite;
}

.laser-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 60px;
  height: 60px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--neon-cyan-glow), transparent);
  border-radius: 50%;
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes laserVertical {
  0% { top: -5%; }
  50% { top: 100%; }
  100% { top: -5%; }
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.5); }
}

.loading-text {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.loading-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 40px;
}

/* Ротатор рекламы */
.ad-rotator {
  position: relative;
  height: 60px;
}

.ad-card {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.ad-card.active {
  opacity: 1;
  pointer-events: auto;
}

.ad-icon {
  font-size: 24px;
}

.ad-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════
   ЭКРАН 5: РЕЗУЛЬТАТ (ШТОРКА)
   ═══════════════════════════════════════════════════════════════════════ */

.result-intro {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 16px 0;
  padding: 10px 12px;
  border: 1px solid rgba(0, 245, 255, 0.18);
  border-radius: 14px;
  background:
    radial-gradient(circle at 0 50%, rgba(0, 245, 255, 0.12), transparent 36%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.72), rgba(31, 20, 48, 0.62));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035);
}

.result-intro-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 1px solid rgba(0, 245, 255, 0.3);
  border-radius: 50%;
  color: var(--neon-cyan);
  background: rgba(0, 245, 255, 0.08);
  box-shadow: 0 0 15px rgba(0, 245, 255, 0.12);
}

.result-intro-copy {
  min-width: 0;
}

.result-intro-copy strong,
.result-intro-copy span {
  display: block;
}

.result-intro-copy strong {
  margin-bottom: 2px;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.3;
}

.result-intro-copy span {
  color: var(--text-secondary);
  font-size: 9px;
  line-height: 1.35;
}

.compare-container {
  position: relative;
  margin: 16px;
  /* Telegram WebView на части Android-устройств занижает dvh внутри clamp,
     поэтому отдельный min-height обязателен: окно не превращается в полоску. */
  height: 480px;
  height: 68dvh;
  min-height: 480px;
  max-height: 680px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-glass);
  background: radial-gradient(circle at 50% 20%, rgba(0, 245, 255, 0.08), rgba(5, 4, 9, 0.96));
  /* Вертикальный жест прокручивает экран результата, горизонтальный остаётся
     интерактивному ползунку «до/после». Раньше `none` блокировал страницу. */
  touch-action: pan-y pinch-zoom;
  user-select: none;
}

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

.compare-before {
  position: relative;
  z-index: 1;
}

.compare-after-wrap {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  width: 50%;
}

.compare-after {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  min-width: 100%;
  height: 100%;
  object-fit: cover;
}

.compare-container.single-result {
  min-height: 480px;
}

.compare-container.single-result .compare-after {
  object-fit: contain;
}

.compare-divider {
  position: absolute;
  top: 0;
  left: 50%;
  width: 3px;
  height: 100%;
  background: var(--neon-cyan);
  z-index: 3;
  cursor: ew-resize;
  box-shadow: 0 0 10px var(--neon-cyan), 0 0 30px var(--neon-cyan-glow);
}

.compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  background: var(--neon-cyan);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--neon-cyan-glow);
}

.compare-arrows {
  font-size: 14px;
  font-weight: 800;
  color: #050409;
}

.compare-label {
  position: absolute;
  bottom: 12px;
  z-index: 4;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 4px 10px;
  background: rgba(0,0,0,0.6);
  border-radius: 6px;
  color: var(--text-primary);
}

.compare-label-left {
  left: 12px;
}

.compare-label-right {
  right: 12px;
}

.result-actions {
  display: flex;
  flex-direction: column;   /* гаджет 4 кнопок раньше шли flex-row и на телефоне схлопывались в одну нечитаемую строку */
  gap: 12px;
  padding: 16px;
}

/* Сброс конфликтующих базовых правил кнопок внутри .result-actions:
   базово .btn-primary/.btn-secondary имеют width:100%; max-width:360px; margin:0 auto,
   а .btn-back-bar — width: calc(100% - 32px); margin: 10px auto 24px.
   Встречаясь с flex:1 в одном ряду они ломали верстку. В столбце же нужен просто
   width:100% без max-width и без margin:0 auto, чтобы кнопки занимали всю ширину контейнера. */
.result-actions .btn-secondary,
.result-actions .btn-primary,
.result-actions .btn-back-bar {
  flex: none;                /* в столбце не растягиваем — width:100% уже задаёт нужную ширину */
  width: 100%;
  max-width: none;
  margin: 0;
}

/* Новая точная подпись длиннее прежней. На узких экранах она переносится
   внутри кнопки целиком, не выезжая за края и не сжимая иконку. */
#btn-finish {
  min-height: 54px;
  padding: 12px 16px;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
}

#btn-finish .qa-icon {
  flex: 0 0 auto;
}

/* ═══════════════════════════════════════════════════════════════════════
   МОДАЛКА
   ═══════════════════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 24px;
}

.modal-card {
  width: 100%;
  max-width: 320px;
  padding: 32px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  text-align: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.modal-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.modal-card .btn-primary {
  margin-bottom: 12px;
}

/* ═══════════════════════ МОДАЛКА ВЫБОРА АВТО-ПРОМПТА (#promptModal) ═══════════════════════ */
/* Тема Smart Studio Pixel: тёмно-фиолетовый фон, неоновые акценты cyan→purple. */
.prompt-modal-card {
  max-width: 360px;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalIn 0.25s ease;
  position: relative;
}

/* Плавное появление карточки */
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* Плавное скрытие (класс вешается из JS перед add('hidden')) */
.prompt-modal-card.closing {
  animation: modalOut 0.2s ease forwards;
}
@keyframes modalOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.95); }
}

/* Лоадер внутри модалки */
.promptModal-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 8px;
  font-size: 14px;
  color: var(--text-secondary);
}
.promptModal-loader.hidden { display: none; }
.promptModal-spinner {
  display: inline-block;
  font-size: 20px;
  animation: spin 1.1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Контейнер карточек вариантов */
.prompt-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.prompt-options:empty { display: none; }

/* Карточка одного варианта промпта */
.prompt-option-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}
.prompt-option-card:hover,
.prompt-option-card:active {
  border-color: var(--neon-cyan);
  background: rgba(0, 245, 255, 0.06);
  box-shadow: 0 0 18px var(--neon-cyan-dim), 0 0 28px rgba(168, 85, 247, 0.18);
  transform: translateY(-1px);
}
/* Подпись «Вариант N» */
.prompt-option-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--neon-cyan);
  margin-bottom: 4px;
}
/* Текст самого промпта (русская версия для отображения) */
.prompt-option-text {
  display: block;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-primary);
  word-break: break-word;
}

/* ═══════════════════════════════════════════════════════════════════════
   АДАПТИВНОСТЬ ПОД ВСЕ МОДЕЛИ УСТРОЙСТВ (iOS / Android)
   ═══════════════════════════════════════════════════════════════════════ */

/* 1. Маленькие экраны по ширине (iPhone SE, старые/компактные Android) */
@media (max-width: 380px) {
  /* Тариф-карточки остаются в ОДИН ряд (4 в строку), только сжимаются:
     меньше отступы/шрифт/бейджи, чтобы ничего не съезжало вертикально. */
  .paywall-packages {
    gap: 6px;
  }
  .paywall-pkg {
    padding: 12px 4px;
    gap: 3px;
  }
  .pkg-credits {
    font-size: 22px;
  }
  .pkg-name {
    font-size: 9px;
    letter-spacing: 0.3px;
  }
  .pkg-label {
    font-size: 9px;
  }
  .pkg-price,
  .pkg-base-stars {
    font-size: 11px;
  }
  .pkg-badge {
    font-size: 8px;
    padding: 1px 6px;
  }
  .mode-grid {
    grid-template-columns: 1fr 1fr; /* Сохраняем компактную сетку 2x2/2x3 */
    gap: 8px;
  }
  .mode-card {
    padding: 14px 8px;
    border-radius: 14px;
  }
  .mode-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 0;
  }
  .menu-3d-icon {
    width: 53px;
    height: 53px;
  }
  .mode-name {
    font-size: 12px;
  }
  .mode-desc {
    font-size: 10px;
    line-height: 1.25;
  }
  .header-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
  }
  .app-title {
    font-size: 14px;
    letter-spacing: -0.3px;
  }
}

/* 2. Сверхмалые устройства (ширина до 325px) */
@media (max-width: 325px) {
  .paywall-title {
    font-size: 26px;
  }
  .paywall-sub {
    margin-bottom: 20px;
  }
  .paywall-features {
    margin-bottom: 20px;
  }
  .paywall-feature {
    padding: 8px 12px;
    font-size: 12px;
  }
  .paywall-pkg {
    padding: 12px 6px;
  }
  .pkg-credits {
    font-size: 22px;
  }
  .pkg-name {
    font-size: 8px;
    letter-spacing: 0.2px;
  }
  .pkg-label {
    font-size: 8px;
  }
  .pkg-price,
  .pkg-base-stars {
    font-size: 10px;
  }
  .pkg-badge {
    font-size: 7px;
    padding: 1px 5px;
    top: 3px;            /* ВНУТРИ карточки — на сверхмалых экранах тоже не обрезаем */
  }
  .mode-grid {
    gap: 6px;
  }
  .mode-card {
    padding: 8px 4px;
  }
  .mode-icon {
    width: 60px;
    height: 60px;
  }
  .menu-3d-icon {
    width: 53px;
    height: 53px;
  }
  .header-logo {
    width: 24px;
    height: 24px;
    border-radius: 5px;
  }
  .app-title {
    font-size: 13px;
  }
  .topbar {
    padding: 8px 12px;
  }
  .topbar-brand {
    gap: 6px;
  }
  .mode-name {
    font-size: 11px;
  }
  .mode-desc {
    display: none; /* Скрываем описания на сверхмалых экранах, чтобы не загромождать */
  }
}

/* 3. Короткие экраны по высоте (Телефоны с вырезами, клавиатурами, открытыми панелями) */
@media (max-height: 720px) {
  .paywall-wrap {
    padding: 20px 16px 32px; /* v4.8.13: нижний запас 32px — кнопка повыше */
  }
  .logo-img {
    width: 60px;
    height: 60px;
  }
  .logo-ring {
    inset: -12px;
  }
  .paywall-title {
    font-size: 26px;
    margin-bottom: 4px;
  }
  .paywall-sub {
    margin-bottom: 16px;
  }
  .paywall-features {
    margin-bottom: 16px;
  }
  .paywall-feature {
    padding: 8px 12px;
    margin-bottom: 6px;
    font-size: 13px;
  }
  .paywall-price-block {
    margin-bottom: 16px;
  }
  .paywall-price-label {
    margin-bottom: 8px;
    font-size: 11px;
  }
  .btn-paywall {
    padding: 12px 20px;
    font-size: 15px;
  }
  
  /* Элементы управления холстом делаем компактнее */
  .upload-zone {
    min-height: 140px;
    margin: 8px 12px;
  }
  .preview-img {
    height: 140px;
  }
  .canvas-container {
    margin: 4px 12px;
  }
  .tools-bar {
    padding: 6px 12px;
    margin: 4px 12px;
    gap: 6px;
  }
  .tool-btn {
    width: 34px;
    height: 34px;
    font-size: 16px;
  }
  .tool-btn-labeled {
    min-width: 34px;
    padding: 0 8px;
    font-size: 12px;
  }
  .prompt-wrap {
    padding: 0 12px;
    margin-bottom: 4px;
  }
  .prompt-textarea {
    min-height: 48px;
    padding: 10px 12px;
    font-size: 13px;
  }
  .btn-generate {
    margin: 4px auto 12px;
    padding: 12px 20px;
    font-size: 15px;
  }
  .menu-wrap {
    padding: 16px 12px;
  }
  .menu-subheading {
    margin-bottom: 16px;
  }
}

/* 4. Сверхкороткие экраны по высоте (до 620px) */
@media (max-height: 620px) {
  .paywall-features {
    display: none; /* Скрываем список фич, чтобы уместить тарифы на одном экране */
  }
  .paywall-wrap {
    justify-content: space-around;
  }
  .upload-zone {
    min-height: 110px;
  }
  .preview-img {
    height: 110px;
  }
  .btn-generate {
    margin-bottom: 6px;
  }
}

/* 5. Планшеты и большие экраны (от 768px по ширине) */
@media (min-width: 768px) {
  .mode-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 600px;
  }
  .paywall-wrap {
    max-width: 480px;
    margin: 0 auto;
  }
  .header-logo {
    width: 42px;
    height: 42px;
  }
  .app-title {
    font-size: 19px;
  }
  .topbar {
    padding: 14px 24px;
  }
}

/* Кнопка сброса масштаба */
.zoom-reset-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 100;
  background: rgba(15, 12, 30, 0.85);
  border: 1px solid rgba(0, 245, 255, 0.3);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  transform: translate3d(0, 0, 0);
}

.zoom-reset-btn:hover {
  background: rgba(30, 25, 60, 0.95);
  border-color: rgba(0, 245, 255, 0.6);
}

.zoom-reset-btn:active {
  transform: scale(0.95) translate3d(0, 0, 0);
  background: rgba(0, 245, 255, 0.15);
  border-color: var(--neon-cyan);
}

/* ── Боковая кнопка обратной связи (Tab) ────────────────────────────────── */
.feedback-tab {
  position: fixed;
  right: 14px;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 999;
  background: linear-gradient(135deg, var(--neon-cyan), #00C4CC);
  color: #050409;
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 5px 18px var(--neon-cyan-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 0;
  font-weight: 700;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.feedback-tab span::before {
  content: "💬";
  font-size: 21px;
}

.feedback-tab:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 22px var(--neon-cyan);
}

.feedback-tab:active {
  transform: scale(0.94);
}

/* ── Выезжающая панель (Side Drawer) ─────────────────────────────────────── */
#feedback-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(5, 4, 9, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  display: flex;
  justify-content: flex-end;
}

#feedback-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.feedback-drawer {
  width: 310px;
  height: 100%;
  background: var(--bg-card);
  border-left: 1px solid var(--border-glass-hover);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 36px 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
}

#feedback-modal.is-open .feedback-drawer {
  transform: translateX(0);
}

.btn-close-drawer {
  position: absolute;
  top: 16px;
  left: 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-close-drawer:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.btn-close-drawer:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.15);
  color: var(--neon-cyan);
}

/* ══ Экраны Face Swap / Style Remix (двойной холст) ══ */
.multi-upload {
  display: flex;
  gap: 12px;
  padding: 0 16px;
  margin-top: 12px;
}
.upload-zone.small {
  position: relative;
  flex: 1;
  min-height: 150px;
  border: 1.5px dashed rgba(0, 245, 255, 0.35);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(14px);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.upload-zone.small .upload-placeholder { text-align: center; padding: 10px; }
.upload-zone.small .upload-icon { font-size: 30px; }
.upload-zone.small .upload-title { font-weight: 700; font-size: 14px; margin-top: 6px; color: #fff; }
.upload-zone.small .upload-sub { font-size: 11px; color: rgba(255,255,255,0.55); margin-top: 2px; }
.upload-zone.small .preview-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 3;
}

.presets-label {
  padding: 14px 16px 4px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
}
.presets-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 16px 10px;
  -webkit-overflow-scrolling: touch;
}
.preset-chip {
  flex: 0 0 auto;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 245, 255, 0.35);
  background: rgba(0, 245, 255, 0.08);
  color: #d6fbff;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all .15s ease;
}
.preset-chip.active {
  background: rgba(0, 245, 255, 0.25);
  box-shadow: 0 0 14px rgba(0, 245, 255, 0.55);
  color: #fff;
}
.presets-loading { color: rgba(255,255,255,0.5); font-size: 13px; padding: 4px; }
.presets-placeholder { color: rgba(255,255,255,0.45); font-size: 13px; padding: 6px 0; text-align: center; width: 100%; }

/* Toast */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.85); color: #fff; padding: 12px 24px; border-radius: 12px;
  font-size: 14px; z-index: 9999; opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease; max-width: 90vw; text-align: center;
  backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.15);
}
.toast.toast-visible { opacity: 1; }

/* ═══════════════════════ GACHA / ИИ-РУЛЕТКА ═══════════════════════ */

/* Карточка ИИ-Рулетки — такой же размер, тонкий золотой акцент рамки */
.mode-card-gacha {
  border-color: rgba(255, 215, 0, 0.18);
}
.mode-card-gacha:hover {
  border-color: rgba(255, 215, 0, 0.35);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 215, 0, 0.12);
}
.mode-card-gacha:active {
  border-color: rgba(255, 215, 0, 0.6);
  box-shadow: 0 0 24px rgba(255, 215, 0, 0.15);
}

/* Анимированная иконка кубика */
.gacha-dice-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 32px 0 12px;
  position: relative;
}

/* Неоновое кольцо вокруг иконки */
.gacha-dice-ring {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 2px solid rgba(168, 85, 247, 0.4);
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.35), inset 0 0 20px rgba(168, 85, 247, 0.1);
  animation: gacha-ring-pulse 2.5s ease-in-out infinite;
}
@keyframes gacha-ring-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(168, 85, 247, 0.25), inset 0 0 12px rgba(168, 85, 247, 0.08); }
  50%      { transform: scale(1.08); box-shadow: 0 0 40px rgba(255, 215, 0, 0.4), inset 0 0 24px rgba(255, 215, 0, 0.15); border-color: rgba(255, 215, 0, 0.5); }
}

.gacha-dice {
  width: 80px;
  height: 80px;
  object-fit: contain;
  mix-blend-mode: normal;
  filter: drop-shadow(0 0 18px rgba(168, 85, 247, 0.7)) drop-shadow(0 0 36px rgba(168, 85, 247, 0.35));
  animation: gacha-bounce 2s ease-in-out infinite;
  z-index: 1;
  position: relative;
}
@keyframes gacha-bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-8px) rotate(5deg); }
  75% { transform: translateY(-4px) rotate(-5deg); }
}

/* Текст-подсказка */
.gacha-hint {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 8px 24px 16px;
  line-height: 1.5;
}

/* Плашка стиля на экране результата (gacha) */

/* Quick Action icons — неоновый акцент */
.qa-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 6px var(--neon-cyan-glow));
  font-size: 16px;
  vertical-align: middle;
}
.gacha-badge-result {
  text-align: center;
  padding: 14px 20px;
  margin: 12px auto;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(168, 85, 247, 0.2));
  border: 1px solid rgba(255, 215, 0, 0.5);
  border-radius: 16px;
  color: #FFD700;
  font-weight: 700;
  font-size: 15px;
  max-width: 320px;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
  animation: gacha-badge-glow 2s ease-in-out infinite alternate;
}
@keyframes gacha-badge-glow {
  from { box-shadow: 0 0 8px rgba(255, 215, 0, 0.2); }
  to   { box-shadow: 0 0 24px rgba(168, 85, 247, 0.5); }
}

/* TZ v2.0 §8.3: truthful result label (actual delivered dimensions). */
.result-label-badge {
  text-align: center;
  padding: 10px 18px;
  margin: 10px auto 0;
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.12), rgba(168, 85, 247, 0.16));
  border: 1px solid rgba(0, 245, 255, 0.45);
  border-radius: 14px;
  color: var(--neon-cyan);
  font-weight: 700;
  font-size: 14px;
  max-width: 320px;
  text-shadow: 0 0 10px var(--neon-cyan-glow);
}

/* Крутящаяся анимация для экрана загрузки (gacha) */
.gacha-spinning .laser-beam {
  animation: gacha-beam-spin 0.8s linear infinite;
}
@keyframes gacha-beam-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════════════
   v4.0 NEW STYLES
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Engine Mode Toggle (Fast / PRO) ──────────────────────────────────── */
.engine-toggle {
  display: flex;
  padding: 8px 16px;
  gap: 8px;
}

.engine-toggle-btn {
  flex: 1;
  padding: 12px 16px;
  border: 1.5px solid var(--border-glass);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  /* Единая шкала кнопок (owner decision): тогглы всегда одной высоты.
     Подписи содержат цены и на узких экранах рвутся на 2 строки —
     резервируем высоту под 2 строки (как .btn-generate), иначе Fast/PRO/
     Облако пляшут друг относительно друга. */
  line-height: 1.2;
  min-height: 62px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.engine-toggle-btn.active {
  border-color: var(--neon-cyan);
  background: rgba(0, 245, 255, 0.12);
  color: var(--neon-cyan);
  box-shadow: 0 0 15px var(--neon-cyan-dim);
}

.engine-toggle-btn.pro-active {
  border-color: var(--neon-purple);
  background: rgba(168, 85, 247, 0.12);
  color: var(--neon-purple);
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.3);
}

.engine-toggle-btn.cloud-active {
  border-color: var(--neon-gold);
  background: rgba(255, 191, 71, 0.12);
  color: var(--neon-gold);
  box-shadow: 0 0 15px var(--neon-gold-glow);
}

.engine-toggle-btn:active {
  transform: scale(0.96);
}
/* Cloud engines picker (owner decision 2026-09-29). */
.cloud-picker { display: none; gap: 8px; margin-top: 8px; }
.cloud-card { flex: 1; display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px; border-radius: 12px; border: 1px solid var(--border-glass);
  background: var(--bg-card); color: var(--text-primary); }
.cloud-card.on { border-color: var(--neon-cyan); border-width: 2px; background: rgba(0,245,255,.14); animation: cloud-pick-pulse 1.6s ease-in-out infinite; }
@keyframes cloud-pick-pulse {
  0%, 100% { box-shadow: 0 0 0 1px var(--neon-cyan), 0 0 6px rgba(0,245,255,.15); }
  50% { box-shadow: 0 0 0 1px var(--neon-cyan), 0 0 20px rgba(0,245,255,.5); }
}
.cloud-name { font-weight: 700; }
.cloud-badges { font-size: 12px; opacity: .7; }
/* Слой подсказок (owner decision 2026-10-09): сильные стороны движка +
   строгость проверки контента — по нашим замерам 2026-10-08/09. */
.cloud-hint { font-size: 10.5px; opacity: .6; line-height: 1.3; }
.cloud-price { font-weight: 700; }
/* Компактный селектор + модалка выбора движка (вместо сетки карточек). */
.cloud-selector { width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border-glass);
  background: var(--bg-card); color: var(--text-primary); }
.cloud-sel-name { font-weight: 700; flex: 1; text-align: left; }
.cloud-sel-price { font-weight: 700; }
.cloud-sel-chev { opacity: .6; }
#cloud-modal-list { margin-top: 8px; }
.cloud-modal-row { width: 100%; display: grid;
  grid-template-columns: 1fr auto; gap: 2px 8px; text-align: left;
  padding: 10px 12px; border-radius: 12px; margin-bottom: 8px;
  border: 1px solid var(--border-glass); background: var(--bg-card);
  color: var(--text-primary); }
.cloud-modal-row.on { border-color: var(--neon-cyan); }
.cloud-modal-row .cloud-price { grid-row: span 3; align-self: center; }
.cloud-check { color: var(--neon-cyan); font-weight: 700; }

/* ── Macro Chips (edit mode) ──────────────────────────────────────────── */
.macro-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.macro-chip {
  padding: 8px 14px;
  border: 1px solid var(--border-glass);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.macro-chip:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.macro-chip.active {
  border-color: var(--neon-cyan);
  background: rgba(0, 245, 255, 0.11);
  color: var(--neon-cyan);
  box-shadow: 0 0 14px var(--neon-cyan-dim);
}

.macro-chip:active {
  background: rgba(0, 245, 255, 0.1);
  transform: scale(0.96);
}

/* ── Macro beta badge (ЭТАП ПРЕДБЕТА 2.2) ───────────────────────────────
   Честная метка ограничения: матинг V4 выключен (legacy-путь, качество
   может уступать). Янтарный тон — тот же язык, что у FaceSwap-варнинга.
   Бейдж не кликабелен и не перехватывает нажатие по чипу. */
.macro-chip-beta-badge {
  align-self: center;
  margin-left: -6px;
  padding: 2px 8px;
  border: 1px solid var(--amber-border, rgba(255, 191, 71, 0.45));
  border-radius: 999px;
  background: var(--amber-bg, rgba(255, 191, 71, 0.12));
  color: var(--amber-text, #ffbf47);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: help;
  user-select: none;
  white-space: nowrap;
}

/* ── Format Chips (create mode) ───────────────────────────────────────── */
.format-chips {
  display: flex;
  gap: 8px;
  padding: 4px 0;
}

.format-chip {
  padding: 8px 14px;
  border: 1px solid var(--border-glass);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.format-chip.active {
  border-color: var(--neon-cyan);
  background: rgba(0, 245, 255, 0.15);
  color: var(--neon-cyan);
  box-shadow: 0 0 12px var(--neon-cyan-dim);
}

.format-chip:active {
  transform: scale(0.96);
}

/* ── Insufficient Funds Modal (Bottom Sheet) ──────────────────────────── */
#insufficient-funds-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(5, 4, 9, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: flex-end;
  justify-content: center;
}

#insufficient-funds-modal.active {
  display: flex;
}

.funds-sheet {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass-hover);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 28px 20px calc(20px + env(safe-area-inset-bottom, 20px));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.funds-icon {
  font-size: 40px;
  text-align: center;
  margin-bottom: 12px;
}

.funds-title {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.funds-text {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.5;
}

.funds-btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  margin-bottom: 10px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.funds-btn-buy {
  background: linear-gradient(135deg, var(--neon-cyan), #00C4CC);
  color: #050409;
  box-shadow: 0 4px 15px var(--neon-cyan-glow);
}

.funds-btn-switch {
  background: transparent;
  border: 1.5px solid var(--neon-cyan);
  color: var(--neon-cyan);
}

.funds-btn:active {
  transform: scale(0.97);
}

/* ── Upsell Banner (result screen, fast → PRO) ────────────────────────── */
.upsell-banner {
  margin: 12px 16px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(0, 245, 255, 0.08));
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: var(--radius-md);
  text-align: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.upsell-banner.hidden {
  display: none;
}

.upsell-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.upsell-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.upsell-btn {
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--neon-purple), #7C3AED);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

.upsell-btn:active {
  transform: scale(0.96);
}

/* ── Download Button ──────────────────────────────────────────────────── */
.btn-download {
  padding: 8px 16px;
  background: rgba(34, 255, 136, 0.12);
  border: 1px solid rgba(34, 255, 136, 0.3);
  border-radius: var(--radius-sm);
  color: var(--neon-green);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-download:active {
  transform: scale(0.96);
}

/* ── Menu cards: текст и цена должны быть видимы на мобильном ─────────── */
.mode-card {
  min-height: 206px;
  max-height: none;
}

.mode-card:focus-visible {
  outline: 2px solid var(--neon-cyan);
  outline-offset: 3px;
}

.mode-card .mode-icon {
  width: 76px;
  height: 76px;
}

.mode-card .menu-3d-icon {
  width: 68px;
  height: 68px;
}

/* ── Enhance button (auto-prompt, context) styling ────────────────────── */
.enhance-btn {
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  width: 100%;
}

.enhance-btn:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.enhance-btn:active {
  transform: scale(0.97);
  background: rgba(0, 245, 255, 0.08);
}

/* ── Loading dynamic text ─────────────────────────────────────────────── */
.loading-step {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  transition: opacity 0.3s;
}

/* ── Live generation progress (фабричная очередь/проценты) ──────────────── */
.gen-progress {
  width: min(280px, 72vw);
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  margin: 10px auto 0;
  overflow: hidden;
}
.gen-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: linear-gradient(90deg, #48f5ff, #7C4DFF);
  transition: width 0.6s ease;
}
.gen-progress-fill.gen-progress-busy {
  width: 30%;
  animation: gen-progress-slide 1.4s ease-in-out infinite alternate;
}
@keyframes gen-progress-slide {
  from { margin-left: -30%; }
  to { margin-left: 100%; }
}
.gen-progress-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  min-height: 16px;
}

/* TZ 2026-10-19: позиция в окереди и
   подсказка «можно закрыть
   приложение». */
.gen-queue-label {
  font-size: 13px;
  color: var(--text-primary, #fff);
  margin-top: 8px;
  min-height: 18px;
  font-weight: 600;
}
.gen-close-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  max-width: 320px;
  line-height: 1.4;
}

/* Top-up cards use their own compact, mobile-first layout. */
.topup-pkg-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 92px;
  align-items: center;
  gap: 9px;
  padding: 9px 9px 9px 7px;
  border: 1px solid var(--border-glass);
  border-radius: 15px;
  background:
    linear-gradient(145deg, rgba(0, 245, 255, 0.07), rgba(168, 85, 247, 0.05)),
    var(--bg-card);
  text-align: left;
  overflow: hidden;
}

.topup-pkg-card.popular {
  border-color: rgba(217, 70, 239, 0.45);
  background:
    radial-gradient(circle at 12% 50%, rgba(0, 245, 255, 0.12), transparent 35%),
    linear-gradient(145deg, rgba(217, 70, 239, 0.12), rgba(0, 245, 255, 0.05)),
    var(--bg-card);
  box-shadow: inset 0 0 18px rgba(217, 70, 239, 0.05);
}

.topup-pkg-image {
  display: block;
  width: 58px;
  height: 58px;
  object-fit: contain;
  mix-blend-mode: screen;
  border-radius: 50%;
  clip-path: circle(49% at 50% 50%);
  -webkit-mask-image: radial-gradient(circle, #000 61%, rgba(0, 0, 0, 0.9) 72%, transparent 78%);
  mask-image: radial-gradient(circle, #000 61%, rgba(0, 0, 0, 0.9) 72%, transparent 78%);
}

.topup-pkg-info {
  min-width: 0;
}

.topup-pkg-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin-bottom: 2px;
}

.topup-pkg-badge {
  flex: 0 0 auto;
  padding: 2px 5px;
  border: 1px solid rgba(0, 245, 255, 0.3);
  border-radius: 999px;
  color: var(--neon-cyan);
  background: rgba(0, 245, 255, 0.07);
  font-size: 6px;
  font-weight: 850;
  letter-spacing: 0.06em;
}

.topup-tier-regular .topup-pkg-badge {
  border-color: rgba(217, 70, 239, 0.4);
  color: #f0abfc;
  background: rgba(217, 70, 239, 0.1);
}

.topup-tier-large .topup-pkg-badge {
  border-color: rgba(255, 215, 0, 0.38);
  color: #ffe66d;
  background: rgba(255, 215, 0, 0.08);
}

.topup-pkg-type {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topup-pkg-name {
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.15;
  white-space: nowrap;
}

.topup-pkg-desc {
  margin-top: 2px;
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 8px;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
}

.modal-card .topup-buy-btn {
  width: 100%;
  min-width: 0;
  min-height: 45px;
  margin: 0;
  padding: 6px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 12px;
  line-height: 1.1;
  white-space: normal;
}

.topup-buy-label {
  font-size: 9px;
  font-weight: 700;
  opacity: 0.82;
}

.topup-buy-price {
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.topup-buy-btn:disabled {
  cursor: wait;
  opacity: 0.65;
}

@media (max-width: 380px) {
  .mode-card {
    min-height: 188px;
    padding: 12px 8px;
  }

  .mode-card .mode-icon {
    width: 62px;
    height: 62px;
  }

  .mode-card .menu-3d-icon {
    width: 56px;
    height: 56px;
  }

  .topup-packages {
    grid-template-columns: 1fr;
  }

  .topup-pkg-card {
    grid-template-columns: 52px minmax(0, 1fr) 84px;
    gap: 7px;
    padding-left: 6px;
  }

  .topup-pkg-image {
    width: 52px;
    height: 52px;
  }

  .topup-pkg-name {
    font-size: 17px;
  }

  .topup-rate {
    gap: 9px;
  }

  .topup-rate-equation {
    gap: 4px;
    padding: 7px;
    font-size: 12px;
  }
}

/* ═══════════════════════ v4.3: ДИЗАЙН С ТЕКСТОМ ═══════════════════════ */

.mode-card-text {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 420px;
  min-height: 112px;
  margin: 12px auto 0;
  padding: 12px 14px;
  text-align: left;
  border-color: rgba(217, 70, 239, 0.34);
  background:
    radial-gradient(circle at 12% 50%, rgba(0, 229, 255, 0.15), transparent 34%),
    radial-gradient(circle at 78% 30%, rgba(217, 70, 239, 0.13), transparent 44%),
    rgba(22, 22, 34, 0.9);
}

.mode-card-text:hover {
  border-color: rgba(217, 70, 239, 0.62);
  background:
    radial-gradient(circle at 12% 50%, rgba(0, 229, 255, 0.22), transparent 36%),
    radial-gradient(circle at 78% 30%, rgba(217, 70, 239, 0.2), transparent 48%),
    rgba(25, 25, 41, 0.94);
}

.mode-card-text .mode-icon {
  width: 74px;
  height: 74px;
  flex: none;
}

.mode-card-text .menu-3d-icon {
  width: 72px;
  height: 72px;
}

/* ═══════════════════════════════════════════════════════════════════════
   GALLERY v4.6 — добровольная публикация и лента идей
   ═══════════════════════════════════════════════════════════════════════ */

.gallery-entry {
  position: relative;
  width: 100%;
  min-height: 106px;
  margin-top: 14px;
  padding: 12px 42px 12px 118px;
  border: 1px solid rgba(0, 232, 255, .38);
  border-radius: 22px;
  overflow: hidden;
  color: var(--text-primary);
  text-align: left;
  background:
    radial-gradient(circle at 12% 25%, rgba(0, 230, 255, .18), transparent 42%),
    radial-gradient(circle at 88% 80%, rgba(184, 74, 255, .2), transparent 45%),
    linear-gradient(135deg, rgba(16, 22, 38, .97), rgba(24, 12, 38, .97));
  box-shadow: 0 12px 38px rgba(0, 0, 0, .28), inset 0 1px rgba(255,255,255,.06);
  cursor: pointer;
}

.gallery-entry::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.08) 48%, transparent 64%);
  transform: translateX(-120%);
  animation: galleryShine 5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes galleryShine {
  0%, 65% { transform: translateX(-120%); }
  88%, 100% { transform: translateX(120%); }
}

.gallery-entry-collage {
  position: absolute;
  left: 12px;
  top: 10px;
  width: 96px;
  height: 86px;
}

.gallery-entry-collage img {
  position: absolute;
  width: 54px;
  height: 70px;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.7);
  border-radius: 13px;
  box-shadow: 0 8px 18px rgba(0,0,0,.45);
}

.gallery-entry-collage img:nth-child(1) { left: 0; top: 8px; transform: rotate(-9deg); }
.gallery-entry-collage img:nth-child(2) { left: 25px; top: 0; z-index: 2; transform: rotate(2deg); }
.gallery-entry-collage img:nth-child(3) { left: 47px; top: 10px; transform: rotate(10deg); }

.gallery-entry-copy { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 3px; }
.gallery-entry-copy small { color: #32edf7; font-size: 9px; font-weight: 800; letter-spacing: 1.25px; }
.gallery-entry-copy strong { font-size: 18px; line-height: 1.15; }
.gallery-entry-copy > span { color: var(--text-secondary); font-size: 11px; line-height: 1.35; }
.gallery-entry-arrow { position: absolute; z-index: 2; right: 16px; top: 50%; color: #48f5ff; font-size: 24px; transform: translateY(-50%); }

.gallery-topbar { position: sticky; top: 0; z-index: 8; }
.gallery-back {
  width: 36px; height: 36px; flex: 0 0 36px; border: 1px solid rgba(255,255,255,.15);
  border-radius: 12px; color: #fff; background: rgba(255,255,255,.06); font-size: 20px;
}
.gallery-wrap { padding: 12px 12px 34px; }
.gallery-hero {
  display: flex; align-items: center; gap: 12px; padding: 15px; margin-bottom: 12px;
  border: 1px solid rgba(113, 77, 255, .28); border-radius: 20px;
  background: linear-gradient(135deg, rgba(24,18,45,.9), rgba(8,24,38,.9));
}
.gallery-hero-orb {
  display: grid; place-items: center; width: 52px; height: 52px; flex: 0 0 52px;
  border: 1px solid rgba(0,238,255,.6); border-radius: 50%; color: #fff; font-size: 25px;
  background: radial-gradient(circle at 35% 30%, #49f8ff, #5262dc 48%, #71146f 78%);
  box-shadow: 0 0 28px rgba(0,230,255,.28);
}
.gallery-hero h2 { margin: 0 0 4px; font-size: 18px; }
.gallery-hero p { margin: 0; color: var(--text-secondary); font-size: 11px; line-height: 1.35; }

.gallery-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px; border-radius: 15px; background: rgba(255,255,255,.045); }
.gallery-tab, .gallery-category {
  min-height: 38px; border: 1px solid transparent; border-radius: 12px;
  color: var(--text-secondary); background: transparent; font-size: 12px; font-weight: 700;
}
.gallery-tab.active { color: #061016; background: linear-gradient(135deg, #30eff7, #00c8db); box-shadow: 0 5px 18px rgba(0,220,236,.24); }
.gallery-categories { display: flex; gap: 7px; margin: 10px 0 13px; overflow-x: auto; scrollbar-width: none; }
.gallery-categories::-webkit-scrollbar { display: none; }
.gallery-category { flex: 0 0 auto; min-height: 32px; padding: 0 13px; border-color: rgba(255,255,255,.1); background: rgba(255,255,255,.035); }
.gallery-category.active { border-color: rgba(167,86,255,.62); color: #fff; background: rgba(135,55,220,.22); }
.gallery-state { padding: 44px 18px; color: var(--text-secondary); text-align: center; font-size: 13px; }
.gallery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.gallery-grid:empty { display: none; }

.gallery-card {
  position: relative; min-width: 0; overflow: hidden; border: 1px solid rgba(255,255,255,.1);
  border-radius: 17px; background: #100e19; box-shadow: 0 8px 26px rgba(0,0,0,.26); cursor: pointer;
}
.gallery-card-image { position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: linear-gradient(135deg, #171327, #091923); }
.gallery-card-image img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .3s ease; }
.gallery-card:active .gallery-card-image img { transform: scale(.98); }
.gallery-card-badge {
  position: absolute; left: 7px; top: 7px; max-width: calc(100% - 14px); padding: 5px 8px;
  overflow: hidden; border: 1px solid rgba(255,255,255,.16); border-radius: 999px;
  color: #fff; background: rgba(4,5,12,.72); backdrop-filter: blur(8px); font-size: 9px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap;
}
.gallery-card-status { position: absolute; inset: auto 7px 7px; padding: 6px 8px; border-radius: 9px; color: #fff; background: rgba(7,8,15,.76); backdrop-filter: blur(8px); font-size: 9px; text-align: center; }
.gallery-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 9px; }
.gallery-card-likes { color: #ff7fbd; font-size: 11px; font-weight: 800; }
.gallery-card-open { color: #48edf8; font-size: 10px; font-weight: 700; }

.gallery-publish-card {
  display: block;
  margin: 12px 15px 4px; padding: 14px; border: 1px solid rgba(0,232,255,.58); border-radius: 18px;
  background: linear-gradient(135deg, rgba(5,31,42,.92), rgba(33,14,48,.92));
  box-shadow: 0 10px 32px rgba(0,0,0,.25), 0 0 24px rgba(0,232,255,.09);
}
.gallery-publish-card.hidden { display: none; }
.gallery-publish-choice { display: grid; grid-template-columns: 27px minmax(0, 1fr); gap: 11px; align-items: center; cursor: pointer; }
.gallery-publish-choice input { width: 24px; height: 24px; margin: 0; accent-color: #20e9f1; filter: drop-shadow(0 0 8px rgba(32,233,241,.45)); }
.gallery-publish-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.gallery-publish-copy strong { color: #f5feff; font-size: 13px; line-height: 1.3; }
.gallery-publish-copy span { color: #b6cbd3; font-size: 10px; line-height: 1.4; }
.gallery-publish-card > button { width: 100%; min-height: 42px; margin-top: 12px; border: 0; border-radius: 12px; color: #061016; background: linear-gradient(135deg, #40f5fb, #15cbd9); font-size: 12px; font-weight: 800; transition: opacity .18s ease, transform .18s ease; }
.gallery-publish-card > button:disabled { opacity: .38; box-shadow: none; }
.gallery-publish-card > button:not(:disabled):active { transform: scale(.98); }

.gallery-consent-card { width: min(92vw, 390px); padding-top: 30px; text-align: left; }
.gallery-consent-icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 18px; color: #071015; background: linear-gradient(135deg, #49f7ff, #c26bff); font-size: 28px; box-shadow: 0 0 28px rgba(73,247,255,.2); }
.gallery-consent-card .modal-title, .gallery-consent-card .modal-text { text-align: center; }
.gallery-check { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0; padding: 12px; border: 1px solid rgba(0,232,255,.24); border-radius: 13px; background: rgba(0,217,232,.06); font-size: 11px; line-height: 1.4; }
.gallery-check-optional { border-color: rgba(255,255,255,.1); background: rgba(255,255,255,.035); }
.gallery-check input { width: 19px; height: 19px; flex: 0 0 19px; accent-color: #1de6ee; }
.gallery-private-note { color: var(--text-secondary); font-size: 10px; line-height: 1.4; }
.gallery-consent-card .btn-primary { width: 100%; }

.gallery-preview-card {
  position: relative; width: min(94vw, 470px); max-height: 92vh; overflow-y: auto;
  border: 1px solid rgba(255,255,255,.14); border-radius: 24px; background: #0c0a13;
  box-shadow: 0 24px 80px rgba(0,0,0,.65);
}
.gallery-preview-card > img { width: 100%; max-height: 68vh; display: block; object-fit: contain; border-radius: 23px 23px 0 0; background: #07060b; }
.gallery-preview-close { position: absolute; z-index: 2; right: 10px; top: 10px; width: 36px; height: 36px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; color: #fff; background: rgba(5,5,10,.7); backdrop-filter: blur(10px); }
.gallery-preview-meta { display: flex; justify-content: space-between; gap: 8px; padding: 11px 13px 6px; color: var(--text-secondary); font-size: 10px; }
.gallery-mode-badge { color: #55edf7; font-weight: 800; }
.gallery-preview-actions { display: grid; grid-template-columns: auto 1fr; gap: 8px; padding: 8px 12px 14px; }
.gallery-preview-actions button { min-height: 42px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.11); border-radius: 12px; color: #fff; background: rgba(255,255,255,.055); font-size: 11px; font-weight: 700; }
.gallery-preview-actions .gallery-similar-btn { border: 0; color: #061016; background: linear-gradient(135deg, #46f5fb, #13c8da); }
.gallery-preview-actions .gallery-danger-btn { grid-column: 1 / -1; color: #ff9ebd; border-color: rgba(255,91,142,.25); background: rgba(255,65,123,.07); }
.gallery-preview-actions .hidden { display: none; }

@media (max-width: 360px) {
  .gallery-entry { padding-left: 104px; }
  .gallery-entry-collage { transform: scale(.88); transform-origin: left center; }
  .gallery-preview-actions { grid-template-columns: 1fr; }
  .gallery-preview-actions .gallery-danger-btn { grid-column: auto; }
}

.mode-card-text-copy {
  min-width: 0;
}

.mode-card-text .mode-name,
.mode-card-text .mode-desc {
  text-align: left;
}

.mode-card-text .mode-name {
  margin-top: 2px;
  font-size: 16px;
}

.mode-card-text .mode-desc {
  max-width: 230px;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.35;
}

.mode-feature-badge {
  display: inline-flex;
  padding: 3px 7px;
  border: 1px solid rgba(0, 245, 255, 0.35);
  border-radius: 999px;
  color: var(--neon-cyan);
  background: rgba(0, 245, 255, 0.07);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.7px;
}

.mode-text-cost {
  min-width: 50px;
  padding: 7px 8px;
  border: 1px solid rgba(217, 70, 239, 0.28);
  border-radius: 999px;
  color: #f0abfc;
  background: rgba(217, 70, 239, 0.09);
  font-size: 12px;
  white-space: nowrap;
}

.text-pro-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  margin: 10px 16px 12px;
  padding: 10px 12px;
  border: 1px solid rgba(217, 70, 239, 0.28);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.08), rgba(217, 70, 239, 0.09));
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.35;
}

.text-pro-note strong {
  color: #f0abfc;
  font-size: 12px;
  white-space: nowrap;
}

.text-pro-note-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(0, 245, 255, 0.35);
  border-radius: 10px;
  color: var(--neon-cyan);
  background: rgba(0, 245, 255, 0.08);
  font-size: 14px;
  font-weight: 900;
}

.text-design-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.text-field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 2px 6px;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
}

.text-required {
  color: #f0abfc;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.exact-text-input {
  min-height: 70px;
  border-color: rgba(217, 70, 239, 0.35);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.15px;
}

.exact-text-input:focus {
  border-color: #d946ef;
  box-shadow: 0 0 0 3px rgba(217, 70, 239, 0.1);
}

.text-field-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: -2px 2px 2px;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.35;
}

.text-field-meta span:last-child {
  flex: none;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.text-option-block {
  margin-top: 5px;
}

.text-option-title {
  margin: 0 2px 7px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
}

.text-option-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.text-option-chip {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid var(--border-glass);
  border-radius: 999px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.035);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.1s;
}

.text-option-chip.active {
  border-color: rgba(0, 245, 255, 0.55);
  color: var(--neon-cyan);
  background: rgba(0, 245, 255, 0.09);
  box-shadow: inset 0 0 14px rgba(0, 245, 255, 0.035);
}

.text-option-chip:active {
  transform: scale(0.96);
}

.text-edit-result {
  width: calc(100% - 32px);
  margin: 0 16px 12px;
  border-color: rgba(217, 70, 239, 0.35);
  color: #f0abfc;
  background: rgba(217, 70, 239, 0.08);
}

/* ── Нативные рекламные плашки: меню / ожидание / результат ─────────────── */
.ad-slot {
  width: calc(100% - 24px);
  min-height: 94px;
  margin: 14px 12px 6px;
  padding: 11px;
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(0, 245, 255, 0.2);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 30%, rgba(0, 245, 255, 0.12), transparent 35%),
    radial-gradient(circle at 88% 72%, rgba(217, 70, 239, 0.12), transparent 38%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(31, 20, 48, 0.88)),
    rgba(8, 7, 15, 0.94);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.26), inset 0 1px rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  text-align: left;
  font-family: var(--font);
  cursor: pointer;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.ad-slot::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: -70% auto -70% -30%;
  width: 28%;
  transform: rotate(18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: adSlotSheen 7s ease-in-out infinite;
  pointer-events: none;
}

@keyframes adSlotSheen {
  0%, 72% { left: -35%; opacity: 0; }
  78% { opacity: 1; }
  92%, 100% { left: 125%; opacity: 0; }
}

.ad-slot:active {
  transform: scale(0.985);
  border-color: rgba(0, 245, 255, 0.42);
}

.ad-slot-image {
  width: 68px;
  height: 68px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 15px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 18px rgba(0, 245, 255, 0.1), 0 7px 16px rgba(0, 0, 0, 0.24);
}

.ad-slot-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ad-slot-label {
  color: var(--neon-cyan);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.ad-slot-title,
.ad-slot-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ad-slot-title {
  color: #fff;
  font-size: 13px;
  line-height: 1.25;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ad-slot-text {
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ad-slot-button {
  max-width: 86px;
  padding: 7px 9px;
  border: 1px solid rgba(0, 245, 255, 0.28);
  border-radius: 999px;
  color: var(--neon-cyan);
  background: rgba(0, 245, 255, 0.08);
  font-size: 9px;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: inset 0 0 12px rgba(0, 245, 255, 0.04);
}

.ad-slot-loading {
  width: min(360px, calc(100% - 30px));
  margin-top: 20px;
}

.ad-slot-image.hidden {
  display: none;
}

.ad-slot.ad-slot-no-image {
  grid-template-columns: minmax(0, 1fr) auto;
}

/* Экран №2: реклама стоит между двумя рядами основных режимов. */
.mode-grid > .menu-grid-ad {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  margin: 0;
}

@media (max-width: 380px) {
  .mode-card-text {
    grid-template-columns: 62px minmax(0, 1fr) auto;
    min-height: 100px;
    padding: 10px;
  }

  .mode-card-text .mode-icon,
  .mode-card-text .menu-3d-icon {
    width: 58px;
    height: 58px;
  }

  .mode-card-text .mode-name {
    font-size: 14px;
  }

  .mode-card-text .mode-desc {
    font-size: 9px;
  }

  .mode-text-cost {
    min-width: 44px;
    padding: 6px;
    font-size: 10px;
  }

  .ad-slot {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .ad-slot-image {
    width: 52px;
    height: 52px;
  }

  .ad-slot-button {
    display: none;
  }
}

/* Четыре основные карточки 2×2: на 15% ниже прежних 206px.
   Широкие карточки «Дизайн с текстом» и «Галерея» не затрагиваются. */
.mode-grid .mode-card {
  box-sizing: border-box;
  min-height: 175px;
  padding: 12px 10px;
}

.mode-grid .mode-card .mode-icon {
  width: 65px;
  height: 65px;
}

.mode-grid .mode-card .menu-3d-icon {
  width: 58px;
  height: 58px;
}

/* ═══ 4.7.12: скрытие цен для записи видео (флаг админки show_prices) ═══ */
/* Прячет только отображение; реальную цену сервер списывает как обычно. */
body.prices-hidden .btn-cost { display: none !important; }
body.prices-hidden .topup-pkg-desc { display: none !important; }
body.prices-hidden .price-tag { display: none !important; }

/* ═══ Task 12: welcome-trial promo banner ═══ */
.welcome-trial-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 6px auto 0;
  padding: 6px 12px;
  max-width: 340px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent, #ffd54a);
  background: rgba(255, 213, 74, 0.08);
  border: 1px solid rgba(255, 213, 74, 0.25);
  border-radius: 12px;
}
.welcome-trial-banner-sub {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.75;
}

/* ── Interactive text editor (text_design, owner decision) ───────────────── */
.td-editor { margin-top: 10px; }
.td-editor.hidden { display: none; }
.td-canvas {
  width: 100%;
  display: block;
  border-radius: 14px;
  background: #14141c;
  touch-action: none;
  cursor: grab;
}
.td-canvas.td-dragging { cursor: grabbing; }
.preset-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.preset-chip {
  padding: 8px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}
.preset-chip.active {
  background: linear-gradient(135deg, #f5c542, #e89b3c);
  color: #241a05;
  border-color: transparent;
  font-weight: 700;
}
.td-controls { display: flex; gap: 12px; margin-top: 10px; }
.td-ctl { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 12px; opacity: .92; }
.td-ctl input[type=range] { width: 100%; accent-color: #e89b3c; }
.td-editor.classic-lock .td-controls { opacity: .35; pointer-events: none; }
/* Явный выбор шрифта (owner decision): тот же визуальный язык, что у чипов
   пресетов — существующие токены, без новой палитры. */
.td-font-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 13px;
}
.td-font-select option { background: #14141c; color: #fff; }
/* «Сбросить» (owner decision): ghost/secondary — переиспользуем .btn-secondary. */
.td-reset { margin-top: 10px; width: 100%; }
.td-editor.classic-lock .td-reset { opacity: .35; pointer-events: none; }
/* ЭТАП 3: ToS-аттестация FaceSwap — чекбокс согласия перед списанием. */
.face-consent { display: flex; align-items: flex-start; gap: 10px; margin: 6px 16px 12px; padding: 12px 14px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: rgba(255,255,255,.03); cursor: pointer; }
.face-consent input[type="checkbox"] { width: 18px; height: 18px; margin: 1px 0 0; flex: 0 0 auto; accent-color: #49f7ff; cursor: pointer; }
.face-consent span { font-size: 12px; line-height: 1.45; color: var(--text-secondary, #9aa0b4); }

/* ═══════════════════ ЭКРАН 4: КОШЕЛЁК / ИСТОРИЯ ═══════════════════ */

.menu-secondary-entries {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.menu-secondary-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid rgba(0, 232, 255, .22);
  border-radius: 18px;
  color: var(--text-primary);
  text-align: left;
  background: linear-gradient(135deg, rgba(16, 22, 38, .9), rgba(24, 12, 38, .9));
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22), inset 0 1px rgba(255,255,255,.05);
  cursor: pointer;
}

.menu-secondary-entry .menu-secondary-icon {
  font-size: 22px;
  line-height: 1;
  flex: 0 0 auto;
}

.menu-secondary-entry .menu-secondary-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}

.menu-secondary-entry .menu-secondary-copy strong {
  font-size: 15px;
  font-weight: 700;
}

.menu-secondary-entry .menu-secondary-copy span {
  font-size: 12px;
  color: var(--text-secondary, #9aa4b2);
}

.wallet-wrap,
.history-wrap {
  padding: 12px 14px 28px;
  max-width: 560px;
  margin: 0 auto;
}

.wallet-balance-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 22px 16px;
  margin: 14px 0 18px;
  border: 1px solid rgba(0, 232, 255, .38);
  border-radius: 22px;
  background:
    radial-gradient(circle at 18% 20%, rgba(0, 230, 255, .16), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(184, 74, 255, .18), transparent 48%),
    linear-gradient(135deg, rgba(16, 22, 38, .97), rgba(24, 12, 38, .97));
  box-shadow: 0 12px 38px rgba(0, 0, 0, .28), inset 0 1px rgba(255,255,255,.06);
}

.wallet-balance-value {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: .5px;
}

.wallet-balance-label {
  font-size: 13px;
  color: var(--text-secondary, #9aa4b2);
}

.wallet-section-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.wallet-tx-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wallet-tx {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 14px;
  background: rgba(16, 22, 38, .6);
}

.wallet-tx-reason {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-tx-date {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-secondary, #9aa4b2);
}

.wallet-tx-amount {
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 800;
}

.wallet-tx-in { color: #35d49a; }
.wallet-tx-out { color: #ff7d7d; }

.history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.history-card {
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(16, 22, 38, .6);
  cursor: pointer;
}

.history-card-image {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 20, .5);
}

.history-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.history-card-placeholder {
  font-size: 30px;
  color: var(--text-secondary, #9aa4b2);
}

.history-card-status {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  backdrop-filter: blur(4px);
}

.history-badge-done { background: rgba(53, 212, 154, .85); color: #04281b; }
.history-badge-failed { background: rgba(255, 90, 90, .85); color: #2d0505; }
.history-badge-refunded { background: rgba(255, 196, 84, .9); color: #33230a; }
.history-badge-pending { background: rgba(120, 160, 255, .8); color: #101a33; }

.history-card-footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
}

.history-card-prompt {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ЭТАП 6.2: честный варнинг FaceSwap (до списания, до identity-гейта Этапа 9) */
.face-artistry-warning {
  margin: 4px 16px 10px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 196, 84, .45);
  border-radius: 12px;
  background: rgba(255, 196, 84, .10);
  color: #ffd58a;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

/* Волна 2 (v4.8.22, фичи #4/#5/#6): каталог сюжетов face swap */
#face-catalog { display: flex; flex-direction: column; gap: 10px; padding: 2px 16px 4px; }
#face-catalog .face-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; }
#face-catalog .face-thumb { flex: 0 0 96px; border: 2px solid transparent; border-radius: 10px; background: #1a1d26; padding: 0; overflow: hidden; color: #eee; font-size: 11px; line-height: 1.3; cursor: pointer; }
#face-catalog .face-thumb img { width: 96px; height: 128px; object-fit: cover; display: block; }
#face-catalog .face-thumb span { display: block; padding: 4px 2px; }
#face-catalog .face-thumb.active { border-color: #4c8cff; }

/* Фича №7 (v4.8.24): кисть-ластик поверх превью фото */
#brush-canvas { position: absolute; z-index: 3; touch-action: none; border-radius: inherit; cursor: crosshair; }
#brush-bar { display: flex; gap: 8px; align-items: center; margin: 8px 16px; flex-wrap: wrap; }

/* ЭТАП 6.4: карточка переподписи протухшей ссылки */
.resign-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 10px 16px 14px;
  padding: 12px 14px;
  border: 1px solid rgba(0, 232, 255, .3);
  border-radius: 14px;
  background: rgba(16, 22, 38, .8);
}

.resign-card.hidden { display: none; }

.resign-hint {
  font-size: 12px;
  color: var(--text-secondary, #9aa4b2);
}

.btn-resign {
  padding: 10px 18px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #00b3d6, #7a4dd8);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn-resign:disabled { opacity: .6; cursor: wait; }

/* «Фигурка» (спецификация кнопок 2026-10-21): иконка-эмодзи в 3D-стиле
   карточек режимов + выделение (кнопка-хит). */
.mode-card-figure {
  border-color: rgba(244, 114, 182, 0.38);
  background: radial-gradient(circle at 50% 18%, rgba(236, 72, 153, 0.22), transparent 62%), var(--card-bg, rgba(255,255,255,0.03));
}
.mode-card-figure:hover { border-color: rgba(244, 114, 182, 0.72); }
.mode-card-figure .mode-icon {
  filter: drop-shadow(0 6px 12px rgba(236, 72, 153, 0.45));
}
/* Ряд быстрых утилит в главном меню (Блок В спецификации) */
.menu-quick-actions {
  display: flex; gap: 8px; padding: 0 16px; margin: 12px 0;
  max-width: 420px; margin-left: auto; margin-right: auto;
}
.menu-quick-actions .btn-secondary {
  flex: 1; min-width: 0; font-size: 11px; padding: 9px 5px;
  gap: 3px 4px; line-height: 1.2;
}
/* Цена в строке НИКОГДА не рвётся (owner complaint 2026-10-22: «(4 ⚡)»
   разваливалось на «(4» + «⚡)» и ломало вид ряда). Переносится подпись. */
.menu-quick-actions .price-tag {
  white-space: nowrap; flex: 0 0 auto; font-size: 10px;
}
.menu-quick-actions .qa-label {
  min-width: 0; text-align: left; line-height: 1.2;
}
.menu-quick-actions .qa-icon { font-size: 15px; }
