.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Add padding around game for larger touch area */
    padding: 20px;
    touch-action: none;
}

#game {
    display: grid;
    grid-template-columns: repeat(4, 80px);
    grid-template-rows: repeat(4, 80px);
    gap: 10px;
    touch-action: none; /* Disable default touch behaviors */
    user-select: none; /* Prevent text selection */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.tile {
    width: 80px;
    height: 80px;
    background-color: #b0c4de;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    color: #2f4f4f;
}

#instructions {
    margin-top: 20px;
    text-align: center;
}

/* Game Over Overlay */
.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.game-over-content {
    background-color: rgba(255, 255, 255, 0.7);
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
}

.game-over-title {
    font-size: 3rem;
    color: #333;
    margin-bottom: 20px;
    font-weight: bold;
    text-transform: uppercase;
}

.game-over-score {
    font-size: 1.5rem;
    color: #666;
    margin-bottom: 30px;
}

.restart-button {
    background-color: #b0c4de;
    color: #2f4f4f;
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-transform: uppercase;
}

.restart-button:hover {
    background-color: #9fb8d9;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    body {
        padding: 20px 10px;
        overflow-x: hidden; /* Prevent horizontal scrolling */
    }

    #game {
        grid-template-columns: repeat(4, 70px);
        grid-template-rows: repeat(4, 70px);
        gap: 8px;
    }

    .tile {
        width: 70px;
        height: 70px;
        font-size: 20px;
    }

    #instructions {
        font-size: 14px;
        margin-top: 15px;
    }
}

@media (max-width: 480px) {
    #game {
        grid-template-columns: repeat(4, 70px);
        grid-template-rows: repeat(4, 70px);
        gap: 6px;
    }

    .tile {
        width: 70px;
        height: 70px;
        font-size: 18px;
    }
}
