body {
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: #faf8ef;
}

.container {
    text-align: center;
}

h1 {
    color: #776e65;
    font-size: 3rem;
    margin-bottom: 20px;
}

h2 {
    color: #776e65;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

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

.score, .best-score {
    background-color: #bbada0;
    color: white;
    padding: 10px 20px;
    margin: 0 10px;
    border-radius: 5px;
    font-weight: bold;
}

.game-container {
    background-color: #bbada0;
    border-radius: 5px;
    width: 400px;
    height: 400px;
    padding: 10px;
    margin: 0 auto;
    position: relative;
}

.game-over {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(238, 228, 218, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.8s ease-in-out;
    z-index: 10;
}

.game-over-text {
    font-size: 3rem;
    font-weight: bold;
    color: #776e65;
    text-align: center;
    animation: scaleIn 0.5s ease-in-out;
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 10px;
    width: 100%;
    height: 100%;
}

.grid-cell {
    background-color: #cdc1b4;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    color: #776e65;
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
}

.grid-cell > span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.grid-cell.tile-2 { background-color: #eee4da; }
.grid-cell.tile-4 { background-color: #ede0c8; }
.grid-cell.tile-8 { background-color: #f2b179; color: white; }
.grid-cell.tile-16 { background-color: #f59563; color: white; }
.grid-cell.tile-32 { background-color: #f67c5f; color: white; }
.grid-cell.tile-64 { background-color: #f65e3b; color: white; }
.grid-cell.tile-128 { background-color: #edcf72; color: white; font-size: 1.5rem; }
.grid-cell.tile-256 { background-color: #edcc61; color: white; font-size: 1.5rem; }
.grid-cell.tile-512 { background-color: #edc850; color: white; font-size: 1.5rem; }
.grid-cell.tile-1024 { background-color: #edc53f; color: white; font-size: 1.2rem; }
.grid-cell.tile-2048 { background-color: #edc22e; color: white; font-size: 1.2rem; }

.game-controls {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

#new-game, #toggle-sound {
    background-color: #8f7a66;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#new-game:hover, #toggle-sound:hover {
    background-color: #9f8a76;
}

#toggle-sound {
    padding: 10px 15px;
}

#toggle-sound.sound-off {
    opacity: 0.7;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}
