/* Custom Properties & Animations */
:root {
    --color-blue: #2563EB;
    --color-green: #16A34A;
    --color-orange: #EA580C;
    --color-yellow: #FACC15;
}

/* Base Styles */
html {
    scroll-behavior: smooth;
}

/* Background Patterns using Generated Images */
.bg-pattern-park {
    background-image: url('https://r2.flowith.net/files/jpeg/9HQFW-cartoon_park_playground_background_index_12@1024x1024.jpeg');
    background-size: cover;
    background-position: center;
}

.bg-pattern-class {
    background-image: url('https://r2.flowith.net/files/jpeg/8S2RV-educational_platform_background_index_11@1024x1024.jpeg');
    background-size: cover;
    background-position: center;
}

/* ===== ESTILOS CRÍTICOS PARA PREGUNTA Y RESPUESTAS ===== */

/* Contenedor principal de la tarjeta de pregunta */
#question-card {
    display: flex !important;
    flex-direction: column !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Wrapper para el texto de la pregunta SIN LÍMITE DE ALTURA */
.question-text-wrapper {
    flex: 0 1 auto !important;
    max-height: none !important;
    overflow: visible !important;
    overflow-x: hidden !important;
    padding-right: 0 !important;
    margin-bottom: 1.5rem !important;
    position: relative !important;
}

/* Texto de la pregunta */
#question-text {
    margin-bottom: 0 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* Asegurar que las opciones siempre sean visibles */
.options-container {
    flex: 0 0 auto !important;
    margin-top: 0 !important;
}

/* Botones de opciones optimizados */
#options-grid button {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* ===== FIN ESTILOS CRÍTICOS ===== */

/* Custom UI Elements */
.nav-btn {
    @apply px-4 py-2 rounded-xl font-bold border-b-4 border-black active:border-0 active:translate-y-1 transition-all flex items-center;
}

.hero-btn {
    @apply shadow-[4px_4px_0px_0px_rgba(0,0,0,1)];
}

.hero-btn:active {
    @apply shadow-none;
}

.badge {
    @apply px-2 py-1 rounded-md text-xs font-bold uppercase tracking-wide;
}

/* ===== ANIMACIONES DE PERSONAJES ===== */

@keyframes float {
    0%, 100% { 
        transform: translateY(0) rotate(0deg); 
    }
    50% { 
        transform: translateY(-10px) rotate(2deg); 
    }
}

.avatar-float {
    animation: float 4s ease-in-out infinite;
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

@keyframes bounce-slow {
    0%, 100% { 
        transform: translateY(0) scale(1); 
    }
    50% { 
        transform: translateY(-20px) scale(1.05); 
    }
}

.animate-bounce-slow {
    animation: bounce-slow 3s infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

.animate-wiggle {
    animation: wiggle 0.5s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(37, 99, 235, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 20px rgba(37, 99, 235, 0.6);
        transform: scale(1.02);
    }
}

.animate-pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* ===== ANIMACIONES DE ENTRADA ===== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-in-left {
    animation: slideInLeft 0.6s ease-out forwards;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-zoom-in {
    animation: zoomIn 0.5s ease-out forwards;
}

/* ===== SCROLLBAR CUSTOMIZATION ===== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #cbd5e1, #94a3b8);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #94a3b8, #64748b);
    background-clip: content-box;
}

/* ===== MEDIA QUERIES RESPONSIVOS ===== */

@media (max-width: 768px) {
    /* Reducir animaciones en móvil para performance */
    .avatar-float,
    .animate-float,
    .animate-bounce-slow {
        animation-duration: 6s;
    }

    /* Ajustes específicos para el contenedor de juego */
    #game-ui {
        padding: 0.75rem !important;
        justify-content: flex-start !important;
        padding-top: 1.5rem !important;
    }

    /* Ajustes para la tarjeta de pregunta en móvil */
    #question-card {
        padding: 1rem !important;
        max-height: none !important;
    }

    /* Pregunta sin límite de altura */
    .question-text-wrapper {
        max-height: none !important;
        margin-bottom: 1rem !important;
    }

    /* Texto más pequeño pero legible */
    #question-text {
        font-size: 1rem !important;
        line-height: 1.4 !important;
    }

    /* Opciones más compactas */
    #options-grid {
        gap: 0.5rem !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    #options-grid button {
        padding: 0.75rem !important;
        font-size: 0.875rem !important;
        min-height: 48px !important;
    }

    /* Ocultar lista de jugadores en móvil */
    #players-aside {
        display: none !important;
    }

    /* Header más compacto */
    header {
        padding: 0.75rem 1rem !important;
    }

    /* Puntajes más compactos */
    .flex.justify-between.items-end {
        margin-bottom: 0.75rem !important;
    }

    /* Resultados finales en móvil */
    #finished-overlay .bg-white\/10 {
        padding: 1.5rem !important;
    }
}

/* Tablets y pantallas medianas */
@media (min-width: 769px) and (max-width: 1024px) {
    #question-card {
        max-height: none !important;
    }

    .question-text-wrapper {
        max-height: none !important;
    }

    #question-text {
        font-size: 1.125rem !important;
    }
}

/* Pantallas grandes */
@media (min-width: 1025px) {
    #question-card {
        padding: 2rem !important;
    }

    .question-text-wrapper {
        max-height: none !important;
    }

    #question-text {
        font-size: 1.5rem !important;
    }

    #options-grid button {
        font-size: 1rem !important;
        padding: 1.25rem !important;
    }
}

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

/* Estados de interacción mejorados */
#options-grid button:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

#options-grid button:active:not(:disabled) {
    transform: scale(0.98);
}

#options-grid button:disabled {
    cursor: not-allowed;
    opacity: 0.8;
}