@import url("https://cdn.jsdelivr.net/npm/modern-normalize@2.0.0/modern-normalize.css");

* {
  box-sizing: border-box;
  font-family: 'Poppins';
}

:root {
  line-height: 1.5;
}

h1, h2, h3, h4, h5, figure, p, ol, ul {
  margin: 0;
}

ol[role="list"], ul[role="list"] {
  list-style: none;
  padding-inline: 0;
}

h1, h2, h3, h4, h5 {
  font-size: inherit;
  font-weight: inherit;
}

img {
  display: block;
  max-inline-size: 100%;
}

button {
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  color: inherit;
  border: none;
}

a {
  text-decoration: none;
  color: inherit;
}

/* End of reset */

body {
  background-color: #e9f8ff;
  height: 100vh;
  height: 100dvh;
  padding: 1%;
  display: grid;
  grid-template: 1fr 0.5fr 4fr 0.5fr 1fr / 1fr;
}


#stat-display {
  display: flex;
  justify-content: center;
  grid-area: 1 / 1 / 2 / 2;
  font-weight: 510;
  font-size: 1.6rem;
  justify-content: space-around;
}

.total-wins,
.total-losses,
.total-draws {
  transition: color 250ms;
}

#wins-display:hover > .total-wins {
  color: #00e904;
}

#losses-display:hover > .total-losses {
  color: #ff0000;
}

#draws-display:hover > .total-draws {
  color: #00aeff;
}

#mark-display {
  display: flex;
  justify-content: center;
  align-items: end;
  grid-area: 2 / 1 / 3 / 2;
  font-weight: 510;
  font-size: 1.2rem;
  gap: 37%;
}

.x-mark-display {
  color: #00aeff;
}

.o-mark-display {
  color: #ff0000;
}

#board-container {
  width: fit-content;
  height: fit-content;
  display: grid;
  grid-template: 1fr 1fr 1fr / 1fr 1fr 1fr;
  grid-area: 3 / 1 / 4 / 2;
  background-color: white;
  margin: 1.3%;
  padding: 3% 15% 3% 15%;
  justify-self: center;
  align-self: center;
  border-radius: 70px;
  border: 10px solid black;
}

.board-piece {
  font-size: 5rem;
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: center;
  justify-self: center;
  align-self: center;
  height: 8rem;
  width: 8rem;
  cursor: pointer;
  transition: background-color 500ms linear;
}

.board-piece:hover {
  background-color: rgb(240, 240, 240);
}

.board-piece:active {
  background-color: white;
}


#center-board-piece {
  border: 20px solid #16739e;
}

#center-left-board-piece,
#center-right-board-piece {
  border: solid #16739e;
  border-width: 20px 0 20px 0;
}

#top-center-board-piece,
#bottom-center-board-piece {
  border: solid #16739e;
  border-width: 0 20px 0 20px;
}

#top-left-board-piece {
  border-radius: 25px 0 0 0;
}

#top-right-board-piece {
  border-radius: 0 25px 0 0;
}

#bottom-right-board-piece {
  border-radius: 0 0 25px 0;
}

#bottom-left-board-piece {
  border-radius: 0 0 0 25px;
}

.x-board-piece {
  color: #00aeff;
}

.x-board-piece:hover {
  transition: 200ms background-color;
  background-color: white;
}

.o-board-piece {
  color: #ff0000;
}

.o-board-piece:hover {
  transition: 200ms background-color;
  background-color: white;
}

#you-win-display {
  font-size: 1.5rem;
  font-weight: 550;
  animation: fade-in 500ms ease-out;
}

#button-container {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  grid-area: 4 / 1 / 5 / 2  ;
  gap: 20px;
  height: 3vh;
}

#play-again-button,
#switch-mark-button {
  background-color: #00ff06;
  border: 2px solid black;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 5px;
  padding: 0.2% 1% 0.2% 1%;
  cursor: pointer;
  transition: background-color 250ms, transform 300ms ease;
  transform-origin: center;
}

@keyframes fade-in {
  from {
    opacity: 0%;
  }
  to {
    opacity: 100%;
  }
}

#play-again-button:hover,
#switch-mark-button:hover {
  transform: scale(1.1, 1.1);
}

#play-again-button:active,
#switch-mark-button:active {
  background-color: rgb(165, 255, 120);
}

footer {
  grid-area: 5 / 1 / 6 / 2;
  margin-top: auto;
}

#footer-text {
  font-weight: 550;
  text-align: center;
}

#footer-anchor {
  font-family: 'Space Mono';
}

#name-wrapper {
  font-family: 'Space Mono';
}

#footer-anchor:hover > #name-wrapper {
  font-style: italic;
}





/* @media (max-height: 700px) {
  body {}
} */







@media (max-width: 650px) {
  body {
    height: 100vh;
    height: 100dvh;
    grid-template: 10vh 10vh 1fr 10vh 10vh / 1fr;
    padding: 0;
    margin: 0;
    align-items: center;
    overflow: hidden;
  }

  #mark-display {
    gap: 25vw;
  }

  #button-container {
    margin-top: -10%;
  }

  #board-container {
    grid-template: 1fr 1fr 1fr / 33% 33% 33%;
    width: 90%;
    padding: 2% 0 2% 0;
    overflow: hidden;
    margin: 4%;
  }

  .board-piece {
    font-size: 3rem;
    height: 6rem;
    width: 6rem;
  }

  .board-piece:hover {
    background-color: initial;
  }

  .x-board-piece:hover {
    background-color: initial;
  }

  #top-left-board-piece,
  #center-left-board-piece,
  #bottom-left-board-piece {
    margin-right: -30vw;
  }

  #top-right-board-piece,
  #center-right-board-piece,
  #bottom-right-board-piece {
    margin-left: -30vw;
  }

  #center-board-piece {
    border: 15px solid #16739e;
  }

  #center-left-board-piece,
  #center-right-board-piece {
    border: solid #16739e;
    border-width: 15px 0 15px 0;
  }

  #top-center-board-piece,
  #bottom-center-board-piece {
    border: solid #16739e;
    border-width: 0 15px 0 15px;
  }

  footer {
    margin: auto;
  }
  
  #stat-display {
    font-size: 1rem;
  }
  
  #footer-text {
    font-size: 0.8rem;
  }
}





@media (max-width: 575px) {
  #top-left-board-piece,
  #center-left-board-piece,
  #bottom-left-board-piece {
    margin-right: -25vw;
  }

  #top-right-board-piece,
  #center-right-board-piece,
  #bottom-right-board-piece {
    margin-left: -25vw;
  }
}



@media (max-width: 500px) {
  #top-left-board-piece,
  #center-left-board-piece,
  #bottom-left-board-piece {
    margin-right: -20vw;
  }

  #top-right-board-piece,
  #center-right-board-piece,
  #bottom-right-board-piece {
    margin-left: -20vw;
  }

  #play-again-button,
  #switch-mark-button {
    padding: 0.5% 2% 0.5% 2%;
  }
}




@media (max-width: 450px) {
  #top-left-board-piece,
  #center-left-board-piece,
  #bottom-left-board-piece {
    margin-right: -15vw;
  }

  #top-right-board-piece,
  #center-right-board-piece,
  #bottom-right-board-piece {
    margin-left: -15vw;
  }
}





@media (max-width: 375px) {
  #board-container {
    padding: 7% 10% 7% 10%;
  }
  #top-left-board-piece,
  #center-left-board-piece,
  #bottom-left-board-piece {
    margin-right: 8vw;
  }

  #top-right-board-piece,
  #center-right-board-piece,
  #bottom-right-board-piece {
    margin-left: 8vw;
  }
}
