body {
    font-family: Arial, sans-serif;
    text-align: center;
    background-color: #faf8ef;
    color: #776e65;
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 500px;
    margin: 0 auto;
}

h1 {
    font-size: 60px;
    margin: 20px 0;
    color: #776e65;
}

.score-container, .best-container {
    display: inline-block;
    background: #bbada0;
    padding: 5px 15px;
    border-radius: 5px;
    color: white;
    margin: 0 5px 20px;
}

.score-title, .best-title {
    font-size: 13px;
    text-transform: uppercase;
}

.score, .best {
    font-size: 25px;
    font-weight: bold;
}

.game-intro {
    margin-bottom: 20px;
}

.game-container {
    position: relative;
    background: #bbada0;
    border-radius: 6px;
    width: 450px;
    height: 450px;
    margin: 0 auto;
    padding: 15px;
    box-sizing: border-box;
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 15px;
    width: 100%;
    height: 100%;
    position: relative; /* Tilelar uchun referens */
}

.grid-cell {
    background: rgba(238, 228, 218, 0.35);
    border-radius: 3px;
    width: 96px;
    height: 96px;

}

.tile {
    position: absolute;
    width: 96px;
    height: 96px;
    display: flex;           /* Flexbox qo'shamiz */
    justify-content: center; /* Gorizontal markazlash */
    align-items: center;     /* Vertikal markazlash */
    font-size: 55px;
    font-weight: bold;
    border-radius: 3px;
    background: #eee4da;
    color: #776e65;
    transition: all 0.1s ease-in-out;
    box-sizing: border-box;   /* Padding va borderlarni hisobga olish */
    padding: 5px;            /* Ichki chetlar */
}

/* Barcha sonlar uchun umumiy stil */
.tile-2, .tile-4, .tile-8, 
.tile-16, .tile-32, .tile-64,
.tile-128, .tile-256, .tile-512,
.tile-1024, .tile-2048 {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Har bir son uchun maxsus font o'lchami */
.tile-2, .tile-4 { font-size: 55px; }
.tile-8, .tile-16 { font-size: 50px; }
.tile-32, .tile-64 { font-size: 45px; }
.tile-128, .tile-256, .tile-512 { font-size: 40px; }
.tile-1024, .tile-2048 { font-size: 35px; }
.restart-button {
    background: #8f7a66;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 20px;
    font-size: 18px;
    cursor: pointer;
    margin-top: 20px;
}

.restart-button:hover {
    background: #9f8b77;
}

.game-over {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(238, 228, 218, 0.73);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 6px;
}

.game-over-text {
    font-size: 60px;
    font-weight: bold;
    color: #776e65;
    margin-bottom: 30px;
}