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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #87ceeb;
  color: #fff;
}

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

#overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(20, 30, 60, 0.85), rgba(60, 90, 140, 0.85));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.6s ease;
}

#overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#overlay-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 40px 48px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  min-width: 320px;
}

#overlay-card h1 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
}

#overlay-card p {
  font-size: 14px;
  opacity: 0.75;
  margin-bottom: 24px;
}

#name-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  outline: none;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}

#name-input:focus {
  border-color: rgba(255, 255, 255, 0.6);
}

#name-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

#enter-btn {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  background: #4caf50;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

#enter-btn:hover {
  background: #5dbf61;
}

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

#overlay-error {
  margin-top: 12px;
  font-size: 13px;
  color: #ff8080;
  min-height: 18px;
}

#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 5;
  pointer-events: none;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

#player-count {
  font-size: 14px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.35);
  padding: 6px 12px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 8px;
}

#controls-hint {
  font-size: 12px;
  opacity: 0.85;
  background: rgba(0, 0, 0, 0.35);
  padding: 6px 12px;
  border-radius: 6px;
  display: inline-block;
}

#lock-hint {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  z-index: 6;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

#lock-hint.hidden {
  opacity: 0;
  pointer-events: none;
}

.lock-card {
  text-align: center;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 28px 44px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.lock-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
}

.lock-sub {
  font-size: 13px;
  opacity: 0.85;
}

#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  z-index: 4;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
  display: none;
}

#crosshair.visible {
  display: block;
}

#hud-bottom {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 5;
  pointer-events: none;
}

#health-bar {
  width: 220px;
  height: 26px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

#health-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(to right, #4caf50, #80c780);
  transition: width 0.18s ease, background 0.25s ease;
}

#health-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  letter-spacing: 0.5px;
}

#hurt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 7;
  background: radial-gradient(ellipse at center, rgba(180, 0, 0, 0) 40%, rgba(180, 0, 0, 0.55) 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

#hurt-overlay.flash {
  opacity: 1;
  transition: opacity 0.05s ease;
}

#death-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(40, 0, 0, 0.55);
  color: #fff;
  z-index: 8;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#death-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.death-card {
  text-align: center;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(220, 80, 80, 0.4);
  border-radius: 12px;
  padding: 36px 56px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.death-title {
  font-size: 32px;
  font-weight: 700;
  color: #ff6868;
  margin-bottom: 10px;
}

.death-sub {
  font-size: 14px;
  opacity: 0.9;
}
