:root {
    --text: #fff;
    --border: #bbada0;
    --board-bg: #bbada0;
    --empty-tile: #cdc1b4;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(130deg, #021230 0%, #000200 100%);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

h1 {
    color: var(--text);
    font-size: 50px;
    font-weight: bold;
    text-align: center;
    padding: 20px;
}

.score-container {
    color: var(--text);
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
}

#board {
    width: 400px;
    height: 400px;
    position: relative;
    margin: 20px auto;
    border-radius: 6px;
}

.tile {
    width: 95px;
    height: 95px;
    position: absolute;
    border-radius: 3px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 36px;
    color: #776e65;
    background-color: var(--empty-tile);
}

.tile-2 {
    background-color: #eee4da;
    color: #776e65;
}

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

.tile-8 {
    background-color: #f2b179;
    color: #f9f6f2;
}

.tile-16 {
    background-color: #f59563;
    color: #f9f6f2;
}

.tile-32 {
    background-color: #f67c5f;
    color: #f9f6f2;
}

.tile-64 {
    background-color: #f65e3b;
    color: #f9f6f2;
}

.tile-128 {
    background-color: #edcf72;
    color: #f9f6f2;
    font-size: 32px;
}

.tile-256 {
    background-color: #edcc61;
    color: #f9f6f2;
    font-size: 32px;
}

.tile-512 {
    background-color: #edc850;
    color: #f9f6f2;
    font-size: 32px;
}

.tile-1024 {
    background-color: #edc53f;
    color: #f9f6f2;
    font-size: 28px;
}

.tile-2048 {
    background-color: #edc22e;
    color: #f9f6f2;
    font-size: 28px;
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.8);
}

.tile-4096 {
    background-color: #3c3a32;
    color: #f9f6f2;
    font-size: 28px;
}

.tile-8192 {
    background-color: #3c3a32;
    color: #f9f6f2;
    font-size: 28px;
}

.reset-btn {
    border: none;
    border-radius: 5px;
    background-color: #8f7a66;
    color: #f9f6f2;
    font-size: 15px;
    cursor: pointer;
    padding: 5px;
}

.reset-btn:hover {
    background-color: #9f8b77;
}

.mobile {
    display: none;
    margin-top: 20px;
}

button {
    border: none;
    border-radius: 5px;
    background-color: #8f7a66;
    color: #f9f6f2;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    height: 50px;
    width: 80px;
    margin: 5px;
    transition: background-color 0.2s;
}

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

button:active {
    background-color: #7f6a56;
}

@media screen and (max-width: 500px) {
    #board {
        width: 320px;
        height: 320px;
        padding: 8px;
    }

    .tile {
        width: 72px;
        height: 72px;
        font-size: 28px;
    }

    .tile-128, .tile-256, .tile-512 {
        font-size: 24px;
    }

    .tile-1024, .tile-2048, .tile-4096, .tile-8192 {
        font-size: 20px;
    }

    h1 {
        font-size: 36px;
    }
}

@media screen and (max-width: 1024px) {
    .mobile {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}

.lr {
    display: flex;
    flex-direction: row;
    justify-content: center;
}

.up,
.down,
.left,
.right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}