/* === RESET Y BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-cyan: #00ffff;
    --primary-magenta: #ff00ff;
    --primary-gold: #ffd700;
    --bg-dark: #0a0a0f;
    --bg-darker: #050508;
    --text-white: #ffffff;
    --glow-cyan: 0 0 20px var(--primary-cyan);
    --glow-magenta: 0 0 20px var(--primary-magenta);
    --glow-gold: 0 0 20px var(--primary-gold);
}

body {
    font-family: 'Orbitron', monospace;
    background: var(--bg-dark);
    color: var(--text-white);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* === CANVAS OPTIMIZADO === */
#effectsCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#effectsCanvas.active {
    opacity: 1;
}

/* === FONDO DINÁMICO OPTIMIZADO === */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}

.stars-field {
    position: absolute;
    width: 200%;
    height: 200%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, var(--text-white), transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, var(--text-white), transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.6), transparent);
    background-repeat: repeat;
    background-size: 300px 200px;
    animation: starsMove 180s linear infinite;
    will-change: transform;
}

@keyframes starsMove {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-200px, -200px, 0); }
}

.nebula-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 25% 50%, rgba(0, 255, 255, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 75% 25%, rgba(255, 0, 255, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 75%, rgba(255, 215, 0, 0.1) 0%, transparent 50%);
    animation: nebulaShift 40s ease-in-out infinite;
    will-change: transform;
}

@keyframes nebulaShift {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.3; }
    33% { transform: scale(1.1) rotate(120deg); opacity: 0.5; }
    66% { transform: scale(0.9) rotate(240deg); opacity: 0.4; }
}

.grid-matrix {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 120px 120px;
    animation: gridPulse 15s ease-in-out infinite;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.02); }
}

.aurora-waves {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        60deg,
        transparent 30%,
        rgba(0, 255, 127, 0.08) 50%,
        rgba(255, 0, 255, 0.08) 70%,
        transparent 90%
    );
    animation: auroraFlow 25s ease-in-out infinite;
}

@keyframes auroraFlow {
    0%, 100% { transform: translateX(-150px) skewX(-5deg); }
    50% { transform: translateX(150px) skewX(5deg); }
}

/* === CONTENIDO PRINCIPAL === */
.main-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    gap: 40px;
}

/* === TÍTULO FUTURISTA === */
.title-header {
    text-align: center;
    animation: titleEntrance 2s ease-out;
}

.main-title {
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 20px;
}

.title-word {
    display: block;
    background: linear-gradient(45deg, var(--primary-cyan), var(--primary-magenta), var(--primary-gold));
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 4s ease-in-out infinite;
}

.title-year {
    display: block;
    background: linear-gradient(45deg, var(--primary-gold), #ff6b35, #f7931e);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: goldShimmer 3s ease-in-out infinite;
    text-shadow: var(--glow-gold);
}

@keyframes gradientFlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes goldShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.glow-cyan {
    text-shadow: var(--glow-cyan);
    animation: cyberGlow 2s ease-in-out infinite alternate;
}

@keyframes cyberGlow {
    0% { text-shadow: 0 0 10px var(--primary-cyan); }
    100% { text-shadow: 0 0 30px var(--primary-cyan), 0 0 40px var(--primary-cyan); }
}

.hologram {
    position: relative;
    animation: hologramFlicker 4s ease-in-out infinite;
}

@keyframes hologramFlicker {
    0%, 100% { opacity: 1; }
    98% { opacity: 1; }
    99% { opacity: 0.8; }
}

.subtitle {
    font-size: clamp(1rem, 3vw, 1.4rem);
    font-weight: 300;
    color: var(--primary-cyan);
    font-family: 'Exo 2', sans-serif;
}

.neon-pulse {
    animation: neonPulse 3s ease-in-out infinite;
}

@keyframes neonPulse {
    0%, 100% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.02); }
}

@keyframes titleEntrance {
    0% {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* === CONTADOR OPTIMIZADO === */
.countdown-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(15px, 4vw, 30px);
    flex-wrap: wrap;
}

.time-block {
    position: relative;
    text-align: center;
    padding: clamp(15px, 3vw, 25px);
    background: rgba(0, 255, 255, 0.05);
    border: 2px solid rgba(0, 255, 255, 0.2);
    border-radius: 20px;
    backdrop-filter: blur(15px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: clamp(80px, 15vw, 120px);
    overflow: hidden;
}

.time-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.6s ease;
}

.time-block:hover::before {
    left: 100%;
}

.time-block:hover {
    transform: scale(1.05) translateY(-5px);
    background: rgba(0, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.5);
    box-shadow: var(--glow-cyan);
}

.cyber-glow {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    color: var(--text-white);
    text-shadow: 
        0 0 10px var(--primary-cyan),
        0 0 20px var(--primary-cyan),
        0 0 30px var(--primary-cyan);
    transition: all 0.3s ease;
    position: relative;
}

.time-value.updating {
    animation: valueUpdate 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes valueUpdate {
    0% { transform: scale(1) rotateY(0deg); }
    50% { transform: scale(1.15) rotateY(180deg); color: var(--primary-gold); }
    100% { transform: scale(1) rotateY(360deg); }
}

.time-label {
    font-size: clamp(0.7rem, 1.5vw, 0.9rem);
    font-weight: 400;
    color: var(--primary-cyan);
    margin-top: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.time-effect {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-cyan), var(--primary-magenta));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.time-block:hover .time-effect {
    transform: scaleX(1);
}

.separator-pulse {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 900;
    color: var(--primary-magenta);
    text-shadow: var(--glow-magenta);
    animation: separatorPulse 2s ease-in-out infinite;
}

@keyframes separatorPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* === MENSAJE DINÁMICO === */
.message-display {
    text-align: center;
}

.message-text {
    font-size: clamp(1.1rem, 2.5vw, 1.6rem);
    font-weight: 400;
    color: var(--primary-gold);
    font-family: 'Exo 2', sans-serif;
    transition: all 0.5s ease;
}

.holographic {
    background: linear-gradient(45deg, var(--primary-gold), var(--primary-cyan), var(--primary-magenta));
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: holographicShift 5s ease-in-out infinite;
}

@keyframes holographicShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* === BARRA DE PROGRESO FUTURISTA === */
.progress-display {
    width: 100%;
    max-width: 600px;
}

.progress-label {
    text-align: center;
    font-size: 1rem;
    color: var(--primary-cyan);
    margin-bottom: 15px;
    font-family: 'Exo 2', sans-serif;
}

.progress-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress-track {
    position: relative;
    flex: 1;
    height: 25px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid rgba(0, 255, 255, 0.2);
}

.quantum-glow {
    height: 100%;
    background: linear-gradient(90deg, 
        var(--primary-cyan), 
        var(--primary-magenta), 
        var(--primary-gold), 
        var(--primary-cyan)
    );
    background-size: 400% 100%;
    border-radius: 15px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    animation: quantumFlow 4s ease-in-out infinite;
    position: relative;
}

@keyframes quantumFlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.progress-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle, rgba(255, 255, 255, 0.8) 1px, transparent 1px);
    background-size: 20px 20px;
    animation: particlesMove 3s linear infinite;
    opacity: 0.6;
}

@keyframes particlesMove {
    0% { transform: translateX(-20px); }
    100% { transform: translateX(20px); }
}

.progress-text {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-white);
    text-shadow: var(--glow-cyan);
    min-width: 50px;
}

/* === CONTROLES INTERACTIVOS === */
.controls-panel {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.effect-button, .theme-toggle {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-white);
    background: linear-gradient(45deg, var(--primary-cyan), var(--primary-magenta));
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    box-shadow: 
        0 0 20px rgba(0, 255, 255, 0.3),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
    font-family: 'Orbitron', monospace;
    position: relative;
    overflow: hidden;
}

.effect-button::before, .theme-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.effect-button:hover::before, .theme-toggle:hover::before {
    left: 100%;
}

.effect-button:hover, .theme-toggle:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 
        0 0 30px rgba(0, 255, 255, 0.5),
        inset 0 0 30px rgba(255, 255, 255, 0.2);
}

.effect-button:active, .theme-toggle:active {
    transform: scale(0.98);
}

/* === ELEMENTOS FLOTANTES OPTIMIZADOS === */
.floating-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.float-item {
    position: absolute;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 900;
    color: rgba(0, 255, 255, 0.3);
    animation: floatAround 20s linear infinite;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.float-item:nth-child(1) {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
    animation-duration: 25s;
}

.float-item:nth-child(2) {
    top: 20%;
    right: 15%;
    animation-delay: -5s;
    animation-duration: 30s;
}

.float-item:nth-child(3) {
    bottom: 30%;
    left: 20%;
    animation-delay: -10s;
    animation-duration: 35s;
}

.float-item:nth-child(4) {
    bottom: 20%;
    right: 25%;
    animation-delay: -15s;
    animation-duration: 28s;
}

.float-item:nth-child(5) {
    top: 50%;
    left: 5%;
    animation-delay: -20s;
    animation-duration: 32s;
}

@keyframes floatAround {
    0%, 100% {
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
        opacity: 0.3;
    }
    25% {
        transform: translate3d(100px, -50px, 0) rotate(90deg) scale(1.1);
        opacity: 0.6;
    }
    50% {
        transform: translate3d(50px, 100px, 0) rotate(180deg) scale(0.9);
        opacity: 0.4;
    }
    75% {
        transform: translate3d(-80px, 30px, 0) rotate(270deg) scale(1.05);
        opacity: 0.5;
    }
}

/* === RESPONSIVE OPTIMIZADO === */
@media (max-width: 768px) {
    .main-content {
        gap: 30px;
        padding: 15px;
    }
    
    .countdown-display {
        gap: 10px;
    }
    
    .time-block {
        min-width: 70px;
        padding: 12px;
    }
    
    .controls-panel {
        gap: 15px;
    }
    
    .separator-pulse {
        display: none;
    }
}

@media (max-width: 480px) {
    .countdown-display {
        flex-direction: column;
        gap: 15px;
    }
    
    .time-block {
        width: 100%;
        max-width: 200px;
    }
    
    .controls-panel {
        flex-direction: column;
        align-items: center;
    }
    
    .effect-button, .theme-toggle {
        width: 200px;
    }
}

@media (max-width: 320px) {
    .main-content {
        gap: 20px;
    }
    
    .time-block {
        padding: 10px;
    }
}

/* === MODO NOCTURNO === */
body.night-mode {
    --bg-dark: #000005;
    --bg-darker: #000000;
    --primary-cyan: #00cccc;
    --primary-magenta: #cc00cc;
    --primary-gold: #ccaa00;
}

body.night-mode .background-container {
    opacity: 0.7;
}

body.night-mode .time-block {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(0, 255, 255, 0.1);
}

/* === ANIMACIONES DE PARTÍCULAS === */
.particle-effect {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    border-radius: 50%;
    animation: particleFloat 1s ease-out forwards;
}

@keyframes particleFloat {
    0% {
        transform: scale(1) translate(0, 0);
        opacity: 1;
    }
    100% {
        transform: scale(0) translate(var(--dx), var(--dy));
        opacity: 0;
    }
}

/* === OPTIMIZACIONES DE RENDIMIENTO === */
.background-container * {
    will-change: transform;
}

.time-value, .title-word, .title-year {
    will-change: transform, color;
}

.progress-fill {
    will-change: width;
}

/* === ACCESIBILIDAD === */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-color-scheme: dark) {
    body {
        --bg-dark: #000008;
    }
}