/* ================================================================
   MENOS JUICIOS, MÁS APOYO
   Estilos institucionales — Día Mundial del Autismo
   Colores: azul #004AAD · verde #7ED957 · blanco · azul suave
================================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --blue:         #004AAD;
  --blue-dark:    #003585;
  --blue-mid:     #1560C7;
  --blue-soft:    #E8F0FC;
  --blue-pale:    #F0F6FF;
  --green:        #7ED957;
  --green-dark:   #5BBF3A;
  --green-soft:   #EAF9E1;
  --white:        #FFFFFF;
  --text-dark:    #1A2540;
  --text-mid:     #3A4A6B;
  --text-soft:    #6B7A99;
  --border:       #D5E3F7;
  --correct-bg:   #EAF9E1;
  --wrong-bg:     #FDE8E8;
  --correct-col:  #3A9E1F;
  --wrong-col:    #C0392B;
  --radius:       16px;
  --radius-sm:    10px;
  --shadow:       0 8px 32px rgba(0,74,173,0.12);
  --shadow-sm:    0 2px 12px rgba(0,74,173,0.08);
  --transition:   0.35s cubic-bezier(.4,0,.2,1);
  --font:         'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Reset y base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--blue-pale);
  color: var(--text-dark);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Pantallas ──────────────────────────────────────────────── */
.screen {
  min-height: 100dvh;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--transition), transform var(--transition);
  position: relative;
}

.screen.active {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

/* Animación de entrada */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Botones ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 50px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn-primary {
  background: var(--green);
  color: var(--blue-dark);
}
.btn-primary:hover, .btn-primary:focus-visible {
  background: var(--green-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(126,217,87,0.45);
  outline: none;
}
.btn-primary:active { transform: translateY(0); }

.btn-lg { padding: 16px 32px; font-size: 1.05rem; }
.btn-full { width: 100%; justify-content: center; }

.btn-secondary {
  background: var(--white);
  color: var(--blue);
  border: 2px solid var(--blue);
}
.btn-secondary:hover, .btn-secondary:focus-visible {
  background: var(--blue-soft);
  outline: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border: 2px solid var(--border);
}
.btn-ghost:hover, .btn-ghost:focus-visible {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: var(--blue);
  outline: none;
}

/* ================================================================
   PANTALLA 1 · BIENVENIDA
================================================================ */
.screen-welcome {
  background: linear-gradient(150deg, var(--blue) 0%, var(--blue-mid) 60%, #0A3D8F 100%);
  overflow: hidden;
}

/* Burbujas decorativas */
.bubbles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.bubble {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  animation: floatBubble linear infinite;
}
.b1 { width: 260px; height: 260px; top: -60px; right: -60px; animation-duration: 12s; }
.b2 { width: 180px; height: 180px; bottom: 40px; left: -50px; animation-duration: 16s; animation-delay: -4s; }
.b3 { width: 100px; height: 100px; top: 40%; left: 15%; animation-duration: 20s; animation-delay: -8s; background: rgba(126,217,87,0.1); }
.b4 { width: 60px;  height: 60px;  bottom: 20%; right: 20%; animation-duration: 14s; animation-delay: -2s; background: rgba(126,217,87,0.12); }

@keyframes floatBubble {
  0%   { transform: translateY(0) scale(1); }
  50%  { transform: translateY(-20px) scale(1.04); }
  100% { transform: translateY(0) scale(1); }
}

.welcome-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 560px;
  animation: fadeInUp 0.7s ease both;
}

.badge-date {
  display: inline-block;
  background: rgba(255,255,255,0.18);
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 50px;
  padding: 6px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 24px;
  backdrop-filter: blur(4px);
}

.welcome-title {
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 800;
  color: var(--white);
  line-height: 1.15;
  margin-bottom: 20px;
}

.welcome-title .highlight {
  color: var(--green);
}

.welcome-sub {
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  color: rgba(255,255,255,0.82);
  line-height: 1.6;
  margin-bottom: 40px;
}

/* ================================================================
   PANTALLA 2 · QUIZ
================================================================ */
.screen-quiz {
  background: var(--blue-pale);
  align-items: stretch;
  justify-content: flex-start;
  padding-top: 40px;
}

.quiz-wrapper {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Barra de progreso */
.progress-area { display: flex; flex-direction: column; gap: 8px; }

.progress-bar-container {
  height: 6px;
  background: var(--border);
  border-radius: 50px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green));
  border-radius: 50px;
  transition: width 0.5s cubic-bezier(.4,0,.2,1);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.progress-score {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--blue);
}

.progress-dots {
  display: flex;
  gap: 6px;
}

.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: background var(--transition);
}

.progress-dot.done    { background: var(--green); }
.progress-dot.active  { background: var(--blue); transform: scale(1.2); }

/* Tarjeta pregunta */
.question-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
  animation: fadeInUp 0.4s ease both;
}

.question-text {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.5;
  margin-bottom: 24px;
}

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

.option-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--blue-pale);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-dark);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
}

.option-btn:hover:not(:disabled) {
  border-color: var(--blue);
  background: var(--blue-soft);
  transform: translateX(4px);
}

.option-btn:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.option-btn .opt-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--border);
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: all var(--transition);
}

.option-btn.correct {
  border-color: var(--correct-col);
  background: var(--correct-bg);
  color: var(--correct-col);
}

.option-btn.correct .opt-letter {
  background: var(--correct-col);
  border-color: var(--correct-col);
  color: var(--white);
}

.option-btn.wrong {
  border-color: var(--wrong-col);
  background: var(--wrong-bg);
  color: var(--wrong-col);
}

.option-btn.wrong .opt-letter {
  background: var(--wrong-col);
  border-color: var(--wrong-col);
  color: var(--white);
}

.option-btn:disabled { cursor: default; }

/* Retroalimentación */
.feedback-box {
  background: var(--white);
  border-radius: var(--radius);
  border-left: 5px solid var(--blue);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeInUp 0.4s ease both;
}

.feedback-box[hidden] { display: none; }

.feedback-icon { font-size: 1.6rem; }

.feedback-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-mid);
  font-style: italic;
}

.btn-next {
  align-self: flex-end;
}

/* ================================================================
   PANTALLA 3 · RESULTADO
================================================================ */
.screen-result {
  background: linear-gradient(160deg, var(--blue-pale) 0%, var(--blue-soft) 100%);
}

.result-wrapper {
  text-align: center;
  max-width: 500px;
  animation: fadeInUp 0.5s ease both;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.result-icon { font-size: 3.5rem; }

.result-title {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--blue);
  line-height: 1.3;
}

.result-msg {
  font-size: 1rem;
  color: var(--text-mid);
  line-height: 1.65;
}

.score-display {
  background: var(--white);
  border-radius: 50px;
  padding: 10px 28px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--blue);
  box-shadow: var(--shadow-sm);
}

/* ================================================================
   PANTALLA 4 · FORMULARIO
================================================================ */
.screen-form {
  background: var(--blue-pale);
  align-items: stretch;
  justify-content: flex-start;
  padding-top: 48px;
  padding-bottom: 48px;
}

.form-wrapper {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  animation: fadeInUp 0.5s ease both;
}

.form-title {
  font-size: clamp(1.3rem, 3.5vw, 1.8rem);
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 8px;
}

.form-sub {
  font-size: 0.95rem;
  color: var(--text-soft);
  margin-bottom: 28px;
  line-height: 1.5;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.field-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  gap: 6px;
}

.field-optional {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-soft);
}

.field-required {
  color: var(--blue);
  font-size: 1rem;
}

.field-input {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text-dark);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}

.field-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,74,173,0.12);
}

.field-input.error {
  border-color: var(--wrong-col);
}

.field-input::placeholder { color: #B0BDD0; }

.field-textarea {
  resize: vertical;
  min-height: 90px;
}

.field-hint {
  font-size: 0.78rem;
  color: var(--wrong-col);
  min-height: 14px;
}

.char-count {
  font-size: 0.78rem;
  color: var(--text-soft);
  text-align: right;
}

/* Estado del envío */
.submit-status {
  margin-top: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  animation: fadeInUp 0.3s ease both;
}

.submit-status[hidden] { display: none; }

.submit-status.loading {
  background: var(--blue-soft);
  color: var(--blue);
  border: 1px solid var(--border);
}

.submit-status.error {
  background: var(--wrong-bg);
  color: var(--wrong-col);
  border: 1px solid #F5C6C6;
}

/* ================================================================
   PANTALLA 5 · CIERRE
================================================================ */
.screen-close {
  background: linear-gradient(150deg, var(--blue) 0%, var(--blue-mid) 100%);
  text-align: center;
}

.close-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 480px;
  animation: fadeInUp 0.6s ease both;
}

.heart-container {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.heart { font-size: 3.2rem; z-index: 1; animation: heartbeat 2s ease-in-out infinite; }

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  25%       { transform: scale(1.12); }
  50%       { transform: scale(1.05); }
}

.ripple {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  animation: rippleOut 3s ease-out infinite;
}

.r1 { width: 70px;  height: 70px;  animation-delay: 0s; }
.r2 { width: 90px;  height: 90px;  animation-delay: 0.8s; }
.r3 { width: 110px; height: 110px; animation-delay: 1.6s; }

@keyframes rippleOut {
  0%   { transform: scale(0.8); opacity: 0.7; }
  100% { transform: scale(1.6); opacity: 0; }
}

.close-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  color: var(--white);
}

.close-phrase {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--green);
  font-weight: 600;
}

.close-sub {
  font-size: clamp(0.9rem, 2vw, 1rem);
  color: rgba(255,255,255,0.78);
  line-height: 1.6;
}

.close-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

/* ================================================================
   RESPONSIVE
================================================================ */
@media (max-width: 480px) {
  .screen { padding: 20px 16px; }
  .question-card { padding: 24px 18px; }
  .feedback-box  { padding: 16px 18px; }
  .form-wrapper  { padding: 0 4px; }
  .close-actions { flex-direction: column; align-items: stretch; }
  .close-actions .btn { justify-content: center; }
  .br-desktop { display: none; }
}

@media (min-width: 769px) {
  .screen { padding: 40px 32px; }
  .quiz-wrapper { padding-top: 20px; }
}

/* ── Loader spinner ─────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(0,74,173,0.2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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