:root {
    --bg-dark: #0a0b10;
    --card-bg: rgba(255, 255, 255, 0.05);
    --accent-orange: #ff9d00;
    --accent-gold: #ffd700;
    --grid-bg: #1e1e24;
    --cell-bg: rgba(255, 255, 255, 0.03);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

.game-page-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 0 20px;
}

.ambient-glow {
    position: fixed;
    top: -10%;
    left: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(255, 157, 0, 0.05) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

/* Game layout */

.scores-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.scores {
    display: flex;
    gap: 10px;
}

.score-box {
    background: var(--card-bg);
    padding: 8px 16px;
    border-radius: 12px;
    min-width: 80px;
    text-align: center;
    border: 1px solid var(--glass-border);
}

.score-box .label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 700;
    margin-bottom: 2px;
}

.score-box span:not(.label) {
    font-size: 1.1rem;
    font-weight: 800;
}

/* Main */
.game-header {
    text-align: center;
    padding: 30px 0 20px;
}

.game-header h1 {
    font-size: 2.2rem;
    background: linear-gradient(to right, #fff, var(--accent-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Grid Container */
.game-board-wrapper {
    background: var(--grid-bg);
    padding: 12px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin: 0 auto;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 12px;
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
}

.grid-cell {
    background: var(--cell-bg);
    border-radius: 8px;
}

/* Tiles */
.tile-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
}

.tile {
    position: absolute;
    width: calc(25% - 12px);
    height: calc(25% - 12px);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    font-weight: 800;
    transition: all 0.1s ease-in-out;
    animation: appear 0.2s ease-in-out forwards;
}

@keyframes appear {
    0% { opacity: 0; transform: scale(0); }
    100% { opacity: 1; transform: scale(1); }
}

/* Tile Colors */
.tile-2 { background: #eee4da; color: #776e65; }
.tile-4 { background: #ede0c8; color: #776e65; }
.tile-8 { background: #f2b179; color: white; }
.tile-16 { background: #f59563; color: white; }
.tile-32 { background: #f67c5f; color: white; }
.tile-64 { background: #f65e3b; color: white; }
.tile-128 { background: #edcf72; color: white; font-size: 1.5rem; box-shadow: 0 0 10px var(--accent-gold); }
.tile-256 { background: #edcc61; color: white; font-size: 1.5rem; box-shadow: 0 0 15px var(--accent-gold); }
.tile-512 { background: #edc850; color: white; font-size: 1.5rem; }
.tile-1024 { background: #edc53f; color: white; font-size: 1.2rem; }
.tile-2048 { background: #edc22e; color: white; font-size: 1.2rem; box-shadow: 0 0 30px var(--accent-gold); }

/* Tools */
.game-controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 25px;
}

.btn-tool {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-tool:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-orange);
}

.btn-restart {
    grid-column: span 2;
    background: var(--accent-orange);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    margin-top: 5px;
}

.how-to-play {
    margin-top: 30px;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.how-to-play h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    margin-bottom: 10px;
}

.how-to-play p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.overlay-content {
    text-align: center;
}

.overlay-content h2 {
    font-size: 3rem;
    margin-bottom: 20px;
}

.overlay-content button {
    background: var(--accent-orange);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    font-weight: 800;
    cursor: pointer;
}
