/* ===================================
   VARIABLES CSS Y RESET
   =================================== */
:root {
    /* FASE 1: FORMULARIO - Colores galácticos suaves */
    --phase-1-primary: #4a90e2;      /* Azul galáctico suave */
    --phase-1-secondary: #5cb3cc;    /* Verde agua espacial */
    
    /* FASE 2: HTML - Tonos oficiales */
    --phase-2-primary: #f16529;      /* HTML Orange */
    --phase-2-secondary: #ff9a5a;    /* Resplandor coral */
    
    /* FASE 3: CSS - Tonos oficiales */
    --phase-3-primary: #2965f1;      /* CSS Blue */
    --phase-3-secondary: #6ec5ff;    /* Acento cian */
    
    /* FASE 4: JAVASCRIPT - Tonos oficiales */
    --phase-4-primary: #f7df1e;      /* JS Yellow */
    --phase-4-secondary: #202124;    /* Base oscura */

    /* Paletas de juego por nivel */
    --html-primary: var(--phase-2-primary);
    --html-secondary: var(--phase-2-secondary);
    --css-primary: var(--phase-3-primary);
    --css-secondary: var(--phase-3-secondary);
    --js-primary: var(--phase-4-primary);
    --js-secondary: #2b2b2b;
    
    /* Colores activos (cambian dinámicamente) */
    --color-primary: var(--phase-1-primary);
    /* Eliminamos las variables alpha del formulario para que no opaque el fondo */
    --color-secondary: var(--phase-1-secondary);
    --color-accent: var(--phase-1-primary);
    --color-danger: var(--phase-1-secondary);
    
    /* Colores neutros */
    --color-white: #ffffff;
    --color-gray-50: #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-300: #d1d5db;
    --color-gray-400: #9ca3af;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
    --color-gray-800: #1f2937;
    --color-gray-900: #111827;
    
    /* Tipografía Gaming - Solo fuentes del sistema */
    --font-family-gaming: 'Courier New', 'Consolas', 'Monaco', 'Menlo', monospace;
    --font-family-ui: 'Segoe UI', 'Roboto', 'Arial', sans-serif;
    --font-family: var(--font-family-ui);
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    
    /* Espaciado */
    --spacing-2: 0.5rem;
    --spacing-3: 0.75rem;
    --spacing-4: 1rem;
    --spacing-6: 1.5rem;
    --spacing-8: 2rem;
    --spacing-12: 3rem;
    
    /* Bordes y sombras */
    --border-radius: 0.5rem;
    --border-radius-lg: 0.75rem;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    /* Transiciones */
    --transition: all 0.2s ease-in-out;
    --transition-slow: all 0.3s ease-in-out;
}

/* Reset básico */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--color-gray-800);
    background: 
        /* Base espacial profunda galáctico suave */
        linear-gradient(135deg, #0f0f23 0%, #1a1a2e 25%, #16213e 50%, #1e3a8a 75%, #1e40af 100%);
    background-attachment: fixed;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    min-height: 100vh;
    max-width: 100vw;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    animation: cosmic-breathe 60s ease-in-out infinite;
}

/* Animación removida para evitar problemas de scroll */

/* Fondo nebular evolutivo - Cambia según la fase del juego */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: 
        /* Nebulosa principal - Color primario suavizado */
        radial-gradient(ellipse 80% 70% at 50% 40%, 
            var(--color-primary-alpha-30) 0%, 
            var(--color-primary-alpha-15) 30%, 
            transparent 70%),
        /* Nebulosa secundaria - Color secundario suavizado */
        radial-gradient(ellipse 70% 80% at 30% 60%, 
            var(--color-secondary-alpha-25) 0%, 
            var(--color-secondary-alpha-10) 40%, 
            transparent 75%),
        /* Gradiente base galáctico suave */
        linear-gradient(135deg, 
            var(--color-primary-alpha-20) 0%, 
            var(--color-secondary-alpha-15) 100%);
    background-size: 100% 100%;
    background-attachment: fixed;
    z-index: -2;
    pointer-events: none;
    animation: gentle-glow 60s ease-in-out infinite alternate;
    filter: blur(1.2px) saturate(0.8) contrast(0.9);
    will-change: opacity;
    transition: all 3s ease-in-out;
}

/* Campo estelar evolutivo - Estrellas que cambian según la fase */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: 
        /* Estrellas principales - Color primario actual */
        radial-gradient(circle at 15% 25%, var(--color-primary) 0px, transparent 2px),
        radial-gradient(circle at 35% 60%, var(--color-primary) 0px, transparent 2px),
        radial-gradient(circle at 65% 35%, var(--color-primary) 0px, transparent 2px),
        radial-gradient(circle at 85% 15%, var(--color-primary) 0px, transparent 2px),
        /* Estrellas secundarias - Color secundario actual */
        radial-gradient(circle at 75% 70%, var(--color-secondary) 0px, transparent 2px),
        radial-gradient(circle at 25% 80%, var(--color-secondary) 0px, transparent 2px),
        radial-gradient(circle at 45% 45%, var(--color-secondary) 0px, transparent 2px),
        radial-gradient(circle at 90% 85%, var(--color-secondary) 0px, transparent 2px),
        /* Estrellas blancas pequeñas - Siempre presentes */
        radial-gradient(circle at 10% 40%, rgba(255, 255, 255, 0.8) 0px, transparent 1px),
        radial-gradient(circle at 70% 5%, rgba(255, 255, 255, 0.7) 0px, transparent 1px),
        radial-gradient(circle at 50% 85%, rgba(255, 255, 255, 0.6) 0px, transparent 1px),
        radial-gradient(circle at 95% 30%, rgba(255, 255, 255, 0.8) 0px, transparent 1px);
    background-size: 300px 300px, 200px 200px, 250px 250px, 350px 350px, 180px 180px, 220px 220px, 280px 280px, 160px 160px, 400px 400px, 300px 300px, 250px 250px, 200px 200px;
    background-repeat: repeat;
    background-attachment: fixed;
    z-index: -1;
    pointer-events: none;
    animation: random-drift 50s ease-in-out infinite alternate;
    filter: blur(0.3px) contrast(1.2) saturate(1.3);
    will-change: background-position;
    transition: all 2s ease-in-out;
}

/* Animación nebula galáctico - Respiración cósmica suave */
@keyframes gentle-glow {
    0% { 
        opacity: 0.7;
        filter: brightness(0.9) hue-rotate(0deg) saturate(0.8);
    }
    25% {
        opacity: 0.8;
        filter: brightness(1) hue-rotate(5deg) saturate(0.9);
    }
    50% {
        opacity: 0.9;
        filter: brightness(1.1) hue-rotate(8deg) saturate(1);
    }
    75% {
        opacity: 0.85;
        filter: brightness(1.05) hue-rotate(6deg) saturate(0.95);
    }
    100% { 
        opacity: 0.7;
        filter: brightness(0.9) hue-rotate(0deg) saturate(0.8);
    }
}

/* Animación sutil para partículas - Parpadeo natural */
@keyframes gentle-sparkle {
    0% { 
        opacity: 0.5;
        filter: brightness(1) blur(0px);
        transform: scale(1);
    }
    20% {
        opacity: 0.7;
        filter: brightness(1.1) blur(0.2px);
        transform: scale(1.05);
    }
    40% {
        opacity: 0.9;
        filter: brightness(1.2) blur(0.1px);
        transform: scale(0.98);
    }
    60% {
        opacity: 0.8;
        filter: brightness(1.15) blur(0.3px);
        transform: scale(1.02);
    }
    80% {
        opacity: 0.6;
        filter: brightness(1.05) blur(0.1px);
        transform: scale(0.99);
    }
    100% { 
        opacity: 0.5;
        filter: brightness(1) blur(0px);
        transform: scale(1);
    }
}

/* Animación ultra sutil para el fondo principal - Respiración cósmica galáctico */
@keyframes cosmic-breathe {
    0% {
        filter: brightness(0.95) saturate(0.9) hue-rotate(0deg);
    }
    33% {
        filter: brightness(1) saturate(0.95) hue-rotate(1deg);
    }
    66% {
        filter: brightness(1.02) saturate(1) hue-rotate(2deg);
    }
    100% {
        filter: brightness(0.95) saturate(0.9) hue-rotate(0deg);
    }
}

/* ===================================
   SISTEMA DE FASES EVOLUTIVAS
   =================================== */

/* FASE 1: FORMULARIO - Azul galáctico suave */
body.phase-1 {
    --color-primary: var(--phase-1-primary);
    --color-secondary: var(--phase-1-secondary);
    --color-primary-alpha-30: rgba(74, 144, 226, 0);
    --color-primary-alpha-20: rgba(74, 144, 226, 0);
    --color-primary-alpha-15: rgba(74, 144, 226, 0);
    --color-secondary-alpha-25: rgba(92, 179, 204, 0);
    --color-secondary-alpha-15: rgba(92, 179, 204, 0);
    --color-secondary-alpha-10: rgba(92, 179, 204, 0);
}

/* FASE 2: HTML - Naranja nebular suave */
body.phase-2 {
    --color-primary: var(--phase-2-primary);
    --color-secondary: var(--phase-2-secondary);
    --color-primary-alpha-30: rgba(241, 101, 41, 0.32);
    --color-primary-alpha-20: rgba(241, 101, 41, 0.2);
    --color-primary-alpha-15: rgba(241, 101, 41, 0.15);
    --color-secondary-alpha-25: rgba(255, 154, 90, 0.25);
    --color-secondary-alpha-15: rgba(255, 154, 90, 0.15);
    --color-secondary-alpha-10: rgba(255, 154, 90, 0.1);
}

/* FASE 3: CSS - Púrpura nebula profundo */
body.phase-3 {
    --color-primary: var(--phase-3-primary);
    --color-secondary: var(--phase-3-secondary);
    --color-primary-alpha-30: rgba(41, 101, 241, 0.32);
    --color-primary-alpha-20: rgba(41, 101, 241, 0.22);
    --color-primary-alpha-15: rgba(41, 101, 241, 0.16);
    --color-secondary-alpha-25: rgba(110, 197, 255, 0.25);
    --color-secondary-alpha-15: rgba(110, 197, 255, 0.15);
    --color-secondary-alpha-10: rgba(110, 197, 255, 0.1);
}

/* FASE 4: JAVASCRIPT - Rojo marte profundo */
body.phase-4 {
    --color-primary: var(--phase-4-primary);
    --color-secondary: var(--phase-4-secondary);
    --color-primary-alpha-30: rgba(247, 223, 30, 0.32);
    --color-primary-alpha-20: rgba(247, 223, 30, 0.2);
    --color-primary-alpha-15: rgba(247, 223, 30, 0.15);
    --color-secondary-alpha-25: rgba(32, 33, 36, 0.4);
    --color-secondary-alpha-15: rgba(32, 33, 36, 0.24);
    --color-secondary-alpha-10: rgba(32, 33, 36, 0.16);
}

/* FASE FINAL: BIG BANG - Colores galácticos finales */
body.big-bang {
    --color-primary: #9333ea;
    --color-secondary: #059669;
    --color-primary-alpha-30: rgba(147, 51, 234, 0.3);
    --color-primary-alpha-15: rgba(147, 51, 234, 0.15);
    --color-primary-alpha-20: rgba(147, 51, 234, 0.2);
    --color-secondary-alpha-25: rgba(5, 150, 105, 0.25);
    --color-secondary-alpha-10: rgba(5, 150, 105, 0.1);
    --color-secondary-alpha-15: rgba(5, 150, 105, 0.15);
    animation: big-bang-explosion 4s ease-in-out;
}

@keyframes big-bang-explosion {
    0% { 
        filter: brightness(0.9) hue-rotate(0deg) saturate(0.8);
    }
    25% {
        filter: brightness(1.1) hue-rotate(90deg) saturate(1);
    }
    50% {
        filter: brightness(1.3) hue-rotate(180deg) saturate(1.2);
    }
    75% {
        filter: brightness(1.2) hue-rotate(270deg) saturate(1.1);
    }
    100% {
        filter: brightness(1) hue-rotate(360deg) saturate(0.9);
    }
}

/* ===================================
   PANTALLA DE ANIMACIÓN INICIAL
   =================================== */
.intro-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(15px);
    background: rgba(0, 0, 0, 0.3);
    animation: intro-appear 1s ease-out;
}

.intro-animation.fade-out {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
    transition: all 1s ease-out;
}

.intro-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-8);
    text-align: center;
    max-width: 800px;
    padding: var(--spacing-6);
}

.typewriter-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.typewriter-text {
    font-size: 3rem;
    font-weight: 900;
    color: #00ffff;
    font-family: var(--font-family-gaming);
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.8), 0 0 40px rgba(0, 255, 255, 0.4);
    line-height: 1.4;
    letter-spacing: 2px;
    margin: 0;
    text-transform: uppercase;
}

/* Estilo especial para el mensaje "Click para comenzar" */
.typewriter-text.click-to-start {
    font-size: 2.2rem;
    color: #ffd700;
    text-transform: none;
    font-weight: 700;
    text-shadow: 
        0 0 15px rgba(255, 215, 0, 0.9),
        0 0 25px rgba(255, 215, 0, 0.6),
        0 0 35px rgba(255, 215, 0, 0.3);
    animation: click-to-start-pulse 2s ease-in-out infinite;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.typewriter-text.click-to-start:hover {
    transform: scale(1.05);
    text-shadow: 
        0 0 20px rgba(255, 215, 0, 1),
        0 0 30px rgba(255, 215, 0, 0.8),
        0 0 40px rgba(255, 215, 0, 0.5);
}

@keyframes click-to-start-pulse {
    0% {
        opacity: 0.7;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
    100% {
        opacity: 0.7;
        transform: scale(1);
    }
}

/* Estilos para palabras específicas en el texto */
.typewriter-text .html-word {
    color: #ff8c42;
    text-shadow: 
        0 0 15px rgba(255, 140, 66, 0.8),
        0 0 30px rgba(255, 140, 66, 0.6),
        0 0 45px rgba(255, 140, 66, 0.4);
    font-weight: 900;
    animation: tech-glow-orange 2s ease-in-out infinite alternate;
}

.typewriter-text .css-word {
    color: #4a90e2;
    text-shadow: 
        0 0 15px rgba(74, 144, 226, 0.8),
        0 0 30px rgba(74, 144, 226, 0.6),
        0 0 45px rgba(74, 144, 226, 0.4);
    font-weight: 900;
    animation: tech-glow-blue 2s ease-in-out infinite alternate;
}

.typewriter-text .js-word {
    color: #ffd700;
    text-shadow: 
        0 0 15px rgba(255, 215, 0, 0.8),
        0 0 30px rgba(255, 215, 0, 0.6),
        0 0 45px rgba(255, 215, 0, 0.4);
    font-weight: 900;
    animation: tech-glow-yellow 2s ease-in-out infinite alternate;
}

/* Animaciones para las palabras tecnológicas */
@keyframes tech-glow-orange {
    0% { text-shadow: 0 0 15px rgba(255, 140, 66, 0.8), 0 0 30px rgba(255, 140, 66, 0.6); }
    100% { text-shadow: 0 0 25px rgba(255, 140, 66, 1), 0 0 40px rgba(255, 140, 66, 0.8); }
}

@keyframes tech-glow-blue {
    0% { text-shadow: 0 0 15px rgba(74, 144, 226, 0.8), 0 0 30px rgba(74, 144, 226, 0.6); }
    100% { text-shadow: 0 0 25px rgba(74, 144, 226, 1), 0 0 40px rgba(74, 144, 226, 0.8); }
}

@keyframes tech-glow-yellow {
    0% { text-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.6); }
    100% { text-shadow: 0 0 25px rgba(255, 215, 0, 1), 0 0 40px rgba(255, 215, 0, 0.8); }
}


.audio-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    margin-left: auto;
    align-self: flex-start;
}

.audio-btn {
    width: 34px;
    height: 34px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    cursor: pointer;
    color: rgba(226, 232, 240, 0.85);
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.35);
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 24px rgba(8, 11, 24, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
    opacity: 0.85;
}

.audio-btn:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 14px 30px rgba(12, 18, 36, 0.4);
    background: rgba(37, 99, 235, 0.75);
    opacity: 1;
}

.audio-btn.muted {
    background: rgba(239, 68, 68, 0.68);
    border-color: rgba(248, 113, 113, 0.4);
    color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 12px 26px rgba(190, 18, 60, 0.32);
}

.audio-btn.muted:hover {
    background: rgba(248, 113, 113, 0.78);
}

.start-adventure-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
    padding: var(--spacing-3) var(--spacing-6);
    margin-top: var(--spacing-6);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.9), rgba(59, 130, 246, 0.9));
    border: 1px solid rgba(148, 163, 184, 0.6);
    border-radius: 999px;
    color: var(--color-white);
    font-size: var(--font-size-lg);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-shadow: 0 0 15px rgba(59, 130, 246, 0.45), 0 0 25px rgba(16, 185, 129, 0.35);
    box-shadow:
        0 0 30px rgba(59, 130, 246, 0.45),
        inset 0 0 30px rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    animation: start-btn-pulse 3s ease-in-out infinite;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.6s ease, opacity 0.6s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.start-adventure-btn.show {
    transform: translateY(0);
    opacity: 1;
    transition: all 1s ease-out 0.5s;
}

@keyframes start-btn-pulse {
    0%, 100% { 
        box-shadow: 
            0 0 30px rgba(0, 255, 255, 0.5),
            inset 0 0 30px rgba(0, 255, 255, 0.1);
    }
    50% { 
        box-shadow: 
            0 0 40px rgba(0, 255, 255, 0.8),
            0 0 60px rgba(255, 0, 150, 0.4),
            inset 0 0 40px rgba(0, 255, 255, 0.2);
    }
}

.start-adventure-btn:hover {
    transform: scale(1.05);
    box-shadow: 
        0 0 50px rgba(0, 255, 255, 0.8),
        0 0 80px rgba(255, 0, 150, 0.5),
        inset 0 0 50px rgba(0, 255, 255, 0.2);
}

@keyframes intro-appear {
    0% { 
        opacity: 0; 
        backdrop-filter: blur(0px);
    }
    100% { 
        opacity: 1; 
        backdrop-filter: blur(15px);
    }
}

/* ===================================
   PANTALLA DE BIENVENIDA
   =================================== */
.welcome-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--spacing-2);
    padding-top: max(1vh, 10px);
    padding-bottom: max(1vh, 10px);
    box-sizing: border-box;
    /* Permitir scroll cuando sea necesario */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 255, 0.6) transparent;
}

.welcome-screen.fade-out {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

.welcome-container {
    background: linear-gradient(135deg, 
        rgba(10, 15, 30, 0.95) 0%, 
        rgba(20, 25, 45, 0.9) 50%,
        rgba(15, 20, 40, 0.95) 100%);
    backdrop-filter: blur(25px);
    border: 2px solid rgba(0, 255, 255, 0.4);
    border-radius: 15px;
    padding: 20px;
    max-width: 600px;
    width: calc(100% - 20px);
    min-width: 320px;
    /* Sistema híbrido: adapta hasta cierto punto, luego scroll */
    min-height: auto;
    height: auto;
    max-height: calc(100vh - 20px);
    box-shadow: 
        0 0 40px rgba(0, 255, 255, 0.3),
        0 0 80px rgba(255, 0, 150, 0.2),
        inset 0 1px 0 rgba(0, 255, 255, 0.2),
        inset 0 -1px 0 rgba(255, 0, 150, 0.1);
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    animation: welcome-appear 1s ease-out, neon-glow 4s ease-in-out infinite;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
    /* Transición suave para cambios de altura y contenido */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    /* Scrollbar personalizado */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 255, 0.7) rgba(10, 15, 30, 0.3);
}

/* Animación neon para el container */
@keyframes neon-glow {
    0%, 100% { 
        box-shadow: 
            0 0 40px rgba(0, 255, 255, 0.3),
            0 0 80px rgba(255, 0, 150, 0.2),
            inset 0 1px 0 rgba(0, 255, 255, 0.2),
            inset 0 -1px 0 rgba(255, 0, 150, 0.1);
    }
    50% { 
        box-shadow: 
            0 0 50px rgba(0, 255, 255, 0.4),
            0 0 100px rgba(255, 0, 150, 0.3),
            inset 0 1px 0 rgba(0, 255, 255, 0.3),
            inset 0 -1px 0 rgba(255, 0, 150, 0.2);
    }
}

/* Scrollbar personalizado retro neon - MEJORADO */
.welcome-container::-webkit-scrollbar {
    width: 12px;
}

.welcome-container::-webkit-scrollbar-track {
    background: rgba(10, 15, 30, 0.6);
    border-radius: 6px;
    border: 1px solid rgba(0, 255, 255, 0.3);
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
}

.welcome-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, 
        rgba(0, 255, 255, 0.8) 0%, 
        rgba(0, 200, 255, 0.6) 50%,
        rgba(255, 0, 150, 0.5) 100%);
    border-radius: 6px;
    border: 1px solid rgba(0, 255, 255, 0.4);
    transition: all 0.3s ease;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
}

.welcome-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, 
        rgba(0, 255, 255, 1) 0%, 
        rgba(0, 200, 255, 0.8) 50%,
        rgba(255, 0, 150, 0.7) 100%);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.5);
}

/* Scrollbar para el welcome-screen también */
.welcome-screen::-webkit-scrollbar {
    width: 14px;
}

.welcome-screen::-webkit-scrollbar-track {
    background: rgba(5, 10, 20, 0.7);
    border-radius: 7px;
}

.welcome-screen::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, 
        rgba(0, 255, 255, 0.9) 0%, 
        rgba(255, 0, 150, 0.6) 100%);
    border-radius: 7px;
    border: 2px solid rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
}

.welcome-screen::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, 
        rgba(0, 255, 255, 1) 0%, 
        rgba(255, 0, 150, 0.8) 100%);
}

@keyframes welcome-appear {
    0% {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.welcome-header {
    text-align: center;
    margin-bottom: var(--spacing-6);
    flex-shrink: 0;
    padding: var(--spacing-3);
}

.welcome-header h1 {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: #00ffff;
    text-shadow: 
        0 0 10px rgba(0, 255, 255, 0.8),
        0 0 20px rgba(0, 255, 255, 0.6),
        0 0 30px rgba(0, 255, 255, 0.4);
    margin-bottom: var(--spacing-3);
    animation: neon-title-pulse 3s ease-in-out infinite;
    line-height: 1.2;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-family: 'Courier New', monospace;
}

@keyframes neon-title-pulse {
    0%, 100% { 
        color: #00ffff;
        text-shadow: 
            0 0 10px rgba(0, 255, 255, 0.8),
            0 0 20px rgba(0, 255, 255, 0.6),
            0 0 30px rgba(0, 255, 255, 0.4);
    }
    50% { 
        color: #ff0096;
        text-shadow: 
            0 0 10px rgba(255, 0, 150, 0.8),
            0 0 20px rgba(255, 0, 150, 0.6),
            0 0 30px rgba(255, 0, 150, 0.4);
    }
}

.welcome-header p {
    color: #a0a0ff;
    font-size: var(--font-size-sm);
    line-height: 1.4;
    margin-bottom: 0;
    text-shadow: 0 0 5px rgba(160, 160, 255, 0.3);
    font-family: 'Courier New', monospace;
}

.player-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    min-height: auto;
    padding: 0;
    margin: 0;
    width: 100%;
    /* Permitir que el formulario se expanda */
    overflow: visible;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    margin-bottom: 16px;
    padding-bottom: 6px;
    width: 100%;
    /* Adaptación fluida al contenido dinámico */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: auto;
}

/* Cuando hay feedback, expandir dinámicamente */
.form-group:has(.field-feedback) {
    margin-bottom: 32px;
    padding-bottom: 16px;
    min-height: auto;
}

/* Fallback para navegadores que no soportan :has() */
.form-group.field-valid,
.form-group.field-invalid,
.form-group.field-empty {
    margin-bottom: 32px;
    padding-bottom: 16px;
}

/* Cuando el feedback está activo, asegurar espacio óptimo */
.form-group.has-feedback {
    margin-bottom: 36px;
    padding-bottom: 18px;
}

/* Contenedor de formulario que se adapta dinámicamente */
.player-form {
    flex: 1;
    width: 100%;
    min-height: auto;
    overflow: visible;
    padding: 0;
    margin: 0;
    /* Permitir crecimiento natural */
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Texto de ayuda inline amigable */
.field-help {
    font-size: 12px;
    color: rgba(140, 200, 255, 0.8);
    margin-top: 4px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 6px;
}

.field-help::before {
    content: "💡";
    font-size: 11px;
}

/* Contenedor de input con indicador */
.input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.input-container input,
.input-container select {
    width: 100%;
    padding-right: 45px; /* Espacio para el indicador */
}

/* Animaciones suaves para transiciones de estado */
.form-group {
    transition: all 0.3s ease;
}

.form-group:focus-within {
    transform: translateY(-2px);
}

/* Mejora visual para labels */
.form-group label {
    margin-bottom: 6px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Estados hover mejorados */
.form-group:hover .field-help {
    color: rgba(140, 200, 255, 1);
    transform: translateX(2px);
}

/* Respuesta visual al focus */
.input-container:focus-within {
    transform: scale(1.02);
}

/* Mejoras de UX adicionales */
.form-group input:focus,
.form-group select:focus {
    transform: none; /* Evitar doble transformación */
    box-shadow: 
        0 0 0 2px rgba(0, 255, 255, 0.3),
        0 4px 12px rgba(0, 255, 255, 0.2);
}

/* Feedback positivo sutil */
.field-valid .input-container {
    animation: gentle-success-pulse 0.6s ease-out;
}

@keyframes gentle-success-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Estados mejorados para mensajes de ayuda */
.field-help {
    transition: all 0.3s ease;
}

.form-group:focus-within .field-help {
    color: rgba(140, 200, 255, 1);
    transform: translateX(4px);
}

/* Placeholder mejorado */
.form-group input::placeholder,
.form-group select option:first-child {
    color: rgba(140, 200, 255, 0.6);
    font-style: italic;
}

/* Microinteracciones suaves */
.field-feedback {
    animation: slideInFromLeft 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInFromLeft {
    0% {
        opacity: 0;
        transform: translateX(-20px) translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateX(0) translateY(0);
    }
}

.form-group label {
    font-weight: 700;
    color: #00ffff;
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-2);
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Courier New', monospace;
}

.form-group input,
.form-group select {
    padding: var(--spacing-3);
    border: 2px solid rgba(0, 255, 255, 0.4);
    border-radius: 8px;
    font-size: var(--font-size-sm);
    background: rgba(10, 15, 30, 0.8);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    min-height: 44px;
    color: #ffffff;
    font-family: 'Courier New', monospace;
    box-shadow: 
        inset 0 0 10px rgba(0, 255, 255, 0.1),
        0 0 5px rgba(0, 255, 255, 0.2);
}

.form-group input::placeholder,
.form-group select option {
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Courier New', monospace;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #ff0096;
    box-shadow: 
        0 0 20px rgba(255, 0, 150, 0.4),
        inset 0 0 15px rgba(255, 0, 150, 0.1);
    background: rgba(15, 20, 35, 0.9);
    color: #ffffff;
}

/* Estados de validación de campos - Mantener estilo neon */
.form-group.field-valid input,
.form-group.field-valid select {
    border-color: #00ff88;
    background: rgba(10, 20, 15, 0.8);
    color: #ffffff;
    box-shadow: 
        0 0 15px rgba(0, 255, 136, 0.4),
        inset 0 0 10px rgba(0, 255, 136, 0.1);
}

.form-group.field-invalid input,
.form-group.field-invalid select {
    border-color: #ff3366;
    background: rgba(20, 10, 15, 0.8);
    color: #ffffff;
    box-shadow: 
        0 0 15px rgba(255, 51, 102, 0.4),
        inset 0 0 10px rgba(255, 51, 102, 0.1);
    animation: field-shake 0.3s ease-in-out;
}

.form-group.field-empty input,
.form-group.field-empty select {
    border-color: rgba(0, 255, 255, 0.3);
    background: rgba(10, 15, 30, 0.6);
    color: #ffffff;
    box-shadow: 
        inset 0 0 8px rgba(0, 255, 255, 0.1),
        0 0 3px rgba(0, 255, 255, 0.2);
}

/* Animación para campos inválidos */
@keyframes field-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* Sistema de feedback UX mejorado */
.field-feedback {
    position: static;
    margin-top: 8px;
    padding: 10px 15px;
    background: rgba(10, 15, 30, 0.8);
    border-radius: 8px;
    border-left: 3px solid transparent;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* Indicador visual en el campo (icono a la derecha) */
.field-indicator {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s ease-out;
    z-index: 10;
    border-radius: 50%;
    font-family: 'Courier New', monospace;
    pointer-events: none;
}

/* ===================================
   SISTEMA DE ADAPTABILIDAD DINÁMICO
   =================================== */

/* Contenedor que se adapta automáticamente */
.container-adaptive {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    resize: none;
    /* Flexibilidad total para el contenido */
    height: auto !important;
    min-height: auto !important;
    max-height: calc(100vh - 20px) !important;
}

/* Modo expandido para contenido dinámico */
.form-expanded {
    /* Permitir crecimiento natural del contenido */
    height: auto !important;
    min-height: auto !important;
    /* Transición suave para cambios */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Contenedor con feedback de validación activo */
.welcome-container.has-validation-feedback {
    /* Espacio adicional para mensajes */
    padding-bottom: 24px !important;
    /* Asegurar que todo el contenido sea visible */
    min-height: auto !important;
}

/* Forzar scroll cuando es necesario */
.welcome-container.force-scroll {
    overflow-y: auto !important;
    max-height: calc(100vh - 20px) !important;
    height: calc(100vh - 20px) !important;
}

/* Estado sin scroll cuando el contenido cabe */
.welcome-container.no-scroll {
    overflow-y: visible !important;
    height: auto !important;
    max-height: none !important;
}

/* Animación suave para aparición de feedback */
.field-feedback {
    animation: feedbackSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes feedbackSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Transición suave cuando se remueve el feedback */
.field-feedback.removing {
    animation: feedbackSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes feedbackSlideOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
}

/* Estados de feedback mejorados */
.field-valid .field-feedback {
    color: #00ff88;
    background: rgba(0, 255, 136, 0.12);
    border-left-color: #00ff88;
    opacity: 1;
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.15);
}

.field-valid .field-feedback::before {
    content: "✓ ";
    font-weight: bold;
    margin-right: 6px;
}

.field-invalid .field-feedback {
    color: #ff6b9d;
    background: rgba(255, 107, 157, 0.12);
    border-left-color: #ff6b9d;
    opacity: 1;
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.15);
}

.field-invalid .field-feedback::before {
    content: "⚠ ";
    font-weight: bold;
    margin-right: 6px;
}

.field-empty .field-feedback {
    color: #8cc8ff;
    background: rgba(140, 200, 255, 0.12);
    border-left-color: #8cc8ff;
    opacity: 0.9;
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(140, 200, 255, 0.15);
}

.field-empty .field-feedback::before {
    content: "💡 ";
    margin-right: 6px;
}

/* Indicadores visuales en los campos */
.field-valid .field-indicator {
    color: #00ff88;
    background: rgba(0, 255, 136, 0.15);
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
    opacity: 1;
}

.field-valid .field-indicator::before {
    content: "✓";
}

.field-invalid .field-indicator {
    color: #ff6b9d;
    background: rgba(255, 107, 157, 0.15);
    box-shadow: 0 0 8px rgba(255, 107, 157, 0.3);
    opacity: 1;
}

.field-invalid .field-indicator::before {
    content: "✗";
}

.field-empty .field-indicator {
    color: #8cc8ff;
    background: rgba(140, 200, 255, 0.15);
    box-shadow: 0 0 8px rgba(140, 200, 255, 0.3);
    opacity: 0.7;
}

.field-empty .field-indicator::before {
    content: "?";
}

/* Indicador de progreso del formulario - Estilo Neon */
.form-progress {
    margin-bottom: var(--spacing-6);
    padding: var(--spacing-4);
    background: rgba(10, 15, 30, 0.6);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 10px;
    backdrop-filter: blur(15px);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
    display: none;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.5s ease-in-out;
}

.form-progress.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.form-progress-label {
    font-size: var(--font-size-sm);
    color: #00ffff;
    margin-bottom: var(--spacing-3);
    display: block;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.6);
}

.form-progress-bar {
    height: 8px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 255, 255, 0.4);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.2);
}

.form-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, 
        rgba(0, 255, 255, 0.8) 0%, 
        rgba(255, 0, 150, 0.8) 100%);
    border-radius: 4px;
    transition: width 0.4s ease-out;
    position: relative;
    width: 0%;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.6);
}

.form-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: progress-shine 2s ease-in-out infinite;
}

.form-progress-text {
    font-size: var(--font-size-sm);
    color: #a0a0ff;
    margin-top: var(--spacing-3);
    text-align: center;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 5px rgba(160, 160, 255, 0.4);
}

/* Estados de la barra de progreso */
.progress-complete .form-progress-fill {
    background: linear-gradient(90deg, var(--color-secondary), var(--color-secondary-dark));
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.progress-complete .form-progress-fill::after {
    animation: progress-complete-shine 1s ease-in-out;
}

.progress-partial .form-progress-fill {
    background: linear-gradient(90deg, var(--color-accent), var(--color-primary));
}

@keyframes progress-complete-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.start-game-btn {
    position: relative;
    background: linear-gradient(135deg, 
        rgba(0, 255, 255, 0.2) 0%, 
        rgba(255, 0, 150, 0.2) 100%);
    color: #00ffff;
    border: 2px solid #00ffff;
    padding: 16px 24px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    margin: 20px auto 10px auto;
    width: 100%;
    max-width: 340px;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 100;
    flex-shrink: 0;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
    box-shadow: 
        0 0 20px rgba(0, 255, 255, 0.4),
        inset 0 0 20px rgba(0, 255, 255, 0.1);
    animation: neon-button-pulse 2s ease-in-out infinite;
    align-self: center;
}

@media (max-width: 768px) {
    .welcome-container {
        padding: 20px;
        max-width: 95%;
        max-height: 90vh;
        border-radius: 12px;
        min-width: 320px;
    }
    
    .welcome-header h1 {
        font-size: 20px;
        margin-bottom: 8px;
    }
    
    .welcome-header p {
        font-size: 14px;
    }
    
    .welcome-header {
        margin-bottom: 16px;
        padding: 0;
    }
    
    .player-form {
        gap: 16px;
        padding: 0;
        margin: 0;
    }
    
    .form-group {
        gap: 6px;
        margin-bottom: 24px;
        padding-bottom: 8px;
    }
    
    .form-group input,
    .form-group select {
        padding: 12px;
        font-size: 14px;
        min-height: 44px;
    }
    
    .field-feedback {
        font-size: 11px;
        padding: 3px 8px;
        min-height: 18px;
        border-radius: 3px;
        top: calc(100% + 3px);
    }
    
    .start-game-btn {
        padding: 12px 20px;
        font-size: 14px;
        max-width: 100%;
        min-height: 50px;
        margin: 16px auto 8px auto;
    }
    
    /* Ajustar tamaño de typewriter en tablets */
    .typewriter-text {
        font-size: 2.2rem;
        line-height: 1.3;
    }
    
    .cursor {
        font-size: 2.2rem;
    }
}

/* Media query para pantallas muy pequeñas (móviles horizontales) */
@media (max-width: 480px), (max-height: 600px) {
    .welcome-container {
        padding: 16px;
        max-height: 94vh;
        border-radius: 10px;
        min-width: 280px;
        max-width: 98%;
    }
    
    .welcome-header h1 {
        font-size: 18px;
        margin-bottom: 4px;
    }
    
    .welcome-header p {
        font-size: 12px;
        line-height: 1.4;
    }
    
    .welcome-header {
        margin-bottom: 12px;
    }
    
    .player-form {
        gap: 12px;
        margin: 0;
    }
    
    .form-group {
        margin-bottom: 20px;
        padding-bottom: 6px;
    }
    
    .form-group label {
        font-size: 12px;
        margin-bottom: 4px;
    }
    
    .form-group input,
    .form-group select {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 38px;
    }
    
    .field-feedback {
        font-size: 10px;
        padding: 3px 6px;
        min-height: 16px;
        top: calc(100% + 2px);
        border-radius: 2px;
    }
    
    .start-game-btn {
        padding: 10px 16px;
        font-size: 12px;
        min-height: 42px;
        margin: 12px auto 6px auto;
        max-width: 100%;
    }
    
    /* Ajustar tamaño de typewriter en móviles pequeños */
    .typewriter-text {
        font-size: 1.8rem;
        line-height: 1.2;
    }
    
    .cursor {
        font-size: 1.8rem;
    }
}

/* Animación neon para el botón */
@keyframes neon-button-pulse {
    0%, 100% { 
        box-shadow: 
            0 0 20px rgba(0, 255, 255, 0.4),
            inset 0 0 20px rgba(0, 255, 255, 0.1);
        border-color: #00ffff;
    }
    50% { 
        box-shadow: 
            0 0 30px rgba(255, 0, 150, 0.6),
            inset 0 0 30px rgba(255, 0, 150, 0.2);
        border-color: #ff0096;
    }
}

.start-game-btn:hover {
    transform: translateY(-3px) scale(1.02);
    color: #ff0096;
    border-color: #ff0096;
    text-shadow: 0 0 15px rgba(255, 0, 150, 1);
    box-shadow: 
        0 0 40px rgba(255, 0, 150, 0.8),
        inset 0 0 30px rgba(255, 0, 150, 0.2);
    background: linear-gradient(135deg, 
        rgba(255, 0, 150, 0.3) 0%, 
        rgba(0, 255, 255, 0.2) 100%);
}

.start-game-btn span {
    position: relative;
    z-index: 2;
}

.btn-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 1px, transparent 1px);
    background-size: 10px 10px;
    animation: particle-float 3s linear infinite;
    opacity: 0;
    transition: opacity 0.3s;
}

.start-game-btn:hover .btn-particles {
    opacity: 1;
}

/* Botón deshabilitado */
.start-game-btn:disabled,
.start-game-btn.btn-disabled {
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.6), rgba(75, 85, 99, 0.6));
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
}

.start-game-btn:disabled:hover,
.start-game-btn.btn-disabled:hover {
    transform: none;
    box-shadow: var(--shadow-md);
}

.start-game-btn:disabled .btn-particles,
.start-game-btn.btn-disabled .btn-particles {
    opacity: 0;
}

@keyframes particle-float {
    0% { transform: translateY(0); }
    100% { transform: translateY(-100%); }
}

/* Animación optimizada para movimiento aleatorio de partículas */
@keyframes random-drift {
    0% { 
        background-position: 0% 0%, 15% 25%, 35% 60%, 65% 35%, 75% 70%, 25% 80%, 85% 15%, 45% 45%, 90% 85%, 5% 90%, 55% 10%, 95% 50%, 10% 40%; 
        opacity: 0.8;
    }
    20% { 
        background-position: 10% 5%, 25% 35%, 45% 70%, 75% 45%, 85% 80%, 35% 90%, 95% 25%, 55% 55%, 100% 95%, 15% 100%, 65% 20%, 105% 60%, 20% 50%; 
        opacity: 0.9;
    }
    40% { 
        background-position: 20% 10%, 35% 45%, 55% 80%, 85% 55%, 95% 90%, 45% 100%, 105% 35%, 65% 65%, 110% 105%, 25% 110%, 75% 30%, 115% 70%, 30% 60%; 
        opacity: 1;
    }
    60% { 
        background-position: 15% 15%, 30% 50%, 50% 75%, 80% 50%, 90% 85%, 40% 95%, 100% 30%, 60% 60%, 105% 100%, 20% 105%, 70% 25%, 110% 65%, 25% 55%; 
        opacity: 0.9;
    }
    80% { 
        background-position: 5% 10%, 20% 40%, 40% 65%, 70% 40%, 80% 75%, 30% 85%, 90% 20%, 50% 50%, 95% 90%, 10% 95%, 60% 15%, 100% 55%, 15% 45%; 
        opacity: 0.8;
    }
    100% { 
        background-position: 0% 0%, 15% 25%, 35% 60%, 65% 35%, 75% 70%, 25% 80%, 85% 15%, 45% 45%, 90% 85%, 5% 90%, 55% 10%, 95% 50%, 10% 40%; 
        opacity: 0.8;
    }
}

/* ===================================
   LAYOUT PRINCIPAL DEL JUEGO
   =================================== */
.game-container {
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    grid-template-rows: auto 1fr;
    grid-template-areas: 
        "player header header"
        "player board inventory";
    gap: var(--spacing-6);
    padding: var(--spacing-6);
    min-height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(20px);
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-container.show {
    opacity: 1;
    transform: translateY(0);
}

.game-container.hidden {
    display: none;
}

.game-main {
    display: contents;
}

/* ===================================
   PANEL DEL JUGADOR
   =================================== */
.player-panel {
    grid-area: player;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-6);
    box-shadow: 
        var(--shadow-lg),
        0 0 40px rgba(245, 158, 11, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-6);
    position: sticky;
    top: var(--spacing-6);
    height: fit-content;
}

.player-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-4);
    flex-wrap: wrap;
    padding-bottom: var(--spacing-4);
    border-bottom: 2px solid rgba(203, 213, 225, 0.3);
    position: relative;
    padding-right: 58px;
}

.player-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-4);
    min-width: 0;
}

.player-avatar {
    width: 72px;
    height: 72px;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.25), transparent 55%),
                linear-gradient(135deg, rgba(56, 189, 248, 0.95), rgba(67, 56, 202, 0.9));
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(15, 23, 42, 0.92);
    box-shadow: 0 10px 28px rgba(30, 64, 175, 0.35);
    border: 2px solid rgba(148, 163, 184, 0.35);
    animation: avatar-pulse 2.3s ease-in-out infinite alternate;
}

.player-avatar-icon {
    width: 48px;
    height: 48px;
    fill: currentColor;
    filter: drop-shadow(0 6px 12px rgba(14, 23, 42, 0.35));
    transition: transform 0.3s ease;
}

.player-avatar:hover .player-avatar-icon {
    transform: scale(1.05) translateY(-2px);
}

@keyframes avatar-pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

.player-details h3 {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-gray-900);
    margin: 0;
}

.player-level {
    font-size: var(--font-size-sm);
    color: var(--color-gray-600);
    background: rgba(59, 130, 246, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
}

.score-board {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-3);
    background: rgba(59, 130, 246, 0.05);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--color-primary);
}

.score-label {
    font-weight: 600;
    color: var(--color-gray-700);
}

.score-value {
    font-weight: 700;
    font-size: var(--font-size-lg);
    color: var(--color-primary);
    animation: score-update 0.3s ease-out;
}

@keyframes score-update {
    0% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.progress-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
}

.progress-label {
    font-weight: 600;
    color: var(--color-gray-700);
    font-size: var(--font-size-sm);
}

.progress-bar {
    height: 8px;
    background: rgba(203, 213, 225, 0.3);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-secondary), var(--color-primary));
    border-radius: 4px;
    width: 0%;
    transition: width 0.5s ease-out;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: progress-shine 2s ease-in-out infinite;
}

@keyframes progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    font-size: var(--font-size-sm);
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--color-secondary);
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.35), 0 0 18px rgba(236, 72, 153, 0.25);
    text-align: center;
}

.achievements {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
}

.achievements h3 {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--color-gray-900);
}

.achievements-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
    max-height: 200px;
    overflow-y: auto;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--spacing-2);
    background: rgba(16, 185, 129, 0.1);
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
    animation: achievement-appear 0.5s ease-out;
}

@keyframes achievement-appear {
    0% {
        opacity: 0;
        transform: translateX(-20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===================================
   HEADER DEL JUEGO
   =================================== */
.game-header {
    grid-area: header;
    text-align: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: var(--spacing-6);
    padding-right: calc(var(--spacing-6) + 4.5rem);
    border-radius: var(--border-radius-lg);
    box-shadow: 
        var(--shadow-lg),
        0 0 30px rgba(59, 130, 246, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    position: relative;
    overflow: hidden;
}

.game-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
    animation: shine 3s ease-in-out infinite;
}

@keyframes shine {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}

.game-header h1 {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    background: linear-gradient(
        135deg,
        rgba(15, 23, 42, 0.95) 0%,
        var(--color-primary) 50%,
        var(--color-secondary) 100%
    );
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: var(--spacing-2);
    position: relative;
    z-index: 1;
    text-shadow: 0 0 30px rgba(15, 23, 42, 0.35);
    transition: background 0.6s ease, text-shadow 0.6s ease, filter 0.6s ease;
}

.game-header p {
    font-size: var(--font-size-lg);
    color: var(--color-gray-700);
    position: relative;
    z-index: 1;
}

/* Control de Audio */
.audio-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    position: absolute;
    top: -12px;
    right: 0;
}

.audio-btn {
    width: 36px;
    height: 36px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    color: rgba(226, 232, 240, 0.85);
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.35);
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 24px rgba(8, 11, 24, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
    opacity: 0.85;
}

.audio-btn:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 14px 30px rgba(12, 18, 36, 0.4);
    background: rgba(37, 99, 235, 0.75);
    opacity: 1;
}

.audio-btn.muted {
    background: rgba(239, 68, 68, 0.68);
    border-color: rgba(248, 113, 113, 0.4);
    color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 12px 26px rgba(190, 18, 60, 0.32);
}

.audio-btn.muted:hover {
    background: rgba(248, 113, 113, 0.78);
}

/* ===================================
   TABLERO DE JUEGO
   =================================== */
.game-board {
    grid-area: board;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-6);
    box-shadow: 
        var(--shadow-lg),
        0 0 40px rgba(16, 185, 129, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    position: relative;
}

.game-board h2 {
    font-size: var(--font-size-2xl);
    color: var(--color-gray-900);
    margin-bottom: var(--spacing-6);
    text-align: center;
}

.webpage-template {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-4);
    min-height: 500px;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--spacing-4);
    flex: 1;
}

/* ===================================
   ZONAS DE DESTINO
   =================================== */
.drop-zone {
    border: 2px dashed rgba(148, 163, 184, 0.6);
    border-radius: var(--border-radius);
    padding: var(--spacing-6);
    text-align: center;
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.8) 0%, rgba(241, 245, 249, 0.6) 100%);
    backdrop-filter: blur(5px);
    transition: var(--transition);
    position: relative;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.drop-zone:hover {
    border-color: var(--color-primary);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(147, 197, 253, 0.05) 100%);
    box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.1),
        0 0 20px rgba(59, 130, 246, 0.2);
}

.drop-zone.drag-over {
    border-color: var(--color-secondary);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(34, 197, 94, 0.1) 100%);
    border-style: solid;
    transform: scale(1.02);
    box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.1),
        0 0 25px rgba(16, 185, 129, 0.3),
        0 5px 15px rgba(0, 0, 0, 0.1);
}

.zone-label {
    font-weight: 600;
    color: var(--color-gray-700);
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-2);
}

.drop-zone small {
    color: var(--color-gray-500);
    font-size: var(--font-size-sm);
}

/* Estilos para zonas ocupadas */
.drop-zone.occupied {
    background: var(--color-secondary);
    border-color: var(--color-secondary-dark);
    color: var(--color-white);
}

.drop-zone.occupied .zone-label,
.drop-zone.occupied small {
    color: var(--color-white);
}

/* ===================================
   INVENTARIO DE PIEZAS
   =================================== */
.pieces-inventory {
    grid-area: inventory;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-6);
    box-shadow: 
        var(--shadow-lg),
        0 0 40px rgba(139, 92, 246, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    position: relative;
}

.pieces-inventory h2 {
    font-size: var(--font-size-xl);
    color: var(--color-gray-900);
    margin-bottom: var(--spacing-2);
}

.pieces-inventory p {
    color: var(--color-gray-600);
    margin-bottom: var(--spacing-6);
    font-size: var(--font-size-sm);
}

.pieces-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
    margin-bottom: var(--spacing-6);
}

/* ===================================
   PIEZAS ARRASTRABLES
   =================================== */
.piece {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: var(--color-white);
    padding: var(--spacing-4);
    border-radius: var(--border-radius);
    cursor: grab;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    font-size: var(--font-size-base);
    text-align: center;
    box-shadow: 
        var(--shadow-md),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 20px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    user-select: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.piece::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.5s ease;
}

.piece:hover::before {
    left: 100%;
}

.piece:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 0 30px rgba(59, 130, 246, 0.3);
}

.piece:active {
    cursor: grabbing;
    transform: translateY(-1px) scale(0.98);
    box-shadow: 
        0 5px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.piece[draggable="false"] {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--color-gray-400);
    transform: none;
}

.piece[draggable="false"]:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

/* Colores galácticos suaves para cada tipo de etiqueta */
.piece[data-tag="header"] {
    background: linear-gradient(135deg, #b91c1c, #991b1b);
}

.piece[data-tag="nav"] {
    background: linear-gradient(135deg, #d4851f, #b45309);
}

.piece[data-tag="main"] {
    background: linear-gradient(135deg, #059669, #047857);
}

.piece[data-tag="article"] {
    background: linear-gradient(135deg, #4a90e2, #3b82f6);
}

.piece[data-tag="aside"] {
    background: linear-gradient(135deg, #6b46c1, #5b21b6);
}

.piece[data-tag="footer"] {
    background: linear-gradient(135deg, #6b7280, #4b5563);
}

/* ===================================
   JUEGOS PROGRESIVOS
   =================================== */

/* Contenedor de niveles */
.game-level {
    margin-bottom: var(--spacing-6);
    opacity: 1;
    transition: all 0.5s ease-in-out;
}

.game-level.hidden {
    display: none;
    opacity: 0;
}

.game-level.active {
    display: block;
    opacity: 1;
}

.level-header {
    text-align: center;
    margin-bottom: var(--spacing-6);
    padding: var(--spacing-4);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    backdrop-filter: blur(10px);
}

.level-header h2 {
    color: var(--color-primary);
    margin-bottom: var(--spacing-2);
    font-size: var(--font-size-2xl);
}

.level-header p {
    color: var(--color-gray-300);
    font-size: var(--font-size-lg);
}

/* ===================================
   JUEGO CSS - PREGUNTAS INTERACTIVAS
   =================================== */

/* ===================================
   CSS DESIGNER GAME - GAMIFICADO
   =================================== */

.css-timer {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    font-size: var(--font-size-lg);
    font-weight: bold;
    color: var(--color-primary);
    margin-top: var(--spacing-2);
}

.css-designer-workspace {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: var(--spacing-6);
    margin-top: var(--spacing-6);
    height: 70vh;
    overflow: hidden;
}

.css-control-panel {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-6);
    backdrop-filter: blur(10px);
    border: 2px solid var(--color-primary-alpha-30);
    overflow-y: auto;
    max-height: 100%;
}

.challenge-info {
    margin-bottom: var(--spacing-6);
}

.challenge-info h3 {
    color: var(--color-primary);
    margin-bottom: var(--spacing-2);
    font-size: var(--font-size-xl);
}

.challenge-info p {
    color: var(--color-gray-200);
    margin-bottom: var(--spacing-4);
}

.challenge-progress {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.css-toolkit h4 {
    color: var(--color-secondary);
    margin-bottom: var(--spacing-4);
    font-size: var(--font-size-lg);
}

.css-tools {
    display: grid;
    gap: var(--spacing-4);
}

.tool-category {
    border-bottom: 1px solid var(--color-gray-600);
    padding-bottom: var(--spacing-3);
}

.tool-category:last-child {
    border-bottom: none;
}

.tool-category label {
    display: block;
    color: var(--color-gray-300);
    font-weight: bold;
    margin-bottom: var(--spacing-2);
    font-size: var(--font-size-sm);
}

.tool-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--spacing-2);
}

.css-tool {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--color-gray-500);
    color: var(--color-white);
    padding: var(--spacing-2) var(--spacing-3);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.css-tool:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-alpha-20);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--color-primary-alpha-15);
}

.css-tool.used {
    animation: tool-pulse 0.3s ease;
    background: var(--color-secondary-alpha-25);
    border-color: var(--color-secondary);
}

.css-actions {
    display: flex;
    gap: var(--spacing-3);
    margin-top: var(--spacing-4);
}

.reset-element-btn, .hint-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--color-gray-500);
    color: var(--color-white);
    padding: var(--spacing-3);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: bold;
}

.reset-element-btn:hover {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.2);
}

.hint-btn:hover {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.2);
}

.css-preview-area {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    backdrop-filter: blur(10px);
    border: 2px solid var(--color-secondary-alpha-25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.preview-header {
    background: var(--color-secondary-alpha-15);
    padding: var(--spacing-4);
    border-bottom: 1px solid var(--color-gray-600);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-header h4 {
    color: var(--color-secondary);
    margin: 0;
}

.preview-controls {
    display: flex;
    gap: var(--spacing-2);
}

.preview-size {
    background: transparent;
    border: 1px solid var(--color-gray-500);
    color: var(--color-gray-300);
    padding: var(--spacing-2);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: var(--font-size-sm);
}

.preview-size:hover, .preview-size.active {
    border-color: var(--color-secondary);
    color: var(--color-secondary);
    background: var(--color-secondary-alpha-10);
}

.preview-container {
    flex: 1;
    padding: var(--spacing-6);
    overflow-y: auto;
    position: relative;
}

.preview-container.tablet {
    max-width: 768px;
    margin: 0 auto;
}

.preview-container.mobile {
    max-width: 375px;
    margin: 0 auto;
}

.css-challenge-preview {
    display: none;
    height: 100%;
    position: relative;
}

.css-challenge-preview.active {
    display: block;
}

.target-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--border-radius);
    padding: var(--spacing-6);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--color-gray-500);
    position: relative;
}

.target-element {
    background: var(--color-primary);
    color: white;
    padding: var(--spacing-4) var(--spacing-6);
    border-radius: var(--border-radius);
    font-weight: bold;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
}

/* Estilos específicos para cada desafío */
#challenge-3-preview .target-container {
    display: block;
    padding: var(--spacing-4);
}

#challenge-3-preview .grid-item {
    background: var(--color-secondary);
    color: white;
    padding: var(--spacing-3);
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: bold;
    margin: var(--spacing-2);
}

.success-indicator {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(34, 197, 94, 0.9);
    color: white;
    padding: var(--spacing-4) var(--spacing-6);
    border-radius: var(--border-radius-lg);
    font-weight: bold;
    font-size: var(--font-size-lg);
    z-index: 10;
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.4);
}

.success-indicator.animate-success {
    animation: success-bounce 0.6s ease;
}

.applied-styles-panel {
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--color-gray-600);
    padding: var(--spacing-4);
    max-height: 150px;
    overflow-y: auto;
}

.applied-styles-panel h5 {
    color: var(--color-gray-300);
    margin-bottom: var(--spacing-2);
    font-size: var(--font-size-sm);
}

.current-css {
    font-family: 'Courier New', monospace;
    font-size: var(--font-size-sm);
    color: var(--color-gray-200);
    white-space: pre-line;
    background: rgba(0, 0, 0, 0.5);
    padding: var(--spacing-3);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--color-primary);
}

.css-game-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-gray-800);
    padding: var(--spacing-4) var(--spacing-6);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    max-width: 300px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    border-left: 4px solid var(--color-primary);
}

.css-game-message.show {
    transform: translateX(0);
}

.css-game-message.success {
    border-left-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
    backdrop-filter: blur(10px);
}

.css-game-message.warning {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    backdrop-filter: blur(10px);
}

.css-game-message.info {
    border-left-color: var(--color-primary);
    background: var(--color-primary-alpha-15);
    color: var(--color-primary);
    backdrop-filter: blur(10px);
}

/* Animaciones */
@keyframes tool-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes success-bounce {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes achievement-glow {
    0% { box-shadow: 0 0 0 rgba(92, 179, 204, 0.4); }
    50% { box-shadow: 0 0 20px rgba(92, 179, 204, 0.6); }
    100% { box-shadow: 0 0 0 rgba(92, 179, 204, 0.4); }
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Responsive */
@media (max-width: 1024px) {
    .css-designer-workspace {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .css-control-panel {
        max-height: none;
        order: 2;
    }
    
    .css-preview-area {
        order: 1;
        height: 400px;
    }
}

@media (max-width: 768px) {
    .tool-buttons {
        grid-template-columns: 1fr;
    }
    
    .css-actions {
        flex-direction: column;
    }
}

.css-option:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.question-status {
    margin-top: var(--spacing-3);
    padding: var(--spacing-2);
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: bold;
}

.question-status.correct {
    background: rgba(34, 197, 94, 0.2);
    color: var(--color-secondary);
}

.question-status.wrong {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ===================================
   JUEGO JAVASCRIPT - COMPLETAR CÓDIGO
   =================================== */

.js-playground {
    display: grid;
    gap: var(--spacing-4);
    max-width: 100%;
}

.code-challenges {
    display: grid;
    gap: var(--spacing-6);
}

.challenge-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-6);
    backdrop-filter: blur(10px);
    border: 2px solid transparent;
    transition: var(--transition);
}

.challenge-card h3 {
    color: var(--color-primary);
    margin-bottom: var(--spacing-4);
    font-size: var(--font-size-xl);
}

.code-block {
    background: rgba(0, 0, 0, 0.4);
    border-radius: var(--border-radius);
    padding: var(--spacing-4);
    margin: var(--spacing-4) 0;
    border: 1px solid var(--color-gray-600);
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
    color: var(--color-gray-200);
    font-family: 'Courier New', monospace;
    font-size: var(--font-size-sm);
    line-height: 1.6;
    white-space: pre-wrap;
}

.code-input-container {
    display: inline-block;
    position: relative;
}

.code-input {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--color-primary);
    color: var(--color-white);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: var(--font-size-sm);
    min-width: 100px;
    text-align: center;
}

.code-input:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.code-input.correct {
    border-color: var(--color-secondary);
    background: rgba(34, 197, 94, 0.2);
}

.code-input.wrong {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.2);
    animation: shake 0.5s ease-in-out;
}

.challenge-status {
    margin-top: var(--spacing-3);
    padding: var(--spacing-2);
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: bold;
}

.challenge-status.correct {
    background: rgba(34, 197, 94, 0.2);
    color: var(--color-secondary);
}

.challenge-status.wrong {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Estilos para información del inventario */
.css-info, .js-info {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-4);
    backdrop-filter: blur(10px);
}

.css-info h3, .js-info h3 {
    color: var(--color-primary);
    margin-bottom: var(--spacing-2);
}

.mini-progress-bar {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    height: 8px;
    margin: var(--spacing-2) 0;
    overflow: hidden;
}

.mini-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: 10px;
    width: 0%;
    transition: width 0.5s ease;
}

.js-hints {
    margin-top: var(--spacing-4);
    padding: var(--spacing-3);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--color-secondary);
}

.js-hints h4 {
    color: var(--color-secondary);
    margin-bottom: var(--spacing-2);
    font-size: var(--font-size-base);
}

.js-hints ul {
    margin: 0;
    padding-left: var(--spacing-4);
}

.js-hints li {
    color: var(--color-gray-300);
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-1);
}

/* ===================================
   ESTADÍSTICAS DEL JUEGO
   =================================== */
.game-stats {
    background: var(--color-gray-50);
    border-radius: var(--border-radius);
    padding: var(--spacing-4);
    margin-bottom: var(--spacing-6);
}

.player-panel .game-stats {
    background: rgba(248, 250, 252, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 14px 32px rgba(148, 163, 184, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.player-panel .player-achievements {
    background: rgba(248, 250, 252, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-4);
    box-shadow: 0 10px 26px rgba(148, 163, 184, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.player-panel .player-achievements h3 {
    color: var(--color-gray-900);
    margin-bottom: var(--spacing-2);
}

.stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-2);
}

.stat:last-child {
    margin-bottom: 0;
}

.stat-label {
    font-weight: 600;
    color: var(--color-gray-700);
}

#correct-count {
    color: var(--color-secondary);
    font-weight: 700;
}

#attempts-count {
    color: var(--color-primary);
    font-weight: 700;
}

/* ===================================
   EFECTOS Y ANIMACIONES
   =================================== */
@keyframes success-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.success-animation {
    animation: success-pulse 0.6s ease-in-out;
}

.error-animation {
    animation: shake 0.5s ease-in-out;
}

/* Animaciones adicionales para el sistema de notificaciones */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes slideInDown {
    from {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutUp {
    from {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
    to {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }
}

@keyframes floatUp {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -150%) scale(0.8);
        opacity: 0;
    }
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */
@media (max-width: 1024px) {
    .game-container {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "header"
            "inventory"
            "board";
        padding: var(--spacing-4);
    }
    
    .pieces-inventory {
        order: -1;
    }
    
    .pieces-container {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-2);
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: var(--spacing-3);
        gap: var(--spacing-4);
    }
    
    .game-header h1 {
        font-size: var(--font-size-2xl);
    }
    
    .game-header p {
        font-size: var(--font-size-base);
    }
    
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .pieces-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .drop-zone {
        padding: var(--spacing-4);
        min-height: 60px;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: var(--spacing-2);
        gap: var(--spacing-3);
    }
    
    .game-header,
    .game-board,
    .pieces-inventory {
        padding: var(--spacing-4);
    }
    
    .pieces-container {
        grid-template-columns: 1fr;
    }
    
    .piece {
        padding: var(--spacing-3);
        font-size: var(--font-size-sm);
    }
}

/* ===================================
   MODO ALTO CONTRASTE
   =================================== */
@media (prefers-contrast: high) {
    .drop-zone {
        border-width: 3px;
    }
    
    .piece {
        border: 2px solid var(--color-gray-900);
    }
}

/* ===================================
   REDUCCIÓN DE MOVIMIENTO
   =================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .piece:hover {
        transform: none;
    }
}

/* ===================================
   MODAL BIG BANG Y PUBLICIDAD
   =================================== */

.big-bang-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transform: scale(1.05);
    transition: opacity 0.6s ease, transform 0.6s ease;
    background: radial-gradient(ellipse at center, 
        rgba(30, 20, 60, 0.82) 0%,
        rgba(36, 24, 66, 0.86) 25%,
        rgba(12, 20, 40, 0.92) 65%,
        rgba(4, 8, 20, 0.96) 100%);
    backdrop-filter: blur(16px) saturate(150%);
}

.big-bang-modal.is-active {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
    animation: big-bang-modal-appear 1.8s ease forwards;
}

.big-bang-modal.closing {
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}

@keyframes big-bang-modal-appear {
    0% { 
        opacity: 0; 
        transform: scale(1.08);
        filter: brightness(0.6) hue-rotate(0deg) saturate(0.7);
    }
    50% {
        opacity: 1;
        transform: scale(0.98);
        filter: brightness(1.2) hue-rotate(180deg) saturate(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
        filter: brightness(1) hue-rotate(360deg) saturate(1);
    }
}

.big-bang-content {
    background: linear-gradient(135deg, 
        rgba(20, 15, 40, 0.95) 0%,
        rgba(35, 20, 60, 0.9) 50%,
        rgba(25, 35, 70, 0.92) 100%);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-8);
    text-align: center;
    max-width: 600px;
    border: 2px solid rgba(100, 200, 255, 0.6);
    box-shadow: 
        0 0 30px rgba(100, 200, 255, 0.3),
        inset 0 0 20px rgba(150, 100, 255, 0.2);
    animation: content-pulse 3s ease-in-out infinite;
    opacity: 0;
    transform: translateY(40px) scale(0.95);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.big-bang-modal.is-active .big-bang-content {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition-delay: 0.2s;
}

@keyframes content-pulse {
    0% { 
        box-shadow: 
            0 0 20px rgba(100, 200, 255, 0.3),
            inset 0 0 15px rgba(150, 100, 255, 0.2);
    }
    50% { 
        box-shadow: 
            0 0 35px rgba(100, 200, 255, 0.4), 
            0 0 45px rgba(150, 100, 255, 0.3),
            inset 0 0 25px rgba(200, 150, 255, 0.25);
    }
    100% { 
        box-shadow: 
            0 0 20px rgba(100, 200, 255, 0.3),
            inset 0 0 15px rgba(150, 100, 255, 0.2);
    }
}

.big-bang-modal.closing .big-bang-content {
    opacity: 0;
    transform: translateY(30px) scale(0.96);
    transition-delay: 0s;
}

/* ===================================
   NOTIFICACIÓN GAMIFICADA DE MISIONES
   =================================== */

.mission-celebration {
    position: fixed;
    top: 7vh;
    right: clamp(1.5rem, 2.5vw, 3rem);
    display: flex;
    gap: var(--spacing-4);
    padding: var(--spacing-4) var(--spacing-6);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 22px 55px rgba(6, 12, 28, 0.55);
    background: rgba(8, 14, 32, 0.88);
    color: var(--color-white);
    transform: translateX(120%);
    opacity: 0;
    pointer-events: none;
    z-index: 950;
    backdrop-filter: blur(20px) saturate(145%);
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.4s ease;
}

.mission-celebration.show {
    transform: translateX(0);
    opacity: 1;
}

.mission-celebration.hide {
    transform: translateX(120%);
    opacity: 0;
}

.mission-celebration::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.25), transparent 60%);
    opacity: 0.35;
    pointer-events: none;
    filter: blur(12px);
    z-index: -1;
}

.mission-celebration .celebration-icon {
    font-size: clamp(2.2rem, 3vw, 2.8rem);
    display: grid;
    place-items: center;
    text-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    animation: celebration-bounce 1.6s ease-in-out infinite;
}

.mission-celebration .celebration-info {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.mission-celebration h4 {
    font-size: clamp(1.2rem, 1.6vw, 1.4rem);
    font-weight: 800;
    letter-spacing: 0.05em;
}

.mission-celebration p {
    font-size: clamp(0.9rem, 1.1vw, 1rem);
    color: rgba(226, 232, 240, 0.85);
}

.mission-celebration .celebration-reward {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.mission-celebration.mission-html {
    background: linear-gradient(135deg, rgba(241, 101, 41, 0.92) 0%, rgba(255, 154, 90, 0.85) 45%, rgba(8, 14, 32, 0.88) 100%);
}

.mission-celebration.mission-html .celebration-reward {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(32, 21, 14, 0.9);
}

.mission-celebration.mission-css {
    background: linear-gradient(140deg, rgba(41, 101, 241, 0.92) 0%, rgba(110, 197, 255, 0.8) 45%, rgba(8, 14, 32, 0.88) 100%);
}

.mission-celebration.mission-css .celebration-reward {
    background: rgba(255, 255, 255, 0.18);
    color: rgba(16, 38, 75, 0.95);
}

.mission-celebration.mission-js {
    background: linear-gradient(135deg, rgba(247, 223, 30, 0.9) 0%, rgba(255, 255, 255, 0.75) 45%, rgba(8, 14, 32, 0.9) 100%);
    color: rgba(20, 20, 20, 0.95);
}

.mission-celebration.mission-js .celebration-reward {
    background: rgba(32, 32, 32, 0.12);
    color: rgba(32, 32, 32, 0.85);
}

@keyframes celebration-bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    45% { transform: translateY(-6px) scale(1.05); }
    65% { transform: translateY(2px) scale(0.98); }
}

.trophy-icon {
    font-size: 8rem;
    margin-bottom: var(--spacing-4);
    animation: trophy-bounce 1s ease-in-out infinite alternate;
}

@keyframes trophy-bounce {
    0% { transform: translateY(0px) scale(1); }
    100% { transform: translateY(-20px) scale(1.1); }
}

.big-bang-title {
    font-size: var(--font-size-3xl);
    color: var(--color-primary);
    margin-bottom: var(--spacing-4);
    text-shadow: 0 0 20px currentColor;
}

.completion-message {
    font-size: var(--font-size-xl);
    color: var(--color-white);
    margin-bottom: var(--spacing-6);
}

.developer-credit {
    background: linear-gradient(45deg, 
        rgba(80, 150, 200, 0.8) 0%,
        rgba(120, 80, 180, 0.8) 50%,
        rgba(60, 180, 120, 0.8) 100%);
    border-radius: var(--border-radius);
    padding: var(--spacing-4);
    margin-top: var(--spacing-4);
    border: 1px solid rgba(150, 200, 255, 0.4);
    box-shadow: 0 0 15px rgba(100, 150, 255, 0.2);
}

.developer-name {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-white);
    margin-bottom: var(--spacing-3);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: var(--spacing-4);
}

.social-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--spacing-2) var(--spacing-3);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    color: var(--color-white);
    text-decoration: none;
    transition: var(--transition);
    font-size: var(--font-size-sm);
}

.social-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.social-icon {
    font-size: var(--font-size-lg);
}

.hidden {
    display: none !important;
}

/* ===================================
   REDISEÑO VISUAL DE NIVELES 2025
   =================================== */

.game-container {
    background: linear-gradient(140deg, rgba(8, 14, 32, 0.85) 0%, rgba(9, 20, 44, 0.88) 45%, rgba(6, 12, 28, 0.92) 100%);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 35px 80px rgba(4, 10, 30, 0.55);
    padding: clamp(1.5rem, 2vw, 3rem);
    gap: clamp(1.5rem, 2.5vw, 3rem);
    position: relative;
    overflow: hidden;
}

.game-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.08), transparent 45%),
                radial-gradient(circle at bottom left, rgba(255, 255, 255, 0.05), transparent 40%);
    pointer-events: none;
    mix-blend-mode: screen;
}

.game-main {
    position: relative;
    z-index: 1;
}

.game-header {
    grid-area: header;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: var(--spacing-6);
    backdrop-filter: blur(20px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-4);
    position: relative;
}

.game-header h1 {
    font-size: clamp(1.8rem, 2.4vw, 2.4rem);
    color: var(--color-white);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.game-header p {
    max-width: 560px;
    color: rgba(226, 232, 240, 0.85);
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
}

.player-panel {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.02) 90%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 6px solid var(--color-primary);
    color: var(--color-white);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.player-details h3,
.score-label,
.progress-label,
.achievements h3 {
    color: rgba(241, 245, 249, 0.95);
}

.score-board .score-item {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.score-value {
    color: var(--color-white);
}

.progress-bar {
    background: rgba(255, 255, 255, 0.08);
}

.progress-fill {
    background: linear-gradient(90deg, var(--color-secondary), var(--color-primary));
}

.pieces-inventory {
    background: linear-gradient(150deg, rgba(18, 23, 45, 0.9) 0%, rgba(10, 12, 28, 0.96) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 24px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
    color: rgba(226, 232, 240, 0.9);
}

.pieces-inventory h2 {
    color: var(--color-white);
    font-size: clamp(1.25rem, 2vw, 1.6rem);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.pieces-container.active {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: clamp(0.75rem, 1.5vw, 1.2rem);
}

.piece {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    color: var(--color-white);
    font-weight: 700;
    letter-spacing: 0.03em;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border 0.25s ease;
}

.piece:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 30px rgba(17, 24, 39, 0.4);
    border-color: var(--color-primary);
}

/* ------------ NIVEL HTML ------------- */
#html-game {
    --level-primary: var(--html-primary);
    --level-secondary: var(--html-secondary);
    background: linear-gradient(150deg, rgba(241, 101, 41, 0.15) 0%, rgba(40, 16, 6, 0.75) 60%),
                linear-gradient(25deg, rgba(15, 6, 3, 0.85) 0%, rgba(28, 14, 8, 0.9) 100%);
    border: 1px solid rgba(241, 101, 41, 0.25);
    border-radius: 26px;
    box-shadow: 0 32px 70px rgba(241, 101, 41, 0.25);
    padding: clamp(1.5rem, 2.5vw, 3rem);
}

#html-game .level-header h2 {
    color: rgba(255, 245, 238, 0.95);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

#html-game .level-header p {
    color: rgba(255, 235, 220, 0.85);
    max-width: 640px;
}

#html-game .webpage-template {
    display: grid;
    gap: clamp(1rem, 2vw, 1.8rem);
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    grid-template-areas:
        "header header nav nav"
        "main main main aside"
        "article article article aside"
        "footer footer footer footer";
    align-items: stretch;
}

#html-game #drop-header { grid-area: header; }
#html-game #drop-nav { grid-area: nav; }
#html-game #drop-main { grid-area: main; }
#html-game #drop-article { grid-area: article; }
#html-game #drop-aside { grid-area: aside; }
#html-game #drop-footer { grid-area: footer; }

#html-game .content-wrapper {
    display: contents;
}

#html-game .drop-zone {
    background: rgba(22, 12, 8, 0.9);
    border: 1px solid rgba(241, 101, 41, 0.35);
    border-radius: 22px;
    padding: clamp(1.4rem, 2vw, 1.8rem);
    align-items: flex-start;
    text-align: left;
    min-height: 140px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 14px 30px rgba(241, 101, 41, 0.2);
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border 0.25s ease, background 0.25s ease;
}

#html-game .drop-zone::before {
    content: attr(data-label-icon);
}

#html-game #drop-header::before { content: '🚀'; }
#html-game #drop-nav::before { content: '🧭'; }
#html-game #drop-main::before { content: '🌐'; }
#html-game #drop-article::before { content: '📜'; }
#html-game #drop-aside::before { content: '📡'; }
#html-game #drop-footer::before { content: '🛬'; }

#html-game .drop-zone::before {
    font-size: 1.8rem;
    position: absolute;
    top: 18px;
    right: 18px;
    opacity: 0.9;
}

#html-game .drop-zone:hover,
#html-game .drop-zone.drag-over {
    border-color: rgba(241, 101, 41, 0.65);
    background: rgba(34, 18, 10, 0.95);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(241, 101, 41, 0.25);
}

#html-game .zone-label {
    color: rgba(255, 226, 210, 0.95);
    font-size: 1.1rem;
    letter-spacing: 0.05em;
}

#html-game .drop-zone small {
    color: rgba(255, 226, 210, 0.72);
    line-height: 1.6;
}

#html-game .drop-zone.occupied {
    background: linear-gradient(135deg, rgba(241, 101, 41, 0.85), rgba(255, 154, 90, 0.75));
    border-color: rgba(241, 101, 41, 0.9);
    box-shadow: 0 24px 45px rgba(241, 101, 41, 0.35);
}

#html-game .drop-zone.occupied .zone-label,
#html-game .drop-zone.occupied small {
    color: rgba(34, 10, 6, 0.92);
}

/* ------------ NIVEL CSS ------------- */
#css-game {
    --level-primary: var(--css-primary);
    --level-secondary: var(--css-secondary);
    background: linear-gradient(150deg, rgba(41, 101, 241, 0.16) 0%, rgba(6, 18, 52, 0.92) 80%);
    border: 1px solid rgba(41, 101, 241, 0.25);
    border-radius: 26px;
    box-shadow: 0 28px 70px rgba(41, 101, 241, 0.2);
    padding: clamp(1.5rem, 2.5vw, 3rem);
}

#css-game .level-header h2 {
    color: rgba(226, 240, 255, 0.95);
    letter-spacing: 0.1em;
}

#css-game .level-header p {
    color: rgba(200, 224, 255, 0.8);
}

#css-game .css-designer-workspace {
    display: grid;
    grid-template-columns: minmax(380px, 480px) minmax(260px, 0.8fr);
    gap: clamp(1.4rem, 2.3vw, 2.6rem);
    align-items: stretch;
    min-height: 100%;
    height: auto;
    overflow: visible;
    align-content: flex-start;
}

#css-game .css-control-panel {
    background: linear-gradient(180deg, rgba(8, 22, 66, 0.94) 0%, rgba(5, 15, 46, 0.94) 100%);
    border: 1px solid rgba(41, 101, 241, 0.42);
    border-radius: 22px;
    padding: clamp(1.4rem, 2.2vw, 2.3rem);
    box-shadow: 0 24px 60px rgba(6, 18, 60, 0.55);
    display: flex;
    flex-direction: column;
    gap: clamp(1.1rem, 1.8vw, 1.9rem);
    overflow: visible;
    position: relative;
    isolation: isolate;
    width: 100%;
    max-width: 100%;
}

#css-game .css-control-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at 20% 15%, rgba(110, 197, 255, 0.18), transparent 55%),
                radial-gradient(circle at 85% 25%, rgba(41, 101, 241, 0.22), transparent 60%),
                linear-gradient(140deg, rgba(7, 26, 82, 0.35), rgba(4, 12, 42, 0.7));
    pointer-events: none;
    z-index: 0;
}

#css-game .challenge-info h3 {
    color: rgba(173, 209, 255, 0.95);
    font-size: 1.2rem;
}

#css-game .challenge-info p,
#css-game .css-info p {
    color: rgba(181, 212, 255, 0.78);
    line-height: 1.5;
}

#css-game .css-toolkit {
    display: flex;
    flex-direction: column;
    gap: clamp(1.2rem, 1.9vw, 2rem);
    position: relative;
    z-index: 1;
    width: 100%;
}

#css-game .css-tools {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    width: 100%;
}

#css-game .tool-category {
    background: linear-gradient(155deg, rgba(16, 42, 92, 0.75), rgba(7, 20, 54, 0.9));
    border: 1px solid rgba(110, 197, 255, 0.25);
    border-radius: 18px;
    padding: clamp(1rem, 1.6vw, 1.7rem);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    gap: 0.9rem;
    opacity: 0;
    transform: translateY(18px) scale(0.97);
    pointer-events: none;
    display: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
    width: 100%;
    box-sizing: border-box;
}

#css-game .tool-category label {
    color: rgba(212, 233, 255, 0.92);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.85rem;
}

#css-game .tool-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    width: 100%;
    align-items: stretch;
}

#css-game .tool-category.is-active {
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

#css-game .tool-category.is-complete {
    opacity: 0;
    transform: translateY(-14px) scale(0.95);
    pointer-events: none;
}

#css-game .css-tool {
    background: linear-gradient(135deg, rgba(28, 74, 160, 0.6) 0%, rgba(74, 149, 255, 0.4) 100%);
    border: 1px solid rgba(173, 209, 255, 0.35);
    border-radius: 16px;
    color: rgba(234, 245, 255, 0.95);
    font-weight: 600;
    padding: 1rem 1.2rem;
    transition: transform 0.2s ease, box-shadow 0.25s ease, border 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    line-height: 1.35;
    min-height: 64px;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.04em;
    position: relative;
    overflow: hidden;
    flex: 1 1 calc(50% - 0.85rem);
    max-width: calc(50% - 0.85rem);
    min-width: 140px;
}

#css-game .css-tool:hover,
#css-game .css-tool:focus-visible {
    transform: translateY(-3px) scale(1.01);
    border-color: rgba(214, 234, 255, 0.85);
    box-shadow: 0 18px 34px rgba(41, 101, 241, 0.32);
}

#css-game .css-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-top: 1.4rem;
}

#css-game .css-tool::after {
    content: '';
    position: absolute;
    inset: -140% -20% 60% -40%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 65%);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

#css-game .css-tool:hover::after,
#css-game .css-tool:focus-visible::after {
    opacity: 1;
    transform: translateY(-10%);
}

#css-game .css-actions button {
    flex: 1 1 180px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(173, 209, 255, 0.4);
    border-radius: 12px;
    color: rgba(226, 240, 255, 0.92);
    font-weight: 600;
    letter-spacing: 0.05em;
    transition: transform 0.25s ease;
    padding: 0.85rem 1.1rem;
}

#css-game .css-actions button:hover {
    transform: translateY(-3px);
}

#css-game .css-preview-area {
    background: linear-gradient(180deg, rgba(5, 10, 32, 0.9) 0%, rgba(3, 7, 25, 0.94) 100%);
    border: 1px solid rgba(41, 101, 241, 0.28);
    border-radius: 22px;
    padding: clamp(1.2rem, 2vw, 2rem);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 1.6vw, 1.8rem);
    max-width: clamp(280px, 52vw, 520px);
    width: min(100%, 480px);
    align-self: flex-start;
    justify-self: center;
}

#css-game .preview-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

#css-game .preview-header h4 {
    color: rgba(226, 240, 255, 0.88);
    letter-spacing: 0.08em;
}

#css-game .preview-controls {
    display: flex;
    gap: 0.5rem;
}

#css-game .preview-size {
    background: rgba(41, 101, 241, 0.18);
    border: 1px solid rgba(110, 197, 255, 0.45);
    border-radius: 12px;
    color: rgba(226, 240, 255, 0.92);
    padding: 0.45rem 0.85rem;
    font-weight: 600;
    transition: transform 0.2s ease, border 0.2s ease;
}

#css-game .preview-size:hover,
#css-game .preview-size.active {
    border-color: rgba(173, 209, 255, 0.85);
    transform: translateY(-2px);
}

#css-game .preview-container {
    background: linear-gradient(135deg, rgba(10, 20, 50, 0.8), rgba(10, 26, 68, 0.9));
    border-radius: 18px;
    border: 1px dashed rgba(110, 197, 255, 0.25);
    padding: clamp(1rem, 1.8vw, 1.5rem);
    min-height: clamp(240px, 35vh, 300px);
    margin-inline: auto;
    width: min(100%, 460px);
}

#css-game .target-container {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    border: 1px solid rgba(110, 197, 255, 0.25);
}

#css-game .target-element,
#css-game .grid-item {
    background: rgba(41, 101, 241, 0.12);
    border-radius: 12px;
    border: 1px solid rgba(110, 197, 255, 0.18);
    color: rgba(226, 240, 255, 0.9);
}

/* ------------ NIVEL JAVASCRIPT ------------- */
#js-game {
    --level-primary: var(--js-primary);
    --level-secondary: var(--js-secondary);
    background: linear-gradient(160deg, rgba(247, 223, 30, 0.18) 0%, rgba(14, 14, 16, 0.92) 75%);
    border: 1px solid rgba(247, 223, 30, 0.28);
    border-radius: 26px;
    box-shadow: 0 28px 70px rgba(247, 223, 30, 0.22);
    padding: clamp(1.5rem, 2.5vw, 3rem);
}

#js-game .level-header h2 {
    color: rgba(255, 248, 200, 0.95);
    letter-spacing: 0.1em;
}

#js-game .level-header p {
    color: rgba(255, 248, 200, 0.75);
}

#js-game .js-playground {
    background: linear-gradient(185deg, rgba(12, 12, 18, 0.92) 0%, rgba(6, 6, 10, 0.96) 100%);
    border: 1px solid rgba(247, 223, 30, 0.22);
    border-radius: 24px;
    padding: clamp(1.4rem, 2.2vw, 2.4rem);
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.45);
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1rem, 1.8vw, 2rem);
    width: min(100%, 720px);
    margin: 0 auto;
}

#js-game .js-playground::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at top left, rgba(247, 223, 30, 0.18), transparent 55%),
                radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.1), transparent 60%);
    pointer-events: none;
    mix-blend-mode: screen;
    opacity: 0.9;
}

#js-game .code-challenges {
    display: flex;
    flex-direction: column;
    gap: clamp(1.1rem, 1.8vw, 2rem);
    position: relative;
    z-index: 1;
    width: 100%;
}

#js-game .challenge-card {
    background: linear-gradient(180deg, rgba(15, 15, 18, 0.92) 0%, rgba(9, 9, 12, 0.95) 100%);
    border: 1px solid rgba(247, 223, 30, 0.28);
    border-radius: 22px;
    padding: clamp(1.2rem, 2vw, 2rem);
    position: relative;
    overflow: hidden;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
    display: none;
    opacity: 0;
    transform: translateY(18px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}

#js-game .challenge-card::after {
    content: '';
    position: absolute;
    inset: -40% -20% auto auto;
    background: radial-gradient(circle, rgba(247, 223, 30, 0.25), transparent 60%);
    transform: rotate(25deg);
    pointer-events: none;
}

#js-game .challenge-card h3 {
    color: rgba(255, 248, 200, 0.92);
    font-size: 1.15rem;
}

#js-game .challenge-card.is-active {
    display: flex;
    flex-direction: column;
    gap: clamp(0.9rem, 1.4vw, 1.6rem);
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

#js-game .challenge-card.is-complete {
    border-color: rgba(151, 227, 110, 0.5);
    box-shadow: 0 22px 48px rgba(151, 227, 110, 0.12);
}

#js-game .code-block {
    background: rgba(12, 12, 16, 0.9);
    border: 1px solid rgba(247, 223, 30, 0.32);
    border-radius: 16px;
    padding: 1.1rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    overflow-x: auto;
    transition: border 0.3s ease, box-shadow 0.3s ease;
}

#js-game .code-block pre {
    color: rgba(255, 254, 238, 0.9);
    text-shadow: 0 0 6px rgba(247, 223, 30, 0.15);
    white-space: pre-wrap;
}

#js-game .code-input {
    background: rgba(247, 223, 30, 0.16);
    border: 1px solid rgba(247, 223, 30, 0.5);
    border-radius: 10px;
    color: rgba(247, 223, 30, 0.95);
    font-weight: 700;
    min-width: 110px;
    transition: transform 0.2s ease, box-shadow 0.25s ease;
    max-width: 100%;
}

#js-game .code-input::placeholder {
    color: rgba(247, 223, 30, 0.55);
}

#js-game .code-input:focus {
    box-shadow: 0 0 0 2px rgba(247, 223, 30, 0.45), 0 10px 24px rgba(247, 223, 30, 0.25);
    transform: translateY(-2px);
}

#js-game .code-input.correct {
    background: rgba(151, 227, 110, 0.2);
    border-color: rgba(151, 227, 110, 0.7);
}

#js-game .code-input.wrong {
    background: rgba(255, 107, 107, 0.18);
    border-color: rgba(255, 107, 107, 0.6);
}

#js-game .challenge-status {
    background: rgba(247, 223, 30, 0.18);
    border-radius: 12px;
    color: rgba(247, 223, 30, 0.92);
    padding: 0.55rem 0.8rem;
    letter-spacing: 0.05em;
    align-self: flex-start;
    margin-top: 0.4rem;
}

#js-game .challenge-status.correct {
    background: rgba(151, 227, 110, 0.2);
    color: rgba(18, 84, 21, 0.9);
}

#js-game .challenge-status.wrong {
    background: rgba(255, 107, 107, 0.2);
    color: rgba(99, 7, 7, 0.85);
}

@media (max-width: 640px) {
    #js-game .js-playground {
        width: 100%;
        padding: clamp(1.2rem, 4vw, 2rem);
    }

    #js-game .challenge-card {
        max-width: 100%;
    }
}

#js-game .js-info,
#css-game .css-info {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    padding: 1.4rem;
    color: rgba(226, 232, 240, 0.9);
}

#js-game .js-info h3,
#css-game .css-info h3 {
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.08em;
}

#js-game .js-hints ul li {
    color: rgba(255, 248, 200, 0.78);
}

/* ------------ RESPONSIVE ------------- */
@media (max-width: 1200px) {
    #html-game .webpage-template {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        grid-template-areas:
            "header header"
            "nav nav"
            "main main"
            "article aside"
            "footer footer";
    }
}

@media (max-width: 1024px) {
    .game-container {
        border-radius: 20px;
    }

    #css-game .css-designer-workspace {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .game-header {
        padding: var(--spacing-4);
    }

    #html-game,
    #css-game,
    #js-game {
        padding: 1.4rem;
    }

    #html-game .drop-zone {
        min-height: 120px;
    }
}

@media (max-width: 480px) {
    .pieces-container.active {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }

    #js-game .code-challenges {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   PREVENCIÓN DE SCROLL HORIZONTAL
   =================================== */
/* Regla global para prevenir scroll horizontal - EXCLUIR formulario */
*:not(.welcome-container) {
    max-width: 100vw;
    box-sizing: border-box;
}

/* Asegurar que html y body no tengan scroll horizontal */
html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
}

/* Contenedores principales sin scroll */
.welcome-screen,
.game-container {
    max-width: 100vw !important;
    overflow: hidden !important;
}

/* Mantener el tamaño compacto del formulario - NO sobreescribir */
.welcome-container {
    overflow: hidden !important;
    /* max-width mantenido en 500px sin !important para preservar el diseño compacto */
}

@media (max-width: 520px) {
    #css-game .css-tool {
        flex: 1 1 100%;
        max-width: 100%;
        min-width: 0;
    }
}