html, body {
    margin: 0;
    padding: 0;
    background: #faf8ef;
    color: #776e65;
    font-family: "Clear Sans", "Helvetica Neue", Arial, sans-serif;
    font-size: 18px;
}

body {
    margin: 80px 0;
}

.game-container {
    width: 500px;
    margin: 0 auto;
}

h1.title {
    font-size: 80px;
    font-weight: bold;
    margin: 0;
    display: inline-block;
}

.game-header {
    margin-bottom: 30px;
}

.game-header h1 {
    font-size: 80px;
    font-weight: bold;
    margin: 0;
    color: #776e65;
    float: left;
}

.score-container {
    float: right;
    text-align: right;
}

.score-container:after {
    content: "";
    display: block;
    clear: both;
}

.score-box {
    position: relative;
    display: inline-block;
    background: #bbada0;
    padding: 3px 25px;
    font-size: 18px;
    height: 25px;
    line-height: 47px;
    font-weight: bold;
    border-radius: 3px;
    color: white;
    margin-left: 5px;
    text-align: center;
}

.score-box:after {
    position: absolute;
    width: 100%;
    top: 10px;
    left: 0;
    text-transform: uppercase;
    font-size: 13px;
    line-height: 13px;
    text-align: center;
    color: #eee4da;
}

.score-label {
    position: absolute;
    width: 100%;
    top: 10px;
    left: 0;
    text-transform: uppercase;
    font-size: 13px;
    line-height: 13px;
    text-align: center;
    color: #eee4da;
}

.score {
    font-size: 25px;
}

.game-info {
    margin-bottom: 30px;
    line-height: 1.65;
}

.game-info:after {
    content: "";
    display: block;
    clear: both;
}

.game-intro {
    float: left;
    line-height: 42px;
    margin-bottom: 0;
}

.restart-button {
    display: inline-block;
    background: #8f7a66;
    border-radius: 3px;
    padding: 0 20px;
    text-decoration: none;
    color: #f9f6f2;
    height: 40px;
    line-height: 42px;
    cursor: pointer;
    float: right;
    font-weight: bold;
    font-size: 18px;
    border: none;
}

.restart-button:hover {
    background: #9f8a76;
}

.grid-container {
    background: #bbada0;
    border-radius: 6px;
    width: 500px;
    height: 500px;
    position: relative;
    box-sizing: border-box;
    padding: 10px;
}

.grid-row {
    margin-bottom: 10px;
}

.grid-row:last-child {
    margin-bottom: 0;
}

.grid-cell {
    width: 107.5px;
    height: 107.5px;
    background: rgba(238, 228, 218, 0.35);
    border-radius: 6px;
    float: left;
    margin-right: 10px;
}

.grid-cell:last-child {
    margin-right: 0;
}

.tile-container {
    position: absolute;
    z-index: 2;
}

.tile {
    width: 107.5px;
    height: 107.5px;
    background: #eee4da;
    position: absolute;
    border-radius: 6px;
    font-weight: bold;
    text-align: center;
    line-height: 107.5px;
    font-size: 55px;
    transition: 150ms ease-in-out;
    transition-property: transform;
    color: #776e65;
}

.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: 45px; }
.tile-256 { background: #edcc61; color: #f9f6f2; font-size: 45px; }
.tile-512 { background: #edc850; color: #f9f6f2; font-size: 45px; }
.tile-1024 { background: #edc53f; color: #f9f6f2; font-size: 35px; }
.tile-2048 { background: #edc22e; color: #f9f6f2; font-size: 35px; }

.tile-super { background: #3c3a32; color: #f9f6f2; font-size: 30px; }

.game-message {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(255, 255, 255, 0.73);
    z-index: 100;
    text-align: center;
    border-radius: 6px;
}

.game-message p {
    font-size: 60px;
    font-weight: bold;
    height: 60px;
    line-height: 60px;
    margin-top: 222px;
}

.game-message .lower {
    display: block;
    margin-top: 59px;
}

.game-message.game-won {
    background: rgba(237, 194, 46, 0.5);
    color: #f9f6f2;
}

.game-message.game-won p {
    font-size: 60px;
}

.game-message.game-over {
    background: rgba(238, 228, 218, 0.73);
    color: #776e65;
}

.game-message.game-over p {
    font-size: 60px;
}

.game-explanation {
    margin-top: 30px;
    line-height: 1.65;
}

.game-explanation hr {
    border: none;
    border-bottom: 1px solid #d8d4d0;
    margin-top: 20px;
    margin-bottom: 30px;
}

@media screen and (max-width: 520px) {
    html, body {
        font-size: 15px;
    }
    
    body {
        margin: 20px 0;
        padding: 0 20px;
    }
    
    .game-container {
        width: 280px;
        margin: 0 auto;
    }
    
    .game-header h1 {
        font-size: 50px;
    }
    
    .grid-container {
        width: 280px;
        height: 280px;
        padding: 5px;
    }
    
    .grid-cell {
        width: 62.5px;
        height: 62.5px;
        margin-right: 5px;
    }
    
    .grid-row {
        margin-bottom: 5px;
    }
    
    .tile {
        width: 62.5px;
        height: 62.5px;
        line-height: 62.5px;
        font-size: 32px;
    }
    
    .tile-128 { font-size: 28px; }
    .tile-256 { font-size: 28px; }
    .tile-512 { font-size: 28px; }
    .tile-1024 { font-size: 22px; }
    .tile-2048 { font-size: 22px; }
    .tile-super { font-size: 18px; }
    
    .game-message p {
        font-size: 30px;
        margin-top: 100px;
    }
}