html, body {
  height: 100%;
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f4f4;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.color-pickers {
  position: absolute;
  top: 0.5rem;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 10;
}

.picker-group {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.color-pickers label {
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.ai-toggle {
  margin-top: 0.3rem;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  cursor: pointer;
  border: 2px solid #333;
  background-color: white;
  border-radius: 4px;
  user-select: none;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.ai-toggle.pressed {
  background-color: #333;
  color: white;
}

.container {
  width: 100vw;
  height: 100vh;
  padding: 1rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  z-index: 1;
}

h1 {
  font-size: clamp(1.5rem, 5vw, 3rem);
  margin: 2rem 0 1rem;
}

#game-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  width: min(90vw, 90vh - 12rem);
  height: min(90vw, 90vh - 12rem);
  border: 2px solid #333;
  box-sizing: border-box;
  aspect-ratio: 1 / 1;
}

.cell {
  background: white;
  border: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(min(90vw, 90vh - 12rem) / 6);
  cursor: pointer;
  user-select: none;
  aspect-ratio: 1 / 1;
  margin: -1px;
}

.cell:hover {
  background: #eee;
}

#status {
  font-weight: bold;
  font-size: clamp(1rem, 3vw, 1.5rem);
  margin: 0.5rem 0;
  text-align: center;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  color: white;
  background-color: transparent;
  transition: background-color 0.5s ease;
}

button#restart {
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

/* Winner Overlay */

#winner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  user-select: none;
}

#winner-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* The actual message box */

#winner-overlay .winner-message {
  background: inherit; /* Will be set via JS inline style for color */
  color: white;
  padding: 2rem 3rem;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(255 255 255 / 0.7);
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: bold;
  text-align: center;
  animation: sparkle 2s ease-in-out infinite alternate, fadeInScale 0.7s ease forwards;
  max-width: 90vw;
  cursor: default;
}

/* Subtle sparkle effect */
@keyframes sparkle {
  0%, 100% { text-shadow: 0 0 10px white; }
  50% { text-shadow: 0 0 20px gold, 0 0 30px yellow; }
}

/* fade & scale in */
@keyframes fadeInScale {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}
