:root {
  color-scheme: dark;
  --ink: #f2ece7;
  --ink-soft: rgba(242, 236, 231, 0.78);
  --shadow: rgba(7, 7, 9, 0.55);
  --accent: rgba(255, 255, 255, 0.8);
  --veil-strong: rgba(255, 255, 255, 0.3);
  --veil-soft: rgba(255, 255, 255, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Iowan Old Style", "Palatino Linotype", "Source Han Serif SC", "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
  background: #15171d;
  color: var(--ink);
  overflow: hidden;
}

button {
  font-family: inherit;
}

.intro {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 20% 20%, #2b3241 0%, #1c2029 55%, #14151b 100%);
  transition: opacity 1.2s ease;
  z-index: 2;
}

.start {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 1rem;
  letter-spacing: 0.32em;
  cursor: pointer;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.start:active {
  transform: scale(0.98);
}

.start:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.4);
  outline-offset: 4px;
}

.stage {
  position: fixed;
  inset: 0;
  --bg-image: radial-gradient(circle at 30% 20%, #2f3a4b 0%, #1f2430 55%, #15171d 100%);
  background-image: linear-gradient(180deg, var(--veil-strong) 0%, var(--veil-soft) 100%), var(--bg-image);
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.4s ease;
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.35) 100%);
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.12'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  opacity: 0.25;
}

.lights {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.lights span {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  height: var(--size);
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.9) 0%, rgba(255, 190, 205, 0.6) 45%, rgba(255, 190, 205, 0) 70%);
  box-shadow: 0 0 18px rgba(255, 220, 230, 0.5);
  opacity: 0.75;
  animation: float var(--dur) ease-in-out infinite;
  animation-delay: var(--delay);
}

.caption {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);
  transform: translate(var(--tx, -50%), var(--ty, -50%));
  max-width: min(90vw, 520px);
  color: var(--ink-soft);
  font-size: clamp(1.8rem, 6.6vw, 3.4rem);
  line-height: 2.05;
  letter-spacing: 0.05em;
  font-weight: 500;
  text-align: center;
  white-space: pre-line;
  text-shadow: 0 26px 50px rgba(4, 4, 8, 0.78), 0 2px 10px rgba(6, 6, 10, 0.65);
  -webkit-text-stroke: 1px rgba(8, 8, 12, 0.45);
  opacity: 0;
  transition: opacity 2.2s ease, transform 2.2s ease;
  z-index: 1;
}

.caption.active {
  opacity: 1;
  transform: translate(var(--tx, -50%), calc(var(--ty, -50%) - 6px));
}

.caption.vertical {
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 0.18em;
}

.greeting {
  position: absolute;
  left: 50%;
  bottom: 10vh;
  transform: translateX(-50%);
  color: var(--ink);
  font-size: clamp(2.1rem, 7.2vw, 3.8rem);
  letter-spacing: 0.2em;
  text-shadow: 0 30px 60px rgba(0, 0, 0, 0.65), 0 2px 10px rgba(0, 0, 0, 0.55);
  -webkit-text-stroke: 1px rgba(10, 10, 14, 0.45);
  opacity: 0;
  transition: opacity 2.4s ease;
  z-index: 1;
}

body.started .intro {
  opacity: 0;
  pointer-events: none;
}

body.started .stage {
  opacity: 1;
  pointer-events: auto;
}

body.ended .greeting {
  opacity: 1;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(12px, -18px) scale(1.1);
  }
  100% {
    transform: translate(-8px, 14px) scale(0.95);
  }
}

@media (max-width: 480px) {
  .caption {
    max-width: 88vw;
    line-height: 1.8;
  }
}

@media (prefers-reduced-motion: reduce) {
  .intro,
  .stage,
  .caption,
  .lights span {
    transition: none;
    animation: none;
  }
}
