* {
  box-sizing: border-box;
}

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

.landing {
  --viewport-height: 100vh;
  --backdrop: url('../images/kuake/pc/backdrop.webp?v=20261121-4');
  width: 100%;
  height: var(--viewport-height);
  background: #f3c7ef var(--backdrop) center / cover no-repeat;
}

@supports (height: 100dvh) {
  .landing {
    --viewport-height: 100dvh;
  }
}

.landing--mobile {
  --backdrop: url('../images/kuake/h5/backdrop.webp?v=20261121-4');
}

.landing__stage {
  position: relative;
  width: 100%;
  height: 100%;
  --qr-width: min(40.4167vw, calc(var(--viewport-height) * 776 / 1080));
}

.landing__logo,
.landing__art,
.landing__title {
  position: absolute;
  display: block;
  pointer-events: none;
}

.landing__logo {
  top: 4.4444%;
  left: 3.2292%;
  width: min(15%, calc(var(--viewport-height) * 0.29));
}

.landing__art {
  right: 3.2292%;
  bottom: 0;
  width: 46.5625%;
  height: 88.4259%;
  object-fit: contain;
  object-position: right bottom;
}

.landing__title {
  top: 23.0556%;
  left: 5.8333%;
  width: min(38.0208%, calc(var(--viewport-height) * 730 / 1080));
}

.landing__nav {
  position: absolute;
  top: 3.7037%;
  right: 3.2292%;
  width: min(38.75%, calc(var(--viewport-height) * 744 / 1080));
  display: flex;
  align-items: start;
  justify-content: space-between;
}

.landing__nav button,
.landing__downloads button {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.landing__nav button {
  width: 29.8387%;
}

.landing__nav img,
.landing__downloads img {
  display: block;
  width: 100%;
  height: auto;
}

.landing__stage button:focus-visible {
  outline: 2px solid #501574;
  outline-offset: 2px;
}

.landing__qr {
  position: absolute;
  top: 58.8889%;
  left: 4.9479%;
  width: var(--qr-width);
  aspect-ratio: 776 / 319;
  margin: 0;
  background: url('../images/kuake/pc/qr-card.webp?v=20261121-4') center / contain no-repeat;
}

#qrcode {
  position: absolute;
  top: 17.24%;
  left: 9.54%;
  display: grid;
  place-items: center;
  width: 25.26%;
  height: 61.45%;
  background: #fff;
  border-radius: 4%;
}

#qrcode canvas,
#qrcode table {
  display: block !important;
  width: 84%;
  height: auto;
  image-rendering: pixelated;
}

#qrcode table {
  display: table !important;
  aspect-ratio: 1;
}

#qrcode img {
  display: none !important;
}

.landing__qr figcaption {
  position: absolute;
  top: 45%;
  left: 41.75%;
  width: 40%;
  color: #50154e;
  font: 400 calc(var(--qr-width) * 0.0285) / 1.45 system-ui, sans-serif;
}

.landing--mobile .landing__stage {
  --nav-width: min(38vw, calc(var(--viewport-height) * 0.4));
  --download-width: min(92.9334vw, calc(var(--viewport-height) * 0.65));
  --download-height: calc(var(--download-width) * 0.477077 * 110 / 333);
  --download-bottom: max(env(safe-area-inset-bottom, 0px), clamp(3%, calc(16% - 16vw), 8.5591%));
  --title-width: min(83.3333vw, calc(var(--viewport-height) * 0.49));
  --title-height: calc(var(--title-width) * 291 / 625);
  /* 先给下载按钮和标题留出空间，主视觉再按剩余高度缩放。 */
  --title-bottom: max(20.4433%, calc(var(--download-bottom) + var(--download-height) + 12px));
  --art-top: max(12.8079%, calc(1.601% + var(--nav-width) * 0.32 + 8px));
  --art-bottom: calc(var(--title-bottom) + var(--title-height) - 1.05%);
}

.landing--mobile .landing__logo {
  top: 2.0936%;
  left: 3.7333%;
  width: min(33.4667%, calc(var(--viewport-height) * 0.29));
}

.landing--mobile .landing__art {
  top: var(--art-top);
  right: 0;
  bottom: auto;
  width: 100%;
  height: calc(100% - var(--art-top) - var(--art-bottom));
  object-position: center bottom;
}

.landing--mobile .landing__title {
  top: auto;
  bottom: var(--title-bottom);
  left: 49.2667%;
  width: var(--title-width);
  transform: translateX(-50%);
}

.landing--mobile .landing__nav {
  top: 1.601%;
  right: 5.0667%;
  width: var(--nav-width);
}

.landing--mobile .landing__nav button {
  width: 29.474%;
}

.landing__downloads {
  position: absolute;
  bottom: var(--download-bottom);
  left: 50%;
  width: var(--download-width);
  transform: translateX(-50%);
  display: flex;
  align-items: start;
  justify-content: space-between;
}

.landing__downloads button {
  width: 47.7077%;
}

@media (orientation: landscape) {
  .landing--mobile .landing__art {
    top: 17%;
    right: 4%;
    width: 46%;
    height: 80%;
    object-position: center bottom;
  }

  .landing--mobile .landing__title {
    top: 28%;
    bottom: auto;
    left: 6%;
    width: min(40%, calc(var(--viewport-height) * 0.68));
    transform: none;
  }

  .landing--mobile .landing__downloads {
    bottom: max(14%, env(safe-area-inset-bottom, 0px));
    left: 6%;
    width: min(43%, calc(var(--viewport-height) * 0.72));
    transform: none;
  }
}
