/* ─── faction theme variables ─────────────────────────────────────── */
:root {
  --ui-accent: #1fc7d4;
  --ui-accent-soft: rgba(31, 199, 212, 0.55);
  --ui-accent-glow: rgba(31, 199, 212, 0.35);
  --ui-accent-rim: rgba(31, 199, 212, 0.85);
  --ui-secondary: #c7a64a;
  --ui-panel-bg: linear-gradient(
    160deg,
    rgba(10, 20, 36, 0.78),
    rgba(4, 10, 22, 0.72)
  );
  --ui-panel-border: rgba(31, 199, 212, 0.45);
  --ui-panel-shadow:
    0 10px 32px rgba(31, 199, 212, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  --ui-text-primary: #f0f8ff;
  --ui-text-muted: rgba(220, 235, 250, 0.55);
  --ui-text-label: rgba(220, 235, 250, 0.45);
  --ui-font-display: "Orbitron", "Rajdhani", -apple-system, sans-serif;
  --ui-font-body: "Rajdhani", -apple-system, BlinkMacSystemFont, sans-serif;
  --ui-letter-display: 4px;
  --ui-letter-body: 1.5px;
  --ui-corner-cut: 8px;
}

body.theme-guardians {
  --ui-accent: #1fc7d4;
  --ui-accent-soft: rgba(31, 199, 212, 0.55);
  --ui-accent-glow: rgba(31, 199, 212, 0.38);
  --ui-accent-rim: rgba(31, 199, 212, 0.85);
  --ui-secondary: #c7a64a;
  --ui-panel-bg: linear-gradient(
    160deg,
    rgba(10, 22, 40, 0.78),
    rgba(4, 12, 24, 0.72)
  );
  --ui-panel-border: rgba(31, 199, 212, 0.5);
  --ui-text-primary: #f0f8ff;
}

/* ─── shared utility classes ──────────────────────────────────────── */
.holo-panel {
  background: var(--ui-panel-bg);
  border: 1px solid var(--ui-panel-border);
  border-radius: 4px;
  box-shadow: var(--ui-panel-shadow);
  color: var(--ui-text-primary);
  font-family: var(--ui-font-body);
  position: relative;
}
.holo-panel::before,
.holo-panel::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1px solid var(--ui-accent-rim);
  pointer-events: none;
}
.holo-panel::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}
.holo-panel::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
}
@keyframes holoEdgePulse {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }
  50% {
    box-shadow: 0 0 12px var(--ui-accent-glow);
  }
}
@keyframes holoScan {
  0% {
    transform: translateY(-100%);
    opacity: 0;
  }
  20% {
    opacity: 0.4;
  }
  80% {
    opacity: 0.4;
  }
  100% {
    transform: translateY(100%);
    opacity: 0;
  }
}

body {
  font-family: var(--ui-font-body);
  font-weight: 400;
  letter-spacing: 0.4px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  position: fixed;
  overflow: hidden;
  width: 100%;
  height: 100%;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  background: #000;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  color: #fff;
}
canvas {
  display: block;
  touch-action: none;
}

#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.8);
  font-size: 22px;
  pointer-events: none;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
}

#prompt {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 15, 25, 0.8);
  border: 1px solid rgba(31, 199, 212, 0.4);
  padding: 10px 22px;
  border-radius: 4px;
  font-size: 13px;
  letter-spacing: 1px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
  z-index: 5;
}
#prompt.visible {
  opacity: 1;
}

#palette {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 260px;
  background: var(--ui-panel-bg);
  border: 1px solid var(--ui-panel-border);
  padding: 16px;
  border-radius: 3px;
  backdrop-filter: blur(10px) saturate(140%);
  box-shadow: 0 0 24px var(--ui-accent-glow);
  z-index: 5;
  font-family: var(--ui-font-body);
  color: var(--ui-text-primary);
}
#palette::before,
#palette::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1px solid var(--ui-accent-rim);
  pointer-events: none;
}
#palette::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}
#palette::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
}
#palette.hidden {
  display: none;
}
.palette-title {
  color: var(--ui-accent);
  font-size: 12px;
  letter-spacing: var(--ui-letter-display);
  font-weight: 700;
  font-family: var(--ui-font-display);
  margin-bottom: 10px;
  border-bottom: 1px solid var(--ui-panel-border);
  padding-bottom: 8px;
  text-shadow: 0 0 8px var(--ui-accent-glow);
}
.palette-item {
  padding: 10px 10px;
  margin: 5px 0;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.palette-item.selected {
  background: rgba(31, 199, 212, 0.18);
  border-left: 3px solid #1fc7d4;
  padding-left: 7px;
}
.palette-item:hover {
  background: rgba(255, 255, 255, 0.1);
}
.key {
  background: #1fc7d4;
  color: #000;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 3px;
  text-align: center;
  font-size: 11px;
  line-height: 20px;
  flex-shrink: 0;
}
.palette-hint {
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  margin-top: 10px;
  line-height: 1.4;
}

#lock-prompt {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(31, 199, 212, 0.4);
  padding: 24px 44px;
  border-radius: 6px;
  text-align: center;
  font-size: 18px;
  pointer-events: none;
  z-index: 5;
}
#lock-prompt small {
  display: block;
  margin-top: 10px;
  opacity: 0.7;
  font-size: 12px;
  letter-spacing: 1px;
}
#lock-prompt.hidden {
  display: none;
}

/* ─── touch UI ─── */
#touch-ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 8;
}
#joy {
  position: absolute;
  left: max(30px, env(safe-area-inset-left, 0px));
  bottom: max(40px, env(safe-area-inset-bottom, 0px));
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(10, 15, 25, 0.35);
  border: 2px solid rgba(31, 199, 212, 0.45);
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
#joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 60px;
  height: 60px;
  margin-left: -30px;
  margin-top: -30px;
  border-radius: 50%;
  background: rgba(31, 199, 212, 0.65);
  border: 2px solid rgba(255, 255, 255, 0.55);
  pointer-events: none;
}
#action-e {
  position: absolute;
  right: max(30px, env(safe-area-inset-right, 0px));
  bottom: max(70px, env(safe-area-inset-bottom, 0px));
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: rgba(31, 199, 212, 0.4);
  border: 2px solid rgba(31, 199, 212, 0.7);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  cursor: pointer;
}
#action-e:active {
  background: rgba(31, 199, 212, 0.75);
  transform: scale(0.96);
}
#touch-ui[data-mode="rts"] #joy {
  display: none;
}
#touch-ui[data-mode="rts"] #action-e {
  background: rgba(192, 57, 43, 0.45);
  border-color: rgba(192, 57, 43, 0.75);
}

body.touch-device #lock-prompt,
body.touch-device #crosshair {
  display: none !important;
}
body.touch-device #prompt {
  bottom: 180px;
}
body.touch-device #palette {
  right: 12px;
  top: 12px;
  width: 210px;
  padding: 10px;
}
#minimap {
  position: fixed;
  bottom: 14px;
  right: 14px;
  width: 220px;
  height: 220px;
  border-radius: 4px;
  z-index: 6;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.55);
}
body.touch-device #minimap {
  width: 150px;
  height: 150px;
  bottom: 170px;
  right: 14px;
}

#screen-flash {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 9;
  transition: none;
}

#hud {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-family: var(--ui-font-body);
  background: var(--ui-panel-bg);
  border: 1px solid var(--ui-panel-border);
  padding: 10px 26px 12px;
  border-radius: 3px;
  z-index: 5;
  letter-spacing: var(--ui-letter-body);
  pointer-events: none;
  backdrop-filter: blur(10px) saturate(140%);
  box-shadow: 0 0 28px var(--ui-accent-glow);
  color: var(--ui-text-primary);
  min-width: 260px;
  position: fixed;
}
#hud::before,
#hud::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1px solid var(--ui-accent-rim);
  pointer-events: none;
}
#hud::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}
#hud::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
}
#hud.visible {
  display: flex;
}
#hud-region {
  font-size: 13px;
  font-weight: 700;
  color: var(--ui-accent);
  letter-spacing: var(--ui-letter-display);
  font-family: var(--ui-font-display);
  text-shadow: 0 0 8px var(--ui-accent-glow);
}
#hud-speed {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
}
#hud-target {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 1.2px;
}
#hud-target.ready {
  color: #ed4b9e;
}
#hud-target.locked {
  color: #ff5555;
  letter-spacing: 1.6px;
}
#hud-ship {
  font-size: 10px;
  color: #1fc7d4;
  letter-spacing: 1.5px;
  margin-top: 2px;
}

#space-prompt {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(8, 14, 24, 0.88);
  border: 1px solid rgba(31, 199, 212, 0.55);
  border-radius: 4px;
  padding: 14px 26px;
  text-align: center;
  z-index: 7;
  pointer-events: none;
  transition: opacity 0.25s;
}
#space-prompt.hidden {
  opacity: 0;
  pointer-events: none;
}
.sp-title {
  color: #1fc7d4;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 3px;
  margin-bottom: 6px;
}
.sp-row {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  letter-spacing: 1.2px;
  margin-top: 3px;
}
body.touch-device #hud {
  top: 12px;
  padding: 7px 16px;
}

#harvest-bar {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  height: 6px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(31, 199, 212, 0.5);
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 6;
  pointer-events: none;
}
#harvest-bar.visible {
  opacity: 1;
}
#harvest-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffd24a, #ed4b9e);
  border-radius: 2px;
}

#turret-hud {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(8, 14, 24, 0.8);
  border: 1px solid rgba(237, 75, 158, 0.5);
  padding: 10px 22px;
  border-radius: 4px;
  z-index: 6;
  pointer-events: none;
}
#turret-hud.visible {
  display: flex;
}
.turret-label {
  font-size: 11px;
  letter-spacing: 2.5px;
  color: #ed4b9e;
  font-weight: 700;
}
.turret-hint {
  font-size: 9px;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.4);
}
#heat-bar {
  width: 220px;
  height: 7px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(237, 75, 158, 0.4);
  border-radius: 3px;
  overflow: hidden;
}
#heat-bar.hot {
  border-color: #ff4444;
  box-shadow: 0 0 8px rgba(255, 68, 68, 0.6);
}
#heat-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffd24a 0%, #ff4444 100%);
  transition: width 0.05s linear;
}

/* ── inventory ── */
#inventory-panel {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 280px;
  background: var(--ui-panel-bg);
  border: 1px solid var(--ui-panel-border);
  border-left: none;
  border-radius: 0 3px 3px 0;
  padding: 16px 18px;
  z-index: 6;
  font-family: var(--ui-font-body);
  transition: transform 0.28s cubic-bezier(0.5, 0, 0.2, 1);
  backdrop-filter: blur(12px) saturate(140%);
  color: var(--ui-text-primary);
  box-shadow: 0 0 28px var(--ui-accent-glow);
}
#inventory-panel::before,
#inventory-panel::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid var(--ui-accent-rim);
  pointer-events: none;
}
#inventory-panel::before {
  top: -1px;
  right: -1px;
  border-left: none;
  border-bottom: none;
}
#inventory-panel::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
}
#inventory-panel.collapsed {
  transform: translate(-280px, -50%);
}
#inv-toggle {
  position: absolute;
  right: -44px;
  top: 14px;
  width: 44px;
  height: 44px;
  background: var(--ui-panel-bg);
  border: 1px solid var(--ui-panel-border);
  border-left: none;
  color: var(--ui-accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  border-radius: 0 3px 3px 0;
  backdrop-filter: blur(10px);
  text-shadow: 0 0 8px var(--ui-accent-glow);
  box-shadow: 8px 0 18px var(--ui-accent-glow);
  transition: background 0.15s;
}
#inv-toggle:hover {
  background: var(--ui-accent-glow);
}
.inv-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.inv-title {
  color: var(--ui-accent);
  font-family: var(--ui-font-display);
  font-size: 12px;
  letter-spacing: var(--ui-letter-display);
  font-weight: 700;
  border-bottom: 1px solid var(--ui-panel-border);
  padding-bottom: 10px;
  text-shadow: 0 0 8px var(--ui-accent-glow);
}
.inv-tabs {
  display: flex;
  gap: 4px;
}
.inv-tab {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--ui-text-muted);
  padding: 7px;
  font-size: 9px;
  letter-spacing: 2px;
  cursor: pointer;
  border-radius: 0;
  font-weight: 700;
  font-family: var(--ui-font-display);
  transition: all 0.15s;
  clip-path: polygon(
    6px 0,
    100% 0,
    100% calc(100% - 6px),
    calc(100% - 6px) 100%,
    0 100%,
    0 6px
  );
}
.inv-tab:hover {
  color: var(--ui-text-primary);
  background: var(--ui-accent-glow);
}
.inv-tab.active {
  background: var(--ui-accent-soft);
  border-color: var(--ui-accent);
  color: var(--ui-text-primary);
  box-shadow: 0 0 10px var(--ui-accent-glow);
}
#inv-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
}
.inv-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.025);
  border-radius: 0;
  border-left: 3px solid transparent;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.15s;
}
.inv-slot:hover {
  background: rgba(255, 255, 255, 0.06);
  border-left-color: var(--ui-accent);
  transform: translateX(2px);
}
.inv-slot.flash {
  background: var(--ui-accent-soft);
  border-left-color: var(--ui-accent);
  animation: invflash 0.5s ease-out;
  box-shadow: 0 0 14px var(--ui-accent-glow);
}
@keyframes invflash {
  0% {
    background: var(--ui-accent-rim);
  }
  100% {
    background: rgba(255, 255, 255, 0.025);
  }
}
.inv-icon {
  width: 28px;
  height: 28px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.4);
}
.inv-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.inv-name {
  font-size: 12px;
  color: var(--ui-text-primary);
  letter-spacing: 1px;
}
.inv-qty {
  font-size: 13px;
  color: var(--ui-accent);
  font-weight: 700;
  font-family: var(--ui-font-display);
  text-shadow: 0 0 6px var(--ui-accent-glow);
  font-variant-numeric: tabular-nums;
}
.inv-footer {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 1.5px;
  padding-top: 8px;
  border-top: 1px solid rgba(31, 199, 212, 0.18);
}

/* ── player stats ── */
#stats-panel {
  /* On-foot vitals — compact HP + Shield bars pinned bottom-centre (matches the
     HP/shield readouts on the other layers). Was a tall right-side stats card. */
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: 260px;
  background: var(--ui-panel-bg);
  border: 1px solid var(--ui-panel-border);
  border-radius: 4px;
  padding: 8px 14px;
  z-index: 5;
  font-family: var(--ui-font-body);
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow:
    var(--ui-panel-shadow),
    0 0 20px var(--ui-accent-glow);
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--ui-text-primary);
  overflow: hidden;
}
#stats-panel::before,
#stats-panel::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid var(--ui-accent-rim);
  pointer-events: none;
}
#stats-panel::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}
#stats-panel::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
}
#stats-panel.hidden {
  display: none;
}
.stats-title {
  color: var(--ui-accent);
  font-size: 12px;
  letter-spacing: var(--ui-letter-display);
  font-weight: 700;
  font-family: var(--ui-font-display);
  border-bottom: 1px solid var(--ui-panel-border);
  padding-bottom: 6px;
  text-shadow: 0 0 8px var(--ui-accent-glow);
}
.stat-bar-row {
  display: grid;
  grid-template-columns: 56px 1fr 30px;
  align-items: center;
  gap: 6px;
  font-size: 10px;
}
.stat-label {
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 1px;
}
.stat-bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 3px;
  overflow: hidden;
}
.stat-fill {
  height: 100%;
  transition: width 0.2s;
}
.stat-fill.hp {
  background: linear-gradient(90deg, #c0392b, #ed4b9e);
}
.stat-fill.shield {
  background: linear-gradient(90deg, #1fc7d4, #9be3e6);
}
.stat-fill.stamina {
  background: linear-gradient(90deg, #ffd24a, #ff8a4a);
}
.stat-num {
  font-size: 10px;
  color: #fff;
  text-align: right;
}
.stats-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.stats-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
}
.stats-row span:first-child {
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 1px;
  font-size: 10px;
}
.weapon-block .weapon-name {
  font-size: 13px;
  color: #ed4b9e;
  font-weight: 700;
}
.weapon-block .weapon-kind {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.ammo-row.hidden {
  display: none;
}
.ammo-row #stat-ammo {
  color: #ffd87a;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ammo-row #stat-reserve {
  color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
}
.ammo-row .ammo-sep {
  color: rgba(255, 255, 255, 0.3);
  margin: 0 2px;
}
#stat-ammo.ammo-low {
  color: #ff9b4a;
}
#stat-ammo.ammo-empty {
  color: #ed4b9e;
  animation: ammoBlink 0.6s ease-in-out infinite;
}
@keyframes ammoBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}
.reload-hint {
  margin-top: 4px;
  font-size: 10px;
  letter-spacing: 2px;
  color: #ffd87a;
  text-align: center;
  animation: reloadPulse 0.8s ease-in-out infinite;
}
.reload-hint.hidden {
  display: none;
}
@keyframes reloadPulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* ── hotbar ── */
#hotbar {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 6;
  opacity: 0;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  pointer-events: none;
}
#hotbar.transient-visible {
  opacity: 1;
  pointer-events: auto;
}
#hotbar.hidden {
  display: none;
}
.hotbar-slot {
  width: 56px;
  height: 56px;
  background: rgba(8, 14, 24, 0.85);
  border: 1px solid rgba(31, 199, 212, 0.3);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.12s,
    border-color 0.12s,
    box-shadow 0.12s;
}
.hotbar-slot.active {
  border-color: #1fc7d4;
  box-shadow: 0 0 12px rgba(31, 199, 212, 0.5);
  transform: translateY(-4px);
}
.hotbar-icon {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  box-shadow: inset 0 -3px 5px rgba(0, 0, 0, 0.4);
}
.hotbar-key {
  position: absolute;
  top: 3px;
  left: 5px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 700;
}

body.touch-device #inventory-panel {
  width: 200px;
}
body.touch-device #stats-panel {
  width: 200px;
  left: 8px;
}
body.touch-device #hotbar {
  bottom: 12px;
}
body.touch-device .hotbar-slot {
  width: 44px;
  height: 44px;
}

/* ── RTS structure info panel ── */
/* Building-selection panel — fede 2026-05-28: decluttered to the new
   pattern (slim HP bar + actions to the RIGHT), matching the Comms Hub
   panel. The old ARMOR/SHIELD/POWER/TIER stat grid + status line are
   hidden (".ri-stats / .ri-status / #ri-subtitle" below); the JS still
   writes them harmlessly. flex-wrap lays out: title (row 1, full width),
   then [HP bar | upgrade button] (row 2), then the production queue
   (row 3, full width) for factories. */
#rts-info {
  /* fede 2026-06-13 — the floating building/CC info card is RETIRED: HP/shield
     now live on the bottom selection icon, and the CC upgrade moved to its own
     contextual icon (see #cc-upgrade-act). Kept in the DOM (the selection
     dispatcher still writes to its fields harmlessly) but never shown. */
  display: none !important;
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  max-width: 560px;
  background: linear-gradient(160deg, rgba(8, 16, 28, 0.94), rgba(5, 10, 20, 0.9));
  border: 1px solid rgba(31, 199, 212, 0.55);
  border-radius: 8px;
  padding: 10px 12px;
  z-index: 7;
  backdrop-filter: blur(8px);
  font-family: system-ui, sans-serif;
  color: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
#rts-info.hidden {
  display: none;
}
.ri-header {
  flex: 1 1 100%;
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 0;
  margin: 0;
}
#ri-subtitle {
  display: none;
}
#ri-title {
  color: #1fc7d4;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
}
.ri-bar-row {
  display: grid;
  grid-template-columns: auto 140px auto;
  align-items: center;
  gap: 6px;
  margin: 0;
  flex: 0 0 auto;
}
.ri-label {
  color: rgba(255, 255, 255, 0.6);
  font-size: 10px;
  letter-spacing: 1.5px;
}
.ri-bar {
  height: 8px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(31, 199, 212, 0.2);
}
#ri-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #ed4b9e, #44ff88);
  transition: width 0.15s;
}
.ri-num {
  font-size: 11px;
  text-align: right;
  color: #fff;
}
.ri-stats {
  display: none; /* fede 2026-05-28 — "información innecesaria" */
}
.ri-stat {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 1px;
}
.ri-stat span:first-child {
  color: rgba(255, 255, 255, 0.5);
}
.ri-status {
  display: none; /* fede 2026-05-28 — decluttered out of the selection panel */
}
.ri-queue {
  flex: 1 1 100%; /* production queue wraps full-width below the HP row */
  border-top: 1px solid rgba(31, 199, 212, 0.25);
  padding-top: 8px;
  margin-top: 4px;
}
.ri-queue.hidden {
  display: none;
}
.ri-queue-title {
  color: #ffd24a;
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 700;
  margin-bottom: 4px;
}
#ri-queue-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
  max-height: 100px;
  overflow-y: auto;
}
.ri-q-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 11px;
}
.ri-q-item .q-progress {
  flex: 1;
  height: 4px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 2px;
  margin: 0 8px;
  overflow: hidden;
}
.ri-q-item .q-progress-fill {
  height: 100%;
  background: #1fc7d4;
  transition: width 0.05s;
}
.ri-q-cancel {
  background: rgba(255, 68, 68, 0.2);
  border: 1px solid rgba(255, 68, 68, 0.5);
  color: #ff8888;
  width: 20px;
  height: 20px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  padding: 0;
}
.ri-queue-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.ri-queue-actions button {
  flex: 1;
  background: rgba(31, 199, 212, 0.12);
  border: 1px solid rgba(31, 199, 212, 0.4);
  color: #fff;
  font-size: 10px;
  letter-spacing: 1.2px;
  padding: 6px;
  cursor: pointer;
  font-weight: 700;
  border-radius: 3px;
}
.ri-queue-actions button:hover {
  background: rgba(31, 199, 212, 0.25);
}

#placement-reason {
  position: fixed;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(80, 14, 14, 0.88);
  border: 1px solid rgba(255, 80, 80, 0.65);
  color: #ffdcdc;
  padding: 6px 16px;
  border-radius: 4px;
  font-size: 12px;
  letter-spacing: 1.2px;
  z-index: 7;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
#placement-reason.hidden {
  display: none;
}

#main-menu,
#mp-connect {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(
      ellipse at 30% 40%,
      rgba(31, 199, 212, 0.12),
      transparent 55%
    ),
    radial-gradient(
      ellipse at 70% 60%,
      rgba(155, 74, 255, 0.08),
      transparent 60%
    ),
    radial-gradient(
      ellipse at center,
      rgba(8, 14, 28, 0.96),
      rgba(2, 3, 10, 0.99)
    );
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ui-font-body);
  overflow: hidden;
}
#main-menu::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0,
    transparent 2px,
    rgba(31, 199, 212, 0.025) 3px,
    transparent 4px
  );
  pointer-events: none;
  animation: menuScanlines 14s linear infinite;
  opacity: 0.5;
}
#main-menu::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 40%,
    rgba(0, 0, 0, 0.6)
  );
  pointer-events: none;
}
@keyframes menuScanlines {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 0 100vh;
  }
}
#main-menu.hidden,
#mp-connect.hidden {
  display: none;
}
.mm-card {
  position: relative;
  z-index: 2;
  background: linear-gradient(
    160deg,
    rgba(14, 26, 44, 0.92),
    rgba(4, 10, 22, 0.92)
  );
  border: 1px solid var(--ui-panel-border);
  border-radius: 2px;
  padding: 44px 58px 38px;
  text-align: center;
  min-width: 380px;
  box-shadow:
    0 18px 80px rgba(0, 0, 0, 0.7),
    0 0 40px var(--ui-accent-glow),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  overflow: hidden;
}
.mm-card::before,
.mm-card::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 1px solid var(--ui-accent-rim);
  pointer-events: none;
}
.mm-card::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}
.mm-card::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
}
.mm-title {
  color: var(--ui-accent);
  font-family: var(--ui-font-display);
  font-size: 36px;
  letter-spacing: 9px;
  font-weight: 900;
  margin-bottom: 6px;
  text-shadow:
    0 0 14px var(--ui-accent-glow),
    0 0 32px var(--ui-accent-glow);
  animation: titlePulse 4s ease-in-out infinite;
}
@keyframes titlePulse {
  0%,
  100% {
    text-shadow:
      0 0 14px var(--ui-accent-glow),
      0 0 32px var(--ui-accent-glow);
  }
  50% {
    text-shadow:
      0 0 22px var(--ui-accent-rim),
      0 0 50px var(--ui-accent-glow);
  }
}
.mm-subtitle {
  color: var(--ui-text-muted);
  font-family: var(--ui-font-display);
  font-size: 10px;
  letter-spacing: 5px;
  margin-bottom: 36px;
  font-weight: 500;
}
.mm-btn {
  display: block;
  width: 100%;
  margin: 10px 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.02),
    var(--ui-accent-glow),
    rgba(255, 255, 255, 0.02)
  );
  border: 1px solid var(--ui-accent-soft);
  color: var(--ui-text-primary);
  padding: 14px 22px;
  font-size: 12px;
  letter-spacing: 4px;
  font-weight: 700;
  font-family: var(--ui-font-display);
  cursor: pointer;
  border-radius: 0;
  position: relative;
  transition:
    background 0.18s,
    transform 0.1s,
    box-shadow 0.18s,
    letter-spacing 0.18s;
  clip-path: polygon(
    10px 0,
    100% 0,
    100% calc(100% - 10px),
    calc(100% - 10px) 100%,
    0 100%,
    0 10px
  );
}
.mm-btn:hover {
  background: linear-gradient(
    90deg,
    var(--ui-accent-glow),
    var(--ui-accent-soft),
    var(--ui-accent-glow)
  );
  box-shadow: 0 0 24px var(--ui-accent-glow);
  letter-spacing: 5px;
  transform: translateY(-1px);
}
.mm-btn:active {
  transform: translateY(0);
}
.mm-note {
  margin-top: 22px;
  color: rgba(255, 200, 120, 0.85);
  font-size: 11px;
  letter-spacing: 2px;
  min-height: 14px;
}

#alignment-picker {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background:
    radial-gradient(
      ellipse at 25% 50%,
      rgba(31, 199, 212, 0.13),
      transparent 55%
    ),
    radial-gradient(
      ellipse at 75% 50%,
      rgba(180, 60, 200, 0.13),
      transparent 55%
    ),
    #02040c;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  overflow-y: auto;
}
#alignment-picker.hidden {
  display: none;
}
.ap-header {
  text-align: center;
  margin-bottom: 40px;
}
.ap-title {
  color: #fff;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 6px;
}
.ap-subtitle {
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  letter-spacing: 2px;
  margin-top: 10px;
}
.ap-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 480px));
  gap: 36px;
  width: 100%;
  max-width: 1100px;
}
.ap-card {
  position: relative;
  padding: 36px 32px 30px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: linear-gradient(
    160deg,
    rgba(8, 14, 28, 0.95),
    rgba(4, 6, 14, 0.92)
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  overflow: hidden;
}
.ap-card:hover {
  transform: translateY(-6px);
}
.ap-glow {
  position: absolute;
  inset: -30%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
  filter: blur(60px);
}
.ap-light .ap-glow {
  background: radial-gradient(
    circle,
    rgba(31, 199, 212, 0.45),
    transparent 60%
  );
}
.ap-light:hover {
  border-color: #1fc7d4;
  box-shadow: 0 12px 50px rgba(31, 199, 212, 0.35);
}
.ap-dark .ap-glow {
  background: radial-gradient(circle, rgba(237, 75, 158, 0.4), transparent 60%);
}
.ap-dark:hover {
  border-color: #ed4b9e;
  box-shadow: 0 12px 50px rgba(237, 75, 158, 0.35);
}
.ap-card > * {
  position: relative;
  z-index: 1;
}
.ap-card-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 4px;
  margin-bottom: 6px;
}
.ap-light .ap-card-title {
  color: #1fc7d4;
}
.ap-dark .ap-card-title {
  color: #ed4b9e;
}
.ap-card-sub {
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 22px;
}
.ap-card-bullets {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.8;
  text-align: left;
  width: 100%;
}
.ap-card-bullets li::before {
  content: "▸ ";
  opacity: 0.65;
  margin-right: 2px;
}
.ap-light .ap-card-bullets li::before {
  color: #1fc7d4;
}
.ap-dark .ap-card-bullets li::before {
  color: #ed4b9e;
}
.ap-select {
  width: 100%;
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  font-size: 12px;
  letter-spacing: 3px;
  font-weight: 700;
  padding: 12px;
  cursor: pointer;
  border-radius: 3px;
}
.ap-light .ap-select:hover {
  background: #1fc7d4;
  color: #02040c;
  border-color: #1fc7d4;
}
.ap-dark .ap-select:hover {
  background: #ed4b9e;
  color: #02040c;
  border-color: #ed4b9e;
}

#faction-picker {
  position: fixed;
  inset: 0;
  z-index: 20;
  background:
    radial-gradient(
      ellipse at center,
      rgba(20, 22, 42, 0.85),
      rgba(2, 4, 12, 0.96)
    ),
    #02040c;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  overflow-y: auto;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
#faction-picker.hidden {
  display: none;
}
.fp-header {
  text-align: center;
  margin-bottom: 28px;
}
.fp-title {
  color: #1fc7d4;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 5px;
}
.fp-subtitle {
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  letter-spacing: 2px;
  margin-top: 8px;
}
.fp-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  max-width: 1100px;
  width: 100%;
}
.fp-card {
  background: linear-gradient(
    180deg,
    rgba(8, 14, 28, 0.95),
    rgba(4, 6, 16, 0.85)
  );
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease;
  cursor: pointer;
}
.fp-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.4);
}
.fp-card[data-faction="guardians"]:hover {
  box-shadow: 0 8px 26px rgba(31, 199, 212, 0.35);
  border-color: #1fc7d4;
}

.fp-badge {
  font-size: 9px;
  letter-spacing: 2px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 2px;
  align-self: flex-start;
  margin-bottom: 10px;
}
.fp-badge-guardians {
  background: rgba(31, 199, 212, 0.18);
  color: #1fc7d4;
  border: 1px solid rgba(31, 199, 212, 0.5);
}

.fp-name {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
  margin-bottom: 6px;
}
.fp-tagline {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 12px;
  min-height: 24px;
}
.fp-bullets {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.6;
  flex: 1;
}
.fp-bullets li::before {
  content: "▸ ";
  opacity: 0.55;
}

.fp-select {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 700;
  padding: 9px;
  cursor: pointer;
  border-radius: 3px;
}
.fp-card[data-faction="guardians"] .fp-select:hover {
  background: #1fc7d4;
  color: #02040c;
  border-color: #1fc7d4;
}

.fp-back {
  margin-top: 28px;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 8px 18px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 11px;
  letter-spacing: 2px;
}
.fp-back:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

#intro-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  background:
    radial-gradient(
      ellipse at center,
      rgba(8, 12, 24, 0.92),
      rgba(2, 4, 12, 0.98)
    ),
    #02040c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  padding: 40px;
  overflow-y: auto;
}
#intro-screen.hidden {
  display: none;
}
.intro-card {
  max-width: 720px;
  width: 100%;
  background: linear-gradient(
    180deg,
    rgba(10, 16, 32, 0.95),
    rgba(4, 8, 18, 0.92)
  );
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  padding: 36px 44px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.6);
}
.intro-faction {
  font-size: 11px;
  letter-spacing: 3px;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 8px;
}
.intro-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #fff;
  margin-bottom: 24px;
}
.intro-body {
  font-size: 14px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.85);
  white-space: pre-wrap;
  margin-bottom: 30px;
  font-style: italic;
}
.intro-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
.intro-actions button {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 10px 22px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 700;
}
#intro-begin {
  border-color: #1fc7d4;
  color: #1fc7d4;
}
#intro-begin:hover {
  background: #1fc7d4;
  color: #02040c;
}
#intro-back:hover {
  border-color: rgba(255, 255, 255, 0.55);
}

#charge-ring {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 6;
  background: conic-gradient(
    #9be3ff calc(var(--charge, 0) * 360deg),
    rgba(155, 227, 255, 0.08) 0deg
  );
  box-shadow: 0 0 18px rgba(155, 227, 255, 0.35);
}
#charge-ring.hidden {
  display: none;
}
#charge-fill {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: rgba(8, 14, 24, 0.9);
}

#shipbay-panel {
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(20, 30, 55, 0.85),
    rgba(2, 3, 10, 0.95)
  );
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
#shipbay-panel.hidden {
  display: none;
}
.sb-title {
  color: #1fc7d4;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 4px;
  text-shadow: 0 0 14px rgba(31, 199, 212, 0.45);
}
.sb-cards {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
}
.sb-card {
  width: 220px;
  background: rgba(10, 18, 30, 0.92);
  border: 1px solid rgba(31, 199, 212, 0.45);
  border-radius: 6px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
}
.sb-name {
  color: #1fc7d4;
  font-weight: 700;
  letter-spacing: 2.5px;
  font-size: 16px;
  border-bottom: 1px solid rgba(31, 199, 212, 0.25);
  padding-bottom: 6px;
}
.sb-role {
  color: rgba(255, 200, 120, 0.85);
  font-size: 10px;
  letter-spacing: 1.5px;
}
.sb-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 1px;
}
.sb-stat-row span:first-child {
  color: rgba(255, 255, 255, 0.45);
}
.sb-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.sb-actions button {
  flex: 1;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 7px;
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 3px;
}
.sb-actions .sb-pilot:hover {
  background: rgba(31, 199, 212, 0.35);
  border-color: #1fc7d4;
}
.sb-actions .sb-escort:hover {
  background: rgba(199, 166, 74, 0.35);
  border-color: #c7a64a;
}
.sb-card.is-pilot {
  border-color: #1fc7d4;
  box-shadow: 0 0 14px rgba(31, 199, 212, 0.35);
}
.sb-card.is-escort {
  border-color: #c7a64a;
  box-shadow: 0 0 12px rgba(199, 166, 74, 0.3);
}
.sb-role-tag {
  margin-top: 8px;
  font-size: 10px;
  letter-spacing: 2px;
  color: transparent;
  min-height: 12px;
  text-align: center;
  font-weight: 700;
}
.sb-card.is-pilot .sb-role-tag::before {
  content: "★ PILOT";
  color: #1fc7d4;
}
.sb-card.is-escort .sb-role-tag::before {
  content: attr(data-count) "× ESCORT";
  color: #c7a64a;
}
.sb-fleet-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(8, 14, 28, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}
.sb-fleet-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 700;
}
.sb-fleet-summary {
  flex: 1;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 1px;
}
.sb-clear {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.55);
  font-size: 9px;
  letter-spacing: 1.5px;
  padding: 5px 9px;
  cursor: pointer;
  border-radius: 3px;
}
.sb-clear:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
}
.sb-bottom {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}
#sb-launch {
  background: linear-gradient(
    180deg,
    rgba(31, 199, 212, 0.4),
    rgba(31, 199, 212, 0.18)
  );
  border: 1px solid #1fc7d4;
  color: #fff;
  padding: 12px 36px;
  font-size: 13px;
  letter-spacing: 4px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 3px;
  box-shadow: 0 4px 18px rgba(31, 199, 212, 0.3);
}
#sb-launch:hover:not(:disabled) {
  background: rgba(31, 199, 212, 0.6);
}
#sb-launch:disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
}
.sb-hint {
  margin-top: 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 1.5px;
  text-align: center;
}

.ri-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto; /* upgrade button sits to the RIGHT of the HP bar */
  margin: 0;
  padding: 0;
}
.ri-upgrade {
  flex: 1;
  background: rgba(199, 166, 74, 0.18);
  border: 1px solid rgba(199, 166, 74, 0.65);
  color: #ffd24a;
  font-size: 10px;
  letter-spacing: 1.5px;
  padding: 7px 10px;
  cursor: pointer;
  font-weight: 700;
  border-radius: 3px;
}
.ri-upgrade:hover {
  background: rgba(199, 166, 74, 0.32);
}
.ri-upgrade:disabled {
  opacity: 0.4;
  cursor: default;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.4);
}
.ri-upgrade-cost {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 1px;
  white-space: nowrap;
}

#galaxy-rts-panel {
  position: fixed;
  top: 80px;
  right: 18px;
  width: 290px;
  background: var(--ui-panel-bg);
  border: 1px solid var(--ui-panel-border);
  border-radius: 3px;
  padding: 16px 20px;
  z-index: 7;
  color: var(--ui-text-primary);
  font-family: var(--ui-font-body);
  backdrop-filter: blur(12px) saturate(140%);
  box-shadow: 0 6px 30px var(--ui-accent-glow);
}
#galaxy-rts-panel::before,
#galaxy-rts-panel::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid var(--ui-accent-rim);
  pointer-events: none;
}
#galaxy-rts-panel::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}
#galaxy-rts-panel::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
}
#galaxy-rts-panel.hidden {
  display: none;
}
.gp-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid rgba(31, 199, 212, 0.3);
  padding-bottom: 8px;
  margin-bottom: 8px;
}
#gp-name {
  color: #1fc7d4;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2.5px;
}
#gp-region {
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
  letter-spacing: 1.5px;
}
.gp-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gp-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 1px;
}
.gp-row span:first-child {
  color: rgba(255, 255, 255, 0.45);
}
.gp-row span:last-child {
  color: #fff;
}
.gp-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}
.gp-actions button {
  flex: 1;
  background: rgba(31, 199, 212, 0.14);
  border: 1px solid rgba(31, 199, 212, 0.55);
  color: #fff;
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 700;
  padding: 7px;
  cursor: pointer;
  border-radius: 3px;
}
.gp-actions button:hover {
  background: rgba(31, 199, 212, 0.28);
}
.gp-actions button:disabled {
  opacity: 0.4;
  cursor: default;
}
.gp-alert {
  background: rgba(237, 75, 158, 0.18);
  border: 1px solid rgba(237, 75, 158, 0.6);
  color: #ed4b9e;
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 700;
  padding: 6px;
  text-align: center;
  margin-bottom: 8px;
  animation: alertPulse 1s ease-in-out infinite;
}
.gp-alert.hidden {
  display: none;
}
@keyframes alertPulse {
  0%,
  100% {
    opacity: 0.55;
    box-shadow: 0 0 0 rgba(237, 75, 158, 0);
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 14px rgba(237, 75, 158, 0.45);
  }
}
.mini-bar {
  display: inline-block;
  width: 80px;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 6px;
  overflow: hidden;
}
.mini-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #1fc7d4, #9be3e6);
  transition: width 0.2s ease;
}
#fp-hp-fill {
  background: linear-gradient(90deg, #ed4b9e, #ff9bc5);
}
#fp-fuel-fill {
  background: linear-gradient(90deg, #ffd87a, #ffeebe);
}
#fleet-rts-panel {
  position: fixed;
  top: 80px;
  right: 18px;
  width: 290px;
  background: var(--ui-panel-bg);
  border: 1px solid rgba(237, 75, 158, 0.55);
  border-radius: 3px;
  padding: 16px 20px;
  z-index: 7;
  color: var(--ui-text-primary);
  font-family: var(--ui-font-body);
  backdrop-filter: blur(12px) saturate(140%);
  box-shadow: 0 6px 30px rgba(237, 75, 158, 0.22);
}
#fleet-rts-panel::before,
#fleet-rts-panel::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid rgba(237, 75, 158, 0.85);
  pointer-events: none;
}
#fleet-rts-panel::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}
#fleet-rts-panel::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
}
#fleet-rts-panel.hidden {
  display: none;
}
#fleet-rts-panel #fp-name {
  color: #ed4b9e;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2.5px;
}
#fleet-rts-panel #fp-owner {
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
  letter-spacing: 1.5px;
}
#galaxy-hint {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(155, 227, 230, 0.85);
  background: rgba(8, 14, 26, 0.5);
  padding: 4px 10px;
  border: 1px solid rgba(31, 199, 212, 0.25);
  border-radius: 3px;
  pointer-events: none;
  animation: galaxyHint 4s ease-in-out infinite;
}
#galaxy-hint.hidden {
  display: none;
}
#hud-fleet {
  color: #c7a64a;
  letter-spacing: 2px;
  font-weight: 700;
  font-size: 11px;
  margin-top: 4px;
}
#hud-fleet.hidden {
  display: none;
}
#fleet-cmd-hint {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(8, 14, 26, 0.6);
  padding: 6px 14px;
  border: 1px solid rgba(199, 166, 74, 0.4);
  border-radius: 3px;
  pointer-events: none;
}
#fleet-cmd-hint.hidden {
  display: none;
}
.fc-key {
  color: #c7a64a;
  font-weight: 700;
}
#hud-hp {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: center;
  gap: 8px;
}
#hud-hp.hidden {
  display: none;
}
.hud-hp-label {
  color: rgba(255, 255, 255, 0.5);
  font-weight: 700;
}
.hud-hp-bar {
  display: inline-block;
  width: 110px;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}
#hud-hp-fill {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ed4b9e, #ff9bc5);
  transition: width 0.15s ease;
}
#hud-hp.crit #hud-hp-fill {
  background: linear-gradient(90deg, #ff2a18, #ffaa44);
  animation: hpBlink 0.4s ease-in-out infinite;
}
@keyframes hpBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

#hazard-alert {
  position: fixed;
  top: 24%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  min-width: 280px;
  background: rgba(40, 4, 8, 0.78);
  border: 1px solid rgba(255, 42, 24, 0.85);
  border-radius: 4px;
  padding: 12px 18px;
  box-shadow: 0 0 30px rgba(255, 42, 24, 0.35);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  text-align: center;
  pointer-events: none;
  animation: hazardPulse 0.55s ease-in-out infinite;
}
#hazard-alert.hidden {
  display: none;
}
@keyframes hazardPulse {
  0%,
  100% {
    box-shadow: 0 0 30px rgba(255, 42, 24, 0.35);
    border-color: rgba(255, 42, 24, 0.85);
  }
  50% {
    box-shadow: 0 0 50px rgba(255, 90, 24, 0.7);
    border-color: rgba(255, 200, 80, 1);
  }
}
.hz-title {
  font-size: 14px;
  letter-spacing: 3px;
  font-weight: 700;
  color: #ff5a18;
  margin-bottom: 4px;
}
.hz-source {
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(255, 200, 120, 0.85);
  margin-bottom: 10px;
}
.hz-list {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: rgba(255, 230, 210, 0.95);
  line-height: 1.7;
}
.hz-list li::before {
  content: "▸ ";
  color: #ff5a18;
}
.hz-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}
#hz-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffaa44, #ff2a18);
  transition: width 0.18s ease;
}

#death-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 200, 130, 0.4),
    rgba(0, 0, 0, 0.92)
  );
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
#death-overlay.hidden {
  display: none;
}
.death-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  animation: deathFlash 0.55s ease-out forwards;
}
@keyframes deathFlash {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
.death-msg {
  font-size: 38px;
  letter-spacing: 8px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 30px rgba(255, 150, 80, 0.85);
  animation: deathMsg 2.4s ease-out forwards;
}
@keyframes deathMsg {
  0% {
    opacity: 0;
    transform: scale(0.85);
  }
  20% {
    opacity: 1;
    transform: scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@keyframes galaxyHint {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}
