/* 2048 Game Styles */

#game-container {
    max-width: 500px;
    margin: 20px auto;
    padding: 20px;
    background: #faf8ef;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

body.dark-mode #game-container {
    background: #2c3e50;
}

h1 {
    text-align: center;
    color: #776e65;
    font-size: 3rem;
    margin-bottom: 10px;
}

body.dark-mode h1 {
    color: #ecf0f1;
}

#score-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.score-box {
    background: #bbada0;
    padding: 10px 25px;
    border-radius: 6px;
    text-align: center;
    min-width: 100px;
}

body.dark-mode .score-box {
    background: #34495e;
}

.score-label {
    display: block;
    color: #eee4da;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.score-box span:last-child {
    display: block;
    color: white;
    font-size: 1.8rem;
    font-weight: bold;
}

#game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.instructions {
    color: #776e65;
    margin: 0;
}

body.dark-mode .instructions {
    color: #bdc3c7;
}

#new-game-btn {
    background: #8f7a66;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

#new-game-btn:hover {
    background: #9f8b77;
}

#grid-container {
    position: relative;
    background: #bbada0;
    border-radius: 6px;
    padding: 10px;
    width: 400px;
    height: 400px;
    margin: 0 auto;
}

body.dark-mode #grid-container {
    background: #34495e;
}

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

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

.tile-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px;
}

.tile {
    position: absolute;
    width: 87.5px;
    height: 87.5px;
    border-radius: 3px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    transition: all 0.15s ease-in-out;
    animation: appear 0.2s ease-in-out;
}

@keyframes appear {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes merge {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.tile-2 { background: #eee4da; color: #776e65; }
.tile-4 { background: #ede0c8; color: #776e65; }
.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: 1.7rem; }
.tile-256 { background: #edcc61; color: #f9f6f2; font-size: 1.7rem; }
.tile-512 { background: #edc850; color: #f9f6f2; font-size: 1.7rem; }
.tile-1024 { background: #edc53f; color: #f9f6f2; font-size: 1.4rem; }
.tile-2048 { background: #edc22e; color: #f9f6f2; font-size: 1.4rem; }
.tile-super { background: #3c3a32; color: #f9f6f2; font-size: 1.2rem; }

body.dark-mode .tile-2 { background: #34495e; color: #ecf0f1; }
body.dark-mode .tile-4 { background: #2c3e50; color: #ecf0f1; }
body.dark-mode .tile-8,
body.dark-mode .tile-16,
body.dark-mode .tile-32,
body.dark-mode .tile-64 { background: #e67e22; color: #f9f6f2; }
body.dark-mode .tile-128,
body.dark-mode .tile-256,
body.dark-mode .tile-512 { background: #f39c12; color: #f9f6f2; }
body.dark-mode .tile-1024,
body.dark-mode .tile-2048 { background: #f1c40f; color: #2c3e50; }
body.dark-mode .tile-super { background: #9b59b6; color: #f9f6f2; }

#game-message {
    text-align: center;
    margin-top: 20px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #776e65;
    min-height: 40px;
}

body.dark-mode #game-message {
    color: #ecf0f1;
}

.game-footer {
    text-align: center;
    margin-top: 20px;
    color: #776e65;
}

body.dark-mode .game-footer {
    color: #bdc3c7;
}

@media (max-width: 520px) {
    #grid-container {
        width: 280px;
        height: 280px;
    }
    
    .tile {
        width: 60px;
        height: 60px;
        font-size: 1.3rem;
    }
    
    .tile-128, .tile-256, .tile-512 { font-size: 1.1rem; }
    .tile-1024, .tile-2048 { font-size: 0.9rem; }
    .tile-super { font-size: 0.7rem; }
    
    h1 { font-size: 2rem; }
}
