/* 让body作为弹性容器，居中整个游戏容器 */
body {
    font-family: "Arial", sans-serif;
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    margin: 0;
    display: flex;
    justify-content: center;
    /* 水平居中 */
    align-items: center;
    /* 垂直居中 */
    height: 100vh;
    /* 视口高度 */
    padding: 20px; /* 内边距 */

    -webkit-tap-highlight-color: transparent;
}

.container {
    width: 90vw;
    max-width: 400px;
    background: #faf8ef;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    padding: 20px;
    box-sizing: border-box;
}

.logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.logo-container img {
    width: 100%;       /* 宽度填满父容器，自动适应 */
    height: auto;      /* 高度按比例自适应 */
    max-width: 300px;  /* 最大宽度限制，防止过大 */
    user-select: none;
    pointer-events: none;
}


.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#restart {
    background-color: #ff6f61;
    border: none;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
    user-select: none;
}

#restart:hover {
    background-color: #ff3b2f;
}

.score-container {
    display: flex;
    gap: 15px;
    font-size: 16px;
    font-weight: bold;
    color: #776e65;
    user-select: none;
}

.game-area {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: linear-gradient(45deg, #bbada0, #ccc0b3);
    border-radius: 10px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 10px;
    padding: 10px;
    box-sizing: border-box;
    user-select: none;
    touch-action: none;
}

.tile {
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    color: #776e65;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.tile-0 {
    background-color: #cdc1b4;
}

.tile-2 {
    background-color: #eee4da;
    color: #776e65;
}

.tile-4 {
    background-color: #ede0c8;
    color: #776e65;
}

.tile-8 {
    background-color: #f2b179;
    color: white;
}

.tile-16 {
    background-color: #f59563;
    color: white;
}

.tile-32 {
    background-color: #f67c5f;
    color: white;
}

.tile-64 {
    background-color: #f65e3b;
    color: white;
}

.tile-128 {
    background-color: #edcf72;
    color: white;
}

.tile-256 {
    background-color: #edcc61;
    color: white;
}

.tile-512 {
    background-color: #edc850;
    color: white;
}

.tile-1024 {
    background-color: #edc53f;
    color: white;
}

.tile-2048 {
    background-color: #edc22e;
    color: white;
}

@media (max-width: 400px) {
    .container {
        max-width: 90vw;
    }

    .tile {
        font-size: 5vw;
    }
}