* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background-color: #548687;
  text-align: center;
}

.container {
  height: 70vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.game {
  height: 60vmin;
  width: 60vmin;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1.5vmin;
}

.box {
  flex: 1 1 calc(33.33% - 1.5vmin); /* Each box takes 1/3rd width minus gap */
  aspect-ratio: 1/1;                /* Keeps square shape */
  border: none;
  border-radius: 1.5rem;
  box-shadow: 0 0 1rem rgba(0, 0, 0, 0.5);
  font-size: 9vmin;
  color: #b0413e;
  background-color: #ffffc7;
  cursor: pointer;
}

.btn {
  padding: 1rem 2rem;  /* Fixed padding (no width expansion on click) */
  font-size: 2rem;
  background-color: #191913;
  color: #fff;
  border-radius: 1rem;
  border: none;
  cursor: pointer;
  transition: background 0.3s, transform 0.1s;
}

.btn:active {
  transform: scale(0.95); /* Press effect without changing width */
}

.btn:hover {
  background-color: #333;
}

#msg {
  color: #ffffc7;
  font-size: 8vmin;
  animation: fadeIn 0.8s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

.msg-container {
  height: 100vmin;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4rem;
}

.hide {
  display: none;
}

@media (max-width: 600px) {
  .game {
    width: 90vmin;
    height: 90vmin;
    gap: 2vmin;
  }

  .box {
    font-size: 12vmin;
  }

  .btn {
    font-size: 1.5rem;
    padding: 0.8rem 1.5rem;
  }

  #msg {
    font-size: 10vmin;
  }
}


/* Animate X/O placement */
.box.animate {
  animation: popIn 0.2s ease forwards;
}

@keyframes popIn {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Highlight winning boxes */
.box.winner {
  background-color: #b0413e; /* red highlight */
  color: #fff;
  box-shadow: 0 0 1.5rem rgba(176, 65, 62, 0.8);
  transition: background-color 0.3s, box-shadow 0.3s;
}

