.galaxy-dogfight-level {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 20%, rgba(58, 218, 255, 0.26), transparent 28%),
    radial-gradient(circle at 84% 18%, rgba(255, 85, 178, 0.22), transparent 28%),
    #050614;
  color: #f6fbff;
  touch-action: none;
}

.galaxy-dogfight-stage,
.galaxy-dogfight-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.galaxy-dogfight-canvas {
  display: block;
}

.galaxy-dogfight-reticle {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 78px;
  height: 78px;
  border: 2px solid rgba(143, 247, 255, 0.65);
  border-radius: 50%;
  box-shadow:
    0 0 18px rgba(79, 230, 255, 0.34),
    inset 0 0 18px rgba(79, 230, 255, 0.2);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.galaxy-dogfight-reticle::before,
.galaxy-dogfight-reticle::after {
  position: absolute;
  left: 50%;
  top: 50%;
  content: "";
  background: rgba(143, 247, 255, 0.74);
  transform: translate(-50%, -50%);
}

.galaxy-dogfight-reticle::before {
  width: 2px;
  height: 24px;
}

.galaxy-dogfight-reticle::after {
  width: 24px;
  height: 2px;
}

.galaxy-dogfight-hud {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  z-index: 4;
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) auto minmax(170px, 240px);
  gap: 10px;
  align-items: stretch;
  pointer-events: none;
}

.galaxy-dogfight-hud button,
.galaxy-dogfight-brief,
.galaxy-dogfight-score,
.galaxy-dogfight-bars,
.galaxy-dogfight-controls {
  pointer-events: auto;
}

.galaxy-dogfight-exit,
.galaxy-dogfight-brief,
.galaxy-dogfight-score,
.galaxy-dogfight-bars {
  border: 1px solid rgba(170, 240, 255, 0.42);
  background: rgba(5, 11, 29, 0.78);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(10px);
}

.galaxy-dogfight-exit {
  min-width: 86px;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 12px;
  color: #fff;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0;
}

.galaxy-dogfight-hud button:focus-visible,
.galaxy-dogfight-controls button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.92);
  outline-offset: 3px;
}

.galaxy-dogfight-brief {
  min-height: 68px;
  padding: 10px 14px;
  border-radius: 12px;
}

.galaxy-dogfight-brief span {
  display: block;
  margin-bottom: 2px;
  color: #8ff7ff;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.galaxy-dogfight-brief h1 {
  margin: 0;
  font-size: clamp(1.16rem, 2.3vw, 1.62rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.galaxy-dogfight-brief p {
  margin: 4px 0 0;
  color: #daf9ff;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.2;
}

.galaxy-dogfight-score {
  display: grid;
  place-items: center;
  min-width: 96px;
  padding: 8px 12px;
  border-color: rgba(255, 126, 201, 0.5);
  border-radius: 12px;
}

.galaxy-dogfight-score small {
  color: #ffc4e6;
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.galaxy-dogfight-score b {
  font-size: 1.42rem;
  line-height: 1.1;
}

.galaxy-dogfight-bars {
  display: grid;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 12px;
}

.galaxy-dogfight-bars label {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: #dffaff;
  font-size: 0.78rem;
  font-weight: 900;
}

.galaxy-dogfight-bars i {
  position: relative;
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.galaxy-dogfight-bars b {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7af7b4, #7eeeff);
  box-shadow: 0 0 14px rgba(126, 238, 255, 0.45);
}

.galaxy-dogfight-radar {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 4;
  width: 108px;
  height: 108px;
  border: 2px solid rgba(146, 246, 255, 0.42);
  border-radius: 50%;
  background:
    linear-gradient(rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.12)) 50% 0 / 1px 100% no-repeat,
    linear-gradient(90deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.12)) 0 50% / 100% 1px no-repeat,
    rgba(4, 12, 29, 0.68);
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.34),
    inset 0 0 22px rgba(78, 229, 255, 0.16);
  pointer-events: none;
}

.galaxy-radar-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.galaxy-radar-dot.ship {
  background: #ff71c2;
  box-shadow: 0 0 10px rgba(255, 113, 194, 0.85);
}

.galaxy-radar-dot.rock {
  width: 5px;
  height: 5px;
  background: #c8d2df;
  opacity: 0.7;
}

.galaxy-radar-dot.beacon {
  width: 10px;
  height: 10px;
  background: #ffe27a;
  border: 2px solid #6ef6ff;
  box-shadow:
    0 0 10px rgba(255, 226, 122, 0.92),
    0 0 18px rgba(110, 246, 255, 0.64);
}

.galaxy-dogfight-controls {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  right: max(144px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 5;
  display: flex;
  gap: 14px;
  align-items: end;
  pointer-events: none;
}

.galaxy-dogfight-controls button {
  border: 1px solid rgba(255, 255, 255, 0.38);
  color: #fff;
  font-weight: 900;
  letter-spacing: 0;
  background: rgba(9, 22, 45, 0.78);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
  touch-action: manipulation;
  user-select: none;
}

.galaxy-dogfight-controls button:active {
  transform: translateY(1px) scale(0.98);
}

.galaxy-dogfight-pad {
  display: grid;
  grid-template-columns: repeat(3, 54px);
  grid-template-rows: repeat(2, 54px);
  gap: 7px;
}

.galaxy-dogfight-pad button {
  min-width: 54px;
  min-height: 54px;
  border-radius: 16px;
  font-size: 1.25rem;
}

.galaxy-dogfight-pad button:first-child {
  grid-column: 2;
}

.galaxy-dogfight-pad button:nth-child(2) {
  grid-column: 1;
}

.galaxy-dogfight-pad button:nth-child(3) {
  grid-column: 2;
}

.galaxy-dogfight-pad button:nth-child(4) {
  grid-column: 3;
}

.galaxy-dogfight-actions {
  display: flex;
  gap: 10px;
}

.galaxy-dogfight-actions button {
  min-width: 82px;
  min-height: 62px;
  padding: 0 16px;
  border-radius: 18px;
  font-size: 1rem;
}

.galaxy-dogfight-actions .fire {
  border-color: rgba(255, 113, 194, 0.72);
  background: rgba(116, 16, 70, 0.82);
}

.galaxy-dogfight-actions .boost {
  border-color: rgba(126, 238, 255, 0.68);
}

.galaxy-dogfight-actions .flip {
  border-color: rgba(255, 214, 110, 0.68);
  background: rgba(96, 70, 12, 0.78);
}

.galaxy-dogfight-actions .dock {
  border-color: rgba(125, 249, 255, 0.72);
  background: rgba(12, 78, 96, 0.78);
}

@media (max-width: 820px) {
  .galaxy-dogfight-hud {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .galaxy-dogfight-bars {
    grid-column: 2 / 4;
  }

  .galaxy-dogfight-brief p {
    display: none;
  }

  .galaxy-dogfight-radar {
    width: 94px;
    height: 94px;
  }

  .galaxy-dogfight-controls {
    right: max(112px, env(safe-area-inset-right));
  }
}

@media (max-width: 560px) {
  .galaxy-dogfight-reticle {
    width: 62px;
    height: 62px;
  }

  .galaxy-dogfight-hud {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .galaxy-dogfight-score {
    display: none;
  }

  .galaxy-dogfight-bars {
    grid-column: 1 / 3;
  }

  .galaxy-dogfight-brief p {
    display: block;
    max-width: 100%;
    margin-top: 2px;
    overflow: hidden;
    font-size: 0.72rem;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .galaxy-dogfight-radar {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(142px, calc(env(safe-area-inset-bottom) + 142px));
    width: 86px;
    height: 86px;
  }

  .galaxy-dogfight-controls {
    right: max(12px, env(safe-area-inset-right));
    justify-content: space-between;
  }

  .galaxy-dogfight-pad {
    grid-template-columns: repeat(3, 48px);
    grid-template-rows: repeat(2, 48px);
    gap: 6px;
  }

  .galaxy-dogfight-pad button {
    min-width: 48px;
    min-height: 48px;
    border-radius: 14px;
  }

  .galaxy-dogfight-actions {
    flex-direction: column;
    gap: 8px;
  }

  .galaxy-dogfight-actions button {
    min-width: 74px;
    min-height: 54px;
    border-radius: 16px;
  }
}
