* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #0d1117;
  color: #f4f7fb;
  font-family: Arial, Helvetica, sans-serif;
  touch-action: none;
}

canvas {
  display: block;
}

#hud {
  position: fixed;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.brand {
  font-size: 17px;
  font-weight: 700;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}

.stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stats span,
#status {
  min-height: 30px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(7, 10, 16, 0.72);
  backdrop-filter: blur(8px);
  font-size: 13px;
}

#startPanel {
  position: fixed;
  inset: 50% auto auto 50%;
  z-index: 8;
  width: min(320px, calc(100vw - 40px));
  transform: translate(-50%, -50%);
}

#playerName {
  width: 100%;
  height: 44px;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 6px;
  background: rgba(7, 10, 16, 0.78);
  color: white;
  font-size: 15px;
  outline: none;
  padding: 0 13px;
  text-align: center;
}

#startButton {
  width: 100%;
  min-height: 82px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 8px;
  background: #f1f5f9;
  color: #111827;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

#startButton span {
  display: block;
  font-size: 26px;
  line-height: 1;
}

#startButton small {
  display: block;
  margin-top: 10px;
  padding: 0 16px;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.3;
}

#crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#crosshair::before,
#crosshair::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.86);
}

#crosshair::before {
  left: 8px;
  top: 0;
  width: 2px;
  height: 18px;
}

#crosshair::after {
  left: 0;
  top: 8px;
  width: 18px;
  height: 2px;
}

#hitMarker {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 5;
  transform: translate(-50%, -50%) scale(0.7);
  color: #fef08a;
  font-size: 42px;
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.8);
  transition: opacity 120ms ease, transform 120ms ease;
}

#hitMarker.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

#gameMessage {
  position: fixed;
  left: 50%;
  top: 18%;
  z-index: 7;
  min-width: 220px;
  transform: translateX(-50%);
  color: #ffffff;
  font-size: 20px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  text-shadow: 0 3px 16px rgba(0, 0, 0, 0.85);
  transition: opacity 160ms ease;
}

#gameMessage.active {
  opacity: 1;
}

#nameTags {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.name-tag {
  position: absolute;
  min-width: 78px;
  transform: translate(-50%, -100%);
  color: white;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.hp-bar {
  height: 5px;
  margin-top: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}

.hp-bar span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: #22c55e;
}

#status {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 6;
  display: none;
}

.touch-pad {
  position: fixed;
  left: 22px;
  bottom: 48px;
  z-index: 6;
  width: 116px;
  height: 116px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(7, 10, 16, 0.35);
  display: none;
}

.touch-pad span {
  position: absolute;
  left: 38px;
  top: 38px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.84);
}

#touchFire {
  position: fixed;
  right: 24px;
  bottom: 58px;
  z-index: 6;
  width: 92px;
  height: 92px;
  border: 0;
  border-radius: 50%;
  background: #e11d48;
  color: white;
  font-weight: 700;
  cursor: pointer;
  display: none;
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.35);
}

@media (pointer: coarse) {
  .touch-pad,
  #touchFire {
    display: block;
  }

  #hud {
    align-items: flex-start;
  }

  .brand {
    font-size: 15px;
  }

  .stats span {
    font-size: 12px;
    padding: 6px 8px;
  }
}
