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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0d1222;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: crosshair;
}

.hidden {
  display: none !important;
}

/* Pantallas de inicio y fin */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 16px;
  text-align: center;
  background: rgba(6, 9, 20, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.logo {
  font-size: clamp(48px, 12vw, 104px);
  font-weight: 900;
  letter-spacing: -2px;
  background: linear-gradient(90deg, #80ed99, #4cc9f0, #c77dff, #f72585);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 24px rgba(76, 201, 240, 0.35));
}

.logo span {
  font-weight: 600;
  opacity: 0.85;
}

#nickname {
  width: min(320px, 90vw);
  padding: 14px 18px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 18px;
  text-align: center;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

#nickname:focus {
  border-color: #4cc9f0;
}

.btn {
  min-width: 200px;
  padding: 16px 40px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #80ed99, #2ec4b6);
  color: #0b1a14;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 0 0 0 rgba(128, 237, 153, 0.6);
  animation: pulse 1.8s infinite;
  transition: transform 0.15s;
}

.btn:hover {
  transform: scale(1.06);
}

.btn:active {
  transform: scale(0.97);
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(128, 237, 153, 0.55); }
  70% { box-shadow: 0 0 0 22px rgba(128, 237, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(128, 237, 153, 0); }
}

.hint {
  max-width: 420px;
  font-size: 14px;
  opacity: 0.7;
}

.touch-hint {
  display: none;
}

h2 {
  font-size: clamp(40px, 9vw, 72px);
  font-weight: 900;
  color: #ff4d6d;
}

.final {
  font-size: 22px;
}

/* HUD */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#score {
  position: absolute;
  top: 16px;
  left: 16px;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

#leaderboard {
  position: absolute;
  top: 16px;
  right: 16px;
  min-width: 170px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(10, 14, 28, 0.55);
  font-size: 14px;
}

#leaderboard h3 {
  margin-bottom: 6px;
  font-size: 15px;
  opacity: 0.8;
}

#leaderList {
  padding-left: 20px;
}

#leaderList li {
  opacity: 0.75;
  white-space: nowrap;
}

#leaderList li.me {
  opacity: 1;
  font-weight: 800;
  color: #80ed99;
}

#minimap {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 140px;
  height: 140px;
}

#boostBtn {
  display: none;
  position: absolute;
  left: 20px;
  bottom: 24px;
  width: 92px;
  height: 92px;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(247, 37, 133, 0.35);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  pointer-events: auto;
  touch-action: none;
}

#boostBtn.active {
  background: rgba(247, 37, 133, 0.75);
}

/* Celulares y tablets */
@media (pointer: coarse) {
  #boostBtn { display: block; }
  .desktop-hint { display: none; }
  .touch-hint { display: block; }
}

@media (max-width: 600px) {
  #leaderboard {
    min-width: 0;
    font-size: 12px;
  }
  #minimap {
    width: 100px;
    height: 100px;
  }
}
