/* ========================================
   Adventure / Sparkle World — overworld styles
   ======================================== */

.adventure-world {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-gradient);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ---- Player character ---- */

.adventure-character {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--char-color, #ff69b4);
  display: grid;
  place-items: center;
  transform: translate3d(var(--cx, 0px), var(--cy, 0px), 0);
  will-change: transform;
  z-index: 10;
  box-shadow: 0 0 12px 4px color-mix(in srgb, var(--char-color, #ff69b4) 40%, transparent);
  pointer-events: none;
  /* offset so center of circle aligns with world position */
  margin-left: -24px;
  margin-top: -24px;
}

.adventure-char-initial {
  font-weight: var(--weight-heading);
  font-size: 1.25rem;
  color: var(--text-primary);
  text-shadow: 0 1px 2px var(--black-30);
  line-height: var(--leading-none);
}

/* ---- Animation states ---- */

.adventure-character.adventure-enter {
  animation: adventure-drop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.adventure-character.idle {
  animation: adventure-idle 1.5s ease-in-out infinite;
}

.adventure-character.walking {
  animation: adventure-walk 0.3s ease-in-out infinite;
}

.adventure-character.facing-left {
  transform: translate3d(var(--cx, 0px), var(--cy, 0px), 0) scaleX(-1);
}

@keyframes adventure-drop-in {
  0% {
    opacity: 0;
    translate: 0 -40px;
    scale: 0.5;
  }
  100% {
    opacity: 1;
    translate: 0 0;
    scale: 1;
  }
}

@keyframes adventure-idle {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -3px;
  }
}

@keyframes adventure-walk {
  0%,
  100% {
    translate: 0 0;
    scale: 1 1;
  }
  50% {
    translate: 0 -4px;
    scale: 1.02 0.96;
  }
}

/* ---- Tap indicator ---- */

.adventure-tap-ring {
  position: absolute;
  width: 32px;
  height: 32px;
  margin-left: -16px;
  margin-top: -16px;
  border-radius: 50%;
  border: 2px solid var(--white-50);
  pointer-events: none;
  animation: adventure-tap-fade 0.4s ease-out forwards;
  z-index: 5;
}

@keyframes adventure-tap-fade {
  0% {
    opacity: 1;
    scale: 0.5;
  }
  100% {
    opacity: 0;
    scale: 1.2;
  }
}

/* ---- Decorations ---- */

.adventure-decoration {
  position: absolute;
  pointer-events: none;
  transform: translate3d(var(--cx, 0px), var(--cy, 0px), 0);
}

.adventure-tree {
  width: var(--size, 40px);
  aspect-ratio: 1;
  background: radial-gradient(circle, #2d5a27 40%, #1a3d15 100%);
  border-radius: 50%;
  box-shadow: 0 4px 8px var(--black-30);
  z-index: 3;
}

.adventure-tree::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 10px;
  background: #5c3d2e;
  border-radius: 2px;
}

.adventure-rock {
  width: var(--size, 28px);
  aspect-ratio: 1.3;
  background: radial-gradient(ellipse, #6b6b7b 30%, #4a4a5a 100%);
  border-radius: 45% 55% 50% 50%;
  box-shadow: 0 3px 6px var(--black-30);
  z-index: 2;
}

.adventure-bush {
  width: var(--size, 20px);
  aspect-ratio: 1.2;
  background: radial-gradient(circle, #3a7a34 30%, #2a5a24 100%);
  border-radius: 50% 50% 45% 45%;
  z-index: 2;
}

.adventure-flower {
  width: var(--size, 10px);
  aspect-ratio: 1;
  background: radial-gradient(circle, #ff69b4 40%, #ff1493 100%);
  border-radius: 50%;
  box-shadow: 0 0 6px 2px rgba(255, 105, 180, 0.4);
  z-index: 1;
  animation: adventure-flower-glow 3s ease-in-out infinite;
}

@keyframes adventure-flower-glow {
  0%,
  100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

/* ---- Landmarks ---- */

.adventure-landmark {
  position: absolute;
  transform: translate3d(var(--cx, 0px), var(--cy, 0px), 0);
  pointer-events: none;
  text-align: center;
  z-index: 4;
}

.adventure-landmark-emoji {
  font-size: 1.2rem;
  display: block;
}

.adventure-landmark-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-body);
  color: var(--white-60);
  white-space: nowrap;
  text-shadow: 0 1px 3px var(--black-50);
}

/* ---- Demon markers ---- */

.adventure-demon {
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--demon-color, #e74c3c);
  display: grid;
  place-items: center;
  transform: translate3d(var(--cx, 0px), var(--cy, 0px), 0);
  margin-left: -28px;
  margin-top: -28px;
  z-index: 8;
  pointer-events: none;
  box-shadow:
    0 0 16px 6px color-mix(in srgb, var(--demon-color, #e74c3c) 50%, transparent),
    inset 0 -3px 6px var(--black-30);
  animation: adventure-demon-idle 1s ease-in-out infinite;
}

.adventure-demon-initial {
  font-weight: var(--weight-heading);
  font-size: 1.4rem;
  color: var(--text-primary);
  text-shadow: 0 1px 3px var(--black-40);
}

@keyframes adventure-demon-idle {
  0%,
  100% {
    translate: 0 0;
    scale: 1;
  }
  50% {
    translate: 0 -5px;
    scale: 1.05;
  }
}

.adventure-demon.demon-nearby {
  box-shadow:
    0 0 24px 10px color-mix(in srgb, var(--demon-color, #e74c3c) 70%, transparent),
    inset 0 -3px 6px var(--black-30);
  animation: adventure-demon-alert 0.5s ease-in-out infinite;
}

@keyframes adventure-demon-alert {
  0%,
  100% {
    translate: 0 0;
    scale: 1.05;
  }
  50% {
    translate: 0 -6px;
    scale: 1.12;
  }
}

/* ---- Reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
  .adventure-character.adventure-enter,
  .adventure-character.idle,
  .adventure-character.walking {
    animation: none;
  }

  .adventure-tap-ring {
    animation: none;
    display: none;
  }

  .adventure-demon,
  .adventure-demon.demon-nearby {
    animation: none;
  }

  .adventure-flower {
    animation: none;
    opacity: 0.85;
  }
}
