* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: #f2f2f2;
  color: #222;
  text-align: center;
  transition: background-color 0.4s ease, color 0.4s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
}

.dark-mode {
  background-color: #121212;
  color: #eee;
}

h1 {
  font-weight: 700;
  margin-bottom: 1rem;
  text-decoration: underline;
}

.container {
  margin-top: 3rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.game {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  width: 320px;
  height: 320px;
  justify-content: center;
  align-items: center;
}

.box {
  width: 90px;
  height: 90px;
  font-size: 2.5rem;
  background: #e0e0e0; /* Soft light gray */
  border: 2px solid #888;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.3s ease;
  color: #222;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
}

.box:disabled {
  cursor: default;
  opacity: 0.7;
}

.box:hover:not(:disabled) {
  background-color: #bdbdbd;
  transform: scale(1.05);
}

.dark-mode .box {
  background: #333; /* Dark gray */
  border: 2px solid #555;
  color: #eee;
}

.dark-mode .box:hover:not(:disabled) {
  background-color: #555;
}

.box.win {
  background-color: #4caf50 !important; /* Green for win */
  color: white !important;
  animation: blink 0.6s ease-in-out infinite alternate;
}

#reset-btn,
#new-btn {
  margin-top: 1.5rem;
  background-color: blueviolet;
  padding: 0.75rem 2rem;
  font-size: 1.2rem;
  color: white;
  border-radius: 1rem;
  border: none;
  cursor: pointer;
  transition: background-color 0.3s ease;
  user-select: none;
}

#reset-btn:hover,
#new-btn:hover {
  background-color: #9b59b6;
}

.msg-container {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  min-height: 60px;
  font-weight: 600;
  font-size: 1.5rem;
}

.hide {
  display: none;
}

@keyframes blink {
  0% {
    box-shadow: 0 0 8px #4caf50;
  }
  100% {
    box-shadow: 0 0 20px #81c784;
  }
}
