:root {
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #f7fbff;
  background: #05070d;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(6, 10, 20, 0) 0%, rgba(6, 10, 20, 0.44) 72%),
    #05070d;
}

button {
  font: inherit;
}

#app,
canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

canvas {
  display: block;
  cursor: crosshair;
}

#hud {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  width: min(520px, calc(100vw - 32px));
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  text-shadow: 0 0 12px rgba(0, 255, 255, 0.34);
}

.hud-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.hud-row.compact {
  grid-template-columns: minmax(0, 1fr) auto auto;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid rgba(120, 247, 255, 0.22);
  background: rgba(7, 12, 22, 0.62);
  backdrop-filter: blur(10px);
  box-shadow: 0 0 26px rgba(0, 255, 224, 0.08);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.meter {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(120, 247, 255, 0.2);
  background: rgba(7, 12, 22, 0.64);
  backdrop-filter: blur(10px);
  box-shadow: 0 0 24px rgba(0, 255, 224, 0.08);
}

.meter span,
.compact span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.meter span {
  margin-bottom: 6px;
  font-size: 11px;
  color: rgba(231, 247, 255, 0.78);
  text-transform: uppercase;
}

.meter-track {
  height: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.09);
}

.meter-fill {
  width: 100%;
  height: 100%;
  transform-origin: left center;
  transition: transform 120ms linear, background-color 120ms linear;
}

.health {
  background: linear-gradient(90deg, #ff3868, #ff9c38);
}

.shield {
  background: linear-gradient(90deg, #42f5ff, #8bffea);
}

.heat {
  background: linear-gradient(90deg, #b9ff46, #ffdc4f, #ff4fd8);
}

#objective {
  color: #e9fbff;
}

#shards {
  color: #8bffea;
}

#score {
  min-width: 64px;
  color: #ffdc4f;
  text-align: right;
}

#threatPanel {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 5;
  width: min(220px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 1px solid rgba(255, 51, 95, 0.34);
  background:
    linear-gradient(90deg, rgba(255, 51, 95, 0.16), transparent),
    rgba(7, 12, 22, 0.58);
  box-shadow:
    0 0 26px rgba(255, 51, 95, 0.12),
    inset 0 0 18px rgba(255, 51, 95, 0.07);
  backdrop-filter: blur(10px);
  pointer-events: none;
  text-transform: uppercase;
}

.threat-label,
#threatHint {
  display: block;
  overflow: hidden;
  color: rgba(245, 250, 255, 0.72);
  font-size: 10px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#threatCount {
  display: block;
  margin: 3px 0;
  color: #ff6f91;
  font-size: 18px;
  line-height: 1;
  text-shadow: 0 0 12px rgba(255, 51, 95, 0.74);
}

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

.enemy-marker {
  --marker-angle: 0rad;
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  transform: translate(-50%, -50%);
  min-width: 76px;
  padding: 4px 7px;
  border: 1px solid rgba(255, 51, 95, 0.62);
  background: rgba(22, 3, 12, 0.58);
  box-shadow: 0 0 18px rgba(255, 51, 95, 0.34);
  color: #ffd7e1;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(255, 51, 95, 0.95);
}

.enemy-marker::before {
  content: "";
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  background: #ff335f;
  box-shadow: 0 0 14px rgba(255, 51, 95, 0.9);
  transform: rotate(45deg);
}

.enemy-marker.offscreen::before {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  transform: rotate(var(--marker-angle));
}

.enemy-marker.damaged {
  border-color: rgba(255, 220, 79, 0.9);
  color: #fff4ad;
  box-shadow: 0 0 24px rgba(255, 220, 79, 0.42);
}

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

#crosshair span {
  position: absolute;
  display: block;
  background: rgba(234, 255, 255, 0.88);
  box-shadow: 0 0 10px rgba(37, 244, 255, 0.9);
}

#crosshair span:nth-child(1),
#crosshair span:nth-child(2) {
  left: 16px;
  width: 2px;
  height: 10px;
}

#crosshair span:nth-child(1) {
  top: 0;
}

#crosshair span:nth-child(2) {
  bottom: 0;
}

#crosshair span:nth-child(3),
#crosshair span:nth-child(4) {
  top: 16px;
  width: 10px;
  height: 2px;
}

#crosshair span:nth-child(3) {
  left: 0;
}

#crosshair span:nth-child(4) {
  right: 0;
}

.toast {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 6;
  max-width: min(420px, calc(100vw - 36px));
  min-height: 36px;
  padding: 10px 12px;
  opacity: 0;
  transform: translateY(8px);
  border: 1px solid rgba(255, 220, 79, 0.32);
  background: rgba(14, 16, 24, 0.72);
  backdrop-filter: blur(10px);
  color: #fff4ad;
  font-size: 13px;
  text-transform: uppercase;
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

#damageVignette {
  position: fixed;
  inset: 0;
  z-index: 3;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 50%, transparent 42%, rgba(255, 56, 104, 0.38) 100%),
    rgba(255, 0, 76, 0.08);
  pointer-events: none;
  transition: opacity 200ms ease;
}

#damageVignette.visible {
  opacity: 1;
}

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center start;
  overflow: hidden;
  padding: clamp(18px, 5vw, 72px);
  background: #04070c;
}

.screen::before,
.screen::after {
  content: "";
  position: absolute;
  inset: 0;
}

.screen::before {
  background:
    linear-gradient(90deg, rgba(4, 7, 12, 0.62), rgba(4, 7, 12, 0.24) 42%, rgba(4, 7, 12, 0.08)),
    url("/fps/public/assets/neon-voxel-breach-start.png") center / cover no-repeat;
  transform: scale(1.02);
}

.screen::after {
  background:
    linear-gradient(180deg, rgba(4, 7, 12, 0.14), rgba(4, 7, 12, 0.34)),
    linear-gradient(90deg, rgba(66, 245, 255, 0.12), transparent 30%, rgba(255, 51, 95, 0.1));
  pointer-events: none;
}

.screen.hidden {
  display: none;
}

.screen-panel {
  position: relative;
  z-index: 1;
  width: min(650px, 100%);
  padding: clamp(24px, 4.4vw, 48px);
  border: 1px solid rgba(121, 247, 255, 0.36);
  background:
    linear-gradient(135deg, rgba(10, 15, 27, 0.9), rgba(5, 9, 17, 0.62)),
    rgba(5, 9, 17, 0.76);
  box-shadow:
    0 24px 90px rgba(0, 0, 0, 0.54),
    0 0 52px rgba(0, 255, 224, 0.16),
    inset 0 0 38px rgba(255, 79, 216, 0.08);
  backdrop-filter: blur(14px);
}

.kicker {
  margin: 0 0 14px;
  color: #8bffea;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  max-width: 560px;
  margin: 0;
  font-size: clamp(34px, 7vw, 68px);
  line-height: 0.95;
  letter-spacing: 0;
}

.screen-copy {
  max-width: 540px;
  margin: 18px 0 0;
  color: rgba(239, 248, 255, 0.78);
  font-size: clamp(15px, 2.5vw, 18px);
  line-height: 1.5;
}

.mission-brief {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.mission-brief span {
  padding: 7px 10px;
  border: 1px solid rgba(255, 51, 95, 0.38);
  background: rgba(255, 51, 95, 0.1);
  color: #ff9bae;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  box-shadow: 0 0 18px rgba(255, 51, 95, 0.1);
}

#startButton {
  min-height: 46px;
  margin-top: 24px;
  padding: 0 20px;
  border: 0;
  background: linear-gradient(90deg, #42f5ff, #ff4fd8);
  color: #061018;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 0 26px rgba(66, 245, 255, 0.28);
}

#startButton:hover,
#startButton:focus-visible {
  outline: 2px solid #ffdc4f;
  outline-offset: 3px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.controls span {
  min-width: 54px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(242, 250, 255, 0.72);
  font-size: 12px;
  text-align: center;
  text-transform: uppercase;
}

@media (max-width: 640px) {
  #hud {
    right: 12px;
    left: 12px;
    width: auto;
  }

  .hud-row {
    grid-template-columns: 1fr;
  }

  .hud-row.compact {
    grid-template-columns: 1fr auto;
  }

  #score {
    display: none;
  }

  #threatPanel {
    top: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: min(210px, calc(100vw - 24px));
  }

  .enemy-marker {
    min-width: auto;
    padding: 4px 6px;
  }

  .enemy-marker span {
    display: none;
  }

  .screen {
    place-items: end center;
  }

  .screen::before {
    background:
      linear-gradient(180deg, rgba(4, 7, 12, 0.08), rgba(4, 7, 12, 0.76)),
      url("/fps/public/assets/neon-voxel-breach-start.png") center / cover no-repeat;
  }
}
