/* 游戏容器样式 */
.game-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 15px;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

/* 游戏头部样式 */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* 分数容器样式 */
.scores-container {
    display: flex;
    gap: 10px;
}

.score-box {
    background: #bbada0;
    padding: 10px 15px;
    border-radius: 3px;
    color: white;
    text-align: center;
}

.score-title {
    font-size: 14px;
    color: #eee4da;
}

.score-value {
    font-size: 20px;
    font-weight: bold;
}

/* 新游戏按钮样式 */
.new-game-button {
    background: #8f7a66;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
}

.new-game-button:hover {
    background: #7f6a56;
}

/* 网格容器样式 */
.grid-container {
    position: relative;
    background: #bbada0;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    box-sizing: border-box;
}

/* 网格单元格样式 */
.grid-cell {
    background: rgba(238, 228, 218, 0.35);
    border-radius: 3px;
    aspect-ratio: 1;
}

/* 方块容器样式 */
.tile-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px;
    box-sizing: border-box;
}

/* 方块样式 */
.tile {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 35px;
    font-weight: bold;
    border-radius: 3px;
    background: #eee4da;
    color: #776e65;
    transition: all 0.15s ease;
}

/* 方块颜色 */
.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;
    font-size: 30px;
}
.tile-256 { 
    background: #edcc61; 
    color: white;
    font-size: 30px;
}
.tile-512 { 
    background: #edc850; 
    color: white;
    font-size: 30px;
}
.tile-1024 { 
    background: #edc53f; 
    color: white;
    font-size: 25px;
}
.tile-2048 { 
    background: #edc22e; 
    color: white;
    font-size: 25px;
}

/* 新方块动画 */
.tile-new {
    animation: appear 0.2s ease;
}

@keyframes appear {
    0% { 
        transform: scale(0);
    }
    100% { 
        transform: scale(1);
    }
}

/* 游戏消息样式 */
.game-message {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(238, 228, 218, 0.73);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 6px;
    z-index: 100;
}

.game-message p {
    font-size: 60px;
    font-weight: bold;
    margin: 0 0 20px;
}

.game-message.game-won {
    background: rgba(237, 194, 46, 0.5);
    color: #f9f6f2;
}

.game-message.game-over {
    background: rgba(238, 228, 218, 0.73);
    color: #776e65;
}

.retry-button {
    background: #8f7a66;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
}

.retry-button:hover {
    background: #7f6a56;
}

/* 响应式设计 */
@media screen and (max-width: 520px) {
    .game-container {
        padding: 10px;
    }

    .grid-container {
        gap: 5px;
        padding: 5px;
    }

    .tile {
        font-size: 25px;
    }

    .tile-128,
    .tile-256,
    .tile-512 {
        font-size: 20px;
    }

    .tile-1024,
    .tile-2048 {
        font-size: 15px;
    }

    .game-message p {
        font-size: 40px;
    }
}