/* Enhanced Game Integration Styles */

/* Game Focus and Interaction Enhancements */
.game-iframe {
    transition: all 0.3s ease;
    cursor: pointer;
}

.game-iframe:hover {
    transform: scale(1.01);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.game-iframe:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* Game Loading Enhancements */
.game-loading {
    background: linear-gradient(45deg, #f8f9fa 25%, #e9ecef 25%, #e9ecef 50%, #f8f9fa 50%, #f8f9fa 75%, #e9ecef 75%);
    background-size: 20px 20px;
    animation: loading-pattern 1s linear infinite, fadeInUp 1s ease;
}

@keyframes loading-pattern {
    0% { background-position: 0 0; }
    100% { background-position: 20px 20px; }
}

.loading-spinner {
    position: relative;
    display: inline-block;
}

.loading-spinner::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    margin: -30px 0 0 -30px;
    border: 3px solid transparent;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: loading-pulse 2s ease-in-out infinite;
}

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

/* Game Container Responsive Enhancements */
.game-container {
    position: relative;
    overflow: visible;
}

.game-container::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: linear-gradient(45deg, #667eea, #764ba2, #667eea);
    border-radius: 25px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-container:hover::before {
    opacity: 0.1;
}

/* Game Controls Enhanced Styling */
.game-controls {
    margin-top: 15px;
    text-align: center;
    opacity: 0;
    animation: fadeInUp 0.5s ease 0.5s forwards;
}

.game-buttons {
    display: inline-flex;
    gap: 12px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.game-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.game-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
}

.game-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.game-btn:hover::before {
    width: 100%;
    height: 100%;
}

.game-btn:active {
    transform: translateY(0) scale(0.95);
}

/* Tooltip Enhancement for Game Controls */
.game-btn {
    position: relative;
}

.game-btn::after {
    content: attr(title);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.game-btn:hover::after {
    opacity: 1;
}

/* Game Instructions Modal Enhanced */
.game-instructions-modal {
    backdrop-filter: blur(5px);
    animation: modalFadeIn 0.3s ease;
}

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

.modal-content {
    animation: modalSlideIn 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

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

.instruction-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
    transition: transform 0.2s ease;
}

.instruction-item:hover {
    transform: translateX(5px);
}

/* Game Status Indicators */
.game-status {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.game-status.loading {
    background: #fff3cd;
    color: #856404;
}

.game-status.ready {
    background: #d4edda;
    color: #155724;
}

.game-status.error {
    background: #f8d7da;
    color: #721c24;
}

/* Mobile-Specific Game Enhancements */
@media (max-width: 767px) {
    .game-container {
        padding: 15px;
        min-height: 350px;
    }
    
    .game-buttons {
        gap: 8px;
        padding: 6px 12px;
    }
    
    .game-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .game-btn::after {
        bottom: -30px;
        font-size: 11px;
    }
}

/* Performance Optimizations */
.game-iframe {
    will-change: transform, opacity;
    backface-visibility: hidden;
    perspective: 1000px;
}

.game-container {
    contain: layout style paint;
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    .game-iframe:hover {
        transform: none;
    }
    
    .game-btn:hover {
        transform: none;
    }
    
    .loading-spinner::after {
        animation: none;
    }
    
    .game-loading {
        animation: none;
        background: #f8f9fa;
    }
}

@media (prefers-contrast: high) {
    .game-btn {
        border: 2px solid white;
    }
    
    .game-container {
        border: 2px solid #333;
    }
    
    .game-iframe:focus {
        outline: 3px solid #000;
    }
}

/* Print Styles */
@media print {
    .game-container,
    .game-controls {
        display: none;
    }
}