:root {
  /* Fixed Space Theme Colors (Sky remains black) */
  --sky-bg: #0b0e14;
  --sky-text: #e0e0e0;
  --sky-text-dim: #888;
  --sky-accent: #4a90e2;

  /* Theme-Aware Warp Ring Colors (Defaults to Dark) */
  --warp-bg: linear-gradient(
    180deg,
    rgba(20, 25, 35, 0.8) 0%,
    rgba(10, 15, 25, 0.9) 100%
  );
  --warp-text: #e0e0e0;
  --warp-text-dim: #888;
  --warp-border: #444;
  --warp-accent: #4a90e2;
  --map-bg: #0b0e14;
  --map-grid: rgba(255, 255, 255, 0.05);
  --coord-bg: rgba(255, 255, 255, 0.05);
}

@media (prefers-color-scheme: light) {
  :root {
    /* Only Warp Ring section changes in light theme */
    --warp-bg: linear-gradient(
      180deg,
      rgba(230, 235, 245, 0.8) 0%,
      rgba(220, 225, 235, 0.9) 100%
    );
    --warp-text: #1a1a1a;
    --warp-text-dim: #666;
    --warp-border: #ccc;
    --warp-accent: #2a6dbd;
    --map-bg: #ffffff;
    --map-grid: rgba(0, 0, 0, 0.05);
    --coord-bg: rgba(0, 0, 0, 0.05);
  }
}

body {
  background: var(--sky-bg);
  color: var(--sky-text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  margin: 0;
  padding: 4rem 0;
  box-sizing: border-box;
  position: relative;
  transition:
    background 0.3s,
    color 0.3s;
}

h1,
p {
  padding-left: 2rem;
  padding-right: 2rem;
  max-width: 800px;
  text-align: center;
}

/* Starfield effect - always visible */
body::before,
body::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  background: transparent;
  z-index: -1;
  opacity: 1; /* Always 100% opacity for stars */
}

body::before {
  box-shadow:
    10vw 20vh #fff,
    35vw 45vh #fff,
    80vw 10vh #fff,
    15vw 85vh #fff,
    55vw 15vh #fff,
    90vw 60vh #fff,
    25vw 30vh #fff,
    70vw 75vh #fff,
    45vw 90vh #fff,
    5vw 50vh #fff,
    65vw 5vh #fff,
    85vw 25vh #fff,
    12vw 12vh rgba(255, 255, 255, 0.5),
    42vw 82vh rgba(255, 255, 255, 0.5),
    72vw 32vh rgba(255, 255, 255, 0.5),
    92vw 92vh rgba(255, 255, 255, 0.5);
}

body::after {
  width: 2px;
  height: 2px;
  box-shadow:
    20vw 10vh #fff,
    40vw 60vh #fff,
    60vw 20vh #fff,
    80vw 80vh #fff,
    10vw 90vh #fff,
    30vw 40vh #fff,
    50vw 70vh #fff,
    70vw 10vh #fff,
    95vw 45vh #fff;
  opacity: 0.5;
}

.planet-container {
  position: relative;
  margin-bottom: 3rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.planet {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle at 30% 30%, var(--sky-accent), #1b2735);
  border-radius: 50%;
  box-shadow:
    inset -20px -20px 50px rgba(0, 0, 0, 0.5),
    inset 10px 10px 20px rgba(255, 255, 255, 0.1),
    0 0 60px var(--sky-accent);
  position: relative;
  overflow: hidden;
  z-index: 2;
}

/* Surface craters/texture */
.planet::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(circle at 70% 20%, rgba(0, 0, 0, 0.15) 5%, transparent 6%),
    radial-gradient(circle at 40% 60%, rgba(0, 0, 0, 0.15) 8%, transparent 9%),
    radial-gradient(circle at 80% 70%, rgba(0, 0, 0, 0.1) 3%, transparent 4%),
    radial-gradient(
      circle at 20% 40%,
      rgba(255, 255, 255, 0.05) 10%,
      transparent 11%
    );
}

.ring {
  position: absolute;
  width: 340px;
  height: 80px;
  border: 12px solid rgba(255, 255, 255, 0.08);
  border-top-color: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  transform: rotate(-20deg);
  z-index: 3;
  pointer-events: none;
}

/* Back half of the ring */
.ring-back {
  position: absolute;
  width: 340px;
  height: 80px;
  border: 12px solid rgba(255, 255, 255, 0.08);
  border-bottom-color: transparent;
  border-top-color: rgba(255, 255, 255, 0.04);
  border-radius: 50%;
  transform: rotate(-20deg);
  z-index: 1;
  pointer-events: none;
}

.atmosphere {
  position: absolute;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(74, 144, 226, 0.1) 0%,
    transparent 70%
  );
  box-shadow: 0 0 40px rgba(74, 144, 226, 0.1);
  z-index: 0;
}

h1 {
  font-size: 2.5rem;
  margin: 0.5rem 0;
  text-transform: uppercase;
  letter-spacing: 4px;
  color: var(--sky-text);
}

p {
  color: var(--sky-text-dim);
  font-style: italic;
}

.warp-ring {
  margin-top: 3rem;
  padding: 4rem 2rem;
  background: var(--warp-bg);
  border-top: 1px dashed var(--warp-border);
  border-bottom: 1px dashed var(--warp-border);
  color: var(--warp-text);
  text-align: center;
  width: 100%;
  box-sizing: border-box;
  transition:
    background 0.3s,
    border 0.3s,
    color 0.3s;
}

.warp-ring-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
  margin-top: 3rem;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 800px) {
  .warp-ring-content {
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: flex-start;
    text-align: left;
  }

  .star-map-wrapper {
    flex: 0 0 auto;
    width: 60%;
  }

  .warp-links {
    flex: 1;
    margin-top: 0;
    padding-top: 1rem;
  }
}

.star-map-container {
  margin: 0 auto 2rem;
  position: relative;
  width: 60vw;
  height: 60vw;
  min-width: 20em;
  min-height: 20em;
  max-width: 600px;
  max-height: 600px;
  background: var(--map-bg);
  border: 1px solid var(--warp-border);
  border-radius: 4px;
  overflow: hidden;
  transition:
    background 0.3s,
    border 0.3s;
}

@media (min-width: 800px) {
  .star-map-container {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }
}

.warp-ring h2 {
  font-size: 0.9rem;
  color: var(--warp-text-dim);
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.warp-ring a {
  color: var(--warp-accent);
  text-decoration: none;
  font-weight: bold;
  transition:
    color 0.3s,
    text-shadow 0.3s,
    transform 0.3s;
}

.warp-links {
  flex: 1;
  margin: 0;
  padding: 0 0 0 2rem; /* Give space for numbers */
  list-style-position: outside;
}

.warp-links li {
  display: list-item; /* Restore list item behavior */
  margin-bottom: 0.5rem;
  width: 100%;
}

.neighbor-entry-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.warp-links li a {
  color: var(--warp-accent);
  text-decoration: none;
  font-weight: bold;
  transition:
    color 0.3s,
    text-shadow 0.3s,
    transform 0.3s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  text-align: left;
}

.warp-links li a:hover,
.warp-links li a.active {
  color: #fff;
  text-shadow: 0 0 10px var(--warp-accent);
}

.warp-links li a.active {
  transform: scale(1.05);
}

@media (prefers-color-scheme: light) {
  .warp-links li a:hover,
  .warp-links li a.active {
    color: var(--warp-accent);
    text-shadow: none;
    text-decoration: underline;
  }
}

.coord {
  font-family: "Courier New", Courier, monospace;
  background: var(--coord-bg);
  color: var(--warp-text);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  flex: 0 0 auto;
  white-space: nowrap;
}

.warp-ring a:hover,
.warp-ring a.active {
  color: #fff;
  text-shadow: 0 0 10px var(--warp-accent);
}

.warp-ring a.active {
  transform: scale(1.05);
}

@media (prefers-color-scheme: light) {
  .warp-ring a:hover,
  .warp-ring a.active {
    color: var(--warp-accent);
    text-shadow: none;
    text-decoration: underline;
  }
}

/* Course Lines */
.course-line {
  fill: none;
  stroke: var(--sky-accent);
  stroke-width: 2;
  stroke-dasharray: 10, 10;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.course-line.active {
  opacity: 0.6;
  stroke-dashoffset: 100;
  animation: dash 3s linear infinite;
}

@keyframes dash {
  to {
    stroke-dashoffset: 0;
  }
}

/* Neighbor Circle State */
.neighbor-circle {
  fill: var(--sky-accent);
  opacity: 0.6;
  transition: all 0.3s ease;
}

.neighbor-circle.active {
  fill: #fff;
  r: 8;
  opacity: 1;
  filter: drop-shadow(0 0 10px var(--sky-accent));
}

/* Crosshair Styles */
.crosshair-line {
  stroke: #2ecc71;
  stroke-width: 4;
}

.crosshair-circle {
  fill: none;
  stroke: #2ecc71;
  stroke-width: 2;
}

.crosshair-pulse {
  fill: #2ecc71;
  opacity: 0.4;
}

.crosshair-pulse {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    r: 10;
    opacity: 0.4;
  }
  100% {
    r: 40;
    opacity: 0;
  }
}

/* Coordinate Display Class */
.coord-display {
  font-family: "Courier New", Courier, monospace;
  background: var(--coord-bg);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Map Grid Lines */
.map-grid-line {
  stroke: var(--map-grid);
  stroke-width: 2;
}

/* Map Labels */
.map-label {
  position: absolute;
  bottom: 5px;
  right: 8px;
  font-size: 0.6rem;
  color: #444;
  pointer-events: none;
}

/* Map Legend styles */
.map-legend {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-bottom: 2rem;
  font-size: 0.75rem;
  color: #888;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-marker {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-marker.station {
  border: 1px solid #2ecc71;
  position: relative;
}

.legend-marker.station::before,
.legend-marker.station::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  background: #2ecc71;
  transform: translate(-50%, -50%);
}

.legend-marker.station::before {
  width: 14px;
  height: 1px;
}

.legend-marker.station::after {
  width: 1px;
  height: 14px;
}

.legend-marker.neighbor {
  background: #4a90e2;
  opacity: 0.6;
}

/* Footer styles */
footer {
  margin-top: 4rem;
  padding: 2rem;
  font-size: 0.9rem;
  color: #555;
  text-align: center;
}

footer a {
  color: #4a90e2;
  text-decoration: none;
}
