/* ===== Design tokens ===== */
:root{
  --bg: #10141c;
  --bg-2: #0b0e14;
  --surface: #171d29;
  --surface-2: #1e2635;
  --border: #2a3345;
  --gold: #e7b95b;
  --gold-soft: rgba(231, 185, 91, .16);
  --teal: #4fada5;
  --teal-soft: rgba(79, 173, 165, .18);
  --text: #f3efe6;
  --text-muted: #93a0b4;
  --error: #e2604f;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 30px 80px -30px rgba(0,0,0,.65), 0 2px 0 rgba(255,255,255,.02) inset;
  --ease: cubic-bezier(.22,1,.36,1);
}

*{ box-sizing: border-box; }

html,body{
  margin:0; padding:0;
  min-height:100%;
  background: radial-gradient(120% 140% at 50% -10%, #1a2130 0%, var(--bg) 45%, var(--bg-2) 100%);
  color: var(--text);
  font-family: 'Vazirmatn', 'Tahoma', sans-serif;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce){
  *{ animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

#constellation{
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: .5;
  pointer-events: none;
}

.stage{
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px 60px;
  gap: 28px;
}

/* ===== Brand header ===== */
.brand{
  text-align: center;
}
.brand-mark{
  display: inline-flex;
  gap: 8px;
  margin-bottom: 14px;
}
.brand-node{
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px 2px var(--gold-soft);
  animation: pulse-node 2.4s var(--ease) infinite;
}
.brand-node:nth-child(2){ animation-delay: .3s; background: var(--teal); box-shadow: 0 0 12px 2px var(--teal-soft); }
.brand-node:nth-child(3){ animation-delay: .6s; }
@keyframes pulse-node{
  0%, 100%{ opacity:.4; transform: scale(.8); }
  50%{ opacity:1; transform: scale(1.15); }
}
.brand h1{
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 900;
  letter-spacing: -.01em;
  margin: 0 0 6px;
  background: linear-gradient(90deg, var(--text) 0%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub{
  margin: 0;
  color: var(--text-muted);
  font-size: 14.5px;
  font-weight: 500;
}

/* ===== Card ===== */
.card{
  width: 100%;
  max-width: 560px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px 30px 28px;
  box-shadow: var(--shadow-card);
  position: relative;
}

/* ===== Synapse progress ===== */
.synapse{
  position: relative;
  height: 34px;
  margin-bottom: 26px;
}
.synapse-track{
  position: absolute;
  top: 50%;
  inset-inline: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--border);
  transform: translateY(-50%);
  overflow: hidden;
}
.synapse-fill{
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: var(--gold);
  box-shadow: 0 0 8px 1px var(--gold-soft);
  transition: width .6s var(--ease);
}
.synapse-nodes{
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.synapse-nodes .node{
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1.6px solid var(--border);
  transition: all .5s var(--ease);
  position: relative;
}
.synapse-nodes .node.done{
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 10px 2px var(--gold-soft);
}
.synapse-nodes .node.active{
  background: var(--bg);
  border-color: var(--gold);
  transform: scale(1.5);
  box-shadow: 0 0 0 4px var(--gold-soft);
}

/* ===== Steps ===== */
form{ position: relative; min-height: 210px; }
.step{
  display: none;
  animation: step-in .45s var(--ease);
}
.step.is-active{ display: block; }
.step.leaving{ animation: step-out .3s var(--ease) forwards; }
@keyframes step-in{
  from{ opacity: 0; transform: translateX(14px); }
  to{ opacity: 1; transform: translateX(0); }
}
@keyframes step-out{
  from{ opacity: 1; transform: translateX(0); }
  to{ opacity: 0; transform: translateX(-14px); }
}

.eyebrow{
  margin: 0 0 10px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--teal);
  text-transform: uppercase;
}
.question{
  margin: 0 0 6px;
  font-size: clamp(19px, 3.4vw, 23px);
  font-weight: 800;
  line-height: 1.5;
}
.hint{
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
}

.field{ margin-top: 16px; }
.field input[type="text"],
.field input[type="tel"],
.field textarea{
  width: 100%;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 500;
  outline: none;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.field textarea{ resize: vertical; min-height: 96px; }
.field input::placeholder,
.field textarea::placeholder{ color: #5b6579; }
.field input:focus,
.field textarea:focus{
  border-color: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-soft);
}
.step.invalid .field input,
.step.invalid .field textarea{ border-color: var(--error); }

/* ===== Options ===== */
.options{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}
.option{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .2s var(--ease), background .2s var(--ease), transform .15s var(--ease);
}
.option:hover{ border-color: #3a4459; transform: translateY(-1px); }
.option input{
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}
.chip{
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  transition: all .2s var(--ease);
}
.option-text{
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.option:has(input:checked),
.option.is-checked{
  border-color: var(--gold);
  background: var(--gold-soft);
}
.option:has(input:checked) .chip,
.option.is-checked .chip{
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg-2);
}
.option input:focus-visible ~ .chip{
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.error-msg{
  display: none;
  color: var(--error);
  font-size: 13px;
  font-weight: 600;
  margin: 12px 0 0;
}
.step.invalid .error-msg{ display: block; }

/* ===== Nav row ===== */
.nav-row{
  display: flex;
  gap: 10px;
  margin-top: 26px;
}
.btn{
  flex: 1;
  border: none;
  border-radius: var(--radius-md);
  padding: 15px 18px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s var(--ease), filter .2s var(--ease), opacity .2s var(--ease);
  position: relative;
}
.btn:active{ transform: scale(.97); }
.btn-primary{
  background: linear-gradient(135deg, var(--gold) 0%, #d9a545 100%);
  color: #201404;
}
.btn-primary:hover{ filter: brightness(1.08); }
.btn-ghost{
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  flex: 0 0 auto;
  padding: 15px 22px;
}
.btn-ghost:hover{ border-color: #3a4459; color: var(--text); }
.btn-ghost[data-hidden="true"]{ display: none; }
#btnSubmit{ display: none; }
#btnSubmit.show{ display: flex; align-items: center; justify-content: center; gap: 8px; }
#btnNext.hide{ display: none; }

.btn-spinner{
  display: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(32,20,4,.3);
  border-top-color: #201404;
  animation: spin .7s linear infinite;
}
.btn.is-loading .btn-spinner{ display: inline-block; }
.btn.is-loading .btn-label{ opacity: .6; }
@keyframes spin{ to{ transform: rotate(360deg); } }

.form-toast{
  display: none;
  margin: 16px 0 0;
  text-align: center;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--error);
}
.form-toast.show{ display: block; }

/* ===== Success screen ===== */
.success-card{
  text-align: center;
  padding: 46px 30px 40px;
}
.success-glow{
  width: 110px; height: 110px;
  margin: 0 auto 22px;
}
.success-check{ width: 100%; height: 100%; }
.success-ring{
  fill: none;
  stroke: var(--gold);
  stroke-width: 3;
  stroke-dasharray: 340;
  stroke-dashoffset: 340;
  animation: ring-draw .7s var(--ease) forwards;
  filter: drop-shadow(0 0 10px var(--gold-soft));
}
.success-tick{
  fill: none;
  stroke: var(--gold);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 70;
  stroke-dashoffset: 70;
  animation: tick-draw .5s var(--ease) .55s forwards;
}
@keyframes ring-draw{ to{ stroke-dashoffset: 0; } }
@keyframes tick-draw{ to{ stroke-dashoffset: 0; } }
.success-card h2{
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 10px;
}
.success-text{
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.8;
  margin: 0;
  max-width: 400px;
  margin-inline: auto;
}

/* ===== Responsive ===== */
@media (max-width: 480px){
  .card{ padding: 26px 20px 22px; border-radius: 18px; }
  .options{ grid-template-columns: 1fr; }
  .nav-row{ flex-wrap: nowrap; }
  .btn-ghost{ padding: 15px 16px; }
}
