/* 1. Use a more-intuitive box-sizing model */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* 2. Remove default margin */
* {
    margin: 0;
}

/* 3. Enable keyword animations */
@media (prefers-reduced-motion: no-preference) {
    html {
        interpolate-size: allow-keywords;
    }
}

body {
    /* 4. Add accessible line-height */
    line-height: 1.5;
    /* 5. Improve text rendering */
    -webkit-font-smoothing: antialiased;
    position: relative;
}

/* 6. Improve media defaults */
img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

/* 7. Inherit fonts for form controls */
input,
button,
textarea,
select {
    font: inherit;
}

/* 8. Avoid text overflows */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: break-word;
    color: white;
}

/* 9. Improve line wrapping */
p {
    text-wrap: pretty;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    text-wrap: balance;
}

/*
    10. Create a root stacking context
  */
#root,
#__next {
    isolation: isolate;
}










@font-face {
    font-family: manicMiner;
    src: url(assets/maincminer.woff2);
    font-display: swap;
}

@font-face {
    font-family: monogram;
    src: url(assets/vt323.woff2);
    font-display: swap;
}

:root {
    --red: #ff0000;
    --green: #00ff00;
}

.red {
    color: var(--red);
}

.green {
    color: var(--green);
}

.black {
    color: black !important;
}

.game-header {
    width: 100%;
    height: 11rem;
    margin: 0;
    padding: 2rem 1.5rem;
    background-image: url(assets/forest.png);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: bottom;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: end;
}

.level-title {
    font-family: manicMiner, sans-serif; 
    font-size: 1.3rem;
    color: var(--green);
}

.big-title {
    font-family: manicMiner, sans-serif; 
    font-size: 2.5rem;
    color: var(--green);
}

.level-number {
    font-family: monogram, sans-serif; 
    font-size: 1.8rem;
}

.button-1 {
    font-size: 1rem;
    color: black;
    font-family: manicMiner, sans-serif; 
    background-color: #00000000;
    background-image: url(assets/helper/Button_1.png);
    image-rendering: pixelated;
    background-repeat: no-repeat;
    background-size: contain;
    padding: 0.7rem 1rem 1rem 0.5rem;
    border: 0;
    cursor: pointer;
    width: 150px;
}

.button-1:focus {
    outline: none;
    box-shadow: none;
}

.level-buttons {
    display: flex;
    align-items: end;
    visibility: visible;
}

.level-buttons.hidden {
    visibility: hidden;
}

.button-2 {
    font-size: 1rem;
    color: black;
    font-family: manicMiner, sans-serif; 
    background-color: #00000000;
    background-image: url(assets/helper/Button_2.png);
    image-rendering: pixelated;
    background-repeat: no-repeat;
    background-size: contain;
    padding: 0.7rem 0.5rem 1rem 0rem;
    border: 0;
    cursor: pointer;
    width: 105px;
}

.button-2:focus {
    outline: none;
    box-shadow: none;
}

#button-sound {
    background-image: url(assets/helper/Button_sound_on.png);
    image-rendering: pixelated;
    background-repeat: no-repeat;
    background-size: contain;
    background-color: #00000000;
    border: 0;
    cursor: pointer;
    height: 52px;
    width: 55px;
}

#button-sound.enabled {
    background-image: url(assets/helper/Button_sound_off.png);
}

.button-2:focus {
    outline: none;
    box-shadow: none;
}



#game-canvas {
    height: 100vw !important;
    margin-bottom: 20vh;
}

.game-footer {
    font-family: monogram, sans-serif; 
    font-size: 1.4rem;
    line-height: 1.4rem;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    position: fixed;
    width: 100%;
    bottom: 0;
    left: 0;
    background-color: black;
    border-top: 3px solid white;
    gap: 1rem;
}

.game-footer-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.game-footer-line {
    display: flex;
    flex-direction: row;
    gap: 0.6rem;
}

.game-data {
    color: black;
    padding: 0 0.3rem;
}

.bg-green {
    background-color: var(--green);
}

.bg-white {
    background-color: white;
}

.bg-red {
    background-color: var(--red);
}





.home-main {
    height: 100dvh;
    overflow: hidden;
    position: relative;
}


.home-blood {
    image-rendering: pixelated;
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
}

.home-mask {
    position: absolute;
    z-index: 2;
    bottom: 0;
    left: 50%;
    width: 78vw;
    image-rendering: pixelated;
    animation-duration: 1.5s;
    transform: translate(-50%, 90%);
    opacity: 0;
    transition: 1.5s;
}

.home-mask.moved {
    transform: translate(-50%, 45%);
    opacity: 1;
}

.home-title-container {
    position: absolute;
    z-index: 3;
    top: 7.5%;
    left: 50%;
    transform: translate(-50%, 0);
    width: 85vw;
    height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5vh;
}

.home-title {
    width: 100%;
    image-rendering: pixelated;
}

.tutorial-main {
    padding: 3rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    justify-content: space-between;
    height: 100dvh;
}

.tutorial-text {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.long-text {
    font-family: monogram, sans-serif; 
    font-size: 1.5rem;
    line-height: 1.7rem;
}

.tutorial-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 2rem;
}

.tutorial-line {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    align-items: center;
}

.tutorial-line-img {
    width: 3rem;
    image-rendering: pixelated;
}

.tutorial-label {
    font-family: monogram, sans-serif; 
    font-size: 1.8rem;
    line-height: 1.8rem;
}

.tutorial-buttons {
    padding: 2rem 0 8rem 0;
    display: flex;
    flex-direction: column;
}





.dialogue-overlay {
    position: fixed;
    width: 100%;
    height: 100vh;
    overflow-y: scroll;
    top: 0;
    left: 0;
    background-color: black;
    flex-direction: column;
    justify-content: space-between;
    padding-bottom: 6rem;
    opacity: 0;
    z-index: -100;
    pointer-events: none;
    display: flex;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.dialogue-overlay.visible {
    transition: opacity 0.75s;
    opacity: 1;
    z-index: 10;
    pointer-events: all;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.dialogue-overlay::-webkit-scrollbar {
    display: none;
}

.dialogue-text {
    padding: 3rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dialogue-img {
    width: 75%;
    margin-left: auto;
    margin-right: auto;
    image-rendering: pixelated;
    transition: 1.5s;
    transform: translate(0, 300px);
}

.dialogue-overlay.visible .dialogue-img {
    transform: translate(0, 0);
}

.dialogue-buttons {
    width: 100%;
    padding: 6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}




.gameover-overlay {
    position: fixed;
    width: 100vw;
    height: 100vh;
    overflow-y: scroll;
    top: 0;
    left: 0;
    background-color: black;
    background-image: url('assets/helper/BG-chiusura.png');
    background-repeat: no-repeat;
    background-size: cover;
    padding: 2.5rem 3rem 5rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    opacity: 0;
    z-index: -100;
    pointer-events: none;
    text-align: center;
    align-items: center;
    image-rendering: pixelated;
    -ms-overflow-style: none;
    scrollbar-width: none;
}


/* Hide scrollbar for Chrome, Safari and Opera */
.gameover-overlay::-webkit-scrollbar {
    display: none;
}


.gameover-overlay.visible {
    transition: opacity 0.75s;
    opacity: 1;
    z-index: 13;
    pointer-events: all;
}

.gameover-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.dots-line {
    width: 80%;
}

#game-complete-label {
    display: none;
}

#game-complete-label.visible {
    display: block;
}

.gameover-cover {
    image-rendering: pixelated;
    width: 100%;
    box-shadow: 0 0 40px 0px #ff0000;
    margin-bottom: 4rem;
}

.gameover-cover-container {
    margin-top: 2rem;
}

.result-canvas {
    position: absolute;
    left: -9999px;
    /* molto fuori dallo schermo */
    top: -9999px;
    width: 1080px;
    height: 0px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-image: url(assets/helper/Result.png);
    position: relative;
    box-shadow: 0 0 25px 0px #00ff00b3;
}

.result-canvas.ready {
    height: 1920px;
}

.result-text-container {
    font-family: monogram, sans-serif; 
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);

    padding: 1.2rem 3rem;
    border-radius: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-text {
    font-size: 60px;
    white-space: nowrap;
    transform: translate(0, 90px);
}

.result-title {
    text-transform: uppercase;
    color: var(--green);
    font-size: 120px;
    white-space: nowrap;
    margin: 0;
    transform: translate(0, 20px);
}

#visible-points {
    font-family: monogram, sans-serif; 
    font-size: 4rem;
    line-height: 3rem;
    color: var(--green);
    text-transform: uppercase;
}

.visible-points-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 4rem 0 2rem 0;
    border: 2px solid white;
    padding: 2rem;
    background-color: black;
}




.game-popup {
    position: absolute;
    z-index: 5;
    top: 50vh;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid white;
    background-color: black;
    text-align: center;
    padding: 1.5rem;
    width: 80%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}



@media screen and (min-width: 800px) {

    .home-title-container {
        top: 5%;
        width: 60vw;
    }

    .home-mask {
        width: 50vw;
    }

    .level-title {
        font-size: 2rem;
    }

    .long-text {
        font-size: 2rem;
        line-height: 2rem;
    }

    .tutorial-main {
        padding: 6rem;
    }

    .tutorial-label {
        font-size: 2rem;
        line-height: 2rem;
    }

    .game-header {
        height: 16rem;
        padding: 3rex 6rem;
        background-repeat: repeat;
        background-size: 700px;
    }

    .game-footer {
        padding: 1.5rem 6rem;
        font-size: 1.8rem;
        line-height: 1.8rem;
    }

    #game-canvas {
        width: 700px !important;
        height: 700px !important;
        margin-left: auto;
        margin-right: auto;
    }

    .gameover-overlay {
        background-position-y: -100px;
        padding: 3rem 10rem;
    }

    .dialogue-text {
        padding: 6rem;
    }

    .gameover-cover-container {
        width: 75%;
    }

}




@media screen and (min-width: 1100px) {

    #game-canvas {
        width: 600px !important;
        height: 600px !important;
        margin-left: auto;
        margin-right: auto;
    }

    .game-header {
        padding: 3rex 12rem;
    }

    .level-number {
        font-size: 2rem;
    }

    .reset-button {
        font-size: 1.6rem;
        padding: 0.5rem 1rem;
    }

    .home-mask {
        width: 40vw;
    }

    .home-blood {
        top: -50%;
    }

    .tutorial-text {
        width: 70%;
    }

    .tutorial-line-img {
        width: 4rem;
    }

    .tutorial-list {
        gap: 0.75rem;
        margin-top: 3rem;
    }

    .tutorial-main {
        justify-content: start;
    }

    .tutorial-buttons {
        padding: 2rem 0;
        align-items: start;
    }

    .game-footer {
        padding: 1.5rem 6rem;
        display: flex;
        flex-direction: row;
        gap: 2rem;
        justify-content: center;
    }

    .game-footer-line {
        width: fit-content;
    }

    .gameover-overlay {
        background-position-y: -200px;
    }


    .game-popup {
        width: 50%;
    }

    .gameover-cover-container {
        width: 50%;
    }
}



@media screen and (min-width: 1300px) {
    .game-footer {
        width: fit-content;
        left: 50%;
        bottom: 4rem;
        transform: translate(-50%, 0);
        padding: 1.5rem;
        border: 2px solid white;
    }

    .home-title {
        width: 40vw;
    }

    .home-mask {
        width: 30vw;
    }

    .home-blood {
        top: -80%;
    }

    .gameover-overlay {
        flex-direction: row;
        gap: 2.5rem;
        align-items: start;
        padding: 10rem;
        background-size: cover;
        background-image: url('assets/helper/BG-chiusura-large.png');
        background-position-y: 0;
    }

    .black {
        color: white !important;
    }

    .gameover-section {
        width: 50%;
        align-items: start;
        text-align: left;
    }

    .gameover-cover-container {
        width: 60%;
        margin-top: 4rem;
        margin-bottom: 4rem;
    }

    .dots-line {
        display: none;
    }


    .dialogue-overlay {
        flex-direction: row;
    }

    .dialogue-text {
        width: 50%;
        flex-shrink: 0;
    }

    .dialogue-img {
        align-self: center;
        width: 40%;
        height: auto;
        display: block;
        margin-top: 6rem;
    }
}


@media screen and (min-width: 1600px) {
    #game-canvas {
        width: 600px !important;
        height: 600px !important;
        margin-left: auto;
        margin-right: auto;
    }


    .home-mask {
        top: 50%;
        left: auto;
        right: -12%;
        transform: translate(0, -50%);
        width: auto;
        height: 75vh;
        image-rendering: pixelated;
        animation-duration: 1.5s;
        right: -40%;
        opacity: 0;
    }

    .home-mask.moved {
        right: -12%;
        opacity: 1;
        transform: translate(0, -50%);
    }

    .home-blood {
        width: 150vh;
        top: 0;
        left: 50%;
        transform-origin: 0% 45%;
        transform: rotate(-90deg);
    }


    .home-title-container {
        top: 50%;
        left: 10%;
        transform: translate(0, -50%);
        width: auto;
        height: auto;
    }

    .tutorial-main {
        display: grid;
        grid-auto-rows: max-content;
        grid-template-columns: 1fr 1fr;
        justify-content: auto;
    }

    .tutorial-text {
        width: 90%;
    }

    .tutorial-list {
        margin-top: 5rem;
    }

    .game-popup {
        width: 30%;
    }
    .gameover-cover-container {
        width: 50%;
    }

}