:root {
  --bg-top: #08162f;
  --bg-bottom: #1b3f74;
  --panel: rgba(9, 21, 44, 0.74);
  --panel-strong: rgba(14, 31, 60, 0.88);
  --line: rgba(194, 224, 255, 0.28);
  --text: #eef7ff;
  --muted: #b4cae7;
  --accent: #ffd76c;
  --accent-strong: #ff9b4a;
  --shadow: rgba(2, 8, 20, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Marker Felt", "Comic Sans MS", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(162, 208, 255, 0.22), transparent 26%),
    radial-gradient(circle at 82% 10%, rgba(255, 227, 135, 0.16), transparent 18%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

.constellation-app {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.hero,
.status-bar,
.side-panel,
.game-shell {
  background: var(--panel);
  border: 2px solid rgba(196, 225, 255, 0.18);
  border-radius: 28px;
  box-shadow: 0 18px 34px var(--shadow);
  backdrop-filter: blur(10px);
}

.hero {
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow,
.small-label,
.status-pill span {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

h1 {
  margin: 4px 0 8px;
  font-size: clamp(2.2rem, 4vw, 3.7rem);
  line-height: 0.94;
}

.intro {
  max-width: 58ch;
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.38;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.secondary-link,
.start-button,
.game-popover-button {
  border: 0;
  border-radius: 999px;
  text-decoration: none;
  font: inherit;
}

.secondary-link {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.start-button,
.game-popover-button {
  color: #0f1f3d;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  box-shadow: 0 14px 24px rgba(255, 177, 77, 0.22);
  cursor: pointer;
}

.start-button {
  padding: 14px 22px;
  font-size: 1.45rem;
}

.game-popover-button {
  margin-top: 14px;
  min-width: 180px;
  padding: 14px 20px;
  font-size: 1.15rem;
}

.status-bar {
  margin-top: 14px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.status-pill {
  padding: 12px 14px;
  border-radius: 20px;
  background: var(--panel-strong);
}

.status-pill strong {
  display: block;
  margin-top: 4px;
  font-size: 1.45rem;
}

.main-layout {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) 360px;
  gap: 14px;
  align-items: start;
}

.game-shell {
  padding: 16px;
}

.playfield {
  position: relative;
  overflow: hidden;
  min-height: 68vh;
  border-radius: 26px;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.9), transparent 5%),
    radial-gradient(circle at 76% 18%, rgba(255, 255, 255, 0.72), transparent 4%),
    radial-gradient(circle at 63% 42%, rgba(255, 255, 255, 0.56), transparent 3%),
    linear-gradient(180deg, rgba(8, 22, 47, 0.86), rgba(17, 41, 79, 0.92));
}

.sky-grid,
.constellation-lines,
.constellation-spots,
.celebration-layer,
.game-popover {
  position: absolute;
  inset: 0;
}

.sky-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.62;
}

.sky-glow-one {
  inset: 8% auto auto 8%;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(130, 196, 255, 0.2), transparent 70%);
}

.sky-glow-two {
  inset: auto 10% 14% auto;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(255, 213, 112, 0.12), transparent 72%);
}

.sky-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: calc(100% / 8) calc(100% / 6);
  opacity: 0.3;
}

.constellation-spot,
.target-halo,
.astronaut,
.celebration-item {
  position: absolute;
  transform: translate(-50%, -50%);
}

.constellation-line {
  position: absolute;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(146, 204, 255, 0.28), rgba(255, 223, 139, 0.38));
  box-shadow: 0 0 18px rgba(151, 208, 255, 0.14);
  transform-origin: left center;
  pointer-events: none;
}

.constellation-spot {
  width: 30px;
  height: 30px;
  background: rgba(184, 212, 255, 0.18);
  border: 2px dashed rgba(221, 238, 255, 0.42);
  clip-path: polygon(50% 0%, 62% 35%, 100% 35%, 70% 58%, 82% 100%, 50% 74%, 18% 100%, 30% 58%, 0% 35%, 38% 35%);
}

.constellation-spot::after {
  content: "";
  position: absolute;
  inset: 5px;
  background: rgba(255, 255, 255, 0.14);
  clip-path: inherit;
}

.constellation-spot.completed {
  background: radial-gradient(circle at 35% 35%, #fffbe7, #ffd965 62%, #ffb242 100%);
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.86);
  box-shadow: 0 0 18px rgba(255, 218, 115, 0.44);
}

.constellation-spot.active {
  border-style: solid;
  border-color: rgba(255, 244, 197, 0.94);
  box-shadow: 0 0 0 12px rgba(255, 220, 120, 0.12);
}

.target-halo {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 4px solid rgba(255, 237, 186, 0.92);
  box-shadow: 0 0 0 14px rgba(255, 218, 106, 0.12);
  animation: pulse 1.7s ease-in-out infinite;
}

.astronaut {
  width: 104px;
  height: 104px;
  transition: left 110ms linear, top 110ms linear, transform 160ms ease;
  z-index: 4;
}

.astronaut img:first-child {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.22));
}

.astronaut-star {
  position: absolute;
  right: -6px;
  top: 4px;
  width: 34px;
  height: 34px;
  object-fit: contain;
  animation: bob 1.8s ease-in-out infinite;
}

.astronaut.no-star .astronaut-star {
  opacity: 0;
  transform: scale(0.2);
  pointer-events: none;
}

.celebration-layer {
  pointer-events: none;
  z-index: 5;
}

.celebration-item {
  width: 56px;
  height: 56px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.celebration-item.starburst {
  animation: starburst 1.2s ease-out forwards;
}

.celebration-item.rocket {
  width: 110px;
  height: 110px;
  animation: rocket-launch 2s ease-out forwards;
}

.game-popover {
  z-index: 7;
  display: grid;
  place-items: center;
  padding: 22px;
  background: linear-gradient(180deg, rgba(4, 14, 32, 0.4), rgba(6, 17, 37, 0.62));
  backdrop-filter: blur(4px);
}

.game-popover-card {
  width: min(100%, 440px);
  padding: 22px 22px 20px;
  border-radius: 28px;
  background: rgba(12, 28, 53, 0.96);
  border: 2px solid rgba(194, 224, 255, 0.16);
  box-shadow: 0 24px 40px rgba(4, 10, 22, 0.32);
  text-align: center;
}

.game-popover-eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

.game-popover-card h2 {
  margin: 0 0 14px;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  line-height: 0.95;
}

.game-popover-text {
  margin: 0 0 8px;
  font-size: 1.04rem;
  line-height: 1.32;
}

.hidden {
  display: none;
}

.side-panel {
  padding: 14px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.message,
.mission-panel,
.reward-panel,
.helper-panel {
  border-radius: 22px;
  background: var(--panel-strong);
  padding: 14px;
}

.message {
  min-height: 92px;
  display: flex;
  align-items: center;
  font-size: 1.06rem;
  line-height: 1.3;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mission-index {
  font-size: 1.35rem;
}

.mission-story {
  margin: 12px 0;
  color: var(--muted);
  line-height: 1.36;
}

.mission-meter {
  height: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.mission-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8ec9ff, #ffd56b);
  transition: width 180ms ease;
}

.mission-step {
  display: block;
  margin-top: 10px;
}

.rocket-shelf {
  margin-top: 12px;
  min-height: 120px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.rocket-mini {
  min-height: 88px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(8, 18, 39, 0.54);
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 2px rgba(194, 224, 255, 0.08);
}

.rocket-mini img {
  width: 58px;
  height: 58px;
}

.helper-panel p {
  margin: 8px 0 0;
  color: var(--muted);
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 10px rgba(255, 218, 106, 0.08);
  }

  50% {
    box-shadow: 0 0 0 22px rgba(255, 218, 106, 0.16);
  }
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

@keyframes starburst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4);
  }

  20% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) translateY(-70px) scale(1.2);
  }
}

@keyframes rocket-launch {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) translateY(30px) scale(0.6);
  }

  20% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) translateY(-220px) scale(1.15);
  }
}

@media (max-width: 980px) {
  .main-layout {
    grid-template-columns: 1fr;
  }

  .status-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .playfield {
    min-height: 56vh;
  }
}

@media (max-width: 640px) {
  .constellation-app {
    width: min(100% - 14px, 1180px);
    padding-top: 10px;
  }

  .hero {
    padding: 16px;
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions,
  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .status-bar {
    grid-template-columns: 1fr 1fr;
  }

  .astronaut {
    width: 88px;
    height: 88px;
  }

  .target-halo {
    width: 78px;
    height: 78px;
  }

  .rocket-shelf {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
