* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  overflow: hidden;
  background: #1a1e2e;
  font-family: 'Inter', system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

canvas#canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
}

.hidden {
  display: none !important;
}

/* ===== HUD ===== */
#hud {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 10;
}

#hud-top-left {
  position: absolute;
  top: 16px;
  left: 16px;
}

#score-display {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
  font-size: 18px;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  letter-spacing: 0.02em;
}

#boost-bar-container {
  margin-top: 8px;
  width: 140px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
}

#boost-bar-fill {
  width: 100%;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #7dd3fc, #f9a8d4);
  transition: width 0.1s ease;
}

/* Leaderboard */
#leaderboard {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 170px;
  background: rgba(20, 24, 40, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.06);
}

#leaderboard-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

#leaderboard-entries {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lb-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: rgba(255,255,255,0.7);
  padding: 3px 0;
}

.lb-entry.is-player {
  color: #7dd3fc;
  font-weight: 600;
}

.lb-entry .lb-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100px;
}

.lb-entry .lb-score {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* Minimap */
#minimap-container {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 120px;
  height: 120px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(20, 24, 40, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.06);
}

#minimap {
  width: 100%;
  height: 100%;
}

/* ===== Start Screen ===== */
#start-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  background: rgba(15, 18, 30, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#start-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#game-title {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(42px, 8vw, 72px);
  color: #fff;
  letter-spacing: -0.01em;
  text-shadow: 0 4px 30px rgba(125, 211, 252, 0.3);
  line-height: 1.1;
}

#game-subtitle {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(14px, 2.5vw, 18px);
  color: rgba(255,255,255,0.5);
  margin-bottom: 6px;
}

#name-input-container {
  margin: 4px 0;
}

#player-name {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  width: 200px;
  padding: 10px 16px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: #fff;
  outline: none;
  transition: border-color 0.2s;
}

#player-name:focus {
  border-color: rgba(125, 211, 252, 0.5);
}

#player-name::placeholder {
  color: rgba(255,255,255,0.25);
}

#high-score-start {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.4);
}

#play-button, #replay-button {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: #fff;
  border: none;
  padding: 14px 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #7dd3fc, #c4b5fd);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 20px rgba(125, 211, 252, 0.25);
  margin-top: 8px;
  letter-spacing: 0.02em;
}

#play-button:hover, #replay-button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgba(125, 211, 252, 0.35);
}

#play-button:active, #replay-button:active {
  transform: scale(0.97);
}

#footer-link {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  color: rgba(255,255,255,0.2);
  text-decoration: none;
  margin-top: 24px;
  transition: color 0.2s;
}

#footer-link:hover {
  color: rgba(255,255,255,0.45);
}

/* ===== Death Screen ===== */
#death-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  background: rgba(15, 18, 30, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fadeIn 0.4s ease;
}

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

#death-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#death-title {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 36px;
  color: #fff;
}

#death-score {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
  font-size: 18px;
  color: rgba(255,255,255,0.7);
}

#death-high-score {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 400;
  font-size: 14px;
  color: rgba(255,255,255,0.4);
}

/* Responsive */
@media (max-width: 600px) {
  #leaderboard {
    width: 140px;
    padding: 10px 10px;
  }
  .lb-entry {
    font-size: 11px;
  }
  #minimap-container {
    width: 90px;
    height: 90px;
  }
  #minimap {
    width: 90px;
    height: 90px;
  }
  #score-display {
    font-size: 15px;
  }
  #boost-bar-container {
    width: 110px;
  }
}