/* =============================
   GLOBAL
============================= */
* {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  text-align: center;
  background: #eef3f7;
  margin: 0;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

/* =============================
   HEADER (LOGO)
============================= */
#header {
  text-align: center;
  margin: 10px 0;
}

#header img {
  width: 100%;
  max-width: 320px;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* =============================
   BUTTONS
============================= */
button {
  padding: 15px;
  font-size: 16px;
  border: none;
  border-radius: 16px;
  background: #4CAF50;
  color: white;
  cursor: pointer;
}

button:active {
  transform: scale(0.96);
}

button:disabled {
  opacity: 0.5;
}

/* =============================
   MENU GRID
============================= */
#menuGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  padding: 0 12px;
}

#menuGrid button {
  line-height: 1.4;
  min-height: 80px;
}

#menuGrid button br {
  line-height: 10px;
}

/* =============================
   CONTROLS
============================= */
.timer-setting,
.sound-toggle,
.case-toggle {
  text-align: center;
  margin-top: 10px;
}

/* =============================
   GAME AREA
============================= */
#prompt {
  font-size: 36px;
  margin: 20px 0 20px;
  font-weight: bold;
}

.target-word {
  color: #2c3e50;
  font-size: 42px;
  letter-spacing: 2px;
}

#bottomBar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 400px;
  margin: 10px auto 20px;
  font-size: 20px;
  font-weight: bold;
  padding: 0 20px;
}

/* =============================
   GRID (GAME)
============================= */
#grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  padding: 0 12px;
  margin-bottom: 20px;
}

.card {
  background: white;
  border-radius: 15px;
  padding: 25px;
  font-size: 40px;
  cursor: pointer;
}

.card:active {
  transform: scale(0.9);
}

/* =============================
   BLUR
============================= */
#gameContent.blur {
  filter: blur(6px);
}

/* =============================
   OVERLAYS (FIXED - IMPORTANT)
============================= */
#startOverlay,
#countdownOverlay,
#endOverlay {
  position: fixed; /* 🔥 FIXED (not absolute) */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(0,0,0,0.4);
  z-index: 999;
}

/* Start button */
#startOverlay button {
  font-size: 32px;
  padding: 20px 40px;
  background: #ff9800;
}

/* =============================
   COUNTDOWN
============================= */
#countdownNumber {
  font-size: 120px;
  color: white;
  font-weight: bold;
  transform: scale(0.5);
  opacity: 0;
}

.countdown-pop {
  animation: pop 0.4s ease;
}

@keyframes pop {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* =============================
   FEEDBACK (CORRECT / WRONG)
============================= */
#overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 180px;
  pointer-events: none;

  opacity: 0;
  transform: scale(0.5);
  z-index: 1000;
}

#overlay.show {
  opacity: 1;
  transform: scale(1.2);
  transition: transform 0.15s ease-out, opacity 0.15s ease-out;
}

#overlay.fade-out {
  opacity: 0;
  transform: scale(0.8);
  transition: transform 0.2s ease-in, opacity 0.2s ease-in;
}

.correct { color: #2ecc71; }
.wrong { color: #e74c3c; }

/* =============================
   END SCREEN
============================= */
.end-box {
  background: white;
  padding: 30px;
  border-radius: 15px;
  text-align: center;
}

.end-box h2 {
  font-size: 28px;
  margin-bottom: 10px;
}

.end-box p {
  font-size: 22px;
  margin-bottom: 20px;
}

.end-box button {
  display: block;
  width: 200px;
  margin: 10px auto;
}