:root {
  --ink: #f4ecff;
  --muted: rgba(244, 236, 255, 0.78);
  --violet: #c084fc;
  --cyan: #67e8f9;
  --navy: #0b0520;
  --font: "Nunito", system-ui, sans-serif;
  /* Sky pocket for orbits; keep clear of Andreja on the left */
  --hub-x: 68%;
  --hub-y: 42%;
  --orbit-size: min(57vw, 520px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--navy);
  overflow: hidden;
  touch-action: manipulation;
  text-transform: uppercase;
}

a { color: inherit; text-decoration: none; }
button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: #0b0520;
}

.hero-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Bias left/bottom so girl + drawings stay in frame */
  object-position: 12% 68%;
  /* Avoid CSS scale() — it softens the upscaled art */
  transform: none;
}

.scene picture {
  position: absolute;
  inset: 0;
  display: block;
}

#stars,
.fairies,
.mist {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#stars {
  width: 100%;
  height: 100%;
  mix-blend-mode: screen;
  opacity: 0.75;
}

.fairy {
  position: absolute;
  width: 9px;
  height: 9px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, var(--violet) 40%, transparent 72%);
  box-shadow: 0 0 12px 4px rgba(192, 132, 252, 0.7);
  will-change: transform, opacity;
}

.mist {
  background:
    linear-gradient(90deg, transparent 0%, transparent 42%, rgba(11, 5, 32, 0.18) 70%, rgba(11, 5, 32, 0.28) 100%),
    linear-gradient(180deg, rgba(11, 5, 32, 0.22) 0%, transparent 16%, transparent 72%, rgba(11, 5, 32, 0.55) 100%);
}

.stage,
.toast {
  position: relative;
  z-index: 3;
}

.stage {
  min-height: 100svh;
}

.orbit-anchor {
  position: fixed;
  left: var(--hub-x);
  top: var(--hub-y);
  width: 0;
  height: 0;
  z-index: 4;
  pointer-events: none;
}

.orbit-field {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--orbit-size);
  height: var(--orbit-size);
  transform: translate(-50%, -50%);
  pointer-events: none;
  /* Softly contain labels that stick past the rings */
  overflow: visible;
}

.orbit-rings {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  filter: drop-shadow(0 0 5px rgba(192, 132, 252, 0.55));
}

.orbit-rings ellipse {
  fill: none;
  stroke: rgba(216, 180, 254, 0.7);
  stroke-width: 0.5;
  stroke-dasharray: 1.1 1.5;
}

.hub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 38%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: auto;
  z-index: 20;
  display: grid;
  place-items: center;
  text-align: center;
}

.hub-planet {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #86efac, #22c55e 34%, #14532d 68%, #022c16 100%);
  box-shadow:
    0 0 0 2px rgba(167, 243, 208, 0.35),
    0 0 28px rgba(74, 222, 128, 0.45),
    0 0 60px rgba(124, 58, 237, 0.28),
    inset 0 -10px 18px rgba(0, 0, 0, 0.4);
  animation: hub-pulse 4s ease-in-out infinite;
}

.hub-planet::before {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: rgba(2, 24, 12, 0.55);
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.35);
}

.hub-planet::after {
  content: "";
  position: absolute;
  inset: 28% -18%;
  border: 2px solid rgba(216, 180, 254, 0.65);
  border-radius: 50%;
  transform: rotateX(66deg) rotateZ(12deg);
  box-shadow: 0 0 12px rgba(192, 132, 252, 0.35);
}

.hub-text {
  position: relative;
  z-index: 2;
  font-weight: 800;
  font-size: clamp(0.85rem, 2.3vw, 1.15rem);
  line-height: 1.12;
  letter-spacing: 0.01em;
  color: #f7fee7;
  text-shadow:
    0 0 3px rgba(0, 0, 0, 1),
    0 1px 2px rgba(0, 0, 0, 1),
    0 2px 8px rgba(0, 0, 0, 0.9),
    0 0 14px rgba(0, 0, 0, 0.65);
}

@keyframes hub-pulse {
  0%, 100% { filter: brightness(1); transform: scale(1); }
  50% { filter: brightness(1.08); transform: scale(1.03); }
}

.hub:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

.worlds-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.world {
  position: absolute;
  left: 0;
  top: 0;
  width: 58px;
  height: 58px;
  margin: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  pointer-events: auto;
  z-index: 10;
  /* JS sets translate3d */
  will-change: transform;
}

.world-ball {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.65);
  box-shadow:
    inset -3px -3px 8px rgba(0, 0, 0, 0.35),
    0 0 14px rgba(255, 255, 255, 0.28);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
}

.w1 { background: radial-gradient(circle at 30% 28%, #fff7ed, #fb923c 48%, #9a3412); }
.w2 { background: radial-gradient(circle at 30% 28%, #ecfeff, #22d3ee 48%, #0e7490); }
.w3 { background: radial-gradient(circle at 30% 28%, #f5f3ff, #a78bfa 48%, #5b21b6); }
.w4 { background: radial-gradient(circle at 30% 28%, #fdf2f8, #f472b6 48%, #9d174d); }
.w5 { background: radial-gradient(circle at 30% 28%, #f0fdf4, #4ade80 48%, #166534); }
.wmore { background: radial-gradient(circle at 30% 28%, #f8fafc, #94a3b8 55%, #334155); color: #0f172a; }

.world-name {
  font-size: 0.6rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(12, 6, 36, 0.82);
  border: 1px solid rgba(216, 180, 254, 0.4);
  white-space: nowrap;
  line-height: 1.2;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 40;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(20, 8, 48, 0.94);
  border: 1px solid rgba(192, 132, 252, 0.5);
  font-weight: 800;
  max-width: calc(100vw - 24px);
  text-align: center;
  pointer-events: none;
}

@media (max-width: 820px) {
  :root {
    /* Phone: a bit left + lower, still clear of Andreja */
    --hub-x: 66%;
    --hub-y: 42%;
    --orbit-size: min(75vw, 340px);
  }

  .world {
    width: 58px;
    height: 58px;
  }

  .world-ball {
    width: 28px;
    height: 28px;
  }

  .world-name {
    font-size: 0.58rem;
    padding: 1px 5px;
  }

  .hub {
    width: 42%;
  }

  .hub-text {
    font-size: clamp(0.8rem, 3.8vw, 1rem);
  }

  .hero-art {
    object-position: 8% 72%;
  }
}

@media (max-width: 420px) {
  :root {
    --hub-x: 64%;
    --hub-y: 44%;
    --orbit-size: min(72vw, 300px);
  }

  .hub {
    width: 46%;
  }

  .hub-text {
    font-size: clamp(0.78rem, 4vw, 0.95rem);
  }

  .hero-art {
    object-position: 2% 78%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fairy { display: none; }
}
