/* ─── Reset & Base ───────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background: #010814;
  color: #e0e8ff;
  overflow: hidden;
  user-select: none;
}

#map-container {
  position: fixed;
  inset: 0;
}

/* ─── Title Bar ──────────────────────────────────────────────────────────── */
#title-bar {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 100;
  pointer-events: none;
}

#title-bar h1 {
  font-family: 'Orbitron', monospace;
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 5px;
  text-transform: uppercase;
  text-shadow: 0 0 40px rgba(80, 160, 255, 0.7), 0 0 80px rgba(80, 160, 255, 0.3);
}

#title-bar p {
  font-size: 10px;
  color: #3a5080;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 5px;
}

/* ─── Info Panel ─────────────────────────────────────────────────────────── */
#info-panel,
#body-info-panel {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 310px;
  background: rgba(1, 8, 22, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(80, 140, 255, 0.18);
  border-radius: 16px;
  padding: 28px;
  z-index: 200;
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 0 60px rgba(0, 80, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#info-panel.hidden,
#body-info-panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(24px);
}

#close-panel,
#close-body-panel {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.07);
  color: #6688bb;
  border: 1px solid rgba(80, 140, 255, 0.15);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: background 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#close-panel:hover,
#close-body-panel:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

#faction-badge,
#body-color-badge {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: box-shadow 0.3s;
}

#planet-name,
#body-name {
  font-family: 'Orbitron', monospace;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
  margin-bottom: 4px;
}

#planet-faction,
#body-type {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.8px;
}

#planet-description,
#body-description {
  font-size: 13px;
  line-height: 1.65;
  color: #7a94bb;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(80, 140, 255, 0.1);
}

.body-nav {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 20px;
}

.nav-btn {
  flex: 1;
  background: rgba(80, 140, 255, 0.08);
  color: #4499ff;
  border: 1px solid rgba(80, 140, 255, 0.2);
  border-radius: 6px;
  padding: 8px;
  font-size: 11px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.nav-btn:hover {
  background: rgba(80, 140, 255, 0.15);
  color: #aaccff;
  border-color: rgba(80, 140, 255, 0.4);
}


.conn-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #3a5577;
  margin-bottom: 10px;
}

.conn-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 0;
  font-size: 13px;
  color: #9ab0cc;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.conn-item:last-child {
  border-bottom: none;
}

.conn-sec {
  margin-left: auto;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #3a5577;
}

.conn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sec-high {
  background: #44ff88;
  box-shadow: 0 0 5px #44ff88;
}

.sec-medium {
  background: #ffaa44;
  box-shadow: 0 0 5px #ffaa44;
}

.sec-low {
  background: #ff5555;
  box-shadow: 0 0 5px #ff5555;
}

.sec-unknown {
  background: #666;
}

/* ─── Legend ─────────────────────────────────────────────────────────────── */
#legend {
  position: fixed;
  left: 24px;
  bottom: 60px;
  background: rgba(1, 8, 22, 0.84);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(80, 140, 255, 0.13);
  border-radius: 12px;
  padding: 16px 20px;
  z-index: 100;
  min-width: 210px;
}

#legend h3 {
  font-family: 'Orbitron', monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: #3a5577;
  margin-bottom: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 12.5px;
  color: #9ab0cc;
  cursor: default;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ─── Controls Hint ──────────────────────────────────────────────────────── */
#controls-hint {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(1, 8, 22, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(80, 140, 255, 0.1);
  border-radius: 100px;
  padding: 8px 20px;
  font-size: 11.5px;
  color: #3a5577;
  letter-spacing: 0.3px;
  z-index: 100;
  white-space: nowrap;
}

#global-back-btn {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(80, 140, 255, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(80, 140, 255, 0.3);
  border-radius: 100px;
  padding: 10px 24px;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  color: #aaccff;
  letter-spacing: 0.5px;
  z-index: 200;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 0 15px rgba(80, 140, 255, 0.1);
}

#global-back-btn:hover {
  background: rgba(80, 140, 255, 0.3);
  color: #fff;
  border-color: rgba(80, 140, 255, 0.5);
  box-shadow: 0 0 20px rgba(80, 140, 255, 0.3);
}

#global-back-btn.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(15px);
}

/* ─── System View UI ─────────────────────────────────────────────────────── */
#system-ui {
  position: fixed;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 280px;
  background: rgba(1, 8, 22, 0.90);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(80, 140, 255, 0.18);
  border-radius: 16px;
  padding: 22px;
  z-index: 200;
  transition: opacity 0.4s ease, transform 0.4s ease;
  box-shadow: 0 0 50px rgba(0, 80, 255, 0.07);
}

#system-ui.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-16px);
}

#system-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(80, 140, 255, 0.1);
  color: #4499ff;
  border: 1px solid rgba(80, 140, 255, 0.25);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  margin-bottom: 18px;
  transition: background 0.2s, color 0.2s;
  width: 100%;
  justify-content: center;
}

#system-back-btn:hover {
  background: rgba(80, 140, 255, 0.2);
  color: #88bbff;
}

.sys-header {
  margin-bottom: 14px;
}

#sys-name {
  font-family: 'Orbitron', monospace;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 4px;
}

#sys-faction {
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.8px;
}

.sys-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 12.5px;
}

.sys-meta-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #3a5070;
}

#sys-desc {
  font-size: 12px;
  color: #5a7a99;
  line-height: 1.65;
  margin: 14px 0;
}

.sys-hint {
  font-size: 10.5px;
  color: #2d4460;
  font-style: italic;
  text-align: center;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* ─── Loading ────────────────────────────────────────────────────────────── */
#loading {
  position: fixed;
  inset: 0;
  background: #010814;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: opacity 0.6s ease;
}

#loading.fade-out {
  opacity: 0;
  pointer-events: none;
}

#loading h2 {
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  letter-spacing: 4px;
  color: #3a5577;
  text-transform: uppercase;
  margin-top: 20px;
  animation: pulse 1.5s ease-in-out infinite;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 2px solid rgba(80, 140, 255, 0.1);
  border-top-color: #4499ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.4;
  }

  50% {
    opacity: 1;
  }
}

/* ─── Path HUD ───────────────────────────────────────────────────────────── */
#path-hud {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 500px;
  max-width: calc(100vw - 80px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#path-hud.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-10px);
}

#path-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(1, 8, 22, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(80, 140, 255, 0.18);
  border-radius: 100px;
  padding: 9px 12px 9px 20px;
}

#path-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  flex: 1;
  flex-wrap: wrap;
}

#path-clear-btn {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  color: #445577;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#path-clear-btn:hover {
  background: rgba(255, 80, 80, 0.2);
  color: #ff6666;
  border-color: rgba(255, 80, 80, 0.3);
}

/* ─── Hop Detail Panel ───────────────────────────────────────────────────── */
#path-detail {
  background: rgba(1, 8, 22, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(80, 140, 255, 0.14);
  border-radius: 14px;
  padding: 14px;
  max-height: 340px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(80, 140, 255, 0.2) transparent;
}

#path-detail.hidden {
  display: none;
}

.hop-card {
  border: 1px solid rgba(80, 140, 255, 0.1);
  border-radius: 10px;
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.025);
  margin-bottom: 10px;
  transition: border-color 0.2s;
}

.hop-card:last-child {
  margin-bottom: 0;
}

.hop-card:hover {
  border-color: rgba(80, 140, 255, 0.25);
}

.hop-number {
  font-family: 'Orbitron', monospace;
  font-size: 9px;
  letter-spacing: 2.5px;
  color: #2d4460;
  text-transform: uppercase;
  margin-bottom: 9px;
}

.hop-route {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.hop-route-arrow {
  color: #2d4460;
  font-size: 10px;
  flex-shrink: 0;
}

.hop-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #3a5070;
  margin-bottom: 9px;
}

.hop-ctrl-dot {
  font-size: 8px;
  line-height: 1;
}

.hop-access {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 6px;
  margin-bottom: 9px;
}

.access-open {
  background: rgba(0, 232, 122, 0.09);
  color: #00e87a;
  border: 1px solid rgba(0, 232, 122, 0.22);
}

.access-pass {
  background: rgba(68, 153, 255, 0.09);
  color: #4499ff;
  border: 1px solid rgba(68, 153, 255, 0.22);
}

.access-bribe {
  background: rgba(255, 170, 68, 0.09);
  color: #ffaa44;
  border: 1px solid rgba(255, 170, 68, 0.22);
}

.access-forbidden {
  background: rgba(255, 65, 65, 0.09);
  color: #ff5050;
  border: 1px solid rgba(255, 65, 65, 0.22);
}

.access-contested {
  background: rgba(220, 200, 55, 0.09);
  color: #ddc844;
  border: 1px solid rgba(220, 200, 55, 0.22);
}

.hop-desc {
  font-size: 11.5px;
  color: #37506a;
  line-height: 1.6;
  font-style: italic;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 9px;
}

/* ─── Path pill labels ───────────────────────────────────────────────────── */
.ph-origin {
  color: #00e87a;
  font-weight: 600;
}

.ph-dest {
  color: #ff5050;
  font-weight: 600;
}

.ph-arrow {
  color: #2d4460;
}

.ph-hint {
  color: #2d4460;
  font-style: italic;
}

.ph-hops {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 100px;
  padding: 2px 10px;
  font-size: 11px;
  color: #aac0dd;
  letter-spacing: 0.5px;
}

.ph-noresult {
  background: rgba(255, 60, 60, 0.12);
  border: 1px solid rgba(255, 60, 60, 0.25);
  border-radius: 100px;
  padding: 2px 10px;
  font-size: 11px;
  color: #ff5555;
}

/* ─── Travel & Ship UI ───────────────────────────────────────────────────── */
.checkbox-row {
  margin-top: 10px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #a0c0ff;
  background: rgba(10, 20, 40, 0.4);
  padding: 6px 10px;
  border-radius: 4px;
}

.hop-cb {
  cursor: pointer;
  accent-color: #00e87a;
  width: 14px;
  height: 14px;
}

#travel-btn {
  background: linear-gradient(135deg, #00e87a, #0088aa);
  color: #fff;
  border: none;
  padding: 14px;
  width: 100%;
  border-radius: 8px;
  font-family: 'Orbitron', monospace;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: all 0.2s ease;
  box-shadow: 0 0 15px rgba(0, 232, 122, 0.3);
  margin-top: 10px;
}

#travel-btn:hover {
  background: linear-gradient(135deg, #22ffa0, #00aacc);
  box-shadow: 0 0 25px rgba(0, 232, 122, 0.6);
  transform: translateY(-2px);
}

#travel-btn.hidden {
  display: none;
}