/* Ruta Netlife — pantalla del participante */
:root {
  --bg: #0a0612;
  --bg-2: #170a24;
  --ink: #ffffff;
  --ink-2: rgba(255, 255, 255, .78);
  --ink-3: rgba(255, 255, 255, .55);
  --line: rgba(255, 255, 255, .16);
  --glass: rgba(255, 255, 255, .06);
  --yellow: #ffd21f;
  --orange: #ff7a00;
  --red: #e3174a;
  --magenta: #a3195b;
  --ok: #2ee6a0;
  --bad: #ff5470;
  --brand: linear-gradient(100deg, var(--yellow) 0%, var(--orange) 45%, var(--red) 82%, var(--magenta) 100%);
  --display: 'Poppins', system-ui, sans-serif;
  --body: 'Roboto', system-ui, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dock-h: 0px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(120% 90% at 50% 0%, var(--bg-2) 0%, var(--bg) 62%);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

#bg, #fx, .vignette, .flash { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#bg { z-index: 0; }
.vignette { z-index: 1; background: radial-gradient(ellipse at center, transparent 45%, rgba(5, 2, 10, .72) 100%); }
.flash { z-index: 2; opacity: 0; }
.flash.is-ok { background: radial-gradient(ellipse at center, transparent 40%, rgba(46, 230, 160, .32) 100%); }
.flash.is-bad { background: radial-gradient(ellipse at center, transparent 40%, rgba(255, 84, 112, .34) 100%); }
#fx { z-index: 80; }

/* ---------- Cabecera ---------- */
.top {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: max(14px, env(safe-area-inset-top)) clamp(16px, 4vw, 44px) 10px;
}
.top__logo { height: clamp(30px, 5vh, 52px); width: auto; display: block; }

.progress { grid-column: 2; min-width: 0; list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; gap: clamp(4px, 1vw, 8px); }
.progress li {
  position: relative;
  flex: 0 1 clamp(14px, 5vw, 56px);
  min-width: 6px;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .16);
  overflow: hidden;
}
.progress li::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .6s var(--ease);
  background: var(--ok);
}
.progress li.is-ok::after { transform: scaleX(1); }

.icon-btn {
  grid-column: 3;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--ink);
  cursor: pointer;
  transition: background .2s, transform .2s var(--ease);
}
.icon-btn:hover { background: rgba(255, 255, 255, .12); }
.icon-btn:active { transform: scale(.94); }
.ico { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.icon-btn[aria-pressed='true'] .ico--off, .icon-btn[aria-pressed='false'] .ico--on { display: none; }

:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
h2:focus { outline: none; }

/* ---------- Escenario ---------- */
.stage {
  position: relative;
  z-index: 5;
  flex: 1;
  display: grid;
  justify-items: center;
  align-items: start;
  padding: clamp(8px, 2vh, 24px) 16px calc(32px + var(--dock-h));
}
.screen { width: min(560px, 100%); }

.eyebrow {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(.78rem, .7rem + .4vw, 1rem);
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--yellow);
}

/* ---------- Botón principal ---------- */
.cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 60px;
  padding: 14px 32px;
  border: 0;
  border-radius: 99px;
  background: var(--brand);
  background-size: 180% 100%;
  color: #1b0a05;
  font-family: var(--display);
  font-weight: 800;
  font-style: italic;
  font-size: clamp(1.1rem, 1rem + .6vw, 1.4rem);
  text-transform: uppercase;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: 0 10px 34px -8px rgba(255, 122, 0, .75), inset 0 1px 0 rgba(255, 255, 255, .45);
  transition: transform .2s var(--ease), background-position .5s var(--ease), filter .2s;
  isolation: isolate;
}
.cta::before {
  content: '';
  position: absolute;
  inset: -6px;
  z-index: -1;
  border-radius: inherit;
  border: 2px solid rgba(255, 170, 0, .6);
  animation: cta-pulse 1.9s ease-out infinite;
}
.cta svg { width: 1.25em; height: 1.25em; flex-shrink: 0; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.cta:hover { background-position: 100% 0; }
.cta:active { transform: scale(.97); }
.cta:disabled { filter: grayscale(1); opacity: .5; cursor: progress; }
.cta:disabled::before { animation: none; opacity: 0; }
.cta--block { width: 100%; }
.cta--sm { min-height: 50px; padding: 10px 22px; font-size: 1rem; flex-shrink: 0; }
.cta--sm::before { display: none; }
@keyframes cta-pulse { from { transform: scale(.98); opacity: .9; } to { transform: scale(1.06, 1.3); opacity: 0; } }

.link { padding: 6px 4px; border: 0; background: none; color: var(--ink-3); font: 500 .9rem var(--body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link:hover { color: var(--ink); }

/* ---------- Registro ---------- */
.register { display: flex; flex-direction: column; align-items: center; text-align: center; gap: clamp(8px, 1.6vh, 16px); }
.register__title {
  margin: 0;
  max-width: 14ch;
  font-family: var(--display);
  font-weight: 900;
  font-style: italic;
  font-size: clamp(2.4rem, 1.4rem + 6vw, 4.6rem);
  line-height: .98;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff 30%, #ffe9c2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 26px rgba(255, 122, 0, .45));
  padding: 0 .08em;
}
.register__sub { margin: 0; max-width: 40ch; color: var(--ink-2); font-size: clamp(1rem, .95rem + .4vw, 1.2rem); }
.pending { margin: 0; padding: 10px 16px; border-radius: 14px; border: 1px solid rgba(255, 210, 31, .45); background: rgba(255, 210, 31, .1); color: var(--yellow); font-weight: 500; }

.orbit { position: relative; width: clamp(132px, 22vh, 190px); aspect-ratio: 1; display: grid; place-items: center; margin-bottom: 4px; }
.orbit__ring { position: absolute; inset: 0; border-radius: 50%; border: 2px dashed rgba(255, 170, 0, .5); animation: spin 22s linear infinite; }
.orbit__ring--2 { inset: -14%; border: 1px solid rgba(255, 255, 255, .2); animation: ping 2.8s ease-out infinite; }
.orbit__dots { position: absolute; inset: 0; animation: spin 14s linear infinite; }
.orbit__dots span { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px; border-radius: 50%; background: rgba(255, 255, 255, .22); border: 2px solid rgba(255, 255, 255, .4); animation: dot-on 7s infinite; }
.orbit__pin { position: relative; width: 38%; filter: drop-shadow(0 8px 22px rgba(255, 122, 0, .65)); animation: bob 3.2s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ping { from { transform: scale(.72); opacity: .9; } to { transform: scale(1.12); opacity: 0; } }
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes dot-on { 0%, 8% { background: rgba(255, 255, 255, .22); border-color: rgba(255, 255, 255, .4); box-shadow: none; } 14%, 86% { background: var(--ok); border-color: var(--ok); box-shadow: 0 0 14px var(--ok); } 100% { background: rgba(255, 255, 255, .22); } }

.card {
  width: 100%;
  margin-top: 6px;
  padding: 22px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .03));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-align: left;
  display: grid;
  gap: 14px;
}
.field { display: grid; gap: 6px; }
.field span { font-weight: 500; font-size: .92rem; color: var(--ink-2); }
.input {
  width: 100%;
  min-height: 54px;
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: rgba(10, 6, 18, .7);
  color: var(--ink);
  font: 500 1.1rem var(--body);
  transition: border-color .2s, box-shadow .2s;
}
.input::placeholder { color: rgba(255, 255, 255, .35); }
.input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 4px rgba(255, 122, 0, .25); }
.form-error { margin: 0; padding: 10px 14px; border-radius: 12px; background: rgba(255, 84, 112, .16); color: #ffb3c0; font-size: .95rem; }
.form-note { margin: 0; text-align: center; font-size: .85rem; color: var(--ink-3); }

/* ---------- Pasaporte ---------- */
.passport { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.hello { text-align: center; }
.hello__name {
  margin: 2px 0 0;
  font-family: var(--display);
  font-weight: 900;
  font-style: italic;
  font-size: clamp(1.6rem, 1.2rem + 3vw, 2.6rem);
  line-height: 1.05;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.hello__name em { font-style: inherit; background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; padding-right: .08em; }

.summary { display: flex; flex-direction: column; align-items: center; }
.ring { position: relative; width: clamp(150px, 26vh, 210px); aspect-ratio: 1; }
.ring svg { width: 100%; height: 100%; overflow: visible; }
.ring__track { fill: none; stroke: rgba(255, 255, 255, .12); stroke-width: 14; }
.ring__bar { fill: none; stroke: url(#gRing); stroke-width: 14; stroke-linecap: round; stroke-dasharray: 540.4; stroke-dashoffset: 540.4; filter: drop-shadow(0 0 14px rgba(255, 122, 0, .8)); transition: stroke-dashoffset 1.2s var(--ease); }
.ring__num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--display); line-height: 1; }
.ring__num strong { font-weight: 900; font-style: italic; font-size: clamp(3.4rem, 10vh, 5.4rem); padding-right: .06em; }
.ring__num span { margin-top: 4px; font-weight: 700; font-size: clamp(.9rem, 2.2vh, 1.2rem); color: var(--ink-3); text-transform: uppercase; letter-spacing: .14em; }
.summary__label { margin: 6px 0 0; font-family: var(--display); font-weight: 700; font-size: .95rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); }

/* Ruta: una parada por punto de control, unidas por una línea que se llena */
.route { list-style: none; margin: 4px 0 0; padding: 0; width: 100%; display: grid; }
.stop { position: relative; display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 8px 0; }
.stop::before { /* tramo hasta la siguiente parada */
  content: '';
  position: absolute;
  left: 27px;
  top: 50%;
  height: 100%;
  width: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .12);
}
.stop::after {
  content: '';
  position: absolute;
  left: 27px;
  top: 50%;
  height: 100%;
  width: 4px;
  border-radius: 4px;
  background: var(--ok);
  box-shadow: 0 0 12px rgba(46, 230, 160, .6);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform .7s var(--ease);
}
.stop:last-child::before, .stop:last-child::after { display: none; }
.stop.is-ok.next-ok::after { transform: scaleY(1); }

.stop__node {
  position: relative;
  z-index: 1;
  width: 58px; height: 58px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 2.5px dashed rgba(255, 255, 255, .35);
  background: #150b20;
  font-family: var(--display);
  font-weight: 900;
  font-style: italic;
  font-size: 1.4rem;
  color: var(--ink-2);
  transition: background .35s, border-color .35s, color .35s, box-shadow .35s;
}
.stop__node svg { width: 30px; height: 30px; stroke: currentColor; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.stop__body { min-width: 0; }
.stop__name { margin: 0; font-family: var(--display); font-weight: 700; font-size: 1.08rem; line-height: 1.2; overflow-wrap: anywhere; }
.stop__desc { margin: 2px 0 0; font-size: .9rem; color: var(--ink-3); }
.stop__state {
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid var(--line);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}

.stop.is-ok .stop__node { border: 0; background: var(--ok); color: #04261a; box-shadow: 0 0 0 5px rgba(46, 230, 160, .18), 0 0 26px rgba(46, 230, 160, .55); }
.stop.is-ok .stop__state { border-color: rgba(46, 230, 160, .5); background: rgba(46, 230, 160, .14); color: var(--ok); }
.stop__burst { position: absolute; left: 0; top: 50%; width: 58px; height: 58px; margin-top: -29px; border-radius: 50%; border: 3px solid var(--ok); opacity: 0; pointer-events: none; }

/* Ruta completada */
.done {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 24px 20px 22px;
  border-radius: 24px;
  border: 1.5px solid rgba(46, 230, 160, .55);
  background: linear-gradient(160deg, rgba(46, 230, 160, .2), rgba(46, 230, 160, .04) 60%);
  box-shadow: 0 20px 60px -24px rgba(46, 230, 160, .7);
  overflow: hidden;
}
.done::before { /* brillo que recorre la tarjeta */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .14) 50%, transparent 65%);
  animation: sheen 3.2s ease-in-out infinite;
  pointer-events: none;
}
.seal { width: 110px; height: 110px; animation: seal-spin 10s linear infinite; }
.seal svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 22px rgba(46, 230, 160, .7)); }
.done__title { margin: 6px 0 0; font-family: var(--display); font-weight: 900; font-style: italic; font-size: clamp(1.9rem, 1.4rem + 3vw, 2.8rem); line-height: 1; text-transform: uppercase; color: var(--ok); }
.done__sub { margin: 0; color: var(--ink); font-size: 1.05rem; }
.done__hint { margin: 4px 0 0; color: var(--ink-3); font-size: .9rem; }
.live { display: inline-flex; align-items: center; gap: 8px; margin: 8px 0 0; padding: 8px 16px; border-radius: 99px; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); font-size: .9rem; color: var(--ink-2); }
.live i { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); animation: blink 1s steps(2, start) infinite; }
.live b { font-family: var(--display); font-variant-numeric: tabular-nums; color: var(--ink); letter-spacing: .04em; }
@keyframes sheen { from { transform: translateX(-100%); } 60%, to { transform: translateX(100%); } }
@keyframes seal-spin { 0%, 100% { transform: rotate(-6deg) scale(1); } 50% { transform: rotate(6deg) scale(1.04); } }
@keyframes blink { to { visibility: hidden; } }

/* ---------- Botón fijo de escanear ---------- */
.dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  padding: 18px 16px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(10, 6, 18, .92) 40%);
}
.dock .cta { display: flex; width: min(560px, 100%); margin: 0 auto; min-height: 64px; }

/* ---------- Escáner ---------- */
.scanner { position: fixed; inset: 0; z-index: 70; background: #000; overflow: hidden; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner__shade { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.scanner__frame {
  position: relative;
  width: min(72vw, 72vh, 340px);
  aspect-ratio: 1;
  border-radius: 24px;
  box-shadow: 0 0 0 100vmax rgba(5, 2, 10, .62);
}
.scanner__frame i { position: absolute; width: 22%; height: 22%; border: 5px solid var(--yellow); filter: drop-shadow(0 0 8px rgba(255, 170, 0, .8)); }
.scanner__frame i:nth-child(1) { left: -3px; top: -3px; border-right: 0; border-bottom: 0; border-top-left-radius: 24px; }
.scanner__frame i:nth-child(2) { right: -3px; top: -3px; border-left: 0; border-bottom: 0; border-top-right-radius: 24px; }
.scanner__frame i:nth-child(3) { left: -3px; bottom: -3px; border-right: 0; border-top: 0; border-bottom-left-radius: 24px; }
.scanner__frame i:nth-child(4) { right: -3px; bottom: -3px; border-left: 0; border-top: 0; border-bottom-right-radius: 24px; }
.scanner__laser { position: absolute; left: 8%; right: 8%; top: 10%; height: 3px; border-radius: 3px; background: var(--brand); box-shadow: 0 0 16px 3px rgba(255, 122, 0, .8); animation: laser 2.2s ease-in-out infinite alternate; }
.scanner.is-hit .scanner__frame i { border-color: var(--ok); filter: drop-shadow(0 0 12px var(--ok)); }
.scanner.is-hit .scanner__laser { opacity: 0; }
@keyframes laser { to { top: 88%; } }
.scanner__top {
  position: absolute;
  left: 0; right: 0; top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(16px, env(safe-area-inset-top)) 16px 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .7), transparent);
}
.scanner__top p { margin: 0; font-family: var(--display); font-weight: 700; font-size: 1.05rem; line-height: 1.25; }
.scanner__top .icon-btn { flex-shrink: 0; background: rgba(0, 0, 0, .45); }
.scanner__fallback {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 22px 16px max(20px, env(safe-area-inset-bottom));
  background: rgba(14, 8, 22, .96);
  border-top: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
}
.scanner__msg { margin: 0 0 14px; color: var(--ink-2); }
.scanner__msg:empty { display: none; }
.manual { display: grid; gap: 8px; }
.manual label { font-size: .92rem; color: var(--ink-3); }
.manual__row { display: flex; gap: 8px; }
.manual .input { min-width: 0; text-transform: uppercase; letter-spacing: .12em; font-family: var(--display); font-weight: 700; }

/* ---------- Aviso tras escanear ---------- */
.sheet { position: fixed; left: 0; right: 0; top: 0; z-index: 75; padding: max(12px, env(safe-area-inset-top)) 12px 0; pointer-events: none; }
.sheet__inner {
  position: relative;
  width: min(560px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(20, 10, 30, .94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 60px -10px rgba(0, 0, 0, .8);
  pointer-events: auto;
  overflow: hidden;
  --tone: var(--ok);
  --tone-ink: #04261a;
}
.sheet.is-warn .sheet__inner { --tone: var(--yellow); --tone-ink: #2a1d00; }
.sheet.is-bad .sheet__inner { --tone: var(--bad); --tone-ink: #2a0510; }
.sheet__inner::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--tone); }
.sheet__badge { flex: 0 0 auto; width: 52px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: var(--tone); color: var(--tone-ink); }
.sheet__badge svg { width: 56%; height: 56%; stroke: currentColor; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.sheet__body { flex: 1; min-width: 0; }
.sheet__title { margin: 0; font-family: var(--display); font-weight: 900; font-style: italic; font-size: 1.3rem; text-transform: uppercase; color: var(--tone); line-height: 1.1; }
.sheet__text { margin: 2px 0 0; color: var(--ink-2); font-size: .98rem; }

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