:root {
  color-scheme: dark;
  font-family: "Avenir Next", "Trebuchet MS", "Gill Sans", sans-serif;
  line-height: 1.4;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at top, rgba(69, 116, 144, 0.2), transparent 36%),
    linear-gradient(180deg, #060b11 0%, #09131d 100%);
  color: #dff6ff;
  overscroll-behavior: none;
}

.viewport,
.viewport canvas {
  display: block;
  height: 100%;
  width: 100%;
}

.hud {
  inset: 0;
  pointer-events: none;
  position: fixed;
}

.hud__panel {
  background:
    linear-gradient(180deg, rgba(8, 18, 28, 0.9), rgba(11, 32, 43, 0.78)),
    radial-gradient(circle at top, rgba(76, 225, 255, 0.08), transparent 42%);
  border: 1px solid rgba(89, 210, 255, 0.32);
  border-radius: 20px;
  box-shadow:
    0 24px 80px rgba(2, 8, 14, 0.55),
    inset 0 1px 0 rgba(179, 240, 255, 0.08);
  color: #e7fbff;
  left: 24px;
  max-width: 360px;
  padding: 20px 20px 18px;
  position: absolute;
  top: 24px;
}

.hud__eyebrow {
  color: #78dfff;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.hud__title {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.95;
  margin: 0 0 12px;
  text-shadow: 0 0 28px rgba(66, 196, 255, 0.18);
}

.hud__status {
  color: #d3edf6;
  margin: 0 0 16px;
  max-width: 28ch;
}

.hud__button {
  background: linear-gradient(180deg, #ffd27a 0%, #ff934f 100%);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(255, 120, 61, 0.22);
  color: #1a0d08;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 12px 18px;
  pointer-events: auto;
  text-transform: uppercase;
}

.hud__button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.hud__tips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.hud__tips span {
  background: rgba(123, 227, 255, 0.08);
  border: 1px solid rgba(123, 227, 255, 0.14);
  border-radius: 999px;
  color: #e8f9ff;
  font-size: 0.78rem;
  padding: 6px 10px;
}

.crosshair {
  --crosshair-scale: 1;
  border: 2px solid rgba(241, 251, 255, 0.9);
  border-radius: 999px;
  box-shadow: 0 0 24px rgba(241, 251, 255, 0.45);
  height: 16px;
  left: 50%;
  opacity: 0;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) scale(var(--crosshair-scale));
  transition:
    opacity 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
  width: 16px;
}

.crosshair.is-reloading {
  border-color: rgba(255, 196, 108, 0.95);
  box-shadow: 0 0 24px rgba(255, 196, 108, 0.55);
}

.hit-marker {
  height: 28px;
  left: 50%;
  opacity: 0;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 70ms ease;
  width: 28px;
}

.hit-marker::before,
.hit-marker::after {
  background: rgba(255, 242, 219, 0.95);
  content: "";
  height: 2px;
  left: 50%;
  position: absolute;
  top: 50%;
  width: 100%;
}

.hit-marker::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.hit-marker::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.hit-marker.is-visible {
  opacity: 1;
}

.hit-marker.is-kill::before,
.hit-marker.is-kill::after {
  background: rgba(255, 88, 124, 0.98);
  height: 3px;
}

.damage-vignette {
  --damage-opacity: 0;
  background:
    radial-gradient(circle at center, rgba(0, 0, 0, 0) 34%, rgba(139, 13, 27, 0.38) 72%, rgba(78, 6, 16, 0.84) 100%);
  inset: 0;
  opacity: var(--damage-opacity);
  position: absolute;
  transition: opacity 80ms linear;
}

.damage-vignette.is-dead {
  opacity: 0.96;
}

.wave-banner {
  color: #fff6de;
  font-size: clamp(2.4rem, 6vw, 5.2rem);
  font-weight: 800;
  left: 50%;
  letter-spacing: 0.12em;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  text-shadow:
    0 0 24px rgba(255, 188, 92, 0.35),
    0 12px 32px rgba(0, 0, 0, 0.34);
  text-transform: uppercase;
  top: 20%;
  transform: translate(-50%, -50%) scale(0.9);
  transition:
    opacity 180ms ease,
    transform 220ms ease;
  white-space: nowrap;
}

.wave-banner.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.death-overlay {
  color: #fff1f2;
  inset: 50% auto auto 50%;
  max-width: min(520px, calc(100vw - 48px));
  opacity: 0;
  position: absolute;
  text-align: center;
  transform: translate(-50%, -50%) scale(0.96);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.death-overlay.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.death-overlay__eyebrow {
  letter-spacing: 0.28em;
  margin: 0 0 8px;
  opacity: 0.72;
  text-transform: uppercase;
}

.death-overlay__title {
  font-size: clamp(3rem, 10vw, 6rem);
  line-height: 0.9;
  margin: 0 0 12px;
  text-transform: uppercase;
}

.death-overlay__summary {
  font-size: 1rem;
  margin: 0 0 20px;
  opacity: 0.85;
}

.death-overlay__stats {
  background: rgba(21, 8, 16, 0.38);
  border: 1px solid rgba(255, 226, 232, 0.14);
  border-radius: 18px;
  display: grid;
  gap: 10px;
  margin: 0 auto;
  max-width: 360px;
  padding: 16px 18px;
}

.death-overlay__stat {
  align-items: baseline;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.death-overlay__stat-label {
  color: rgba(255, 232, 236, 0.72);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.death-overlay__stat-value {
  font-size: 1.08rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.death-overlay__button {
  margin-top: 18px;
  pointer-events: auto;
}

.ammo {
  background:
    linear-gradient(180deg, rgba(6, 18, 28, 0.9), rgba(10, 31, 46, 0.84)),
    rgba(7, 31, 46, 0.84);
  border: 1px solid rgba(210, 244, 255, 0.22);
  border-radius: 18px;
  bottom: 24px;
  color: #f2fcff;
  display: grid;
  gap: 10px;
  min-width: 240px;
  padding: 14px 16px 15px;
  pointer-events: none;
  position: absolute;
  right: 24px;
  box-shadow: 0 18px 48px rgba(4, 12, 20, 0.35);
}

.survival {
  background:
    linear-gradient(180deg, rgba(6, 18, 28, 0.9), rgba(10, 31, 46, 0.84)),
    rgba(7, 31, 46, 0.84);
  border: 1px solid rgba(210, 244, 255, 0.22);
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(4, 12, 20, 0.35);
  gap: 10px;
  color: #f2fcff;
  display: grid;
  min-width: 220px;
  padding: 14px 16px 14px;
  position: absolute;
  right: 24px;
  top: 24px;
}

.survival__stat {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
}

.survival__header {
  align-items: baseline;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.survival__heading,
.survival__label,
.survival__status {
  color: rgba(222, 245, 255, 0.72);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  margin: 0;
  text-transform: uppercase;
}

.survival__heading {
  font-weight: 700;
}

.survival__status {
  color: #d9f6ff;
  max-width: 12ch;
  text-align: right;
}

.survival__value {
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.health-meter {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.health-meter__bar {
  background: rgba(214, 235, 246, 0.12);
  border: 1px solid rgba(215, 240, 249, 0.12);
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}

.health-meter__fill {
  --health-fill: 1;
  background: linear-gradient(90deg, #ff5f7a 0%, #ffb057 55%, #ffe480 100%);
  border-radius: inherit;
  height: 100%;
  transform: scaleX(var(--health-fill));
  transform-origin: left center;
  transition:
    transform 120ms ease,
    filter 120ms ease;
}

.health-meter__labels {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
}

.health-meter__label {
  color: rgba(222, 245, 255, 0.72);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.health-meter__value {
  color: #fff6d7;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.ammo__header,
.ammo__counts,
.ammo__slots {
  align-items: baseline;
  display: flex;
}

.ammo__header {
  justify-content: space-between;
  gap: 16px;
}

.ammo__counts {
  gap: 8px;
}

.ammo__slots {
  gap: 8px;
}

.ammo__label,
.ammo__state {
  color: rgba(222, 245, 255, 0.72);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ammo__label {
  font-weight: 700;
}

.ammo__state {
  min-height: 1em;
  min-width: 7ch;
  text-align: right;
}

.ammo__current,
.ammo__divider {
  font-size: 3rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1;
}

.ammo__reserve {
  color: rgba(228, 244, 255, 0.76);
  font-size: 1.6rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1;
}

.weapon-slot {
  align-items: center;
  background: rgba(207, 241, 255, 0.08);
  border: 1px solid rgba(207, 241, 255, 0.16);
  border-radius: 12px;
  color: #d8f7ff;
  display: inline-grid;
  gap: 2px;
  min-width: 44px;
  padding: 7px 10px 6px;
  pointer-events: none;
  text-align: center;
}

.weapon-slot.is-active {
  background: linear-gradient(180deg, rgba(255, 236, 181, 0.94), rgba(255, 170, 100, 0.94));
  border-color: rgba(255, 244, 211, 0.52);
  color: #1e2228;
  box-shadow: 0 0 18px rgba(255, 173, 91, 0.35);
}

.weapon-slot__index {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.weapon-slot__label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hud.is-locked .hud__panel {
  opacity: 0.2;
}

.hud.is-locked .crosshair {
  opacity: 1;
}

.hud.is-locked .survival,
.hud.is-locked .ammo {
  opacity: 0.96;
}

.hud.is-critical .health-meter__fill {
  filter: saturate(1.15) brightness(1.05);
}

.hud.is-critical .survival {
  border-color: rgba(255, 134, 134, 0.45);
  box-shadow:
    0 18px 48px rgba(4, 12, 20, 0.35),
    0 0 18px rgba(255, 78, 78, 0.18);
}

.hud.is-error .hud__panel {
  background: linear-gradient(160deg, rgba(61, 17, 14, 0.95), rgba(102, 29, 22, 0.82));
}

.mobile-controls {
  display: none;
  inset: 0;
  position: absolute;
}

.hud.is-mobile .mobile-controls {
  display: block;
}

.mobile-controls__left,
.mobile-controls__right {
  bottom: 20px;
  position: absolute;
}

.mobile-controls__left {
  left: 20px;
}

.mobile-controls__right {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: 12px;
  right: 20px;
}

.touchpad,
.lookpad,
.mobile-button,
.mobile-weapon {
  backdrop-filter: blur(14px);
  background: rgba(7, 31, 46, 0.24);
  border: 1px solid rgba(224, 247, 255, 0.22);
  color: #ecfbff;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.touchpad {
  border-radius: 999px;
  height: 128px;
  position: relative;
  width: 128px;
}

.touchpad::after {
  border: 1px solid rgba(224, 247, 255, 0.18);
  border-radius: 999px;
  content: "";
  inset: 18px;
  position: absolute;
}

.touchpad__stick {
  --stick-x: 0px;
  --stick-y: 0px;
  background: linear-gradient(180deg, rgba(225, 249, 255, 0.95), rgba(121, 214, 243, 0.92));
  border-radius: 999px;
  height: 48px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(calc(-50% + var(--stick-x)), calc(-50% + var(--stick-y)));
  width: 48px;
}

.lookpad {
  align-items: flex-start;
  border-radius: 22px;
  display: flex;
  height: 150px;
  justify-content: flex-end;
  padding: 12px;
  width: min(36vw, 200px);
}

.lookpad__label {
  color: rgba(232, 250, 255, 0.72);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mobile-actions,
.mobile-weapons {
  display: flex;
  gap: 10px;
}

.mobile-button,
.mobile-weapon {
  align-items: center;
  border-radius: 18px;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 52px;
  min-width: 52px;
  padding: 0 14px;
}

.mobile-weapon.is-active {
  background: linear-gradient(180deg, rgba(201, 242, 255, 0.96), rgba(139, 216, 244, 0.92));
  border-color: rgba(234, 251, 255, 0.5);
  color: #06202d;
}

.mobile-button--fire {
  background: linear-gradient(180deg, rgba(255, 119, 119, 0.88), rgba(186, 32, 48, 0.86));
  border-color: rgba(255, 217, 217, 0.3);
  min-width: 96px;
}

.mobile-button--aux {
  background: rgba(7, 31, 46, 0.58);
}

.hud.is-mobile .hud__tips {
  display: none;
}

.hud.is-mobile .ammo__slots {
  display: none;
}

.hud.is-mobile .hud__panel {
  max-width: min(360px, calc(100vw - 32px));
}

@media (max-width: 720px) {
  .hud__panel {
    left: 16px;
    max-width: calc(100vw - 32px);
    right: 16px;
    top: 16px;
  }

  .ammo {
    bottom: 16px;
    right: 16px;
  }

  .survival {
    right: 16px;
    top: 16px;
  }

  .hud.is-mobile .ammo {
    bottom: 184px;
    left: 16px;
    right: auto;
  }

  .hud.is-mobile .survival {
    right: 16px;
    min-width: 180px;
    top: 16px;
  }

  .hud.is-mobile .hud__panel {
    opacity: 0.82;
  }

  .mobile-controls__left,
  .mobile-controls__right {
    bottom: max(16px, env(safe-area-inset-bottom));
  }

  .mobile-controls__left {
    left: max(16px, env(safe-area-inset-left));
  }

  .mobile-controls__right {
    right: max(16px, env(safe-area-inset-right));
  }
}
