.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.game-intro {
  max-width: 500px;
  margin: 20px auto 0;
  text-align: center;
  font-family: "Nunito", sans-serif;
}
.game-intro h1 {
  font-family: "Fredoka One", cursive;
  color: #4f46e5;
  font-size: 2.5rem;
  margin-bottom: 5px;
}
.game-intro p {
  color: #4b5563;
  font-size: 1.1rem;
  margin-bottom: 0;
}

.game-container {
  max-width: 500px;
  margin: 20px auto 40px;
  background: #ffffff;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.stats {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-family: "Fredoka One", cursive;
  font-size: 1.4rem;
  color: #4f46e5;
  margin-bottom: 20px;
  height: 60px;
}

.stat-box {
  text-align: left;
  display: flex;
  flex-direction: column;
}
#streak-meter {
  font-size: 0.9rem;
  color: #f59e0b;
  margin-top: 2px;
  line-height: 1;
}

#puzzle-box {
  position: relative;
  padding: 20px;
  border-radius: 15px;
  border: 4px solid transparent;
  transition: all 0.3s ease;
}
#equation {
  font-size: 4rem;
  font-family: "Fredoka One", cursive;
  margin: 20px 0;
  color: #111827;
  min-height: 1.2em;
}

#bonus-alert {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #f59e0b;
  color: white;
  padding: 5px 15px;
  border-radius: 20px;
  font-family: "Fredoka One", cursive;
  animation: floatUp 0.8s ease-out forwards;
  z-index: 10;
}

@keyframes floatUp {
  0% {
    transform: translate(-50%, 0);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -40px);
    opacity: 0;
  }
}

.correct-flash {
  animation: correct-bg 0.4s ease-out;
}
.wrong-flash {
  animation: wrong-bg 0.4s ease-out;
}

@keyframes correct-bg {
  0% {
    background-color: #ffffff;
  }
  50% {
    background-color: #d1fae5;
  }
  100% {
    background-color: #ffffff;
  }
}

@keyframes wrong-bg {
  0% {
    background-color: #ffffff;
  }
  25% {
    transform: translateX(-8px);
    background-color: #fee2e2;
  }
  50% {
    transform: translateX(8px);
  }
  75% {
    transform: translateX(-8px);
  }
  100% {
    transform: translateX(0);
    background-color: #ffffff;
  }
}

#answer-input {
  width: 140px;
  padding: 15px;
  font-size: 2rem;
  border: 4px solid #e5e7eb;
  border-radius: 15px;
  text-align: center;
  font-family: "Nunito", sans-serif;
  outline: none;
}
#submit-btn {
  display: block;
  margin: 25px auto 0;
  background: #2ecc71;
  color: white;
  border: none;
  padding: 15px 40px;
  font-size: 1.5rem;
  border-radius: 50px;
  cursor: pointer;
  font-family: "Fredoka One", cursive;
}

.difficulty-picker {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}
.difficulty-picker button {
  font-family: "Nunito", sans-serif;
  border: none;
  background: #f3f4f6;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
}
.difficulty-picker button.active {
  background: #4f46e5;
  color: white;
}

#start-screen,
#game-over {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 20;
  box-sizing: border-box;
}
#start-screen {
  background: #4f46e5;
  color: white;
  padding: 0;
}
#game-over {
  background: rgba(255, 255, 255, 0.98);
  color: #111827;
  padding: 20px;
}
#new-record-badge {
  background: #9333ea;
  color: white;
  padding: 8px 20px;
  border-radius: 12px;
  font-family: "Fredoka One", cursive;
  font-size: 1.3rem;
  margin-bottom: 15px;
  animation: pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop {
  0% {
    transform: scale(0);
  }
  100% {
    transform: scale(1);
  }
}

.high-score-table {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  padding: 15px;
  border-radius: 15px;
  margin: 15px 0;
  width: 220px;
}
.score-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-family: "Nunito", sans-serif;
  font-weight: 600;
  margin-bottom: 5px;
}
.score-row span:last-child {
  font-family: "Fredoka One", cursive;
  color: #ffd700;
}
.reset-link {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
  margin-top: 10px;
}

#start-btn,
#game-over button {
  background: #ffffff;
  color: #4f46e5;
  border: none;
  padding: 15px 40px;
  font-size: 1.5rem;
  border-radius: 50px;
  cursor: pointer;
  font-family: "Fredoka One", cursive;
  margin-top: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
#game-over button {
  background: #ff4757;
  color: white;
}

#confetti-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 25;
}
.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall {
  to {
    transform: translateY(500px) rotate(360deg);
    opacity: 0;
  }
}
.hidden {
  display: none !important;
}

.how-to-play {
  max-width: 500px;
  margin: 40px auto;
  padding: 20px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  font-family: "Nunito", sans-serif;
}
.how-to-play h2 {
  font-family: "Fredoka One", cursive;
  color: #4f46e5;
  margin-bottom: 20px;
}
.instructions-grid {
  display: grid;
  gap: 15px;
  text-align: left;
}
.step {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 10px;
  background: #f9fafb;
  border-radius: 12px;
}
.step-number {
  background: #4f46e5;
  color: white;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-family: "Fredoka One", cursive;
  flex-shrink: 0;
}
.step p {
  margin: 0;
  font-size: 1rem;
  color: #374151;
  line-height: 1.4;
}
