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

body {
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  touch-action: none;
}

#game-container {
  width: 100vw;
  height: 100vh;
  position: relative;
  background: #fff;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 15vh;
  background: rgba(255, 255, 255, 0.98);
  z-index: 10;
}

#gameover {
  padding-top: 8vh;
}

.hidden {
  display: none !important;
}

h1 {
  font-size: 2.2rem;
  color: #000;
  text-align: center;
  font-weight: 800;
  margin-bottom: 1.5rem;
  letter-spacing: 8px;
  text-transform: uppercase;
}

h2 {
  font-size: 2rem;
  color: #000;
  font-weight: 700;
  margin-bottom: 1rem;
}

#player-name {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

button {
  background: #000;
  border: none;
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}

button:hover {
  opacity: 0.85;
}

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

#best-score {
  margin-top: 1.5rem;
  color: #000;
  font-size: 1rem;
  font-weight: 500;
}

#best-score #best {
  font-weight: 700;
}

#final-score {
  font-size: 3rem;
  color: #000;
  font-weight: 800;
  letter-spacing: -2px;
}

#gameover p {
  color: #888;
  margin-bottom: 0.8rem;
  font-size: 0.85rem;
}

#retry-btn {
  background: #000;
  margin-bottom: 1rem;
}

#leaderboard {
  background: #f5f5f5;
  border-radius: 12px;
  padding: 0.8rem 1.2rem;
  width: 280px;
}

#leaderboard h3 {
  color: #000;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
}

#scores-list {
  list-style: none;
  max-height: 120px;
  overflow-y: auto;
}

#scores-list li {
  display: flex;
  align-items: center;
  padding: 0.35rem 0;
  border-bottom: 1px solid #e0e0e0;
  color: #000;
  font-size: 0.8rem;
}

#scores-list li span:last-child {
  margin-left: auto;
}

#scores-list li:last-child {
  border-bottom: none;
}

#scores-list li:first-child {
  font-weight: 700;
  color: #00aa00;
}

#scores-list li span:first-child {
  color: #888;
  margin-right: 0.5rem;
  font-weight: 600;
}

/* Menu images */
.menu-logo {
  width: 260px;
  height: auto;
  margin-bottom: -25px;
}

.menu-candle {
  position: absolute;
  bottom: 20px;
  left: -30px;
  width: 180px;
  height: auto;
}

.menu-grizz {
  position: absolute;
  bottom: 20px;
  right: -30px;
  width: 200px;
  height: auto;
}

.gameover-img {
  width: 280px;
  height: auto;
  margin-bottom: 0;
}

/* Animation game over */
#gameover.animating .gameover-img {
  animation: shrinkImage 0.8s ease-out forwards;
}

#gameover.animating .gameover-content {
  animation: fadeIn 0.5s ease-out 0.3s forwards;
  opacity: 0;
}

@keyframes shrinkImage {
  0% {
    width: 80vw;
  }
  100% {
    width: 280px;
  }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.rugged {
  color: #ff3333;
  font-size: 1.6rem;
  margin-bottom: -15px;
}

.gameover-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -20px;
}
