:root {
  --stage-width: 320;
  --stage-height: 486;
  --stage-scale: 1;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #121212;
  font-family: Arial, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.viewport {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.08), transparent 32%),
    #111;
}

.stage-shell {
  width: calc(var(--stage-width) * var(--stage-scale) * 1px);
  height: calc(var(--stage-height) * var(--stage-scale) * 1px);
}

.stage {
  position: relative;
  width: calc(var(--stage-width) * 1px);
  height: calc(var(--stage-height) * 1px);
  overflow: hidden;
  background: #fff;
  transform: scale(var(--stage-scale));
  transform-origin: left top;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
  user-select: none;
}

.page {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #fff;
  animation: pageIn 240ms ease-out both;
}

.layer {
  position: absolute;
  transform-origin: center center;
  animation-fill-mode: both;
}

.text-layer {
  display: flex;
  align-items: center;
  margin: 0;
  overflow: visible;
  word-break: break-word;
  overflow-wrap: break-word;
}

.text-content {
  width: 100%;
}

.image-layer {
  overflow: hidden;
}

.image-layer img,
.shape-layer img {
  position: absolute;
  display: block;
  max-width: none;
  user-select: none;
  pointer-events: none;
}

.shape-layer {
  overflow: hidden;
}

.field-layer,
.textarea-layer,
.phone-layer input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: none;
  color: #676767;
  background: #fff;
  padding: 0 10px;
}

.textarea-layer {
  resize: none;
  padding-top: 8px;
}

.phone-layer {
  background: transparent;
}

.phone-layer .phone-input {
  position: absolute;
  top: 0;
  left: 0;
  height: 36px;
  width: 100%;
  background: transparent;
  font-size: 14px;
  color: #676767;
}

.phone-layer .code-row {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 36px;
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 8px;
  align-items: stretch;
}

.phone-layer .code-row input {
  background: transparent;
  padding: 0 8px;
  font-size: 14px;
}

.phone-layer .code-row button {
  border: 0;
  border-radius: 4px;
  background: #fff;
  color: #676767;
  font-size: 12px;
}

.submit-layer {
  border: 0;
  background: #000;
  color: #fff;
  text-align: center;
  cursor: pointer;
}

.barrage-layer {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 4px;
}

.barrage-layer span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #000;
  color: #fff;
  font-size: 12px;
  line-height: 1;
}

.avatar-wall {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
  align-content: start;
}

.avatar-wall span {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.9);
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
}

.map-layer {
  background: #f7fbf4;
  border: 2px solid #111;
  overflow: hidden;
}

.map-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 21px, #f2cf5a 21px 26px, transparent 26px 56px),
    linear-gradient(0deg, transparent 0 18px, #f2cf5a 18px 23px, transparent 23px 49px),
    linear-gradient(90deg, transparent 0 74px, rgba(92, 172, 221, 0.5) 74px 80px, transparent 80px),
    #edf7e8;
  opacity: 0.88;
}

.map-pin {
  position: absolute;
  left: 96px;
  top: 37px;
  width: 25px;
  height: 25px;
  border-radius: 50% 50% 50% 0;
  background: #2a8be7;
  transform: rotate(-45deg);
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.25);
}

.map-pin::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #fff;
}

.map-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 11px;
  color: #333;
  text-align: center;
  font-size: 14px;
  line-height: 1.2;
}

.map-name small {
  display: block;
  margin-top: 3px;
  color: #999;
  font-size: 12px;
}

.map-route {
  position: absolute;
  right: 20px;
  bottom: 31px;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1f77ff;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.nav-button {
  position: fixed;
  z-index: 5;
  left: 50%;
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  opacity: 0.82;
  transform: translateX(-50%);
  cursor: pointer;
}

.nav-button::before {
  content: "";
  position: absolute;
  inset: 13px;
  border-right: 2px solid rgba(255, 255, 255, 0.9);
  border-bottom: 2px solid rgba(255, 255, 255, 0.9);
}

.nav-button--prev {
  top: 16px;
}

.nav-button--prev::before {
  transform: rotate(225deg);
}

.nav-button--next {
  bottom: 16px;
  animation: arrowFloat 1.35s ease-in-out infinite;
}

.nav-button--next::before {
  transform: rotate(45deg);
}

.page-count {
  position: fixed;
  z-index: 5;
  top: 12px;
  right: 14px;
  min-width: 42px;
  padding: 3px 7px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.36);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  text-align: center;
}

@keyframes pageIn {
  from {
    opacity: 0.4;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes elementFade {
  from {
    opacity: 0;
  }
  to {
    opacity: var(--target-opacity, 1);
  }
}

@keyframes elementSlide {
  from {
    opacity: 0;
    transform: translateX(-24px) var(--layer-transform, none);
  }
  to {
    opacity: var(--target-opacity, 1);
    transform: var(--layer-transform, none);
  }
}

@keyframes arrowFloat {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-7px);
  }
}

@media (max-width: 520px) {
  .stage {
    box-shadow: none;
  }

  .viewport {
    background: #000;
  }
}
