/* US B/1–B/6 guided onboarding paywall — design frames 402×822 (ui-us.pen B/*) */

:root {
  --design-w: 402;
  --design-h: 822;
  --color-title: #f8fafc;
  --color-subtitle: rgba(255, 255, 255, 0.8);
  --color-cta-text: #ffffff;
  --color-cta-bg: #868054;
  --color-cta-stroke: rgba(255, 248, 240, 0.67);
  --shadow-cta: 0 12px 24px rgba(75, 51, 44, 0.4);
  --shade-bottom: rgba(143, 108, 89, 0.68);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  /*
   * Safe area: Android WebView usually reports env(safe-area-inset-*) as 0.
   * Flutter injects --native-safe-* from MediaQuery.viewPadding (logical px).
   */
  --native-safe-top: 0px;
  --native-safe-right: 0px;
  --native-safe-bottom: 0px;
  --native-safe-left: 0px;
  --safe-top: max(var(--native-safe-top), env(safe-area-inset-top, 0px));
  --safe-right: max(var(--native-safe-right), env(safe-area-inset-right, 0px));
  --safe-bottom: max(var(--native-safe-bottom), env(safe-area-inset-bottom, 0px));
  --safe-left: max(var(--native-safe-left), env(safe-area-inset-left, 0px));
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --page-ms: 480ms;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  font-family: var(--font);
  background: #1a1410;
  color: var(--color-title);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body {
  overflow: hidden;
}

/* Hide stage until images are preloaded (avoids empty-image flash). */
html:not(.is-assets-ready) .stage {
  opacity: 0;
}

html.is-assets-ready .stage {
  opacity: 1;
}


.stage {
  min-height: 100%;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 0;
}

.phone {
  width: 100%;
  height: 100%;
  max-width: none;
  position: relative;
}

.paywall {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #2a211c;
  isolation: isolate;
  --u: calc(100% / var(--design-w));
  --v: calc(100% / var(--design-h));
}

/* —— Feature stack (B/1–B/5) —— */
.feature-stack {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  transition: opacity var(--page-ms) var(--ease-out);
}

.paywall.is-pro .feature-stack {
  opacity: 0;
  pointer-events: none;
}

.feature {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateX(18px) scale(0.985);
  transition:
    opacity var(--page-ms) var(--ease-out),
    transform var(--page-ms) var(--ease-out),
    visibility 0s linear var(--page-ms);
  content-visibility: hidden;
  contain: layout paint style;
  pointer-events: none;
}

.feature.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateX(0) scale(1);
  transition:
    opacity var(--page-ms) var(--ease-out),
    transform var(--page-ms) var(--ease-out),
    visibility 0s linear 0s;
  content-visibility: visible;
}

.paywall.is-animating .feature.is-active,
.paywall.is-animating .feature.is-exit-left {
  will-change: opacity, transform;
}

.feature.is-exit-left {
  opacity: 0;
  visibility: visible;
  transform: translateX(-22px) scale(0.985);
  transition:
    opacity var(--page-ms) var(--ease-out),
    transform var(--page-ms) var(--ease-out);
}

.feature.is-enter-right {
  opacity: 0;
  transform: translateX(28px) scale(0.99);
}

/* Full-bleed photo bg — design B/1: image -13,0 417×822 on 402×822 */
.feature__bg {
  position: absolute;
  /* Slight overscan matches design node vXhjA (-13 / 417) */
  left: calc(-13 * var(--u));
  top: 0;
  width: calc(417 * var(--u));
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.feature__bg-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  user-select: none;
  -webkit-user-drag: none;
}

.feature.is-active .feature__bg-img {
  animation: heroIn 0.55s var(--ease-out) both;
}

/* Bottom shade — design bEAhh: y497 h325, brown → transparent upward */
.feature__shade {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(497 * var(--v));
  height: calc(325 * var(--v));
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    to top,
    var(--shade-bottom) 0%,
    rgba(143, 108, 89, 0.35) 42%,
    transparent 100%
  );
}

/* Copy — design Title y537, Subtitle y625.5 */
.feature__copy {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(537 * var(--v));
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 calc(30 * var(--u));
  text-align: center;
  pointer-events: none;
}

.feature.is-active .feature__copy {
  animation: contentIn 0.65s var(--ease-out) 0.06s both;
}

.feature__copy--tight {
  top: calc(555.5 * var(--v));
}

.feature__title {
  margin: 0;
  max-width: 334px;
  width: 100%;
  color: var(--color-title);
  font-size: clamp(28px, 8.5vw, 34px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 16px rgba(40, 24, 16, 0.35);
}

.feature__subtitle {
  margin: 14px 0 0;
  max-width: 340px;
  color: var(--color-subtitle);
  font-size: clamp(14px, 4vw, 16px);
  font-weight: 500;
  line-height: 1.45;
  text-shadow: 0 1px 10px rgba(40, 24, 16, 0.3);
}

/* —— Continue footer —— */
.paywall__footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding:
    0 calc(34 * var(--u))
    max(18px, calc(var(--safe-bottom) + 16px));
  text-align: center;
  transition:
    opacity var(--page-ms) var(--ease-out),
    transform var(--page-ms) var(--ease-out);
}

.paywall__footer--continue {
  gap: 12px;
}

.paywall.is-pro .paywall__footer--continue {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}

.paywall__dots {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  height: 10px;
  margin-top: 2px;
}

.paywall__dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 248, 240, 0.28);
  transition:
    width 0.28s var(--ease-out),
    background 0.28s ease;
}

.paywall__dot.is-active {
  width: 16px;
  background: rgba(255, 248, 240, 0.92);
}

/* CTA — design Hrxex: #868054, r28, stroke #FFF8F0AA, shadow 0 12 24 */
.paywall__cta {
  position: relative;
  width: min(334px, 100%);
  height: 56px;
  min-height: 56px;
  border: 1px solid var(--color-cta-stroke);
  border-radius: 28px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--color-cta-text);
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  background: var(--color-cta-bg);
  box-shadow: var(--shadow-cta);
  transition:
    transform 0.18s var(--ease-out),
    box-shadow 0.18s ease,
    filter 0.18s ease;
}

.paywall__cta--continue {
  background: var(--color-cta-bg);
}

.paywall__cta--trial {
  width: 100%;
  max-width: 358px;
  height: 56px;
  min-height: 56px;
  border: 1px solid rgba(255, 248, 240, 0.67);
  border-radius: 28px;
  font-size: 16px;
  background: #fbab66;
  box-shadow: 0 12px 24px rgba(180, 100, 40, 0.35);
}

.paywall__cta::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    105deg,
    transparent 35%,
    rgba(255, 255, 255, 0.28) 50%,
    transparent 65%
  );
  transform: translateX(-120%);
  animation: ctaShimmer 3.6s ease-in-out 1.2s infinite;
  pointer-events: none;
}

.paywall__cta-label,
.paywall__cta-spinner {
  position: relative;
  z-index: 1;
}

.paywall__cta:hover {
  filter: brightness(1.05);
}

.paywall__cta:active {
  transform: scale(0.975);
}

.paywall__cta:focus-visible {
  outline: 3px solid rgba(255, 248, 240, 0.45);
  outline-offset: 3px;
}

.paywall__cta[disabled],
.paywall.is-busy .paywall__cta--trial {
  cursor: progress;
  filter: saturate(0.92);
}

.paywall__cta-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

.paywall.is-busy .paywall__cta-spinner {
  display: inline-block;
}

.paywall.is-busy .paywall__cta-label {
  opacity: 0.92;
}

.paywall__legal {
  margin: 12px 0 0;
  color: rgba(255, 248, 240, 0.72);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  opacity: 0.9;
}

/* Close */
.paywall__close {
  position: absolute;
  top: calc(var(--safe-top) + 10px);
  right: max(14px, calc(var(--safe-right) + 10px));
  z-index: 20;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #5a4030;
  background: rgba(255, 248, 240, 0.9);
  box-shadow: 0 4px 14px rgba(40, 24, 16, 0.18);
  cursor: pointer;
  opacity: 0;
  transform: scale(0.9);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    background 0.15s ease;
}

.paywall__close:not([hidden]) {
  opacity: 1;
  transform: scale(1);
}

.paywall__close:active {
  transform: scale(0.94);
}

/* Error */
.paywall__error {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: max(88px, calc(var(--safe-bottom) + 88px));
  z-index: 15;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(40, 24, 16, 0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.paywall__error[hidden] {
  display: none;
}

/* —— PRO page (B/6 design tDPfu; no price card) —— */
.pro {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding:
    max(24px, calc(var(--safe-top) + 16px))
    calc(20 * var(--u))
    max(14px, calc(var(--safe-bottom) + 14px));
  opacity: 0;
  visibility: hidden;
  transform: translateY(24px) scale(0.98);
  pointer-events: none;
  transition:
    opacity var(--page-ms) var(--ease-out),
    transform var(--page-ms) var(--ease-out),
    visibility 0s linear var(--page-ms);
}

.pro__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.pro__bg-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  user-select: none;
  -webkit-user-drag: none;
}

.paywall.is-pro .pro {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  transition:
    opacity var(--page-ms) var(--ease-out),
    transform var(--page-ms) var(--ease-out),
    visibility 0s linear 0s;
}

.pro__card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 393px;
  margin: 0 auto;
  padding: 12px 8px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  color: #fff6e7;
}

.pro__logo {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ffd6a8 0%, #fbab66 100%);
  border: 1px solid rgba(255, 240, 214, 0.8);
  color: #7c493e;
  flex-shrink: 0;
  box-shadow: 0 10px 28px rgba(180, 100, 40, 0.28);
}

.pro__features {
  width: 100%;
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.pro__chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-height: 74px;
  padding: 12px 4px 8px;
  border-radius: 14px;
  background: rgba(255, 247, 230, 0.2);
  border: 1px solid rgba(255, 226, 184, 0.18);
  color: #fff6e7;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.pro__chip span {
  max-width: 68px;
}

.pro__perks {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
}

.pro__perk {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 244, 217, 0.85);
  border: 1px solid rgba(255, 209, 156, 0.6);
  box-shadow: 0 6px 16px rgba(120, 60, 20, 0.08);
}

.pro__perk-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: #fff0d2;
  border: 1px solid #ffd6a5;
}

.pro__perk-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pro__perk-copy strong {
  color: #5a3a28;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
}

.pro__perk-copy em {
  color: #8a6048;
  font-size: 11px;
  font-style: normal;
  font-weight: 500;
  line-height: 1.25;
}

.pro__footer {
  width: 100%;
  margin-top: auto;
  padding-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pro .paywall__legal {
  color: rgba(255, 246, 231, 0.72);
}

/* —— Motion —— */
@keyframes heroIn {
  from {
    opacity: 0;
    transform: scale(1.04);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes contentIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ctaShimmer {
  0%,
  55% {
    transform: translateX(-120%);
  }
  80%,
  100% {
    transform: translateX(120%);
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .feature,
  .feature-stack,
  .pro,
  .paywall__footer--continue,
  .feature__bg-img,
  .feature.is-active .feature__copy,
  .paywall__cta::before {
    animation: none !important;
    transition: none !important;
  }

  .feature,
  .feature.is-active {
    transform: none;
  }
}

@media (min-aspect-ratio: 9/18) {
  .paywall__footer {
    padding-bottom: max(28px, calc(var(--safe-bottom) + 20px));
  }
}

@media (max-height: 700px) {
  .feature__title {
    font-size: 28px;
  }

  .feature__subtitle {
    margin-top: 8px;
    font-size: 14px;
  }

  .paywall__cta {
    height: 52px;
  }

  .feature__copy {
    top: calc(500 * var(--v));
  }
}
