/* Variables */
:root {
  --cell-size: 10rem;
  --mark-size: calc(var(--cell-size) * 0.8);

  --cell-size-mobile: 6rem;
  --mark-size-mobile: calc(var(--cell-size) * 0.5);

  --backBoard: #1b2438;

  --hover: linear-gradient(#6a85b6, #bac8e0);
  --restart: linear-gradient(#4d878d, #455a64);

  --xMark: linear-gradient(#ff8008, #ffc837);
	--oMark: linear-gradient(#4776e6, #8e54e9);

  --light:#d7d9e7;
	--grey: #7f8287;
	--dark: #5b758e;
}
/* End of Variables */

/* Resets */
*,
*::after,
*::before {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Import font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');


body {
  margin: 0;
  font-family: "Poppins", sans-serif;
  background-color: var(--backBoard);
  
}

h1 {
  font-size: 3.1rem;
  font-weight: 600;
  color: var(--light);
  margin: 0;
  padding-top: 1.5rem;
}

section {
  text-align: center;
}

/* .gameStatus{
  font-weight: 400;
  color:rgb(209, 132, 247);
  margin-bottom: 1.8rem;
  font-size: 2rem;
} */

/* create grid for board */
.board {
  margin-top: -4rem;
  width: 100vw;
  height: 100vh;
  display: grid;
  justify-content: center;
  align-content: center;
  justify-items: center;
  align-items: center;
  grid-template-columns: repeat(3, auto);
}

/* create each cell in the grid */
.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  border: 1px solid var(--grey);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  cursor: pointer;
}

/* remove top border of the 3 top cells */
.cell:first-child,
.cell:nth-child(2),
.cell:nth-child(3) {
  border-top: none;
}

/* remove left border of the 3 left cells */
.cell:nth-child(3n + 1) {
  border-left: none;
}

/* remove right border of the 3 right cells */
.cell:nth-child(3n + 3) {
  border-right: none;
}

/* remove bottom border of the 3 bottom cells */
.cell:last-child,
.cell:nth-child(8),
.cell:nth-child(7) {
  border-bottom: none;
}

/* de-activate cell that has been played */
.cell.x,
.cell.circle {
  cursor: not-allowed;
}

/* mark cell with X */
.cell.x::before,
.cell.x::after,
.cell.circle::before {
  background: var(--xMark);
}

/* mark cell with O */
.cell.circle::before {
  background: var(--oMark);
}

/* create hover effect for both x and o */
.board.x .cell:not(.x):not(.circle):hover::before,
.board.x .cell:not(.x):not(.circle):hover::after,
.board.circle .cell:not(.x):not(.circle):hover::before {
  background: var(--hover);
  opacity: 0.7;
}

/* create size of X or O at hover */
.cell.x::before,
.cell.x::after,
.board.x .cell:not(.x):not(.circle):hover::before,
.board.x .cell:not(.x):not(.circle):hover::after {
  content: "";
  position: absolute;
  width: calc(var(--mark-size) * 0.15);
  height: var(--mark-size);
}

/* create X mark */
.cell.x::before,
.board.x .cell:not(.x):not(.circle):hover::before {
  transform: rotate(45deg);
}

.cell.x::after,
.board.x .cell:not(.x):not(.circle):hover::after {
  transform: rotate(-45deg);
}

/* create O mark */
.cell.circle::before,
.cell.circle::after,
.board.circle .cell:not(.x):not(.circle):hover::before,
.board.circle .cell:not(.x):not(.circle):hover::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

/* hover effect before cell is marked */
.cell.circle::before,
.board.circle .cell:not(.x):not(.circle):hover::before {
  width: var(--mark-size);
  height: var(--mark-size);
}

/* hover effect after cell is marked */
.cell.circle::after,
.board.circle .cell:not(.x):not(.circle):hover::after {
  width: calc(var(--mark-size) * 0.7);
  height: calc(var(--mark-size) * 0.7);
  background-color:var(--backBoard);
}

/* create winning message screen */
.winning-message {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.85);
  justify-content: center;
  align-items: center;
  color: var(--light);
  font-size: 4rem;
  flex-direction: column;
}

/* hide winning message gif icon */
.imgbox{
  display: none;
}

/* style winning message gif icon */
.imgbox img{
  width: 0;
  transition: width 1s ease-in-out;
  margin-left: -2rem;
}


/* style restart button */
.winning-message button {
  font-size: 1.5rem;
  background: #4c988d;
  border: 1px solid #263238;
  color: #1b2429;
  border-radius: 0.8rem;
  padding: 0.5rem 1rem;
  margin-top: 1rem;
  cursor: pointer;
  transition: 0.3s;
}

/* hover effect for restart button */
.winning-message button:hover {
  color: white;
  border-color: white;
  transform: scale(1.1);
}

/* show the winning message */
.winning-message.show {
  display: flex;
}

[data-winning-message-text] {
  display: flex;
  justify-content: space-evenly;
  flex-direction: column;
}

/* hide winning message gif icon */
.imgbox.show{
  display: flex;
}



/* STYLING FOR MOBILE DEVICES */
@media screen and (max-width: 950px){
  h1{
    font-size: 2rem;
  }

  .board{
    margin-top: -8rem;
  }

  .cell{
    width: var(--cell-size-mobile);
    height: var(--cell-size-mobile);
  }

/* hover effect before cell is marked */
.cell.circle::before,
.board.circle .cell:not(.x):not(.circle):hover::before {
  width: var(--mark-size-mobile);
  height: var(--mark-size-mobile);
}

.cell.x::before,
.cell.x::after,
.board.x .cell:not(.x):not(.circle):hover::before,
.board.x .cell:not(.x):not(.circle):hover::after {
  content: "";
  position: absolute;
  width: calc(var(--mark-size-mobile) * 0.15);
  height: var(--mark-size-mobile);
}

.cell.circle::before,
.board.circle .cell:not(.x):not(.circle):hover::before {
  width: var(--mark-size-mobile);
  height: var(--mark-size-mobile);
}

.cell.circle::after,
.board.circle .cell:not(.x):not(.circle):hover::after {
  width: calc(var(--mark-size-mobile) * 0.7);
  height: calc(var(--mark-size-mobile) * 0.7);
  background-color:var(--backBoard);
}

.winning-message{
  font-size: 2.5rem;
}


}