:root {
  --ink: #2d2747;
  --paper: #f8f3e8;
  --yellow: #f9dc4b;
  --red: #ef6654;
  --blue: #4588ea;
  --skin: #ba7e4b;
  --hair: #302644;
  --sky-top: #72b7e8;
  --sky-bottom: #91d4fa;
  --grass-back: #8ed26d;
  --grass-middle: #72c65a;
  --grass-front: #5ab34b;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  color: var(--ink);
  background: var(--sky-top);

  font-family: "Comic Sans MS", "Trebuchet MS", Arial, sans-serif;

  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 5px solid #ffffff;
  outline-offset: 5px;
}

#xnWorld {
  position: relative;

  width: 100%;
  height: 100%;
  min-height: 100dvh;

  overflow: hidden;

  cursor: crosshair;
  touch-action: none;

  background: linear-gradient(
    to bottom,
    var(--sky-top) 0%,
    var(--sky-bottom) 62%,
    var(--grass-back) 62%,
    var(--grass-middle) 100%
  );
}

/* Large front hill */

#xnWorld::before {
  content: "";

  position: absolute;
  z-index: 1;

  left: -10%;
  bottom: -17%;

  width: 120%;
  height: 38%;

  background: var(--grass-front);
  border-radius: 50% 50% 0 0;

  pointer-events: none;
}

/* Distant hill line */

#xnWorld::after {
  content: "";

  position: absolute;
  z-index: 2;

  left: -5%;
  bottom: 10%;

  width: 110%;
  height: 17%;

  border-top: 4px solid rgba(45, 39, 71, 0.09);
  border-radius: 50%;

  pointer-events: none;
}

/* Sky decorations */

.skyDecor {
  position: absolute;
  z-index: 0;
  inset: 0;

  pointer-events: none;
}

.sun {
  position: absolute;

  top: 10%;
  right: 9%;

  width: clamp(76px, 9vw, 122px);
  aspect-ratio: 1;

  background: #ecd866;

  border: 5px solid rgba(45, 39, 71, 0.75);
  border-radius: 50%;

  box-shadow:
    0 0 0 16px rgba(236, 216, 102, 0.16),
    0 0 0 29px rgba(236, 216, 102, 0.08);

  animation: sunFloat 4s ease-in-out infinite alternate;
}

@keyframes sunFloat {
  from {
    transform: translateY(0) rotate(-2deg);
  }

  to {
    transform: translateY(-7px) rotate(2deg);
  }
}

.cloud {
  position: absolute;

  width: 140px;
  height: 42px;

  background: rgba(255, 255, 255, 0.61);

  border: 4px solid rgba(45, 39, 71, 0.16);
  border-radius: 999px;

  filter: drop-shadow(0 5px 0 rgba(45, 39, 71, 0.09));
}

.cloud::before,
.cloud::after {
  content: "";

  position: absolute;

  background: inherit;
  border: inherit;
  border-radius: 50%;
}

.cloud::before {
  left: 18px;
  bottom: 10px;

  width: 54px;
  height: 54px;
}

.cloud::after {
  right: 16px;
  bottom: 6px;

  width: 64px;
  height: 64px;
}

.cloudOne {
  top: 24%;
  left: 73%;

  transform: scale(0.8);
}

.cloudTwo {
  top: 15%;
  left: 25%;

  opacity: 0.57;
  transform: scale(0.55);
}

.cloudThree {
  top: 36%;
  left: 86%;

  opacity: 0.47;
  transform: scale(0.43);
}

.doodle {
  position: absolute;

  color: rgba(255, 255, 255, 0.75);

  font-weight: 900;

  text-shadow: 2px 2px 0 rgba(45, 39, 71, 0.16);

  animation: doodleFloat 3s ease-in-out infinite alternate;
}

.doodleStarOne {
  top: 28%;
  left: 6%;

  font-size: clamp(28px, 4vw, 58px);
}

.doodleStarTwo {
  top: 18%;
  left: 63%;

  font-size: clamp(18px, 2vw, 36px);

  animation-delay: 0.7s;
}

.doodleBolt {
  top: 40%;
  left: 31%;

  font-size: clamp(28px, 4vw, 54px);

  transform: rotate(12deg);
  animation-delay: 0.3s;
}

.doodleSpiral {
  top: 49%;
  right: 6%;

  font-size: clamp(34px, 6vw, 72px);

  animation-delay: 0.9s;
}

@keyframes doodleFloat {
  from {
    translate: 0 0;
  }

  to {
    translate: 0 -8px;
  }
}

/* Super XN header */

.siteHeader {
  position: absolute;
  z-index: 50;

  top: max(18px, env(safe-area-inset-top));
  left: 50%;

  transform: translateX(-50%);

  pointer-events: none;
}

.siteHeader h1 {
  display: flex;
  align-items: center;
  gap: 10px;

  margin: 0;
  padding: 12px 20px;

  background: rgba(255, 255, 255, 0.92);

  border: 4px solid var(--ink);
  border-radius: 20px;

  box-shadow:
    0 8px 0 rgba(45, 39, 71, 0.2),
    0 14px 24px rgba(45, 39, 71, 0.12);

  font-size: clamp(1.5rem, 4vw, 2.7rem);
  line-height: 1;
}

.siteHeader h1 span {
  font-weight: 900;
}

.siteHeader h1 strong {
  display: inline-block;

  padding: 5px 12px;

  color: #ffffff;
  background: var(--red);

  border: 3px solid var(--ink);
  border-radius: 999px;

  transform: rotate(5deg);
}

/* Hotspots */

.hotspot {
  position: absolute;
  z-index: 10;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  width: clamp(140px, 18vw, 205px);
  aspect-ratio: 1;

  gap: 6px;
  padding: 16px;

  color: var(--ink);
  background: var(--paper);

  border: 5px solid var(--ink);
  border-radius: 50%;

  box-shadow:
    0 10px 0 rgba(45, 39, 71, 0.18),
    0 18px 30px rgba(45, 39, 71, 0.15);

  cursor: pointer;
  user-select: none;

  transition:
    transform 160ms ease,
    filter 160ms ease,
    box-shadow 160ms ease;
}

.hotspot:hover,
.hotspot:focus-visible,
.hotspot.isActive {
  transform: scale(1.06);
  filter: brightness(1.04);

  box-shadow:
    0 8px 0 rgba(45, 39, 71, 0.18),
    0 0 0 9px rgba(255, 255, 255, 0.2),
    0 20px 34px rgba(45, 39, 71, 0.2);
}

.hotspotName {
  position: relative;
  z-index: 3;

  text-align: center;

  font-size: clamp(0.8rem, 1.4vw, 1rem);
  font-weight: 900;
  line-height: 1.1;
}

.playableBadge,
.comingSoonBadge {
  position: absolute;
  z-index: 5;

  right: -10px;
  bottom: 4px;

  padding: 6px 12px;

  border: 3px solid var(--ink);
  border-radius: 14px;

  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;

  transform: rotate(-8deg);
}

.playableBadge {
  background: var(--yellow);
}

.comingSoonBadge {
  color: #ffffff;
  background: #6f628d;
}

/* Elemental People */

.elementalHotspot {
  top: 41%;
  left: 6%;

  background:
    radial-gradient(
      circle,
      rgba(255, 255, 255, 0.84) 0 22%,
      rgba(255, 255, 255, 0.25) 23% 35%,
      transparent 36%
    ),
    conic-gradient(
      from 30deg,
      #ff7f63,
      #f6cf55,
      #74cf73,
      #5ca8f6,
      #a66be7,
      #ff7f63
    );
}

.hotspotPulse {
  position: absolute;

  inset: 16px;

  border: 4px dashed rgba(45, 39, 71, 0.5);
  border-radius: 50%;

  animation: portalSpin 12s linear infinite;
}

@keyframes portalSpin {
  to {
    transform: rotate(360deg);
  }
}

.elementIcons {
  position: relative;
  z-index: 2;

  display: grid;
  grid-template-columns: repeat(2, 1fr);

  gap: 0;

  font-size: clamp(1.4rem, 3vw, 2.3rem);
  line-height: 1;
}

/* Locked worlds */

.lockedHotspot {
  background: repeating-linear-gradient(
    -7deg,
    #efe8d9 0,
    #efe8d9 15px,
    #e4dcc9 16px,
    #e4dcc9 18px
  );
}

/* Castle World */

.castleHotspot {
  top: 53%;
  right: 9%;
}

.castleDrawing {
  position: relative;

  width: 78%;
  height: 52%;
}

.castleTower,
.castleCenter {
  position: absolute;
  bottom: 0;

  background: #bea9d9;
  border: 4px solid var(--ink);
}

.castleTower {
  width: 30%;
  height: 78%;
}

.castleTower::before {
  content: "";

  position: absolute;

  left: -4px;
  right: -4px;
  top: -14px;

  height: 18px;

  background: linear-gradient(
    to right,
    #bea9d9 0 22%,
    transparent 22% 38%,
    #bea9d9 38% 62%,
    transparent 62% 78%,
    #bea9d9 78% 100%
  );

  border: 4px solid var(--ink);
  border-bottom: 0;
}

.towerLeft {
  left: 0;
}

.towerRight {
  right: 0;
}

.castleCenter {
  left: 26%;

  width: 48%;
  height: 58%;
}

.castleCenter::after {
  content: "";

  position: absolute;

  left: 50%;
  bottom: -4px;

  width: 28%;
  height: 44%;

  background: #6f628d;

  border: 4px solid var(--ink);
  border-radius: 50% 50% 0 0;

  transform: translateX(-50%);
}

.castleFlag {
  position: absolute;

  left: 16%;
  top: -24px;

  width: 28px;
  height: 18px;

  background: var(--red);

  border: 3px solid var(--ink);
  border-left: 0;
}

/* Space Adventure */

.spaceHotspot {
  left: 38%;
  bottom: 9%;
}

.spaceDrawing {
  position: relative;

  width: 78%;
  height: 54px;
}

.planet {
  position: absolute;

  left: 4px;
  bottom: 0;

  font-size: clamp(2.2rem, 5vw, 3.8rem);
}

.rocket {
  position: absolute;

  right: 2px;
  top: -6px;

  font-size: clamp(2rem, 4vw, 3.5rem);

  transform: rotate(-18deg);
}

/* Super XN character */

#hero {
  position: absolute;
  z-index: 30;

  left: 0;
  top: 0;

  width: clamp(82px, 9vw, 118px);
  height: clamp(122px, 14vw, 174px);

  pointer-events: none;
  user-select: none;

  will-change: transform;
}

.heroShadow {
  position: absolute;
  z-index: 0;

  left: 50%;
  bottom: -3px;

  width: 62%;
  height: 14px;

  background: rgba(43, 68, 39, 0.28);
  border-radius: 50%;

  filter: blur(2px);

  transform: translateX(-50%);
}

.heroBob {
  position: absolute;
  inset: 0;

  transform-origin: center bottom;
}

#hero.isWalking .heroBob {
  animation: heroBounce 240ms ease-in-out infinite alternate;
}

@keyframes heroBounce {
  from {
    transform: translateY(0) rotate(-1deg);
  }

  to {
    transform: translateY(-6px) rotate(1deg);
  }
}

.heroVisual {
  position: absolute;
  inset: 0;

  transform-origin: center bottom;
}

#hero.facingLeft .heroVisual {
  transform: scaleX(-1);
}

.heroFallback {
  position: absolute;
  inset: 0;
}

.cape {
  position: absolute;
  z-index: 1;

  left: 24%;
  top: 36%;

  width: 58%;
  height: 48%;

  background: var(--red);

  border: 4px solid var(--ink);
  border-radius: 22% 45% 60% 38%;

  transform: rotate(-6deg);
}

.characterHead {
  position: absolute;
  z-index: 5;

  left: 50%;
  top: 4%;

  width: 60%;
  aspect-ratio: 0.92;

  background: var(--skin);

  border: 4px solid var(--ink);
  border-radius: 46% 48% 44% 42%;

  transform: translateX(-50%);
}

.hair {
  position: absolute;

  left: -6%;
  right: -6%;
  top: -12%;

  height: 40%;

  background: var(--hair);

  border: 4px solid var(--ink);
  border-radius: 50% 50% 35% 35%;
}

.hair span {
  position: absolute;

  top: 52%;

  width: 26%;
  height: 52%;

  background: var(--hair);
  border-radius: 0 0 50% 50%;
}

.hair span:nth-child(1) {
  left: 10%;
  transform: rotate(22deg);
}

.hair span:nth-child(2) {
  left: 37%;
  transform: rotate(-6deg);
}

.hair span:nth-child(3) {
  right: 8%;
  transform: rotate(-22deg);
}

.ear {
  position: absolute;
  z-index: -1;

  top: 44%;

  width: 18%;
  height: 24%;

  background: var(--skin);

  border: 4px solid var(--ink);
  border-radius: 50%;
}

.earLeft {
  left: -12%;
}

.earRight {
  right: -12%;
}

.face {
  position: absolute;
  inset: 0;
}

.eye {
  position: absolute;

  top: 50%;

  width: 10%;
  aspect-ratio: 1;

  background: var(--ink);
  border-radius: 50%;
}

.eyeLeft {
  left: 27%;
}

.eyeRight {
  right: 27%;
}

.smile {
  position: absolute;

  left: 50%;
  top: 68%;

  width: 28%;
  height: 14%;

  border-bottom: 4px solid var(--ink);
  border-radius: 0 0 50% 50%;

  transform: translateX(-50%);
}

.characterBody {
  position: absolute;
  z-index: 3;

  left: 50%;
  top: 42%;

  width: 58%;
  height: 40%;

  background: var(--blue);

  border: 4px solid var(--ink);
  border-radius: 18% 18% 12% 12%;

  transform: translateX(-50%);
}

.shirtLogo {
  position: absolute;

  left: 50%;
  top: 14%;

  padding: 2px 5px;

  color: #ffffff;
  background: var(--red);

  border: 2px solid var(--ink);
  border-radius: 50%;

  font-size: clamp(0.55rem, 1vw, 0.76rem);
  font-weight: 900;

  transform: translateX(-50%);
}

.arm {
  position: absolute;
  z-index: -1;

  top: 8%;

  width: 24%;
  height: 72%;

  background: var(--blue);

  border: 4px solid var(--ink);
  border-radius: 30px;

  transform-origin: center top;
}

.armLeft {
  left: -18%;
  transform: rotate(18deg);
}

.armRight {
  right: -18%;
  transform: rotate(-18deg);
}

#hero.isWalking .armLeft {
  animation: armSwingLeft 300ms ease-in-out infinite alternate;
}

#hero.isWalking .armRight {
  animation: armSwingRight 300ms ease-in-out infinite alternate;
}

@keyframes armSwingLeft {
  from {
    transform: rotate(28deg);
  }

  to {
    transform: rotate(-10deg);
  }
}

@keyframes armSwingRight {
  from {
    transform: rotate(-28deg);
  }

  to {
    transform: rotate(10deg);
  }
}

.hand {
  position: absolute;

  left: 50%;
  bottom: -12%;

  width: 130%;
  aspect-ratio: 1;

  background: var(--skin);

  border: 4px solid var(--ink);
  border-radius: 50%;

  transform: translateX(-50%);
}

.leg {
  position: absolute;
  z-index: -2;

  bottom: -72%;

  width: 28%;
  height: 84%;

  background: #323451;

  border: 4px solid var(--ink);
  border-radius: 0 0 16px 16px;

  transform-origin: center top;
}

.legLeft {
  left: 12%;
}

.legRight {
  right: 12%;
}

#hero.isWalking .legLeft {
  animation: legSwingLeft 300ms ease-in-out infinite alternate;
}

#hero.isWalking .legRight {
  animation: legSwingRight 300ms ease-in-out infinite alternate;
}

@keyframes legSwingLeft {
  from {
    transform: rotate(-14deg);
  }

  to {
    transform: rotate(14deg);
  }
}

@keyframes legSwingRight {
  from {
    transform: rotate(14deg);
  }

  to {
    transform: rotate(-14deg);
  }
}

.shoe {
  position: absolute;

  left: -18%;
  bottom: -6px;

  width: 136%;
  height: 28%;

  background: #fff4cf;

  border: 4px solid var(--ink);
  border-radius: 60% 45% 35% 35%;
}

/* Coming-soon toast */

.statusToast {
  position: absolute;
  z-index: 90;

  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));

  max-width: min(90%, 420px);

  padding: 12px 20px;

  color: #ffffff;
  background: rgba(45, 39, 71, 0.96);

  border: 3px solid #ffffff;
  border-radius: 18px;

  box-shadow:
    0 7px 0 rgba(24, 20, 39, 0.3),
    0 14px 26px rgba(24, 20, 39, 0.2);

  font-weight: 900;
  text-align: center;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transform: translate(-50%, 18px);

  transition:
    opacity 180ms ease,
    transform 180ms ease,
    visibility 180ms ease;
}

.statusToast.isVisible {
  opacity: 1;
  visibility: visible;

  transform: translate(-50%, 0);
}

/* Instructions */

.instructions {
  position: absolute;
  z-index: 60;

  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));

  padding: 9px 16px;

  color: #ffffff;
  background: rgba(45, 39, 71, 0.8);

  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 999px;

  font-size: 0.82rem;
  font-weight: 800;

  pointer-events: none;

  transform: translateX(-50%);

  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.instructions.isHidden {
  opacity: 0;

  transform: translate(-50%, 14px);
}

.touchInstructions {
  display: none;
}

/* Touch devices */

@media (pointer: coarse) {
  #xnWorld {
    cursor: default;
  }

  .mouseInstructions {
    display: none;
  }

  .touchInstructions {
    display: inline;
  }
}

/* Phones */

@media (max-width: 700px) {
  .siteHeader h1 {
    padding: 9px 15px;
  }

  .elementalHotspot {
    top: 29%;
    left: 4%;
  }

  .castleHotspot {
    top: 47%;
    right: 3%;
  }

  .spaceHotspot {
    left: 9%;
    bottom: 8%;
  }

  .hotspot {
    width: clamp(120px, 35vw, 170px);
    border-width: 4px;
  }

  #hero {
    width: clamp(76px, 21vw, 105px);
    height: clamp(114px, 32vw, 158px);
  }
}

/* Short landscape screens */

@media (max-height: 620px) and (orientation: landscape) {
  .siteHeader {
    left: 20px;
    transform: none;
  }

  .siteHeader h1 {
    padding: 8px 13px;
    font-size: 1.4rem;
  }

  .elementalHotspot {
    top: 24%;
    left: 7%;
  }

  .castleHotspot {
    top: 31%;
    right: 7%;
  }

  .spaceHotspot {
    left: 43%;
    bottom: 4%;
  }

  .hotspot {
    width: clamp(105px, 25vh, 145px);
  }

  #hero {
    width: clamp(66px, 16vh, 94px);
    height: clamp(100px, 25vh, 142px);
  }
}

/* Reduced-motion support */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
