@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

* {
    font-family: "Poppins", sans-serif;
    font-weight: 400;
    font-style: normal;
}

body {
    text-align: center;
    margin: 0;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.game-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
}

h1 {
    color: #fff;
    margin: 0 0 20px 0;
    font-size: 3em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.score-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.score,
.best {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 10px;
    color: white;
    font-weight: bold;
    backdrop-filter: blur(5px);
}

.grid-container {
    position: relative;
    background: #bbada0;
    border-radius: 10px;
    padding: 10px;
    margin: 20px auto;
    width: 340px;
    height: 340px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;

}

.grid-row {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.grid-cell {
    width: 70px;
    height: 70px;
    background: #cdc1b4;
    border-radius: 6px;
    position: relative;

}

.tile {
    position: absolute;
    width: 70px;
    height: 70px;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 35px;
    transition: all 0.15s ease-in-out;
    z-index: 10;
    margin: 15px 0 0 15px;
}

.tile-2 {
    background: #eee4da;
    color: #776e65;
}

.tile-4 {
    background: #ede0c8;
    color: #776e65;
}

.tile-8 {
    background: #f2b179;
    color: #f9f6f2;
}

.tile-16 {
    background: #f59563;
    color: #f9f6f2;
}

.tile-32 {
    background: #f67c5f;
    color: #f9f6f2;
}

.tile-64 {
    background: #f65e3b;
    color: #f9f6f2;
}

.tile-128 {
    background: #edcf72;
    color: #f9f6f2;
    font-size: 30px;
}

.tile-256 {
    background: #edcc61;
    color: #f9f6f2;
    font-size: 30px;
}

.tile-512 {
    background: #edc850;
    color: #f9f6f2;
    font-size: 30px;
}

.tile-1024 {
    background: #edc53f;
    color: #f9f6f2;
    font-size: 25px;
}

.tile-2048 {
    background: #edc22e;
    color: #f9f6f2;
    font-size: 25px;
}

.tile-new {
    animation: appear 0.2s ease-in-out;
}

.tile-merged {
    animation: pop 0.2s ease-in-out;
}

@keyframes appear {
    0% {
        transform: scale(0);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.controls {
    color: white;
    margin: 20px 0;
    font-size: 16px;
}

.new-game-btn {
    background: #8f7a66;
    color: #f9f6f2;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin: 10px;
    transition: background-color 0.2s;
}

.new-game-btn:hover {
    background: #9f8a76;
}

.game-over,
.game-won {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    border-radius: 10px;
    z-index: 100;
}

.game-over h2,
.game-won h2 {
    color: #776e65;
    font-size: 36px;
    margin: 0 0 20px 0;
}

.game-won {
    background: rgba(237, 194, 46, 0.9);
}

.game-won h2 {
    color: #f9f6f2;
}