/* Final Touches and Polish */

/* Enhanced Game Container with Premium Border */
.game-container {
    position: relative;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid transparent;
    background-clip: padding-box;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.15),
        0 15px 30px rgba(102, 126, 234, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
}

.game-container::before {
    content: '';
    position: absolute;
    inset: -2px;
    padding: 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #5a67d8 100%);
    border-radius: inherit;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: xor;
    -webkit-mask-composite: xor;
    z-index: -1;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.game-container:hover::before {
    opacity: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #5a67d8 50%, #667eea 75%, #764ba2 100%);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

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

/* Premium Loading Animation */
.enhanced-loading {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    position: relative;
    overflow: hidden;
}

.enhanced-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    animation: loadingShimmer 2s infinite;
}

@keyframes loadingShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.enhanced-spinner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.enhanced-spinner::after {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    border: 3px solid rgba(102, 126, 234, 0.1);
    border-radius: 50%;
    border-top: 3px solid #667eea;
    border-right: 3px solid #764ba2;
    animation: spinGlow 1.5s linear infinite;
    filter: drop-shadow(0 0 10px rgba(102, 126, 234, 0.3));
}

@keyframes spinGlow {
    0% {
        transform: rotate(0deg);
        filter: drop-shadow(0 0 5px rgba(102, 126, 234, 0.3));
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(102, 126, 234, 0.5));
    }
    100% {
        transform: rotate(360deg);
        filter: drop-shadow(0 0 5px rgba(102, 126, 234, 0.3));
    }
}

/* Enhanced Game Status Indicator */
.game-status {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 100;
    transition: all 0.3s ease;
}

.game-status.loading {
    background: linear-gradient(135deg, rgba(255, 243, 205, 0.9), rgba(255, 235, 153, 0.9));
    color: #92400e;
    animation: statusPulse 2s ease-in-out infinite;
}

.game-status.ready {
    background: linear-gradient(135deg, rgba(212, 237, 218, 0.9), rgba(187, 247, 208, 0.9));
    color: #065f46;
}

.game-status.error {
    background: linear-gradient(135deg, rgba(248, 215, 218, 0.9), rgba(252, 165, 165, 0.9));
    color: #7f1d1d;
}

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

/* Enhanced Typography */
.game-title {
    position: relative;
    overflow: hidden;
}

.game-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
    opacity: 0;
    animation: titleUnderline 1s ease 2s forwards;
}

@keyframes titleUnderline {
    from {
        opacity: 0;
        width: 0;
    }
    to {
        opacity: 1;
        width: 100px;
    }
}

/* Enhanced Stat Items */
.stat-item {
    position: relative;
    overflow: hidden;
}

.stat-item::after {
    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;
}

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

/* Premium Navigation Enhancement */
.navbar {
    position: relative;
    overflow: hidden;
}

.navbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(102, 126, 234, 0.3) 50%, transparent 100%);
}

.nav-logo img {
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(102, 126, 234, 0.2));
}

.nav-logo:hover img {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 4px 8px rgba(102, 126, 234, 0.4));
}

/* Enhanced Feature Cards */
.feature-card {
    position: relative;
    overflow: hidden;
}

.feature-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.02) 0%, rgba(118, 75, 162, 0.02) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.feature-card:hover::after {
    opacity: 1;
}

.feature-icon {
    position: relative;
    z-index: 1;
}

.feature-icon::before {
    content: '';
    position: absolute;
    inset: -10px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.feature-card:hover .feature-icon::before {
    opacity: 1;
}

/* Enhanced Article Styling */
.game-article h2 {
    position: relative;
    overflow: hidden;
}

.game-article h2::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: headerShine 3s ease-in-out infinite;
}

@keyframes headerShine {
    0%, 90%, 100% { left: -100%; }
    45% { left: 100%; }
}

/* Mobile Optimization */
@media (max-width: 768px) {
    .game-container::before {
        display: none; /* Simplify on mobile for performance */
    }
    
    .enhanced-loading::before {
        animation-duration: 1.5s; /* Faster on mobile */
    }
    
    .game-title::after {
        width: 80px;
    }
    
    .stat-item {
        font-size: 0.8rem;
        padding: 0.6rem 1.2rem;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .game-container {
        background: linear-gradient(145deg, #1e293b 0%, #334155 100%);
        color: #f8fafc;
    }
    
    .enhanced-loading {
        background: linear-gradient(135deg, #334155 0%, #475569 100%);
    }
    
    .stat-item {
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
        color: #f8fafc;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .game-container {
        border: 3px solid #000;
        box-shadow: none;
    }
    
    .game-status {
        border: 2px solid #000;
    }
    
    .stat-item {
        border: 2px solid #000;
        background: #fff;
        color: #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .enhanced-spinner {
        animation: none;
    }
    
    .game-container:hover::before {
        animation: none;
    }
    
    .floating-element {
        animation: none;
        transform: none !important;
    }
    
    .enhanced-loading::before {
        animation: none;
    }
}

/* Print Styles */
@media print {
    .game-container,
    .game-status,
    .enhanced-loading {
        display: none;
    }
    
    .game-title {
        color: #000 !important;
        background: none !important;
        -webkit-text-fill-color: #000 !important;
    }
}

/* Performance Optimizations */
.game-container,
.enhanced-loading,
.stat-item,
.feature-card {
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Accessibility Improvements */
.enhanced-focus:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
    box-shadow: 0 0 0 6px rgba(102, 126, 234, 0.2);
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .interactive-card:hover {
        transform: none; /* Disable hover effects on touch devices */
    }
    
    .stat-item:hover::after {
        left: -100%; /* Disable hover shimmer on touch */
    }
    
    .feature-card:hover {
        transform: none;
    }
}