/* ============================================================
   CÓDIGO INTERNO™ — Diagnóstico
   Tokens de marca
   ============================================================ */
:root{
  --indigo-deep:   #221A56;
  --indigo:        #3C3489;
  --indigo-soft:   #EEEDFE;
  --teal-dark:     #073B31;
  --gold:          #C9A227;
  --gold-soft:     #F1E4B8;
  --bone:          #F5F0E4;
  --bone-2:        #ECE4D2;
  --ink:           #1C1730;
  --ink-soft:      rgba(28,23,48,.66);
  --ink-faint:     rgba(28,23,48,.42);
  --white:         #FFFDF8;
  --error:         #A23B2B;

  --font-display: 'Fraunces', serif;
  --font-body: 'Sora', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }

body{
  background: var(--bone);
  color: var(--ink);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============ Constellation canvas (solo intro/final) ============ */
#constellation{
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.1s ease;
}
#constellation.visible{ opacity: 1; }

#app{ position: relative; z-index: 1; }

/* ============================================================
   Barra de progreso
   ============================================================ */
.progress-header{
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--indigo-deep);
  padding: 14px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.progress-track{
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,.14);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill{
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), #E4C766);
  border-radius: 4px;
  transition: width .45s cubic-bezier(.65,0,.35,1);
}
.progress-label{
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  color: rgba(255,255,255,.6);
  text-align: right;
}

/* ============================================================
   Layout general de pantallas
   ============================================================ */
#stage{
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 60px;
}

.screen{
  display: none;
  width: 100%;
  max-width: 620px;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: fadeUp .5s ease;
}
.screen.active{ display: flex; }

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

.eyebrow{
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 18px;
}

.mantra{
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(30px, 5.4vw, 48px);
  line-height: 1.18;
  color: var(--indigo-deep);
  margin: 0 0 22px;
}
.mantra span{
  font-style: italic;
  color: var(--teal-dark);
}
.mantra-final span{ color: var(--gold); }

.intro-copy{
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 480px;
  margin: 0 0 14px;
}
.intro-copy--muted{ color: var(--ink-faint); font-size: 14.5px; }

.confidential{
  margin-top: 22px;
  font-size: 12.5px;
  font-style: italic;
  color: var(--ink-faint);
}

.email-gate{
  width: 100%;
  max-width: 380px;
  margin: 6px 0 6px;
  text-align: left;
}
.email-gate label{
  display: block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--teal-dark);
  margin-bottom: 8px;
}
.email-gate .q-text-input{
  background: var(--white);
}
.email-gate .q-error{
  margin-top: 8px;
  text-align: left;
}

.final-quote{
  margin-top: 26px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 19px;
  color: var(--indigo);
}

/* ============================================================
   Botones
   ============================================================ */
.btn{
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15.5px;
  border: none;
  border-radius: 999px;
  padding: 16px 34px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-primary{
  background: var(--indigo-deep);
  color: var(--white);
  box-shadow: 0 10px 24px -10px rgba(34,26,86,.55);
  margin-top: 10px;
}
.btn-primary:hover{ transform: translateY(-2px); box-shadow: 0 14px 28px -10px rgba(34,26,86,.6); }
.btn-primary:active{ transform: translateY(0); }
.btn-primary:disabled{
  background: #C9C4DD;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}
.btn-ghost{
  background: transparent;
  color: var(--ink-soft);
  border: 1.5px solid var(--ink-faint);
}
.btn-ghost:hover{ border-color: var(--indigo); color: var(--indigo); }

/* ============================================================
   Tarjeta de pregunta
   ============================================================ */
.screen-question{ align-items: stretch; }
.question-card{
  background: var(--white);
  border: 1px solid var(--bone-2);
  border-radius: var(--radius-lg);
  padding: 40px clamp(22px, 5vw, 44px);
  text-align: left;
  box-shadow: 0 18px 40px -26px rgba(28,23,48,.28);
}

.q-eyebrow{
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .1em;
  color: var(--teal-dark);
  text-transform: uppercase;
  margin: 0 0 10px;
}
.q-title{
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(22px, 3.4vw, 28px);
  line-height: 1.32;
  color: var(--indigo-deep);
  margin: 0 0 8px;
}
.q-hint{
  font-size: 14px;
  color: var(--ink-faint);
  margin: 0 0 24px;
}
.q-hint:empty{ display:none; margin:0; }

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

/* Opciones tipo choice/checkbox */
.opt{
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  border: 1.5px solid var(--bone-2);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  background: var(--bone);
}
.opt:hover{ border-color: var(--gold); }
.opt.selected{
  border-color: var(--indigo);
  background: var(--indigo-soft);
}
.opt .mark{
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--ink-faint);
  position: relative;
}
.opt.opt-checkbox .mark{ border-radius: 6px; }
.opt.selected .mark{ border-color: var(--indigo); }
.opt.selected .mark::after{
  content:'';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--indigo);
}
.opt.opt-checkbox.selected .mark::after{ border-radius: 3px; }
.opt .opt-text{
  font-size: 15.5px;
  color: var(--ink);
  line-height: 1.4;
}

.opt-other-input{
  margin-top: 4px;
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  padding: 13px 16px;
  border: 1.5px solid var(--bone-2);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--ink);
}
.opt-other-input:focus{ outline: none; border-color: var(--indigo); }

/* Escala lineal */
.scale-row{
  display: flex;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}
.scale-pt{
  flex: 1 1 0;
  min-width: 38px;
  height: 46px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--bone-2);
  background: var(--bone);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
}
.scale-pt:hover{ border-color: var(--gold); }
.scale-pt.selected{
  background: var(--indigo-deep);
  border-color: var(--indigo-deep);
  color: var(--white);
}
.scale-labels{
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-faint);
}

/* Texto libre */
.q-textarea{
  width: 100%;
  min-height: 110px;
  font-family: var(--font-body);
  font-size: 15.5px;
  padding: 16px 18px;
  border: 1.5px solid var(--bone-2);
  border-radius: var(--radius-md);
  background: var(--bone);
  color: var(--ink);
  resize: vertical;
}
.q-textarea:focus{ outline: none; border-color: var(--indigo); background: var(--white); }

.q-text-input{
  width: 100%;
  font-family: var(--font-body);
  font-size: 15.5px;
  padding: 15px 18px;
  border: 1.5px solid var(--bone-2);
  border-radius: var(--radius-md);
  background: var(--bone);
  color: var(--ink);
}
.q-text-input:focus{ outline: none; border-color: var(--indigo); background: var(--white); }

.q-error{
  color: var(--error);
  font-size: 13.5px;
  margin-top: 14px;
}

/* Campo condicional (contacto) */
.conditional-field{
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--bone-2);
}
.conditional-field label{
  display:block;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

/* Nav row */
.nav-row{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 22px;
  gap: 12px;
}
.nav-row .btn{ margin-top: 0; }
.nav-row .btn-primary{ flex: 1; }

/* ============================================================
   Enviando / spinner
   ============================================================ */
.screen-sending{ min-height: 40vh; justify-content: center; }
.spinner{
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 3px solid var(--bone-2);
  border-top-color: var(--gold);
  animation: spin .8s linear infinite;
  margin-bottom: 20px;
}
@keyframes spin{ to{ transform: rotate(360deg); } }
.sending-text{
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--ink-faint);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 480px){
  #stage{ padding: 20px 14px 48px; }
  .question-card{ padding: 28px 20px; border-radius: 16px; }
  .btn{ padding: 15px 24px; font-size: 15px; }
  .scale-pt{ height: 40px; font-size: 12.5px; }
}

/* Accesibilidad: reduce motion */
@media (prefers-reduced-motion: reduce){
  .screen{ animation: none; }
  .progress-fill{ transition: none; }
  .btn{ transition: none; }
}
