.game-container {
    max-width: 500px;
    margin: 0 auto;
}

.game-board-wrapper {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto;
    padding: 10px;
    background: #bbada0;
    border-radius: 6px;
    user-select: none;
    touch-action: none;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 10px;
    width: 100%;
    height: 100%;
}

.grid-cell {
    width: 100%;
    height: 100%;
    background: rgba(238, 228, 218, 0.35);
    border-radius: 3px;
}

.tile-container {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 2;
}

.tile {
    position: absolute;
    width: 62.5px; /* (300 - 50 gap) / 4 approx */
    height: 62.5px;
    border-radius: 3px;
    background: #eee4da;
    color: #776e65;
    font-weight: bold;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s, background-color 0.1s;
    z-index: 10;
}

/* Base positions for 4x4 grid */
.tile-pos-0-0 { transform: translate(0px, 0px); }
.tile-pos-0-1 { transform: translate(72.5px, 0px); }
.tile-pos-0-2 { transform: translate(145px, 0px); }
.tile-pos-0-3 { transform: translate(217.5px, 0px); }
.tile-pos-1-0 { transform: translate(0px, 72.5px); }
.tile-pos-1-1 { transform: translate(72.5px, 72.5px); }
.tile-pos-1-2 { transform: translate(145px, 72.5px); }
.tile-pos-1-3 { transform: translate(217.5px, 72.5px); }
.tile-pos-2-0 { transform: translate(0px, 145px); }
.tile-pos-2-1 { transform: translate(72.5px, 145px); }
.tile-pos-2-2 { transform: translate(145px, 145px); }
.tile-pos-2-3 { transform: translate(217.5px, 145px); }
.tile-pos-3-0 { transform: translate(0px, 217.5px); }
.tile-pos-3-1 { transform: translate(72.5px, 217.5px); }
.tile-pos-3-2 { transform: translate(145px, 217.5px); }
.tile-pos-3-3 { transform: translate(217.5px, 217.5px); }

/* Tile Colors */
.tile-2 { background: #eee4da; }
.tile-4 { background: #ede0c8; }
.tile-8 { background: #f2b179; color: #f9f6f2; }
.tile-16 { background: #f59563; color: #f9f6f2; }
.tile-32 { background: #f67c5f; color: #f9f6f2; }
.tile-64 { background: #f65e3b; color: #f9f6f2; }
.tile-128 { background: #edcf72; color: #f9f6f2; font-size: 20px; }
.tile-256 { background: #edcc61; color: #f9f6f2; font-size: 20px; }
.tile-512 { background: #edc850; color: #f9f6f2; font-size: 20px; }
.tile-1024 { background: #edc53f; color: #f9f6f2; font-size: 16px; }
.tile-2048 { background: #edc22e; color: #f9f6f2; font-size: 16px; }

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(238, 228, 218, 0.73);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 6px;
}

.dark-theme .overlay {
    background: rgba(0, 0, 0, 0.7);
}

.d-none { display: none !important; }

@media (max-width: 400px) {
    .game-board-wrapper {
        width: 260px;
        height: 260px;
    }
    .tile {
        width: 52.5px;
        height: 52.5px;
    }
    .tile-pos-0-1 { transform: translate(62.5px, 0px); }
    .tile-pos-0-2 { transform: translate(125px, 0px); }
    /* ... and so on, but using percentages or flex might be better for responsiveness.
       For now, let's stick to a fixed size and scale it. */
}
