/* ============================================================
   Kegel Funnel — дизайн-система и компоненты
   Тёмная "мужская" тема под бренд приложения (чёрный фон,
   красный бренд-акцент, mint CTA-кнопки, конденсированные
   заголовки). Структура вёрстки — как в исходном funnel.
   Меняете бренд → правьте переменные в :root ниже.
   ============================================================ */

:root {
  /* Раскладка */
  --max-width: 450px;
  --pad-x: 24px;
  --gap: 16px;          /* вертикальный ритм между блоками */
  --radius: 16px;

  /* Цвета (тёмная тема) */
  --color-bg: #050505;
  --color-bg-elev: #121212;
  --color-text: #ffffff;
  --color-text-muted: rgba(255, 255, 255, 0.6);
  --color-card: #141414;
  --color-border: rgba(255, 255, 255, 0.1);

  --color-accent: #19d6a6;        /* mint — главные CTA (как кнопки Start/Save в приложении) */
  --color-accent-text: #04150f;
  --color-brand: #ff2233;         /* красный бренд-акцент (как иконка/свечение) */
  --color-free: #ff2233;          /* хайлайт слова "free" */
  --color-star: #ff2233;
  --color-link: #0a84ff;          /* синие ссылки как в App Store (dark) */

  /* Кнопка */
  --btn-height: 56px;

  /* Шрифты */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Anton", "Inter", sans-serif;  /* конденсированные заголовки */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Центрированная узкая колонка + фирменное красное свечение по краям (как на скринах) */
.app {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background:
    radial-gradient(120% 60% at 50% 100%, rgba(255, 34, 51, 0.18), transparent 60%),
    radial-gradient(100% 40% at 50% 0%, rgba(255, 34, 51, 0.10), transparent 70%),
    var(--color-bg);
}

/* ---------- Экраны ---------- */
.screen { display: none; padding: 0 var(--pad-x) 48px; }
.screen.active { display: block; }

/* ---------- Шапка с кнопкой "назад" ---------- */
.app-header {
  height: 48px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(var(--color-bg), rgba(5, 5, 5, 0));
}
.back-btn {
  border: 0;
  background: transparent;
  padding: 8px;
  margin-left: -8px;
  cursor: pointer;
  color: var(--color-text);
  line-height: 0;
}
.back-btn[hidden] { display: none; }
.back-btn svg { width: 24px; height: 24px; }

/* ---------- Типографика ---------- */
h1, h2, h3, p { margin: 0; }
.h1 {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-align: center;
}
.h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.p  { font-size: 16px; font-weight: 400; line-height: 1.5; }
.muted { color: var(--color-text-muted); }
.center { text-align: center; }
.left { text-align: left; }
.free { color: var(--color-free); }
.block { margin-top: var(--gap); }
.block-lg { margin-top: 28px; }

/* ---------- Кнопки ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--btn-height);
  padding: 5px 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--color-accent);
  color: var(--color-accent-text);
  font-family: var(--font);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn:active { transform: translateY(1px); }
.btn .btn-sub { font-size: 12px; font-weight: 500; opacity: 0.85; }
.btn-col { flex-direction: column; gap: 2px; }

/* HTML-атрибут hidden должен скрывать кнопку (иначе .btn display:flex перебивает) */
.btn[hidden] { display: none; }

/* Светлая кнопка-кошелёк (Apple/Google Pay стиль на тёмном фоне) */
.btn-wallet { background: #ffffff; color: #000000; }
.btn-wallet .wallet-logo { display: inline-flex; align-items: center; }
.btn-wallet .wallet-logo svg { height: 20px; width: auto; }

/* Пульсирующая кнопка (экран Finish) */
.btn-pulse { animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(25, 214, 166, 0.5); }
  70%  { box-shadow: 0 0 0 14px rgba(25, 214, 166, 0); }
  100% { box-shadow: 0 0 0 0 rgba(25, 214, 166, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .btn-pulse { animation: none; }
}

/* ---------- Изображения + плейсхолдеры ---------- */
.ph {
  aspect-ratio: var(--ar, 1);
  background: var(--color-card);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.ph::before {
  content: attr(data-label);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted);
  z-index: 0;
}
.ph img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ph.no-radius { border-radius: 0; }
.ph.contain img { object-fit: contain; }
.ph.contain { background: transparent; }

/* ---------- HERO (экран Intro) ---------- */
.hero {
  display: grid;
  grid-template-columns: 48fr 52fr;
  gap: 14px;
  align-items: center;
  padding: 6px 0 4px;
}
.hero-icon { width: 100%; }
.hero-icon .ph {
  border-radius: 22px;
  border: 1px solid var(--color-border);
}
.hero-text { display: flex; flex-direction: column; gap: 4px; }
.hero-text .btn { margin-top: 8px; }

/* ---------- Ряд статистики ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-top: 20px;
}
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.stat + .stat { border-left: 1px solid var(--color-border); }
.stat .stat-label { font-size: 13px; letter-spacing: 0.3px; color: var(--color-text-muted); }
.stat .stat-value { font-size: 20px; font-weight: 700; color: var(--color-text); }
.stat .stat-sub   { font-size: 12px; color: var(--color-text-muted); }
.stars { display: flex; gap: 2px; }
.stars svg { width: 13px; height: 13px; fill: var(--color-star); }

/* ---------- Карусель ---------- */
.carousel { margin-top: 20px; }
.carousel-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
}
.carousel-slide .ph { --ar: 1290/2796; border-radius: 22px; border: 1px solid var(--color-border); }
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-text-muted);
  opacity: 0.35;
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}
.dot.active { opacity: 1; transform: scale(1.25); background: var(--color-brand); }

/* ---------- Ratings & Reviews ---------- */
.reviews-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  margin-top: 8px;
}
.reviews-score { display: flex; flex-direction: column; align-items: center; }
.reviews-score .score-big { font-family: var(--font-display); font-size: 56px; line-height: 1; }
.reviews-score .score-stars { display: flex; gap: 2px; margin-top: 4px; }
.reviews-score .score-stars svg { width: 14px; height: 14px; fill: var(--color-star); }
.reviews-score .score-out { color: var(--color-text-muted); font-size: 13px; margin-top: 4px; }

/* Распределение оценок — чистый CSS вместо картинки */
.rating-bars { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.rating-bar { display: flex; align-items: center; gap: 8px; }
.rating-bar .rb-label { font-size: 12px; color: var(--color-text-muted); width: 10px; text-align: right; }
.rating-bar .rb-track {
  display: block;
  flex: 1;
  height: 6px;
  border-radius: 100px;
  background: var(--color-border);
  overflow: hidden;
}
.rating-bar .rb-fill {
  display: block;
  height: 100%;
  border-radius: 100px;
  background: var(--color-star);
}

/* Текстовые отзывы (картинок отзывов нет — собираем карточками) */
.review-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
  text-align: left;
}
.review-card .rc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.review-card .rc-title { font-size: 15px; font-weight: 700; }
.review-card .rc-date { font-size: 13px; color: var(--color-text-muted); white-space: nowrap; }
.review-card .rc-sub { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 8px; }
.review-card .rc-stars { display: flex; gap: 2px; }
.review-card .rc-stars svg { width: 13px; height: 13px; fill: var(--color-star); }
.review-card .rc-author { font-size: 13px; color: var(--color-text-muted); }
.review-card .rc-text { font-size: 15px; line-height: 1.5; }

/* ---------- App Store: What's New / Information / Supports ---------- */
.store-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.store-link { color: var(--color-link); font-size: 15px; font-weight: 500; cursor: default; }
.store-meta { display: flex; justify-content: space-between; margin-top: 4px; font-size: 14px; color: var(--color-text-muted); }
.store-meta + .p { margin-top: 8px; }

.info-list { margin: 8px 0 0; padding: 0; }
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}
.info-row dt { color: var(--color-text-muted); font-size: 15px; flex: 0 0 auto; }
.info-row dd { margin: 0; font-size: 15px; text-align: right; }
.info-row.info-link { align-items: center; }
.info-link .store-link { font-weight: 400; }
.info-icon { width: 18px; height: 18px; color: var(--color-link); fill: currentColor; flex: 0 0 auto; }

.supports-row { display: flex; align-items: flex-start; gap: 12px; margin-top: 10px; }
.supports-icon { width: 40px; height: 40px; flex: 0 0 auto; color: var(--color-text); }
.supports-title { font-weight: 600; }
.supports-text { font-size: 14px; margin-top: 2px; }

/* ---------- Checkout ---------- */
/* Тёмная стеклянная панель вокруг формы оплаты */
.pay-card {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-top-color: rgba(255, 255, 255, 0.18); /* тонкий светлый хайлайт сверху */
  border-radius: 20px;
  padding: 18px;
  margin-top: 20px;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  max-width: 100%;
}
.pay-methods { display: flex; flex-direction: column; gap: 12px; margin-top: 0; max-width: 100%; }
.pay-email {
  width: 100%;
  max-width: 100%;
  padding: 12px 14px;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #fff;
  font-family: inherit;
  font-size: 16px; /* >=16px, чтобы iOS Safari не зумил при фокусе */
}
.pay-email::placeholder { color: #777; }
.pay-email:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(25, 214, 166, 0.25);
}
.pay-bullets { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pay-bullets li {
  position: relative;
  padding-left: 26px;
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.4;
}
.pay-bullets li::before {
  content: "";
  position: absolute;
  left: 0; top: 1px;
  width: 18px; height: 18px;
  background: var(--color-accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.pay-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: center;
}
.pay-footer svg { width: 14px; height: 14px; fill: currentColor; flex: 0 0 auto; }
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0;
  color: var(--color-text-muted);
  font-size: 13px;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ---------- Finish ---------- */
.finish-icon { width: 120px; margin: 24px auto 0; }
.finish-icon .ph {
  --ar: 1;
  border-radius: 24px;
  border: 1px solid var(--color-border);
}
.steps {
  list-style: none;
  counter-reset: step;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 28px;
  text-align: left;
  line-height: 1.5;
}
.steps li::before {
  content: counter(step) ".";
  position: absolute;
  left: 0;
  font-weight: 700;
  color: var(--color-accent);
}
.finish-cta { margin-top: 28px; }

/* ---------- Stripe ---------- */
/* Лоудер в слоте CTA, пока определяется доступность Apple Pay */
.cta-loader { height: 56px; margin-top: 8px; display: flex; align-items: center; justify-content: center; }
.cta-loader[hidden] { display: none; }
.cta-loader .spinner {
  width: 24px; height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #19d6a6;
  border-radius: 50%;
  animation: cta-spin 0.7s linear infinite;
}
@keyframes cta-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cta-loader .spinner { animation-duration: 1.4s; } }

/* Единая кнопка: видимый визуал + невидимая нативная Apple Pay поверх */
.wallet-cta {
  position: relative;
  margin-top: 8px;
  height: 56px;
  border-radius: var(--radius);
  overflow: hidden;
}
.wallet-cta[hidden] { display: none; }
.wallet-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100%;
  background: #ffffff; /* белая кнопка с чёрным текстом */
  color: #000000;
  font-size: 18px;
  font-weight: 700;
}
/* Нативная Apple Pay кнопка поверх — почти невидима, но ловит тап (требование Apple) */
.wallet-native { position: absolute; inset: 0; z-index: 2; opacity: 0.02; }
.wallet-native > * { height: 100%; }
.trial-note { font-size: 13px; margin-top: 8px; }
#payment-element { margin-top: 8px; }
#payment-form .btn { margin-top: 16px; }
.pay-error {
  color: #ff5a5f;
  font-size: 14px;
  line-height: 1.4;
  margin-top: 10px;
  text-align: center;
}

/* Единственный яркий акцент экрана checkout — mint-градиентная CTA-кнопка */
.btn-cta {
  background: linear-gradient(135deg, #1fe0b0, #0fbf8f);
  color: var(--color-accent-text);
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: 0 10px 30px rgba(25, 214, 166, 0.35);
}
@media (prefers-reduced-motion: no-preference) {
  .btn-cta { transition: transform 0.15s ease, box-shadow 0.15s ease; }
}
.btn-cta:active { transform: scale(0.985); }
