* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Helvetica', sans-serif;
    background: linear-gradient(135deg, #1a472a 0%, #0d2818 100%);
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

.home-button {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(196, 30, 58, 0.9);
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    z-index: 1000;
    transition: all 0.3s;
}

.home-button:hover {
    background: rgba(160, 23, 41, 0.9);
    transform: scale(1.05);
}

/* Snowflakes Animation */
.snowflakes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.snowflake {
    position: absolute;
    top: -10%;
    color: #fff;
    font-size: 1.5em;
    opacity: 0.8;
    animation: fall linear infinite;
}

.snowflake:nth-child(1) { left: 10%; animation-duration: 10s; animation-delay: 0s; }
.snowflake:nth-child(2) { left: 20%; animation-duration: 12s; animation-delay: 2s; }
.snowflake:nth-child(3) { left: 30%; animation-duration: 9s; animation-delay: 4s; }
.snowflake:nth-child(4) { left: 40%; animation-duration: 11s; animation-delay: 1s; }
.snowflake:nth-child(5) { left: 50%; animation-duration: 13s; animation-delay: 3s; }
.snowflake:nth-child(6) { left: 60%; animation-duration: 10s; animation-delay: 5s; }
.snowflake:nth-child(7) { left: 75%; animation-duration: 11s; animation-delay: 2s; }
.snowflake:nth-child(8) { left: 85%; animation-duration: 12s; animation-delay: 4s; }

@keyframes fall {
    0% {
        top: -10%;
        opacity: 0.8;
    }
    100% {
        top: 110%;
        opacity: 0.3;
    }
}

.container {
    max-width: 500px;
    width: 100%;
    position: relative;
    z-index: 10;
}

.header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    font-size: 2.5em;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 15px;
}

.scores {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.score-container {
    background: rgba(187, 173, 160, 0.5);
    padding: 10px 20px;
    border-radius: 8px;
    min-width: 80px;
}

.score-label {
    font-size: 0.8em;
    text-transform: uppercase;
    color: #eee4da;
    margin-bottom: 5px;
}

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

.game-info {
    text-align: center;
    margin-bottom: 20px;
}

.game-info p {
    margin-bottom: 15px;
    font-size: 1.1em;
}

.button {
    background: #c41e3a;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1em;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.button:hover {
    background: #a01729;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.4);
}

.button:active {
    transform: translateY(0);
}

.game-board {
    background: rgba(187, 173, 160, 0.5);
    border-radius: 10px;
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
    position: relative;
}

.cell {
    background: rgba(238, 228, 218, 0.35);
    border-radius: 8px;
    aspect-ratio: 1;
    position: relative;
}

.tile {
    position: absolute;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    border-radius: 8px;
    transition: all 0.15s ease-in-out;
    animation: appear 0.2s;
    line-height: 1;
}

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

.tile.merged {
    animation: pop 0.2s;
}

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

/* Christmas-themed tile colors */
.tile-2 { background: #f4e4d7; 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; }
.tile-256 { background: #edcc61; color: #f9f6f2; }
.tile-512 { background: #edc850; color: #f9f6f2; }
.tile-1024 { background: #edc53f; color: #f9f6f2; font-size: 1.5em; }
.tile-2048 { background: #edc22e; color: #f9f6f2; font-size: 1.5em; }
.tile-super { background: #3c3a32; color: #f9f6f2; font-size: 1.2em; }

/* Tile positions - using grid structure */

.instructions {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 0.9em;
    line-height: 1.6;
}

.game-over, .win-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.game-over-content, .win-content {
    background: linear-gradient(135deg, #c41e3a 0%, #8b1528 100%);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.game-over-content h2, .win-content h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
}

.game-over-content p, .win-content p {
    font-size: 1.3em;
    margin-bottom: 15px;
}

.game-over-content .button, .win-content .button {
    margin: 10px;
}

.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 600px) {
    h1 {
        font-size: 2em;
    }
    
    .tile {
        font-size: 1.5em;
    }
    
    .tile-1024 div:first-child, .tile-2048 div:first-child {
        font-size: 2em;
    }
    
    .tile-super div:first-child {
        font-size: 1.8em;
    }
}
