:root {
  font-family: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
  color: #f7f3e9;
  background: #111718;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #111718;
}

body { cursor: none; }

#world {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.atmosphere {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 70% 17%, rgba(255, 233, 187, .16), transparent 30%),
    radial-gradient(ellipse at 50% 92%, rgba(255, 219, 166, .045), transparent 40%),
    linear-gradient(to bottom, rgba(239, 245, 235, .028), rgba(5, 12, 17, .115));
  mix-blend-mode: screen;
}

.caption {
  position: absolute;
  left: 7.5vw;
  top: 11.8vh;
  width: min(900px, 68vw);
  min-height: 6.5rem;
  color: rgba(252, 247, 235, .97);
  font-size: clamp(28px, 2.22vw, 40px);
  line-height: 1.56;
  font-weight: 500;
  letter-spacing: .022em;
  white-space: pre-line;
  text-wrap: pretty;
  word-break: keep-all;
  overflow-wrap: normal;
  line-break: strict;
  text-shadow:
    0 2px 22px rgba(6, 11, 14, .68),
    0 1px 4px rgba(6, 11, 14, .42);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 950ms ease, transform 1250ms cubic-bezier(.2,.7,.2,1);
  pointer-events: none;
}

.caption.visible {
  opacity: 1;
  transform: translateY(0);
}

.caption.final {
  top: 12.5vh;
  width: min(940px, 71vw);
  font-size: clamp(30px, 2.42vw, 44px);
  line-height: 1.54;
}

.opening {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(250, 246, 235, .82);
  font-size: clamp(15px, 1.28vw, 21px);
  letter-spacing: .58em;
  opacity: 1;
  transition: opacity 1300ms ease;
  pointer-events: none;
}

.opening.hidden { opacity: 0; }

.qa-freeze .caption,
.qa-freeze .opening {
  transition: none !important;
}

.grain {
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  opacity: .038;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.75'/%3E%3C/svg%3E");
  animation: grain .28s steps(2) infinite;
  mix-blend-mode: soft-light;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow:
    inset 0 0 11vw rgba(4, 8, 9, .2),
    inset 0 -12vh 18vh rgba(4, 8, 9, .12),
    inset 0 7vh 14vh rgba(4, 8, 9, .045);
}

@keyframes grain {
  0% { transform: translate3d(-2%, 1%, 0); }
  25% { transform: translate3d(1%, -2%, 0); }
  50% { transform: translate3d(2%, 2%, 0); }
  75% { transform: translate3d(-1%, 2%, 0); }
  100% { transform: translate3d(-2%, 1%, 0); }
}

@media (max-width: 760px) {
  .caption {
    left: 8vw;
    top: 10vh;
    width: 84vw;
    font-size: clamp(22px, 5.6vw, 32px);
    line-height: 1.56;
  }

  .caption.final {
    top: 10vh;
    width: 84vw;
    font-size: clamp(24px, 6vw, 34px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
}
