:root {
    --tile-size: 80px;
    --grid-gap: 10px;
    --board-padding: 10px;
}

@media (max-width: 500px) {
    :root {
        --tile-size: 65px;
        --grid-gap: 8px;
        --board-padding: 8px;
    }
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    min-height: calc(100vh - 120px);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: calc(var(--tile-size) * 4 + var(--grid-gap) * 3 + var(--board-padding) * 2);
    margin-bottom: 2rem;
}

.game-header h1 {
    font-size: 3rem;
    margin: 0;
    color: var(--cyan);
    text-shadow: 0 0 10px var(--cyan-glow);
}

.scores {
    display: flex;
    gap: 1rem;
}

.score-box {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    backdrop-filter: blur(5px);
}

.score-label {
    font-size: 0.7rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

.board-container {
    position: relative;
    background: rgba(10, 25, 47, 0.7);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 12px;
    padding: var(--board-padding);
    width: calc(var(--tile-size) * 4 + var(--grid-gap) * 3 + var(--board-padding) * 2);
    height: calc(var(--tile-size) * 4 + var(--grid-gap) * 3 + var(--board-padding) * 2);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, var(--tile-size));
    grid-template-rows: repeat(4, var(--tile-size));
    gap: var(--grid-gap);
}

.cell {
    width: var(--tile-size);
    height: var(--tile-size);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.tiles {
    position: absolute;
    top: var(--board-padding);
    left: var(--board-padding);
    width: calc(100% - var(--board-padding) * 2);
    height: calc(100% - var(--board-padding) * 2);
    pointer-events: none;
}

.tile {
    position: absolute;
    width: var(--tile-size);
    height: var(--tile-size);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    color: white;
    transition: transform 0.15s ease-in-out;
    box-shadow: inset 0 0 10px rgba(255,255,255,0.2), 0 0 15px rgba(0,0,0,0.3);
    backdrop-filter: blur(5px);
    z-index: 10;
}

/* Animations */
@keyframes appear {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}
.tile.new {
    animation: appear 0.2s ease-out;
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}
.tile.merged {
    animation: pop 0.2s ease-out;
}

/* Glassmorphism Tile Colors - Deep blue to cyan to magenta */
.tile-2 { background: rgba(13, 71, 161, 0.8); }
.tile-4 { background: rgba(21, 101, 192, 0.8); }
.tile-8 { background: rgba(25, 118, 210, 0.8); }
.tile-16 { background: rgba(3, 155, 229, 0.8); }
.tile-32 { background: rgba(0, 172, 193, 0.8); }
.tile-64 { background: rgba(0, 188, 212, 0.8); color: white; text-shadow: 0 0 5px rgba(0,0,0,0.5); }
.tile-128 { background: rgba(0, 229, 255, 0.8); color: #000; box-shadow: 0 0 15px rgba(0, 229, 255, 0.6); }
.tile-256 { background: rgba(33, 150, 243, 0.9); }
.tile-512 { background: rgba(103, 58, 183, 0.9); }
.tile-1024 { background: rgba(156, 39, 176, 0.9); }
.tile-2048 { background: rgba(233, 30, 99, 0.9); box-shadow: 0 0 20px rgba(233, 30, 99, 0.8); }
.tile-super { background: rgba(255, 64, 129, 0.9); box-shadow: 0 0 25px rgba(255, 64, 129, 0.8); font-size: 1.5rem;}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 25, 47, 0.85);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.3s;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #0ff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.glass-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.4);
    color: white;
    padding: 0.8rem 1.5rem;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.glass-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
}

.controls-hint {
    margin-top: 1.5rem;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}
