/* Ruta al Cierre — experiencia del candidato (v2, gamificada).
   Portado de content/prototipo-experiencia-ruta-al-cierre.html.
   SOLO esta hoja + index.html la usan — admin.html jamás la importa,
   así que nada de esto (fondo oscuro, tipografía invertida, animaciones)
   se filtra al panel de reclutador. Tokens y componentes REALMENTE
   compartidos (botones/chips/semáforo/barra mini del dashboard) siguen
   viviendo en rc-core.css. */

:root {
  /* Overrides/adiciones solo para esta hoja (no afectan admin.html,
     que no la importa) */
  --navy-deep: #021C2E;
  --ice: #E6EEF3;
  --amber-hi: #FFA94D;
  --success: #2FBF83; /* verde de celebración del candidato — distinto del --success de admin (#1E9E6A), a propósito */
}

* { -webkit-tap-highlight-color: transparent; }
/* Red de seguridad sistémica: cualquier regla que ponga display:X sin
   condicionarla a una clase (ej. .q-video{display:block}) puede ganarle
   al atributo hidden por cascada — ya pasó dos veces. Esto lo blinda. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}
body {
  font-family: var(--fuente);
  font-size: 16px;
  color: #fff;
  background: radial-gradient(120% 90% at 50% -10%, #0E4B6E 0%, var(--navy) 45%, var(--navy-deep) 100%);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.app { min-height: 100vh; min-height: 100dvh; }

/* ==== iconografía vectorial (VIC) ==== */
.vic { display: inline-block; vertical-align: middle; }
.vic path, .vic circle, .vic line, .vic rect, .vic polyline {
  fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.vic .acc { stroke: var(--amber-hi); }
.vic .fillacc { fill: var(--amber); stroke: none; }
.vic.dark path, .vic.dark circle, .vic.dark line, .vic.dark polyline { stroke: var(--navy); }
.vic.dark .acc { stroke: var(--amber); }
.draw { stroke-dasharray: 100; stroke-dashoffset: 100; animation: draw .9s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ==== ruta ambiental de fondo ==== */
#bgRoute { position: fixed; inset: 0; z-index: 0; opacity: .14; pointer-events: none; }
#bgRoute path {
  stroke: var(--amber); stroke-width: 2.5; fill: none;
  stroke-dasharray: 2 14; stroke-linecap: round; animation: routeFlow 40s linear infinite;
}
@keyframes routeFlow { to { stroke-dashoffset: -640; } }

#fx { position: fixed; inset: 0; z-index: 5; pointer-events: none; }

.stage {
  position: relative; z-index: 1; max-width: 480px; margin: 0 auto;
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: 0 18px;
}

/* ==== header / mapa de ruta ==== */
header#hdr { padding: 14px 2px 6px; }
.hud { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.hud-left { font-size: 12.5px; color: var(--silver); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.hud-chips { display: flex; gap: 8px; align-items: center; }
.hchip {
  font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px;
  background: rgba(232,130,26,.16); color: var(--amber-hi); border: 1px solid rgba(232,130,26,.35);
}
.hchip.racha {
  background: rgba(47,191,131,.14); color: #7FE0B6; border-color: rgba(47,191,131,.35);
  display: none; align-items: center; gap: 6px;
}
.hchip.racha.on { display: inline-flex; animation: pop .45s cubic-bezier(.34,1.56,.64,1); }
.routebar { position: relative; height: 40px; }
.routebar svg { width: 100%; height: 40px; overflow: visible; }
.rb-track { stroke: rgba(255,255,255,.16); stroke-width: 3; fill: none; stroke-dasharray: 1 9; stroke-linecap: round; }
.rb-fill {
  stroke: var(--amber); stroke-width: 3.5; fill: none; stroke-dasharray: 1 9; stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(232,130,26,.55));
}
@media (prefers-reduced-motion: no-preference) { .rb-fill { transition: stroke-dasharray .6s cubic-bezier(.22,1,.36,1); } }
.station circle { fill: var(--navy-800); stroke: rgba(255,255,255,.35); stroke-width: 2; transition: all .4s; }
.station.done circle { fill: var(--amber); stroke: var(--amber-hi); filter: drop-shadow(0 0 6px rgba(232,130,26,.7)); }
#traveler { filter: drop-shadow(0 0 8px rgba(255,169,77,.9)); }
#traveler circle { fill: var(--amber-hi); transition: all .8s cubic-bezier(.34,1.2,.4,1); }
#traveler .pulse { fill: none; stroke: var(--amber-hi); stroke-width: 2; opacity: 0; animation: sonar 2s ease-out infinite; }
@keyframes sonar { 0% { r: 6; opacity: .8; } 100% { r: 16; opacity: 0; } }

/* ==== pantallas ==== */
.screen { flex: 1; display: none; flex-direction: column; padding: 8px 0 26px; }
.screen.on { display: flex; animation: screenIn .5s cubic-bezier(.22,1,.36,1); }
.screen.out { animation: screenOut .32s ease-in forwards; }
@keyframes screenIn { from { opacity: 0; transform: translateX(46px); } to { opacity: 1; transform: none; } }
@keyframes screenOut { to { opacity: 0; transform: translateX(-46px); } }

/* --- bienvenida --- */
.welcome { justify-content: center; text-align: center; gap: 14px; }
.brandchip {
  margin: 0 auto; background: #fff; border-radius: 14px; padding: 10px 18px; width: max-content;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
@media (prefers-reduced-motion: no-preference) { .brandchip { animation: floaty 6s ease-in-out infinite; } }
.brandchip b { font-family: var(--fuente-display); font-weight: 800; font-size: 18px; color: var(--silver); }
.brandchip span { color: var(--navy); }
.brandchip i { color: var(--amber); font-style: normal; }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.marca-cliente-linea { font-size: 12.5px; color: rgba(255,255,255,.55); margin: 2px 0 0; display: flex; align-items: center; gap: 8px; justify-content: center; }
.marca-cliente-linea img { height: 20px; width: auto; border-radius: 4px; background: #fff; padding: 2px; }
.welcome h1 { font-size: 30px; line-height: 1.15; margin: 6px 0 0; font-weight: 800; font-family: var(--fuente-display); }
.welcome h1 em { color: var(--amber-hi); font-style: normal; }
.welcome p { color: #BFD3DF; font-size: 15px; line-height: 1.55; margin: 0 8px; }
.meta { display: flex; gap: 10px; justify-content: center; margin-top: 4px; }
.meta div {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px; padding: 10px 14px; font-size: 12px; color: var(--ice);
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 86px;
}
.meta b { font-size: 13px; color: #fff; font-family: var(--fuente-display); }

/* --- splash de etapa --- */
.splash { justify-content: center; align-items: center; text-align: center; gap: 14px; }
.splash-ico {
  width: 96px; height: 96px; border-radius: 26px;
  background: linear-gradient(160deg, rgba(232,130,26,.22), rgba(232,130,26,.05));
  border: 1px solid rgba(232,130,26,.4);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 46px rgba(232,130,26,.28);
  animation: splashPop .55s cubic-bezier(.34,1.5,.5,1);
}
@keyframes splashPop { from { transform: scale(.3) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
.splash-kicker {
  font-size: 11px; letter-spacing: .3em; color: var(--silver); font-weight: 700; text-transform: uppercase;
  opacity: 0; animation: fadeUp .45s .35s ease forwards;
}
.splash h2 { font-size: 30px; margin: 0; font-weight: 800; font-family: var(--fuente-display); opacity: 0; animation: fadeUp .5s .45s cubic-bezier(.22,1,.36,1) forwards; }
.splash-line {
  width: 0; height: 3px; border-radius: 3px; background: var(--amber);
  box-shadow: 0 0 10px rgba(232,130,26,.8); animation: lineGrow .6s .6s cubic-bezier(.22,1,.36,1) forwards;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes lineGrow { to { width: 74px; } }

/* --- escenario --- */
.scene-chip {
  display: inline-flex; align-items: center; gap: 8px; width: max-content;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  padding: 7px 14px 7px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--ice);
  margin: 6px 0 12px; animation: pop .5s cubic-bezier(.34,1.56,.64,1);
}
.scard {
  background: var(--card); color: var(--text); border-radius: 18px;
  padding: 18px 18px 16px; box-shadow: 0 16px 40px rgba(0,0,0,.35);
  animation: cardDrop .55s cubic-bezier(.22,1.4,.36,1); min-height: 96px; cursor: pointer;
}
@keyframes cardDrop { from { opacity: 0; transform: translateY(-16px) scale(.97); } to { opacity: 1; transform: none; } }
.scard p { margin: 0; font-size: 15.5px; line-height: 1.6; white-space: pre-line; }
.scard.video-modo { padding: 14px; overflow: hidden; cursor: default; line-height: 0; text-align: center; }
.q-video { display: block; max-height: 55vh; width: auto; max-width: 100%; margin: 0 auto; object-fit: contain; background: #000; border-radius: 14px; }
.caret { display: inline-block; width: 2px; height: 1.05em; background: var(--amber); vertical-align: -3px; margin-left: 1px; animation: blink .75s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.skiphint { font-size: 11px; color: var(--muted, var(--text-muted)); margin-top: 10px; opacity: .7; }
.opts { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.opt {
  background: rgba(255,255,255,.96); color: var(--text); border: 2px solid transparent;
  border-radius: 14px; padding: 14px 44px 14px 15px; font-size: 14px; line-height: 1.45;
  cursor: pointer; position: relative; opacity: 0; transform: translateY(14px);
  transition: transform .15s, box-shadow .15s, border-color .15s, background .15s; user-select: none;
  text-align: left; appearance: none; width: 100%; font-family: var(--fuente);
}
.opt.in { animation: optIn .45s cubic-bezier(.22,1,.36,1) forwards; }
@keyframes optIn { to { opacity: 1; transform: none; } }
.opt:active { transform: scale(.975); }
.opt .tick {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%) scale(0);
  width: 24px; height: 24px; border-radius: 50%; background: var(--amber);
  display: flex; align-items: center; justify-content: center;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
.opt.sel { border-color: var(--amber); background: var(--amber-soft); box-shadow: 0 8px 22px rgba(232,130,26,.35); transform: translateY(-2px); }
.opt.sel .tick { transform: translateY(-50%) scale(1); }
.opt:disabled { cursor: default; }

.cta {
  margin-top: 16px; border: none; border-radius: 14px; padding: 15px;
  font-family: var(--fuente-display); font-weight: 700; font-size: 16px; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, var(--amber) 0%, #F09A3E 100%);
  box-shadow: 0 10px 26px rgba(232,130,26,.45);
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity .3s, transform .3s; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%;
}
.cta.ready { opacity: 1; transform: none; pointer-events: auto; }
@media (prefers-reduced-motion: no-preference) {
  .cta.ready { animation: breathe 2.2s ease-in-out infinite; }
  .cta::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent);
    animation: shine 2.6s ease-in-out infinite; }
}
@keyframes breathe { 0%, 100% { box-shadow: 0 10px 26px rgba(232,130,26,.45); } 50% { box-shadow: 0 10px 34px rgba(232,130,26,.75); } }
@keyframes shine { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.cta:active { transform: scale(.98); }
.cta:disabled { pointer-events: none; }

/* --- interstitial --- */
.inter { justify-content: center; align-items: center; text-align: center; gap: 12px; }
.inter-ico {
  width: 104px; height: 104px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.16), rgba(255,255,255,0) 60%),
              linear-gradient(160deg, rgba(47,191,131,.25), rgba(47,191,131,.06));
  border: 1px solid rgba(47,191,131,.45);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 50px rgba(47,191,131,.3);
  animation: splashPop .6s cubic-bezier(.34,1.5,.5,1);
}
.inter h2 { font-size: 26px; margin: 0; font-weight: 800; font-family: var(--fuente-display); }
.inter p { color: #BFD3DF; margin: 0; font-size: 14.5px; }
.stagepill {
  background: rgba(232,130,26,.15); border: 1px solid rgba(232,130,26,.4);
  color: var(--amber-hi); font-weight: 700; padding: 8px 18px; border-radius: 999px; font-size: 14px;
  animation: pop .5s .15s cubic-bezier(.34,1.56,.64,1) backwards;
}

/* --- final --- */
.final { justify-content: center; align-items: center; text-align: center; gap: 12px; }
.badge {
  width: 156px; height: 156px; border-radius: 50%; position: relative;
  background: conic-gradient(from 210deg, #C96F12, var(--amber), #FFC177, var(--amber), #C96F12);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 18px 50px rgba(232,130,26,.45), inset 0 0 0 6px rgba(255,255,255,.25);
  animation: badgeIn .8s cubic-bezier(.34,1.4,.5,1);
}
@keyframes badgeIn { from { transform: scale(.2) rotate(-30deg); opacity: 0; } to { transform: none; opacity: 1; } }
.badge .inner {
  width: 118px; height: 118px; border-radius: 50%; background: var(--navy);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.badge small { font-size: 9px; letter-spacing: .14em; color: var(--amber-hi); font-weight: 700; }
.final h2 { font-size: 26px; margin: 4px 0 0; font-weight: 800; font-family: var(--fuente-display); }
.final p { color: #BFD3DF; font-size: 14.5px; margin: 0 10px; line-height: 1.5; }

@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

.soundtgl {
  position: fixed; right: 14px; bottom: 14px; z-index: 6; background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2); color: #fff; border-radius: 999px; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}

/* --- error / carga (heredan el fondo oscuro, mensajes simples) --- */
/* OJO: nunca poner display aquí — .screen{display:none} / .screen.on{display:flex}
   ya controlan visibilidad; si esta regla fijara display quedaría siempre
   visible por empate de especificidad + orden de cascada (bug real, ya visto). */
.screen-centrada { justify-content: center; text-align: center; gap: 4px; }
.texto-sutil { color: var(--ice); font-size: 15px; }
.titulo { font-family: var(--fuente-display); font-size: 26px; font-weight: 800; margin: 0 0 12px; }
.parrafo { font-size: 15px; line-height: 1.55; color: #BFD3DF; margin: 0 8px 20px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
  #bgRoute path { animation: none; }
}
