*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #111827;
  color: #f9fafb;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 0;
}

#app-root {
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
}

#game-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
}

#hud {
  background-color: #1f2937;
  border-top: 2px solid #4f46e5;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Courier New', monospace;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hud-label {
  font-size: 11px;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hud-value {
  font-size: 18px;
  color: #4f46e5;
  font-weight: bold;
}

#game-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 100;
  background: rgba(0, 0, 0, 0.8);
  padding: 32px 48px;
  border-radius: 8px;
  border: 2px solid #4f46e5;
  display: none;
  backdrop-filter: blur(5px);
}

#game-status.show {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: slideIn 0.3s ease-out;
}

#game-status.clear {
  border: 2px solid #fbbf24;
  background: rgba(0, 0, 0, 0.9);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

#game-status-title {
  font-size: 32px;
  font-weight: bold;
  color: #f9fafb;
  text-transform: uppercase;
  letter-spacing: 2px;
}

#game-status.clear #game-status-title {
  color: #fbbf24;
  font-size: 40px;
  animation: pulse 0.6s ease-in-out;
}

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

#game-status-message {
  font-size: 16px;
  color: #d1d5db;
}

#game-status-score {
  font-size: 24px;
  font-weight: bold;
  color: #4f46e5;
}

#game-status.clear #game-status-score {
  color: #fbbf24;
  font-size: 28px;
}

#controls-info {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
  line-height: 1.5;
}

@media (prefers-color-scheme: dark) {
  body {
    background-color: #111827;
    color: #f9fafb;
  }

  #game-container {
    background-color: #0f172a;
  }
}