* {
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #fbfbfb;
    color: #776e65;
    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;
}

h1 {
    font-size: 48px;
    font-weight: bold;
    color: #776e65;
}

.scores-container {
    display: flex;
    gap: 10px;
}

.score-box {
    background: #bbada0;
    padding: 10px 20px;
    border-radius: 12px;
    text-align: center;
    color: white;
    min-width: 100px;
}

.score-label {
    display: block;
    font-size: 14px;
    text-transform: uppercase;
}

#score, #best-score {
    display: block;
    font-size: 24px;
    font-weight: bold;
}

.game-container {
    position: relative;
    background: #bbada0;
    padding: 12px;
    border-radius: 12px;
    margin-top: 20px;
}

.grid-container {
    position: relative;
    display: grid;
    grid-gap: 12px;
    background: #bbada0;
    border-radius: 8px;
    padding: 12px;
}

.grid-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 12px;
}

.grid-cell {
    width: 100%;
    padding-bottom: 100%;
    background: rgba(238, 228, 218, 0.35);
    border-radius: 8px;
}

.tile-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    pointer-events: none;
}

.tile {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #eee4da;
    border-radius: 8px;
    font-size: 36px;
    font-weight: bold;
    transition: all 0.15s ease;
    z-index: 10;
    text-align: center;
    line-height: 1;
}

.tile-2 { background: #eee4da; }
.tile-4 { background: #ede0c8; }
.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: 28px;
    box-shadow: 0 0 10px rgba(243, 215, 116, 0.5);
}
.tile-256 {
    background: #edcc61;
    color: white;
    font-size: 28px;
    box-shadow: 0 0 10px rgba(243, 215, 116, 0.6);
}
.tile-512 {
    background: #edc850;
    color: white;
    font-size: 28px;
    box-shadow: 0 0 10px rgba(243, 215, 116, 0.7);
}
.tile-1024 {
    background: #edc53f;
    color: white;
    font-size: 24px;
    box-shadow: 0 0 10px rgba(243, 215, 116, 0.8);
}
.tile-2048 {
    background: #edc22e;
    color: white;
    font-size: 24px;
    box-shadow: 0 0 10px rgba(243, 215, 116, 0.9);
}

.game-message {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(238, 228, 218, 0.73);
    z-index: 100;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 12px;
}

.game-message.game-over {
    display: flex;
}

.game-message p {
    font-size: 60px;
    font-weight: bold;
    margin-bottom: 20px;
}

.retry-button {
    display: inline-block;
    background: #8f7a66;
    border-radius: 8px;
    padding: 12px 24px;
    color: white;
    text-decoration: none;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.15s ease;
}

.retry-button:hover {
    background: #7f6a56;
}

.game-explanation {
    margin-top: 20px;
    text-align: center;
    font-size: 16px;
    line-height: 1.5;
} 