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

body {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
  font-family: 'Noto Sans', sans-serif;
}

#game-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  gap: 30px;
}

#stage-info {
  color: #fff;
  font-size: 24px;
  font-weight: bold;
}

#chests-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 20px;
}

.treasure-chest {
  cursor: pointer;
  transition: transform 0.2s;
}

.treasure-chest:hover {
  transform: scale(1.05);
}

.chest-img {
  width: 150px;
  height: auto;
  user-select: none;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  transition: opacity 0.15s ease-in-out;
}

@media (max-width: 768px) {
  .chest-img {
    width: 100px;
  }
}

#message {
  position: absolute;
  font-size: 64px;
  color: #fff;
  font-weight: bold;
  animation: fade-in-out 1.5s ease-out forwards;
  pointer-events: none;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.9), 0 0 40px rgba(255, 255, 255, 0.6);
  padding: 20px 40px;
  border-radius: 12px;
  z-index: 100;
}

@media (max-width: 768px) {
  #message {
    font-size: 48px;
  }
}

#message.hidden {
  display: none;
}

#message.correct {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.2);
  border: 3px solid #4ade80;
  text-shadow: 0 0 20px rgba(74, 222, 128, 0.8), 0 0 40px rgba(74, 222, 128, 0.5);
}

#message.wrong {
  color: #f87171;
  background: rgba(248, 113, 113, 0.2);
  border: 3px solid #f87171;
  text-shadow: 0 0 20px rgba(248, 113, 113, 0.8), 0 0 40px rgba(248, 113, 113, 0.5);
}

@keyframes fade-in-out {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  20% {
    opacity: 1;
    transform: scale(1.2);
  }
  80% {
    opacity: 1;
    transform: scale(1.1);
  }
  100% {
    opacity: 0;
    transform: scale(0.9);
  }
}

.shake {
  animation: shake 0.5s;
}

@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

.game-over-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fade-in 0.3s ease-out;
}

.popup-content {
  background: #1a1a1a;
  padding: 40px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: slide-up 0.3s ease-out;
}

.popup-content h2 {
  color: #fff;
  font-size: 32px;
  margin-bottom: 20px;
}

.popup-content .score {
  color: #4ade80;
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 30px;
}

.restart-btn {
  background: #fff;
  color: #000;
  border: none;
  padding: 12px 32px;
  font-size: 18px;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  font-family: 'Noto Sans', sans-serif;
}

.restart-btn:hover {
  background: #e5e5e5;
  transform: scale(1.05);
}

.restart-btn:active {
  transform: scale(0.95);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slide-up {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}