:root {
    --color-bg-dark: #0a0a0f;
    --color-bg-medium: #1a1a2e;
    --color-purple-primary: #9333ea;
    --color-purple-light: #a855f7;
    --color-purple-dark: #7e22ce;
    --color-purple-glow: rgba(147, 51, 234, 0.4);
    --color-text-primary: #ffffff;
    --color-text-secondary: #a0a0b0;
    --border-radius-sm: 12px;
    --border-radius-md: 20px;
    --border-radius-lg: 24px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--color-bg-dark);
    color: var(--color-text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Animated Background */
.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(147, 51, 234, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(168, 85, 247, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, var(--color-bg-dark) 0%, var(--color-bg-medium) 100%);
    z-index: -1;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

/* Header */
.header {
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    position: relative;
}

.clear-cache-btn {
    position: absolute;
    right: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(147, 51, 234, 0.2);
    border: 2px solid rgba(147, 51, 234, 0.4);
    color: var(--color-text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.clear-cache-btn:hover {
    background: rgba(147, 51, 234, 0.4);
    border-color: var(--color-purple-primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(147, 51, 234, 0.3);
}

.clear-cache-btn:active {
    transform: translateY(0);
}

.clear-cache-btn svg {
    width: 20px;
    height: 20px;
}

/* Loading Status Overlay */
.loading-status {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(20px);
    border: 2px solid var(--color-purple-primary);
    border-radius: var(--border-radius-lg);
    padding: 2rem 3rem;
    z-index: 2000;
    display: none;
    box-shadow: 0 20px 60px rgba(147, 51, 234, 0.4);
}

.loading-status.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(147, 51, 234, 0.2);
    border-top-color: var(--color-purple-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    text-align: center;
}

.logo {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-purple-light), var(--color-purple-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    animation: fadeInDown 0.8s ease;
}

.logo-icon {
    font-size: 3rem;
    filter: drop-shadow(0 0 20px var(--color-purple-glow));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 3rem;
    padding: 2rem 0;
}

/* Game Cards with 3D Effect */
.game-card {
    position: relative;
    background: rgba(26, 26, 46, 0.6);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius-lg);
    padding: 3rem 2rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 2px solid rgba(147, 51, 234, 0.2);
    transform-style: preserve-3d;
    perspective: 1000px;
    animation: fadeInUp 0.8s ease;
    animation-fill-mode: both;
}

.game-card:nth-child(1) {
    animation-delay: 0.2s;
}

.game-card:nth-child(2) {
    animation-delay: 0.4s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: var(--border-radius-lg);
    background: linear-gradient(135deg,
            rgba(147, 51, 234, 0.1) 0%,
            rgba(168, 85, 247, 0.05) 100%);
    opacity: 0;
    transition: var(--transition-smooth);
    z-index: -1;
}

.game-card:hover::before {
    opacity: 1;
}

.game-card:hover {
    border-color: var(--color-purple-primary);
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 60px rgba(147, 51, 234, 0.3);
}

.card-glow {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, var(--color-purple-primary), var(--color-purple-light));
    border-radius: var(--border-radius-lg);
    opacity: 0;
    filter: blur(20px);
    transition: var(--transition-smooth);
    z-index: -2;
}

.game-card:hover .card-glow {
    opacity: 0.6;
}

.card-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.game-icon {
    font-size: 5rem;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 30px var(--color-purple-glow));
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.game-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--color-text-primary);
}

.game-subtitle {
    font-size: 1.1rem;
    color: var(--color-purple-light);
    margin-bottom: 2rem;
    font-weight: 600;
}

.play-button {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, var(--color-purple-primary), var(--color-purple-dark));
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 1.1rem;
    transition: var(--transition-smooth);
    box-shadow: 0 10px 30px rgba(147, 51, 234, 0.3);
}

.game-card:hover .play-button {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(147, 51, 234, 0.5);
}

.play-button svg {
    transition: var(--transition-smooth);
}

.game-card:hover .play-button svg {
    transform: translateX(5px);
}

/* Game Overlay */
.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.98);
    z-index: 1000;
    display: none;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-overlay.active {
    display: flex;
    opacity: 1;
}

/* Fullscreen Styles to fix "Gray Screen" */
.game-overlay:fullscreen {
    background: #000;
}

.game-overlay:fullscreen .game-controls {
    border-bottom: 2px solid rgba(147, 51, 234, 0.5);
    background: rgba(10, 10, 15, 0.95);
}

.game-overlay:fullscreen .game-container {
    background: #000;
}

.game-overlay:-webkit-full-screen {
    background: #000;
}

.game-overlay:-ms-fullscreen {
    background: #000;
}

.game-controls {
    display: flex;
    gap: 1rem;
    padding: 1rem 2rem;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid rgba(147, 51, 234, 0.3);
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(147, 51, 234, 0.2);
    border: 2px solid rgba(147, 51, 234, 0.4);
    color: var(--color-text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.control-btn:hover {
    background: rgba(147, 51, 234, 0.4);
    border-color: var(--color-purple-primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(147, 51, 234, 0.3);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn svg {
    width: 20px;
    height: 20px;
}

.game-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#game-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        padding: 1.5rem 1rem;
    }

    .clear-cache-btn {
        position: static;
        width: 100%;
        justify-content: center;
    }

    .logo {
        font-size: 2rem;
    }

    .games-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .game-card {
        padding: 2rem 1.5rem;
    }

    .game-icon {
        font-size: 4rem;
    }

    .game-title {
        font-size: 1.5rem;
    }

    .game-controls {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }

    .control-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .control-btn span {
        display: none;
    }

    .loading-status {
        padding: 1.5rem 2rem;
        max-width: 90%;
    }

    .loading-text {
        font-size: 1rem;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}