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

body {
  font-family: 'Noto Sans', sans-serif;
  background: #f5f5f5;
  overflow: hidden;
  touch-action: none;
}

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

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

#hud {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  gap: 16px;
  z-index: 10;
  pointer-events: none;
}

#end-game-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 11;
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  border: none;
  padding: 12px 24px;
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#end-game-btn:hover {
  background: rgba(255, 255, 255, 1);
}

#end-game-btn:active {
  transform: scale(0.98);
}

.stat {
  background: rgba(255, 255, 255, 0.9);
  padding: 12px 20px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.label {
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

#score, #timer {
  font-size: 24px;
  font-weight: bold;
  color: #333;
}

#game-over {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#game-over.hidden {
  display: none;
}

.modal {
  background: white;
  padding: 40px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  max-width: 400px;
}

.modal h2 {
  font-size: 28px;
  margin-bottom: 20px;
  color: #333;
}

.modal p {
  font-size: 18px;
  margin-bottom: 24px;
  color: #666;
}

#final-score {
  font-weight: bold;
  color: #333;
  font-size: 24px;
}

button {
  background: #333;
  color: white;
  border: none;
  padding: 12px 32px;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: #555;
}

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

.result-stats {
  margin: 20px 0;
}

.result-stats p {
  font-size: 16px;
  margin-bottom: 12px;
  color: #666;
}

.result-stats .label {
  font-size: 14px;
  color: #999;
}

.result-stats p.rank {
  margin-top: 24px;
  font-size: 28px;
  font-weight: bold;
  color: #333;
}

#rank-title {
  color: #ff6b00;
  font-size: 32px;
}

#achievements {
  margin: 24px 0;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
}

#achievements h3 {
  font-size: 18px;
  color: #666;
  margin-bottom: 16px;
}

#badge-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  max-width: 100%;
}

.badge {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: #333;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(255, 215, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge.silver {
  background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
}

.badge.bronze {
  background: linear-gradient(135deg, #cd7f32, #e8a87c);
}

.badge.platinum {
  background: linear-gradient(135deg, #e5e4e2, #ffffff);
}

.badge-icon {
  font-size: 16px;
}

#badge-notification-area {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
  pointer-events: none;
}

.badge-notification {
  background: rgba(255, 255, 255, 0.95);
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease-out, slideOut 0.3s ease-in 2.7s;
  opacity: 0;
  transform: translateX(100%);
}

@keyframes slideIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.badge-notification-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.badge-notification-content {
  flex: 1;
}

.badge-notification-title {
  font-size: 11px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.badge-notification-name {
  font-size: 14px;
  font-weight: bold;
  color: #333;
}

.badge-notification.gold {
  border-left: 4px solid #ffd700;
}

.badge-notification.silver {
  border-left: 4px solid #c0c0c0;
}

.badge-notification.bronze {
  border-left: 4px solid #cd7f32;
}

.badge-notification.platinum {
  border-left: 4px solid #e5e4e2;
}

#accumulated-badges {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 15;
  pointer-events: none;
  max-height: calc(100vh - 320px);
  overflow-y: auto;
  padding: 4px;
}

.accumulated-badge {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  animation: badgePop 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  position: relative;
}

.accumulated-badge.gold {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
}

.accumulated-badge.silver {
  background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
}

.accumulated-badge.bronze {
  background: linear-gradient(135deg, #cd7f32, #e8a87c);
}

.accumulated-badge.platinum {
  background: linear-gradient(135deg, #e5e4e2, #ffffff);
  box-shadow: 0 2px 12px rgba(229, 228, 226, 0.6);
}

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