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

html {
    overflow: hidden;
}

body {
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    background: #faf8ef;
    overflow: hidden;
}

.game-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    font-size: 36px;
    color: #776e65;
    margin-bottom: 15px;
}

.score {
    font-size: 18px;
    margin-bottom: 15px;
    color: #776e65;
}

p {
    margin-bottom: 20px;
    padding: 0 20px;
    color: #776e65;
}

.grid {
    --size: min(70px, calc((100vw - 40px) / 4));
    --gap: 6px;
    display: grid;
    grid-template-columns: repeat(4, var(--size));
    grid-template-rows: repeat(4, var(--size));
    gap: var(--gap);
    background: #bbada0;
    padding: var(--gap);
    border-radius: 8px;
}

.tile {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(16px, 4vw, 24px);
    font-weight: bold;
    border-radius: 6px;
    background: #cdc1b4;
    color: #776e65;
    transition: all 0.1s;
}

.tile[data-value="2"] { background: #eee4da; }
.tile[data-value="4"] { background: #ede0c8; }
.tile[data-value="8"] { background: #f2b179; color: #f9f6f2; }
.tile[data-value="16"] { background: #f59563; color: #f9f6f2; }
.tile[data-value="32"] { background: #f67c5f; color: #f9f6f2; }
.tile[data-value="64"] { background: #f65e3b; color: #f9f6f2; }
.tile[data-value="128"] { background: #edcf72; color: #f9f6f2; }
.tile[data-value="256"] { background: #edcc61; color: #f9f6f2; }
.tile[data-value="512"] { background: #edc850; color: #f9f6f2; }
.tile[data-value="1024"] { background: #edc53f; color: #f9f6f2; }
.tile[data-value="2048"] { background: #edc22e; color: #f9f6f2; }

#reset {
    margin-top: 20px;
    padding: 12px 24px;
    font-size: 16px;
    background: #8f7a66;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    min-height: 44px;
}

#reset:hover {
    background: #9f8a76;
}

@media (min-width: 400px) {
    .grid {
        --size: min(80px, calc((100vw - 40px) / 4));
        --gap: 8px;
    }
}

@media (min-width: 768px) {
    .grid {
        --size: 100px;
        --gap: 10px;
    }
    h1 {
        font-size: 48px;
        margin-bottom: 20px;
    }
    .score {
        font-size: 24px;
        margin-bottom: 20px;
    }
}
