@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700&family=Ubuntu:wght@300;400;500&display=swap');

@font-face {
    font-family: 'Lumen-Full';
    src: url('../assets/fonts/Lumen-Full.ttf') format('opentype');
}

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

body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--background);
    transition: background-color 0.5s, color 0.5s;
    transition: 1000ms ease;
}

.splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--background);
    font-family: 'Lumen-Full', sans-serif;
    font-size: 3rem;
    z-index: 200;
    color: var(--text);
    text-align: center;
    line-height: 90vh;
    user-select: none;
}

.splash.none {
    position: fixed;
    opacity: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--background);
    z-index: -10;
    color: var(--text);
    text-align: center;
    line-height: 90vh;
    transition: all 0.3s ease-out;
}

.splash-in {
    animation: fadeIn 1s ease-in forwards;
}

#start {
    color: var(--text);
    position: fixed;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 1.3rem;
    animation: wiggle 2s forwards infinite;
}

#start.none {
    display: none;
    transition: all 0.3s ease-out;
}

.wrapper {
    width: 65vmin;
    height: 70vmin;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--primary);
    font-family: 'Open-sans', sans-serif;
    border-radius: 5px;
    box-shadow: var(--box-shadow);
}

.game-details {
    display: flex;
    color: var(--text);
    font-weight: 500;
    font-size: 1.2rem;
    padding: 20px 27px;
    justify-content: space-between;
}

.play-board {
    height: 100%;
    height: 100%;
    display: grid;
    border-radius: 0 0 5px 5px;
    background: var(--secondary);
    grid-template: repeat(30, 1fr) / repeat(30, 1fr);
}

.play-board .food {
    background: var(--background-food);
    box-shadow: 0 0 20px var(--box-shadow-food);
}

.play-board .upgrade {
    background: var(--background-food);
    box-shadow: 0 0 20px var(--box-shadow-food);
}

.play-board .food.wiggle {
    animation: wiggle 3s linear infinite;
    transition-delay: 1s;
}

@keyframes wiggle {
    0%, 7% {
      transform: rotateZ(0);
    }
    15% {
      transform: rotateZ(-15deg);
    }
    20% {
      transform: rotateZ(10deg);
    }
    25% {
      transform: rotateZ(-10deg);
    }
    30% {
      transform: rotateZ(6deg);
    }
    35% {
      transform: rotateZ(-4deg);
    }
    40%, 100% {
      transform: rotateZ(0);
    }
}

.play-board .head {
    background: var(--background-player);
    box-shadow: 0 10px 30px var(--box-shadow-player);
}

.play-board .head.disintegrate {
    animation: disintegrate 1s linear forwards;
}

@keyframes disintegrate {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  20% {
    transform: translateY(-2vh) scale(0.8);
    opacity: 0.8;
  }
  40% {
    transform: translateY(-4vh) scale(0.6);
    opacity: 0.6;
  }
  60% {
    transform: translateY(-6vh) scale(0.4);
    opacity: 0.4;
  }
  80% {
    transform: translateY(-8vh) scale(0.2);
    opacity: 0.2;
  }
  100% {
    transform: translateY(-10vh) scale(0);
    opacity: 0;
  }
}


.controls {
    display: none;
    justify-content: space-around;
}

.controls i {
    padding: 25px 0;
    text-align: center;
    font-size: 1.3rem;
    color: var(--text);
    width: calc(100% / 4);
    cursor: pointer;
    border-top: 1px solid var(--border-top);
}

.toggle {
    background-color: var(--tertiary);
    position: absolute;
    right: 50px;
    top: 50px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    z-index: 2;
    border-radius: 50%;
    transition: 0.5s;
}

#music {
    color: var(--tertiary);
    border: none;
    background: none;
    cursor: pointer;
    position: absolute;
    align-items: center;
    display: flex;
    justify-content: center;
    top: 80px;
    right: 50px;
    width: 18px;
    height: 18px;
    z-index: 2;
    transition: 0.5s;
    animation: FadeIn 0.3s ease;
}

/* Modal popup */
.modal {
    display: none;
    position: fixed;
    z-index: 3;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    font-family: 'Open-sans', sans-serif;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--secondary);
    color: var(--text);
    border-radius: 5px;
    max-width: 300px;
    margin: 100px auto;
    padding: 20px;
    font-weight: 500;
    font-size: 1.1rem;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

dialog {
    align-items: center;
    margin: 150px auto;
    margin-top: 620px;
    padding: 5px;
    background-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--box-shadow);
    outline: none;
    border-radius: 5px;
    animation: fadeIn 1s forwards ease-in;
}

dialog::backdrop {
    background: none;
}

#message {
    color: var(--text);
    font-weight: 500;
    font-size: 1rem;
    font-family: 'Open-sans', sans-serif;
    animation: fadeIn 1s forwards ease-in-out;
}

@keyframes fadeIn {
    from {
    opacity: 0;
    }
    to {
    opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

#replay {
    background: #69d300;
    color: #fefefe;
    box-shadow: 0 0 5px rgba(51, 255, 0, 0.5);
    display: inline-block;
    padding: 10px 20px;
    margin: 8px 2px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}
  
#replay:hover {
    background-color: #56ad00;
}

/* Icons */
a {
    color: var(--text);
    text-decoration:none;
    display: inline-block;
    width:40px;
    height:28px;
    padding-top:12px;
    margin:0 2px;
    -o-transition:all .5s;
    -moz-transition: all .5s;
    transition: all .5s;
    -webkit-font-smoothing: antialiased;
    -webkit-transition: all .5s;
    cursor: pointer;
}

a:hover {
	color: #ff003d;
}

@media screen and (max-width: 800px) {
    .wrapper {
        width: 90vmin;
        height: 115vmin;
    }

    .game-details {
        font-size: 1rem;
        padding: 15px 27px;
    }

    .controls {
        display: flex;
    }

    .controls i {
        padding: 15px 0;
        font-size: 1rem;
    }

    #music {
        right: 20px;
        top: 50px;
        height: 15px;
        width: 15px;
    }

    .toggle {
        right: 20px;
        top: 20px;
        width: 15px;
        height: 15px;
    }

    .splash {
        font-size: 2.5rem;
    }

    dialog {
        margin: 30px auto;
    }
}
