@import url("https://fonts.googleapis.com/css2?family=Fugaz+One&display=swap");

:root {
  --background: #1e1e1e;
  --grid: #e1e1e1;
  --x-color: #ff2240;
  --o-color: #0091ff;
}

@keyframes timerBar {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

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

html {
  max-width: 100dvw;
  max-height: 100dvh;
  background-color: var(--background);
}
body {
  width: 100dvw;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.actualPlayer {
  position: absolute;
  top: 3%;
  left: 1%;
  width: 40vmin;
  max-width: 200px;
  height: 12vmin;
  max-height: 45px;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: clamp(1rem, 4vmin, 1.2rem);
  color: var(--grid);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease, background-color 0.3s ease,
    visibility 0.5s ease;
  overflow: hidden;
  z-index: 1;
}

.actualPlayer::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  background-color: rgba(0, 0, 0, 0.4);
  width: 0%;
  z-index: -1;
}

.actualPlayer.counting::after {
  animation: timerBar 5s linear forwards;
}

.actualPlayer.hidden {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.playerX {
  background-color: var(--x-color);
}

.playerO {
  background-color: var(--o-color);
}

#board {
  width: 90vmin;
  height: 90vmin;
  max-width: 800px;
  max-height: 800px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 1%;
}

.slots {
  display: flex;
  justify-content: center;
  align-items: center;
}
.slots:not(:has(*)) {
  cursor: pointer;
}

#slot1,
#slot2,
#slot4,
#slot5,
#slot7,
#slot8 {
  border-right: 2px solid var(--grid);
}

#slot1,
#slot2,
#slot3,
#slot4,
#slot5,
#slot6 {
  border-bottom: 2px solid var(--grid);
}

.bi-x-lg {
  color: var(--x-color);
  font-size: 18vmin;
}

.bi-circle {
  color: var(--o-color);
  font-size: 16vmin;
}

.black-bg {
  display: none;
  width: 100vw;
  height: 100vh;
  position: absolute;
  background-color: #000000;
  opacity: 0.85;
  z-index: 100;
}

.popup {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 400px;
  height: auto;
  padding: 20px;
  min-height: 200px;
  background-color: #333333;
  border-radius: 15px;
  box-shadow: 0 0 5px 2px #000000;
  z-index: 101;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  color: var(--grid);
}

.close-popup {
  position: absolute;
  top: 0;
  right: 5px;
  width: auto;
  padding-right: 0;
}

.bi-x {
  font-size: 2rem;
  cursor: pointer;
}

#winnerIcon i {
  font-size: 5rem !important;
}

#winnerLabel {
  font-size: 1.5rem;
  text-align: center;
}
.active {
  display: flex;
}

.light-spot {
  position: fixed;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.6;
  z-index: -1;
}

#light-top-right {
  top: -50px;
  right: -50px;
  background-color: var(--x-color);
  box-shadow: 0 0 150px 70px var(--x-color);
}

#light-bottom-left {
  bottom: -50px;
  left: -50px;
  background-color: var(--o-color);
  box-shadow: 0 0 150px 70px var(--o-color);
}

.scoreboard {
  position: absolute;
  top: 3%;
  right: 3%;
  display: flex;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 0 15px;
  height: 45px;
  color: var(--grid);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  z-index: 1;
  font-size: 1.1rem;
}

.score-label {
  font-weight: bold;
  padding-right: 15px;
  margin-right: 15px;
  border-right: 2px solid rgba(255, 255, 255, 0.1);
  letter-spacing: 1px;
}

.score-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-item i {
  font-size: 1.2rem;
}

.x-score {
  padding-right: 15px;
  margin-right: 15px;
  border-right: 2px solid rgba(255, 255, 255, 0.1);
}

.x-score i {
  color: var(--x-color);
}

.o-score i {
  color: var(--o-color);
}

@media (max-width: 900px) {
  #board {
    width: 78vmin;
    height: 78vmin;
  }
}

@media (max-width: 700px) {
  .light-spot {
    width: 150px;
    height: 150px;
  }
  .actualPlayer {
    left: 50%;
    transform: translateX(-50%);
  }
  .scoreboard {
    top: auto;
    bottom: 5%;
    right: 50%;
    transform: translateX(50%);
    width: 90%;
    justify-content: center;
    max-width: 350px;
  }
}
