:root { --move-duration: 2.2s; }

* { box-sizing: border-box; }

html, body {
  height: 100%;
  min-height: 100vh;       /* fallback */
  min-height: 100dvh;      /* modern mobile */
  margin: 0;
}

html, body {
  background: #111; /* fallback */
  background: radial-gradient(1200px 600px at 20% 20%, #34345a 0%, #1b1b2e 50%, #111 100%);
  color: #fff;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  overflow: hidden;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.title {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 6%);
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  text-align: center;
  font-size: clamp(1.4rem, 6vw, 3rem);
  letter-spacing: .5px;
  animation: glow 2.2s ease-in-out infinite alternate;
  z-index: 10;
  padding: 0 .5rem;
}

@keyframes glow {
  from { text-shadow: 0 0 10px #7fffd4, 0 0 20px #7fffd4; }
  to   { text-shadow: 0 0 18px #ff7ffd, 0 0 36px #ff7ffd; }
}

#stage {
  position: relative;
  width: 100vw;
  height: 100vh;   /* fallback */
  height: 100dvh;  /* modern mobile */
}

/* Alien wrappers */
.alien {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
  transition: transform var(--move-duration) cubic-bezier(.22,.61,.36,1);
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.45));
}

/* flip horizontally when walking left/right */
.alien .flip {
  transform-origin: center;
  transition: transform .25s linear;
}

/* 👾 body */
.alien .body {
  font-size: clamp(24px, 6vw, 32px); /* ~32px on desktop, smaller on tiny screens */
  line-height: 1;
  display: inline-block;
  transform-origin: 50% 65%;
  text-shadow: 0 0 4px rgba(127,255,212,.6);
}

/* Walking = faster swing + bob */
.alien.walking .body { animation: walk-swing .6s ease-in-out infinite; }

/* Idle = slower subtle wiggle */
.alien.idle .body { animation: idle-wiggle 1.4s ease-in-out infinite; }

@keyframes walk-swing {
  0%   { transform: translateY(0) rotate(9deg); }
  50%  { transform: translateY(-2px) rotate(-9deg); }
  100% { transform: translateY(0) rotate(9deg); }
}

@keyframes idle-wiggle {
  0%   { transform: translateY(0) rotate(4deg); }
  50%  { transform: translateY(-1px) rotate(-4deg); }
  100% { transform: translateY(0) rotate(4deg); }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .title { animation: none; }
  .alien { transition: none; }
  .alien .body { animation: none; }
}
