:root {
  --background-color: rgb(18, 189, 172);
  --background-dark-color: rgb(12, 161, 146);
  --light-color: rgb(242, 235, 211);
  --dark-color: rgb(84, 84, 84);
}

* {
  box-sizing: border-box;
  margin: 0;
  font-family: "Varela Round", sans-serif;
  font-weight: 400;
  font-style: normal;
}

body {
  background-color: var(--background-color);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100vh;
  width: 100vw;
  padding: 1rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: clamp(2rem, 10vw, 3rem);
}

h1 {
  font-size: clamp(2rem, 10vw, 3rem);
  color: var(--dark-color);
}

.button {
  background-color: var(--background-dark-color);
  color: var(--light-color);
  border: none;
  border-radius: 4rem;
  height: clamp(2rem, 10vw, 3rem);
  padding: 0 clamp(1rem, 5vw, 1.5rem);
  font-size: clamp(1rem, 5vw, 1.5rem);
  line-height: 1;
  cursor: pointer;
  border: 0.25rem solid var(--background-dark-color);
  opacity: 1;
}

.button:hover {
  background-color: var(--background-color);
}

.nav-reset-button {
  display: none;
}

.reveal-nav-reset-button {
  animation-name: reveal-button;
  animation-duration: 0.5s;
  animation-fill-mode: forwards;
}

@keyframes reveal-button {
  from {
    opacity: 0
  }
  to {
    opacity: 1;
  }
}

.hide-nav-reset-button {
  animation-name: hide-button;
  animation-duration: 0.5s;
  animation-fill-mode: forwards;
}

@keyframes hide-button {
  from {
    opacity: 1
  }
  to {
    opacity: 0;
  }
}

.text-light {
  color: var(--light-color);
}

.text-dark {
  color: var(--dark-color)
}

main {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  flex-grow: 1;
  position: relative;
}

.game {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.players {
  width: 100%;
  height: clamp(2rem, 10vw, 3rem);
  margin-bottom: 1rem;
  flex-grow: 0;
}

.players-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100%;
  border-radius: 4rem;
  background-color: var(--background-dark-color);
  padding: 0.25rem;
}

.player {
  border-radius: 4rem;
  padding: clamp(0.25rem, 1.25vw, 0.5rem) clamp(0.5rem, 2.5vw, 1rem);
  transition: background-color 0.5s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.player img {
  object-fit:fill;
  display: flex;
  height: clamp(1rem, 5vw, 1.5rem);
  margin: 0;
}

.player-selected {
  background-color: var(--background-color);
}

.score {
  font-size: clamp(1rem, 5vw, 1.5rem);
  line-height: 1;
}

.game-container {
  height: min(clamp(calc(100% - 4rem), calc(100% - 20vw), calc(100% - 4rem)), calc(100vw - 2rem));
  aspect-ratio: 1/1;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  background-image: url("./img/background.svg");
  background-repeat: no-repeat;
  background-size: 100%;
  position: relative;
}

.node {
  width: 100%;
  aspect-ratio: 1/1; 
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  padding: 20%;
  cursor: pointer;
  position: relative;
}

.node img {
  width: 100%;
  object-position: top;
  object-fit: cover;
  animation-name: image;
  animation-duration: 0.1s;
  transition: transform 1s, position;
  position: relative;
}

@keyframes image {
  from {
    height: 0%;
  }
  to {
    height: 100%;
  }
}

.row::after {
  content: "";
  position: absolute;
  height: 5%;
  left: 0;
  right: 100%;
  top: 50%;
  transform: translate(0, -50%);
  animation-name: r;
  animation-duration: 0.2s;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  border-radius: 0.5rem 0 0 0.5rem;
}

.row ~ .row::after {
  animation-delay: 0.2s;
  border-radius: 0;
}

.row ~ .row ~ .row::after {
  animation-delay: 0.4s;
  border-radius: 0 0.5rem 0.5rem 0;
}

@keyframes r {
  from {
    right: 100%;
  }
  to {
    right: 0%;
  }
}

.column::after {
  content: "";
  position: absolute;
  width: 5%;
  top: 0;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, 0);
  animation-name: c;
  animation-duration: 0.2s;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  border-radius: 0.5rem 0.5rem 0 0;
}

.column ~ .column::after {
  animation-delay: 0.2s;
  border-radius: 0;
}

.column ~ .column ~ .column::after {
  animation-delay: 0.4s;
  border-radius: 0 0 0.5rem 0.5rem;
}

@keyframes c {
  from {
    bottom: 100%;
  }
  to {
    bottom: 0%;
  }
}

.diagonalOne::after {
  content: "";
  position: absolute;
  width: 5%;
  top: 0;
  bottom: 100%;
  left: 0;
  transform: translate(-50%, 0) rotate(-45deg) scaleY(sqrt(2));
  transform-origin: center 0;
  animation-name: dOne;
  animation-duration: 0.2s;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  border-radius: 0.5rem 0.5rem 0 0;
}

.diagonalOne ~ .diagonalOne::after {
  animation-delay: 0.2s;
  border-radius: 0;
}

.diagonalOne ~ .diagonalOne ~ .diagonalOne::after {
  animation-delay: 0.4s;
  border-radius: 0 0 0.5rem 0.5rem;
}

@keyframes dOne {
  from {
    bottom: 100%;
  }
  to {
    bottom: 0%;
  }
}

.diagonalTwo::after {
  content: "";
  position: absolute;
  width: 5%;
  top: 0;
  bottom: 100%;
  right: 0;
  transform: translate(50%, 0) rotate(45deg) scaleY(sqrt(2));
  transform-origin: center 0;
  animation-name: dOne;
  animation-duration: 0.2s;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  border-radius: 0.5rem 0.5rem 0 0;
}

.diagonalTwo ~ .diagonalTwo::after {
  animation-delay: 0.2s;
  border-radius: 0;
}

.diagonalTwo ~ .diagonalTwo ~ .diagonalTwo::after {
  animation-delay: 0.4s;
  border-radius: 0 0 0.5rem 0.5rem;
}

@keyframes dOne {
  from {
    bottom: 100%;
  }
  to {
    bottom: 0%;
  }
}

.line-light::after {
  background-color: var(--light-color);
}

.line-dark::after {
  background-color: var(--dark-color);
}

.winner {
  background-color: var(--background-color);
  position: absolute;
  top: -1rem;
  bottom: -1rem;
  left: -1rem;
  right: -1rem;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  display: inline;
}

.winner-container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
}

.winner-image-container {
  display: flex;
  justify-content: center;
  gap: 1rem;
  width: 100%;
}

.winner-image {
  width: clamp(8rem, 40vw, 12rem);
  object-position: top;
  object-fit: cover;
  transition: transform 1s, position;
  position: relative;
}

.winner-content {
  font-size: clamp(4rem, 20vw, 6rem);
}

.winner-buttons {
  display: flex;
  gap: 0.5rem;
}

.reveal-winner {
  animation-name: reveal;
  animation-duration: 1s;
  animation-fill-mode: forwards;
  animation-delay: 0.6s;
}

.reveal-winner > .winner-container {
  opacity: 1;
  animation-name: end;
  animation-duration: 1s;
  animation-delay: 0.6s;
}

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

@keyframes end {
  from {
    transform: translateY(20%);
    opacity: 0;
  }
  to {
    transform: translateY(0rem);
  }
}
