:root {
  --bg-0: #12081f;
  --bg-1: #1a0e2a;
  --card: rgba(255,255,255,0.06);
  --card-border: rgba(255,255,255,0.1);
  --card-hover: rgba(255,255,255,0.1);
  --text: #fbf5ff;
  --text-dim: #b7a6cc;
  --accent: #ff2d78;
  --accent-2: #22d3ee;
  --accent-grad: linear-gradient(135deg, #ff2d78 0%, #a855f7 55%, #22d3ee 100%);
  --gold: #ffd23f;
  --danger: #ff6b81;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background: var(--bg-0);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(65% 45% at 50% 0%, rgba(255,45,120,0.25), transparent 70%),
    radial-gradient(55% 40% at 90% 100%, rgba(34,211,238,0.2), transparent 70%),
    radial-gradient(45% 35% at 5% 85%, rgba(168,85,247,0.22), transparent 70%),
    var(--bg-0);
  display: flex;
  justify-content: center;
}

#confettiCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

.phone-frame {
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
}

@media (min-width: 560px) {
  body { padding: 32px 16px; }
  .phone-frame {
    min-height: min(860px, calc(100dvh - 64px));
    border-radius: 34px;
    border: 1px solid rgba(255,255,255,0.09);
    box-shadow: 0 40px 100px -30px rgba(0,0,0,0.75), 0 0 0 1px rgba(255,255,255,0.03);
    overflow: hidden;
    background: var(--bg-1);
  }
}

.quiz-header[hidden] { display: none; }

.quiz-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(18px + var(--safe-top)) 20px 14px;
  flex-shrink: 0;
}

.back-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.07);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease, color .15s ease;
}
.back-btn:active { transform: scale(0.88); }
.back-btn.is-hidden { opacity: 0; pointer-events: none; }

.progress-track {
  flex: 1;
  height: 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--accent-grad);
  box-shadow: 0 0 14px rgba(255,45,120,0.6);
  transition: width .5s cubic-bezier(.22,1,.36,1);
}

.step-counter {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  min-width: 34px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.quiz-stage {
  flex: 1;
  position: relative;
  padding: 8px 22px calc(28px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.step {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 100%;
}

.step.enter-right { animation: slideInRight .42s cubic-bezier(.22,1,.36,1) both; }
.step.enter-left { animation: slideInLeft .42s cubic-bezier(.22,1,.36,1) both; }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-28px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---------- Welcome ---------- */
.welcome-step {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding-top: 20px;
}

.hero-emoji {
  font-size: 84px;
  line-height: 1;
  margin-bottom: 16px;
  filter: drop-shadow(0 14px 30px rgba(255,45,120,0.4));
  animation: bounce 2.2s ease-in-out infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-14px) rotate(4deg); }
}

.eyebrow {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .03em;
  color: #1a0e2a;
  background: var(--accent-grad);
  padding: 7px 16px;
  border-radius: 999px;
  margin-bottom: 18px;
  box-shadow: 0 6px 18px -6px rgba(255,45,120,0.55);
}

.welcome-step h1 {
  font-size: 27px;
  line-height: 1.28;
  margin: 0 0 12px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.welcome-step p {
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--text-dim);
  margin: 0 0 30px;
  max-width: 360px;
}

.trust-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-dim);
}
.trust-row svg { flex-shrink: 0; color: var(--gold); }

/* ---------- Question steps ---------- */
.q-kicker {
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-2);
  margin: 10px 0 8px;
}
.q-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.32;
  margin: 0 0 22px;
  letter-spacing: -0.01em;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  background: var(--card);
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  transition: transform .18s cubic-bezier(.22,1,.36,1), background .18s ease, border-color .18s ease, box-shadow .18s ease;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}
.option-card:active { transform: scale(0.97); }
.option-card:hover { background: var(--card-hover); }

.option-card .emoji {
  font-size: 24px;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255,255,255,0.07);
}

.option-card .label { flex: 1; }

.option-card .check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s cubic-bezier(.22,1,.36,1);
}
.option-card .check svg {
  opacity: 0;
  transform: scale(0.4);
  transition: all .25s cubic-bezier(.34,1.56,.64,1);
}

.option-card.is-selected {
  border-color: rgba(255,45,120,0.6);
  background: linear-gradient(135deg, rgba(255,45,120,0.16), rgba(34,211,238,0.1));
  box-shadow: 0 0 0 1px rgba(255,45,120,0.3), 0 10px 26px -10px rgba(255,45,120,0.4);
}
.option-card.is-selected .check {
  background: var(--accent-grad);
  border-color: transparent;
}
.option-card.is-selected .check svg { opacity: 1; transform: scale(1); color: #1a0e2a; }

.option-card.is-selected { animation: pop .38s cubic-bezier(.34,1.56,.64,1); }
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.045); }
  100% { transform: scale(1); }
}

.spacer { flex: 1; }

/* ---------- Buttons ---------- */
.btn-primary {
  appearance: none;
  border: none;
  width: 100%;
  padding: 18px 20px;
  border-radius: var(--radius-sm);
  background: var(--accent-grad);
  color: #1a0e2a;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform .15s cubic-bezier(.22,1,.36,1), box-shadow .15s ease, opacity .15s ease;
  box-shadow: 0 12px 28px -10px rgba(255,45,120,0.6);
}
.btn-primary:active { transform: scale(0.97); }

/* ---------- Result / reveal ---------- */
.result-step {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.result-emoji {
  font-size: 92px;
  line-height: 1;
  margin-bottom: 10px;
  animation: revealPop .6s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes revealPop {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.result-kicker {
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-2);
  letter-spacing: .04em;
  margin-bottom: 6px;
}

.result-step h1 {
  font-size: 27px;
  font-weight: 800;
  margin: 0 0 12px;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.25;
}

.result-step p {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.55;
  max-width: 340px;
  margin: 0 0 26px;
}

.result-card {
  width: 100%;
  border-radius: var(--radius-lg);
  background: linear-gradient(165deg, rgba(255,45,120,0.14) 0%, rgba(168,85,247,0.1) 50%, rgba(34,211,238,0.1) 100%);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 20px;
  margin-bottom: 22px;
  animation: offerIn .5s cubic-bezier(.34,1.56,.64,1) .2s both;
}
@keyframes offerIn {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.result-card .stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 14px;
}
.result-card .stat-row:last-child { border-bottom: none; }
.result-card .stat-label { color: var(--text-dim); font-weight: 600; }
.result-card .stat-value { color: var(--text); font-weight: 800; }

@media (max-height: 750px) {
  .hero-emoji { font-size: 64px; margin-bottom: 8px; }
  .welcome-step h1 { font-size: 23px; }
  .result-emoji { font-size: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  .step.enter-right, .step.enter-left, .hero-emoji, .option-card.is-selected, .result-emoji, .result-card {
    animation: none !important;
  }
}

/* ---------- Order summary (contact step) ---------- */
.order-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(255,45,120,0.14), rgba(34,211,238,0.1));
  border: 1px solid rgba(255,255,255,0.12);
  margin-bottom: 22px;
}
.order-emoji {
  font-size: 30px;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
}
.order-title { font-weight: 800; font-size: 15px; color: var(--text); }
.order-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.order-price-wrap {
  margin-left: auto;
  flex-shrink: 0;
  text-align: right;
}
.order-discount-badge {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--accent-2);
  margin-bottom: 3px;
  white-space: nowrap;
}
.order-price {
  font-weight: 800;
  font-size: 20px;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Contact form ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.field input, .field textarea {
  width: 100%;
  padding: 15px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.field textarea { line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder { color: rgba(251,245,255,0.3); }
.field input:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(255,45,120,0.16);
}
.field input.is-invalid, .field textarea.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(255,107,129,0.14);
}
.field .error-msg {
  font-size: 12.5px;
  color: var(--danger);
  margin-top: 6px;
  min-height: 16px;
}

.privacy-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 4px 0 22px;
}
.privacy-note svg { flex-shrink: 0; margin-top: 2px; color: var(--gold); }

.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn-primary .spin {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2.5px solid rgba(26,14,42,0.35);
  border-top-color: #1a0e2a;
  animation: spin .7s linear infinite;
  vertical-align: -3px;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Thank you ---------- */
.thanks-step {
  justify-content: center;
  align-items: center;
  text-align: center;
}
.thanks-step h1 {
  font-size: 24px;
  font-weight: 800;
  margin: 8px 0 10px;
}
.thanks-step p {
  font-size: 14.5px;
  color: var(--text-dim);
  line-height: 1.5;
  max-width: 340px;
  margin: 0 0 20px;
}
.manager-note {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid var(--card-border);
  font-size: 13.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}
.manager-note .avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--accent-grad);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
