body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #1e1e2f, #2b2b45);
    color: white;
    text-align: center;
    margin: 0;

}

.main-container {
    text-align: center;
    padding: 30px 0;
}

hr {
    width: 500px;
}

.game-wrapper {
    width: 400px;
    margin: 0 auto;
    text-align: center;
}

#restart-btn {
    margin-top: 25px;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;

    background: linear-gradient(45deg, #6f42c1, #4e73df);
    border: none;
    border-radius: 25px;
    color: white;
    cursor: pointer;

    transition: 0.2s ease;
}

#restart-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

#board {
    width: 400px;
    height: 400px;

    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 10px;

    margin: 20px auto;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tile {
    width: 90px;
    height: 90px;

    border-radius: 15px;
    font-size: 28px;
    font-weight: 600;

    display: flex;
    justify-content: center;
    align-items: center;

    transition: all 0.2s ease;
    box-shadow: 0 8px 15px rgba(0,0,0,0.3);
}

.controls {
    display: none;
}

@keyframes pop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    70% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
    }
}

.new-tile {
    animation: pop 0.2s ease forwards;
}

@keyframes mergePop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.25);
    }
    100% {
        transform: scale(1);
    }
}

.merge {
    animation: mergePop 0.2s ease;
}

/* colored tiles */

.x2 { background-color: #4e73df; color: white; }
.x4 { background-color: #1cc88a; color: white; }
.x8 { background-color: #36b9cc; color: white; }
.x16 { background-color: #f6c23e; color: white; }
.x32 { background-color: #e74a3b; color: white; }
.x64 { background-color: #fd7e14; color: white; }
.x128 { background-color: #9b59b6; color: white; }
.x256 { background-color: #20c997; color: white; }
.x512 { background-color: #6610f2; color: white; }
.x1024 { background-color: #ff6f61; color: white; }
.x2048 { background-color: gold; color: black; }

@media (max-width: 768px) {
    
    html, body {
        overflow-x: hidden;
    }

     #board {
        width: 90vw;
        height: 90vw;
        max-width: 360px;
        max-height: 360px;

        padding: 10px;
        gap: 10px;
    }

    .tile {
        flex: 1 0 calc(25% - 10px);
        height: calc((90vw - 40px) / 4);
        font-size: 18px;
    }
    
    .controls {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        margin-top: 25px;
    }

    .controls div {
        display: flex;
        gap: 15px;
    }

    .control-btn {
        width: 55px;
        height: 55px;
        font-size: 20px;
        font-weight: bold;
        border-radius: 12px;
        border: none;
        cursor: pointer;

        background: linear-gradient(45deg, #4e73df, #6f42c1);
        color: white;

        transition: 0.2s ease;
    }
}
