/* ---------- Global Reset ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ---------- Body & Page ---------- */
body {
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  text-align: center;
  padding: 20px;
  color: #F8F8F8;
  background-color: #7A9E9F;
}

/* ---------- Title ---------- */
h1 {
  margin-bottom: 8px;
}

/* ---------- Status Bar (Level & Score) ---------- */
#statusBar {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 18px;
  margin-bottom: 4px;
}

/* ---------- Game Message ---------- */
.game-message {
  font-size: 28px;
  font-weight: bold;
  /* margin: 12px auto; */
  margin: 0 auto 12px auto;
  height: 36px;
  line-height: 36px;
  text-transform: uppercase;
  text-align: center;
  visibility: hidden;
  transition: visibility 0s, opacity 0.3s ease;
  opacity: 0;
}

.correct {
  /* color: #4CAF50; */
  visibility: visible;
  opacity: 1;
}

.wrong {
  /* color: #E53935; */
  visibility: visible;
  opacity: 1;
}

/* ---------- Grid (3×3) ---------- */
#grid {
  display: grid;
  grid-template-columns: repeat(3, 100px);
  grid-template-rows: repeat(3, 100px);
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}

.square {
  background-color: #F3F1DA;
  cursor: pointer;
  border-radius: 8px;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.3);
}

.square.blue   { background-color: #8090F5 !important; }
.square.red    { background-color: #FF8B8E !important; }
.square.green  { background-color: #86FFA1 !important; }
.square.yellow { background-color: #FFE37B !important; }

/* ---------- Countdown Bar ---------- */
#timerBarContainer {
  width: 300px;
  height: 10px;
  border: 1px solid #C7BFA6;
  margin: 10px auto;
  background-color: #eee;
  visibility: hidden;
  box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3);
}

#timerBar {
  height: 100%;
  width: 0%;
  background-color: orange;
}

/* ---------- Color Picker ---------- */
#colorSelector {
  margin-top: 10px;
  text-align: center;
}

.color-choice {
  display: inline-block;
  width: 50px;
  height: 50px;
  margin: 5px;
  border-radius: 25px;
  cursor: pointer;
  opacity: 1;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.3);
}

.color-choice[data-color="blue"]   { background-color: #8090F5; }
.color-choice[data-color="red"]    { background-color: #FF8B8E; }
.color-choice[data-color="green"]  { background-color: #86FFA1; }
.color-choice[data-color="yellow"] { background-color: #FFE37B; }

.color-choice.selected {
  box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.5);
}

/* ---------- Buttons ---------- */
button {
  padding: 10px 20px;
  font-size: 16px;
  margin: 10px;
  border: none;
  border-radius: 6px;
  background-color: lightgray;
  color: black;
  border: 2px solid #C7BFA6;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.3);
  transition: background-color 0.3s, color 0.3s;
}

button:enabled {
  background-color: #6AE05A;
  color: white;
  cursor: pointer;
}

button:disabled {
  background-color: #ccc;
  color: #666;
  cursor: not-allowed;
}

/* ---------- Animations ---------- */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

.pulse {
  animation: pulse 0.8s infinite;
}

.pulse-color {
  animation: pulse 0.8s infinite;
}

@keyframes fadeColor {
  from { background-color: inherit; }
  to   { background-color: transparent; }
}

.fade-color {
  animation: fadeColor 1s forwards;
}

/* ---------- Grid Container ---------- */
#gridContainer {
  position: relative;
  display: inline-block;
  overflow: hidden; /* keep flash inside bounds */
}

/* ---------- Circular Flash Behind Grid ---------- */
#gridFlash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  border-radius: 50%;
  transform: scale(0);
  background: radial-gradient(circle, rgba(0,0,0,0.1) 0%, transparent 70%);
  filter: blur(10px);
}

.flash-correct {
  animation: radialFlashGreen 3s ease-out forwards;
}

.flash-wrong {
  animation: radialFlashRed 3s ease-out forwards;
}

@keyframes radialFlashGreen {
  0% {
    transform: scale(0);
    opacity: 1;
    background: radial-gradient(circle, rgba(0,255,0,0.6) 0%, transparent 70%);
  }
  100% {
    transform: scale(3);
    opacity: 0;
    background: radial-gradient(circle, rgba(0,255,0,0.1) 20%, transparent 100%);
  }
}

@keyframes radialFlashRed {
  0% {
    transform: scale(0);
    opacity: 1;
    background: radial-gradient(circle, rgba(255,0,0,0.6) 0%, transparent 70%);
  }
  100% {
    transform: scale(3);
    opacity: 0;
    background: radial-gradient(circle, rgba(255,0,0,0.1) 20%, transparent 100%);
  }
}
