* {
    box-sizing: border-box;
}

body {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: pink;
    background-image: url('https://i.imgur.com/i4obTJZ.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    overflow: hidden;
}

.reset-modal-container, .win-modal-container, .start-modal-container {
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 150vw;
    height: 150vh;
    background-color: rgba(0, 0, 0, 0.6);
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
}

.start-modal-container {
    background-color: pink;
    background-image: url('https://i.imgur.com/i4obTJZ.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    opacity: 1;
    pointer-events: visible;
}

.reset-modal-container.show, .win-modal-container.show, .start-modal-container.show {
    pointer-events: auto;
    opacity: 1;
}

.start-modal-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.reset-modal, .win-modal, .start-modal {
    background: none;
    border: none;
    text-align: center;
    animation: modal-zoom 3s ease infinite;
    display: grid;
}

.reset-modal img {
    width: 25vmin;
    margin: auto;
}

.start-modal img {
    width: 35vmin;
    margin: auto;
}

.reset-modal p, .win-modal p, .start-modal p {
    margin-top: -1vmin;
    font-family: 'press start 2p', sans-serif;
    font-size: 2.5vmin;
    -webkit-text-stroke: 2px #A572D9;
    color: white;

}

.reset-modal p {
    font-size: 3.5vmin;
}

.win-modal p {
    margin-top: 0;
    font-size: 4vmin;
    margin-bottom: 2vmin;
}

.start-modal p {
    color: #F399D2;
    -webkit-text-stroke: 0px;
    font-size: 1.5vmin;
    width: 47vmin;
    padding: 1vmin;
    line-height: 135%;
}

button {
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: none;
    background: #A572D9;
    border-radius: 12px;
    border: none;
    padding: 0;
    outline-offset: 4px;
    width: 25vmin;
}

button:active .front {
    transform: translateY(-2px);
}

.front {
    display: block;
    padding: 14px;
    border-radius: 12px;
    background: #F399D2;
    color: white;
    transform: translateY(-6px);
    font-family: 'press start 2p', sans-serif;
    font-size: 2vmin;
}

.front:before {
    content: '';
    width: 80px;
    height: 300%;
    border: none ;
    position: absolute;
    left: 0%;
    top: 50%;
    transform: translateY(-50%) rotate(35deg);
    background: rgb(255,255,255);
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.35) 50%, rgba(255,255,255,0) 100%);
    animation: shine 3s infinite;
}

#reset, #play-again, #start-game {
    margin: auto;
}

.chat-bubble {
    --triangle-size: 3vmin;
    background: white;
    border-radius: 10%;
    position: relative;
    animation: enlarge 3s ease;
    transform-origin: 50% calc(100% + var(--triangle-size));
}

.chat-bubble:after {
    border: var(--triangle-size) solid transparent;
    border-top-color: white;
    position: absolute;
    bottom: calc(var(--triangle-size) * -2 + 2px) ;
    left: calc(50% - var(--triangle-size));  
}

.chat-bubble:before {
    content: '';  
    border: var(--triangle-size) solid transparent;
    border-top-color: white;
    position: absolute;
    bottom: calc(var(--triangle-size) * -2 - .1em + 2px);
    left: calc(50% - var(--triangle-size));  
}

#reset:hover, #play-again:hover {
    transform: scale(1.2);
    transition: transform 150ms;
    opacity: 100%;
}

h1 {
    margin-top: 3vmin;
    font-family: 'press start 2p', sans-serif;
    font-size: 3.5vmin;
    color: #A572D9;
}

.timer, h2 {
    color: #E67FD1;
    font-family: 'press start 2p', sans-serif;
    font-size: 1.5vmin;
}

.timer {
    margin-top: 2vmin;
}

#logo img {
    width: 30vmin;
}

main {
    display: grid;
    grid-template-columns: repeat(5, 13vmin);
    grid-template-rows: repeat(4, 14vmin);
    animation-name: floating;
    animation-duration: 3s;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
    margin-bottom: 5vmin;
}

main img {
    margin: auto;
    width: 10vmin;
    cursor: pointer;
}

main img:hover {
    transform: scale(1.1);
    transition: transform 150ms;
}

footer {
    font-family: 'press start 2p', sans-serif;
    font-size: 13px;
    letter-spacing: 4px;
    color: #DADAEF;
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 13px;
    text-align: center;
}

a {
    color: #DADAEF;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    color: white;
}
  
@keyframes floating {
    from { transform: translate(0,  0px); }
    65%  { transform: translate(0, 15px); }
    to   { transform: translate(0, -0px); }    
}

@keyframes zoom {
    from { transform: scale(.75); }
    50% { transform: scale(1); }
    to { transform: scale(.75); }
  }

@keyframes modal-zoom {
    from { transform: scale(.90); }
    50% { transform: scale(1); }
    to { transform: scale(.90); }
}

@keyframes enlarge {
    0% { transform: scale3d(0.75,0.75,1) rotate3d(0,0,0,0); opacity: 0 }
    100% { transform: scale3d(1,1,1) rotate3d(0,0,0,0) translate3d(0,0em,0); opacity: 1 }
}

@keyframes shine {
    from {
      left: -50%;
    }
    to {
      left: 100%;
    }
}

@media screen and (max-width: 850px) {

    body {
        viewport-fit: cover;
    }
    
    main {
        grid-template-columns: repeat(5, 19vmin);
        grid-template-rows: repeat(4, 25vmin);
        margin-bottom: 0vmin;
        padding: 3vmin;
    }

    #logo img {
        width: 25vmin;
    }

    main img {
        width: 18vmin;
    }

    .timer, h2 {
        font-size: 3vmin;
    }

    .timer {
        margin-top: 5vmin;
    }

    .front {
        font-size: 4vmin;
    }

    .reset-modal p {
        margin-bottom: 5vmin;
        font-size: 8vmin;
    }

    .win-modal p {
        font-size: 9.5vmin;
        margin-bottom: 5vmin;
    }

    .start-modal h1 {
        font-size: 5.5vmin;
        margin-top: 7vmin;
    }

    .start-modal p {
        font-size: 3.2vmin;
        width: 75vmin;
        padding: 3vmin;
    }

    .start-modal img {
        width: 65vmin;
    }

    .reset-modal img {
        width: 60vmin;
        margin-bottom: -3vmin;
    }

    .win-modal img {
        width: 90vmin;
    }

    button {
        width: 52vmin;
    }

    footer {
        height: 3vmin;
        font-size: 2vmin;
    }
  }
