*,
*:before,
*:after {
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
    margin: 0px;
    padding: 0px;
    scroll-behavior: smooth;
    font-family: 'Manrope', sans-serif;

    user-select: none;
    -webkit-user-drag: none;

    overflow: hidden;
}

body {
    background-color: var(--black);
    height: 100vh;
    width: 100vw;
}

:root {
    --black: #0e0e0e;
    --blank: #1b1b1b;
    --white: #f8f8f8;
    --red: #f72400;           /* 1 */
    --light-blue: #57c3f5;    /* 2 */
    --blue: #0431f7;          /* 3 */
    --purple: #c539f6;        /* 4 */
    --yellow: #f4f200;        /* 5 */
    --green: #00f400;         /* 6 */
    --orange: #f57000;        /* 7 */
    --shadow: #464646;
}

.container {
    width: 100%;
    height: calc(100% - 80px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-top: 0px;
    padding-bottom: 0px;

    position: fixed;
    bottom: 80px;
}

/* HOME PAGE */

.home-page {
    height: 100vh;
    width: 100vw;

    position: fixed;
    bottom: 0;

    z-index: 200;
}

.home-container {
    height: calc(100% - 80px);
    width: 100vw;

    background-color: #070707;

    position: fixed;
    bottom: 80px;

    z-index: 20;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.title {
    display: flex;
    justify-content: center;
    align-items: center;

    width: 100%;

    position: relative;

    overflow: visible;
}

.home-page h1 {
    font-family: 'Handjet', cursive;
    font-weight: 600;
    font-size: 80px;

    position: absolute;
    bottom: 70%;

    color: var(--white);
}

.animation-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;

    width: 50%;
    max-width: 400px;
    min-width: 300px;
}

.play {
    height: 60px;
    width: 60px;

    border: 4px solid var(--white);
    -webkit-box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.20); 
    box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.20);
    padding: 15px; 
    border-radius: 10px;
    background: rgb(56,56,56);
    background: linear-gradient(156deg, rgb(51, 51, 51) 0%, rgb(59, 59, 59)100%);

    display: flex;
    align-items: center;
    justify-content: center;
    
    margin-top: 80px;

    cursor: pointer;
}

.play:hover {
    filter: brightness(130%)
}

/* GAME */

.game-container {
    width: 100vw;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
}

.grid-container,
.scores-container,
.next-container {
    border: 4px solid var(--white);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
    padding: 8px; 
    border-radius: 10px;
    background: rgb(56,56,56);
    background: linear-gradient(156deg, rgb(51, 51, 51) 0%, rgb(59, 59, 59)100%);
}

/* SCORES */

.scores-container {
    display: flex;
    flex-direction: column;
    gap: 12px;

    margin-bottom: 25vh;
}

.score,
.level,
.lines {
    display: flex;
    flex-direction: column;
    gap: 5px;

    width: fit-content;
}

.label {
    text-align: center;
    font-size: 20px;
    font-weight: 800;
    color: var(--white);

    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
}

.value {
    width: 140px;
    text-align: center;
    color: var(--white);

    border-radius: 3px;
    background-color: var(--blank);
    -webkit-box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25); 
    box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25);
}

.score-single {
    display: none;

    flex-direction: column;
    gap: 5px;

    border: 4px solid var(--white);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
    padding: 8px; 
    border-radius: 10px;
    background: rgb(56,56,56);
    background: linear-gradient(156deg, rgb(51, 51, 51) 0%, rgb(59, 59, 59)100%);
}

.label-single {
    text-align: center;
    font-size: 20px;
    font-weight: 800;
    color: var(--white);

    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
}

.value-single {
    height: 22px;
    width: 140px;
    text-align: center;
    color: var(--white);

    border-radius: 3px;
    background-color: var(--blank);
    -webkit-box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25); 
    box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25);
}

/* GRID */

.center {
    height: 70%;
    width: fit-content;
    overflow: visible;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.grid-container {
    height: 100%;
    max-height: 800px;
    aspect-ratio: 1.037 / 2;

    position: relative;

    overflow: visible;
}

.grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(20, 1fr);
    gap: 1px;
    height: 100%;
    max-width: 100%;
    
    transition: .3s;
}

.grid-item {
    background-color: var(--blank);
    width: 100%;
    aspect-ratio: 1 / 1; /* Aspect ratio of 1:1 for grid items */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;

    transition: 0s;

    -webkit-box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.15); 
    box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.15);
}

/* POINTS ALERT */

.points {
    width: 100vw;

    position: absolute;
    left: 50%;
    transform: translateX(-50%);

    color: var(--white);
    font-size: 16px;

    bottom: 30px;

    transition: .3s;

    transition-timing-function: linear;

    z-index: -10;

    text-align: center;
}

.points span {
    font-weight: 600;
}

/* PAUSE */

.pause {
    position: absolute;
    bottom: -4px;
    right: -104px;

    height: 60px;
    width: 60px;

    border: 4px solid var(--white);
    -webkit-box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.20); 
    box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.20);
    padding: 8px; 
    border-radius: 10px;
    background: rgb(56,56,56);
    background: linear-gradient(156deg, rgb(51, 51, 51) 0%, rgb(59, 59, 59)100%);

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;

    cursor: pointer;
}

.bar {
    height: 50%;
    width: 5px;

    background-color: var(--white);

    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
}

.pause:hover {
    filter: brightness(130%)
}


.pause-container {
    height: 100vh;
    width: 100vw;

    position: fixed;

    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px); /* Apply a blur effect */
    -webkit-backdrop-filter: blur(3px); /* For Safari */

    z-index: 10;

    display: none;
    align-items: center;
    justify-content: center;
}

.pause-modal {
    width: 280px;
    padding: 40px 40px;

    border: 4px solid var(--white);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgb(56,56,56);
    background: linear-gradient(156deg, rgb(51, 51, 51) 0%, rgb(59, 59, 59)100%);

    margin-bottom: 80px;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;

    gap: 15px;
}

.slide-in-up {
    animation: fadeInUpBig;
    animation-duration: .7s;
}

.slide-out-down {
    animation: fadeOutDownBig;
    animation-duration: 1s;
}

.pause-modal h2 {
    font-size: 28px;
    font-weight: 800;
    color: var(--white);
    margin-bottom: 15px;

    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
}

.resume, 
.how-to-play,
.controls,
.restart {
    width: 100%;
    text-align: center;
    padding: 8px;

    border-radius: 8px;
    background-color: var(--blank);
    -webkit-box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25); 
    box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25);

    color: var(--white);
    font-weight: 600;
    font-size: 18px;
    text-shadow: 1px 1px 5px rgba(2, 2, 2, 0.7);

    cursor: pointer;
}

.resume {
    background: linear-gradient(156deg, #a7a7a7b9 0%, #d6d6d6b7 100%);
}

.resume:hover, 
.how-to-play:hover,
.controls:hover,
.restart:hover {
    filter: brightness(130%)
}

/* HOW TO PLAY */

.how-to-play-container {
    height: 100vh;
    width: 100vw;

    position: fixed;

    z-index: 15;

    display: none;
    align-items: center;
    justify-content: center;
}

.how-to-play-modal {
    width: 85vw;
    max-width: 600px;
    padding: 40px 40px;

    border: 4px solid var(--white);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgb(56,56,56);
    background: linear-gradient(156deg, rgb(51, 51, 51) 0%, rgb(59, 59, 59)100%);

    margin-bottom: 80px;

    gap: 15px;
}

.how-to-play-modal h2 {
    font-size: 28px;
    font-weight: 800;
    color: var(--white);
    margin-bottom: 15px;

    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);

    text-align: center;
}

.list {
    width: 100%;
    font-size: 14px;
    text-align: left;

    color: var(--white);

    margin-bottom: 10px;

    overflow: visible;
}

.list span {
    font-weight: 800;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
}

.score-system {
    margin: 0 auto;
    margin-top: 35px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;

    max-width: 280px;

    color: var(--white);

    border-radius: 8px;
    background-color: var(--black);
    -webkit-box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25); 
    box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25);

    padding: 8px;

    border: 1px solid #f8f8f84d;
}

.score-system h3 {
    font-size: 16px;
    margin-bottom: 5px;
}

.score-system div {
    width: 100%;
    display: flex;

    border-radius: 3px;
    background-color: #252525;
    -webkit-box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25); 
    box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25);

    padding: 2px 6px;

    text-shadow: 1px 1px 5px rgba(2, 2, 2, 0.7);
}

.score-system div span {
    width: 100%;
}

.level-specification {
    margin: 0 auto;
    margin-top: 5px;
    margin-bottom: 30px;

    width: fit-content;

    font-size: 12px;
    color: var(--white);
}

.done {
    width: fit-content;

    margin: 5px auto;

    border-radius: 8px;

    padding: 8px 12px;

    border: 2px solid #f8f8f8;

    background-color: #272727;
    -webkit-box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25); 
    box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25);

    cursor: pointer;

    color: var(--white);
    font-weight: 700;
}

.done:hover {
    filter: brightness(130%)
}

/* CONTROLS */

.controls-container {
    height: 100vh;
    width: 100vw;

    position: fixed;

    z-index: 15;

    display: none;
    align-items: center;
    justify-content: center;
}

.controls-modal {
    width: 85vw;
    max-width: 500px;
    padding: 40px 40px;

    border: 4px solid var(--white);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgb(56,56,56);
    background: linear-gradient(156deg, rgb(51, 51, 51) 0%, rgb(59, 59, 59)100%);

    margin-bottom: 80px;

    gap: 15px;
}

.controls-modal h2 {
    font-size: 28px;
    font-weight: 800;
    color: var(--white);
    margin-bottom: 50px;

    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);

    text-align: center;
}

.control {
    width: 100%;
    height: 50px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;

    color: var(--white);
    font-weight: 500;

    margin-bottom: 20px;

    overflow: visible;
}

.control-img {
    width: 50px;
}

.control-img img {
    width: 100%;
}

.touch {
    display: none;
}

.control-desc {
    width: 210px;
}

/* GAME OVER */

.game-over-container {
    height: 100vh;
    width: 100vw;

    position: fixed;

    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px); /* Apply a blur effect */
    -webkit-backdrop-filter: blur(3px); /* For Safari */

    z-index: 15;

    display: none;
    align-items: center;
    justify-content: center;
}

.game-over-modal {
    width: 320px;
    padding: 40px 40px;

    border: 4px solid var(--white);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgb(56,56,56);
    background: linear-gradient(156deg, rgb(51, 51, 51) 0%, rgb(59, 59, 59)100%);

    margin-bottom: 80px;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;

    gap: 15px;
}

.game-over-modal h2 {
    font-size: 28px;
    font-weight: 800;
    color: var(--white);
    margin-bottom: 15px;

    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
}

.scoreboard {
    width: 100%;
    text-align: center;
    color: var(--white);

    border-radius: 8px;
    background-color: var(--black);
    -webkit-box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25); 
    box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25);

    padding: 8px;

    display: flex;
    flex-direction: column;
    gap: 3px;

    border: 1px solid #f8f8f84d;
}

.scoreboard h3 {
    font-size: 16px;
    margin-bottom: 5px;
}

.scoreboard div {
    border-radius: 3px;
    background-color: #252525;
    -webkit-box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25); 
    box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25);

    text-align: right;

    padding: 1px 6px;

    text-shadow: 1px 1px 5px rgba(2, 2, 2, 0.7);
}

.restart-game {
    width: 45px;
    height: 45px;

    padding: 8px;

    border-radius: 8px;

    border: 2px solid #f8f8f8bb;

    background-color: #272727;
    -webkit-box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25); 
    box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25);

    margin-top: 5px;

    cursor: pointer;
}

.restart-game img {
    width: 100%;
}

.restart-game:hover {
    filter: brightness(130%)
}

/* NEXT */

.next-container {
    display: flex;
    flex-direction: column;
    gap: 12px;

    margin-bottom: 25vh;

    width: fit-content;
}

.next {
    display: flex;
    flex-direction: column;
    gap: 5px;

    width: fit-content;
}

.next-piece-container {
    width: 140px;
    height: 100px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 3px;
    background-color: var(--blank);
    -webkit-box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25); 
    box-shadow: inset -3px -3px 5px 2px rgba(0,0,0,0.25);
}

.grid-next {
    display: grid;
    gap: 1px;

    background-color: transparent;
}

.grid-next-item {
    background-color: transparent;
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;

    transition: 0s;
}

/* COLORS */

.red,
.blue,
.green,
.light-blue,
.orange,
.purple,
.yellow, 
.white {
    -webkit-box-shadow: inset -2px -2px 3px 1px rgba(0,0,0,0.15); 
    box-shadow: inset -2px -2px 3px 1px rgba(0,0,0,0.15);
}

.red {
    background-color: var(--red);

    border: 2px solid #bb1900;
}

.light-blue {
    background-color: var(--light-blue);

    border: 2px solid #4192ba;
}

.blue {
    background-color: var(--blue);

    border: 2px solid #0222bc;
}

.purple {
    background-color: var(--purple);

    border: 2px solid #9629bd;
}

.yellow {
    background-color: var(--yellow);

    border: 2px solid #b9b800;
}

.green {
    background-color: var(--green);

    border: 2px solid #00bb00;
}

.orange {
    background-color: var(--orange);

    border: 2px solid #bc5400;
}

.shadow {
    background-color: var(--shadow);

    border: 2px solid #444444;
}

.white {
    background-color: var(--white);

    border: 2px solid #adadad;
    
    transition: .2s;

    animation: flashAnimation .25s infinite alternate;
}

@keyframes flashAnimation {
    0% {
      opacity: 1;
    }
    100% {
      opacity: 0;
    }
}

/* FOOTER */

footer {
    position: fixed;
    bottom: 0;

    height: 80px;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;

    color: var(--white);
}

footer a {
    color: var(--text);
}

/* HEIGHT ALERT */

.block-view {
    height: 100vh;
    width: 100vw;

    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    gap: 15px;

    position: fixed;
    bottom: 0;

    background-color: var(--black);

    z-index: 300;
}

.alert-title {
    color: var(--white);
    font-size: 30px;

    display: flex;
    gap: 12px;
    align-items: center;
}

.alert-title h2 {
    font-family: 'Handjet', cursive;
    font-weight: 500;

    text-align: center;
}

.alert-title img {
    height: 50px;
}

.suggestion {
    color: #f8f8f8b7;
    text-align: center;
    font-size: 14px;
}

/* MEDIA QUERIES */

@media screen and (max-width: 820px) {

    .game-container {
        width: 100vw;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }

    .pause {
        bottom: -4px;
        right: -74px;
    
        height: 60px;
        width: 60px;
    }
}

@media screen and (max-width: 670px) {

    .grid-container {
        height: calc(100% - 78px);
        max-height: 800px;
        aspect-ratio: 1.037 / 2;
    }

    .score-single {
        display: flex;   
    }

    .score {
        display: none;
    }

    .scores-container {
        margin-bottom: 12vh;
    }

    .next-container {
        margin-bottom: 12vh;
    }

    .label,
    .label-single {
        font-size: 16px;
    }

    .value {
        width: 80px;
    }

    .next-piece-container {
        width: 80px;
        height: 60px;
    }

    .pause-modal {
        margin-bottom: 160px;
    }

    .game-over-modal {
        margin-bottom: 160px;
    }

    .how-to-play-modal {
        height: 500px;
        overflow: scroll;

        margin-bottom: 160px;
    }

    .controls-modal {
        margin-bottom: 160px;
    }
}

@media screen and (max-width: 550px) {

    .center {
        height: 80%;
    }
    
    .grid-container {
        max-height: 450px;
    }

    .value {
        width: 60px;
    }

    .value-single {
        width: 120px;
    }

    .next-piece-container {
        width: 60px;
        height: 40px;
    }

    .grid-next-item {
        border-radius: 2px;
    }
    
}

@media screen and (max-width: 450px) {

    .grid-container {
        max-height: 450px;
        border-radius: 10px 10px 0 10px;
    }

    .value {
        width: 50px;
    }

    .value-single {
        width: 120px;
    }

    .next-piece-container {
        width: 50px;
        height: 35px;
    }

    .game-container {
        gap: 0px;
    }

    .scores-container {
        border-right-width: 0px;
        border-radius: 10px 0px 0px 10px;
    }

    .next-container {
        border-left-width: 0px;
        border-radius: 0px 10px 10px 0px;
    }

    .center {
        gap: 0;
    }

    .score-single {
        border-bottom-width: 0px;
        border-radius: 10px 10px 0px 0px;
    }

    .pause {
        bottom: -4px;
        right: -64px;
    
        height: 60px;
        width: 60px;

        border-width: 4px 4px 4px 0px;
        border-radius: 0px 10px 10px 0px;
    }
}

@media screen and (max-height: 750px) {

    .scores-container {
        margin-bottom: 6vh;
    }

    .next-container {
        margin-bottom: 8vh;
    }

    .how-to-play-modal {
        height: 500px;
        overflow: scroll;
    }
}

@media screen and (max-height: 600px) {

    .block-view {
        display: flex;
    }
}

@media (hover: none) {
    .element {
        display: none;
    }

    .touch {
        display: block;
    }

    .arrow {
        display: none;
    }
}