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

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

.container {
    text-align: center;
    max-width: 500px;
    width: 100%;
}

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

.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.score, .best {
    background-color: #bbada0;
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    font-weight: bold;
    min-width: 120px;
}

.game-board {
    background-color: #bbada0;
    border-radius: 10px;
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.cell {
    background-color: #cdc1b4;
    border-radius: 5px;
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
}

/* 方块颜色 */
.cell-2 {
    background-color: #eee4da;
    color: #776e65;
}

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

.cell-8 {
    background-color: #f2b179;
    color: white;
}

.cell-16 {
    background-color: #f59563;
    color: white;
}

.cell-32 {
    background-color: #f67c5f;
    color: white;
}

.cell-64 {
    background-color: #f65e3b;
    color: white;
}

.cell-128 {
    background-color: #edcf72;
    color: white;
    font-size: 1.8rem;
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.2381), inset 0 0 0 1px rgba(255, 255, 255, 0.1429);
}

.cell-256 {
    background-color: #edcc61;
    color: white;
    font-size: 1.8rem;
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.3175), inset 0 0 0 1px rgba(255, 255, 255, 0.1905);
}

.cell-512 {
    background-color: #edc850;
    color: white;
    font-size: 1.8rem;
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.3968), inset 0 0 0 1px rgba(255, 255, 255, 0.2381);
}

.cell-1024 {
    background-color: #edc53f;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.4762), inset 0 0 0 1px rgba(255, 255, 255, 0.2857);
}

.cell-2048 {
    background-color: #edc22e;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.5556), inset 0 0 0 1px rgba(255, 255, 255, 0.3333);
}

/* 大于2048的方块颜色 */
.cell-super {
    background-color: #3c3a32;
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.5556), inset 0 0 0 1px rgba(255, 255, 255, 0.3333);
}

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

button {
    background-color: #8f7a66;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #9f8b77;
}

button:active {
    transform: scale(0.98);
}

.instructions {
    background-color: #eee4da;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #bbada0;
}

.instructions h3 {
    color: #776e65;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.instructions p {
    color: #776e65;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* 响应式设计 */
@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    .score, .best {
        min-width: auto;
        width: 100%;
        max-width: 200px;
    }
    
    .game-board {
        padding: 10px;
        gap: 10px;
    }
    
    .cell {
        font-size: 1.5rem;
    }
    
    .cell-128, .cell-256, .cell-512 {
        font-size: 1.3rem;
    }
    
    .cell-1024, .cell-2048 {
        font-size: 1.1rem;
    }
    
    .cell-super {
        font-size: 1rem;
    }
    
    button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 360px) {
    .game-board {
        padding: 8px;
        gap: 8px;
    }
    
    .cell {
        font-size: 1.2rem;
    }
    
    .cell-128, .cell-256, .cell-512 {
        font-size: 1.1rem;
    }
    
    .cell-1024, .cell-2048 {
        font-size: 1rem;
    }
    
    .cell-super {
        font-size: 0.9rem;
    }
}