/* style.css */
html, body {
  margin: 0;
  padding: 0;
  font-family: 'Arial', sans-serif;
  background: #fdf6e3;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  box-sizing: border-box;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
}

.game-container {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  max-width: 600px;
  height: 100%;
  padding: 10px;
  box-sizing: border-box;
  overflow: hidden;
}

h1 {
  margin: 0;
  font-size: 2rem;
}

.controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 360px;
  margin: 8px 0;
}

/* Speed Button */
#speed-btn {
  font-size: 1rem;
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}
.speed-slow {
  background-color: #dcedc8;
  color: #33691e;
}
.speed-medium {
  background-color: #fff59d;
  color: #f57f17;
}
.speed-fast {
  background-color: #ffcdd2;
  color: #b71c1c;
}

/* Miss Display */
#miss-display {
  font-size: 1.2rem;
  white-space: nowrap;
}

/* Timer */
#timer-display {
  font-size: 1.2rem;
  font-weight: bold;
  margin-left: 8px;
  white-space: nowrap;
  color: #3e2723;
}

/* Timer Warning */
.timer-warning {
  color: #b71c1c !important;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%   { transform: scale(1);   opacity: 1; }
  50%  { transform: scale(1.2); opacity: 0.7; }
  100% { transform: scale(1);   opacity: 1; }
}

#target-display {
  font-size: 2.2rem;
  font-weight: bold;
  color: #ff5722;
  background: #fff8e1;
  padding: 10px 20px;
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  margin: 10px 0;
}

#emoji-area {
  flex-grow: 1;
  width: 100%;
  background: #fff3cd;
  border: 2px dashed #ff9800;
  margin: 10px 0;
  position: relative;
  overflow: hidden;
}

.emoji {
  position: absolute;
  font-size: 3.5rem;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s ease;
}

/* Correct hit */
.hit {
  animation: explode 0.4s forwards;
  pointer-events: none;
}

@keyframes explode {
  0%   { transform: scale(1)   rotate(0deg);   opacity: 1; }
  50%  { transform: scale(2.5) rotate(180deg); opacity: 0.7; }
  100% { transform: scale(0)   rotate(360deg); opacity: 0; }
}

/* Wrong click */
.shake {
  animation: shake 0.35s ease;
  pointer-events: none;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-10px); }
  40%       { transform: translateX(10px); }
  60%       { transform: translateX(-7px); }
  80%       { transform: translateX(7px); }
}

#score-board {
  font-size: 1.1rem;
  margin: 5px 0;
}

#start-btn {
  font-size: 1.2rem;
  padding: 10px 20px;
  cursor: pointer;
  width: 90%;
  max-width: 300px;
}

/* Particles */
.particle {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 1;
  transition: transform 0.65s ease-out, opacity 0.65s ease-out;
  z-index: 1000;
}

/* ─── Game Over Overlay ─── */
#gameover-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 500;
  animation: fadeIn 0.3s ease;
}

#gameover-overlay.hidden {
  display: none;
}

#gameover-card {
  background: #fff8e1;
  border-radius: 18px;
  padding: 36px 48px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#gameover-title {
  font-size: 2.6rem;
  margin-bottom: 14px;
}

#gameover-score {
  font-size: 2rem;
  font-weight: bold;
  color: #ff5722;
  margin-bottom: 6px;
}

#gameover-highscore {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 24px;
  min-height: 1.5em;
}

#play-again-btn {
  font-size: 1.3rem;
  padding: 12px 32px;
  cursor: pointer;
  background: #ff5722;
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: bold;
  transition: transform 0.1s, background 0.15s;
}

#play-again-btn:hover {
  background: #e64a19;
}

#play-again-btn:active {
  transform: scale(0.95);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes popIn {
  from { transform: scale(0.75); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

@media (max-width: 400px) {
  #target-display {
    font-size: 2rem;
    padding: 8px 12px;
  }
  .emoji {
    font-size: 3rem;
  }
  #start-btn {
    font-size: 1rem;
    padding: 8px 16px;
  }
  #score-board {
    font-size: 1rem;
  }
  #timer-display {
    font-size: 1.1rem;
  }
  #miss-display {
    font-size: 1rem;
  }
  #gameover-card {
    padding: 24px 28px;
  }
  #gameover-title {
    font-size: 2rem;
  }
  #gameover-score {
    font-size: 1.6rem;
  }
}
