/* 
 * CSS Variables
 * Define global color scheme and other reusable values
 */
:root {
    --bg-color: #1e1e1e;
    --text-color: #ffffff;
    --accent-color: #3f51b5;
    --hover-color: #303f9f;
    --modal-bg: rgba(0, 0, 0, 0.8);
    --modal-content-bg: #121212;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 20px;
    padding: 10px;
}

.game-tile {
    text-align: center;
    background-color: var(--bg-color);
    padding: 10px;
    border-radius: 10px;
    transition: transform 0.2s;
    cursor: pointer;
    aspect-ratio: 1/1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid var(--accent-color);
}

.game-tile:hover {
    transform: scale(1.05);
    border-color: var(--hover-color);
}

.game-tile img {
    width: 100%;
    height: auto;
    max-height: 80%;
    border-radius: 10px;
    object-fit: cover;
}

.game-tile h3 {
    margin-top: 10px;
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    color: var(--text-color);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-bg);
    justify-content: center;
    align-items: center;
}

.modal-content {
    position: relative;
    background-color: var(--modal-content-bg);
    padding: 20px;
    border-radius: 10px;
    width: 95vw;
    height: 95vh;
    max-width: 95vw;
    max-height: 95vh;
    margin: 0;
    touch-action: manipulation;
    display: flex;
    flex-direction: column;
}

iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 10px;
    min-height: 0;
}

@media (max-width: 768px) {
    .modal-content {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        padding: 10px;
    }
}

.close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: var(--text-color);
    font-size: clamp(36px, 5vw, 64px);
    font-weight: bold;
    cursor: pointer;
    padding: 20px;
    z-index: 1001;
    transition: all 0.2s ease;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: clamp(48px, 7vw, 80px);
    height: clamp(48px, 7vw, 80px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    font-size: 24px;
    color: var(--text-color);
    animation: spin 1s linear infinite;
}

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.close:hover {
    color: var(--hover-color);
    transform: scale(1.1);
    background-color: rgba(0, 0, 0, 0.7);
}

@media (max-width: 768px) {
    .close {
        top: 15px;
        right: 15px;
        padding: 15px;
    }
}

@media (max-width: 768px) {
    .game-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .game-tile {
        padding: 8px;
    }
    
    .game-tile h3 {
        font-size: 0.9rem;
    }
    
    .modal-content {
        padding: 15px;
        width: 98%;
        height: 98%;
        margin: 5px;
    }
    
    .close {
        font-size: 30px;
    }
}

@media (max-width: 480px) {
    .game-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    
    .modal-content {
        padding: 10px;
        border-radius: 5px;
    }
    
    .close {
        font-size: 24px;
        padding: 5px;
    }
}