@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:wght@400;500;600;700&display=swap");

:root {
  --accent: #34d399;
  --accent-2: #22d3ee;
  --ink: #0f172a;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Bricolage Grotesque", sans-serif;
  background: radial-gradient(circle at top left, rgba(16, 185, 129, 0.18), transparent 55%),
    radial-gradient(circle at 20% 70%, rgba(34, 211, 238, 0.14), transparent 55%),
    #020617;
  margin: 0;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: 100vw;
  height: 100vh;
}

.game-shell {
  position: relative;
  width: 100%;
  height: 100%;
}

.lab-mark {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 20;
  margin: 0;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: #bbf7d0;
  text-shadow: 0 0 30px rgba(16, 185, 129, 0.45);
}

.zoom-controls {
  position: absolute;
  left: 1rem;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 24;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.zoom-controls button {
  width: 36px;
  height: 36px;
  border-radius: 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(2, 6, 23, 0.55);
  color: rgba(248, 250, 252, 0.9);
  font-size: 1.1rem;
  font-weight: 700;
  backdrop-filter: blur(10px);
}

.panel-toggle {
  z-index: 25;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(2, 6, 23, 0.55);
  color: rgba(248, 250, 252, 0.92);
  border-radius: 999px;
  padding: 0 0.9rem;
  font-weight: 650;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  height: 2.6rem;
}

.color-popover {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 26;
  padding: 0;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.panel-toggle__swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #22d3ee;
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.12);
}

.left-panel {
  position: absolute;
  right: 0;
  top: 3.4rem;
  z-index: 24;
  width: min(320px, calc(100vw - 2rem));
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.82), rgba(2, 6, 23, 0.52));
  border: 1px solid rgba(148, 163, 184, 0.18);
  backdrop-filter: blur(14px);
  border-radius: 1.1rem;
  transform-origin: top right;
  transform: translateY(0) scale(1);
  transition: transform 150ms ease, opacity 150ms ease;
  opacity: 1;
}

.left-panel.is-collapsed {
  transform: translateY(-6px) scale(0.97);
  opacity: 0;
  pointer-events: none;
}

.left-panel__inner {
  height: 100%;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.left-panel__color {
  width: 100%;
  height: 3rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(2, 6, 23, 0.35);
  padding: 0.2rem;
}

.planet-switch {
  display: inline-flex;
  align-items: center;
  padding: 0 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(10px);
  height: 2.6rem;
}

.planet-select {
  min-width: 9.5rem;
  height: 100%;
  border: none;
  background: transparent;
  color: rgba(248, 250, 252, 0.92);
  padding: 0 0.2rem 0 0.1rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  appearance: none;
  line-height: 2.6rem;
}

.left-panel__swatches {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.6rem;
}

.swatch {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: var(--swatch, #22d3ee);
  cursor: pointer;
}

.swatch[data-color="#77f9ff"] { --swatch: #77f9ff; }
.swatch[data-color="#00f5d4"] { --swatch: #00f5d4; }
.swatch[data-color="#7c3aed"] { --swatch: #7c3aed; }
.swatch[data-color="#ff3dff"] { --swatch: #ff3dff; }
.swatch[data-color="#ffb703"] { --swatch: #ffb703; }
.swatch[data-color="#f8fafc"] { --swatch: #f8fafc; }

#scene {
  position: absolute;
  inset: 0;
  animation: fade-in 700ms ease-out both;
}

#scene canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.joystick {
  position: absolute;
  right: 1rem;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 23;
  opacity: 0.5;
  transition: opacity 120ms ease;
  user-select: none;
  touch-action: none;
}

.joystick.is-active {
  opacity: 0.75;
}

.joystick__base {
  width: 124px;
  height: 124px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: radial-gradient(circle at 30% 30%, rgba(34, 211, 238, 0.12), rgba(2, 6, 23, 0.55));
  backdrop-filter: blur(10px);
  position: relative;
}

.joystick__knob {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: radial-gradient(circle at 30% 30%, rgba(248, 250, 252, 0.18), rgba(2, 6, 23, 0.7));
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.planet-info {
  position: absolute;
  left: 1rem;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 24;
  width: min(320px, calc(100vw - 2rem));
  background: rgba(2, 6, 23, 0.68);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 1rem;
  padding: 0.8rem;
  display: grid;
  gap: 0.6rem;
  backdrop-filter: blur(12px);
}

.planet-info.is-hidden {
  display: none;
}

.planet-info__header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.6rem;
}

.planet-info__header span {
  font-size: 1.6rem;
}

#planet-info-name {
  margin: 0;
  font-size: 1rem;
}

#planet-info-sub {
  margin: 0;
  font-size: 0.75rem;
  color: rgba(248, 250, 252, 0.65);
}

.planet-info__summary {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.35;
  color: rgba(248, 250, 252, 0.88);
}

.planet-info__facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: rgba(226, 232, 240, 0.78);
}

.planet-info__facts li::before {
  content: \"• \";
  color: rgba(148, 163, 184, 0.9);
}

#planet-info-close {
  border: none;
  background: transparent;
  color: rgba(248, 250, 252, 0.8);
  font-size: 1.2rem;
}

#planet-info-link {
  color: #7dd3fc;
  text-decoration: none;
  font-size: 0.85rem;
}

@media (pointer: fine) {
  .joystick {
    display: none;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
