* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background-color: #2a2a2a;
}

#gameCanvas {
  display: block;
  margin: 0 auto;
}

#topBar {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  z-index: 100;
}

#currentLetterDisplay {
  background-color: rgba(255, 255, 255, 0.9);
  padding: 8px 12px;
  border-radius: 8px;
  font-family: Arial, sans-serif;
  font-size: 16px;
  font-weight: bold;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
}

#nextLetterImage {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

#scoreDisplay {
  background-color: rgba(255, 255, 255, 0.9);
  padding: 8px 12px;
  border-radius: 8px;
  font-family: Arial, sans-serif;
  font-size: 16px;
  font-weight: bold;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
}

#celebration {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 1000;
}

#celebration.show {
  display: flex;
  animation: fadeIn 0.5s ease-in;
}

#celebration h1 {
  font-family: Arial, sans-serif;
  font-size: 72px;
  color: gold;
  text-shadow: 0 0 20px gold, 0 0 40px orange;
  animation: pulse 1s ease-in-out infinite;
  margin-bottom: 20px;
}

#celebration p {
  font-family: Arial, sans-serif;
  font-size: 24px;
  color: white;
  margin-bottom: 30px;
}

#celebration button {
  padding: 15px 30px;
  font-size: 20px;
  background-color: gold;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  transition: transform 0.2s;
}

#celebration button:hover {
  transform: scale(1.1);
}

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

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  background-color: gold;
  animation: confettiFall 3s ease-in forwards;
  z-index: 999;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

#dangerLine {
  position: fixed;
  height: 3px;
  background: linear-gradient(90deg, transparent, #ff4444, #ff4444, transparent);
  z-index: 10;
  pointer-events: none;
}

#gameOver {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 1000;
}

#gameOver.show {
  display: flex;
  animation: fadeIn 0.5s ease-in;
}

#gameOver h1 {
  font-family: Arial, sans-serif;
  font-size: 72px;
  color: #ff4444;
  text-shadow: 0 0 20px #ff4444, 0 0 40px #ff0000;
  margin-bottom: 20px;
}

#gameOver p {
  font-family: Arial, sans-serif;
  font-size: 28px;
  color: white;
  margin-bottom: 30px;
}

#gameOver button {
  padding: 15px 30px;
  font-size: 20px;
  background-color: #ff4444;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  transition: transform 0.2s, background-color 0.2s;
}

#gameOver button:hover {
  transform: scale(1.1);
  background-color: #ff6666;
}

#footer {
  position: fixed;
  bottom: 15px;
  right: 20px;
  z-index: 100;
}

#footer a {
  font-family: Arial, sans-serif;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  transition: color 0.2s;
}

#footer a:hover {
  color: rgba(255, 255, 255, 0.9);
}
