#hud-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 10;
  background: rgba(5, 5, 20, 0.92);
  border-bottom: 1px solid rgba(0, 200, 255, 0.15);
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 50px;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hud-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

#hud-level {
  font-size: 13px;
  color: #00ccff;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: bold;
}

.hud-location {
  font-size: 11px;
  color: rgba(0, 200, 255, 0.5);
  margin-left: 12px;
}

.hud-objective {
  font-size: 12px;
  color: #a0b0c0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hud-alert {
  font-size: 13px;
  color: #ff3344;
  text-transform: uppercase;
  font-weight: bold;
  animation: pulse 1s infinite;
  letter-spacing: 1px;
}

.health-bar {
  width: 100px;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.health-fill {
  height: 100%;
  background: linear-gradient(90deg, #00ff88, #00cc66);
  border-radius: 4px;
  transition: width 0.3s;
  width: 100%;
}

.hud-label {
  font-size: 10px;
  color: rgba(200, 210, 220, 0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-right: 6px;
}

.hud-power {
  display: flex;
  align-items: center;
}

.power-bar {
  width: 70px;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.power-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff88ff, #cc44ff);
  border-radius: 4px;
  transition: width 0.1s;
}

#hud-coins {
  font-size: 13px;
  color: #ffcc00;
  font-weight: bold;
}

.pause-hud-btn {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: rgba(0, 200, 255, 0.1);
  border: 1px solid rgba(0, 200, 255, 0.35);
  color: #00ccff;
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

.pause-hud-btn:hover {
  background: rgba(0, 200, 255, 0.3);
}

.pause-hud-btn:active {
  background: rgba(0, 200, 255, 0.45);
  transform: scale(0.94);
}

.shoot-hud-btn {
  position: absolute;
  right: 16px;
  bottom: 92px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  z-index: 16;
  background: rgba(255, 90, 255, 0.14);
  border: 2px solid rgba(255, 90, 255, 0.5);
  color: rgba(255, 140, 255, 0.95);
  box-shadow: 0 0 16px rgba(255, 90, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.shoot-hud-btn:hover {
  background: rgba(255, 90, 255, 0.4);
  box-shadow: 0 0 22px rgba(255, 90, 255, 0.55);
}

.shoot-hud-btn:active {
  transform: scale(0.9);
}

#hud-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 10;
  background: rgba(5, 5, 20, 0.88);
  border-top: 1px solid rgba(0, 200, 255, 0.1);
  padding: 6px 16px;
  text-align: center;
}

.control-hints {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.control-hint {
  font-size: 10px;
  color: rgba(160, 176, 192, 0.5);
}

kbd {
  background: rgba(0, 200, 255, 0.1);
  border: 1px solid rgba(0, 200, 255, 0.2);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  color: #00ccff;
  font-family: monospace;
}

.interaction-prompt {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  background: rgba(5, 15, 30, 0.9);
  border: 1px solid rgba(0, 200, 255, 0.3);
  padding: 8px 16px;
  border-radius: 6px;
  text-align: center;
  color: #00ccff;
  font-size: 13px;
  animation: fadeInUp 0.3s;
}

.key-hint {
  display: inline-block;
  background: rgba(0, 200, 255, 0.15);
  border: 1px solid #00ccff;
  min-width: 24px;
  padding: 0 6px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 4px;
  font-weight: bold;
  font-size: 11px;
  margin-right: 6px;
}

/* Positioned so it can never sit underneath the on-screen action buttons. */
.inventory-panel {
  position: absolute;
  right: 10px;
  top: calc(56px + env(safe-area-inset-top));
  width: min(300px, calc(100vw - 20px));
  max-height: min(72vh, calc(100% - 120px));
  z-index: 30;
  background: rgba(5, 10, 25, 0.96);
  border: 1px solid rgba(0, 200, 255, 0.2);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  touch-action: pan-y;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

/* When the touch pads are on screen the panel must stop above them. */
body.touch-active .inventory-panel {
  max-height: calc(100% - 205px);
}

@media (max-height: 500px) {
  body.touch-active .inventory-panel {
    max-height: calc(100% - 160px);
  }
}

.inventory-title {
  font-size: 11px;
  color: rgba(0, 200, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 2px;
  padding-right: 34px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0, 200, 255, 0.1);
  flex: 0 0 auto;
}

.inventory-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: rgba(0, 200, 255, 0.08);
  border: 1px solid rgba(0, 200, 255, 0.25);
  color: rgba(0, 200, 255, 0.8);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
  z-index: 2;
}

.inventory-close:active {
  background: rgba(0, 200, 255, 0.28);
}

.inventory-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  flex: 1 1 auto;
  min-height: 0;
  padding-right: 2px;
}

.inventory-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px;
}

.inventory-empty {
  font-size: 11px;
  color: rgba(160, 176, 192, 0.45);
  text-align: center;
  padding: 14px 6px;
  letter-spacing: 1px;
}

.inventory-item {
  width: 40px;
  height: 40px;
  background: rgba(0, 200, 255, 0.05);
  border: 1px solid rgba(0, 200, 255, 0.15);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.inventory-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 4px;
}

.inv-opt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 2px;
  border-bottom: 1px solid rgba(0, 200, 255, 0.06);
}

.inv-opt-row > span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(200, 210, 220, 0.75);
}

.inv-opt-btn {
  background: rgba(0, 200, 255, 0.08);
  border: 1px solid rgba(0, 200, 255, 0.2);
  color: #a0c0d0;
  border-radius: 4px;
  font-family: inherit;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 1px;
  min-width: 62px;
  min-height: 38px;
  padding: 4px 10px;
  cursor: pointer;
  flex: 0 0 auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
  user-select: none;
  -webkit-user-select: none;
}

.inv-opt-btn.active {
  background: rgba(0, 200, 255, 0.18);
  border-color: rgba(0, 200, 255, 0.5);
  color: #00ccff;
}

.inv-opt-btn.inv-opt-warn {
  background: rgba(255, 80, 100, 0.1);
  border-color: rgba(255, 80, 100, 0.35);
  color: #ff8090;
}

.inv-opt-sep {
  height: 8px;
}

.fps-counter {
  position: absolute;
  top: 60px;
  left: 8px;
  font-size: 11px;
  color: rgba(0, 200, 255, 0.4);
  font-family: monospace;
  z-index: 20;
}

.inventory-coins {
  margin-top: 6px;
  font-size: 11px;
  color: #ffcc00;
  font-weight: bold;
}

.inventory-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(0, 200, 255, 0.1);
  padding-bottom: 6px;
  flex: 0 0 auto;
}

.inv-tab {
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 2px;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 1px;
  background: rgba(0, 200, 255, 0.05);
  border: 1px solid rgba(0, 200, 255, 0.15);
  border-radius: 4px;
  color: rgba(0, 200, 255, 0.6);
  cursor: pointer;
  text-transform: uppercase;
  min-height: 40px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
  user-select: none;
  -webkit-user-select: none;
}

.inv-tab.active {
  background: rgba(0, 200, 255, 0.2);
  border-color: rgba(0, 200, 255, 0.5);
  color: #00ccff;
  font-weight: bold;
}

.inventory-weapons {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.weapon-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px;
  background: rgba(0, 200, 255, 0.04);
  border: 1px solid rgba(0, 200, 255, 0.12);
  border-radius: 6px;
}

.weapon-row-equipped {
  background: rgba(0, 200, 255, 0.12);
  border-color: rgba(0, 200, 255, 0.4);
}

.weapon-icon {
  font-size: 22px;
  width: 30px;
  text-align: center;
}

.weapon-info {
  flex: 1;
  min-width: 0;
}

.weapon-name {
  font-size: 11px;
  color: #e8f0f8;
  font-weight: bold;
}

.weapon-desc {
  font-size: 9px;
  color: rgba(160, 176, 192, 0.6);
  margin-top: 2px;
  line-height: 1.2;
}

.weapon-btn {
  font-family: inherit;
  font-size: 9px;
  padding: 8px 10px;
  min-height: 36px;
  border-radius: 4px;
  background: rgba(255, 204, 68, 0.15);
  border: 1px solid rgba(255, 204, 68, 0.4);
  color: #ffcc44;
  cursor: pointer;
  white-space: nowrap;
  font-weight: bold;
  letter-spacing: 0.5px;
  flex: 0 0 auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
  user-select: none;
  -webkit-user-select: none;
}

.weapon-btn:hover:not(:disabled) {
  background: rgba(255, 204, 68, 0.35);
}

.weapon-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.weapon-equipped {
  background: rgba(0, 255, 136, 0.12);
  border-color: rgba(0, 255, 136, 0.4);
  color: #00ff88;
}

.weapon-locked {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.35);
}

@media (hover: none), (max-width: 768px) {
  .shoot-hud-btn {
    display: none !important;
  }
}
