/* ---------------------------------------------------------------- map frame */

.world-wrap {
  position: fixed;
  inset: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior: contain;
}

.world-wrap::-webkit-scrollbar {
  display: none;
}

.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 60%, transparent),
    radial-gradient(1px 1px at 28% 8%, #fff 60%, transparent),
    radial-gradient(2px 2px at 44% 22%, #ffe9a8 60%, transparent),
    radial-gradient(1px 1px at 61% 12%, #fff 60%, transparent),
    radial-gradient(1.5px 1.5px at 74% 30%, #cfe3ff 60%, transparent),
    radial-gradient(1px 1px at 88% 16%, #fff 60%, transparent),
    radial-gradient(1px 1px at 6% 40%, #fff 60%, transparent),
    radial-gradient(1.5px 1.5px at 35% 36%, #fff 60%, transparent),
    radial-gradient(ellipse at 15% 60%, rgba(61, 123, 255, 0.35), transparent 50%),
    radial-gradient(ellipse at 85% 55%, rgba(255, 63, 164, 0.25), transparent 50%),
    linear-gradient(180deg, #070420 0%, #1a1150 45%, #3b2a8a 75%, #6b3fa8 100%);
}

.moon {
  position: absolute;
  top: 9%;
  right: 12%;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffbe8, #ffe9a8 60%, #e8c870);
  box-shadow: 0 0 60px 20px rgba(255, 233, 168, 0.35);
}

.cloud {
  position: absolute;
  height: 34px;
  border-radius: 999px;
  background: rgba(200, 190, 255, 0.12);
  filter: blur(2px);
  animation: drift 60s linear infinite;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: inherit;
}

.cloud::before {
  width: 60px;
  height: 50px;
  left: 20%;
  top: -24px;
}

.cloud::after {
  width: 44px;
  height: 40px;
  left: 52%;
  top: -16px;
}

.c1 { width: 180px; top: 14%; left: -10%; }
.c2 { width: 240px; top: 28%; left: -30%; animation-duration: 85s; animation-delay: -30s; }
.c3 { width: 150px; top: 6%; left: -20%; animation-duration: 70s; animation-delay: -50s; }

@keyframes drift {
  to {
    transform: translateX(140vw);
  }
}

.world-size {
  position: relative;
}

.world {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}

.parallax,
.ground {
  position: absolute;
  inset: 0;
}

.road-edge {
  fill: none;
  stroke: #7a4a1e;
  stroke-width: 62;
  stroke-linecap: round;
}

.road {
  fill: none;
  stroke: #e8c27e;
  stroke-width: 50;
  stroke-linecap: round;
}

.road-dash {
  fill: none;
  stroke: #f7dfa8;
  stroke-width: 4;
  stroke-dasharray: 18 26;
  opacity: 0.8;
}

.road-trail {
  fill: none;
  stroke: #ffd44d;
  stroke-width: 8;
  stroke-linecap: round;
  filter: drop-shadow(0 0 8px #ffd44d);
  opacity: 0.85;
}

.sign-text {
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 700;
  fill: #fff4d8;
}

.lamp rect:last-child {
  filter: drop-shadow(0 0 10px #ffe27a);
}

/* ---------------------------------------------------------------- houses */

.house {
  position: absolute;
  width: 300px;
  height: 300px;
  padding: 0;
  border: 0;
  background: none;
  transition: transform 0.35s var(--ease-pop), filter 0.35s;
}

.house:hover {
  transform: translateY(-8px);
}

.house-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.house .h-window {
  animation: window-flicker 4s ease-in-out infinite;
}

.house.is-current .h-window,
.house.is-opening .h-window {
  fill: #fff2a8;
  filter: drop-shadow(0 0 14px #ffd44d);
}

.house.is-opening .h-door {
  fill: #ffe9a0;
  filter: drop-shadow(0 0 24px #ffd44d);
  transition: fill 0.4s, filter 0.4s;
}

.house.is-current {
  filter: drop-shadow(0 0 30px rgba(255, 212, 77, 0.45));
}

.house.is-soon,
.house.is-locked {
  filter: saturate(0.35) brightness(0.65);
}

.house.is-soon .house-svg {
  animation: fog 6s ease-in-out infinite;
}

.house-book,
.house-check,
.house-lock {
  position: absolute;
  left: 50%;
  top: -36px;
  translate: -50% 0;
  display: none;
  font-size: 46px;
}

.house.is-current .house-book {
  display: block;
  animation: book-bounce 1.4s var(--ease-pop) infinite;
  filter: drop-shadow(0 0 18px #ffd44d);
}

.house-ping {
  position: absolute;
  top: -4px;
  right: -16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 20px var(--font-ui);
  color: #3a1d02;
  background: var(--gold);
}

.house.is-done .house-check {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  font: 700 30px var(--font-ui);
  color: #0a3a1a;
  background: var(--green);
  box-shadow: 0 0 24px rgba(62, 224, 122, 0.7);
}

.house.is-locked .house-lock,
.house.is-soon .house-lock {
  display: block;
  font-size: 40px;
}

.house-sign {
  position: absolute;
  left: 50%;
  top: 316px;
  translate: -50% 0;
  width: 250px;
  padding: 8px 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, #c27b38, #8a4a1a);
  border: 3px solid #5a3418;
  color: #fff4d8;
  font: 600 17px/1.2 var(--font-ui);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25);
}

.house-sign b {
  display: block;
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@keyframes book-bounce {
  50% {
    transform: translateY(-14px) rotate(-6deg);
  }
}

@keyframes window-flicker {
  50% {
    opacity: 0.82;
  }
}

@keyframes fog {
  50% {
    opacity: 0.75;
  }
}

/* ---------------------------------------------------------------- Daxter */

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

.daxter {
  position: absolute;
  top: 0;
  left: 0;
  width: 150px;
  will-change: transform;
}

.daxter-svg {
  display: block;
  width: 150px;
  overflow: visible;
  transition: transform 0.25s ease;
}

.daxter.is-facing-left .daxter-svg {
  transform: scaleX(-1);
}

.daxter-svg g,
.daxter-svg path,
.daxter-svg ellipse {
  transform-box: fill-box;
}

.daxter-body {
  transform-origin: 50% 100%;
}

.daxter-head {
  transform-origin: 50% 90%;
}

.daxter-leg,
.daxter-arm {
  transform-origin: 50% 8%;
}

.daxter-lids {
  transform-origin: 50% 0%;
  animation: blink 4.2s infinite;
}

.daxter-halo {
  transform-origin: center;
  animation: halo 2.6s ease-in-out infinite;
}

.daxter-scarf-tail {
  transform-origin: 100% 0%;
  animation: scarf 1.6s ease-in-out infinite;
}

.daxter.is-idle .daxter-body {
  animation: breathe 2.4s ease-in-out infinite;
}

.daxter.is-idle .daxter-pupils {
  animation: look 6s ease-in-out infinite;
}

.daxter.is-walking .daxter-body {
  animation: walk-bob 0.4s ease-in-out infinite;
}

.daxter.is-walking .daxter-head {
  animation: head-sway 0.8s ease-in-out infinite;
}

.daxter.is-walking .daxter-leg-front,
.daxter.is-walking .daxter-arm-back {
  animation: swing 0.8s ease-in-out infinite;
}

.daxter.is-walking .daxter-leg-back,
.daxter.is-walking .daxter-arm-front {
  animation: swing 0.8s ease-in-out infinite reverse;
}

.daxter.is-walking .daxter-scarf-tail {
  animation-duration: 0.4s;
}

.daxter.is-walking .daxter-shadow {
  animation: shadow-pulse 0.4s ease-in-out infinite;
  transform-origin: center;
}

.daxter.is-cheer .daxter-body {
  animation: jump 0.65s var(--ease-pop) 2;
}

.daxter.is-cheer .daxter-arm {
  transform: rotate(160deg);
  transition: transform 0.2s;
}

.daxter.is-cheer .daxter-halo {
  animation: halo 0.3s ease-in-out infinite;
}

.daxter.is-knock .daxter-arm-front {
  animation: knock 0.25s ease-in-out 3;
}

@keyframes breathe {
  50% {
    transform: scale(1.025, 0.975);
  }
}

@keyframes walk-bob {
  0%,
  100% {
    transform: translateY(0) scale(1.03, 0.96);
  }
  50% {
    transform: translateY(-16px) scale(0.97, 1.04);
  }
}

@keyframes head-sway {
  25% {
    transform: rotate(-5deg);
  }
  75% {
    transform: rotate(5deg);
  }
}

@keyframes swing {
  0%,
  100% {
    transform: rotate(32deg);
  }
  50% {
    transform: rotate(-32deg);
  }
}

@keyframes shadow-pulse {
  50% {
    transform: scale(0.75);
    opacity: 0.2;
  }
}

@keyframes jump {
  40% {
    transform: translateY(-70px) scale(0.95, 1.08);
  }
  80% {
    transform: translateY(0) scale(1.08, 0.92);
  }
}

@keyframes knock {
  50% {
    transform: rotate(-70deg);
  }
}

@keyframes blink {
  0%,
  92%,
  100% {
    transform: scaleY(1);
  }
  95% {
    transform: scaleY(15);
  }
}

@keyframes look {
  0%,
  40%,
  100% {
    transform: translate(0, 0);
  }
  50%,
  65% {
    transform: translate(-3px, 1px);
  }
  75%,
  90% {
    transform: translate(3px, -1px);
  }
}

@keyframes halo {
  50% {
    transform: scale(1.12);
    opacity: 0.7;
  }
}

@keyframes scarf {
  50% {
    transform: rotate(-14deg);
  }
}

.dust {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 236, 200, 0.85), rgba(232, 194, 126, 0));
  animation: dust 0.7s ease-out forwards;
}

@keyframes dust {
  to {
    transform: translate(-26px, -18px) scale(2.4);
    opacity: 0;
  }
}

/* ---------------------------------------------------------------- speech bubble */

.daxter-bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 14px);
  width: max-content;
  max-width: 320px;
  padding: 14px 18px;
  border-radius: 20px;
  background: #fffaf0;
  color: #2a1406;
  font: 600 20px/1.3 var(--font-ui);
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  opacity: 0;
  transform: translate(-50%, 12px) scale(0.85);
  transform-origin: 50% 100%;
  transition: opacity 0.25s, transform 0.35s var(--ease-pop);
}

.daxter-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  translate: -50% 0;
  border: 12px solid transparent;
  border-top-color: #fffaf0;
}

.daxter-bubble.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.daxter-bubble a {
  color: #c2185b;
  font-weight: 700;
}

/* ---------------------------------------------------------------- walking controls */

.walk-controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 15;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 18px;
  pointer-events: none;
}

.walk-btn {
  pointer-events: auto;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  background: radial-gradient(circle at 35% 30%, #9a74ff, #4b23c8);
  color: #fff;
  font-size: 32px;
  box-shadow: 0 8px 0 #2a1278, 0 14px 30px rgba(0, 0, 0, 0.45);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.walk-btn:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 #2a1278, 0 6px 16px rgba(0, 0, 0, 0.45);
}

.walk-btn.enter {
  width: 64px;
  height: 64px;
  margin-bottom: 6px;
  font-size: 26px;
  background: radial-gradient(circle at 35% 30%, #ffe58a, #e6a91f);
  color: #3a1d02;
  box-shadow: 0 7px 0 #9a5f0a, 0 12px 26px rgba(0, 0, 0, 0.4);
}

/* Daxter is tappable */
.daxter {
  pointer-events: auto;
  cursor: pointer;
}

/* ---------------------------------------------------------------- coins on the road */

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

.road-coin {
  position: absolute;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff6c8 0 18%, transparent 19%),
    radial-gradient(circle, #ffd84a 0 55%, #e6a91f 56% 70%, #b97a0a 71%);
  box-shadow: 0 0 18px rgba(255, 212, 77, 0.8);
  animation: coin-bob 1.6s ease-in-out infinite, coin-spin 2.4s linear infinite;
}

.road-coin::after {
  content: "★";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 700 16px/1 var(--font-ui);
  color: #9a5f0a;
}

.road-coin.is-collected {
  animation: coin-collect 0.6s ease-out forwards;
}

@keyframes coin-bob {
  50% {
    translate: 0 -10px;
  }
}

@keyframes coin-spin {
  50% {
    scale: 0.35 1;
  }
}

@keyframes coin-collect {
  to {
    translate: 0 -110px;
    scale: 1.6;
    opacity: 0;
  }
}

.hud-coins {
  display: inline-flex;
  align-items: center;
  color: var(--gold);
}

.hud-coins.is-bumped {
  animation: coin-bump 0.35s var(--ease-pop);
}

@keyframes coin-bump {
  50% {
    transform: scale(1.25);
  }
}
