* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: none;
}

html, body {
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(45deg, #e0f0ff, #ffe0f0);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 500px;
    padding: 20px;
}

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

.title-container {
    flex-grow: 1;
    min-width: 120px;
}

.title-container h1 {
    font-size: 36px;
    color: #4a5b7b;
    margin: 0;
}

.title-container .author {
    font-size: 14px;
    color: #4a5b7b;
    margin: 5px 0 0 0;
}

.score-container {
    background: #7c89a8;
    padding: 10px 20px;
    border-radius: 6px;
    color: white;
    text-align: center;
}

.score-label {
    font-size: 16px;
    font-weight: bold;
}

#score {
    font-size: 24px;
    font-weight: bold;
}

#new-game, #restart {
    background: #6d7ba1;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

#new-game:hover, #restart:hover {
    background: #5d6b91;
}

.game-container {
    background: #7c89a8;
    padding: 15px;
    border-radius: 6px;
    position: relative;
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 15px;
    background: #7c89a8;
}

.cell {
    width: 100%;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    position: relative;
    padding-bottom: 100%;
}

.tile {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 35px;
    font-weight: bold;
    border-radius: 3px;
    transition: all 0.15s ease;
    transform: scale(1);
}

.tile.new {
    animation: appear 0.2s ease;
}

.tile.merge {
    animation: pop 0.2s ease;
}

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

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

.tile-2 { background: #e8f0ff; color: #4a5b7b; }
.tile-4 { background: #d4e5ff; color: #4a5b7b; }
.tile-8 { background: #ffe5f2; color: #4a5b7b; }
.tile-16 { background: #ffd6eb; color: #4a5b7b; }
.tile-32 { background: #ffc7e3; color: #4a5b7b; }
.tile-64 { background: #ffb8dc; color: white; }
.tile-128 { background: #8aacff; color: white; font-size: 30px; }
.tile-256 { background: #729aff; color: white; font-size: 30px; }
.tile-512 { background: #5a88ff; color: white; font-size: 30px; }
.tile-1024 { background: #4377ff; color: white; font-size: 25px; }

.game-over {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.hidden {
    display: none;
}

.game-over h2 {
    font-size: 30px;
    margin-bottom: 20px;
    color: #4a5b7b;
}

.game-over p {
    font-size: 20px;
    margin-bottom: 20px;
    color: #4a5b7b;
} 