/* Estilos generales */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 400% 400%;
    color: #333;
    margin: 0;
    padding: 10px;
    min-height: 100vh;
    animation: gradientShift 8s ease infinite;
    position: relative;
    overflow-x: hidden;
    font-size: 18px;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 300% 300%;
    color: white;
    padding: 15px;
    text-align: center;
    width: 100%;
    border-radius: 10px;
    box-shadow: 
        0 10px 20px rgba(102, 126, 234, 0.3),
        0 0 30px rgba(118, 75, 162, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    margin-bottom: 15px;
    position: relative;
    overflow: hidden;
    animation: gradientShift 4s ease infinite;
    z-index: 10;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
    pointer-events: none;
}

header h1 {
    font-size: 2.8em;
    font-weight: 900;
    text-shadow: 
        3px 3px 6px rgba(0, 0, 0, 0.8),
        0 0 15px rgba(0, 0, 0, 0.8),
        1px 1px 2px rgba(0, 0, 0, 0.9);
    letter-spacing: 1px;
    position: relative;
    z-index: 10;
    margin: 0;
    background: linear-gradient(45deg, #ffffff, #e8e8e8, #ffffff);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textShine 3s ease-in-out infinite;
    filter: contrast(0.1) brightness(0.1);
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

/* Layout principal: Ruleta arriba, 3 columnas abajo */
.main-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 100%;
    height: calc(100vh - 120px);
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Botón simple para girar la ruleta */
.ruleta-boton-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 20px;
    gap: 20px;
}

/* Contenedor de contadores de estadísticas */
.contadores-estadisticas {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Contador de preguntas - estilos base */
.contador-preguntas {
    display: flex;
    align-items: center;
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 
        0 6px 12px rgba(0, 0, 0, 0.2),
        0 0 15px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.1);
    min-width: 140px;
    animation: pulse 2s ease-in-out infinite;
}

/* Contador total - azul */
.contador-total {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    box-shadow: 
        0 6px 12px rgba(33, 150, 243, 0.3),
        0 0 15px rgba(33, 150, 243, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Contador correctas - verde */
.contador-correctas {
    background: linear-gradient(135deg, #4CAF50, #388E3C);
    box-shadow: 
        0 6px 12px rgba(76, 175, 80, 0.3),
        0 0 15px rgba(76, 175, 80, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Contador incorrectas - rojo */
.contador-incorrectas {
    background: linear-gradient(135deg, #F44336, #D32F2F);
    box-shadow: 
        0 6px 12px rgba(244, 67, 54, 0.3),
        0 0 15px rgba(244, 67, 54, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.contador-icono {
    font-size: 1.8em;
    margin-right: 10px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.contador-texto {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.contador-numero {
    font-size: 2em;
    font-weight: 900;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.5),
        0 0 10px rgba(0, 0, 0, 0.3);
    line-height: 1;
    margin-bottom: 3px;
}

.contador-etiqueta {
    font-size: 0.8em;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    text-align: center;
    opacity: 0.9;
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 
            0 6px 12px rgba(0, 0, 0, 0.2),
            0 0 15px rgba(0, 0, 0, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    50% { 
        transform: scale(1.02);
        box-shadow: 
            0 8px 16px rgba(0, 0, 0, 0.3),
            0 0 20px rgba(0, 0, 0, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
}

/* Estilos responsivos para contadores */
@media (max-width: 1200px) {
    .contadores-estadisticas {
        gap: 10px;
    }
    
    .contador-preguntas {
        min-width: 120px;
        padding: 10px 12px;
    }
    
    .contador-numero {
        font-size: 1.8em;
    }
    
    .contador-etiqueta {
        font-size: 0.75em;
    }
}

@media (max-width: 768px) {
    .ruleta-boton-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .contadores-estadisticas {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .contador-preguntas {
        min-width: 100px;
        padding: 8px 10px;
    }
    
    .contador-icono {
        font-size: 1.5em;
        margin-right: 8px;
    }
    
    .contador-numero {
        font-size: 1.6em;
    }
    
    .contador-etiqueta {
        font-size: 0.7em;
    }
}

.btn-girar-simple {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-girar-simple:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
    background: linear-gradient(135deg, #ff5252, #d63031);
}

.btn-girar-simple:active {
    transform: translateY(0);
}

.btn-girar-simple:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Sección inferior: 3 columnas */
.bottom-section {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 15px;
    flex: 1;
}

/* Columnas principales */
.historial-column, .central-column, .materias-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

section {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 15px;
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.1),
        0 0 20px rgba(102, 126, 234, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 5;
}

h2 {
    color: #4CAF50;
    border-bottom: 2px solid #ddd;
    padding-bottom: 8px;
    margin-top: 0;
    font-size: 1.6em;
}

/* Estilos de la Ruleta */
.ruleta-container {
    width: 100%;
    max-width: 500px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#ruleta {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57, #ff9ff3, #54a0ff);
    background-size: 400% 400%;
    border: 3px solid #fff;
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 0 20px rgba(255, 107, 107, 0.5),
        0 0 40px rgba(78, 205, 196, 0.3),
        0 0 60px rgba(69, 183, 209, 0.2),
        inset 0 0 15px rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    margin: 10px 0;
}

#ruleta::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg,
        #ff6b6b 0deg,
        #4ecdc4 51.4deg,
        #45b7d1 102.8deg,
        #96ceb4 154.2deg,
        #feca57 205.6deg,
        #ff9ff3 257deg,
        #54a0ff 308.4deg,
        #ff6b6b 360deg
    );
    animation: spin 2s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#ruleta.girando::before {
    opacity: 0.7;
}

#ruleta.girando {
    animation: 
        gradientShift 0.5s ease-in-out infinite,
        pulse 0.8s ease-in-out infinite,
        shake 0.1s ease-in-out infinite;
    transform: scale(1.05);
    box-shadow: 
        0 0 50px rgba(255, 107, 107, 0.8),
        0 0 100px rgba(78, 205, 196, 0.6),
        0 0 150px rgba(69, 183, 209, 0.4),
        inset 0 0 30px rgba(255, 255, 255, 0.5);
}

#asignatura-elegida {
    position: relative;
    z-index: 10;
    color: white;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(255, 255, 255, 0.5);
    font-size: 1em;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
}

#btn-girar {
    background: linear-gradient(45deg, #FFC107, #FF9800, #FF5722);
    background-size: 200% 200%;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    border-radius: 25px;
    margin-top: 10px;
    transition: all 0.3s ease;
    box-shadow: 
        0 5px 15px rgba(255, 193, 7, 0.4),
        0 0 15px rgba(255, 152, 0, 0.3);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

#btn-girar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

#btn-girar:hover {
    background-position: 100% 0;
    transform: translateY(-2px);
    box-shadow: 
        0 12px 35px rgba(255, 193, 7, 0.6),
        0 0 30px rgba(255, 152, 0, 0.5);
}

#btn-girar:hover::before {
    left: 100%;
}

#btn-girar:active {
    transform: translateY(0);
    box-shadow: 
        0 4px 15px rgba(255, 193, 7, 0.4),
        0 0 15px rgba(255, 152, 0, 0.3);
}

#btn-girar:disabled {
    background: linear-gradient(45deg, #ccc, #999);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Marcadores optimizados */
.puntuacion-container {
    flex: 1;
}

/* Ranking de equipos */
.ranking-container {
    flex: 1;
    margin-bottom: 15px;
}

.ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    font-size: 0.9em;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
    transition: transform 0.2s ease;
}

.ranking-item:hover {
    transform: translateY(-2px);
}

.ranking-item .posicion-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ranking-item .posicion {
    font-weight: bold;
    font-size: 1.4em;
}

.ranking-item .nombre-equipo {
    font-weight: 600;
    font-size: 1.2em;
}

.ranking-item .estadisticas {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.ranking-item .respuestas {
    font-size: 1em;
    opacity: 0.9;
}

.ranking-item .puntos {
    font-weight: bold;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 1.2em;
}

#marcadores {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.equipo {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: 200% 200%;
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 
        0 5px 15px rgba(102, 126, 234, 0.3),
        0 0 15px rgba(118, 75, 162, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    animation: gradientShift 6s ease infinite;
    min-height: 50px;
}

.equipo::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;
}

.equipo:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 
        0 15px 35px rgba(102, 126, 234, 0.4),
        0 0 30px rgba(118, 75, 162, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

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

.equipo span:first-child {
    font-weight: 700;
    font-size: 0.9em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.equipo span:last-child {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 10px;
    border-radius: 15px;
    font-weight: 900;
    font-size: 1em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Controles de Juego */
.game-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.turnos-container, .respuesta-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex: 1;
}

.turnos-container strong {
    color: #667eea;
    font-size: 1.1em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

#turnos-botones {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.turnos-botones-horizontal {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 15px;
    margin-top: 15px;
    justify-content: center;
    align-items: center;
}

/* Botones de grado con diseño vertical */
.btn-grado {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: 200% 200%;
    color: white;
    border: none;
    padding: 8px 12px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    border-radius: 15px;
    margin-right: 8px;
    margin-bottom: 8px;
    min-width: 80px;
    height: 60px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 
        0 5px 15px rgba(102, 126, 234, 0.3),
        0 0 10px rgba(118, 75, 162, 0.2);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.grado-texto {
    font-size: 0.7em;
    font-weight: 500;
    line-height: 1;
    margin-bottom: 2px;
    opacity: 0.9;
}

.grado-numero {
    font-size: 1.1em;
    font-weight: 700;
    line-height: 1;
}

#turnos-botones button:not(.btn-grado),
.respuesta-container button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: 200% 200%;
    color: white;
    border: none;
    padding: 12px 20px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    border-radius: 25px;
    margin-right: 8px;
    margin-bottom: 8px;
    min-width: 140px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 
        0 5px 15px rgba(102, 126, 234, 0.3),
        0 0 10px rgba(118, 75, 162, 0.2);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

/* Efectos hover para botones de grado */
.btn-grado::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-grado:hover {
    background-position: 100% 0;
    transform: translateY(-3px);
    box-shadow: 
        0 12px 25px rgba(102, 126, 234, 0.4),
        0 0 20px rgba(118, 75, 162, 0.3);
}

.btn-grado:hover::before {
    left: 100%;
}

#turnos-botones button:not(.btn-grado)::before,
.respuesta-container button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

#turnos-botones button:not(.btn-grado):hover,
.respuesta-container button:hover {
    background-position: 100% 0;
    transform: translateY(-3px);
    box-shadow: 
        0 12px 25px rgba(102, 126, 234, 0.4),
        0 0 20px rgba(118, 75, 162, 0.3);
}

#turnos-botones button:not(.btn-grado):hover::before,
.respuesta-container button:hover::before {
    left: 100%;
}

#btn-correcta {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    background-size: 200% 200%;
}

#btn-correcta:hover {
    background-position: 100% 0;
    box-shadow: 
        0 12px 25px rgba(76, 175, 80, 0.4),
        0 0 20px rgba(69, 160, 73, 0.3);
}

#btn-incorrecta {
    background: linear-gradient(135deg, #F44336 0%, #D32F2F 100%);
    background-size: 200% 200%;
}

#btn-incorrecta:hover {
    background-position: 100% 0;
    box-shadow: 
        0 12px 25px rgba(244, 67, 54, 0.4),
        0 0 20px rgba(211, 47, 47, 0.3);
}

/* Botones de respuesta */
.respuesta-botones {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.respuesta-botones button {
    flex: 1;
    padding: 12px;
    font-size: 0.9em;
}

/* Materias disponibles */
.materias-container {
    flex: 1;
    margin-bottom: 15px;
}

.tabla-materias {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tabla-materias th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9em;
}

.tabla-materias td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85em;
}

.tabla-materias tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.tabla-materias .materia-nombre {
    font-weight: 600;
    color: #111111;
}

.tabla-materias .materia-preguntas {
    text-align: center;
    font-weight: 600;
    color: #0d0d0e;
}

.tabla-materias .materia-estado {
    text-align: center;
    font-weight: 600;
    font-size: 0.8em;
}

/* Historial optimizado */
.historial {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.historial h2 {
    color: #667eea;
    font-size: 1.6em;
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

#historial-list {
    list-style-type: none;
    padding: 0;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #667eea rgba(255, 255, 255, 0.1);
}

#historial-list::-webkit-scrollbar {
    width: 6px;
}

#historial-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

#historial-list::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
}

#historial-list li {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.9) 0%, rgba(118, 75, 162, 0.9) 100%);
    border-left: 4px solid #4CAF50;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 0.9em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#historial-list li::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

#historial-list li:hover {
    transform: translateX(5px);
    background: linear-gradient(135deg, rgba(102, 126, 234, 1) 0%, rgba(118, 75, 162, 1) 100%);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    border-left-color: #FFC107;
}

#historial-list li:hover::before {
    left: 100%;
}

/* === ANIMACIONES ESPECTACULARES PARA LA RULETA === */

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

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1.05);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1.05);
    }
}

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

@keyframes rainbow {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 
            0 0 50px rgba(255, 107, 107, 0.8),
            0 0 100px rgba(78, 205, 196, 0.6),
            0 0 150px rgba(69, 183, 209, 0.4),
            inset 0 0 30px rgba(255, 255, 255, 0.5);
    }
    50% {
        box-shadow: 
            0 0 80px rgba(255, 107, 107, 1),
            0 0 150px rgba(78, 205, 196, 0.8),
            0 0 220px rgba(69, 183, 209, 0.6),
            inset 0 0 50px rgba(255, 255, 255, 0.7);
    }
}

/* Efectos adicionales para pantalla grande */
.ruleta-container {
    position: relative;
}

.ruleta-container::after {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background: radial-gradient(circle, transparent 30%, rgba(255, 255, 255, 0.1) 70%);
    border-radius: 30px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.ruleta-container.girando::after {
    opacity: 1;
    animation: glow 1s ease-in-out infinite;
}

/* Mejoras para proyección en pantalla grande */
body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 400% 400%;
    min-height: 100vh;
    animation: gradientShift 8s ease infinite;
    position: relative;
    overflow-x: hidden;
}

/* Efectos de fondo decorativos */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Logotipo institucional en el header */
.header-logo {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background-image: url('img/logo.jpg');
    background-size: 80%;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 12px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
    z-index: 15;
    animation: logoGlow 3s ease-in-out infinite;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

@keyframes logoGlow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
        transform: translateY(-50%) scale(1);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 255, 255, 0.4);
        transform: translateY(-50%) scale(1.05);
    }
}

/* Patrón de textura sutil */
body::before {
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%),
        url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.05)"/><circle cx="10" cy="60" r="0.5" fill="rgba(255,255,255,0.05)"/><circle cx="90" cy="40" r="0.5" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
}

header {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Efectos de partículas simuladas */
#ruleta.girando {
    position: relative;
}

#ruleta.girando::after {
    content: '✨';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 2em;
    animation: rainbow 0.5s linear infinite;
    z-index: 15;
}

/* Efectos de partículas adicionales */
.ruleta-container.girando::before {
    content: '🌟 ⭐ ✨ 💫 🌟 ⭐ ✨ 💫';
    position: absolute;
    top: -30px;
    left: 0;
    right: 0;
    font-size: 1.5em;
    text-align: center;
    animation: 
        float 2s ease-in-out infinite,
        rainbow 1s linear infinite;
    z-index: 20;
    pointer-events: none;
}

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


/* Efectos de ondas de energía */
.ruleta-container.girando {
    position: relative;
}

.ruleta-container.girando::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    border: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: 
        ripple 1s ease-out infinite,
        glow 0.5s ease-in-out infinite;
    z-index: 5;
}

@keyframes ripple {
    0% {
        width: 100px;
        height: 100px;
        opacity: 1;
    }
    100% {
        width: 300px;
        height: 300px;
        opacity: 0;
    }
}

/* Responsive para pantallas grandes */
@media (min-width: 1200px) {
    body {
        padding: 15px;
    }
    
    .main-container {
        height: calc(100vh - 100px);
        gap: 20px;
    }
    
    header h1 {
        font-size: 2.5em;
        letter-spacing: 2px;
        text-shadow: 
            4px 4px 8px rgba(0, 0, 0, 0.8),
            0 0 20px rgba(255, 255, 255, 0.5),
            2px 2px 4px rgba(0, 0, 0, 0.9);
    }
    
    #ruleta {
        height: 120px;
        font-size: 1.4em;
        padding: 25px;
    }
    
    #asignatura-elegida {
        font-size: 1.1em;
        letter-spacing: 1px;
    }
    
    .equipo {
        padding: 12px 15px;
        font-size: 1em;
        min-height: 55px;
    }
    
    .equipo span:last-child {
        font-size: 1.1em;
        padding: 6px 12px;
    }
    
    #turnos-botones button,
    .respuesta-container button {
        padding: 10px 15px;
        font-size: 0.95em;
    }
    
    /* Botones de grado en pantallas grandes */
    .btn-grado {
        min-width: 90px;
        height: 65px;
        padding: 10px 15px;
    }
    
    .grado-texto {
        font-size: 0.75em;
    }
    
    .grado-numero {
        font-size: 1.2em;
    }
    
    h2 {
        font-size: 1.4em;
    }
    
    /* Logotipo más grande en pantallas grandes */
    .header-logo {
        width: 80px;
        height: 80px;
        left: 30px;
    }
}

/* Responsive para pantallas medianas */
@media (max-width: 1199px) {
    .main-container {
        height: auto;
    }
    
    .bottom-section {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    
    .ruleta-container {
        max-width: 100%;
    }
    
    .historial-column, .central-column, .materias-column {
        flex-direction: row;
        gap: 15px;
    }
    
    .historial, .puntuacion-container, .ranking-container, .game-controls, .materias-container {
        flex: 1;
    }
    
    /* Logotipo más pequeño en pantallas medianas */
    .header-logo {
        width: 50px;
        height: 50px;
        left: 15px;
    }
    
    /* Botones de grado en pantallas medianas */
    .btn-grado {
        min-width: 70px;
        height: 55px;
        padding: 6px 10px;
    }
    
    .grado-texto {
        font-size: 0.65em;
    }
    
    .grado-numero {
        font-size: 1em;
    }
}

/* Efectos adicionales para elementos flotantes */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Añadir efectos de partículas flotantes */
body::before {
    animation: float 6s ease-in-out infinite;
}

/* Efectos de brillo en elementos principales */
section {
    position: relative;
}

section::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #667eea, #764ba2, #f093fb, #667eea);
    background-size: 400% 400%;
    border-radius: 22px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: gradientShift 3s ease infinite;
}

section:hover::before {
    opacity: 0.7;
}

/* Estilos para la ventana modal de la ruleta */
.modal-ruleta {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-ruleta.mostrar {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-contenido {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 40px;
    max-width: 95vw;
    max-height: 95vh;
    width: 800px;
    height: 700px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.4s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.modal-contenido::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    animation: shine 2s infinite;
}

.modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.modal-header h2 {
    color: white;
    font-size: 2.5em;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-weight: bold;
}

.modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.ruleta-modal {
    width: 500px;
    height: 500px;
    border-radius: 50%;
    position: relative;
    background: conic-gradient(
        #ff6b6b 0deg 25.7deg,
        #4ecdc4 25.7deg 51.4deg,
        #45b7d1 51.4deg 77.1deg,
        #96ceb4 77.1deg 102.8deg,
        #feca57 102.8deg 128.5deg,
        #ff9ff3 128.5deg 154.2deg,
        #54a0ff 154.2deg 179.9deg,
        #5f27cd 179.9deg 205.6deg,
        #00d2d3 205.6deg 231.3deg,
        #ff9f43 231.3deg 257deg,
        #ee5a24 257deg 282.7deg,
        #0984e3 282.7deg 308.4deg,
        #6c5ce7 308.4deg 334.1deg,
        #a29bfe 334.1deg 360deg
    );
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.4);
    transition: transform 0.1s ease;
    margin-bottom: 20px;
}

.ruleta-modal.girando {
    animation: spin 0.1s linear infinite;
}

.ruleta-centro {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    background: white;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.asignatura-centro {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #333;
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
    line-height: 1.2;
    z-index: 15;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.ruleta-flecha {
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 35px solid #ff6b6b;
    transform: translateY(-8px);
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
}

.resultado-ruleta {
    text-align: center;
    background: rgba(255, 255, 255, 0.15);
    padding: 30px 40px;
    border-radius: 20px;
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    min-width: 400px;
}

.resultado-ruleta h3 {
    color: white;
    font-size: 4em;
    margin: 0;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.7);
    font-weight: bold;
    letter-spacing: 2px;
}

/* Animaciones para el modal */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        transform: scale(0.8) translateY(-50px);
        opacity: 0;
    }
    to { 
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

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

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

/* Responsive para el modal */
@media (max-width: 768px) {
    .modal-contenido {
        width: 95vw;
        height: 90vh;
        padding: 20px;
    }
    
    .ruleta-modal {
        width: 350px;
        height: 350px;
    }
    
    .modal-header h2 {
        font-size: 2em;
    }
    
    .resultado-ruleta {
        min-width: 300px;
        padding: 20px 30px;
    }
    
    .resultado-ruleta h3 {
        font-size: 2em;
    }
    
    /* Logotipo muy pequeño en móviles */
    .header-logo {
        width: 40px;
        height: 40px;
        left: 10px;
    }
    
    /* Botones de grado en móviles */
    .btn-grado {
        min-width: 60px;
        height: 50px;
        padding: 5px 8px;
        margin-right: 5px;
    }
    
    .grado-texto {
        font-size: 0.6em;
    }
    
    .grado-numero {
        font-size: 0.9em;
    }
}

/* Estilos para el sistema de modales de alerta */
.modal-alerta {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.modal-alerta.mostrar {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-alerta-contenido {
    background: linear-gradient(135deg, #81c784 0%, #66bb6a 50%, #4caf50 100%);
    border-radius: 25px;
    padding: 40px;
    max-width: 90vw;
    width: 500px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    animation: slideInBounce 0.5s ease;
    position: relative;
    overflow: hidden;
    text-align: center;
}

.modal-alerta-contenido::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.2) 50%, transparent 70%);
    animation: shine 2s infinite;
}

.modal-alerta-contenido.success {
    background: linear-gradient(135deg, #81c784 0%, #66bb6a 50%, #4caf50 100%);
}

.modal-alerta-contenido.error {
    background: linear-gradient(135deg, #ef5350 0%, #e53935 50%, #d32f2f 100%);
}

.modal-alerta-contenido.warning {
    background: linear-gradient(135deg, #ffb74d 0%, #ff9800 50%, #f57c00 100%);
}

.modal-alerta-contenido.info {
    background: linear-gradient(135deg, #64b5f6 0%, #42a5f5 50%, #2196f3 100%);
}

.modal-alerta-header {
    margin-bottom: 25px;
}

.modal-alerta-icono {
    font-size: 4em;
    margin-bottom: 15px;
    animation: bounce 1s infinite;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.modal-alerta-titulo {
    color: #000000;
    font-size: 2.5em;
    margin: 0;
    text-shadow: 
        1px 1px 0px #ffffff,
        2px 2px 4px rgba(255, 255, 255, 0.9),
        0 0 8px rgba(255, 255, 255, 0.7);
    font-weight: 900;
    letter-spacing: 1px;
    filter: contrast(1.5) brightness(0.8);
}

.modal-alerta-body {
    margin-bottom: 30px;
}

.modal-alerta-mensaje {
    color: #ffffff;
    font-size: 1.8em;
    margin: 0;
    text-shadow: 
        1px 1px 0px #000000,
        3px 3px 6px rgba(0, 0, 0, 0.9),
        0 0 8px rgba(0, 0, 0, 0.7);
    font-weight: 700;
    line-height: 1.4;
    filter: contrast(1.2) brightness(1.1);
}

.modal-alerta-footer {
    display: flex;
    justify-content: center;
}

.modal-alerta-btn {
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    border: 3px solid rgba(255, 255, 255, 0.8);
    padding: 15px 40px;
    border-radius: 30px;
    font-size: 1.5em;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    text-shadow: 
        1px 1px 0px #000000,
        2px 2px 4px rgba(0, 0, 0, 0.8);
    min-width: 150px;
    filter: contrast(1.2) brightness(1.1);
}

.modal-alerta-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 1);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    color: #ffffff;
    text-shadow: 
        1px 1px 0px #000000,
        2px 2px 6px rgba(0, 0, 0, 0.9);
}

.modal-alerta-btn:active {
    transform: translateY(-1px);
}

/* Animaciones para los modales de alerta */
@keyframes slideInBounce {
    0% {
        transform: scale(0.3) translateY(-100px);
        opacity: 0;
    }
    50% {
        transform: scale(1.05) translateY(0);
        opacity: 0.8;
    }
    70% {
        transform: scale(0.95) translateY(0);
        opacity: 0.9;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Responsive para modales de alerta */
@media (max-width: 768px) {
    .modal-alerta-contenido {
        width: 95vw;
        padding: 30px 20px;
    }
    
    .modal-alerta-icono {
        font-size: 3em;
    }
    
    .modal-alerta-titulo {
        font-size: 2em;
    }
    
    .modal-alerta-mensaje {
        font-size: 1.4em;
    }
    
    .modal-alerta-btn {
        font-size: 1.2em;
        padding: 12px 30px;
    }
}