:root {
  color-scheme: dark;
  --night: #0b1222;
  --night-soft: #172342;
  --ink: #fffaf0;
  --muted: rgba(255, 250, 240, 0.7);
  --paper: #f7ecd6;
  --paper-deep: #ead8b8;
  --paper-ink: #281b20;
  --paper-muted: #6f625c;
  --gold: #e7bd68;
  --rose: #db91a5;
  --line: rgba(231, 189, 104, 0.34);
  --serif: Georgia, "Times New Roman", "Songti SC", SimSun, serif;
  --display: "STKaiti", "KaiTi", "FangSong", "Songti SC", serif;
  --sans: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --shadow: 0 32px 90px rgba(2, 7, 17, 0.44);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--night);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  background: var(--night);
  overflow: hidden;
}

button {
  font: inherit;
}

img {
  display: block;
  width: 100%;
}

.scene {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 3vw, 2.5rem);
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 22%, rgba(219, 145, 165, 0.16), transparent 25rem),
    radial-gradient(circle at 83% 12%, rgba(106, 161, 175, 0.14), transparent 24rem),
    linear-gradient(145deg, #090f1d 0%, #12203d 58%, #251c33 100%);
}

.scene::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  opacity: 0.32;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.88) 0 1px, transparent 1.4px),
    radial-gradient(circle, rgba(231, 189, 104, 0.6) 0 1px, transparent 1.5px);
  background-position: 0 0, 46px 52px;
  background-size: 104px 104px, 158px 158px;
}

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

.moon {
  position: absolute;
  top: 7%;
  right: 7%;
  width: clamp(5rem, 9vw, 7.5rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff7c9, #edc56f 70%, #b97538);
  box-shadow: 0 0 70px rgba(231, 189, 104, 0.28);
  opacity: 0.9;
}

.moon::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: #14213e;
  transform: translateX(38%);
}

.trail {
  position: absolute;
  left: 8%;
  top: 19%;
  width: clamp(12rem, 24vw, 21rem);
  height: clamp(4rem, 8vw, 7rem);
  border-top: 1px solid rgba(231, 189, 104, 0.52);
  border-radius: 50%;
  transform: rotate(-14deg);
  opacity: 0.72;
}

.trail::after {
  content: "✦";
  position: absolute;
  right: -0.4rem;
  top: -0.75rem;
  color: var(--gold);
  font-size: 0.9rem;
  text-shadow: 0 0 18px rgba(231, 189, 104, 0.82);
}

.art-sticker {
  position: absolute;
  width: clamp(5rem, 9vw, 7.4rem);
  height: auto;
  object-fit: contain;
  opacity: 0.74;
  filter: drop-shadow(0 14px 25px rgba(0, 0, 0, 0.2));
}

.art-cat {
  left: 3%;
  bottom: 5%;
  transform: rotate(-7deg);
}

.art-fish {
  right: 5%;
  bottom: 7%;
  width: clamp(4.4rem, 8vw, 6.5rem);
  transform: rotate(6deg);
}

.scene.is-book-open .art-sticker {
  opacity: 0.28;
}

.star {
  position: absolute;
  width: 0.3rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff5c8;
  box-shadow: 0 0 16px rgba(255, 245, 200, 0.85);
  animation: twinkle 4.8s ease-in-out infinite;
}

.star-a { left: 20%; top: 12%; }
.star-b { left: 33%; top: 27%; animation-delay: 0.8s; }
.star-c { right: 27%; top: 29%; animation-delay: 1.6s; }
.star-d { left: 12%; bottom: 21%; animation-delay: 2.4s; }
.star-e { right: 19%; bottom: 13%; animation-delay: 3.2s; }

.cover,
.book {
  position: relative;
  z-index: 2;
}

.cover {
  width: min(620px, calc(100vw - 2rem));
  min-height: min(76svh, 610px);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1rem;
  padding: clamp(1.4rem, 4vw, 3rem);
  border: 1px solid rgba(231, 189, 104, 0.46);
  border-radius: 4px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(4, 8, 16, 0.26), rgba(4, 8, 16, 0.72)),
    url("../Pictures/3b86f7a94990fdc50c5d924b342ea642.jpg") center 35% / cover;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: opacity 0.55s ease, transform 0.55s ease, visibility 0.55s ease;
}

.cover::before {
  content: "";
  position: absolute;
  inset: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  pointer-events: none;
}

.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 50% 48%, transparent 12%, rgba(1, 4, 10, 0.2) 72%);
}

.cover.is-hidden {
  position: absolute;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.985);
  pointer-events: none;
}

.cover-sticker {
  position: absolute;
  z-index: 1;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.28));
  pointer-events: none;
}

.cover-sticker-book {
  left: clamp(0.7rem, 3vw, 1.7rem);
  bottom: clamp(0.8rem, 3vw, 1.6rem);
  width: clamp(5rem, 14vw, 8.6rem);
  transform: rotate(-7deg);
}

.cover-sticker-bow {
  right: clamp(0.7rem, 3vw, 1.5rem);
  top: clamp(0.8rem, 3vw, 1.5rem);
  width: clamp(5rem, 13vw, 8rem);
  transform: rotate(6deg);
}

.cover__date,
.eyebrow {
  margin: 0;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.cover h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(4.2rem, 10vw, 7.3rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 16px 38px rgba(0, 0, 0, 0.54);
}

.cover p:not(.cover__date) {
  max-width: 29rem;
  margin: 0;
  color: rgba(255, 250, 240, 0.86);
  font-size: clamp(1rem, 1.7vw, 1.16rem);
  line-height: 1.8;
}

.start-button,
.nav-button,
.music-chip,
.replay-button {
  border: 1px solid rgba(231, 189, 104, 0.48);
  color: var(--ink);
  background: rgba(8, 14, 27, 0.78);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.26);
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.start-button:hover,
.nav-button:hover,
.music-chip:hover,
.replay-button:hover {
  transform: translateY(-2px);
  border-color: rgba(231, 189, 104, 0.9);
  background: rgba(22, 30, 49, 0.92);
}

.start-button:focus-visible,
.nav-button:focus-visible,
.music-chip:focus-visible,
.replay-button:focus-visible {
  outline: 2px solid #fff4bf;
  outline-offset: 3px;
}

.start-button {
  min-height: 3rem;
  margin-top: 0.65rem;
  padding: 0 1.35rem;
  border-radius: 999px;
  font-weight: 700;
}

.book {
  position: absolute;
  left: 50%;
  width: min(980px, calc(100vw - 20rem));
  height: min(720px, calc(100svh - 3rem));
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) perspective(1400px) rotateX(4deg) scale(0.975);
  transition: opacity 0.6s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.6s ease;
}

.book.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) perspective(1400px) rotateX(0) scale(1);
}

.scene.is-book-open .book {
  left: clamp(2rem, 6vw, 5rem);
  transform: perspective(1400px) rotateX(0) scale(1);
}

.page-card {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(18rem, 0.92fr) minmax(20rem, 1fr);
  gap: clamp(1.2rem, 3vw, 2.6rem);
  align-items: center;
  padding: clamp(1.4rem, 3vw, 2.6rem);
  border: 1px solid rgba(132, 102, 58, 0.26);
  border-radius: 3px 7px 7px 3px;
  color: var(--paper-ink);
  background:
    radial-gradient(circle at 12% 16%, rgba(255, 255, 255, 0.48), transparent 24%),
    repeating-linear-gradient(0deg, rgba(90, 65, 37, 0.018) 0 1px, transparent 1px 5px),
    linear-gradient(90deg, #f8edd8 0 49.4%, #e8d4b1 49.8%, #f3e5ca 50.4%, #f8edd8 100%);
  box-shadow: var(--shadow), inset 0 0 70px rgba(130, 88, 37, 0.06);
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: perspective(1200px) rotateY(-5deg) translateX(1.2rem);
  transform-origin: center;
  transition: opacity 0.38s ease, transform 0.52s cubic-bezier(0.22, 1, 0.36, 1);
}

.page-card::before {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 42px rgba(89, 60, 31, 0.08);
  pointer-events: none;
}

.page-card::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(50% - 0.45rem);
  width: 0.9rem;
  background: linear-gradient(90deg, rgba(61, 42, 29, 0.12), rgba(255, 255, 255, 0.28), rgba(61, 42, 29, 0.09));
  opacity: 0.7;
  pointer-events: none;
}

.page-card.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: perspective(1200px) rotateY(0) translateX(0);
}

.photo-frame {
  width: min(100%, 25rem);
  justify-self: center;
  padding: 0.58rem 0.58rem 1rem;
  background: #fffaf0;
  box-shadow: 0 18px 45px rgba(42, 28, 33, 0.2);
  transform: rotate(-1.5deg);
}

.photo-frame img {
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.page-copy {
  position: relative;
  z-index: 2;
}

.page-copy h2,
.final-card h2 {
  margin: 0.7rem 0 0;
  font-family: var(--display);
  font-size: clamp(2.65rem, 5vw, 4.7rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0;
}

.page-copy p:not(.eyebrow),
.final-card p:not(.eyebrow) {
  max-width: 29rem;
  margin: 1.15rem 0 0;
  color: var(--paper-muted);
  font-family: var(--sans);
  font-size: clamp(0.98rem, 1.45vw, 1.1rem);
  font-weight: 500;
  line-height: 1.9;
}

.page-copy--wide {
  padding-left: clamp(0rem, 2vw, 1rem);
}

.page-art {
  position: absolute;
  z-index: 3;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 20px rgba(42, 28, 33, 0.14));
  pointer-events: none;
}

.page-art-moon {
  right: 5%;
  top: 5%;
  width: clamp(4.4rem, 9vw, 7rem);
  transform: rotate(7deg);
}

.page-art-cat {
  right: 5%;
  top: 4%;
  width: clamp(5rem, 11vw, 8.5rem);
  transform: rotate(-5deg);
}

.page-art-wand {
  left: 3%;
  top: 4%;
  width: clamp(5rem, 11vw, 8rem);
  transform: rotate(-12deg);
}

.page-art-crown-cat {
  left: 4%;
  bottom: 5%;
  width: clamp(5rem, 10vw, 8rem);
  transform: rotate(-7deg);
}

.page-art-fish {
  right: 4%;
  bottom: 6%;
  width: clamp(4.2rem, 9vw, 7rem);
  transform: rotate(7deg);
}

.stamp-stack {
  position: relative;
  min-height: 27rem;
}

.stamp-stack img {
  position: absolute;
  width: min(64%, 17rem);
  aspect-ratio: 1;
  object-fit: cover;
  padding: 0.48rem 0.48rem 1rem;
  background: #fffaf0;
  box-shadow: 0 16px 38px rgba(42, 28, 33, 0.2);
}

.stamp-stack img:first-child {
  left: 3%;
  top: 8%;
  transform: rotate(-5deg);
}

.stamp-stack img:last-child {
  right: 4%;
  bottom: 6%;
  transform: rotate(6deg);
}

.gallery-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.58rem;
  align-items: center;
}

.gallery-strip img {
  height: clamp(18rem, 44vh, 29rem);
  object-fit: cover;
  border: 0.42rem solid #fffaf0;
  box-shadow: 0 13px 30px rgba(42, 28, 33, 0.18);
}

.gallery-strip img:nth-child(1) { transform: rotate(-1.5deg); }
.gallery-strip img:nth-child(2) { transform: translateY(-0.8rem); }
.gallery-strip img:nth-child(3) {
  transform: rotate(1.5deg);
  object-position: 78% center;
}

.wish-photo {
  width: min(78%, 22rem);
  margin: 0;
  justify-self: end;
  padding: 0.55rem 0.55rem 1.4rem;
  background: #fffaf0;
  box-shadow: 0 18px 45px rgba(42, 28, 33, 0.19);
  transform: rotate(3deg);
}

.wish-photo img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.final-card {
  position: relative;
  z-index: 2;
  width: min(34rem, 100%);
  padding: clamp(1rem, 3vw, 2.4rem);
  text-align: left;
}

.final-card p:not(.eyebrow) {
  max-width: 27rem;
}

.controls {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  z-index: 5;
  display: inline-grid;
  grid-template-columns: 2.75rem auto 2.75rem;
  gap: 0.65rem;
  align-items: center;
  transform: translateX(-50%);
}

.nav-button {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  font-family: var(--sans);
  font-size: 1.7rem;
  line-height: 1;
}

.nav-button:disabled {
  opacity: 0.32;
  cursor: default;
  transform: none;
}

.nav-button.is-finish {
  width: auto;
  min-width: 7.5rem;
  padding: 0 1rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.controls:has(.nav-button.is-finish) {
  grid-template-columns: 2.75rem auto auto;
}

.dots {
  display: inline-flex;
  gap: 0.4rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(231, 189, 104, 0.32);
  border-radius: 999px;
  background: rgba(8, 14, 27, 0.78);
  backdrop-filter: blur(12px);
}

.dots span {
  width: 0.4rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 250, 240, 0.35);
}

.dots span.is-active {
  background: var(--gold);
  box-shadow: 0 0 12px rgba(231, 189, 104, 0.68);
}

.music-chip {
  position: fixed;
  right: 1rem;
  top: 1rem;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.55rem;
  padding: 0 0.9rem;
  border-radius: 999px;
}

.music-chip.needs-tap {
  border-color: rgba(219, 145, 165, 0.9);
}

.lyric-ribbon {
  position: fixed;
  right: clamp(1rem, 3vw, 2.5rem);
  top: 50%;
  z-index: 6;
  width: clamp(10.5rem, 15vw, 13rem);
  padding: 0.2rem;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-45%);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.scene.is-book-open .lyric-ribbon {
  opacity: 0.86;
  transform: translateY(-50%);
}

.scene:not(.is-book-open) .lyric-ribbon {
  opacity: 0;
}

.lyric-ribbon.is-quiet {
  opacity: 0.48;
}

.lyric-ribbon__glow {
  position: absolute;
  inset: -2rem;
  z-index: -1;
  background: radial-gradient(circle, rgba(231, 189, 104, 0.11), transparent 66%);
  filter: blur(8px);
}

.lyric-ribbon__meta {
  margin-bottom: 0.7rem;
  color: rgba(231, 189, 104, 0.78);
  font-family: var(--serif);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  line-height: 1.4;
  text-transform: uppercase;
}

.lyric-window {
  height: 6.2rem;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, transparent, #000 24%, #000 76%, transparent);
}

.lyric-list {
  transform: translateY(0);
  transition: transform 0.48s ease;
}

.lyric-line {
  display: flex;
  align-items: center;
  min-height: 1.45rem;
  margin: 0;
  color: rgba(255, 250, 240, 0.34);
  font-family: var(--serif);
  font-size: 0.84rem;
  line-height: 1.35;
  transition: color 0.3s ease, transform 0.3s ease;
}

.lyric-line.is-near {
  color: rgba(255, 250, 240, 0.54);
}

.lyric-line.is-active {
  color: #fffaf0;
  font-weight: 700;
  transform: translateX(0.35rem);
}

.audio-status {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  z-index: 9;
  max-width: min(32rem, calc(100vw - 2rem));
  margin: 0;
  padding: 0.5rem 0.78rem;
  border: 1px solid rgba(231, 189, 104, 0.28);
  border-radius: 999px;
  color: rgba(255, 250, 240, 0.9);
  background: rgba(8, 14, 27, 0.84);
  backdrop-filter: blur(12px);
  font-size: 0.8rem;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 0.25s ease;
}

.audio-status.is-visible {
  opacity: 1;
}

.book.is-closing,
.scene.is-book-open .book.is-closing {
  opacity: 0;
  filter: blur(2px);
  pointer-events: none;
  transform: perspective(1400px) rotateY(-18deg) rotateX(3deg) scale(0.68);
  transform-origin: left center;
  transition:
    opacity 0.7s ease 0.12s,
    filter 0.7s ease,
    transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.ending {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 46%, rgba(231, 189, 104, 0.12), transparent 26rem),
    rgba(5, 10, 21, 0.18);
  transition: opacity 0.9s ease, visibility 0.9s ease;
}

.ending.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.ending__card {
  position: relative;
  width: min(620px, calc(100vw - 2rem));
  min-height: min(72svh, 570px);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.8rem;
  padding: clamp(2rem, 6vw, 4.5rem);
  overflow: hidden;
  border: 1px solid rgba(231, 189, 104, 0.42);
  border-radius: 4px;
  text-align: center;
  background:
    linear-gradient(150deg, rgba(26, 36, 65, 0.96), rgba(17, 18, 37, 0.97)),
    var(--night);
  box-shadow: 0 38px 110px rgba(0, 0, 0, 0.54);
  transform: translateY(1.4rem) scale(0.96);
  transition: transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.ending.is-visible .ending__card {
  transform: translateY(0) scale(1);
}

.ending__card::before {
  content: "";
  position: absolute;
  inset: 0.8rem;
  border: 1px solid rgba(255, 250, 240, 0.12);
  pointer-events: none;
}

.ending__card::after {
  content: "✦";
  position: absolute;
  left: 50%;
  top: clamp(1.3rem, 4vw, 2.2rem);
  color: var(--gold);
  font-size: 1.25rem;
  text-shadow: 0 0 24px rgba(231, 189, 104, 0.72);
  transform: translateX(-50%);
}

.ending__date,
.ending__kicker {
  margin: 0;
  font-family: var(--serif);
  text-transform: uppercase;
}

.ending__date {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.25em;
}

.ending__kicker {
  color: rgba(255, 250, 240, 0.48);
  font-size: 0.64rem;
  letter-spacing: 0.2em;
}

.ending h2 {
  margin: 0.45rem 0 0;
  font-family: var(--serif);
  font-size: clamp(2.8rem, 8vw, 5.7rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.045em;
  text-shadow: 0 18px 45px rgba(0, 0, 0, 0.36);
}

.ending__rule {
  width: 3.6rem;
  height: 1px;
  margin: 0.6rem 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.ending__wish {
  margin: 0;
  color: rgba(255, 250, 240, 0.78);
  font-family: var(--display);
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.9;
}

.replay-button {
  min-height: 2.85rem;
  margin-top: 1.1rem;
  padding: 0 1.25rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
}

.ending__sticker {
  position: absolute;
  height: auto;
  object-fit: contain;
  opacity: 0.68;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.28));
  pointer-events: none;
}

.ending__sticker--cat {
  left: clamp(0.6rem, 3vw, 1.5rem);
  bottom: clamp(0.8rem, 3vw, 1.7rem);
  width: clamp(4.8rem, 13vw, 7.5rem);
  transform: rotate(-7deg);
}

.ending__sticker--bow {
  right: clamp(0.7rem, 3vw, 1.5rem);
  top: clamp(0.8rem, 3vw, 1.5rem);
  width: clamp(4.5rem, 12vw, 7rem);
  transform: rotate(7deg);
}

.ending__spark {
  position: absolute;
  width: 0.35rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff5c8;
  box-shadow: 0 0 20px rgba(255, 245, 200, 0.9);
  animation: ending-float 5s ease-in-out infinite;
}

.ending__spark--one { left: 14%; top: 22%; }
.ending__spark--two { right: 17%; top: 29%; animation-delay: 1.2s; }
.ending__spark--three { right: 22%; bottom: 18%; animation-delay: 2.4s; }

@keyframes ending-float {
  0%, 100% { opacity: 0.35; transform: translateY(0) scale(0.8); }
  50% { opacity: 1; transform: translateY(-0.8rem) scale(1.25); }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.38; transform: scale(0.8); }
  50% { opacity: 0.9; transform: scale(1.25); }
}

@media (max-width: 1120px) {
  .book,
  .scene.is-book-open .book {
    left: 50%;
    width: min(900px, calc(100vw - 3rem));
    transform: translateX(-50%) perspective(1400px) rotateX(0) scale(1);
  }

  .scene.is-book-open .lyric-ribbon {
    opacity: 0;
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
    overflow-x: hidden;
  }

  .scene {
    min-height: 100svh;
    padding: 5.6rem 0.75rem 1rem;
    overflow: hidden;
  }

  .scene.is-book-open {
    display: flex;
    align-items: flex-start;
    justify-content: center;
  }

  .moon {
    top: 6.5rem;
    right: 7%;
    width: 5.2rem;
  }

  .trail {
    left: 9%;
    top: 13rem;
    width: 11rem;
  }

  .art-cat {
    left: 2%;
    bottom: 2%;
    width: 5.4rem;
  }

  .art-fish {
    right: 3%;
    bottom: 3%;
    width: 4.3rem;
  }

  .cover {
    width: min(100%, 34rem);
    min-height: min(76svh, 620px);
  }

  .book {
    position: absolute;
    left: auto;
    width: min(100%, 38rem);
    height: auto;
    min-height: 720px;
    transform: none;
  }

  .book.is-open,
  .scene.is-book-open .book {
    position: relative;
  }

  .book.is-closing,
  .scene.is-book-open .book.is-closing {
    position: relative;
    transform: perspective(1000px) rotateY(-16deg) scale(0.72);
  }

  .page-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 1.1rem;
    min-height: 720px;
    padding: 1.15rem 1rem 4.8rem;
    border-radius: 5px;
    text-align: center;
    background:
      radial-gradient(circle at 12% 16%, rgba(255, 255, 255, 0.5), transparent 24%),
      repeating-linear-gradient(0deg, rgba(90, 65, 37, 0.018) 0 1px, transparent 1px 5px),
      var(--paper);
  }

  .page-card::after {
    left: calc(50% - 0.35rem);
    width: 0.7rem;
    opacity: 0.44;
  }

  .photo-frame {
    width: min(80%, 22rem);
  }

  .photo-frame img {
    aspect-ratio: 4 / 4.6;
  }

  .page-copy h2,
  .final-card h2 {
    font-size: clamp(2.25rem, 10vw, 3.3rem);
  }

  .page-copy p:not(.eyebrow),
  .final-card p:not(.eyebrow) {
    margin-left: auto;
    margin-right: auto;
    font-size: 0.95rem;
  }

  .page-copy--wide {
    order: 2;
    padding-left: 0;
  }

  .stamp-stack {
    order: 1;
    width: min(100%, 25rem);
    min-height: 19rem;
    margin: 0 auto;
  }

  .gallery-strip {
    width: min(100%, 26rem);
    margin: 0 auto;
  }

  .gallery-strip img {
    height: clamp(13rem, 48vw, 17rem);
  }

  .wish-photo {
    width: min(72%, 22rem);
    justify-self: center;
    margin: 0 auto;
    transform: rotate(2deg);
  }

  .final-card {
    width: 100%;
    justify-self: center;
    text-align: center;
  }

  .scene.is-book-open .lyric-ribbon,
  .lyric-ribbon {
    left: 0.75rem;
    right: 5.8rem;
    top: 0.75rem;
    bottom: auto;
    width: auto;
    height: 3rem;
    padding: 0.2rem 0.65rem;
    border: 1px solid rgba(255, 250, 240, 0.14);
    border-radius: 4px;
    background: rgba(8, 14, 27, 0.48);
    backdrop-filter: blur(12px);
    opacity: 0.84;
    transform: none;
  }

  .lyric-ribbon__meta {
    margin: 0;
    font-size: 0.58rem;
  }

  .lyric-window {
    height: 1.4rem;
    mask-image: none;
  }

  .lyric-line {
    min-height: 1.4rem;
    justify-content: flex-start;
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .lyric-line:not(.is-active) {
    visibility: hidden;
  }

  .lyric-line.is-active {
    transform: none;
  }

  .music-chip {
    top: 0.75rem;
    right: 0.75rem;
  }
}

@media (max-width: 540px) {
  .cover {
    min-height: min(74svh, 580px);
    padding-inline: 1rem;
  }

  .cover h1 {
    font-size: clamp(3.6rem, 17vw, 4.8rem);
  }

  .cover-sticker-book {
    width: 5.4rem;
  }

  .cover-sticker-bow {
    width: 5.2rem;
  }

  .book,
  .book.is-open,
  .scene.is-book-open .book {
    width: 100%;
    min-height: 700px;
  }

  .page-card {
    min-height: 700px;
    padding-inline: 0.85rem;
  }

  .page-art-moon,
  .page-art-cat,
  .page-art-wand {
    width: 4.8rem;
  }

  .gallery-strip {
    gap: 0.3rem;
  }

  .gallery-strip img {
    height: 11.5rem;
    border-width: 0.25rem;
  }

  .controls {
    bottom: 0.8rem;
  }

  .ending__card {
    min-height: min(72svh, 560px);
    padding-inline: 1.4rem;
  }

  .ending__sticker--cat {
    width: 4.7rem;
  }

  .ending__sticker--bow {
    width: 4.4rem;
  }
}

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