/* Crack Rápido Ultra - Estilos Optimizados */

/* Variables CSS avanzadas */
:root {
    /* Colores principales */
    --primary-orange: #ff6b35;
    --primary-blue: #667eea;
    --primary-purple: #764ba2;
    --accent-yellow: #ffd32a;
    --accent-red: #ff416c;
    --accent-green: #68d391;
    --accent-pink: #f687b3;
    --accent-cyan: #4facfe;
    
    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    --gradient-secondary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    --gradient-danger: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    --gradient-cosmic: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    
    /* Superficies */
    --surface-dark: rgba(20, 20, 30, 0.95);
    --surface-glass: rgba(255, 255, 255, 0.08);
    --surface-card: rgba(42, 42, 42, 0.95);
    
    /* Efectos */
    --shadow-glow: 0 8px 25px rgba(255, 107, 53, 0.3);
    --shadow-deep: 0 15px 40px rgba(0, 0, 0, 0.4);
    --blur-glass: blur(20px);
    
    /* Transiciones */
    --transition-smooth: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    /* Fuentes */
    --font-primary: 'Montserrat', sans-serif;
    --font-display: 'Oswald', sans-serif;
}

/* Reset y Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background: radial-gradient(ellipse at top, #1a1a2e 0%, #16213e 50%, #0f172a 100%);
    color: white;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Fondo cósmico animado */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 107, 53, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(102, 126, 234, 0.15) 0%, transparent 50%);
    z-index: -2;
    animation: cosmicPulse 8s ease-in-out infinite alternate;
}

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

/* Partículas flotantes */
.speed-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: 
        radial-gradient(3px 3px at 30px 40px, rgba(255, 107, 53, 0.6), transparent),
        radial-gradient(2px 2px at 70px 80px, rgba(255, 65, 108, 0.5), transparent),
        radial-gradient(1px 1px at 110px 120px, rgba(255, 211, 42, 0.4), transparent);
    background-size: 180px 180px;
    animation: particleFlow 20s linear infinite;
}

@keyframes particleFlow {
    0%, 100% { transform: translateX(0) translateY(0); }
    25% { transform: translateX(-15px) translateY(-10px); }
    50% { transform: translateX(10px) translateY(-15px); }
    75% { transform: translateX(15px) translateY(10px); }
}

/* Contenedor principal */
.game-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    position: relative;
}

/* Panel de juego */
.speed-game-panel {
    background: var(--surface-card);
    backdrop-filter: var(--blur-glass);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 
        var(--shadow-deep),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 40px rgba(255, 107, 53, 0.15);
    border: 2px solid rgba(255, 107, 53, 0.4);
    text-align: center;
    max-width: 900px;
    width: 100%;
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.speed-game-panel:hover {
    transform: translateY(-5px);
    box-shadow: 
        0 25px 60px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(255, 107, 53, 0.25);
}

/* Encabezado del juego */
.game-header {
    margin-bottom: 2rem;
    position: relative;
}

.game-title {
    font-size: 3rem;
    font-weight: 900;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.5rem;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    animation: titleGlow 4s ease-in-out infinite;
}

.game-title i {
    color: var(--primary-orange);
    filter: drop-shadow(0 0 20px rgba(255, 107, 53, 0.8));
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { filter: drop-shadow(0 0 20px rgba(255, 107, 53, 0.4)); }
    50% { filter: drop-shadow(0 0 40px rgba(255, 107, 53, 0.8)); }
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.game-subtitle {
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
    font-weight: 500;
    letter-spacing: 1px;
}

/* Estadísticas del juego */
.speed-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    border-radius: 15px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

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

.stat-item:hover {
    background: rgba(255, 107, 53, 0.15);
    transform: translateY(-3px);
    border-color: rgba(255, 107, 53, 0.3);
    box-shadow: var(--shadow-glow);
}

.stat-item:hover::before {
    left: 100%;
}

.stat-value {
    font-size: 2rem;
    font-weight: 900;
    font-family: var(--font-display);
    margin-bottom: 0.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.stat-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Timer circular */
.timer-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
    filter: drop-shadow(0 0 20px rgba(255, 107, 53, 0.6));
}

.timer-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(
        var(--primary-orange) var(--timer-progress, 0%), 
        rgba(255, 255, 255, 0.15) 0%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 900;
    color: white;
    font-family: var(--font-display);
    position: relative;
    animation: timerGlow 2s ease-in-out infinite alternate;
}

.timer-circle::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    background: var(--surface-dark);
    border-radius: 50%;
    z-index: -1;
}

.timer-circle.critical {
    background: conic-gradient(
        var(--accent-red) var(--timer-progress, 0%), 
        rgba(255, 65, 108, 0.2) 0%
    );
    animation: timerCritical 0.3s ease-in-out infinite alternate;
    color: var(--accent-red);
}

@keyframes timerGlow {
    0% { box-shadow: 0 0 20px rgba(255, 107, 53, 0.4); }
    100% { box-shadow: 0 0 40px rgba(255, 107, 53, 0.8); }
}

@keyframes timerCritical {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

/* Barra de progreso */
.progress-container {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 2rem;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 107, 53, 0.2);
}

.progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    width: 0%;
    transition: width 0.5s ease;
    position: relative;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.6);
}

.progress-bar::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: progressShine 2s ease-in-out infinite;
}

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

/* Contenedor de pregunta */
.question-container {
    margin-bottom: 2rem;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-glass);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid rgba(255, 107, 53, 0.2);
    position: relative;
    overflow: hidden;
}

.question-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    line-height: 1.6;
    max-width: 800px;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* Opciones de respuesta */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.option-btn {
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 1.5rem;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

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

.option-btn:hover {
    background: rgba(255, 107, 53, 0.25);
    border-color: var(--primary-orange);
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
    color: white;
}

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

.option-btn.correct {
    background: var(--gradient-success);
    border-color: var(--accent-green);
    animation: correctPulse 0.8s ease-in-out;
}

.option-btn.incorrect {
    background: var(--gradient-danger);
    border-color: var(--accent-red);
    animation: incorrectShake 0.8s ease-in-out;
}

@keyframes correctPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Botones de control */
.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.speed-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-bounce);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-glow);
}

.speed-btn::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.6s ease;
}

.speed-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(255, 107, 53, 0.5);
}

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

.speed-btn.secondary {
    background: var(--surface-glass);
    color: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.speed-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Selección de modo */
.mode-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.mode-card {
    background: var(--surface-glass);
    border: 2px solid rgba(255, 107, 53, 0.3);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-bounce);
    position: relative;
    overflow: hidden;
}

.mode-card:hover {
    transform: translateY(-8px);
    border-color: rgba(255, 107, 53, 0.6);
    box-shadow: var(--shadow-deep);
}

.mode-icon {
    font-size: 3rem;
    color: var(--primary-orange);
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 15px rgba(255, 107, 53, 0.6));
}

.mode-card h3 {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.5rem 0;
    font-family: var(--font-display);
}

.mode-card p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    margin: 0.5rem 0;
}

.mode-detail {
    color: var(--primary-orange);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Selección de categoría */
.category-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.category-card {
    background: var(--surface-glass);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-bounce);
    position: relative;
    overflow: hidden;
}

.category-card:hover {
    transform: translateY(-8px);
    border-color: rgba(102, 126, 234, 0.6);
    box-shadow: var(--shadow-deep);
}

.category-icon {
    font-size: 2.5rem;
    color: var(--primary-blue);
    margin-bottom: 1rem;
}

/* Power-ups */
.powerups-panel {
    background: var(--surface-glass);
    border: 1px solid rgba(183, 148, 246, 0.3);
    border-radius: 15px;
    padding: 1rem;
    margin-bottom: 2rem;
}

.powerups-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.powerup-btn {
    background: var(--gradient-secondary);
    border: 1px solid rgba(183, 148, 246, 0.4);
    border-radius: 12px;
    color: white;
    padding: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.powerup-btn:hover:not(:disabled) {
    background: rgba(183, 148, 246, 0.3);
    transform: translateY(-2px);
}

.powerup-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Records */
.records-section {
    background: var(--surface-glass);
    border-radius: 25px;
    padding: 2rem;
    margin: 2rem 0;
    border: 2px solid rgba(255, 107, 53, 0.3);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.record-item:last-child {
    border-bottom: none;
}

.record-label {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

.record-value {
    color: var(--primary-orange);
    font-weight: 900;
    font-family: var(--font-display);
    font-size: 1.3rem;
}

/* Configuración */
.settings-panel {
    background: var(--surface-glass);
    border-radius: 20px;
    padding: 2rem;
    margin: 2rem 0;
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.settings-grid {
    display: grid;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition-smooth);
}

.setting-item:hover {
    background: rgba(102, 126, 234, 0.1);
}

.toggle-switch {
    position: relative;
    width: 60px;
    height: 30px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.2);
    transition: 0.3s;
    border-radius: 30px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background: var(--gradient-primary);
}

input:checked + .toggle-slider:before {
    transform: translateX(30px);
}

/* Efectos especiales */
.speed-effect {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    font-weight: 900;
    z-index: 1000;
    pointer-events: none;
    font-family: var(--font-display);
    animation: speedEffect 1.5s ease-out forwards;
}

@keyframes speedEffect {
    0% { 
        opacity: 0; 
        transform: translate(-50%, -50%) scale(0.5); 
    }
    30% { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1.2); 
    }
    100% { 
        opacity: 0; 
        transform: translate(-50%, -50%) scale(1) translateY(-100px); 
    }
}

/* Responsive */
@media (max-width: 768px) {
    .speed-game-panel {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .game-title {
        font-size: 2.5rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .speed-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .mode-selection {
        grid-template-columns: 1fr;
    }
    
    .category-selection {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .timer-container {
        width: 100px;
        height: 100px;
    }
    
    .timer-circle {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .speed-game-panel {
        padding: 1rem;
    }
    
    .game-title {
        font-size: 2rem;
    }
    
    .category-selection {
        grid-template-columns: 1fr;
    }
    
    .speed-stats {
        grid-template-columns: 1fr;
    }
    
    .timer-container {
        width: 80px;
        height: 80px;
    }
    
    .timer-circle {
        font-size: 1.8rem;
    }
}

/* Utilities */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
} 