/* ================= Bienvenida tras el pago (bienvenida.js) ================= */

/* ---------- Pantalla completa: primera entrada al área ---------- */
body.nw-open { overflow: hidden; }
.nst-welcome {
  position: fixed; inset: 0; z-index: 600; display: grid; place-items: center; overflow: hidden;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  background: radial-gradient(120% 90% at 50% 40%, #0a100e 0%, #050706 60%, #030404 100%);
  --tone: #3ddc97; --tone-hi: #a6f7d2; --tone-lo: #c9b37e; --bx: 80%; --by: 40%;
  opacity: 0; transition: opacity 360ms ease;
}
.nst-welcome[data-tone=core] { --tone: #c9b37e; --tone-hi: #f1e4bd; --tone-lo: #3ddc97; }
.nst-welcome[data-tone=coach] { --tone: #f0525c; --tone-hi: #ffa3a8; --tone-lo: #c9b37e; }
.nst-welcome[data-tone=admin] { --tone: #b79cff; --tone-hi: #e5dbff; --tone-lo: #3ddc97; }
.nst-welcome.in { opacity: 1; }
.nst-welcome.out { opacity: 0; transition: opacity 600ms ease; }
.nst-welcome.out .nw-center { transform: scale(1.04); filter: blur(6px); transition: transform 600ms var(--ease-out), filter 500ms ease; }
/* Cuadrícula fina que se desvanece hacia los bordes */
.nst-welcome::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 56px 56px; background-position: center;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 80%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 80%);
}
/* Destello de toda la pantalla al romper */
.nst-welcome::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at var(--bx) var(--by), color-mix(in srgb, var(--tone-hi) 30%, transparent), transparent 55%);
}
.nst-welcome.break::after { animation: nw-flash 900ms ease-out; }
@keyframes nw-flash { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }

.nw-aurora {
  position: absolute; inset: -20%; pointer-events: none; opacity: .5; transition: opacity 900ms ease;
  background:
    radial-gradient(40% 35% at 30% 30%, color-mix(in srgb, var(--tone) 22%, transparent), transparent 70%),
    radial-gradient(35% 30% at 72% 65%, color-mix(in srgb, var(--tone-lo) 18%, transparent), transparent 70%);
  filter: blur(30px); animation: nw-drift 14s ease-in-out infinite alternate;
}
.nst-welcome.hello .nw-aurora { opacity: 1; }
@keyframes nw-drift { to { transform: translate(3%, -2%) rotate(6deg); } }

/* Velas */
.nw-chart { position: absolute; left: 0; right: 0; bottom: 4%; height: 56%; pointer-events: none; transition: opacity 900ms ease, filter 900ms ease; }
.nw-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.nst-welcome.hello .nw-chart { opacity: .22; filter: blur(1.5px); }
.wc line { stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.wc.up line { stroke: #3ddc97; } .wc.up rect { fill: #3ddc97; }
.wc.down line { stroke: #f0525c; } .wc.down rect { fill: #f0525c; }
.wc { opacity: 0; transform-box: fill-box; transform-origin: center; }
.nst-welcome.build .wc:not(.wc-big) { animation: nw-candle 420ms var(--ease-out) calc(var(--i) * 45ms) both; }
@keyframes nw-candle { from { opacity: 0; transform: scaleY(.1); } to { opacity: .85; transform: none; } }
.wc-big { transform-origin: bottom; }
.wc-big rect { fill: #3ddc97; filter: drop-shadow(0 0 10px rgba(61, 220, 151, .7)); }
.nst-welcome.grow .wc-big { animation: nw-big 520ms cubic-bezier(.2, .9, .25, 1.15) both; }
@keyframes nw-big { from { opacity: 1; transform: scaleY(.04); } to { opacity: 1; transform: none; } }
.wc-res { stroke: #c9b37e; stroke-width: 1.5; stroke-dasharray: 6 6; vector-effect: non-scaling-stroke; opacity: 0; transition: opacity 500ms ease, stroke 300ms ease; }
.nst-welcome.build .wc-res { opacity: .7; }
.nst-welcome.break .wc-res { stroke: #a6f7d2; opacity: 1; }
.wc-res-label {
  position: absolute; left: 16px; transform: translateY(-140%); opacity: 0; transition: opacity 500ms ease 300ms, color 300ms ease;
  font-family: var(--font-mono); font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: #c9b37e;
}
.nst-welcome.build .wc-res-label { opacity: .85; }
.nst-welcome.break .wc-res-label { color: #a6f7d2; }

/* Chispas y onda de choque */
.nw-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.nw-fx-page { position: fixed; z-index: 250; }
.nw-shock {
  position: absolute; left: var(--bx); top: var(--by); width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
  border: 2px solid var(--tone-hi); opacity: 0; pointer-events: none;
}
.nst-welcome.break .nw-shock { animation: nw-shock 900ms var(--ease-out); }
@keyframes nw-shock { 0% { opacity: .9; transform: scale(.2); } 100% { opacity: 0; transform: scale(9); } }

/* Logo, saludo y plan */
.nw-center { position: relative; z-index: 2; max-width: 620px; text-align: center; display: grid; justify-items: center; }
/* Sombra suave detrás del texto para que las velas no estorben al leer */
.nw-center::before {
  content: ""; position: absolute; inset: -12% -18%; z-index: -1; pointer-events: none; opacity: 0; transition: opacity 900ms ease;
  background: radial-gradient(closest-side, rgba(3, 5, 4, .82), rgba(3, 5, 4, .5) 60%, transparent);
}
.nst-welcome.hello .nw-center::before { opacity: 1; }
.nw-center > * { opacity: 0; transform: translateY(14px); }
.nst-welcome.hello .nw-center > * { opacity: 1; transform: none; transition: opacity 600ms ease, transform 700ms var(--ease-out); }
.nst-welcome.hello .nw-center > :nth-child(2) { transition-delay: 160ms; }
.nst-welcome.hello .nw-center > :nth-child(3) { transition-delay: 220ms; }
.nst-welcome.hello .nw-center > :nth-child(4) { transition-delay: 700ms; }
.nst-welcome.hello .nw-center > :nth-child(5) { transition-delay: 820ms; }
.nst-welcome.hello .nw-center > :nth-child(6) { transition-delay: 980ms; }

.nw-emblem { position: relative; width: 104px; height: 104px; display: grid; place-items: center; margin-bottom: 22px; }
.nst-welcome.hello .nw-emblem { transform: none; animation: nw-pop 760ms cubic-bezier(.2, .9, .25, 1.25) both; }
@keyframes nw-pop { from { opacity: 0; transform: scale(.4) rotate(-8deg); } to { opacity: 1; transform: none; } }
.nw-logo { width: 72px; height: 72px; position: relative; z-index: 1; filter: drop-shadow(0 8px 24px rgba(0, 0, 0, .6)); }
.nw-logo-box { fill: #0b1210; stroke: color-mix(in srgb, var(--tone) 70%, transparent); stroke-width: 1.5; }
.nw-ring { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--tone) 55%, transparent); }
.nst-welcome.hello .nw-ring { animation: nw-ring 2.6s ease-out 500ms infinite; }
@keyframes nw-ring { 0% { opacity: .9; transform: scale(.85); } 70%, 100% { opacity: 0; transform: scale(1.6); } }
.nw-halo { position: absolute; inset: -30%; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--tone) 38%, transparent), transparent 65%); filter: blur(8px); }

.nw-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 6px 12px; border-radius: 999px;
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--tone-hi);
  background: color-mix(in srgb, var(--tone) 10%, transparent); border: 1px solid color-mix(in srgb, var(--tone) 35%, transparent);
}
.nw-eyebrow i { width: 7px; height: 7px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 10px var(--tone); }
.nw-title {
  margin: 0 0 16px; font-family: var(--font-display); font-weight: 600; letter-spacing: -.025em; line-height: 1.08;
  font-size: clamp(2rem, 5.4vw, 3.4rem); color: var(--text, #ecebe6); text-wrap: balance;
}
.nw-title .w { display: inline-block; opacity: 0; transform: translateY(.45em); filter: blur(4px); }
.nst-welcome.hello .nw-title .w { opacity: 1; transform: none; filter: none; transition: opacity 500ms ease, transform 700ms var(--ease-out), filter 500ms ease; transition-delay: calc(260ms + var(--i) * 70ms); }
.nw-title em { font-style: normal; color: var(--tone); }
.nw-plan { display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0 0 12px; color: var(--text, #ecebe6); font-weight: 500; }
.nw-chip {
  font-family: var(--font-mono); font-size: .66rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 6px; color: #04110b; background: var(--tone); box-shadow: 0 0 18px color-mix(in srgb, var(--tone) 45%, transparent);
}
.nw-sub { margin: 0 0 26px; color: var(--muted, #8a8f98); max-width: 44ch; line-height: 1.55; }
.nw-go { min-width: 240px; padding: 15px 26px; font-size: 1rem; }
.nw-go span { display: inline-block; transition: transform var(--dur-fast, 180ms) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .nw-go:hover span { transform: translateX(4px); } }

@media (max-width: 640px) {
  .nw-chart { height: 42%; bottom: 2%; }
  .nw-emblem { width: 88px; height: 88px; margin-bottom: 18px; }
  .nw-logo { width: 60px; height: 60px; }
  .nw-go { width: 100%; min-width: 0; }
  .nw-sub { margin-bottom: 22px; }
}

/* Menos movimiento: sin velas ni chispas, solo fundidos */
.nst-welcome.reduced .nw-aurora { animation: none; }
.nst-welcome.reduced .nw-center > *, .nst-welcome.reduced .nw-title .w { transform: none; filter: none; }
.nst-welcome.reduced.hello .nw-emblem { animation: none; }
.nst-welcome.reduced .nw-ring { display: none; }
.nst-welcome.reduced.out .nw-center { transform: none; filter: none; }

/* ---------- Paso 3 de la ventana de registro (portada) ---------- */
.success-icon svg { width: 100%; height: 100%; overflow: visible; }
.success-icon:has(svg) { background: rgba(var(--accent-rgb), .08); border-color: transparent; position: relative; }
.sw-ring { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 0; transform: rotate(-90deg); transform-origin: center; }
.sw-check { fill: none; stroke: var(--green); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 100; stroke-dashoffset: 0; }
.sw-play .sw-ring { animation: sw-draw 560ms var(--ease-out) both; }
.sw-play .sw-check { animation: sw-draw 380ms var(--ease-out) 420ms both; }
@keyframes sw-draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
.sw-play .success-icon { animation: sw-pop 700ms cubic-bezier(.2, .9, .25, 1.3) both, sw-glow 2.4s ease-in-out 900ms infinite; }
@keyframes sw-pop { from { transform: scale(.5); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sw-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0); } 50% { box-shadow: 0 0 0 10px rgba(var(--accent-rgb), .06), 0 0 34px rgba(var(--accent-rgb), .35); } }
.sw-play > :not(.success-icon) { animation: sw-rise 600ms var(--ease-out) both; }
.sw-play > :nth-child(2) { animation-delay: 620ms; }
.sw-play > :nth-child(3) { animation-delay: 740ms; }
.sw-play > :nth-child(4) { animation-delay: 880ms; }
@keyframes sw-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .sw-play .sw-ring, .sw-play .sw-check { animation: none; }
  .sw-play .success-icon { animation: none; }
  .sw-play > :not(.success-icon) { animation-name: fade-in; }
}
