/* ===== Variables por tema ===== */
:root,
[data-theme="neon"] {
    --accent-rgb: 236, 72, 153;
    --accent-2-rgb: 168, 85, 247;
    --bg-body: #1a0a2e;
    --title-color: #f9a8d4;
    --heading-color: #f472b6;
    --header-from: rgba(76, 29, 149, 0.96);
    --header-mid: rgba(134, 25, 143, 0.94);
    --header-to: rgba(219, 39, 119, 0.92);
    --btn-from: #7c3aed;
    --btn-to: #db2777;
    --panel-bg: rgba(20, 5, 35, 0.78);
    --menu-bg: rgba(15, 5, 30, 0.88);
    --card-bg: rgba(0, 0, 0, 0.38);
    --fx-1: rgba(236, 72, 153, 0.55);
    --fx-2: rgba(168, 85, 247, 0.5);
    --fx-3: rgba(219, 39, 119, 0.45);
}

[data-theme="cyber"] {
    --accent-rgb: 34, 211, 238;
    --accent-2-rgb: 217, 70, 239;
    --bg-body: #030712;
    --title-color: #67e8f9;
    --heading-color: #22d3ee;
    --header-from: rgba(8, 47, 73, 0.96);
    --header-mid: rgba(88, 28, 135, 0.94);
    --header-to: rgba(14, 116, 144, 0.92);
    --btn-from: #0891b2;
    --btn-to: #c026d3;
    --panel-bg: rgba(3, 7, 18, 0.82);
    --menu-bg: rgba(2, 6, 23, 0.9);
    --card-bg: rgba(0, 0, 0, 0.45);
    --fx-1: rgba(34, 211, 238, 0.45);
    --fx-2: rgba(217, 70, 239, 0.4);
    --fx-3: rgba(59, 130, 246, 0.35);
}

[data-theme="sunset"] {
    --accent-rgb: 251, 146, 60;
    --accent-2-rgb: 239, 68, 68;
    --bg-body: #1c0a05;
    --title-color: #fdba74;
    --heading-color: #fb923c;
    --header-from: rgba(124, 45, 18, 0.96);
    --header-mid: rgba(185, 28, 28, 0.94);
    --header-to: rgba(234, 88, 12, 0.92);
    --btn-from: #ea580c;
    --btn-to: #dc2626;
    --panel-bg: rgba(28, 10, 5, 0.8);
    --menu-bg: rgba(20, 8, 4, 0.9);
    --card-bg: rgba(0, 0, 0, 0.42);
    --fx-1: rgba(251, 146, 60, 0.55);
    --fx-2: rgba(239, 68, 68, 0.45);
    --fx-3: rgba(250, 204, 21, 0.35);
}

[data-theme="aurora"] {
    --accent-rgb: 52, 211, 153;
    --accent-2-rgb: 139, 92, 246;
    --bg-body: #041019;
    --title-color: #6ee7b7;
    --heading-color: #34d399;
    --header-from: rgba(6, 78, 59, 0.96);
    --header-mid: rgba(67, 56, 202, 0.94);
    --header-to: rgba(13, 148, 136, 0.92);
    --btn-from: #059669;
    --btn-to: #7c3aed;
    --panel-bg: rgba(4, 16, 25, 0.82);
    --menu-bg: rgba(2, 12, 20, 0.9);
    --card-bg: rgba(0, 0, 0, 0.4);
    --fx-1: rgba(52, 211, 153, 0.45);
    --fx-2: rgba(139, 92, 246, 0.45);
    --fx-3: rgba(56, 189, 248, 0.35);
}

[data-theme="galaxy"] {
    --accent-rgb: 167, 139, 250;
    --accent-2-rgb: 244, 114, 182;
    --bg-body: #0b0618;
    --title-color: #c4b5fd;
    --heading-color: #a78bfa;
    --header-from: rgba(49, 46, 129, 0.96);
    --header-mid: rgba(88, 28, 135, 0.94);
    --header-to: rgba(109, 40, 217, 0.92);
    --btn-from: #6366f1;
    --btn-to: #ec4899;
    --panel-bg: rgba(11, 6, 24, 0.82);
    --menu-bg: rgba(8, 4, 18, 0.9);
    --card-bg: rgba(0, 0, 0, 0.45);
    --fx-1: rgba(167, 139, 250, 0.45);
    --fx-2: rgba(244, 114, 182, 0.4);
    --fx-3: rgba(99, 102, 241, 0.35);
}

html { background: var(--bg-body); }

html.theme-switching .bg-fx {
    transition: opacity 0.55s ease;
}

html.theme-switching .bg-base {
    transition: background 0.55s ease;
}

/* ===== Escena de fondo ===== */
.bg-scene {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-base {
    position: absolute;
    inset: 0;
    background: var(--bg-body);
    transition: background 0.6s ease;
}

.bg-fx {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.85s ease;
}

[data-theme="neon"] .bg-fx-neon,
[data-theme="cyber"] .bg-fx-cyber,
[data-theme="sunset"] .bg-fx-sunset,
[data-theme="aurora"] .bg-fx-aurora,
[data-theme="galaxy"] .bg-fx-galaxy {
    opacity: 1;
}

/* Inicio/login: efectos más intensos */
.auth-page .bg-fx-neon .orb { filter: blur(70px); }
.auth-page .bg-fx-neon .orb-1 { width: 520px; height: 520px; }
.auth-page .bg-fx-neon .orb-2 { width: 460px; height: 460px; }
.auth-page .bg-fx-cyber .cyber-rain { opacity: 0.7; }
.auth-page .bg-fx-sunset .sunset-sun { width: 280px; height: 280px; }
.auth-page .bg-fx-aurora .aurora-ribbon { filter: blur(18px); opacity: 0.95; }
.auth-page .bg-fx-aurora .aurora-dome { opacity: 0.85; }
.auth-page .bg-fx-aurora .aurora-horizon-glow { height: 45%; }
.auth-page .bg-fx-galaxy .nebula { opacity: 1; }
.auth-page .bg-fx-galaxy .planet-giant { width: 200px; height: 200px; }
.auth-page .bg-fx-galaxy .cosmic-aurora { opacity: 0.75; filter: blur(55px); }

.auth-page .auth-card {
    animation: auth-card-in 0.7s ease;
}

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

/* ========== TEMA 1: NEON — orbes, anillos, chispas, rayos ========== */
.bg-fx-neon .orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(55px);
    animation: neon-orb-drift 14s ease-in-out infinite;
}

.bg-fx-neon .orb-1 {
    width: 440px; height: 440px;
    top: -10%; left: -8%;
    background: var(--fx-1);
}

.bg-fx-neon .orb-2 {
    width: 400px; height: 400px;
    bottom: -12%; right: -8%;
    background: var(--fx-2);
    animation-delay: -5s;
}

.bg-fx-neon .orb-3 {
    width: 320px; height: 320px;
    top: 35%; left: 40%;
    background: var(--fx-3);
    animation-delay: -9s;
}

.bg-fx-neon .neon-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(var(--accent-rgb), 0.25);
    animation: neon-ring-pulse 6s ease-in-out infinite;
}

.bg-fx-neon .ring-1 {
    width: 300px; height: 300px;
    top: 20%; right: 10%;
    animation-delay: 0s;
}

.bg-fx-neon .ring-2 {
    width: 180px; height: 180px;
    bottom: 25%; left: 8%;
    animation-delay: -3s;
}

.bg-fx-neon .spark {
    position: absolute;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.9), 0 0 24px var(--fx-1);
    animation: spark-float 8s ease-in-out infinite;
}

.bg-fx-neon .s1 { top: 15%; left: 20%; animation-delay: 0s; }
.bg-fx-neon .s2 { top: 60%; left: 75%; animation-delay: -2s; }
.bg-fx-neon .s3 { top: 80%; left: 30%; animation-delay: -4s; }
.bg-fx-neon .s4 { top: 30%; left: 85%; animation-delay: -1s; }
.bg-fx-neon .s5 { top: 45%; left: 10%; animation-delay: -3s; }
.bg-fx-neon .s6 { top: 70%; left: 55%; animation-delay: -5s; }

.bg-fx-neon .neon-beam {
    position: absolute;
    width: 2px;
    height: 40%;
    background: linear-gradient(180deg, transparent, rgba(var(--accent-rgb), 0.5), transparent);
    filter: blur(1px);
    animation: beam-sway 10s ease-in-out infinite;
}

.bg-fx-neon .beam-1 { top: 10%; left: 25%; transform: rotate(15deg); }
.bg-fx-neon .beam-2 { top: 5%; right: 30%; transform: rotate(-20deg); animation-delay: -5s; }

@keyframes neon-orb-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(50px, -40px) scale(1.1); }
    50% { transform: translate(-20px, 30px) scale(0.92); }
    75% { transform: translate(30px, 20px) scale(1.05); }
}

@keyframes neon-ring-pulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.15); opacity: 0.6; }
}

@keyframes spark-float {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.4; }
    50% { transform: translateY(-30px) scale(1.5); opacity: 1; }
}

@keyframes beam-sway {
    0%, 100% { opacity: 0.3; transform: rotate(15deg) scaleY(1); }
    50% { opacity: 0.7; transform: rotate(20deg) scaleY(1.2); }
}

/* ========== TEMA 2: CYBER — rejilla 3D, lluvia, nodos, scan ========== */
.bg-fx-cyber .cyber-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(var(--accent-rgb), 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(var(--accent-rgb), 0.12) 1px, transparent 1px);
    background-size: 40px 40px;
    animation: cyber-grid-move 15s linear infinite;
    transform: perspective(500px) rotateX(60deg) scale(2);
    transform-origin: center top;
    top: 20%;
    height: 80%;
}

.bg-fx-cyber .cyber-rain {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        180deg,
        transparent 0px,
        transparent 8px,
        rgba(var(--accent-rgb), 0.15) 8px,
        rgba(var(--accent-rgb), 0.15) 9px
    );
    background-size: 3px 120px;
    animation: cyber-rain-fall 4s linear infinite;
    opacity: 0.5;
}

.bg-fx-cyber .cyber-node {
    position: absolute;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: rgba(var(--accent-rgb), 0.9);
    box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.8), 0 0 40px rgba(var(--accent-2-rgb), 0.4);
    animation: cyber-node-blink 3s ease-in-out infinite;
}

.bg-fx-cyber .n1 { top: 25%; left: 15%; }
.bg-fx-cyber .n2 { top: 55%; right: 20%; animation-delay: -1s; }
.bg-fx-cyber .n3 { bottom: 30%; left: 45%; animation-delay: -2s; }

.bg-fx-cyber .cyber-scan {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(var(--accent-rgb), 0.04) 48%,
        rgba(var(--accent-2-rgb), 0.15) 50%,
        rgba(var(--accent-rgb), 0.04) 52%,
        transparent 100%
    );
    background-size: 100% 250%;
    animation: cyber-scan-sweep 5s linear infinite;
}

@keyframes cyber-grid-move {
    from { background-position: 0 0; }
    to { background-position: 40px 40px; }
}

@keyframes cyber-rain-fall {
    from { background-position: 0 0; }
    to { background-position: 0 120px; }
}

@keyframes cyber-node-blink {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.4); }
}

@keyframes cyber-scan-sweep {
    from { background-position: 0 -100%; }
    to { background-position: 0 100%; }
}

/* ========== TEMA 3: SUNSET — sol, olas, brasas, calor ========== */
.bg-fx-sunset .sunset-sun {
    position: absolute;
    width: 220px; height: 220px;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 50%;
    background: radial-gradient(circle, #fde047 0%, #f97316 40%, rgba(239, 68, 68, 0.3) 70%, transparent 75%);
    box-shadow: 0 0 80px rgba(251, 146, 60, 0.6), 0 0 160px rgba(239, 68, 68, 0.3);
    animation: sun-pulse 8s ease-in-out infinite;
}

.bg-fx-sunset .wave {
    position: absolute;
    width: 220%;
    height: 220%;
    left: -60%;
    border-radius: 42%;
    opacity: 0.4;
}

.bg-fx-sunset .wave-1 {
    bottom: -65%;
    background: radial-gradient(ellipse, var(--fx-1), transparent 55%);
    animation: wave-spin 20s linear infinite;
}

.bg-fx-sunset .wave-2 {
    bottom: -70%;
    background: radial-gradient(ellipse, var(--fx-2), transparent 50%);
    animation: wave-spin 28s linear infinite reverse;
    opacity: 0.3;
}

.bg-fx-sunset .wave-3 {
    top: -75%;
    background: radial-gradient(ellipse, var(--fx-3), transparent 45%);
    animation: wave-spin 35s linear infinite;
    opacity: 0.25;
}

.bg-fx-sunset .ember {
    position: absolute;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #fbbf24;
    box-shadow: 0 0 10px #f97316;
    animation: ember-rise 6s ease-in infinite;
}

.bg-fx-sunset .e1 { bottom: 20%; left: 20%; animation-delay: 0s; }
.bg-fx-sunset .e2 { bottom: 15%; left: 60%; animation-delay: -1.5s; }
.bg-fx-sunset .e3 { bottom: 25%; left: 80%; animation-delay: -3s; }
.bg-fx-sunset .e4 { bottom: 18%; left: 40%; animation-delay: -2s; width: 4px; height: 4px; }
.bg-fx-sunset .e5 { bottom: 22%; left: 70%; animation-delay: -4s; width: 5px; height: 5px; }
.bg-fx-sunset .e6 { bottom: 12%; left: 35%; animation-delay: -0.5s; }

.bg-fx-sunset .heat-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(251, 146, 60, 0.08) 100%);
    animation: heat-wave 4s ease-in-out infinite;
}

@keyframes sun-pulse {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.9; }
    50% { transform: translateX(-50%) scale(1.08); opacity: 1; }
}

@keyframes wave-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes ember-rise {
    0% { transform: translateY(0) scale(1); opacity: 0; }
    10% { opacity: 1; }
    100% { transform: translateY(-100vh) scale(0.3); opacity: 0; }
}

@keyframes heat-wave {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.9; }
}

/* ========== TEMA 4: AURORA BOREAL — cortinas verticales, cielo, montañas ========== */
.bg-fx-aurora .aurora-night {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #020810 0%, #041019 40%, #062015 100%);
}

.bg-fx-aurora .aurora-stars-field {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 8% 12%, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 22% 28%, rgba(255,255,255,0.6), transparent),
        radial-gradient(1.5px 1.5px at 45% 8%, #fff, transparent),
        radial-gradient(1px 1px at 68% 18%, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 88% 35%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 15% 45%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 55% 22%, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 78% 8%, #fff, transparent);
    animation: aurora-stars-shimmer 5s ease-in-out infinite alternate;
}

.bg-fx-aurora .aurora-horizon-glow {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 35%;
    background: linear-gradient(
        0deg,
        rgba(16, 185, 129, 0.25) 0%,
        rgba(52, 211, 153, 0.15) 30%,
        rgba(139, 92, 246, 0.08) 60%,
        transparent 100%
    );
    animation: horizon-breathe 10s ease-in-out infinite;
}

/* Cortinas verticales clásicas de aurora boreal */
.bg-fx-aurora .aurora-ribbon {
    position: absolute;
    bottom: 12%;
    filter: blur(20px);
    opacity: 0.75;
    transform-origin: bottom center;
    border-radius: 40% 40% 0 0;
    mix-blend-mode: screen;
}

.bg-fx-aurora .r1 {
    left: 5%;
    width: 14%;
    height: 75%;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(52, 211, 153, 0.15) 15%,
        rgba(16, 185, 129, 0.85) 35%,
        rgba(34, 211, 238, 0.7) 55%,
        rgba(52, 211, 153, 0.4) 75%,
        transparent 100%
    );
    animation: ribbon-dance 9s ease-in-out infinite;
}

.bg-fx-aurora .r2 {
    left: 18%;
    width: 11%;
    height: 65%;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(34, 211, 238, 0.2) 20%,
        rgba(6, 182, 212, 0.75) 45%,
        rgba(139, 92, 246, 0.5) 70%,
        transparent 100%
    );
    animation: ribbon-dance 11s ease-in-out infinite reverse;
    animation-delay: -2s;
}

.bg-fx-aurora .r3 {
    left: 32%;
    width: 16%;
    height: 82%;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(110, 231, 183, 0.2) 10%,
        rgba(52, 211, 153, 0.9) 30%,
        rgba(167, 243, 208, 0.6) 50%,
        rgba(139, 92, 246, 0.45) 70%,
        transparent 100%
    );
    animation: ribbon-dance 8s ease-in-out infinite;
    animation-delay: -4s;
}

.bg-fx-aurora .r4 {
    left: 48%;
    width: 12%;
    height: 70%;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(56, 189, 248, 0.15) 25%,
        rgba(34, 211, 238, 0.8) 45%,
        rgba(52, 211, 153, 0.55) 65%,
        transparent 100%
    );
    animation: ribbon-dance 13s ease-in-out infinite reverse;
    animation-delay: -1s;
}

.bg-fx-aurora .r5 {
    left: 62%;
    width: 15%;
    height: 78%;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(139, 92, 246, 0.2) 15%,
        rgba(52, 211, 153, 0.75) 40%,
        rgba(16, 185, 129, 0.65) 60%,
        rgba(196, 181, 253, 0.35) 80%,
        transparent 100%
    );
    animation: ribbon-dance 10s ease-in-out infinite;
    animation-delay: -6s;
}

.bg-fx-aurora .r6 {
    left: 78%;
    width: 13%;
    height: 60%;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(45, 212, 191, 0.2) 30%,
        rgba(20, 184, 166, 0.7) 50%,
        rgba(99, 102, 241, 0.4) 75%,
        transparent 100%
    );
    animation: ribbon-dance 12s ease-in-out infinite reverse;
    animation-delay: -3s;
}

/* Domo de luz central */
.bg-fx-aurora .aurora-dome {
    position: absolute;
    bottom: 8%;
    left: 50%;
    width: 55%;
    height: 55%;
    transform: translateX(-50%);
    background: radial-gradient(
        ellipse at 50% 100%,
        rgba(52, 211, 153, 0.35) 0%,
        rgba(34, 211, 238, 0.2) 25%,
        rgba(139, 92, 246, 0.12) 50%,
        transparent 70%
    );
    filter: blur(40px);
    animation: dome-pulse 14s ease-in-out infinite;
}

/* Partículas de luz flotantes */
.bg-fx-aurora .aurora-spark {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #6ee7b7;
    box-shadow: 0 0 8px #34d399, 0 0 16px rgba(52, 211, 153, 0.6);
    animation: spark-drift 7s ease-in-out infinite;
}

.bg-fx-aurora .sp1 { bottom: 35%; left: 12%; animation-delay: 0s; }
.bg-fx-aurora .sp2 { bottom: 50%; left: 28%; animation-delay: -1s; width: 4px; height: 4px; }
.bg-fx-aurora .sp3 { bottom: 42%; left: 45%; animation-delay: -2s; }
.bg-fx-aurora .sp4 { bottom: 55%; left: 58%; animation-delay: -3s; background: #67e8f9; box-shadow: 0 0 8px #22d3ee; }
.bg-fx-aurora .sp5 { bottom: 38%; left: 72%; animation-delay: -0.5s; }
.bg-fx-aurora .sp6 { bottom: 48%; left: 85%; animation-delay: -4s; }
.bg-fx-aurora .sp7 { bottom: 60%; left: 38%; animation-delay: -2.5s; width: 2px; height: 2px; }
.bg-fx-aurora .sp8 { bottom: 45%; left: 65%; animation-delay: -1.5s; background: #c4b5fd; box-shadow: 0 0 10px #a78bfa; }

/* Onda de brillo que recorre el cielo */
.bg-fx-aurora .aurora-shimmer-wave {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(110, 231, 183, 0.08) 48%,
        rgba(167, 243, 208, 0.15) 50%,
        rgba(110, 231, 183, 0.08) 52%,
        transparent 60%
    );
    background-size: 200% 100%;
    animation: shimmer-sweep 8s linear infinite;
}

/* Silueta de montañas */
.bg-fx-aurora .aurora-mountains {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 22%;
    background:
        linear-gradient(175deg, transparent 40%, #020810 40.5%),
        linear-gradient(165deg, transparent 55%, #030a12 55.5%),
        linear-gradient(185deg, transparent 35%, #020810 35.5%);
    background-size: 35% 100%, 45% 100%, 40% 100%;
    background-position: 0% 100%, 30% 100%, 65% 100%;
    background-repeat: no-repeat;
    opacity: 0.95;
}

.bg-fx-aurora .aurora-mountains::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(4, 16, 25, 0.9) 0%, transparent 100%);
}

@keyframes aurora-stars-shimmer {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

@keyframes horizon-breathe {
    0%, 100% { opacity: 0.7; transform: scaleY(1); }
    50% { opacity: 1; transform: scaleY(1.08); }
}

@keyframes ribbon-dance {
    0%, 100% {
        transform: skewX(-3deg) scaleY(1) scaleX(1);
        opacity: 0.6;
    }
    25% {
        transform: skewX(4deg) scaleY(1.12) scaleX(1.05);
        opacity: 0.9;
    }
    50% {
        transform: skewX(-2deg) scaleY(0.92) scaleX(0.98);
        opacity: 0.75;
    }
    75% {
        transform: skewX(3deg) scaleY(1.08) scaleX(1.02);
        opacity: 0.85;
    }
}

@keyframes dome-pulse {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.6; }
    50% { transform: translateX(-50%) scale(1.1); opacity: 0.9; }
}

@keyframes spark-drift {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }
    25% {
        transform: translate(15px, -25px) scale(1.3);
        opacity: 1;
    }
    50% {
        transform: translate(-10px, -40px) scale(0.8);
        opacity: 0.5;
    }
    75% {
        transform: translate(20px, -15px) scale(1.1);
        opacity: 0.8;
    }
}

@keyframes shimmer-sweep {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

/* ========== TEMA 5: GALAXY — planetas, aurora cósmica, estrellas ========== */
.bg-fx-galaxy .stars {
    position: absolute;
    inset: 0;
}

.bg-fx-galaxy .stars-back {
    background-image:
        radial-gradient(1px 1px at 5% 10%, #fff, transparent),
        radial-gradient(1px 1px at 25% 40%, rgba(255,255,255,0.7), transparent),
        radial-gradient(1.5px 1.5px at 50% 8%, #fff, transparent),
        radial-gradient(1px 1px at 75% 55%, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 90% 25%, #fff, transparent),
        radial-gradient(1px 1px at 15% 85%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 60% 75%, #fff, transparent);
    animation: stars-drift-slow 60s linear infinite;
}

.bg-fx-galaxy .stars-front {
    background-image:
        radial-gradient(1.5px 1.5px at 12% 30%, #fff, transparent),
        radial-gradient(1px 1px at 38% 70%, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 65% 20%, #fff, transparent),
        radial-gradient(2px 2px at 82% 60%, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 45% 50%, #fff, transparent),
        radial-gradient(1px 1px at 95% 90%, rgba(255,255,255,0.7), transparent);
    animation: stars-drift-fast 40s linear infinite, stars-twinkle 3s ease-in-out infinite alternate;
}

/* Aurora cósmica (púrpura/rosa — distinta al tema Aurora) */
.bg-fx-galaxy .cosmic-aurora {
    position: absolute;
    filter: blur(65px);
    border-radius: 45% 55% 50% 50%;
    mix-blend-mode: screen;
    opacity: 0.55;
    pointer-events: none;
}

.bg-fx-galaxy .ca-1 {
    width: 70%;
    height: 45%;
    top: 8%;
    left: -5%;
    background: linear-gradient(
        125deg,
        transparent 10%,
        rgba(167, 139, 250, 0.55) 35%,
        rgba(244, 114, 182, 0.45) 55%,
        rgba(99, 102, 241, 0.35) 75%,
        transparent 95%
    );
    animation: cosmic-aurora-drift 22s ease-in-out infinite;
}

.bg-fx-galaxy .ca-2 {
    width: 55%;
    height: 50%;
    bottom: 5%;
    right: -8%;
    background: linear-gradient(
        215deg,
        transparent 15%,
        rgba(139, 92, 246, 0.5) 40%,
        rgba(236, 72, 153, 0.4) 60%,
        transparent 90%
    );
    animation: cosmic-aurora-drift 28s ease-in-out infinite reverse;
    animation-delay: -8s;
}

.bg-fx-galaxy .ca-3 {
    width: 40%;
    height: 35%;
    top: 40%;
    left: 35%;
    background: radial-gradient(
        ellipse,
        rgba(196, 181, 253, 0.45) 0%,
        rgba(244, 114, 182, 0.25) 50%,
        transparent 75%
    );
    animation: cosmic-aurora-pulse 14s ease-in-out infinite;
    animation-delay: -4s;
}

.bg-fx-galaxy .nebula {
    position: absolute;
    inset: -25%;
    background:
        radial-gradient(circle at 20% 30%, var(--fx-1), transparent 42%),
        radial-gradient(circle at 80% 60%, var(--fx-2), transparent 38%),
        radial-gradient(circle at 50% 50%, var(--fx-3), transparent 48%);
    animation: nebula-drift 20s ease-in-out infinite;
    opacity: 0.75;
}

/* Planeta gigante de fondo */
.bg-fx-galaxy .planet {
    position: absolute;
    border-radius: 50%;
}

.bg-fx-galaxy .planet-giant {
    width: 160px;
    height: 160px;
    bottom: 8%;
    right: 6%;
    background:
        radial-gradient(circle at 35% 30%, #c4b5fd, #6366f1 35%, #4338ca 60%, #1e1b4b 85%);
    box-shadow:
        inset -12px -8px 24px rgba(0, 0, 0, 0.5),
        0 0 50px rgba(99, 102, 241, 0.35),
        0 0 100px rgba(167, 139, 250, 0.2);
    animation: planet-giant-float 24s ease-in-out infinite;
}

.bg-fx-galaxy .planet-giant::after {
    content: "";
    position: absolute;
    inset: -8%;
    border-radius: 50%;
    border: 1px solid rgba(196, 181, 253, 0.15);
    animation: planet-giant-float 24s ease-in-out infinite reverse;
}

/* Órbitas con planetas */
.bg-fx-galaxy .galaxy-orbit {
    position: absolute;
    border-radius: 50%;
    animation: galaxy-orbit-spin linear infinite;
}

.bg-fx-galaxy .orbit-1 {
    width: 340px;
    height: 340px;
    top: 12%;
    left: 8%;
    animation-duration: 38s;
}

.bg-fx-galaxy .orbit-2 {
    width: 260px;
    height: 260px;
    top: 55%;
    left: 55%;
    animation-duration: 28s;
    animation-direction: reverse;
}

.bg-fx-galaxy .orbit-3 {
    width: 180px;
    height: 180px;
    top: 20%;
    right: 12%;
    animation-duration: 20s;
}

.bg-fx-galaxy .galaxy-orbit .planet {
    top: -18px;
    left: calc(50% - 18px);
}

.bg-fx-galaxy .planet-saturn {
    width: 36px;
    height: 36px;
    background: radial-gradient(circle at 40% 35%, #fde68a, #d97706 50%, #92400e 100%);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
}

.bg-fx-galaxy .planet-saturn::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 56px;
    height: 14px;
    margin: -7px 0 0 -28px;
    border-radius: 50%;
    border: 2px solid rgba(253, 224, 171, 0.45);
    transform: rotateX(70deg);
}

.bg-fx-galaxy .planet-mars {
    width: 28px;
    height: 28px;
    background: radial-gradient(circle at 35% 30%, #fca5a5, #dc2626 55%, #7f1d1d 100%);
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.35);
}

.bg-fx-galaxy .planet-ice {
    width: 22px;
    height: 22px;
    background: radial-gradient(circle at 30% 25%, #e0f2fe, #38bdf8 45%, #0369a1 100%);
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.4);
}

.bg-fx-galaxy .meteor {
    position: absolute;
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, rgba(255,255,255,0.9), transparent);
    border-radius: 999px;
    transform: rotate(-35deg);
    animation: meteor-fly 7s linear infinite;
    opacity: 0;
}

.bg-fx-galaxy .m1 { top: 15%; left: 10%; animation-delay: 0s; }
.bg-fx-galaxy .m2 { top: 40%; left: 60%; animation-delay: -2.5s; }
.bg-fx-galaxy .m3 { top: 25%; left: 30%; animation-delay: -5s; width: 60px; }

@keyframes cosmic-aurora-drift {
    0%, 100% {
        transform: translate(0, 0) rotate(-5deg) scale(1);
        opacity: 0.45;
    }
    33% {
        transform: translate(6%, -4%) rotate(3deg) scale(1.08);
        opacity: 0.7;
    }
    66% {
        transform: translate(-4%, 5%) rotate(-2deg) scale(0.95);
        opacity: 0.55;
    }
}

@keyframes cosmic-aurora-pulse {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.35; }
    50% { transform: scale(1.2) rotate(8deg); opacity: 0.65; }
}

@keyframes planet-giant-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-18px) rotate(5deg); }
}

@keyframes galaxy-orbit-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes stars-drift-slow {
    from { transform: translateX(0); }
    to { transform: translateX(-30px); }
}

@keyframes stars-drift-fast {
    from { transform: translateX(0); }
    to { transform: translateX(20px); }
}

@keyframes stars-twinkle {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

@keyframes nebula-drift {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.12) rotate(3deg); }
}

@keyframes meteor-fly {
    0% { transform: rotate(-35deg) translateX(0); opacity: 0; }
    5% { opacity: 1; }
    15% { transform: rotate(-35deg) translateX(350px); opacity: 0; }
    100% { transform: rotate(-35deg) translateX(350px); opacity: 0; }
}

/* ===== Header / footer ===== */
.site-header,
.site-footer {
    background: linear-gradient(135deg, var(--header-from) 0%, var(--header-mid) 55%, var(--header-to) 100%);
    border-color: rgba(var(--accent-rgb), 0.35);
    box-shadow: 0 4px 24px rgba(var(--accent-rgb), 0.15);
}

.site-footer {
    box-shadow: 0 -4px 24px rgba(var(--accent-rgb), 0.15);
}

.main-menu {
    background: var(--menu-bg);
    border-bottom-color: rgba(var(--accent-rgb), 0.2);
}

/* ===== Selector de temas ===== */
.theme-picker {
    position: fixed;
    bottom: 1.25rem;
    left: 1.25rem;
    z-index: 999;
}

.theme-picker-toggle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid rgba(var(--accent-rgb), 0.5);
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(12px);
    color: #fff;
    font-size: 1.35rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.theme-picker-toggle:hover {
    transform: scale(1.08);
    border-color: rgba(var(--accent-rgb), 0.9);
}

.theme-picker-panel {
    position: absolute;
    bottom: calc(100% + 0.75rem);
    left: 0;
    width: min(280px, calc(100vw - 2.5rem));
    padding: 1rem;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(var(--accent-rgb), 0.35);
    backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.25s ease;
}

.theme-picker.is-open .theme-picker-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-picker-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 0.75rem;
    text-align: center;
}

.theme-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 0.4rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.theme-option:hover {
    border-color: rgba(var(--accent-rgb), 0.6);
    background: rgba(var(--accent-rgb), 0.12);
}

.theme-option.is-active {
    border-color: rgba(var(--accent-rgb), 0.85);
    background: rgba(var(--accent-rgb), 0.2);
    box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.25);
}

.theme-preview {
    width: 100%;
    height: 32px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.theme-preview-neon {
    background: linear-gradient(135deg, #4c1d95, #db2777);
    animation: preview-neon 3s ease-in-out infinite;
}

.theme-preview-cyber {
    background: linear-gradient(135deg, #0e7490, #86198f);
    background-image: repeating-linear-gradient(0deg, rgba(34,211,238,0.3) 0 1px, transparent 1px 6px),
                      linear-gradient(135deg, #0e7490, #86198f);
    animation: preview-scan 2s linear infinite;
}

.theme-preview-sunset {
    background: linear-gradient(180deg, #1c0a05 30%, #ea580c 70%, #fde047 100%);
}

.theme-preview-aurora {
    background: linear-gradient(180deg, #020810 0%, #062015 100%);
    position: relative;
    overflow: hidden;
}

.theme-preview-aurora::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 20%;
    width: 25%;
    height: 80%;
    background: linear-gradient(180deg, transparent, rgba(52,211,153,0.8), transparent);
    filter: blur(3px);
    animation: preview-ribbon 2.5s ease-in-out infinite;
}

.theme-preview-aurora::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 25%;
    width: 20%;
    height: 70%;
    background: linear-gradient(180deg, transparent, rgba(34,211,238,0.7), rgba(139,92,246,0.5), transparent);
    filter: blur(3px);
    animation: preview-ribbon 3s ease-in-out infinite reverse;
}

@keyframes preview-ribbon {
    0%, 100% { transform: skewX(-5deg) scaleY(1); opacity: 0.7; }
    50% { transform: skewX(5deg) scaleY(1.15); opacity: 1; }
}

.theme-preview-galaxy {
    background: radial-gradient(circle at 30% 40%, #6366f1, #0b0618 70%);
    position: relative;
    overflow: hidden;
}

.theme-preview-galaxy::before {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fbbf24;
    top: 20%;
    left: 15%;
    box-shadow: 0 0 6px #fbbf24;
    animation: preview-orbit 3s linear infinite;
}

.theme-preview-galaxy::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent, rgba(167,139,250,0.4), transparent);
    animation: preview-aurora 3s ease-in-out infinite;
}

@keyframes preview-orbit {
    from { transform: rotate(0deg) translateX(18px) rotate(0deg); }
    to { transform: rotate(360deg) translateX(18px) rotate(-360deg); }
}

@keyframes preview-neon {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

@keyframes preview-scan {
    from { background-position: 0 0, 0 0; }
    to { background-position: 0 6px, 0 0; }
}

@keyframes preview-aurora {
    0%, 100% { filter: hue-rotate(0deg); }
    50% { filter: hue-rotate(20deg); }
}

@media (max-width: 768px) {
    .theme-picker {
        bottom: 0.85rem;
        left: 0.85rem;
    }

    .theme-picker-toggle {
        width: 46px;
        height: 46px;
        font-size: 1.15rem;
    }

    .bg-fx-galaxy .orbit-1 { width: 220px; height: 220px; }
    .bg-fx-galaxy .orbit-2 { width: 170px; height: 170px; }
    .bg-fx-galaxy .orbit-3 { width: 120px; height: 120px; }
    .bg-fx-galaxy .planet-giant { width: 100px; height: 100px; bottom: 5%; right: 3%; }
}

@media (prefers-reduced-motion: reduce) {
    .bg-fx-neon *,
    .bg-fx-cyber *,
    .bg-fx-sunset *,
    .bg-fx-aurora *,
    .bg-fx-galaxy *,
    .auth-page .auth-card {
        animation: none !important;
    }
}
