* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  background: #05091f;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.viewport {
  position: relative;
  display: grid;
  width: 100vw;
  height: 100vh;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 50%, rgba(65, 92, 255, 0.34), transparent 32%),
    #05091f;
}

.viewport::before {
  position: absolute;
  inset: -2%;
  z-index: 0;
  content: "";
  background-image:
    linear-gradient(rgba(5, 9, 31, 0.22), rgba(5, 9, 31, 0.22)),
    url("../assets/home-bg.png");
  background-position: center;
  background-size: cover;
  filter: blur(9px) brightness(0.72) saturate(1.08);
  transform: scale(1.04);
}

.stage {
  position: relative;
  z-index: 1;
  width: min(100vw, 150.24vh);
  aspect-ratio: 1537 / 1023;
  overflow: hidden;
  isolation: isolate;
  background-image: url("../assets/home-bg.png");
  background-size: 100% 100%;
  background-position: center;
  box-shadow: 0 0 90px rgba(10, 26, 96, 0.65);
}

.stage::before,
.stage::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  content: "";
  pointer-events: none;
}

.stage::before {
  background:
    radial-gradient(circle at 50% 44%, rgba(116, 177, 255, 0.36), transparent 20%),
    radial-gradient(circle at 49% 55%, rgba(43, 95, 255, 0.35), transparent 18%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(2, 5, 25, 0.18) 72%, rgba(3, 4, 10, 0.42));
  mix-blend-mode: screen;
}

.stage::after {
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 236, 165, 0.8) 0 0.12%, transparent 0.3%),
    radial-gradient(circle at 39% 10%, rgba(255, 255, 255, 0.8) 0 0.1%, transparent 0.28%),
    radial-gradient(circle at 69% 19%, rgba(255, 240, 190, 0.75) 0 0.12%, transparent 0.32%),
    radial-gradient(circle at 84% 12%, rgba(255, 255, 255, 0.7) 0 0.1%, transparent 0.28%),
    radial-gradient(circle at 76% 37%, rgba(145, 188, 255, 0.65) 0 0.14%, transparent 0.36%);
  opacity: 0.78;
  animation: twinkle 3.8s ease-in-out infinite alternate;
}

.sprite,
.start-button {
  position: absolute;
  display: block;
  z-index: 5;
  user-select: none;
  -webkit-user-drag: none;
}

.sprite {
  pointer-events: none;
}

.sprite,
.start-button img {
  height: auto;
}

.title {
  top: 3.2%;
  left: 28%;
  z-index: 20;
  width: 47%;
  filter:
    drop-shadow(0 1.2vmin 0.8vmin rgba(0, 0, 0, 0.58))
    drop-shadow(0 0 1.8vmin rgba(255, 196, 72, 0.32));
  animation: title-arrive 850ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.balloon {
  top: 0.5%;
  left: 25.2%;
  z-index: 16;
  width: 17.2%;
  transform: rotate(-4deg);
  filter: drop-shadow(0 1vmin 0.8vmin rgba(0, 0, 0, 0.45));
}

.book {
  z-index: 10;
  filter: drop-shadow(0 0.8vmin 0.65vmin rgba(0, 0, 0, 0.48));
}

.book-left {
  top: 26.5%;
  left: -2.5%;
  width: 18.6%;
  transform: rotate(-8deg);
}

.book-right {
  top: 31.2%;
  right: 1.4%;
  width: 13.8%;
  transform: rotate(11deg);
}

.page-left {
  top: 47.2%;
  left: 3.7%;
  width: 15.8%;
  transform: rotate(-12deg);
}

.letter {
  z-index: 12;
  filter:
    drop-shadow(0 0.55vmin 0.35vmin rgba(0, 0, 0, 0.46))
    drop-shadow(0 0 0.55vmin rgba(255, 181, 64, 0.42));
}

.letter-b {
  top: 4.5%;
  left: 3.7%;
  width: 11.5%;
  transform: rotate(-6deg);
}

.letter-e {
  top: 18.1%;
  left: 15.8%;
  width: 10.4%;
  transform: rotate(-10deg);
}

.letter-f {
  bottom: 15.4%;
  left: -0.9%;
  width: 10.5%;
  transform: rotate(-4deg);
}

.letter-c {
  top: 4.2%;
  right: 13.6%;
  width: 10.6%;
  transform: rotate(8deg);
}

.letter-h {
  top: 8%;
  right: -1%;
  width: 13.6%;
  transform: rotate(10deg);
}

.letter-g {
  top: 49.8%;
  right: 1%;
  width: 12%;
  transform: rotate(-5deg);
}

.letter-d {
  bottom: 5.4%;
  right: -1.5%;
  width: 11.5%;
  transform: rotate(8deg);
}

.hero {
  z-index: 18;
  filter:
    drop-shadow(0 1.2vmin 0.7vmin rgba(0, 0, 0, 0.54))
    drop-shadow(0 0 1.6vmin rgba(58, 126, 255, 0.17));
  animation: character-rise 900ms ease-out both;
}

.hero-boy {
  bottom: -1.4%;
  left: 14.7%;
  width: 35.2%;
  animation-delay: 90ms;
}

.hero-girl {
  right: 10.9%;
  bottom: -1.2%;
  width: 37.8%;
  animation-delay: 170ms;
}

.cat {
  z-index: 19;
  bottom: -4.2%;
  left: 4.2%;
  width: 21.2%;
  filter:
    drop-shadow(0 1vmin 0.62vmin rgba(0, 0, 0, 0.48))
    drop-shadow(0 0 0.9vmin rgba(255, 228, 170, 0.25));
  animation: character-rise 780ms ease-out 260ms both;
}

.start-button {
  right: 35.8%;
  bottom: 15.1%;
  z-index: 30;
  width: 28%;
  border: 0;
  line-height: 0;
  transform-origin: center;
  filter:
    drop-shadow(0 1.15vmin 0.7vmin rgba(0, 0, 0, 0.52))
    drop-shadow(0 0 1.6vmin rgba(255, 185, 55, 0.36));
  animation: button-breathe 1.8s ease-in-out infinite;
}

.start-button img {
  display: block;
  width: 100%;
}

.start-button::before {
  position: absolute;
  inset: 15% 9% 14%;
  content: "";
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 214, 111, 0.25), transparent 68%);
  opacity: 0;
  transition: opacity 180ms ease;
}

.start-button:hover::before,
.start-button:focus-visible::before {
  opacity: 1;
}

.start-button:hover {
  animation-duration: 1.05s;
}

.start-button:focus-visible {
  outline: 0.35vmin solid rgba(255, 236, 161, 0.95);
  outline-offset: 0.6vmin;
}

.glint {
  position: absolute;
  z-index: 28;
  width: 2.2%;
  aspect-ratio: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 44%, rgba(255, 246, 193, 0.96) 48% 52%, transparent 56%),
    linear-gradient(0deg, transparent 44%, rgba(255, 246, 193, 0.96) 48% 52%, transparent 56%);
  filter: drop-shadow(0 0 0.5vmin rgba(255, 211, 80, 0.85));
  transform: rotate(45deg) scale(0.8);
  animation: glint 2.8s ease-in-out infinite;
}

.glint-one {
  left: 51.3%;
  top: 12.3%;
}

.glint-two {
  left: 62.2%;
  bottom: 25.3%;
  animation-delay: 900ms;
}

.glint-three {
  right: 8.2%;
  top: 55%;
  animation-delay: 1.5s;
}

.float-slow {
  animation: float-y 5.8s ease-in-out infinite;
}

.float-mid {
  animation: float-y 4.8s ease-in-out infinite;
}

.float-fast {
  animation: float-y 3.9s ease-in-out infinite;
}

@keyframes title-arrive {
  from {
    opacity: 0;
    transform: translateY(-4%) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes character-rise {
  from {
    opacity: 0;
    transform: translateY(5%) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes button-breathe {
  0%,
  100% {
    transform: scale(1);
    filter:
      drop-shadow(0 1.15vmin 0.7vmin rgba(0, 0, 0, 0.52))
      drop-shadow(0 0 1.3vmin rgba(255, 185, 55, 0.32));
  }
  50% {
    transform: scale(1.045);
    filter:
      drop-shadow(0 1.3vmin 0.75vmin rgba(0, 0, 0, 0.5))
      drop-shadow(0 0 2.4vmin rgba(255, 214, 88, 0.62));
  }
}

@keyframes float-y {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -2.1%;
  }
}

@keyframes glint {
  0%,
  63%,
  100% {
    opacity: 0;
    transform: rotate(45deg) scale(0.2);
  }
  72% {
    opacity: 1;
    transform: rotate(45deg) scale(1);
  }
  82% {
    opacity: 0;
    transform: rotate(45deg) scale(1.45);
  }
}

@keyframes twinkle {
  from {
    opacity: 0.44;
  }
  to {
    opacity: 0.9;
  }
}

@media (max-aspect-ratio: 1537 / 1023) {
  .stage {
    width: auto;
    height: 100vh;
  }
}

@media (max-width: 760px) and (orientation: portrait) {
  .viewport {
    background: #05091f;
  }

  .stage {
    width: 100vw;
    height: 100vh;
    aspect-ratio: auto;
    background-size: auto 112%;
    background-position: 50% 43%;
    box-shadow: none;
  }

  .stage::before {
    background:
      radial-gradient(circle at 50% 40%, rgba(66, 127, 255, 0.42), transparent 21%),
      radial-gradient(circle at 50% 62%, rgba(255, 168, 73, 0.16), transparent 24%),
      linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(3, 6, 25, 0.04) 62%, rgba(2, 4, 12, 0.34));
  }

  .title {
    top: 15.3%;
    left: 6%;
    width: 88%;
    z-index: 24;
  }

  .balloon {
    top: 9.8%;
    left: 17.5%;
    width: 19%;
    z-index: 15;
  }

  .book-left {
    top: 31.6%;
    left: -4%;
    width: 23%;
  }

  .book-right {
    top: 35.7%;
    right: -4.5%;
    width: 19%;
  }

  .page-left {
    top: 44%;
    left: 1.5%;
    width: 21%;
  }

  .letter-b {
    top: 8.5%;
    left: 2.8%;
    width: 15.5%;
    z-index: 26;
  }

  .letter-e {
    top: 20.3%;
    left: -0.8%;
    width: 14.4%;
    z-index: 26;
  }

  .letter-f {
    left: 3.8%;
    bottom: 3.2%;
    width: 14.8%;
    z-index: 34;
  }

  .letter-c {
    top: 8.5%;
    right: 6%;
    width: 14.8%;
    z-index: 26;
  }

  .letter-h {
    top: 18.4%;
    right: 0.4%;
    width: 12.6%;
    z-index: 26;
  }

  .letter-g {
    top: 50%;
    right: 1.6%;
    width: 15.2%;
    z-index: 26;
  }

  .letter-d {
    right: 6%;
    bottom: 18.2%;
    width: 15.2%;
    z-index: 26;
  }

  .hero-boy {
    left: -3.5%;
    bottom: 20.2%;
    width: 56%;
    z-index: 18;
  }

  .hero-girl {
    right: -4.8%;
    bottom: 19%;
    width: 57%;
    z-index: 18;
  }

  .cat {
    left: -1.6%;
    bottom: 14.8%;
    width: 29.5%;
    z-index: 21;
  }

  .start-button {
    left: 19%;
    right: auto;
    bottom: 3.4%;
    width: 62%;
    z-index: 32;
  }

  .glint-one {
    left: 53%;
    top: 33%;
  }

  .glint-two {
    left: 77%;
    bottom: 29%;
  }

  .glint-three {
    right: 6%;
    top: 50%;
  }
}

@media (max-width: 760px) and (orientation: landscape) {
  .stage {
    width: 100vw;
    height: auto;
  }
}

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

