* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: #faf8ef;
    color: #776e65;
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding-top: 20px;
}

.container {
    width: 100%;
    max-width: 500px;
    padding: 15px;
}

h1 {
    font-size: 48px;
    margin-bottom: 20px;
    margin-top: 0;
}

.score-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.score-box {
    background: #8f7a66;
    padding: 10px 20px;
    border-radius: 3px;
    color: white;
    min-width: 100px;
    text-align: center;
}

.score-label {
    font-size: 13px;
    text-transform: uppercase;
}

#score, #best-score {
    font-size: 20px;
    font-weight: bold;
}

#new-game {
    background: #8f7a66;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 3px;
    cursor: pointer;
    margin-left: auto;
    min-width: 100px;
    font-size: 13px;
    text-transform: uppercase;
}

#new-game:hover, .score-box:hover {
    background: #8a7362;
}

.game-container {
    background: #bbada0;
    padding: 15px;
    border-radius: 6px;
    position: relative;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    position: relative;
}

.grid-cell {
    background: rgba(238, 228, 218, 0.35);
    aspect-ratio: 1;
    border-radius: 3px;
}

#tile-container {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
}

.tile {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 35px;
    font-weight: bold;
    border-radius: 3px;
    transition: transform 100ms ease-in-out;
    width: calc(25% - 11.25px);
    height: calc(25% - 11.25px);
}

/* 方块颜色 */
.tile-2 { background: #eee4da; }
.tile-4 { background: #ede0c8; }
.tile-8 { background: #f2b179; color: white; }
.tile-16 { background: #f59563; color: white; }
.tile-32 { background: #f67c5f; color: white; }
.tile-64 { background: #f65e3b; color: white; }
.tile-128 { background: #edcf72; color: white; }
.tile-256 { background: #edcc61; color: white; }
.tile-512 { background: #edc850; color: white; }
.tile-1024 { background: #edc53f; color: white; }
.tile-2048 { background: #edc22e; color: white; }

.game-explanation {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
}

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

.tile-new {
    animation: pop 200ms ease-in-out;
}

@keyframes merge {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.tile-merged {
    animation: merge 200ms ease-in-out;
} 