/* Registration spark celebration — isolated overlay styles */

body.reg-celebration-active {
    overflow: hidden;
}

.reg-celebration-overlay {
    position: fixed;
    inset: 0;
    z-index: 250000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
    pointer-events: none;
}

.reg-celebration-overlay.is-open {
    display: flex;
    pointer-events: auto;
}

.reg-celebration-overlay__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: reg-celeb-backdrop-in 0.35s ease-out both;
}

.reg-celebration-overlay__confetti,
.reg-celebration-overlay__stars,
.reg-celebration-overlay__spark-field {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.reg-celebration-stage {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: min(720px, 94vw);
}

.reg-celebration-overlay__burst {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 320px;
    height: 320px;
    margin: -160px 0 0 -160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.5) 0%, rgba(30, 64, 175, 0.22) 38%, transparent 72%);
    opacity: 0;
    transform: scale(0.35);
    z-index: 2;
    pointer-events: none;
}

.reg-celebration-overlay.is-burst .reg-celebration-overlay__burst {
    animation: reg-celeb-burst 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Sparklers flanking the card */
.reg-sparkler {
    position: relative;
    flex: 0 0 76px;
    width: 76px;
    height: 200px;
    pointer-events: none;
    z-index: 4;
    align-self: flex-end;
    margin-bottom: 28px;
}

.reg-sparkler-stick {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 124px;
    border-radius: 999px;
    background: linear-gradient(to top, #b45309 0%, #fbbf24 50%, rgba(251, 191, 36, 0));
    opacity: 0.95;
    filter: drop-shadow(0 0 12px rgba(251, 191, 36, 0.9));
    animation: reg-stick-flicker 0.26s ease-in-out infinite alternate;
}

.reg-sparkler--right .reg-sparkler-stick {
    background: linear-gradient(to top, #0f766e 0%, #34d399 50%, rgba(52, 211, 153, 0));
    filter: drop-shadow(0 0 12px rgba(52, 211, 153, 0.9));
}

.reg-sparkler-ember {
    position: absolute;
    left: 50%;
    bottom: 116px;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff 0%, #fef08a 35%, #fbbf24 70%, transparent 100%);
    box-shadow: 0 0 20px #fbbf24, 0 0 40px #f59e0b, 0 0 60px rgba(251, 191, 36, 0.5);
    animation: reg-ember-pulse 0.28s ease-in-out infinite alternate;
}

.reg-sparkler--right .reg-sparkler-ember {
    background: radial-gradient(circle, #fff 0%, #a7f3d0 35%, #34d399 70%, transparent 100%);
    box-shadow: 0 0 20px #34d399, 0 0 40px #0f766e, 0 0 60px rgba(15, 118, 110, 0.5);
}

/* Spark particles */
.reg-spark {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    animation: reg-spark-inward 0.95s ease-out infinite;
    box-shadow: 0 0 8px currentColor, 0 0 14px currentColor;
    background: currentColor;
}

.reg-spark--static { width: 4px; height: 4px; }
.reg-spark--mid    { width: 5px; height: 5px; }
.reg-spark--large  {
    width: 6px;
    height: 6px;
    box-shadow: 0 0 10px currentColor, 0 0 18px currentColor, 0 0 28px currentColor;
}
.reg-spark--streak {
    width: 3px;
    height: 11px;
    border-radius: 999px;
    animation-name: reg-spark-streak;
}

/* Left sparkler — 14 sparks */
.reg-sparkler--left .reg-spark:nth-child(3)  { left: 44%; bottom: 110px; color: #fbbf24; animation-delay: 0s;    --tx: 32px;  --ty: -78px; }
.reg-sparkler--left .reg-spark:nth-child(4)  { left: 52%; bottom: 118px; color: #1e40af; animation-delay: 0.07s; --tx: 48px;  --ty: -95px; }
.reg-sparkler--left .reg-spark:nth-child(5)  { left: 48%; bottom: 122px; color: #0f766e; animation-delay: 0.14s; --tx: 38px;  --ty: -105px; }
.reg-sparkler--left .reg-spark:nth-child(6)  { left: 56%; bottom: 106px; color: #34d399; animation-delay: 0.21s; --tx: 52px;  --ty: -68px; }
.reg-sparkler--left .reg-spark:nth-child(7)  { left: 40%; bottom: 114px; color: #fff;    animation-delay: 0.28s; --tx: 24px;  --ty: -88px; }
.reg-sparkler--left .reg-spark:nth-child(8)  { left: 50%; bottom: 126px; color: #60a5fa; animation-delay: 0.35s; --tx: 42px;  --ty: -112px; }
.reg-sparkler--left .reg-spark:nth-child(9)  { left: 46%; bottom: 102px; color: #fbbf24; animation-delay: 0.42s; --tx: 20px;  --ty: -62px; }
.reg-sparkler--left .reg-spark:nth-child(10) { left: 54%; bottom: 116px; color: #059669; animation-delay: 0.49s; --tx: 50px;  --ty: -98px; }
.reg-sparkler--left .reg-spark:nth-child(11) { left: 42%; bottom: 120px; color: #f472b6; animation-delay: 0.56s; --tx: 28px;  --ty: -102px; }
.reg-sparkler--left .reg-spark:nth-child(12) { left: 58%; bottom: 112px; color: #fef08a; animation-delay: 0.63s; --tx: 55px;  --ty: -85px; }
.reg-sparkler--left .reg-spark:nth-child(13) { left: 47%; bottom: 108px; color: #fef08a; animation-delay: 0.12s; --tx: 36px;  --ty: -82px; --rot: 28deg; }
.reg-sparkler--left .reg-spark:nth-child(14) { left: 51%; bottom: 120px; color: #93c5fd; animation-delay: 0.38s; --tx: 44px;  --ty: -100px; --rot: 14deg; }
.reg-sparkler--left .reg-spark:nth-child(15) { left: 45%; bottom: 124px; color: #a78bfa; animation-delay: 0.55s; --tx: 30px;  --ty: -108px; --rot: 22deg; }
.reg-sparkler--left .reg-spark:nth-child(16) { left: 49%; bottom: 125px; color: #fbbf24; animation-delay: 0.72s; --tx: 58px;  --ty: -110px; }

/* Right sparkler — mirrored */
.reg-sparkler--right .reg-spark:nth-child(3)  { left: 44%; bottom: 110px; color: #fbbf24; animation-delay: 0.04s; --tx: -32px;  --ty: -78px; }
.reg-sparkler--right .reg-spark:nth-child(4)  { left: 52%; bottom: 118px; color: #1e40af; animation-delay: 0.11s; --tx: -48px;  --ty: -95px; }
.reg-sparkler--right .reg-spark:nth-child(5)  { left: 48%; bottom: 122px; color: #0f766e; animation-delay: 0.18s; --tx: -38px;  --ty: -105px; }
.reg-sparkler--right .reg-spark:nth-child(6)  { left: 56%; bottom: 106px; color: #34d399; animation-delay: 0.25s; --tx: -52px;  --ty: -68px; }
.reg-sparkler--right .reg-spark:nth-child(7)  { left: 40%; bottom: 114px; color: #fff;    animation-delay: 0.32s; --tx: -24px;  --ty: -88px; }
.reg-sparkler--right .reg-spark:nth-child(8)  { left: 50%; bottom: 126px; color: #60a5fa; animation-delay: 0.39s; --tx: -42px;  --ty: -112px; }
.reg-sparkler--right .reg-spark:nth-child(9)  { left: 46%; bottom: 102px; color: #fbbf24; animation-delay: 0.46s; --tx: -20px;  --ty: -62px; }
.reg-sparkler--right .reg-spark:nth-child(10) { left: 54%; bottom: 116px; color: #059669; animation-delay: 0.53s; --tx: -50px;  --ty: -98px; }
.reg-sparkler--right .reg-spark:nth-child(11) { left: 42%; bottom: 120px; color: #f472b6; animation-delay: 0.60s; --tx: -28px;  --ty: -102px; }
.reg-sparkler--right .reg-spark:nth-child(12) { left: 58%; bottom: 112px; color: #fef08a; animation-delay: 0.67s; --tx: -55px;  --ty: -85px; }
.reg-sparkler--right .reg-spark:nth-child(13) { left: 47%; bottom: 108px; color: #fef08a; animation-delay: 0.16s; --tx: -36px;  --ty: -82px; --rot: -28deg; }
.reg-sparkler--right .reg-spark:nth-child(14) { left: 51%; bottom: 120px; color: #93c5fd; animation-delay: 0.42s; --tx: -44px;  --ty: -100px; --rot: -14deg; }
.reg-sparkler--right .reg-spark:nth-child(15) { left: 45%; bottom: 124px; color: #a78bfa; animation-delay: 0.59s; --tx: -30px;  --ty: -108px; --rot: -22deg; }
.reg-sparkler--right .reg-spark:nth-child(16) { left: 49%; bottom: 125px; color: #34d399; animation-delay: 0.76s; --tx: -58px;  --ty: -110px; }

/* Confetti, stars, dynamic sparks */
.reg-celeb-particle {
    position: absolute;
    top: -12px;
    opacity: 0;
    pointer-events: none;
    will-change: transform, opacity;
}

.reg-celeb-star {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
    pointer-events: none;
}

.reg-celeb-star::before {
    content: '✦';
    font-size: 10px;
    line-height: 1;
    color: currentColor;
    text-shadow: 0 0 10px currentColor;
}

.reg-celebration-overlay.is-open .reg-celeb-particle {
    animation: reg-celeb-confetti-fall var(--fall-dur, 2.2s) linear var(--fall-delay, 0s) infinite;
}

.reg-celebration-overlay.is-open .reg-celeb-star {
    animation: reg-celeb-star-twinkle 1.2s ease-in-out var(--star-delay, 0s) infinite alternate;
}

/* Congratulations card */
.reg-celebration-card {
    position: relative;
    z-index: 5;
    flex: 0 1 auto;
    width: min(420px, calc(100vw - 180px));
    text-align: center;
    padding: 28px 24px 22px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22), 0 0 48px rgba(251, 191, 36, 0.18);
    opacity: 0;
    transform: translateY(16px) scale(0.97);
}

.reg-celebration-overlay.is-open .reg-celebration-card {
    animation: reg-celebration-card-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.35s both;
}

.reg-celebration-card::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 22px;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.4), rgba(30, 64, 175, 0.22), rgba(15, 118, 110, 0.4));
    opacity: 0.55;
    z-index: -1;
    filter: blur(12px);
    animation: reg-card-glow 1.4s ease-in-out infinite alternate;
}

.reg-celebration-kicker {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #64748b;
    margin: 0 0 8px;
}

.reg-celebration-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: clamp(1.5rem, 5vw, 2rem);
    line-height: 1.2;
    margin: 0 0 10px;
}

.reg-celebration-name .name-part { display: inline-block; }
.reg-celebration-name .name-part:nth-child(4n+1) { color: #1e40af; }
.reg-celebration-name .name-part:nth-child(4n+2) { color: #0f766e; }
.reg-celebration-name .name-part:nth-child(4n+3) { color: #0369a1; }
.reg-celebration-name .name-part:nth-child(4n)   { color: #059669; }

.reg-celebration-msg {
    font-size: 0.92rem;
    line-height: 1.55;
    color: #475569;
    margin: 0 0 14px;
    font-weight: 500;
}

.reg-celebration-next {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
}

/* Keyframes */
@keyframes reg-celeb-backdrop-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes reg-stick-flicker {
    from { opacity: 0.82; transform: translateX(-50%) scaleY(0.97); }
    to   { opacity: 1; transform: translateX(-50%) scaleY(1.03); }
}

@keyframes reg-ember-pulse {
    from { transform: translateX(-50%) scale(0.86); opacity: 0.85; }
    to   { transform: translateX(-50%) scale(1.14); opacity: 1; }
}

@keyframes reg-spark-inward {
    0%   { opacity: 0; transform: translate(0, 0) scale(0.35); }
    10%  { opacity: 1; }
    55%  { opacity: 0.95; }
    100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(1.3); }
}

@keyframes reg-spark-streak {
    0%   { opacity: 0; transform: translate(0, 0) rotate(var(--rot, 0deg)) scale(0.45); }
    12%  { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--tx), var(--ty)) rotate(calc(var(--rot, 0deg) + 20deg)) scale(1.15); }
}

@keyframes reg-celeb-burst {
    0%   { opacity: 0; transform: scale(0.3); }
    30%  { opacity: 0.9; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.4); }
}

@keyframes reg-celeb-confetti-fall {
    0%   { opacity: 0; transform: translateY(0) rotate(0deg); }
    6%   { opacity: 1; }
    100% { opacity: 0.9; transform: translateY(110vh) rotate(720deg); }
}

@keyframes reg-celeb-star-twinkle {
    0%   { opacity: 0; transform: scale(0.35) rotate(0deg); }
    100% { opacity: 1; transform: scale(1.2) rotate(20deg); }
}

@keyframes reg-celebration-card-in {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes reg-card-glow {
    from { opacity: 0.35; transform: scale(0.98); }
    to   { opacity: 0.7; transform: scale(1.03); }
}

@keyframes reg-celeb-overlay-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

.reg-celebration-overlay.is-closing {
    animation: reg-celeb-overlay-out 0.35s ease-out both;
}

@media (max-width: 640px) {
    .reg-celebration-stage { gap: 4px; width: 98vw; }
    .reg-sparkler { flex: 0 0 54px; width: 54px; height: 168px; margin-bottom: 18px; }
    .reg-sparkler-stick { height: 96px; }
    .reg-sparkler-ember { bottom: 90px; width: 12px; height: 12px; }
    .reg-celebration-card { width: min(420px, calc(100vw - 120px)); padding: 22px 18px 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .reg-celebration-overlay__backdrop,
    .reg-sparkler-stick,
    .reg-sparkler-ember,
    .reg-spark,
    .reg-celebration-overlay__burst,
    .reg-celebration-card,
    .reg-celeb-particle,
    .reg-celeb-star,
    .reg-celebration-card::after {
        animation: none !important;
    }

    .reg-sparkler-ember { opacity: 1; }
    .reg-celebration-card { opacity: 1; transform: none; }
    .reg-celeb-particle,
    .reg-celeb-star { display: none; }
}
