:root {
  --playground-header-height: 64px;
  --night-0: #050816;
  --night-1: #081124;
  --night-2: #101b3a;
  --night-3: #182654;
  --violet: #8b7dff;
  --cyan: #69d7ff;
  --text: #f5f7ff;
  --muted: rgba(235, 241, 255, .68);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, "Noto Sans TC", sans-serif;
  background: var(--night-0);
  color: var(--text);
}

body {
  overflow: hidden;
}

#shared-playground-header {
  position: relative;
  z-index: 2000;
}

.playground-nav {
  min-height: 58px;
  background: rgba(5, 8, 22, .82) !important;
  border-bottom: 1px solid rgba(255,255,255,.08) !important;
  backdrop-filter: blur(18px);
}

.playground-nav .navbar-brand,
.playground-nav .nav-link {
  color: rgba(255,255,255,.78) !important;
}

.playground-nav .navbar-brand {
  color: #fff !important;
}

.playground-nav .nav-link:hover,
.playground-nav .nav-link:focus {
  color: #fff !important;
}

.playground-fallback {
  background: rgba(5, 8, 22, .9);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.playground-fallback a {
  color: #fff;
  text-decoration: none;
}

.sky-app {
  position: relative;
  height: calc(100dvh - var(--playground-header-height, 64px));
  min-height: 520px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 110%, rgba(105,215,255,.18), transparent 34%),
    radial-gradient(circle at 15% 20%, rgba(139,125,255,.13), transparent 34%),
    linear-gradient(180deg, var(--night-2) 0%, var(--night-1) 42%, var(--night-0) 100%);
  cursor: crosshair;
}

.sky-app::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,.025), transparent 30%),
    radial-gradient(circle at center, transparent 48%, rgba(1,3,12,.32) 100%);
}

.aurora {
  position: absolute;
  z-index: 2;
  width: 56vw;
  height: 34vh;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .16;
  pointer-events: none;
  animation: auroraFloat 16s ease-in-out infinite alternate;
}

.aurora-one {
  left: -10vw;
  top: 8vh;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
}

.aurora-two {
  right: -18vw;
  bottom: 4vh;
  background: linear-gradient(90deg, #577dff, #9d63ff);
  animation-delay: -6s;
}

@keyframes auroraFloat {
  from { transform: translate3d(-2vw, -1vh, 0) scale(.95); }
  to { transform: translate3d(5vw, 3vh, 0) scale(1.08); }
}

.starry-sky,
.shooting-layer,
.constellation-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.starry-sky {
  z-index: 5;
}

.shooting-layer {
  z-index: 8;
}

.constellation-layer {
  z-index: 7;
}

.star {
  position: absolute;
  width: var(--star-size, 2px);
  height: var(--star-size, 2px);
  border-radius: 50%;
  background: rgba(255,255,255,var(--star-alpha,.9));
  box-shadow: 0 0 var(--star-glow, 5px) rgba(220,235,255,.72);
  animation: twinkle var(--twinkle-duration, 4s) ease-in-out infinite;
  animation-delay: var(--twinkle-delay, 0s);
  transform-origin: center;
}

.star.bright {
  background: #fff;
  box-shadow:
    0 0 5px rgba(255,255,255,.95),
    0 0 14px rgba(105,215,255,.65);
}

.star.moving {
  animation:
    twinkle var(--twinkle-duration, 4s) ease-in-out infinite,
    drift 12s ease-in-out infinite alternate;
}

.star.orbit {
  animation:
    twinkle var(--twinkle-duration, 4s) ease-in-out infinite,
    orbit 15s linear infinite;
}

.star.spiral {
  animation:
    twinkle var(--twinkle-duration, 4s) ease-in-out infinite,
    spiral 11s linear infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: .35; }
  50% { opacity: 1; }
}

@keyframes drift {
  from { transform: translate3d(-24px, 8px, 0); }
  to { transform: translate3d(34px, -18px, 0); }
}

@keyframes orbit {
  from { transform: rotate(0deg) translateX(26px) rotate(0deg); }
  to { transform: rotate(360deg) translateX(26px) rotate(-360deg); }
}

@keyframes spiral {
  0% { transform: rotate(0deg) translateX(12px) scale(.8); }
  50% { transform: rotate(180deg) translateX(38px) scale(1.4); }
  100% { transform: rotate(360deg) translateX(12px) scale(.8); }
}

.shooting-star {
  position: absolute;
  width: 150px;
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.95));
  box-shadow: 0 0 12px rgba(105,215,255,.65);
  transform: rotate(-32deg);
  opacity: 0;
  animation: shooting 1.6s ease-out forwards;
}

@keyframes shooting {
  0% {
    transform: translate3d(-30vw, -10vh, 0) rotate(-32deg);
    opacity: 0;
  }
  12% { opacity: 1; }
  100% {
    transform: translate3d(75vw, 58vh, 0) rotate(-32deg);
    opacity: 0;
  }
}

.constellation-line {
  position: absolute;
  height: 1px;
  transform-origin: left center;
  background: linear-gradient(
    90deg,
    rgba(105,215,255,.08),
    rgba(158,181,255,.48),
    rgba(105,215,255,.12)
  );
  opacity: 0;
  animation: constellationFade 4.5s ease-in-out forwards;
}

@keyframes constellationFade {
  0% { opacity: 0; }
  16% { opacity: .85; }
  78% { opacity: .55; }
  100% { opacity: 0; }
}

.tap-star {
  position: absolute;
  z-index: 10;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: white;
  box-shadow:
    0 0 10px white,
    0 0 24px var(--cyan),
    0 0 40px var(--violet);
  animation: tapStar 1s ease-out forwards;
}

@keyframes tapStar {
  from { opacity: 1; transform: scale(.4); }
  to { opacity: 0; transform: scale(3.2); }
}

.intro-panel {
  position: absolute;
  z-index: 20;
  top: clamp(32px, 7vh, 78px);
  left: clamp(20px, 5vw, 72px);
  width: min(520px, calc(100vw - 40px));
  pointer-events: none;
}

.intro-kicker {
  margin-bottom: .75rem;
  color: rgba(139,201,255,.78);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .22em;
}

.intro-panel h1 {
  margin: 0 0 .7rem;
  font-size: clamp(2.2rem, 6vw, 4.8rem);
  line-height: .98;
  font-weight: 500;
  letter-spacing: -.055em;
}

.intro-panel p {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(.92rem, 2vw, 1.05rem);
  line-height: 1.8;
}

.mode-status {
  position: absolute;
  z-index: 24;
  right: clamp(18px, 4vw, 50px);
  top: clamp(26px, 6vh, 60px);
  padding: .6rem .85rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: rgba(9,14,34,.42);
  color: rgba(255,255,255,.72);
  backdrop-filter: blur(18px);
  font-size: .78rem;
  pointer-events: none;
}

.control-dock {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  transform: translateX(-50%);
  display: flex;
  gap: .55rem;
  padding: .7rem;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 24px;
  background: rgba(7,11,27,.58);
  box-shadow:
    0 24px 60px rgba(0,0,0,.3),
    inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(22px);
}

.sky-control {
  width: 68px;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  border: 0;
  border-radius: 17px;
  background: transparent;
  color: rgba(255,255,255,.66);
  transition:
    transform .18s ease,
    background .18s ease,
    color .18s ease,
    box-shadow .18s ease;
}

.sky-control:hover,
.sky-control:focus-visible {
  color: #fff;
  background: rgba(255,255,255,.08);
  transform: translateY(-2px);
  outline: none;
}

.sky-control.active {
  color: #fff;
  background: linear-gradient(180deg, rgba(105,215,255,.18), rgba(139,125,255,.18));
  box-shadow: inset 0 0 0 1px rgba(135,184,255,.18);
}

.sky-control-accent {
  color: #fff;
  background: linear-gradient(135deg, rgba(89,175,255,.22), rgba(139,125,255,.22));
}

.sky-control-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.sky-control-label {
  font-size: .67rem;
  font-weight: 500;
}

@media (max-width: 767.98px) {
  .intro-panel {
    top: 28px;
    left: 20px;
  }

  .intro-panel h1 {
    font-size: clamp(2.25rem, 13vw, 4rem);
  }

  .intro-panel p {
    max-width: 78vw;
    font-size: .88rem;
  }

  .mode-status {
    top: auto;
    right: auto;
    left: 50%;
    bottom: 102px;
    transform: translateX(-50%);
    white-space: nowrap;
  }

  .control-dock {
    width: calc(100vw - 22px);
    max-width: 560px;
    overflow-x: auto;
    justify-content: flex-start;
    scrollbar-width: none;
    border-radius: 20px;
  }

  .control-dock::-webkit-scrollbar {
    display: none;
  }

  .sky-control {
    flex: 0 0 60px;
    width: 60px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .aurora,
  .star,
  .shooting-star,
  .constellation-line,
  .tap-star {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
