*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body, html{
    width: 100%;
    height: 100%;
}
body{
    background-color: #fff;
    color: #24292e;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
    font-size: 16px;
    line-height: 1.5;
}
:focus{
    box-shadow: none;
    outline: none;
}
.center{
    position: relative;
    height: 100%;
    width: 100%;
    padding: 20px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
}
.log{
    position: relative;
    left: 0px; top: 0px;
    width: 0px;
    height: 500px;
    background: #eee;
    padding: 0px;
    font-family: monospace;
    font-size: 12px;
    overflow: auto;
    opacity: 0;
    transition: all .3s ease-in-out;
}
.log.show{
    opacity: 1;
    left: 0px; top: 0px;
    width: 250px;
    padding: 10px;
}
.log p{ margin-bottom: 2px;}
.board{
    position: relative;
    width: 500px;
    height: 500px;
    max-width: 100%;
    max-height: 100%;
    box-sizing: content-box;
    border: 1px solid #aaa;
    overflow: hidden;
}
.board > .win-lose-screen{
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0px; left: 0px;
    padding: 40px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.7);
    transition: all 3s ease-in-out;
    opacity: 0;
    color: white;
    overflow: auto;
    pointer-events: none;
}
.board > .win-lose-screen.show{
    pointer-events: all;
    opacity: 1;
}
.board > .background{
    position: absolute;
    top: 0px; left: 0px;
    width: 100%;
    height: 100%;
    display: flex;
    flex-wrap: wrap;
}
.background > span{
    display: block;
    width: 25%;
    height: 25%;
    border: 1px solid #aaa;
}
.board > .elements{
    position: absolute;
    top: 0px; left: 0px;
    width: 100%;
    height: 100%;
}
.elements > span{
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
    width: 25%; height: 25%;
    background: #eee;
    border: 1px solid #aaa;
    font-weight: bolder;
    overflow: hidden;
    transition: top .1s ease-in-out, left .1s ease-in-out, background 1s ease-in-out, border 1s ease-in-out;
    animation: spawn .3s;
}
.elements > span.remove{
    animation: despawn 1s cubic-bezier(.73,.02,.82,.36) forwards;
    animation-delay: 1s;
}
.elements > span p{
    margin: 0;
}
@keyframes despawn{
    0%{transform: translate(0px)}
    100%{transform: translateY(400px) rotate(20deg); opacity: 0;}
}
@keyframes spawn{
    0%{transform: scale(0)}
    100%{transform: scale(1)}
}
span.n2{
    background: #ffeaa7;
}
@keyframes border-to-right{
    0%{transform: scaleX(0); transform-origin: left;}
    20%{transform: scaleX(0); transform-origin: left;}
    40%{transform: scaleX(1); transform-origin: left;}
    60%{transform: scaleX(1); transform-origin: right;}
    80%{transform: scaleX(0); transform-origin: right;}
    100%{transform: scaleX(0); transform-origin: right;}
}
@keyframes border-to-left{
    0%{transform: scaleX(0); transform-origin: right;}
    20%{transform: scaleX(0); transform-origin: right;}
    40%{transform: scaleX(1); transform-origin: right;}
    60%{transform: scaleX(1); transform-origin: left;}
    80%{transform: scaleX(0); transform-origin: left;}
    100%{transform: scaleX(0); transform-origin: left;}
}
@keyframes border-to-bottom{
    0%{transform: scaleY(0); transform-origin: top;}
    20%{transform: scaleY(0); transform-origin: top;}
    40%{transform: scaleY(1); transform-origin: top;}
    60%{transform: scaleY(1); transform-origin: bottom;}
    80%{transform: scaleY(0); transform-origin: bottom;}
    100%{transform: scaleY(0); transform-origin: bottom;}
}
@keyframes border-to-top{
    0%{transform: scaleY(0); transform-origin: bottom;}
    20%{transform: scaleY(0); transform-origin: bottom;}
    40%{transform: scaleY(1); transform-origin: bottom;}
    60%{transform: scaleY(1); transform-origin: top;}
    80%{transform: scaleY(0); transform-origin: top;}
    100%{transform: scaleY(0); transform-origin: top;}
}
span.n4{
    background: #fab1a0;
}
span.n8{
    background: #ff7675;
}
span.n16{
    background: #ffd32a;
    color: white;
}
span.n32{
    background: #22a6b3;
    color: white;
}
span.n64{
    background: #0be881;
    border: 4px solid #05c46b;
    color: white;
}
span.n128{
    background: #706fd3;
    border: 4px solid #474787;
    color: white;
}
span.n256{
    background: #ff793f;
    border: 4px solid #cd6133;
    color: white;
}
span.n256 > .shine{
    position: absolute;
    height: 200%;
    width: 50%;
    background: rgba(255,255,255,0.5);
    transform: rotate(30deg);
    top: -50%;
    animation: shine 4s infinite;
}
span.n512{
    background: #B53471;
    border: 4px solid #c44569;
    color: white;
}
span.n512 > .shine{
    position: absolute;
    height: 200%;
    width: 50%;
    background: rgba(255,255,255,0.5);
    transform: rotate(30deg);
    top: -50%;
    animation: shine 4s infinite;
}
span.n1024{
    background: linear-gradient(to right,#e74c3c,#f39c12);
    color: white;
}
span.n1024 > p{
    font-size: .8em;
}
span.n1024 > .top{
    position: absolute;
    height: 200%;
    width: 25%;
    background: rgba(255,255,255,0.5);
    transform: rotate(30deg);
    top: -50%;
    animation: shine 5.3s infinite;
}
span.n1024 > .shine{
    position: absolute;
    height: 200%;
    width: 50%;
    background: rgba(255,255,255,0.5);
    transform: rotate(30deg);
    top: -50%;
    animation: shine 4s infinite;
}
span.n2048{
    border: none;
    color: white;
    box-shadow: 0px 0px 50px #1abc9c;
    background: #1abc9c;
    background: linear-gradient(to top left,#1abc9c,#3498db);
}
span.n2048 > span{
    position: absolute;
}
span.n2048 > p{
    font-size: .8em;
    padding: 4px 10px 7px;
    border-radius: 10px;
    z-index: 2;
}
span.n2048 > .top{
    position: absolute;
    height: 200%;
    width: 25%;
    background: rgba(255,255,255,0.5);
    transform: rotate(30deg);
    top: -50%;
    animation: shine 5.3s infinite;
}
span.n2048 > .left{
    position: absolute;
    height: 200%;
    width: 75%;
    background: rgba(255,255,255,0.5);
    transform: rotate(30deg);
    top: -50%;
    animation: shine 11.3s infinite;
}
span.n2048 > .right{
    position: absolute;
    height: 200%;
    width: 15%;
    background: rgba(255,255,255,0.5);
    transform: rotate(30deg);
    top: -50%;
    animation: shine 1.7s infinite;
}
span.n2048 > .bottom{
    position: absolute;
    height: 200%;
    width: 25%;
    background: rgba(255,255,255,0.5);
    transform: rotate(30deg);
    top: -50%;
    animation: shine 5.1s infinite;
}
span.n2048 > .shine{
    position: absolute;
    height: 200%;
    width: 50%;
    background: rgba(255,255,255,0.5);
    transform: rotate(30deg);
    top: -50%;
    animation: shine 4s infinite;
}
@keyframes shine{
    0%{left: -150%}
    100%{left: 250%}
}
@keyframes move-gradient{
    0%{top: -200%; left: -200%}
    100%{top: 0%; left: 0%}
}
.button{
    --box-shadow-color: rgb(120,120,120);

    position: relative;
    padding: 5px 10px;
    border: 1px solid rgb(120,120,120);
    box-shadow: 1px 1px 0px var(--box-shadow-color);
    border-radius: 5px;
    background: white;
    cursor: pointer;
    transform: translate(-1px,-1px);
    transition: all .1s;
}
.button:hover{
    border: 1px solid rgb(120,120,120);
    box-shadow: 2px 2px 0px var(--box-shadow-color);
    transform: translate(-2px,-2px);
}
.button:active{
    border: 1px solid rgb(120,120,120);
    box-shadow: 0px 0px 0px var(--box-shadow-color);
    transform: translate(0px,0px);
}
.button:focus{
    border-color: #2e86de;
    --box-shadow-color: #2e86de;
}
p{
    margin-bottom: 16px;
}
h1{
    margin-bottom: 24px;
}
h2{
    margin-bottom: 22px;
}
h3{
    margin-bottom: 20px;
}
p#puntos{
    font-size: 24px;
}