/* ==========================================================================
   Funnel UI — light theme, hand-tuned
   Contract: class names are rendered by assets/js/app.js — do not rename.
   Theming: app.js sets --accent on :root per funnel.
   Color psychology: accent = action only; green = safety/guarantee;
   amber = urgency/scarcity; red = loss (anchor price, errors); ink on
   warm white everywhere else. Minimal chrome, satisfying motion.
   ========================================================================== */

:root {
  --accent: #7c5cff;

  /* Derived accent tones — keep every funnel accent harmonious on white */
  --accent-ink: color-mix(in srgb, var(--accent) 78%, #101423);
  --accent-bright: color-mix(in srgb, var(--accent) 82%, #ffffff);
  --accent-tint: color-mix(in srgb, var(--accent) 8%, #ffffff);
  --accent-tint-2: color-mix(in srgb, var(--accent) 16%, #ffffff);
  --accent-line: color-mix(in srgb, var(--accent) 38%, #ffffff);
  --accent-glow: color-mix(in srgb, var(--accent) 26%, transparent);

  --bg: #f6f7fb;
  --card: #ffffff;
  --well: #f3f5f9;          /* recessed neutral surfaces inside the card */
  --line: #e7eaf1;
  --line-strong: #d7dce7;

  --text: #131a2a;
  --text-2: #4d566b;
  --text-3: #8b93a7;

  --good: #16a34a;
  --good-ink: #14532d;
  --good-tint: #e9f8ef;
  --good-line: #bfe8cd;
  --warn-ink: #8a4b06;
  --warn-tint: #fdf3e0;
  --warn-line: #f3ddb0;
  --bad: #e11d48;

  --ring-track: #e9ecf3;    /* loader ring unfilled track (read by app.js) */

  --radius-card: 26px;
  --radius-control: 15px;

  --shadow-card:
    0 1px 2px rgba(19, 26, 42, 0.04),
    0 24px 60px -24px rgba(19, 26, 42, 0.18),
    0 40px 90px -50px var(--accent-glow);
  --shadow-control: 0 10px 24px -10px var(--accent-glow);

  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: light;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(900px 480px at 50% -180px, var(--accent-tint-2), transparent 72%),
    radial-gradient(700px 480px at 100% 110%, var(--accent-tint), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent-tint-2);
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

/* --------------------------------------------------------------------------
   Shell & top bar
   -------------------------------------------------------------------------- */

.app {
  min-height: 100dvh;
  position: relative;
}

.app-shell {
  width: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(88px + env(safe-area-inset-top)) 16px
    calc(30px + env(safe-area-inset-bottom));
}

.app-shell.no-progress {
  padding-top: calc(30px + env(safe-area-inset-top));
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 20px 14px;
  pointer-events: none;
}

.back-btn {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  pointer-events: auto;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  box-shadow: 0 4px 14px -6px rgba(19, 26, 42, 0.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 160ms var(--spring), color 160ms ease,
    border-color 160ms ease;
}

.back-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.back-btn:active {
  transform: scale(0.92);
}

.back-btn span {
  font-size: 21px;
  line-height: 1;
}

.progress-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  transition: width 500ms var(--ease-out);
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255, 255, 255, 0.55) 50%,
    transparent 80%
  );
  transform: translateX(-100%);
  animation: shimmer 2.4s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 35% { transform: translateX(-100%); }
  70%, 100% { transform: translateX(100%); }
}

/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */

.card {
  width: 100%;
  max-width: 520px;
  position: relative;
  padding: 30px 24px 28px;
  border-radius: var(--radius-card);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  animation: cardIn 560ms var(--spring) both;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1,
h2 {
  margin: 0 0 10px;
  font-weight: 800;
  letter-spacing: -0.022em;
  line-height: 1.14;
  text-wrap: balance;
}

h1 {
  font-size: clamp(27px, 7.2vw, 33px);
}

h2 {
  font-size: clamp(22px, 6vw, 26px);
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.subline {
  margin: 0 0 18px;
  color: var(--text-2);
  font-size: 16px;
}

.subtitle {
  margin: -2px 0 20px;
  color: var(--text-2);
  font-size: 15px;
}

.body-copy {
  margin: 0 0 22px;
  color: var(--text-2);
  font-size: 16px;
}

.proof {
  margin: 0 0 24px;
  padding: 13px 16px;
  font-size: 14px;
  color: var(--text-2);
  background: var(--well);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
}

/* Question progress counter — goal-gradient marker above each question */
.step-count {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* Welcome friction-killers — effort/risk pills under the CTA */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.meta-pill {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-2);
  background: var(--well);
  border: 1px solid var(--line);
  animation: rowIn 460ms var(--spring) calc(260ms + var(--i, 0) * 55ms) both;
}

/* --------------------------------------------------------------------------
   Step emoji badge
   -------------------------------------------------------------------------- */

.step-emoji {
  width: 62px;
  height: 62px;
  margin-bottom: 18px;
  display: grid;
  place-items: center;
  font-size: 31px;
  line-height: 1;
  border-radius: 19px;
  background: linear-gradient(150deg, var(--accent-tint-2), var(--accent-tint));
  border: 1px solid var(--accent-line);
  animation: badgeIn 640ms var(--spring) 60ms both;
}

@keyframes badgeIn {
  from {
    opacity: 0;
    transform: scale(0.5) rotate(-8deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

/* --------------------------------------------------------------------------
   Primary button
   -------------------------------------------------------------------------- */

.primary-btn {
  width: 100%;
  min-height: 56px;
  margin-top: 6px;
  padding: 15px 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-control);
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent) 60%, var(--accent-ink) 160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), var(--shadow-control);
  transition: transform 160ms var(--spring), box-shadow 200ms ease,
    filter 200ms ease;
}

.primary-btn::after {
  content: "→";
  font-size: 18px;
  transition: transform 200ms var(--ease-out);
}

.primary-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.primary-btn:hover::after {
  transform: translateX(3px);
}

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

.primary-btn:disabled {
  cursor: default;
  color: var(--text-3);
  background: var(--well);
  box-shadow: none;
  transform: none;
  filter: none;
}

.primary-btn:disabled::after {
  transform: none;
}

/* --------------------------------------------------------------------------
   Options (single & multi)
   -------------------------------------------------------------------------- */

.option-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-bottom: 4px;
}

.option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 62px;
  padding: 12px 15px;
  text-align: left;
  border-radius: var(--radius-control);
  background: var(--card);
  border: 1.5px solid var(--line-strong);
  user-select: none;
  -webkit-user-select: none;
  transition: transform 150ms var(--spring), border-color 150ms ease,
    background 150ms ease, box-shadow 150ms ease;
  animation: rowIn 460ms var(--spring) calc(120ms + var(--i, 0) * 55ms) both;
}

@keyframes rowIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.option:hover {
  border-color: var(--accent-line);
  background: var(--accent-tint);
  transform: translateY(-1px);
}

.option:active {
  transform: scale(0.98);
}

.option-emoji {
  flex: 0 0 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 24px;
  line-height: 1;
  border-radius: 12px;
  background: var(--well);
  border: 1px solid var(--line);
}

.option-label {
  flex: 1;
  font-size: 16px;
  font-weight: 650;
}

/* trailing check bubble — invisible until selected */
.option::after {
  content: "✓";
  flex: 0 0 26px;
  height: 26px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  border-radius: 999px;
  color: transparent;
  border: 1.5px solid var(--line-strong);
  background: var(--card);
  transition: all 160ms var(--spring);
}

.option.selected {
  border-color: var(--accent);
  background: var(--accent-tint);
  box-shadow: var(--shadow-control);
  animation: pickPop 260ms var(--spring);
}

.option.selected::after {
  color: #fff;
  border-color: transparent;
  background: var(--accent);
}

.option.selected .option-emoji {
  background: #fff;
  border-color: var(--accent-line);
}

@keyframes pickPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.025); }
  100% { transform: scale(1); }
}

/* --------------------------------------------------------------------------
   Scale (1–5)
   -------------------------------------------------------------------------- */

.scale-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.scale-chip {
  aspect-ratio: 1 / 1;
  min-height: 54px;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 800;
  border-radius: 15px;
  background: var(--card);
  border: 1.5px solid var(--line-strong);
  color: var(--text-2);
  transition: transform 150ms var(--spring), border-color 150ms ease,
    background 150ms ease, box-shadow 150ms ease, color 150ms ease;
  animation: rowIn 460ms var(--spring) calc(120ms + var(--i, 0) * 55ms) both;
}

.scale-chip:hover {
  border-color: var(--accent-line);
  background: var(--accent-tint);
  transform: translateY(-2px);
}

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

.scale-chip.selected {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  box-shadow: var(--shadow-control);
  animation: pickPop 260ms var(--spring);
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-3);
}

/* --------------------------------------------------------------------------
   Loading step
   -------------------------------------------------------------------------- */

.loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 0 4px;
}

.loader-ring {
  /* JS drives the fill: inline conic-gradient(var(--accent) X%, var(--ring-track) 0) */
  width: 126px;
  height: 126px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  background: conic-gradient(var(--accent) 0%, var(--ring-track) 0);
  animation: badgeIn 600ms var(--spring) both;
}

.loader-inner {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--card);
  box-shadow: 0 4px 14px -6px rgba(19, 26, 42, 0.14);
}

.loader-inner span {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.loading-messages {
  list-style: none;
  width: 100%;
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.loading-messages li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 13px;
  background: var(--well);
  border: 1px solid var(--line);
  color: var(--text-3);
  font-size: 14.5px;
  transition: color 300ms ease, background 300ms ease, border-color 300ms ease;
}

.loading-messages .check {
  flex: 0 0 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  border-radius: 999px;
  color: transparent;
  border: 1.5px solid var(--line-strong);
  background: var(--card);
  transition: all 220ms var(--spring);
}

.loading-messages li.done {
  color: var(--text);
  background: var(--good-tint);
  border-color: var(--good-line);
}

.loading-messages li.done .check {
  color: #fff;
  border-color: transparent;
  background: var(--good);
  animation: pickPop 300ms var(--spring);
}

/* --------------------------------------------------------------------------
   Reveal step
   -------------------------------------------------------------------------- */

.reveal-card {
  overflow: hidden;
}

.reveal-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 140px;
  pointer-events: none;
  background: radial-gradient(62% 120px at 50% 0%, var(--accent-tint-2), transparent);
}

.reveal-content {
  position: relative;
}

.reveal-content > h2 {
  font-size: 16.5px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0;
  margin-bottom: 4px;
}

.product-name {
  font-size: clamp(29px, 7.6vw, 36px);
  margin: 0 0 8px;
  color: var(--text);
}

.product-tagline {
  margin: 0 0 20px;
  font-size: 16px;
  color: var(--text-2);
}

/* Diagnosis playback — the visitor's own answers, mirrored back */
.summary {
  margin: 4px 0 18px;
  padding: 14px 16px 5px;
  border-radius: 15px;
  background: var(--well);
  border: 1px solid var(--line);
}

.summary-title {
  margin: 0 0 4px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.summary-row:last-child {
  border-bottom: 0;
}

.summary-label {
  flex-shrink: 0;
  color: var(--text-2);
}

.summary-value {
  font-weight: 700;
  text-align: right;
  color: var(--text);
}

.prescription {
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--text-2);
}

/* Damaging admission + disqualifier — trust block, after value is shown */
.honesty {
  margin: 0 0 20px;
  padding: 14px 16px;
  border-radius: 15px;
  border: 1.5px dashed var(--line-strong);
  background: var(--card);
}

.honesty-title {
  margin: 0 0 8px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.honesty p {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-2);
}

.honesty p:last-child {
  margin-bottom: 0;
}

.reveal-content .proof {
  margin-bottom: 18px;
}

.benefits {
  list-style: none;
  margin: 0 0 20px;
  padding: 17px 16px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  border-radius: 15px;
  background: var(--well);
  border: 1px solid var(--line);
}

.benefits li {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  font-size: 15px;
  color: var(--text-2);
}

.benefits .tick {
  flex: 0 0 22px;
  height: 22px;
  margin-top: 1px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 16px;
}

.price {
  font-size: 42px;
  font-weight: 850;
  letter-spacing: -0.03em;
  line-height: 1;
}

.anchor-price {
  font-size: 19px;
  font-weight: 650;
  color: var(--text-3);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--bad);
}

/* Denomination reframe directly under the price */
.price-note {
  margin: -8px 0 16px;
  font-size: 13.5px;
  color: var(--text-3);
}

.guarantee,
.scarcity {
  display: block;
  margin: 0 0 9px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 650;
}

.guarantee {
  color: var(--good-ink);
  background: var(--good-tint);
  border: 1px solid var(--good-line);
}

.scarcity {
  color: var(--warn-ink);
  background: var(--warn-tint);
  border: 1px solid var(--warn-line);
}

.telegram-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 58px;
  margin: 17px 0 10px;
  padding: 16px 20px;
  border-radius: var(--radius-control);
  font-size: 16.5px;
  font-weight: 750;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent) 60%, var(--accent-ink) 160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), var(--shadow-control);
  transition: transform 160ms var(--spring), filter 200ms ease;
  animation: ctaPulse 2.6s ease-in-out 800ms infinite;
}

.telegram-cta:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.telegram-cta:active {
  transform: scale(0.97);
}

@keyframes ctaPulse {
  0%, 100% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
      0 10px 24px -10px var(--accent-glow);
  }
  50% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
      0 14px 38px -6px var(--accent-glow);
  }
}

/* "A chat, not a checkout" — shrinks the felt size of the ask */
.cta-note {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  color: var(--text-3);
}

.copy-handle {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: var(--radius-control);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-2);
  background: var(--card);
  border: 1.5px dashed var(--line-strong);
  transition: transform 150ms var(--spring), color 150ms ease,
    border-color 150ms ease, background 150ms ease;
}

.copy-handle:hover {
  color: var(--accent-ink);
  border-color: var(--accent-line);
  background: var(--accent-tint);
}

.copy-handle:active {
  transform: scale(0.98);
}

/* --------------------------------------------------------------------------
   Fallback & toast
   -------------------------------------------------------------------------- */

.fallback-card .eyebrow {
  color: var(--text-3);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 40;
  transform: translate(-50%, 16px);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: #1a2236;
  box-shadow: 0 12px 32px rgba(19, 26, 42, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, transform 260ms var(--spring);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* --------------------------------------------------------------------------
   Desktop
   -------------------------------------------------------------------------- */

@media (min-width: 640px) {
  .card {
    padding: 40px 38px 36px;
  }

  h1 {
    font-size: 37px;
  }

  h2 {
    font-size: 28px;
  }

  .step-emoji {
    width: 70px;
    height: 70px;
    font-size: 35px;
  }

  .price {
    font-size: 48px;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */

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