/* FPS arena HUD, crosshair, weapon bar, target lock, combat radar, and touch fire controls. */

body.fps #tl,
body.fps #tc,
body.fps #tr,
body.fps #bl,
body.fps #br {
  display: none !important;
}

#fpshud {
  position: fixed;
  inset: 0;
  display: none;
  pointer-events: none;
  z-index: 3;
  font-family: var(--font-display, var(--f, sans-serif));
  color: var(--ink, #f4f6ff);
}

body.fps #fpshud {
  display: block;
}

#fpsTop {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top, 0px));
  left: calc(20px + env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(10, 14, 32, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-shadow: 0 2px 10px #000;
}

#fpsScore {
  font-size: 40px;
  line-height: 1;
  color: var(--accent, #ffd23f);
  font-variant-numeric: tabular-nums;
}

#fpsWave {
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted, #bcc6e6);
  text-transform: uppercase;
}

#fpsDiff {
  font-size: 12px;
  letter-spacing: 0.1em;
  color: #ff7a33;
  font-weight: 700;
  text-transform: uppercase;
}

/* Target Lock HUD at top center */
#fpsTargetHud {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: min(260px, 44vw);
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(16, 10, 26, 0.78);
  border: 1px solid rgba(255, 110, 60, 0.45);
  text-align: center;
  opacity: 0;
  transition: opacity 0.18s ease-out;
}

#fpsTargetHud.on {
  opacity: 1;
}

#fpsTgtName {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ff9a5a;
  margin-bottom: 4px;
  text-transform: uppercase;
}

#fpsTgtBar {
  background: linear-gradient(90deg, #ff3b55, #ff9a3c);
}

#fpsTgtStatus {
  display: block;
  font-size: 11px;
  color: #ffd23f;
  margin-top: 3px;
  min-height: 14px;
}

#fpsLeftWrap {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: calc(20px + env(safe-area-inset-right, 0px));
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(10, 14, 32, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted, #bcc6e6);
  text-align: right;
  text-shadow: 0 2px 10px #000;
  text-transform: uppercase;
}

#fpsLeftWrap b {
  display: block;
  font-size: 34px;
  line-height: 1;
  color: var(--bad, #ff5470);
  font-variant-numeric: tabular-nums;
}

/* Dynamic Combat Crosshair */
#fpsCross {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  transform: translate(-50%, -50%);
  opacity: 0.94;
  transition: transform 0.08s ease-out;
}

#fpsCross.aim {
  transform: translate(-50%, -50%) scale(0.72);
}

#fpsCross i {
  position: absolute;
  display: block;
  background: #fff;
  box-shadow: 0 0 4px #000, 0 0 8px rgba(255, 130, 50, 0.85);
}

#fpsCross i:nth-child(1) {
  left: 50%;
  top: 0;
  width: 2px;
  height: 12px;
  transform: translateX(-50%);
}

#fpsCross i:nth-child(2) {
  left: 50%;
  bottom: 0;
  width: 2px;
  height: 12px;
  transform: translateX(-50%);
}

#fpsCross i:nth-child(3) {
  top: 50%;
  left: 0;
  width: 12px;
  height: 2px;
  transform: translateY(-50%);
}

#fpsCross i:nth-child(4) {
  top: 50%;
  right: 0;
  width: 12px;
  height: 2px;
  transform: translateY(-50%);
}

#fpsCross b {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ff7a33;
  box-shadow: 0 0 8px #ff7a33;
  transform: translate(-50%, -50%);
}

#fpsHit {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 36px;
  height: 36px;
  transform: translate(-50%, -50%) rotate(45deg);
  opacity: 0;
}

#fpsHit::before,
#fpsHit::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: #ffd23f;
  box-shadow: 0 0 8px #ff5470;
}

#fpsHit::before {
  width: 2px;
  height: 18px;
  transform: translate(-50%, -50%);
}

#fpsHit::after {
  width: 18px;
  height: 2px;
  transform: translate(-50%, -50%);
}

#fpsHit.on {
  animation: fpsHitPop 0.18s ease-out;
}

@keyframes fpsHitPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(45deg) scale(0.45);
  }
  40% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(45deg) scale(1.3);
  }
}

/* Directional Damage Indicator */
#fpsDmgDir {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 150px;
  height: 150px;
  margin: -75px 0 0 -75px;
  border-radius: 50%;
  border: 4px solid transparent;
  border-top-color: rgba(255, 60, 80, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-out;
}

/* Combat Kill & Status Feed */
#fpsFeed {
  position: fixed;
  right: calc(20px + env(safe-area-inset-right, 0px));
  top: calc(102px + env(safe-area-inset-top, 0px));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 2px 8px #000;
}

#fpsFeed div {
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(10, 14, 32, 0.72);
  border-right: 3px solid #ff7a33;
  color: #f4f6ff;
}

#fpsVitals {
  position: fixed;
  left: calc(20px + env(safe-area-inset-left, 0px));
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: min(310px, 46vw);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.16));
  border-radius: 14px;
  background: rgba(10, 14, 32, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.fpsrow {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted, #bcc6e6);
}

.fpsrow b {
  font-size: 12px;
  color: var(--ink, #f4f6ff);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.fpsbar {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.fpsbar i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--good, #b8ff3a);
  transition: width 0.12s linear, background 0.2s;
}

#fpsShield {
  width: 100%;
  background: #3fe0ff;
}

#fpsHeat {
  width: 0;
  background: linear-gradient(90deg, #ff9a3c, #ff304f);
}

/* Weapon Mode Selector Bar */
#fpsWeapons {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  pointer-events: auto;
  z-index: 4;
}

.wslot {
  font-family: var(--font-display, var(--f, sans-serif));
  font-size: 12px;
  font-weight: 600;
  padding: 7px 11px;
  border-radius: 10px;
  background: rgba(10, 14, 32, 0.78);
  color: var(--muted, #bcc6e6);
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.14s ease-out;
}

.wslot b {
  color: var(--accent, #ffd23f);
  font-size: 11px;
}

.wslot small {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(255, 122, 51, 0.25);
  color: #ff9a5a;
}

.wslot.active {
  background: rgba(255, 110, 40, 0.24);
  border-color: #ff7a33;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(255, 110, 40, 0.35);
}

/* 360 Combat Radar in bottom-right for FPS mode */
#fpsRadar {
  position: fixed;
  right: calc(20px + env(safe-area-inset-right, 0px));
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: 136px;
  height: 136px;
  border-radius: 50%;
  background: rgba(10, 14, 32, 0.74);
  border: 2px solid rgba(255, 122, 51, 0.42);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.45);
}

/* Low hull: red edge pulse that does not block the view. */
#fpshud::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 rgba(255, 40, 70, 0);
  transition: box-shadow 0.3s;
}

body.fps-low #fpshud::after {
  box-shadow: inset 0 0 140px rgba(255, 40, 70, 0.55);
  animation: fpsLow 1.1s ease-in-out infinite;
}

@keyframes fpsLow {
  0%,
  100% {
    box-shadow: inset 0 0 100px rgba(255, 40, 70, 0.35);
  }
  50% {
    box-shadow: inset 0 0 180px rgba(255, 40, 70, 0.7);
  }
}

/* Touch fire and altitude buttons. Hidden on desktop. */
#fire,
#falt,
#fup,
#fdn {
  display: none;
  position: fixed;
  z-index: 2;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--f, sans-serif);
  font-weight: 700;
  border: 2px solid var(--line, rgba(255, 255, 255, 0.2));
  color: var(--ink, #f4f6ff);
  background: rgba(10, 14, 32, 0.68);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

body.touch.fps #fire,
body.touch.fps #falt,
body.touch.fps #fup,
body.touch.fps #fdn {
  display: flex;
  align-items: center;
  justify-content: center;
}

#fire {
  right: calc(28px + env(safe-area-inset-right, 0px));
  bottom: calc(154px + env(safe-area-inset-bottom, 0px));
  width: 92px;
  height: 92px;
  border-radius: 50%;
  font-size: 12px;
  letter-spacing: 0.05em;
  border-color: rgba(255, 110, 45, 0.85);
  background: radial-gradient(circle, rgba(255, 100, 30, 0.4), rgba(10, 14, 32, 0.75));
  box-shadow: 0 0 22px rgba(255, 100, 30, 0.4);
}

#fire:active {
  background: rgba(255, 100, 30, 0.65);
  transform: scale(0.95);
}

#falt {
  right: calc(28px + env(safe-area-inset-right, 0px));
  bottom: calc(256px + env(safe-area-inset-bottom, 0px));
  width: 88px;
  height: 44px;
  border-radius: 22px;
  font-size: 11px;
  border-color: rgba(255, 210, 63, 0.8);
  color: #ffd23f;
}

#fup,
#fdn {
  right: calc(134px + env(safe-area-inset-right, 0px));
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 18px;
}

#fup {
  bottom: calc(212px + env(safe-area-inset-bottom, 0px));
}

#fdn {
  bottom: calc(146px + env(safe-area-inset-bottom, 0px));
}

body.touch.fps #bb {
  display: none !important;
}

body.touch.fps #fpsRadar {
  top: calc(92px + env(safe-area-inset-top, 0px));
  bottom: auto;
  width: 96px;
  height: 96px;
}

body.touch.fps #jl {
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
}

body.touch.fps #jr {
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
}

body.fps #snd {
  opacity: 0.7;
  bottom: calc(2px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 860px) {
  #fpsWeapons {
    bottom: calc(142px + env(safe-area-inset-bottom, 0px));
    left: calc(20px + env(safe-area-inset-left, 0px));
    transform: none;
    flex-wrap: wrap;
    max-width: 320px;
  }
  .wslot {
    font-size: 11px;
    padding: 5px 8px;
  }
}

@media (max-width: 700px) {
  #fpsScore {
    font-size: 30px;
  }
  #fpsVitals {
    width: min(250px, 56vw);
  }
}
