:root {
  --cream: #f7eddc;
  --paper: #fffaf0;
  --ink: #24343a;
  --muted: #66726f;
  --coral: #dc6c5f;
  --rose: #b8475d;
  --sage: #849a6b;
  --sky: #6ea4bd;
  --honey: #e3ad51;
  --night: #10243b;
  --line: rgba(49, 55, 48, 0.22);
  --shadow: 0 26px 70px rgba(42, 33, 22, 0.28);
  --serif: "STKaiti", "KaiTi", "FangSong", "Noto Serif SC", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

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

html {
  background: #d9cbb7;
}

body {
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 255, 255, 0.7), transparent 28%),
    radial-gradient(circle at 90% 90%, rgba(163, 107, 88, 0.2), transparent 32%),
    linear-gradient(135deg, #e7ddce, #cbbba7);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

noscript {
  position: fixed;
  z-index: 999;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  color: #fff;
  background: var(--night);
  text-align: center;
}

.book-ui {
  position: fixed;
  z-index: 200;
  top: 0;
  left: 50%;
  width: min(1240px, calc(100vw - 112px));
  height: 68px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  transform: translateX(-50%);
  color: rgba(35, 45, 47, 0.78);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.brand {
  justify-self: start;
  display: inline-flex;
  gap: 9px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 5px 12px rgba(172, 81, 73, 0.24);
}

.chapter-title {
  max-width: 42vw;
  overflow: hidden;
  font-family: var(--serif);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-status {
  justify-self: end;
  font-variant-numeric: tabular-nums;
}

.book {
  position: fixed;
  z-index: 10;
  top: 68px;
  left: 50%;
  width: min(1240px, calc(100vw - 112px));
  height: min(780px, calc(100vh - 148px));
  transform: translateX(-50%);
  perspective: 2600px;
  transform-style: preserve-3d;
}

.book::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 18px -14px -18px 22px;
  border-radius: 24px;
  background: rgba(87, 67, 45, 0.28);
  filter: blur(24px);
}

.page {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1px solid rgba(87, 73, 51, 0.2);
  border-radius: 22px 14px 14px 22px;
  background: var(--paper);
  box-shadow: var(--shadow);
  transform: rotateY(0deg);
  transform-origin: 0 50%;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  transition: transform 920ms cubic-bezier(0.64, 0.02, 0.24, 1), filter 500ms ease;
  will-change: transform;
}

.page::after {
  content: "";
  position: absolute;
  z-index: 80;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow:
    inset 14px 0 18px -18px rgba(43, 31, 19, 0.55),
    inset -22px 0 25px -28px rgba(51, 38, 23, 0.52);
}

.page.is-flipped {
  transform: rotateY(-180deg);
  filter: brightness(0.94);
  pointer-events: none;
}

.page:not(.is-current):not(.is-flipped) {
  pointer-events: none;
}

.page.is-current {
  pointer-events: auto;
}

.paper-grain {
  position: absolute;
  z-index: 5;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    repeating-linear-gradient(12deg, rgba(82, 66, 45, 0.04) 0 1px, transparent 1px 5px),
    radial-gradient(circle at 23% 37%, rgba(255, 255, 255, 0.65) 0 1px, transparent 1.5px),
    radial-gradient(circle at 73% 64%, rgba(56, 43, 26, 0.12) 0 0.8px, transparent 1.2px);
  background-size: auto, 11px 13px, 17px 19px;
  mix-blend-mode: multiply;
}

.page-number {
  position: absolute;
  z-index: 70;
  right: 24px;
  bottom: 18px;
  font-family: Georgia, serif;
  font-size: 12px;
  letter-spacing: 0.12em;
  opacity: 0.48;
}

.page-number-light {
  color: #fff;
}

/* Cover */

.cover-page {
  background: var(--cream);
}

.cover-art {
  position: absolute;
  z-index: 0;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(247, 237, 220, 0.98) 0%, rgba(247, 237, 220, 0.92) 43%, rgba(247, 237, 220, 0.35) 72%, rgba(247, 237, 220, 0.18) 100%),
    url("assets/page-00-cover.jpg") center / cover no-repeat;
  transform: scale(1.02);
}

.cover-page::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 18px;
  border: 1px solid rgba(118, 89, 55, 0.25);
  border-radius: 14px 7px 7px 14px;
  pointer-events: none;
}

.cover-copy {
  position: absolute;
  z-index: 20;
  top: 13%;
  left: 7.4%;
  width: min(520px, 46%);
}

.eyebrow {
  margin: 0 0 17px;
  color: var(--rose);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.26em;
}

.cover-copy h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(48px, 5.2vw, 78px);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.cover-copy h1 em {
  position: relative;
  color: var(--rose);
  font-style: normal;
}

.cover-copy h1 em::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -4px;
  bottom: 2px;
  left: -6px;
  height: 15px;
  background: rgba(236, 182, 86, 0.45);
  transform: rotate(-1.8deg);
}

.cover-lead {
  max-width: 470px;
  margin: 24px 0 20px;
  color: #4f5d5d;
  font-family: var(--serif);
  font-size: clamp(15px, 1.35vw, 19px);
  line-height: 1.85;
}

.cover-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  color: #6e7069;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.cover-meta i {
  width: 24px;
  height: 1px;
  background: currentColor;
  opacity: 0.45;
}

.start-button,
.restart-button {
  margin-top: 26px;
  padding: 12px 20px;
  color: #fff;
  border: 0;
  border-radius: 999px;
  background: var(--rose);
  box-shadow: 0 9px 20px rgba(166, 59, 77, 0.26);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.start-button:hover,
.restart-button:hover {
  box-shadow: 0 13px 26px rgba(166, 59, 77, 0.32);
  transform: translateY(-2px);
}

.start-button span {
  display: inline-block;
  margin-left: 10px;
}

.cover-portraits {
  position: absolute;
  z-index: 16;
  right: 7%;
  bottom: 9%;
  width: 44%;
  height: 72%;
}

.portrait {
  position: absolute;
  margin: 0;
}

.photo-window {
  overflow: hidden;
  width: clamp(150px, 19vw, 250px);
  aspect-ratio: 1;
  border: 10px solid #fffdf7;
  border-radius: 46% 54% 48% 52% / 52% 47% 53% 48%;
  background: #fff;
  box-shadow: 0 18px 32px rgba(59, 44, 27, 0.24);
}

.photo-window img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.portrait-yang {
  top: 5%;
  left: 4%;
  transform: rotate(-7deg);
}

.portrait-yang img {
  transform: scale(1.07);
}

.portrait-duan {
  right: 1%;
  bottom: 4%;
  transform: rotate(7deg);
}

.portrait-duan img {
  transform: scale(1.25);
}

.portrait figcaption {
  position: absolute;
  right: 18px;
  bottom: -17px;
  padding: 6px 15px;
  color: var(--ink);
  border: 1px solid rgba(63, 54, 45, 0.2);
  border-radius: 999px;
  background: #fff8e8;
  box-shadow: 0 5px 12px rgba(50, 40, 28, 0.12);
  font-family: var(--serif);
  font-size: 15px;
  white-space: nowrap;
}

.cover-heart {
  position: absolute;
  z-index: 5;
  top: 51%;
  left: 49%;
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  color: #fff;
  border: 5px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 8px 18px rgba(140, 55, 55, 0.2);
  font-size: 24px;
  transform: rotate(-9deg);
}

.doodle {
  position: absolute;
  z-index: 12;
  pointer-events: none;
}

.doodle-star {
  top: 9%;
  right: 7%;
  color: var(--honey);
  font-size: 38px;
  transform: rotate(13deg);
}

.doodle-flower {
  right: 44%;
  bottom: 7%;
  color: var(--coral);
  font-size: 32px;
}

.doodle-line {
  top: 12%;
  left: 42%;
  width: 110px;
  height: 52px;
  border-top: 3px solid var(--sage);
  border-radius: 50%;
  transform: rotate(18deg);
}

.swipe-hint {
  position: absolute;
  z-index: 20;
  bottom: 24px;
  left: 50%;
  margin: 0;
  color: rgba(49, 55, 51, 0.52);
  font-size: 11px;
  letter-spacing: 0.12em;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* Illustrated chapters */

.scene-image,
.letter-sky,
.constellation-bg {
  position: absolute;
  z-index: 0;
  inset: 0;
}

.scene-image {
  background-position: center;
  background-size: cover;
  transform: scale(1.015);
}

.scene-spring .scene-image {
  background-image: none;
}

.scene-summer .scene-image {
  background-image: none;
}

.scene-autumn .scene-image {
  background-image: none;
}

.scene-home .scene-image {
  background-image: none;
}

.scene-wash {
  position: absolute;
  z-index: 2;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 249, 236, 0.9), rgba(255, 249, 236, 0.18) 48%, transparent 72%);
}

.wash-right {
  background: linear-gradient(270deg, rgba(255, 249, 236, 0.92), rgba(255, 249, 236, 0.16) 50%, transparent 72%);
}

.chapter-tab {
  position: absolute;
  z-index: 25;
  top: 25px;
  left: 30px;
  margin: 0;
  padding: 7px 13px;
  color: #3f4c4c;
  border: 1px solid rgba(60, 65, 59, 0.17);
  border-radius: 999px;
  background: rgba(255, 251, 242, 0.72);
  backdrop-filter: blur(6px);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.chapter-tab-light {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(26, 40, 50, 0.28);
}

.story-note {
  position: absolute;
  z-index: 20;
  top: 14%;
  width: min(420px, 39%);
  padding: clamp(24px, 3vw, 40px);
  border: 1px solid rgba(81, 65, 46, 0.16);
  background: rgba(255, 250, 239, 0.93);
  box-shadow: 0 20px 45px rgba(47, 39, 29, 0.18);
  backdrop-filter: blur(4px);
}

.note-left {
  left: 6%;
  transform: rotate(-0.8deg);
}

.note-right {
  right: 6%;
  transform: rotate(0.8deg);
}

.note-green {
  border-top: 8px solid var(--sage);
}

.note-blue {
  border-top: 8px solid var(--sky);
}

.note-amber {
  border-top: 8px solid var(--honey);
}

.note-night {
  color: #f7f0e6;
  border-color: rgba(255, 255, 255, 0.2);
  border-top: 8px solid var(--coral);
  background: rgba(18, 36, 52, 0.88);
}

.story-note .kicker,
.letter-date {
  margin: 0 0 10px;
  color: var(--rose);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.note-night .kicker {
  color: #f6c17e;
}

.story-note h2,
.valentine-letter h2,
.final-copy h2 {
  margin: 0 0 17px;
  font-family: var(--serif);
  font-size: clamp(30px, 3.1vw, 47px);
  line-height: 1.18;
  letter-spacing: -0.03em;
}

.story-note > p:not(.kicker),
.valentine-letter > p:not(.letter-date):not(.letter-sign) {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: clamp(14px, 1.2vw, 17px);
  line-height: 1.78;
}

.story-note blockquote,
.valentine-letter blockquote {
  position: relative;
  margin: 18px 0;
  padding: 13px 16px 13px 20px;
  color: #764447;
  border-left: 3px solid var(--coral);
  background: rgba(227, 173, 81, 0.1);
  font-family: var(--serif);
  font-size: clamp(16px, 1.45vw, 20px);
  font-weight: 700;
  line-height: 1.55;
}

.note-night blockquote {
  color: #ffd9c3;
  background: rgba(255, 255, 255, 0.08);
}

.small-copy {
  color: #68736f;
  font-size: 0.86em !important;
}

.note-night .small-copy {
  color: #c7d2d5;
}

.note-pin {
  position: absolute;
  top: 10px;
  right: 18px;
  width: 14px;
  height: 14px;
  border: 3px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  background: var(--sky);
  box-shadow: 0 4px 7px rgba(31, 38, 37, 0.3);
}

.pin-red {
  background: var(--rose);
}

.tape {
  position: absolute;
  width: 92px;
  height: 26px;
  background: rgba(243, 211, 145, 0.6);
  box-shadow: inset 0 0 0 1px rgba(120, 94, 52, 0.1);
}

.tape-top {
  top: -13px;
  left: calc(50% - 46px);
  transform: rotate(-2deg);
}

.tape-corner {
  top: -7px;
  right: -26px;
  transform: rotate(42deg);
}

/* Paper-doll characters */

.paper-characters {
  position: absolute;
  z-index: 14;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  height: 285px;
}

.pair-spring,
.pair-summer,
.pair-home {
  right: 10%;
  bottom: 3%;
}

.pair-walk,
.pair-autumn {
  bottom: 3%;
  left: 12%;
}

.paper-person {
  position: relative;
  width: 175px;
  height: 270px;
  transform-origin: 50% 100%;
}

.paper-person .head {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 16px;
  width: 145px;
  height: 148px;
  border: 7px solid rgba(255, 252, 244, 0.96);
  border-radius: 48% 52% 45% 55% / 49% 48% 52% 51%;
  background-color: #fff;
  background-repeat: no-repeat;
  box-shadow: 0 10px 21px rgba(43, 33, 23, 0.24);
}

.person-yang .head {
  background-image: none;
  background-position: center 49%;
  background-size: 108%;
}

.person-duan .head {
  background-image: none;
  background-position: center 49%;
  background-size: 127%;
}

.paper-person .body {
  position: absolute;
  z-index: 3;
  bottom: 0;
  left: 37px;
  width: 102px;
  height: 135px;
  border: 3px solid rgba(42, 57, 58, 0.65);
  border-radius: 48% 48% 18px 18px;
  box-shadow: 0 12px 20px rgba(42, 32, 20, 0.2);
}

.person-yang .body {
  background:
    radial-gradient(circle at 28% 20%, #fff 0 4px, transparent 5px),
    radial-gradient(circle at 72% 31%, #fff 0 4px, transparent 5px),
    #d86c66;
}

.person-duan .body {
  background:
    linear-gradient(120deg, transparent 43%, rgba(255, 255, 255, 0.45) 44% 47%, transparent 48%),
    #6d96aa;
}

.paper-person .body::before,
.paper-person .body::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: 26px;
  width: 72px;
  height: 22px;
  border: 3px solid rgba(42, 57, 58, 0.65);
  border-radius: 999px;
  background: inherit;
}

.paper-person .body::before {
  right: 75%;
  transform: rotate(-30deg);
}

.paper-person .body::after {
  left: 75%;
  transform: rotate(30deg);
}

.pose-wave {
  transform: rotate(-3deg);
}

.pose-wave .body::after {
  top: 0;
  transform: rotate(-54deg);
}

.pose-laptop {
  transform: translateY(10px) rotate(2deg);
}

.pose-sleepy {
  transform: translateY(18px) rotate(-5deg);
}

.pose-pull {
  transform: translateX(-18px) rotate(6deg);
}

.pose-umbrella {
  transform: rotate(-3deg);
}

.pose-rain {
  transform: translateY(12px) rotate(4deg);
}

.pose-reach:first-child {
  transform: rotate(2deg) translateX(13px);
}

.pose-reach:last-child {
  transform: rotate(-3deg) translateX(-13px);
}

.prop.umbrella {
  position: absolute;
  z-index: 2;
  top: -30px;
  right: -88px;
  width: 150px;
  height: 76px;
  border-radius: 150px 150px 12px 12px;
  background: repeating-linear-gradient(90deg, #efc454 0 28px, #e47467 28px 56px);
  box-shadow: inset 0 -4px rgba(84, 67, 44, 0.18);
  transform: rotate(8deg);
}

.prop.umbrella::after {
  content: "";
  position: absolute;
  top: 70px;
  left: 74px;
  width: 3px;
  height: 155px;
  border-radius: 3px;
  background: #4f6567;
}

/* Letter chapter */

.letter-page {
  color: #f8f0e6;
  background: #162a42;
}

.letter-sky {
  background: #162a42;
  filter: saturate(0.72) brightness(0.88);
}

.season-ribbon {
  position: absolute;
  z-index: 18;
  top: 28px;
  right: 30px;
  display: flex;
  gap: 9px;
  align-items: center;
  color: rgba(255, 255, 255, 0.8);
  font-family: var(--serif);
  font-size: 13px;
}

.season-ribbon i {
  width: 22px;
  height: 1px;
  background: rgba(255, 255, 255, 0.35);
}

.valentine-letter {
  position: absolute;
  z-index: 20;
  top: 11%;
  left: 7%;
  width: min(640px, 58%);
  padding: clamp(30px, 4vw, 55px);
  color: #394346;
  border: 1px solid rgba(87, 70, 44, 0.25);
  background:
    linear-gradient(rgba(255, 251, 240, 0.95), rgba(255, 248, 233, 0.96)),
    repeating-linear-gradient(0deg, transparent 0 29px, rgba(91, 114, 124, 0.08) 29px 30px);
  box-shadow: 0 24px 60px rgba(5, 14, 26, 0.42);
  transform: rotate(-1deg);
}

.valentine-letter h2 {
  font-size: clamp(28px, 3vw, 44px);
}

.letter-sign {
  margin: 20px 0 0;
  color: #70484c;
  font-family: var(--serif);
  font-size: clamp(16px, 1.5vw, 21px);
  line-height: 1.7;
  text-align: right;
}

.snow-globe {
  position: absolute;
  z-index: 12;
  right: 8%;
  bottom: 8%;
  width: min(310px, 28vw);
  aspect-ratio: 1;
  border: 8px solid rgba(241, 234, 219, 0.82);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.52), transparent 17%),
    linear-gradient(180deg, rgba(124, 167, 191, 0.5), rgba(247, 242, 222, 0.75));
  box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.5), 0 23px 35px rgba(0, 0, 0, 0.34);
}

.snow-globe::after {
  content: "";
  position: absolute;
  right: 14%;
  bottom: -15%;
  left: 14%;
  height: 24%;
  border-radius: 13px 13px 30px 30px;
  background: #a96d48;
  box-shadow: inset 0 5px rgba(255, 255, 255, 0.18);
}

.globe-person {
  position: absolute;
  z-index: 2;
  bottom: 17%;
  width: 42%;
  aspect-ratio: 1;
  border: 5px solid #fff9ed;
  border-radius: 50%;
  background-repeat: no-repeat;
  box-shadow: 0 8px 16px rgba(32, 42, 49, 0.2);
}

.globe-yang {
  left: 9%;
  background-image: none;
  background-position: center;
  background-size: 108%;
  transform: rotate(-6deg);
}

.globe-duan {
  right: 9%;
  background-image: none;
  background-position: center;
  background-size: 127%;
  transform: rotate(6deg);
}

.snow {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 45px 25px #fff, 96px -15px #fff, 130px 36px #fff, 180px 2px #fff;
}

.snow-1 { top: 20%; left: 14%; }
.snow-2 { top: 35%; left: 23%; transform: scale(0.7); }
.snow-3 { top: 15%; left: 42%; transform: scale(0.55); }
.snow-4 { top: 48%; left: 10%; transform: scale(0.8); }

/* Final page */

.constellation-page {
  color: #fff;
  background: var(--night);
}

.constellation-bg {
  background:
    radial-gradient(circle at 18% 20%, rgba(228, 174, 91, 0.85) 0 1.5px, transparent 2px),
    radial-gradient(circle at 73% 28%, rgba(255, 255, 255, 0.8) 0 1px, transparent 2px),
    radial-gradient(circle at 86% 70%, rgba(218, 111, 105, 0.7) 0 2px, transparent 3px),
    radial-gradient(circle at 42% 83%, rgba(255, 255, 255, 0.7) 0 1.3px, transparent 2px),
    linear-gradient(140deg, #0d2036, #1c3652 58%, #392a46);
  background-size: 53px 59px, 71px 67px, 89px 83px, 97px 91px, auto;
}

.constellation-bg::after {
  content: "";
  position: absolute;
  right: -6%;
  bottom: -14%;
  width: 57%;
  height: 62%;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
  box-shadow: 0 0 110px rgba(210, 116, 103, 0.18);
}

.final-copy {
  position: absolute;
  z-index: 20;
  top: 9%;
  left: 7%;
  width: min(730px, 63%);
}

.eyebrow-light {
  color: #f2ba72;
}

.final-copy h2 {
  margin-bottom: 10px;
  font-size: clamp(38px, 4.5vw, 66px);
}

.final-lead {
  margin: 0;
  color: #becbd4;
  font-family: var(--serif);
  font-size: 17px;
}

.memory-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 26px 0 20px;
}

.memory-stats article {
  padding: 16px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(5px);
}

.memory-stats strong,
.memory-stats span {
  display: block;
}

.memory-stats strong {
  color: #f6c881;
  font-family: Georgia, serif;
  font-size: clamp(21px, 2.2vw, 32px);
  font-weight: 500;
}

.memory-stats span {
  margin-top: 6px;
  color: #b8c6cf;
  font-size: 11px;
}

.final-quote {
  margin: 18px 0 0;
  font-family: var(--serif);
  font-size: clamp(19px, 1.8vw, 26px);
  line-height: 1.55;
}

.final-quote em {
  color: #c8d2d8;
  font-size: 0.72em;
  font-style: normal;
}

.gift-note {
  width: fit-content;
  margin: 18px 0 0;
  padding: 12px 18px;
  color: #f5e8d7;
  border-left: 3px solid var(--coral);
  background: rgba(255, 255, 255, 0.06);
  font-family: var(--serif);
  font-size: clamp(14px, 1.3vw, 18px);
  line-height: 1.65;
}

.gift-note strong {
  color: #ffd29c;
}

.gift-note span {
  display: block;
  color: #aebec9;
  font-size: 0.8em;
  text-align: right;
}

.restart-button {
  margin-top: 16px;
  background: var(--coral);
}

.final-portraits {
  position: absolute;
  z-index: 18;
  right: 5%;
  bottom: 10%;
  width: 30%;
  height: 55%;
}

.final-portraits .photo-window {
  width: clamp(105px, 14vw, 180px);
  border-width: 7px;
}

.final-portraits .portrait-yang {
  top: 0;
  left: 0;
}

.final-portraits .portrait-duan {
  right: 0;
  bottom: 0;
}

.final-portraits > span {
  position: absolute;
  z-index: 8;
  top: 48%;
  left: 50%;
  color: #f18478;
  font-size: 34px;
  filter: drop-shadow(0 5px 6px rgba(0, 0, 0, 0.22));
  transform: translate(-50%, -50%) rotate(-8deg);
}

/* Controls */

.page-controls {
  position: fixed;
  z-index: 220;
  bottom: 17px;
  left: 50%;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(73, 58, 40, 0.14);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.78);
  box-shadow: 0 10px 30px rgba(52, 42, 30, 0.14);
  backdrop-filter: blur(10px);
  transform: translateX(-50%);
}

.page-controls > button {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  color: var(--ink);
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 17px;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.page-controls > button:hover:not(:disabled) {
  color: #fff;
  background: var(--rose);
  transform: scale(1.05);
}

.page-controls > button:disabled {
  cursor: default;
  opacity: 0.25;
}

.progress-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.progress-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(52, 61, 60, 0.25);
  cursor: pointer;
  transition: width 200ms ease, background 200ms ease;
}

.progress-dot.is-active {
  width: 22px;
  background: var(--rose);
}

/* Entry motion */

.page.is-current .story-note,
.page.is-current .valentine-letter,
.page.is-current .final-copy {
  animation: note-enter 620ms 220ms both;
}

.page.is-current .paper-characters,
.page.is-current .snow-globe,
.page.is-current .final-portraits {
  animation: characters-enter 700ms 380ms both;
}

.page.is-current .cover-portraits {
  animation: characters-enter 720ms 200ms both;
}

@keyframes note-enter {
  from { opacity: 0; translate: 0 22px; }
  to { opacity: 1; translate: 0 0; }
}

@keyframes characters-enter {
  from { opacity: 0; translate: 0 28px; scale: 0.96; }
  to { opacity: 1; translate: 0 0; scale: 1; }
}

@media (max-width: 900px) {
  .book-ui {
    width: calc(100vw - 24px);
    height: 54px;
  }

  .book {
    top: 54px;
    width: calc(100vw - 20px);
    height: calc(100svh - 118px);
  }

  .page {
    border-radius: 16px 10px 10px 16px;
  }

  .brand span:last-child {
    display: none;
  }

  .brand-mark {
    width: 26px;
    height: 26px;
  }

  .chapter-title {
    font-size: 13px;
  }

  .cover-art {
    background:
      linear-gradient(180deg, rgba(247, 237, 220, 0.94) 0%, rgba(247, 237, 220, 0.86) 50%, rgba(247, 237, 220, 0.25) 100%),
      url("assets/page-00-cover.jpg") center / cover no-repeat;
  }

  .cover-copy {
    top: 7%;
    left: 7%;
    width: 86%;
  }

  .cover-copy h1 {
    font-size: clamp(38px, 11.5vw, 58px);
  }

  .cover-lead {
    max-width: 88%;
    margin: 14px 0 12px;
    font-size: 14px;
    line-height: 1.64;
  }

  .cover-meta {
    font-size: 10px;
  }

  .start-button {
    margin-top: 14px;
    padding: 10px 16px;
  }

  .cover-portraits {
    right: 5%;
    bottom: 5%;
    width: 66%;
    height: 35%;
  }

  .photo-window {
    width: clamp(105px, 31vw, 150px);
    border-width: 6px;
  }

  .portrait-yang {
    top: 0;
  }

  .portrait-duan {
    bottom: 0;
  }

  .cover-heart {
    width: 40px;
    height: 40px;
    border-width: 3px;
    font-size: 17px;
  }

  .doodle-line,
  .doodle-flower {
    display: none;
  }

  .swipe-hint {
    bottom: 10px;
    font-size: 9px;
  }

  .chapter-tab {
    top: 15px;
    left: 17px;
    max-width: calc(100% - 34px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .scene-wash,
  .wash-right {
    background: linear-gradient(180deg, rgba(255, 249, 236, 0.94), rgba(255, 249, 236, 0.58) 58%, rgba(255, 249, 236, 0.08) 78%);
  }

  .story-note,
  .note-left,
  .note-right {
    top: 9%;
    right: auto;
    left: 5%;
    width: 90%;
    max-height: 62%;
    padding: 20px 21px;
    transform: rotate(-0.45deg);
  }

  .story-note h2 {
    margin-bottom: 10px;
    font-size: clamp(25px, 7.5vw, 34px);
  }

  .story-note > p:not(.kicker) {
    margin-bottom: 9px;
    font-size: 13px;
    line-height: 1.55;
  }

  .story-note blockquote {
    margin: 10px 0;
    padding: 9px 12px;
    font-size: 15px;
  }

  .paper-characters,
  .pair-spring,
  .pair-walk,
  .pair-summer,
  .pair-autumn,
  .pair-home {
    right: 50%;
    bottom: -2%;
    left: auto;
    gap: 0;
    height: 240px;
    transform: translateX(50%) scale(0.68);
    transform-origin: 50% 100%;
  }

  .scene-summer .scene-image,
  .scene-autumn .scene-image {
    background-position: center;
  }

  .season-ribbon {
    display: none;
  }

  .valentine-letter {
    top: 8%;
    left: 5%;
    width: 90%;
    padding: 22px;
  }

  .valentine-letter h2 {
    margin-bottom: 12px;
    font-size: clamp(24px, 7vw, 32px);
  }

  .valentine-letter > p:not(.letter-date):not(.letter-sign) {
    font-size: 13px;
    line-height: 1.58;
  }

  .valentine-letter blockquote {
    margin: 12px 0;
    font-size: 15px;
  }

  .letter-sign {
    margin-top: 12px;
    font-size: 14px;
  }

  .snow-globe {
    right: -3%;
    bottom: -5%;
    width: 170px;
    opacity: 0.76;
  }

  .final-copy {
    top: 6%;
    left: 6%;
    width: 88%;
  }

  .final-copy h2 {
    font-size: clamp(32px, 9vw, 45px);
  }

  .final-lead {
    font-size: 13px;
  }

  .memory-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 15px 0 12px;
  }

  .memory-stats article {
    padding: 10px;
  }

  .memory-stats strong {
    font-size: 22px;
  }

  .final-quote {
    margin-top: 10px;
    font-size: 17px;
  }

  .gift-note {
    margin-top: 10px;
    padding: 8px 12px;
    font-size: 13px;
  }

  .restart-button {
    margin-top: 10px;
    padding: 9px 14px;
    font-size: 11px;
  }

  .final-portraits {
    right: -1%;
    bottom: 2%;
    width: 45%;
    height: 26%;
    opacity: 0.7;
  }

  .final-portraits .photo-window {
    width: 82px;
    border-width: 4px;
  }

  .page-number {
    right: 12px;
    bottom: 9px;
  }

  .page-controls {
    bottom: 10px;
    padding: 5px 7px;
  }

  .page-controls > button {
    width: 30px;
    height: 30px;
  }

  .progress-dots {
    gap: 4px;
  }

  .progress-dot {
    width: 6px;
    height: 6px;
  }

  .progress-dot.is-active {
    width: 16px;
  }
}

@media (max-width: 420px) and (max-height: 740px) {
  .cover-lead {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .cover-portraits {
    height: 30%;
  }

  .story-note {
    top: 8%;
    padding: 16px 18px;
  }

  .story-note .small-copy {
    display: none;
  }

  .valentine-letter {
    padding: 18px;
  }

  .valentine-letter > p:not(.letter-date):not(.letter-sign) {
    font-size: 12px;
  }

  .snow-globe,
  .final-portraits {
    display: none;
  }

  .gift-note {
    font-size: 12px;
  }
}

/* Approved full-scene picture-book artwork */

.cover-art {
  background:
    linear-gradient(90deg, rgba(5, 18, 38, 0.84) 0%, rgba(5, 18, 38, 0.64) 31%, rgba(5, 18, 38, 0.12) 57%, transparent 73%),
    url("assets/page-00-cover.jpg") center / cover no-repeat;
  transform: none;
}

.cover-copy {
  color: #fff9ee;
  text-shadow: 0 2px 16px rgba(2, 9, 22, 0.42);
}

.cover-copy h1 em {
  color: #ffb19f;
}

.cover-lead,
.cover-meta,
.swipe-hint {
  color: rgba(255, 249, 238, 0.86);
}

.cover-page::before {
  border-color: rgba(255, 255, 255, 0.24);
}

.scene-image,
.letter-sky,
.constellation-bg {
  background-position: center;
  background-size: cover;
  transform: none;
  filter: none;
}

#chapter-1 .scene-image,
#chapter-2 .scene-image,
#chapter-3 .scene-image,
#chapter-4 .scene-image,
#chapter-5 .letter-sky,
#chapter-6 .scene-image,
#chapter-7 .constellation-bg {
  background-image: none;
}

.scene-wash,
.wash-right {
  background:
    linear-gradient(180deg, rgba(10, 19, 29, 0.12), transparent 27%, transparent 72%, rgba(7, 12, 20, 0.16)),
    radial-gradient(circle at center, transparent 46%, rgba(6, 12, 20, 0.13));
}

.cover-portraits,
.paper-characters,
.snow-globe,
.season-ribbon,
.final-portraits,
.doodle {
  display: none;
}

.story-note {
  top: auto;
  bottom: 4.5%;
  width: min(430px, 35%);
  max-height: 73%;
  overflow: auto;
  padding: clamp(21px, 2.4vw, 32px);
  border-radius: 18px;
  background: rgba(255, 250, 239, 0.88);
  box-shadow: 0 22px 60px rgba(15, 20, 24, 0.28);
  backdrop-filter: blur(14px) saturate(0.9);
  transform: none;
  scrollbar-width: thin;
}

.story-note h2 {
  margin-bottom: 12px;
  font-size: clamp(27px, 2.65vw, 41px);
}

.story-note > p:not(.kicker) {
  margin-bottom: 10px;
  font-size: clamp(13px, 1.05vw, 16px);
  line-height: 1.66;
}

.story-note blockquote {
  margin: 12px 0;
  padding: 10px 14px 10px 17px;
  font-size: clamp(15px, 1.25vw, 18px);
}

#chapter-1 .story-note,
#chapter-2 .story-note,
#chapter-3 .story-note,
#chapter-6 .story-note {
  right: auto;
  left: 4%;
}

#chapter-4 .story-note {
  right: 4%;
  left: auto;
}

#chapter-2 .story-note {
  color: #f8f2e9;
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: #f1bd6d;
  background: rgba(10, 31, 46, 0.8);
}

#chapter-2 .story-note .kicker,
#chapter-2 .story-note blockquote {
  color: #ffd38e;
}

#chapter-2 .story-note blockquote {
  background: rgba(255, 255, 255, 0.08);
}

#chapter-2 .story-note .small-copy {
  color: #d1dde0;
}

#chapter-3 .story-note {
  background: rgba(252, 247, 235, 0.86);
}

.letter-sky {
  background: #162a42;
}

.valentine-letter {
  top: auto;
  bottom: 4.5%;
  left: 4%;
  width: min(570px, 46%);
  max-height: 76%;
  overflow: auto;
  padding: clamp(24px, 2.8vw, 38px);
  border-radius: 18px;
  background: rgba(255, 250, 239, 0.9);
  box-shadow: 0 24px 65px rgba(6, 13, 23, 0.42);
  backdrop-filter: blur(14px) saturate(0.9);
  transform: none;
  scrollbar-width: thin;
}

.valentine-letter h2 {
  margin-bottom: 12px;
  font-size: clamp(26px, 2.55vw, 40px);
}

.valentine-letter > p:not(.letter-date):not(.letter-sign) {
  margin-bottom: 10px;
  font-size: clamp(13px, 1.06vw, 16px);
  line-height: 1.65;
}

.valentine-letter blockquote {
  margin: 12px 0;
  font-size: clamp(15px, 1.25vw, 18px);
}

.letter-sign {
  margin-top: 10px;
  font-size: clamp(14px, 1.2vw, 18px);
}

.constellation-bg {
  background: #081a31;
}

.constellation-bg::after {
  display: none;
}

.final-copy {
  top: 6%;
  right: 4%;
  left: auto;
  width: min(480px, 38%);
  max-height: 88%;
  overflow: auto;
  padding: clamp(22px, 2.4vw, 32px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  background: rgba(5, 19, 39, 0.78);
  box-shadow: 0 24px 65px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(15px) saturate(0.88);
  scrollbar-width: thin;
}

.final-copy h2 {
  font-size: clamp(32px, 3.6vw, 52px);
}

.final-lead {
  font-size: clamp(13px, 1.15vw, 16px);
}

.memory-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 17px 0 14px;
}

.memory-stats article {
  padding: 11px 10px;
}

.memory-stats strong {
  font-size: clamp(20px, 1.8vw, 27px);
}

.final-quote {
  margin-top: 12px;
  font-size: clamp(16px, 1.35vw, 20px);
}

.gift-note {
  margin-top: 12px;
  padding: 10px 14px;
  font-size: clamp(13px, 1.05vw, 16px);
}

@media (max-width: 900px) {
  .cover-art {
    background:
      linear-gradient(90deg, rgba(5, 18, 38, 0.82), rgba(5, 18, 38, 0.48) 43%, transparent 72%),
      url("assets/page-00-cover.jpg") center / cover no-repeat;
  }

  .cover-copy {
    top: 8%;
    left: 5%;
    width: 48%;
  }

  .story-note,
  .note-left,
  .note-right {
    top: auto;
    bottom: 4%;
    width: min(390px, 43%);
    max-height: 76%;
    padding: 19px 20px;
    transform: none;
  }

  #chapter-1 .story-note,
  #chapter-2 .story-note,
  #chapter-3 .story-note,
  #chapter-6 .story-note {
    right: auto;
    left: 4%;
  }

  #chapter-4 .story-note {
    right: 4%;
    left: auto;
  }

  .story-note h2 {
    font-size: clamp(24px, 4.2vw, 34px);
  }

  .valentine-letter {
    top: auto;
    bottom: 4%;
    left: 4%;
    width: 48%;
    max-height: 78%;
    padding: 21px;
  }

  .final-copy {
    top: 5%;
    right: 4%;
    left: auto;
    width: 43%;
    max-height: 90%;
  }
}

@media (max-width: 600px) {
  .cover-page,
  .scene-page,
  .letter-page {
    background: #f8efdf;
  }

  .constellation-page {
    background: #081a31;
  }

  .cover-art,
  .scene-image,
  .letter-sky,
  .constellation-bg {
    inset: 0 0 auto;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    background-position: center;
    background-size: cover;
  }

  .scene-wash,
  .wash-right {
    inset: 0 0 auto;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    background: linear-gradient(180deg, rgba(4, 11, 20, 0.08), transparent 60%, rgba(4, 11, 20, 0.22));
  }

  .cover-art {
    background:
      linear-gradient(180deg, transparent 62%, rgba(4, 16, 34, 0.35)),
      url("assets/page-00-cover.jpg") center / cover no-repeat;
  }

  .cover-copy,
  .story-note,
  .note-left,
  .note-right,
  .valentine-letter,
  .final-copy {
    top: calc(66.667vw - 4px);
    right: auto;
    bottom: 8px;
    left: 3.5%;
    width: 93%;
    max-height: none;
    overflow: auto;
    padding: 16px 17px;
    border-radius: 15px;
    transform: none;
  }

  .cover-copy {
    color: #fff8ed;
    background: rgba(6, 24, 47, 0.96);
    box-shadow: none;
  }

  .cover-copy h1 {
    font-size: clamp(34px, 10vw, 46px);
  }

  .cover-lead {
    max-width: none;
    margin: 12px 0 10px;
    font-size: 13px;
    line-height: 1.55;
  }

  .cover-meta {
    font-size: 9px;
  }

  .start-button {
    margin-top: 11px;
  }

  .swipe-hint {
    display: none;
  }

  .chapter-tab {
    top: 11px;
    left: 13px;
    font-size: 8px;
  }

  .story-note {
    color: var(--ink);
    border-top-width: 5px;
    background: rgba(255, 250, 239, 0.97);
  }

  #chapter-2 .story-note {
    color: #f8f2e9;
    background: rgba(10, 31, 46, 0.97);
  }

  .story-note h2,
  .valentine-letter h2 {
    margin-bottom: 8px;
    font-size: clamp(23px, 6.8vw, 30px);
  }

  .story-note > p:not(.kicker),
  .valentine-letter > p:not(.letter-date):not(.letter-sign) {
    margin-bottom: 7px;
    font-size: 12px;
    line-height: 1.5;
  }

  .story-note blockquote,
  .valentine-letter blockquote {
    margin: 8px 0;
    padding: 7px 10px 7px 12px;
    font-size: 14px;
  }

  .valentine-letter {
    background: rgba(255, 250, 239, 0.98);
  }

  .letter-sign {
    margin-top: 7px;
    font-size: 13px;
  }

  .final-copy {
    color: #fff;
    background: rgba(5, 19, 39, 0.97);
  }

  .final-copy h2 {
    font-size: clamp(27px, 8vw, 36px);
  }

  .memory-stats {
    margin: 10px 0 8px;
  }

  .memory-stats article {
    padding: 7px 8px;
  }

  .memory-stats strong {
    font-size: 19px;
  }

  .memory-stats span,
  .final-lead,
  .gift-note {
    font-size: 11px;
  }

  .final-quote {
    margin: 8px 0;
    font-size: 15px;
  }

  .restart-button {
    margin-top: 7px;
  }

  .page {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .cover-art,
  .scene-image,
  .letter-sky,
  .constellation-bg {
    position: relative;
    grid-row: 1;
    inset: auto;
    width: 100%;
    min-height: 0;
    aspect-ratio: 3 / 2;
  }

  .cover-copy,
  .story-note,
  .note-left,
  .note-right,
  .valentine-letter,
  .final-copy {
    position: relative;
    grid-row: 2;
    inset: auto;
    align-self: stretch;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    margin: 0;
    overflow-y: auto;
    border-radius: 0;
    box-shadow: none;
  }

  .page-number {
    display: none;
  }
}

/* Contrast and statistics refinements */

#chapter-6 .story-note {
  color: #263940;
  border-color: rgba(69, 55, 39, 0.18);
  border-top-color: #c85f54;
  background: rgba(255, 250, 239, 0.94);
}

#chapter-6 .story-note .kicker {
  color: #9e504a;
}

#chapter-6 .story-note blockquote {
  color: #8f403f;
  border-left-color: #d9695f;
  background: rgba(224, 112, 89, 0.11);
}

#chapter-6 .story-note .small-copy {
  color: #4d666b;
}

.memory-stats article {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(10, 30, 54, 0.74);
}

.memory-stats strong {
  color: #ffdda0;
  font-family: var(--sans);
  font-weight: 800;
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.memory-stats span {
  margin-top: 7px;
  color: #f4f0e8;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

@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;
  }
}
