@import url('https://fonts.cdnfonts.com/css/monaco');

:root {
  --board-size-small: 300px;
  --board-size-normal: 400px;

  --bg-color-1: rgb(255, 102, 158);
  --bg-color-2: rgb(255, 155, 102);
  --bg-color-3: rgb(255, 219, 129);
  --nav-bg-color: rgb(44, 18, 59);

  --x-color: white;
  --o-color: white;

  --winner-panel-color: rgba(52, 36, 9, 0.745);
  --winner-panel-header-color: rgb(255, 255, 255);
  --btn-bg-color: rgb(246, 137, 48);
  --btn-bg-color-hover: rgb(255, 125, 73);
  --btn-bg-color-active: rgb(253, 107, 44);
}

* {
  box-sizing: border-box;
}

body {
  display: flex;
  height: 100vh;
  margin: 0;
  background: linear-gradient(65deg, var(--bg-color-1), var(--bg-color-2), var(--bg-color-3));
  font-family: 'Monaco', sans-serif;
}

button {
  font-family: 'Monaco', sans-serif;
}

main {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  position: relative;
}

main h1 {
  color: white;
  font-size: 40px;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, auto);
  
  background-color: transparent;
  width: var(--board-size-normal);
  height: var(--board-size-normal);

  border: 2px solid white;
}

.cell {
  display: flex;
  position: relative;
  border: 2px solid white;
  align-items: center;
  justify-content: center;
  transition: background-color 0.5s ease 0ms;
}

.cell.o-winner {
  background-color: rgba(165, 255, 47, 0.7);
}
.cell.x-winner {
  background-color: rgba(255, 64, 47, 0.7);
}

/*Draws diagonals to form X shape*/


.x .diagonal-1 {
  content: "";
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
  background-color: var(--x-color);
  width: 100%;
  height: 5%;
  position: absolute;
  
}

.diagonal-1.hover, .diagonal-2.hover {
  opacity: 0.3;
}

.x .diagonal-2 {
  content: "";
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
  background-color: var(--x-color);
  width: 100%;
  height: 5%;
  position: absolute;
  
}
/*Draws a circle*/
.o {
  position: absolute;
  width: 75%;
  height: 75%;
  border-radius: 50%;
  border: 8px solid var(--o-color);
}

.o.hover {
  opacity: 0.3;
}

.stats-container {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  margin-top: 2rem;
}

.stat {
  display: flex;
  flex-direction: column;
  text-align: center;
  margin: 0 1.5rem;
  font-size: 1.2rem;
  color: white;
}

.winner-panel {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: absolute;
  background-color: var(--winner-panel-color);
  width: 100%;
  text-align: center;
  padding: 10px 0;
}

.winner-panel.show {
  display: flex;
}

.winner-panel h1 {
  font-size: 50px;
  margin: 0 0 1rem 0;
  color: var(--winner-panel-header-color);
  text-shadow: 0 0 2px var(--btn-bg-color);
}

.x-o-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 150px;
  height: 150px;
  position: relative;
  margin: 0 0 -10px 0;
}



button {
  border: none;
  padding: 0.5rem 0.7rem;
  border-radius: 0.25rem;
  font-family: inherit;
  background-color: var(--btn-bg-color);
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.1s ease 0ms;
}

button:hover {
  transform: scale(1.02);
  background-color: var(--btn-bg-color-hover);
}

button:active {
  background-color: var(--btn-bg-color-active);
}

#play-again {
  font-size: 20px;
  margin-bottom: 1rem;
}

@media (max-width: 480px) {

  main h1 {
    font-size: 32px;
    text-align: center;
  }
  .board {
    width: var(--board-size-small);
    height: var(--board-size-small);
  }

  .stat {
    font-size: 1rem;
  }
}

@media (max-height: 480px) {

  body {
    height: initial;
  }
}