:root {
    --bg-color: #ecf0f3;
    --wrapper-shadow: -10px 10px 20px #dbdfe2,
    10px -10px 20px #fdffff;
    --btn-shadow: -5px 5px 10px #c4c7ca,
    5px -5px 10px #ffffff;
    --btn-shadow-inset: inset -5px 5px 10px #c4c7ca,
    inset 5px -5px 10px #ffffff;
    --board-shadow-inset: inset -5px 5px 8px #d4d8db,
    inset 5px -5px 8px #ffffff;

    --color: #243441;
    --border-radius: 20px;
    --setting-btn-color: #222222;
    --block-size: 25px;
    --button-size: 55px;
    --game-width: 414px;
    --game-height: 736px;
}

.dark {
    --bg-color: #243441;
    --color: #ffffff;
    --setting-btn-color: #c7c3c4;
    --wrapper-shadow: -10px 10px 10px #1f2d39,
    10px -10px 10px #293b49;
    --btn-shadow: -5px 5px 10px #1f2d39,
    5px -5px 10px #293b49;
    --btn-shadow-inset: inset -5px 5px 10px #1f2d39,
    inset 5px -5px 10px #293b49;
    --board-shadow-inset: inset -5px 5px 8px #21303c,
    inset 5px -5px 8px #273846;
}

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

body, 
html {
    font-family: 'Krona One', 
    sans-serif;
    height: 100vh;
    background-color: var(--bg-color);
    overflow: hidden;
}

button {
    -webkit-tap-highlight-color: rgba(0,0,0,0);
}

.container {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-wrapper {
    position: relative;
    z-index: 99;
    width: 100%;
    max-width: var(--game-width);
    height: 100%;
    max-height: var(--game-height);
    background-color: var(--bg-color);
    box-shadow: var(--wrapper-shadow);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.info-section {
    position: relative;
    text-align: center;
    font-weight: 600;
    padding: 20px;
    font-size: 25px;
    color: var(--color);
}

.info-section #level {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 30px;
    font-size: 18px;
}

.board-section{
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    margin: auto;
    padding: 10px;
    box-shadow: var(--board-shadow-inset);
    border-radius: 10px;
}

.block {
    width: var(--block-size);
    height: var(--block-size);
    border: 0.1px solid var(--bg-color);
}

.setting-section {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.setting-section button {
    margin: 0 10px;
    color: var(--setting-btn-color)
}

i.bxs-moon {
    display: block;
}

i.bxs-sun {
    display: none;
}

.btn {
    width: var(--button-size);
    height: var(--button-size);
    box-shadow: var(--btn-shadow);
    border-radius: 25px;
    font-weight: 600;
    font-size: 30px;
    color: var(--color);
    border: none;
    outline: none;
    background-color: var(--bg-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn:active {
    box-shadow: var(--btn-shadow-inset);
}

.control-section {
    display: none;
}

.col {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.col:nth-child(1) {
    width: 60%;
}

.col:nth-child(2) {
    width: 40%;
}

.arrow-control {
    display: grid;
    grid-template-columns: repeat(3,1fr);
}

.btn-large {
    width: 80px !important;
    height: 80px !important;
    font-size: 30px;
}

.menu-section {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.menu-section button {
    margin-bottom: 30px;
    
}

.btn-width {
    width: 220px;
    
}

.brand {
    padding: 40px 0;
    font-size: 25px;
    color: var(--color);
    text-align: center;
}

.result {
    text-align: center;
    margin-bottom: 90px;
    display: none;
}

.result p {
    color: var(--setting-btn-color);
}

.result h1 {
    color: var(--color);
    margin-bottom: 30px;
}

.how-to {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translate(100%, -50%);
    box-shadow: var(--wrapper-shadow);
    padding: 30px;
    border-radius: 20px;
    background-color: var(--bg-color);
    color: var(--color);
    transition: transform .5s ease-in-out;
}

.how-to.active {
    transform: translate(0, -50%)
}

.how-to h3 {
    margin-bottom: 40px;
}

.how-to td {
    padding: 20px;
}

.keycap {
    width: calc(var(--button-size) * 2);
    color: var(--setting-btn-color);
    font-size: 20px;
}

/* Images fall effect */
.container img.fall {
    position: absolute;
    animation: fall linear infinite;
}
/* END Images fall effect */

/* Loading screen */
.loading {
    position: absolute;
    top: 0;
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-color);
    z-index: 100;
    animation: hide 1.8s linear forwards;
    animation-delay: 3s;
}

.loading .square {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    width: calc(var(--block-size) * 4);
    height: calc(var(--block-size) * 4);
    overflow: hidden;
    animation: rotate 1s linear forwards;
    animation-delay: 1.8s;
}

.loading .square div {
    width: var(--block-size);
    height: var(--block-size);
    border: 1px solid var(--bg-color);
    animation: down .4s linear forwards;
    transform: translateY(-500%);
}
/* END Loading screen */

/* L block */
.loading .square div:nth-child(5),
.loading .square div:nth-child(9),
.loading .square div:nth-child(13),
.loading .square div:nth-child(14) {
    background-image: url('/assets/animated/pink_block.png');
}
/* END L block */

/* S block */
.loading .square div:nth-child(6),
.loading .square div:nth-child(10),
.loading .square div:nth-child(11),
.loading .square div:nth-child(15) {
    background-image: url('/assets/animated/blue_block.png');
    animation-delay: .4s;
}
/* END S block */

/* L invert block */
.loading .square div:nth-child(1),
.loading .square div:nth-child(2),
.loading .square div:nth-child(3),
.loading .square div:nth-child(7) {
    background-image: url('/assets/animated/green_block.png');
    animation-delay: 1.1s;
}
/* END L invert block */

/* I invert block */
.loading .square div:nth-child(4),
.loading .square div:nth-child(8),
.loading .square div:nth-child(12),
.loading .square div:nth-child(16) {
    background-image: url('/assets/animated/red_block.png');
    animation-delay: 0.8s;
}
/* END I invert block */

/* Animation */

@keyframes down {
    0% {
        transform: translateY(-300%);
    }
    100% {
        transform: translateY(0);
    }
}

@keyframes rotate {
    0% {
        transform: rotate(0);
    }
    100% {
        transform: rotate(90deg);
    }
}

@keyframes hide {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes fall {
    0% {
        transform: translateY(0) rotate(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(2000%) rotate(90deg);
        opacity: 1;
    }
}
/* END Animation */


/* States */
.board-section,
.info-section,
.control-section {
    transform: scale(0);
}

.play .board-section,
.play .info-section,
.play .control-section {
    transform: scale(1);
}

.play .menu-section {
    transform: scale(0);
}

.play #btn-pause {
    display: flex;
}

.pause #btn-new-game,
.end #btn-new-game {
    display: block;
}

.end .result {
    display: block;
}

.end #btn-play {
    display: none;
}

#btn-new-game,
#btn-pause {
    display: none;
}
/* END States */

@media only screen and (max-width: 425px) {
    :root {
        --block-size: 18px;
    }

    .game-wrapper {
        box-shadow: unset;
        border-radius: unset;
        padding-bottom: 10px;
    }

    .control-section {
        display: flex;
    }

    .setting-section {
        padding: unset;
        margin-top: -40px;
    }

    .play .setting-section {
        position: absolute;
        flex-direction: column;
        bottom: unset;
        top: 50%;
        transform: translateY(-50%);
        right: 2px;
        padding: unset;
    }

    .setting-section button {
        margin-bottom: 20px;

    }

    .how-to,
    #btn-help {
        display: none;
    }
}