:root {
  /* Marca — degradado Evolución muestreado del logo */
  --c-pink: #e8196e;
  --c-magenta: #b02c9e;
  --c-purple: #6e46ce;
  --c-blue: #3a78d6;
  --c-cyan: #24c9e0;
  --grad: linear-gradient(
    100deg,
    var(--c-pink) 0%,
    var(--c-magenta) 28%,
    var(--c-purple) 52%,
    var(--c-blue) 74%,
    var(--c-cyan) 100%
  );

  /* Llosa — tinta negra arquitectónica */
  --ink: #0e1116;
  --ink-soft: #384152;
  --muted: #6b7688;

  /* Papel / hoja cuadriculada */
  --paper: #f4f7fc;
  --paper-2: #eef3fa;
  --white: #ffffff;
  --line: rgba(58, 120, 214, 0.10);
  --line-strong: rgba(58, 120, 214, 0.20);
  --card-line: #e4ebf5;

  --shadow-lg: 0 40px 80px -30px rgba(24, 44, 84, 0.35);
  --shadow-md: 0 18px 40px -22px rgba(24, 44, 84, 0.28);
  --radius: 26px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

/* Hoja cuadriculada reutilizable */
.grid-bg {
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(232, 25, 110, 0.10), transparent 34%),
    radial-gradient(circle at 88% 92%, rgba(36, 201, 224, 0.12), transparent 36%),
    radial-gradient(circle at 62% 20%, rgba(110, 70, 206, 0.07), transparent 40%),
    linear-gradient(var(--line-strong) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-strong) 1px, transparent 1px),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size:
    100% 100%, 100% 100%, 100% 100%,
    132px 132px, 132px 132px, 22px 22px, 22px 22px;
}

body {
  font-family: "Inter", "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background-attachment: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 48px);
}

/* ---------- Marco / tarjeta principal ---------- */
.shell {
  position: relative;
  width: min(1240px, 100%);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: 0.92fr 1.28fr;
}

.shell::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--grad);
  background-size: 220% 100%;
  animation: slide 8s linear infinite;
  z-index: 3;
}

@keyframes slide {
  to { background-position: 220% 0; }
}

/* ---------- Panel Hero ---------- */
.hero {
  position: relative;
  padding: clamp(28px, 3vw, 46px);
  border-right: 1px solid var(--card-line);
  background:
    radial-gradient(circle at 0% 0%, rgba(232, 25, 110, 0.06), transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(36, 201, 224, 0.08), transparent 45%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(244, 247, 252, 0.35));
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.4vw, 28px);
  padding: 18px clamp(18px, 2.2vw, 26px);
  background: var(--white);
  border: 1px solid var(--card-line);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
}

.brand-item { display: flex; flex-direction: column; gap: 9px; min-width: 0; }

.brand-eyebrow {
  font-family: "Space Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand img { display: block; max-width: 100%; object-fit: contain; }
.brand-company img { width: auto; height: 40px; }
.brand-area img { width: 250px; height: auto; }

.brand-divider {
  align-self: stretch; flex: none; width: 2px;
  border-radius: 2px; background: var(--grad); opacity: 0.55;
}

.hero h1 {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-weight: 800;
  font-size: clamp(2rem, 3.4vw, 3.3rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.grad-text {
  background: var(--grad);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: slide 6s linear infinite;
}

.lead {
  margin: 0; color: var(--ink-soft);
  font-size: 1.02rem; line-height: 1.65; max-width: 42ch;
}

.steps { display: grid; gap: 12px; }

.step {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; border: 1px solid var(--card-line);
  border-radius: 14px; background: rgba(255, 255, 255, 0.65);
}

.step-num {
  flex: none; width: 34px; height: 34px;
  display: grid; place-items: center; border-radius: 10px;
  font-family: "Space Mono", monospace; font-weight: 700; font-size: 0.85rem;
  color: var(--white); background: var(--grad);
}

.step-txt strong { display: block; font-size: 0.96rem; color: var(--ink); }
.step-txt span { font-size: 0.82rem; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: auto; }

.stat {
  padding: 16px; border: 1px solid var(--card-line);
  border-radius: 16px; background: var(--white); box-shadow: var(--shadow-md);
}

.stat strong {
  display: block; font-family: "Sora", sans-serif; font-size: 1.55rem;
  line-height: 1; margin-bottom: 6px;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

.stat span { font-size: 0.78rem; color: var(--muted); line-height: 1.35; }

.hero-foot {
  font-family: "Space Mono", monospace; font-size: 0.72rem;
  letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase;
}

/* ---------- Panel Formulario ---------- */
.form-panel {
  position: relative;
  padding: clamp(26px, 3vw, 44px);
  background: rgba(255, 255, 255, 0.82);
}

.form-head h2 {
  margin: 0 0 6px; font-family: "Sora", sans-serif; font-weight: 700;
  font-size: clamp(1.5rem, 2vw, 2rem); color: var(--ink);
}

.form-head p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* Enlace al perfil del puesto (Notion) */
.role-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: var(--c-purple);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid rgba(110, 70, 206, 0.3);
  transition: color 0.2s, border-color 0.2s;
}
.role-link:hover { color: var(--c-pink); border-color: var(--c-pink); }
.role-link svg { flex: none; }

/* Indicador de 2 pasos del formulario */
.form-steps {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.fstep {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
}
.fstep b {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-family: "Space Mono", monospace;
  font-size: 0.74rem;
  background: var(--paper-2);
  color: var(--muted);
}
.fstep.on { color: var(--ink); }
.fstep.on b { background: var(--grad); color: #fff; }
.fstep-sep {
  flex: 1;
  max-width: 46px;
  height: 2px;
  border-radius: 2px;
  background: var(--card-line);
}

.meter { margin: 22px 0 26px; }

.meter-label {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px; font-size: 0.8rem; color: var(--ink-soft);
}

.meter-label b {
  font-family: "Space Mono", monospace; font-size: 0.95rem;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

.meter-track {
  height: 9px; border-radius: 999px; background: var(--paper-2);
  border: 1px solid var(--card-line); overflow: hidden;
}

.meter-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: var(--grad); background-size: 200% 100%;
  animation: slide 6s linear infinite;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

form { display: grid; gap: 18px; }

.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }

.field.narrow input { max-width: 170px; }

.field label { font-weight: 600; color: var(--ink); font-size: 0.9rem; line-height: 1.4; }

.field input,
.field textarea {
  width: 100%; border-radius: 13px; border: 1.5px solid var(--card-line);
  background: var(--white); color: var(--ink); padding: 12px 14px;
  font-family: inherit; font-size: 0.97rem;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.field input::placeholder, .field textarea::placeholder { color: #a9b3c2; }

.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--c-purple);
  box-shadow: 0 0 0 4px rgba(110, 70, 206, 0.14);
}

.field input:valid:not(:placeholder-shown) { border-color: rgba(36, 201, 224, 0.55); }

.field input[aria-invalid="true"] {
  border-color: var(--c-pink); box-shadow: 0 0 0 4px rgba(232, 25, 110, 0.12);
}

.count { font-family: "Space Mono", monospace; font-weight: 700; color: var(--c-purple); }
.count.over { color: var(--c-pink); }

.hint {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.76rem; color: var(--muted);
}

/* Dropzone CV */
.drop {
  position: relative; display: flex; align-items: center; gap: 14px;
  padding: 16px; border: 1.5px dashed var(--line-strong); border-radius: 14px;
  background: rgba(244, 247, 252, 0.6); cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.drop:hover, .drop.drag { border-color: var(--c-purple); background: rgba(110, 70, 206, 0.06); }

.drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.drop-ic {
  flex: none; width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 11px; color: var(--white); background: var(--grad);
}

.drop-txt strong { display: block; font-size: 0.92rem; color: var(--ink); }
.drop-txt span { font-size: 0.78rem; color: var(--muted); }

.drop.filled { border-style: solid; border-color: rgba(36, 201, 224, 0.6); background: rgba(36, 201, 224, 0.06); }
.drop.error { border-style: solid; border-color: var(--c-pink); background: rgba(232, 25, 110, 0.06); }

.field-err {
  display: none; align-items: center; gap: 8px; margin: 2px 0 0;
  color: #c81e63; font-size: 0.82rem; font-weight: 600;
}
.field-err.show { display: flex; }
.field-err svg { flex: none; }

/* Botones */
.actions { display: flex; justify-content: flex-end; margin-top: 6px; }

.submit {
  position: relative; border: none; border-radius: 14px;
  background: var(--grad); background-size: 200% 100%; color: var(--white);
  font-family: "Sora", sans-serif; font-size: 1rem; font-weight: 700; letter-spacing: 0.01em;
  padding: 15px 30px; cursor: pointer;
  box-shadow: 0 16px 30px -12px rgba(110, 70, 206, 0.6);
  transition: transform 0.18s, box-shadow 0.18s, background-position 0.4s;
}

.submit:hover { transform: translateY(-2px); background-position: 100% 0; box-shadow: 0 22px 40px -14px rgba(110, 70, 206, 0.7); }
.submit:active { transform: translateY(0); }
.submit[disabled] { opacity: 0.75; cursor: progress; }

.ghost {
  border: 1.5px solid var(--card-line); background: var(--white); color: var(--ink);
  border-radius: 14px; padding: 14px 24px;
  font-family: "Sora", sans-serif; font-weight: 600; font-size: 0.95rem; cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, background 0.2s;
}
.ghost:hover { border-color: var(--c-purple); transform: translateY(-1px); }

.spinner {
  display: none; width: 16px; height: 16px; margin-right: 8px;
  border: 2.5px solid rgba(255, 255, 255, 0.45); border-top-color: #fff;
  border-radius: 50%; vertical-align: -3px; animation: spin 0.7s linear infinite;
}
.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Aviso de error */
.form-alert {
  display: none; align-items: center; gap: 10px; padding: 12px 14px;
  border-radius: 12px; border: 1px solid rgba(232, 25, 110, 0.35);
  background: rgba(232, 25, 110, 0.07); color: #a01259; font-size: 0.88rem;
}
.form-alert.show { display: flex; }

/* Entrada suave del layout */
@keyframes reveal-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
.reveal { opacity: 0; transform: translateY(16px); animation: reveal-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.r1 { animation-delay: 0.05s; }
.r2 { animation-delay: 0.14s; }
.r3 { animation-delay: 0.23s; }
.r4 { animation-delay: 0.32s; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Honeypot anti-spam (invisible para humanos) */
.hp {
  position: absolute !important;
  left: -9999px !important;
  top: -9999px !important;
  width: 1px; height: 1px; overflow: hidden;
}

/* ============================================================
   ESCENARIO DE PREGUNTAS — pantalla completa, una por una
   ============================================================ */
.stage {
  position: fixed; inset: 0; z-index: 200; display: none;
  overflow-y: auto;
  padding: 84px clamp(18px, 4vw, 48px) 40px;
}
.stage.open { display: flex; }

.stage-bg { position: fixed; inset: 0; z-index: -1; }

.stage-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 4;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px clamp(18px, 4vw, 40px);
}
.stage-top img { height: 30px; display: block; }

.stage-progress { display: flex; align-items: center; gap: 12px; }
.stage-progress.hide { visibility: hidden; }
.stage-progress span {
  font-family: "Space Mono", monospace; font-size: 12px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
}
.stage-dots { display: flex; gap: 6px; }
.stage-dots i { width: 22px; height: 5px; border-radius: 999px; background: var(--card-line); transition: background 0.3s; }
.stage-dots i.on { background: var(--grad); }

.stage-flash {
  position: fixed; inset: 0; z-index: 3; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 45%, rgba(255,255,255,0.95), rgba(125,211,252,0.3) 40%, transparent 70%);
}
.stage-flash.zap { animation: flash 0.4s ease-out; }
@keyframes flash { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }

/* margin:auto centra en el flex y permite scroll cuando el cuadro es más alto que la pantalla.
   Ancho fluido: crece con la ventana hasta un máximo cómodo para leer. */
.stage-inner { position: relative; margin: auto; width: min(94vw, 960px); display: grid; }

.q-card {
  grid-area: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; pointer-events: none;
}
.q-card.vis { visibility: visible; pointer-events: auto; }

.q-panel {
  position: relative; width: 100%;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--card-line);
  border-radius: 22px; box-shadow: var(--shadow-lg);
  padding: clamp(26px, 3.4vw, 48px);
  display: flex; flex-direction: column; gap: 18px;
}

.q-index {
  width: fit-content; font-family: "Space Mono", monospace; font-size: 13px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--white);
  background: var(--grad); padding: 6px 14px; border-radius: 999px;
}

.q-text {
  margin: 0; font-family: "Sora", sans-serif; font-weight: 700;
  font-size: clamp(1.35rem, 2.4vw, 2.1rem); line-height: 1.25; color: var(--ink);
}

.q-card textarea {
  width: 100%; min-height: 150px; border-radius: 14px;
  border: 1.5px solid var(--card-line); background: var(--white); color: var(--ink);
  padding: 14px 16px; font-family: inherit; font-size: 1rem; line-height: 1.6; resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.q-card textarea:focus { outline: none; border-color: var(--c-purple); box-shadow: 0 0 0 4px rgba(110,70,206,0.14); }
.q-card textarea[aria-invalid="true"] { border-color: var(--c-pink); box-shadow: 0 0 0 4px rgba(232,25,110,0.12); }

.q-msg { display: none; color: #c81e63; font-size: 0.85rem; font-weight: 600; margin: 0; }
.q-msg.show { display: block; }

.q-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; }
.q-nav.center { justify-content: center; }

/* Intro / éxito */
.intro-panel { text-align: center; align-items: center; }
.intro-ic {
  width: 72px; height: 72px; display: grid; place-items: center;
  border-radius: 20px; color: #fff; background: var(--grad); box-shadow: var(--shadow-md);
}
.intro-panel h2 { margin: 0; font-family: "Sora", sans-serif; font-size: clamp(1.5rem, 2.6vw, 2.1rem); color: var(--ink); }
.intro-panel p { margin: 0; color: var(--ink-soft); max-width: 46ch; line-height: 1.65; }

/* ===== Animaciones de entrada / salida ===== */
/* Q1 — vuela desde lejos */
@keyframes flyIn {
  0% { opacity: 0; transform: perspective(1200px) translate3d(-55vw, -42vh, -900px) rotate(-16deg) scale(0.15); filter: blur(8px); }
  60% { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: perspective(1200px) translate3d(0,0,0) rotate(0) scale(1); filter: blur(0); }
}
@keyframes flyOut {
  0% { opacity: 1; transform: perspective(1200px) translate3d(0,0,0) scale(1); filter: blur(0); }
  100% { opacity: 0; transform: perspective(1200px) translate3d(65vw, -34vh, -700px) rotate(14deg) scale(0.2); filter: blur(8px); }
}
.q-card.fly.in { animation: flyIn 0.85s cubic-bezier(0.16, 1, 0.3, 1) both; }
.q-card.fly.out { animation: flyOut 0.6s cubic-bezier(0.7, 0, 0.84, 0) both; }

/* Q2 — rayo */
@keyframes boltIn {
  0% { opacity: 0; transform: translateX(-130%) skewX(22deg) scale(1.03); }
  50% { opacity: 1; transform: translateX(5%) skewX(-8deg); }
  75% { transform: translateX(-2%) skewX(3deg); }
  100% { opacity: 1; transform: translateX(0) skewX(0); }
}
@keyframes boltOut {
  0% { opacity: 1; transform: translateX(0) skewX(0); }
  100% { opacity: 0; transform: translateX(135%) skewX(-24deg) scale(1.03); }
}
.q-card.bolt.in { animation: boltIn 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.q-card.bolt.out { animation: boltOut 0.28s cubic-bezier(0.8, 0, 0.9, 0.2) both; }

/* Q3 — portal (teletransporte) */
@keyframes portalIn {
  0% { opacity: 0; transform: scale(0.02, 0.02) rotate(-10deg); filter: brightness(1.8) saturate(1.6); }
  35% { opacity: 1; transform: scale(0.05, 1) rotate(3deg); filter: brightness(1.5) saturate(1.5); }
  70% { transform: scale(1.06, 1.06) rotate(-1.5deg); filter: brightness(1.1); }
  100% { opacity: 1; transform: scale(1) rotate(0); filter: none; }
}
@keyframes portalOut {
  0% { opacity: 1; transform: scale(1) rotate(0); filter: none; }
  45% { opacity: 1; transform: scale(0.05, 1.08) rotate(3deg); filter: brightness(1.6) saturate(1.6); }
  100% { opacity: 0; transform: scale(0.02, 0.02) rotate(12deg); filter: brightness(2.4); }
}
.q-card.portal.in { animation: portalIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) both; }
.q-card.portal.out { animation: portalOut 0.65s cubic-bezier(0.7, 0, 0.84, 0) both; }

/* Halo del portal */
.q-card.portal .q-panel::before {
  content: ""; position: absolute; inset: -14px; border-radius: 30px; padding: 2px;
  background: var(--grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  filter: blur(1px); pointer-events: none;
  animation: portalHalo 2.4s ease-in-out infinite;
}
@keyframes portalHalo { 0%, 100% { opacity: 0.25; } 50% { opacity: 0.7; } }

/* Intro / éxito — suave */
@keyframes softIn { from { opacity: 0; transform: translateY(18px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes softOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-14px) scale(0.97); } }
.q-card.soft.in { animation: softIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
.q-card.soft.out { animation: softOut 0.35s ease both; }

/* ---------- Responsive ---------- */
@media (max-width: 940px) {
  .shell { grid-template-columns: 1fr; }
  .hero { border-right: none; border-bottom: 1px solid var(--card-line); }
  .stats { margin-top: 6px; }
}

/* Escenario más compacto en pantallas angostas */
@media (max-width: 720px) {
  .stage { padding: 74px 16px 28px; }
  .q-panel { padding: 22px 20px; border-radius: 18px; gap: 14px; }
  .q-text { font-size: clamp(1.15rem, 4.6vw, 1.55rem); }
}

/* Escenario más compacto en pantallas de poca altura (o con zoom) */
@media (max-height: 680px) {
  .stage { padding-top: 58px; }
  .q-card textarea { min-height: 92px; }
  .q-panel { gap: 12px; }
  .intro-ic { width: 56px; height: 56px; }
}

@media (max-width: 560px) {
  .row { grid-template-columns: 1fr; }
  .brand { flex-direction: column; align-items: flex-start; gap: 16px; }
  .brand-divider { width: 100%; height: 2px; align-self: stretch; }
  .stats { grid-template-columns: 1fr; }
  .actions { justify-content: stretch; }
  .actions .submit { width: 100%; }
  .stage-top img { height: 24px; }
  .q-nav { flex-direction: column-reverse; }
  .q-nav .submit, .q-nav .ghost { width: 100%; }
  .q-nav.center { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .q-card.vis { opacity: 1 !important; visibility: visible !important; }
  .stage-flash { display: none; }
}
