/* ============================================================
   Лунесса · фиолетово-лунная палитра + звёздное небо.
   Стиль: тёмная магия, liquid glass, плавные анимации.
============================================================ */

:root {
  --night:        #070414;
  --night-2:      #0E0824;
  --deep-purple:  #1E1238;
  --card-purple:  #4C1D95;   /* Plum — глубокий, основной surface */
  --plum:         #4C1D95;
  --amethyst:     #6D28D9;
  --violet:       #8B5CF6;   /* основной акцент */
  --orchid:       #C084FC;   /* светлый акцент */
  --lilac:        #8B5CF6;
  --lilac-soft:   #C084FC;
  --magenta:      #E879F9;   /* для glow / highlight */
  --pink-glow:    #E879F9;
  --pink-soft:    #F9A8D4;
  --milk-pink:    #FCE7F3;
  --moon-silver:  #F0E6FF;
  --soft:         #C9BDE2;
  --gold:         #E6C58A;
  --error:        #E36F8C;
  --success:      #97E2C0;

  --glass-bg:        rgba(255,255,255,.06);
  --glass-bg-strong: rgba(255,255,255,.10);
  --glass-border:    rgba(255,255,255,.14);
  --glass-shadow:    0 10px 30px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.18);

  /* Берём максимум из CSS env() и Telegram safeAreaInset (для fullscreen API),
     плюс минимум 8px, чтобы content никогда не клеился к самому краю. */
  --safe-top: max(8px, env(safe-area-inset-top, 0px), var(--tg-safe-top, 0px), var(--tg-content-top, 0px));
  --safe-bot: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-bot, 0px));

  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 26px;
  --r-xl: 32px;
  --r-pill: 999px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--night);
  color: var(--moon-silver);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  height: 100%;
  overflow: hidden;
}
/* Когда mini-app свёрнут (в фоне webview жив) — паузим все анимации.
   Экономит GPU/battery, на дизайн не влияет (видно когда возвращаешься). */
html.app-paused *,
html.app-paused *::before,
html.app-paused *::after {
  animation-play-state: paused !important;
}
/* Root не скроллится: прокрутка живёт внутри .main, чтобы нижняя панель
   не участвовала в resize/repaint document viewport на iOS/Android WebView. */
html { overflow-x: clip; overflow-x: hidden; }
html { overscroll-behavior-y: none; }

body {
  background:
    radial-gradient(ellipse 80% 55% at 50% -12%, rgba(143,100,216,.32), transparent 60%),
    radial-gradient(ellipse 70% 60% at 100% 110%, rgba(212,106,191,.22), transparent 60%),
    linear-gradient(180deg, #07041A 0%, #050211 100%);
  min-height: 100vh;
  min-height: 100dvh;
}

button {
  font: inherit; color: inherit;
  background: transparent; border: 0; cursor: pointer;
}
input, textarea, select { font: inherit; color: inherit; }

.hidden { display: none !important; }

h1, h2, h3, .serif {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600; letter-spacing: .01em;
  color: var(--moon-silver);
}
h1 { font-size: 34px; line-height: 1.12; margin: 0 0 8px; }
h2 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; }
h3 { font-size: 21px; line-height: 1.25; margin: 0 0 6px; }
.lead { font-size: 16px; color: var(--soft); line-height: 1.5; }
.small { font-size: 13px; color: var(--soft); }

/* ============================================================
   STARFIELD
   Тонкий слой "крыша Rolls-Royce": статичные точки +
   мягко мерцающие звёзды + далёкие туманности.
   Сделано CSS-only через radial-gradient точки.
============================================================ */

.sky {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
/* Один статичный SVG-фон: туманности + звёзды нарисованы внутри svg.
   Никаких CSS-animations / filter blur. Браузер растрирует один раз. */
.sky-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Кометы — яркая голова + тающий цветной хвост, разные углы и цвета. */
.shooting-star {
  position: absolute;
  width: 180px; height: 2px;
  border-radius: 999px;
  opacity: 0;
  transform-origin: right center;
  pointer-events: none;
}
.shooting-star::before {
  content: '';
  position: absolute;
  right: -5px; top: -4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(255,250,235,1);
  box-shadow:
    0 0 16px rgba(255,250,230,1),
    0 0 32px rgba(255,236,180,.9),
    0 0 56px rgba(255,210,140,.65);
}

/* Каждая комета — своя траектория в пикселях, угол rotate точно равен
   arctan(dy/dx) траектории, тогда хвост чётко лежит вдоль направления полёта. */

/* Звезда 1 — пологая, верхняя треть. dx=1200, dy=240 → atan(.2)=11.3° */
.shooting-star-1 {
  top: 14%; left: 0;
  background: linear-gradient(to right,
    transparent 0,
    rgba(255,220,150,.5) 40%,
    rgba(255,235,180,.9) 75%,
    rgba(255,250,230,1) 100%);
  filter: drop-shadow(0 0 6px rgba(255,220,150,.95));
  animation: shoot1 7s ease-in infinite;
  animation-delay: 0.5s;
}
@keyframes shoot1 {
  /* dx=900, dy=550 → atan(.61)=31° */
  0%   { transform: translate(-300px, -200px) rotate(31deg); opacity: 0; }
  6%   { opacity: 1; }
  20%  { opacity: 1; }
  28%  { transform: translate(600px, 350px) rotate(31deg); opacity: 0; }
  100% { transform: translate(600px, 350px) rotate(31deg); opacity: 0; }
}

/* Звезда 2 — короткая, верх-средне, круче. dx=1100, dy=440 → atan(.4)=21.8° */
.shooting-star-2 {
  top: 32%; left: 0;
  width: 130px;
  background: linear-gradient(to right,
    transparent 0,
    rgba(255,210,140,.55) 45%,
    rgba(255,235,180,.95) 85%,
    rgba(255,250,230,1) 100%);
  filter: drop-shadow(0 0 6px rgba(255,210,140,.95));
  animation: shoot2 9s ease-in infinite;
  animation-delay: 3s;
}
@keyframes shoot2 {
  /* dx=800, dy=680 → atan(.85)=40° */
  0%   { transform: translate(-300px, -250px) rotate(40deg); opacity: 0; }
  6%   { opacity: 1; }
  20%  { opacity: 1; }
  28%  { transform: translate(500px, 430px) rotate(40deg); opacity: 0; }
  100% { transform: translate(500px, 430px) rotate(40deg); opacity: 0; }
}

/* Звезда 3 — длинная, средне-низ, средний угол. */
.shooting-star-3 {
  top: 50%; left: 0;
  width: 220px;
  background: linear-gradient(to right,
    transparent 0,
    rgba(255,225,160,.45) 35%,
    rgba(255,240,190,.9) 80%,
    rgba(255,250,230,1) 100%);
  filter: drop-shadow(0 0 6px rgba(255,220,150,.9));
  animation: shoot3 8s ease-in infinite;
  animation-delay: 5s;
}
@keyframes shoot3 {
  /* dx=900, dy=620 → atan(.69)=35° */
  0%   { transform: translate(-300px, -220px) rotate(35deg); opacity: 0; }
  6%   { opacity: 1; }
  20%  { opacity: 1; }
  28%  { transform: translate(600px, 400px) rotate(35deg); opacity: 0; }
  100% { transform: translate(600px, 400px) rotate(35deg); opacity: 0; }
}

/* Звезда 4 — самая большая, нижняя треть. dx=1400, dy=350 → atan(.25)=14° */
.shooting-star-4 {
  top: 72%; left: 0;
  width: 260px;
  background: linear-gradient(to right,
    transparent 0,
    rgba(255,200,130,.4) 30%,
    rgba(255,235,180,.9) 80%,
    rgba(255,250,230,1) 100%);
  filter: drop-shadow(0 0 6px rgba(255,210,140,.95));
  animation: shoot4 10s ease-in infinite;
  animation-delay: 7.5s;
}
@keyframes shoot4 {
  /* dx=850, dy=580 → atan(.68)=34° */
  0%   { transform: translate(-300px, -180px) rotate(34deg); opacity: 0; }
  6%   { opacity: 1; }
  20%  { opacity: 1; }
  28%  { transform: translate(550px, 400px) rotate(34deg); opacity: 0; }
  100% { transform: translate(550px, 400px) rotate(34deg); opacity: 0; }
}

/* Системная настройка «уменьшить движение» — отключает декорацию */
@media (prefers-reduced-motion: reduce) {
  .shooting-star, .nav-highlight { animation: none !important; }
  .shooting-star { opacity: 0; }
}

/* ============================================================
   SPLASH
============================================================ */

.splash {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  background: radial-gradient(circle at 50% 45%, #1A0F2C 0%, #050211 60%, #050211 100%);
  z-index: 9999;
  animation: splashOut 1.2s ease 1.4s forwards;
}
.splash-svg, .splash-logo {
  width: 220px; height: 220px;
  object-fit: contain;
  animation: splashIn 1.2s ease both;
}
/* SVG-лого с прозрачным фоном — без квадрата, без blend hacks. */
.splash-title {
  margin-top: 6px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 36px; letter-spacing: .12em;
  color: var(--moon-silver);
  text-shadow: 0 0 22px rgba(192,132,252,.55);
  animation: splashIn 1.4s ease .25s both;
}
@keyframes splashIn { from { opacity: 0; transform: scale(.92);} to { opacity:1; transform:scale(1);} }
@keyframes splashOut { to { opacity: 0; visibility: hidden;} }

/* ============================================================
   APP SHELL
============================================================ */

.app {
  position: fixed;
  inset: 0;
  z-index: 1;
  height: 100vh; height: 100dvh;
  min-height: 0;
  display: flex; flex-direction: column;
  /* safe-top уже в .topbar (через top: var(--safe-top)), не дублируем — иначе hero card опять отодвинется. */
  padding-bottom: 0;
}

.topbar {
  position: absolute;
  top: var(--safe-top); left: 0; right: 0;
  z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 4px 14px;
  background: transparent;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.topbar-back {
  width: 40px; height: 40px;
  border-radius: var(--r-pill);
  display: grid; place-items: center;
  color: var(--moon-silver);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background .2s, transform .12s;
}
.topbar-back:active { transform: scale(.96); }
.topbar-back:hover { background: var(--glass-bg-strong); }
.topbar-title {
  flex: 0 1 auto;
  display: inline-flex; align-items: center; justify-content: center;
  /* текст смещён вниз на 1px внутри острова */
  padding: 6px 20px 4px;
  border-radius: 999px;
  background: rgba(170,120,235,.30);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--moon-silver);
}
.topbar-wordmark {
  height: 30px;
  width: auto;
  object-fit: contain;
  display: block;
}
.topbar-spacer { width: 40px; }

.main {
  flex: 1 1 auto;
  min-height: 0;
  /* padding-top достаточный, чтобы контент не залезал под верхний blur. */
  padding: calc(86px + var(--safe-top)) 18px calc(132px + var(--safe-bot));
  max-width: 760px; width: 100%;
  margin: 0 auto;
  position: relative; /* для абсолютно позиционированного snapshot во время slide */
  overflow-y: auto;
  overflow-x: clip;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
.page { width: 100%; }

/* ============================================================
   STAGGERED PAGE APPEAR.
   Мгновенный swap страницы (без view-transition snapshot — он ломал
   backdrop-filter на Android). Контент новой страницы появляется с
   красивым stagger-эффектом: дочерние блоки въезжают по очереди.
============================================================ */
/* Только transform — opacity убран чтобы parent <section> не становился
   backdrop-root (это ломало backdrop-filter на дочерних .tile в Android). */
@keyframes pageItemIn {
  from { transform: translateY(10px); }
  to   { transform: translateY(0); }
}
/* Каждый прямой ребёнок .page получает stagger-анимацию.
   Длительность короткая, задержка маленькая — суммарно ≤220мс. */
.page > * {
  animation: pageItemIn 260ms cubic-bezier(.22, 1, .36, 1) both;
}
.page > *:nth-child(1) { animation-delay:   0ms; }
.page > *:nth-child(2) { animation-delay:  35ms; }
.page > *:nth-child(3) { animation-delay:  70ms; }
.page > *:nth-child(4) { animation-delay: 100ms; }
.page > *:nth-child(5) { animation-delay: 130ms; }
.page > *:nth-child(6) { animation-delay: 155ms; }
.page > *:nth-child(n+7) { animation-delay: 180ms; }

/* ============================================================
   BOTTOM NAV — Liquid Glass
   Две капсулы: главная (4 кнопки) + профиль (1 кнопка)
============================================================ */

/* ----- bottom nav ----- */
.bottombar {
  position: absolute; left: 0; right: 0;
  bottom: calc(8px + var(--safe-bot));
  display: flex; justify-content: center; align-items: center;
  gap: 10px;
  padding: 0 12px;
  z-index: 60;
  /* НЕ задаём contain/transform/will-change на bottombar — иначе создаётся
     paint context и backdrop-filter на .nav-pill ломается. */
}
/* Blur-слой СВЕРХУ — симметричный nav-bg снизу. Плавно растворяется вниз. */
.top-bg {
  position: fixed;
  left: 0; right: 0; top: 0;
  height: calc(85px + var(--safe-top));
  pointer-events: none;
  z-index: 40;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.8) 35%, rgba(0,0,0,.4) 65%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.8) 35%, rgba(0,0,0,.4) 65%, transparent 100%);
}

/* Blur-слой под навигацией — плавный переход из размытия в нормальный фон. */
.nav-bg {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(140px + var(--safe-bot));
  pointer-events: none;
  z-index: 55;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  /* Плавная маска: внизу полный blur, плавное растворение вверх. */
  -webkit-mask-image: linear-gradient(to top, #000 0%, rgba(0,0,0,.8) 35%, rgba(0,0,0,.4) 65%, transparent 100%);
          mask-image: linear-gradient(to top, #000 0%, rgba(0,0,0,.8) 35%, rgba(0,0,0,.4) 65%, transparent 100%);
}
.nav-pill {
  display: flex; align-items: center;
  padding: 7px;
  border-radius: var(--r-pill);
  background: rgba(70,50,110,.30);
  box-shadow: 0 14px 40px rgba(0,0,0,.45);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  isolation: isolate;
}
/* Android: backdrop-filter в Telegram WebView не работает стабильно — даём
   плотный фон-фолбэк, чтобы пилюля выглядела как тёмное стекло, а не как
   полупрозрачный овал с просвечивающим контентом. */
html.is-android .nav-pill,
html.is-android .nav-bg {
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: backdrop-filter;
}

/* Откатил статичный SVG trick — был псевдо-фон, не настоящий blur. */

/* Android: НЕТ переопределений на .tile/.list-item/.btn-ghost — они используют
   ту же формулу что и .phrase (которая блюрит на Android), и blur работает. */
/* Фолбэк: если backdrop-filter полностью не поддерживается (старые WebView) —
   делаем фон достаточно плотным, чтобы не было «голой полупрозрачности». */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .nav-pill { background: rgba(20,12,38,.86); }
}
.nav-pill-main {
  gap: 4px;
  padding: 7px 14px;
  width: min(288px, calc(100vw - 92px));
  min-width: 0;
  justify-content: space-between;
  position: relative;
}
/* Плавающая подсветка активной кнопки внутри nav-pill-main.
   Позицию/ширину выставляет JS через transform и width; CSS-transition даёт плавное перетекание. */
.nav-highlight {
  position: absolute;
  /* containing-block для absolute = padding-box pill (включая padding!).
     pill padding 7px top/bot → top:7 bottom:7 → height = btn-area height (44px).
     Highlight ровно по кнопке, не вылезает за округлые края pill. */
  top: 7px; bottom: 7px;
  left: 0;
  width: 50px;
  border-radius: var(--r-pill);
  background: radial-gradient(ellipse at 50% 50%, rgba(192,132,252,.55), rgba(139,92,246,.22) 65%, transparent 90%);
  transform: translate3d(0,0,0);
  transition: transform .42s cubic-bezier(.32, 1.02, .42, 1), width .42s cubic-bezier(.32, 1.02, .42, 1), opacity .2s;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
}
.nav-highlight.is-visible { opacity: 1; }
.nav-pill-main .nav-btn { position: relative; z-index: 1; }
.nav-pill-profile { padding: 7px; }
.nav-btn {
  position: relative;
  min-width: 0;
  width: 56px; height: 52px;
  flex: 0 0 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  border-radius: var(--r-pill);
  color: rgba(240,230,255,.78);
  transition: color .1s, background .12s, transform .08s;
  padding: 4px 6px 3px;
}
.nav-pill-main .nav-btn {
  flex: 1 1 0;
  width: auto;
  min-width: 50px;
}
.nav-btn svg {
  width: 28px; height: 28px;
  flex-shrink: 0;
  stroke-width: 1.7;
}
.nav-label {
  font-size: 9px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: .01em;
  white-space: nowrap;
  color: inherit;
  opacity: .85;
}
.nav-btn:active { transform: scale(.94); }
.nav-btn:hover { color: var(--moon-silver); }
/* Активная кнопка: только цвет/glow, никаких изменений размера —
   иначе flex даёт ей всё свободное место и кнопки в pill съезжают. */
.nav-btn.active {
  color: var(--moon-silver);
  border-radius: var(--r-pill);
}
.nav-btn.active svg { filter: drop-shadow(0 0 8px rgba(232,121,249,.85)); }
/* Анимированная подсветка profile-кнопки. ::before — отдельный слой с
   radial-gradient, который плавно появляется + scale-pop с overshoot. */
/* Профиль — квадратная капсула, круг по border-radius pill. */
.nav-pill-profile {
  padding: 7px;
  width: 66px;
  height: 66px;
  box-sizing: border-box;
}
.nav-pill-profile .nav-btn {
  width: 52px;
  min-width: 52px;
  height: 52px;
  flex: 0 0 52px;
  position: relative;
}
.nav-pill-profile .nav-btn::before {
  content: '';
  position: absolute;
  /* -7px компенсируют padding пилюли, подсветка заполняет всю капсулу — параллельно её форме */
  inset: -7px;
  border-radius: var(--r-pill);
  background: radial-gradient(ellipse at 50% 50%, rgba(192,132,252,.65), rgba(139,92,246,.30) 60%, transparent 90%);
  opacity: 0;
  transform: scale(.78);
  transition:
    opacity .26s ease,
    transform .38s cubic-bezier(.32, 1.18, .42, 1);
  pointer-events: none;
  z-index: -1;
}
.nav-pill-profile .nav-btn.active::before {
  opacity: 1;
  transform: scale(1);
}

/* ============================================================
   HERO
============================================================ */

.hero {
  position: relative;
  border-radius: var(--r-xl);
  padding: 30px 24px 28px;
  margin-bottom: 22px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 80% 8%, rgba(192,132,252,.4), transparent 60%),
    radial-gradient(ellipse at 0% 100%, rgba(139,92,246,.28), transparent 65%),
    linear-gradient(160deg, rgba(36,17,61,.78) 0%, rgba(13,8,32,.78) 100%);
  box-shadow:
    0 18px 50px rgba(139,92,246,.18),
    inset 0 1px 0 rgba(255,255,255,.12);
  /* backdrop-filter убран: hero был backdrop-root, что блокировало blur у
     дочерней .btn-ghost внутри неё. Фон уже плотный (.78 opacity), визуально
     разницы почти нет. */
}
.hero::before {
  content: '';
  position: absolute; inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(232,121,249,.35), transparent 40%);
  -webkit-mask: linear-gradient(#000,#000) content-box, linear-gradient(#000,#000);
  -webkit-mask-composite: xor; mask-composite: exclude;
  padding: 1px;
  pointer-events: none;
}
.hero-moon {
  position: absolute;
  right: -34px; top: -28px;
  width: 200px; height: 200px;
  pointer-events: none;
  opacity: .9;
  filter: drop-shadow(0 0 30px rgba(192,132,252,.35));
}
.hero h1 { position: relative; }
.hero .lead { position: relative; max-width: 80%; }
.hero-cta { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }

/* ============================================================
   BUTTONS
============================================================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 15px 24px;
  border-radius: var(--r-pill);
  font-weight: 600; font-size: 16px;
  letter-spacing: .02em;
  transition: transform .08s ease, box-shadow .15s ease, background .15s;
  position: relative;
  overflow: hidden;
}
/* старый skeumorphic блик удалён — frosted glass лук этого не любит */
.btn:active { transform: translateY(1px) scale(.985); }

.btn-primary {
  /* Космический градиент — аметист → фиолет → орхид */
  background: linear-gradient(135deg, #6D28D9 0%, #8B5CF6 50%, #C084FC 100%);
  color: #fff;
  box-shadow: 0 16px 40px rgba(109,40,217,.55);
  text-shadow: 0 1px 0 rgba(0,0,0,.18);
}
@media (hover: hover) { .btn-primary:hover { box-shadow: 0 20px 50px rgba(109,40,217,.7); } }

.btn-ghost {
  background: linear-gradient(180deg, rgba(80,55,130,.50), rgba(60,40,100,.50));
  color: var(--moon-silver);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
@media (hover: hover) { .btn-ghost:hover { background: rgba(80,55,130,.65); } }
/* Android: без override */

.btn-gold {
  background: linear-gradient(135deg, #E6C58A 0%, #D46ABF 110%);
  color: #1A0F2C;
  box-shadow: 0 14px 32px rgba(230,197,138,.35);
}
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 11px 18px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ============================================================
   SECTIONS, PHRASE
============================================================ */

.section { margin-bottom: 26px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.section-title h2 { margin: 0; }
.section-title .small { color: var(--soft); }

.phrase {
  font-family: 'Inter', system-ui, sans-serif;
  font-style: italic;
  font-size: 20px; line-height: 1.45;
  color: var(--moon-silver);
  padding: 20px 22px;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(50,30,82,.45), rgba(34,20,52,.45));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin-bottom: 22px;
  position: relative;
}
.phrase::before {
  content: '✦';
  position: absolute; right: 18px; top: 14px;
  color: rgba(232,121,249,.7);
  text-shadow: 0 0 10px rgba(232,121,249,.6);
  font-size: 14px;
}

/* ============================================================
   TILES (темы / расклады)
============================================================ */

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.tile {
  position: relative;
  padding: 18px 16px 16px;
  border-radius: 32px;
  /* iOS-стиль: едва заметная фиолетовая плёнка на blur, минимум контраста. */
  background: rgba(76,29,149,.14);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  text-align: left;
  transition: background .15s;
  min-height: 122px;
  display: flex; flex-direction: column; justify-content: space-between;
}
/* Android: НЕ переопределяем фон — пусть blur пытается работать. */
.tile-icon { border-radius: 14px; }
@media (hover: hover) {
  .tile:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,.10);
  }
}
.tile:active { background: rgba(255,255,255,.05); }
.tile-head {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; margin-bottom: 8px;
  text-align: center;
}
.tile-icon {
  width: auto; height: auto;
  display: grid; place-items: center;
  background: transparent;
  color: var(--pink-soft);
  flex-shrink: 0;
  box-shadow: none;
  font-size: 28px; font-weight: 500;
  margin-bottom: 8px;
}
.tile-icon svg {
  width: 42px; height: 42px; display: block;
  stroke-width: 1.6;
}
.tile-name { font-family: 'Inter', system-ui, sans-serif; font-size: 22px; line-height: 1.1; color: var(--moon-silver); }
.tile-desc { font-size: 13px; color: var(--soft); line-height: 1.4; text-align: center; }
.tile-meta { margin-top: 10px; font-size: 12px; color: var(--soft); }
.tile-price {
  color: #9CFF3A;
  font-weight: 400;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 18px;
  letter-spacing: -.01em;
}
.tile-price.free { color: #FFD93D; font-weight: 600; }
/* Золотой glow на платных тайлах убран. */

/* ============================================================
   LIST
============================================================ */

.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px;
  border-radius: 28px;
  background: rgba(76,29,149,.14);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  text-align: left;
  transition: background .15s;
  cursor: pointer;
}
/* Android: см. выше — без override */
@media (hover: hover) {
  .list-item:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,.10);
  }
}
.list-item .text { flex: 1; }
.list-item .meta { font-size: 12px; color: var(--soft); margin-top: 4px; }
.list-item .arr { color: var(--lilac-soft); font-size: 22px; line-height: 1; }

/* ============================================================
   GENDER TOGGLE
============================================================ */

.gender-toggle {
  display: inline-flex;
  border-radius: var(--r-pill);
  padding: 4px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  margin-bottom: 16px;
  gap: 2px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.gender-toggle button {
  padding: 8px 16px;
  border-radius: var(--r-pill);
  color: var(--soft);
  font-size: 13px;
  transition: background .25s, color .25s;
}
.gender-toggle button.active {
  background: linear-gradient(135deg, #A47FE6, #D46ABF);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(192,132,252,.4);
}

/* ============================================================
   CONFIRM
============================================================ */

.confirm-card {
  border-radius: 30px;
  padding: 24px 22px;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.02)),
              linear-gradient(180deg, rgba(36,17,61,.78), rgba(15,8,28,.82));
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 18px 50px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.1);
  margin-bottom: 18px;
}
.price-row { display: flex; align-items: baseline; justify-content: space-between; margin-top: 14px; }
.price-row .price {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 36px;
  font-weight: 300;
  color: #9CFF3A;
  letter-spacing: -.02em;
}
.price-row.free .price { color: #FFD93D; font-weight: 500; }

.email-input-row {
  display: flex; flex-direction: column; gap: 6px; margin: 12px 0;
}
.email-input-row label { font-size: 13px; color: var(--soft); }
.email-input-row input,
.support-input,
.support-textarea {
  background: rgba(9,6,17,.55);
  border: 1px solid var(--glass-border);
  color: var(--moon-silver);
  padding: 13px 16px;
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.email-input-row input:focus,
.support-textarea:focus,
.support-input:focus {
  border-color: var(--pink-glow);
  box-shadow: 0 0 0 3px rgba(192,132,252,.18);
}

/* ============================================================
   GENERATION — карты вылетают из стопки + переворачиваются
============================================================ */

.gen-stage {
  position: relative;
  min-height: 460px;
  padding: 40px 8px 18px;
  display: flex; flex-direction: column; align-items: center;
}
.gen-canvas {
  position: relative;
  width: 100%;
  max-width: 360px;
  height: 320px;
}
.gen-card {
  /* Каждая карта переезжает к своей финальной позиции через CSS-переменные. */
  position: absolute;
  left: 50%; top: 50%;
  width: 110px; height: 168px;
  margin-left: -55px; margin-top: -84px;
  border-radius: 14px;
  transform-style: preserve-3d;
  perspective: 900px;
  transform: translate3d(var(--dx, 0), var(--dy, 0), 0) rotate(var(--rot, 0deg)) scale(var(--scale, 1));
  transition:
    transform 900ms cubic-bezier(.5,.05,.2,1),
    filter   400ms ease;
  filter: drop-shadow(0 16px 30px rgba(0,0,0,.55));
  z-index: var(--z, 1);
}
.gen-card.in-deck {
  --dx: 0px; --dy: 0px; --rot: var(--deck-rot, 0deg); --scale: 1;
}
.gen-card.flying {
  --dx: var(--tx); --dy: var(--ty); --rot: var(--tr, 0deg); --scale: 1;
}
.gen-card-inner {
  position: relative;
  width: 100%; height: 100%;
  transition: transform 700ms cubic-bezier(.5,.05,.2,1);
  transform-style: preserve-3d;
}
.gen-card.flipped .gen-card-inner { transform: rotateY(180deg); }
.gen-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #2A1547, #160B26);
  box-shadow: inset 0 0 0 1px rgba(232,121,249,.35);
  display: grid; place-items: center;
}
.gen-face.front { transform: rotateY(180deg); padding: 10px; text-align: center; }
.gen-face.front .name {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px; color: var(--moon-silver);
  text-shadow: 0 0 12px rgba(232,121,249,.45);
}
.gen-face.front.reversed { transform: rotateY(180deg) rotate(180deg); }
.gen-face .back-svg { width: 100%; height: 100%; }

.gen-deck-glow {
  position: absolute;
  left: 50%; top: 50%;
  width: 200px; height: 200px; margin: -100px 0 0 -100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(192,132,252,.35), transparent 60%);
  filter: blur(20px);
  animation: deckPulse 3.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes deckPulse { 0%,100% { opacity: .55; transform: scale(.95);} 50% { opacity: 1; transform: scale(1.05);} }

.gen-meta {
  text-align: center;
  margin-top: 24px;
}
.gen-text {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 22px; letter-spacing: .04em;
  color: var(--moon-silver);
  text-shadow: 0 0 16px rgba(192,132,252,.4);
  margin-bottom: 6px;
}
.gen-sub { color: var(--soft); font-size: 13px; }
.gen-dots {
  display: inline-flex; gap: 6px; margin-top: 14px;
}
.gen-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(232,121,249,.45);
  animation: dotPulse 1.4s ease-in-out infinite;
}
.gen-dots span:nth-child(2) { animation-delay: .2s; }
.gen-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dotPulse { 0%,100% { transform: scale(.7); opacity: .45;} 50% { transform: scale(1.1); opacity: 1;} }

/* ============================================================
   RESULT
============================================================ */

.result-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  margin: 18px 0 24px;
}
.r-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 10px 10px 12px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(36,17,61,.55), rgba(15,8,28,.65));
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 8px 22px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.06);
  position: relative;
  overflow: hidden;
}
.r-card .position-title {
  font-size: 11px;
  color: var(--soft);
  text-align: center;
  min-height: 30px;
  line-height: 1.25;
  word-break: break-word;
  hyphens: auto;
  padding: 0 2px;
}
.r-card .name {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.2;
  color: var(--moon-silver);
  text-align: center;
  word-break: break-word;
}
.r-card.reversed .reversed-badge {
  position: absolute; top: 6px; right: 6px;
  background: rgba(232,121,249,.18);
  border: 1px solid rgba(232,121,249,.4);
  color: var(--soft);
  border-radius: var(--r-pill);
  padding: 2px 8px;
  font-size: 10px;
  letter-spacing: .04em;
}
.card-front-svg, .card-back-svg { width: 100%; height: auto; aspect-ratio: 100/160; }

.result-block {
  padding: 20px 20px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02)),
              linear-gradient(180deg, rgba(22,11,38,.7), rgba(13,8,28,.75));
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 24px rgba(0,0,0,.3);
  margin-bottom: 14px;
}
.result-block h3 { margin-top: 0; }
.result-block .label {
  font-size: 11px; letter-spacing: .18em;
  color: var(--pink-soft);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.result-block p { margin: 0; line-height: 1.55; color: var(--moon-silver); }
.result-cards-detail .position-row {
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.result-cards-detail .position-row:last-child { border-bottom: 0; }
.result-cards-detail .pname { color: var(--soft); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; }
.result-cards-detail .cname { font-family: 'Inter', system-ui, sans-serif; font-size: 20px; color: var(--moon-silver); margin: 4px 0; }
.result-cards-detail .pmean { font-size: 15px; line-height: 1.55; color: var(--moon-silver); }

/* ============================================================
   EMPTY / TOAST / LOADER
============================================================ */

.empty {
  text-align: center;
  padding: 44px 16px;
  color: var(--soft);
}
.empty .moon { font-size: 38px; margin-bottom: 6px; }

.toast {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%);
  padding: 12px 18px;
  background: rgba(36,17,61,.92);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-pill);
  color: var(--moon-silver);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 200;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: rgba(227,111,140,.7); }
.toast.success { border-color: rgba(151,226,192,.6); }

.loader {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(139,92,246,.18);
  border-top-color: var(--pink-glow);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   PAYMENT WAIT
============================================================ */

.pay-wait {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 40px 18px;
  text-align: center;
}
.pay-status {
  font-size: 14px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--soft);
}
.pay-status.success { background: rgba(151,226,192,.15); color: var(--success); border-color: rgba(151,226,192,.4); }
.pay-status.error { background: rgba(227,111,140,.16); color: var(--error); border-color: rgba(227,111,140,.45); }

/* ============================================================
   MISC
============================================================ */

.divider { height: 1px; background: rgba(255,255,255,.08); margin: 22px 0; }
.row-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }

@media (min-width: 480px) {
  .tiles { grid-template-columns: 1fr 1fr 1fr; }
}
