:root {
  --night: #170d22;
  --night-deep: #0e0916;
  --plum: #321a3b;
  --plum-soft: #53304f;
  --rose: #dda2bd;
  --rose-light: #f4c9db;
  --lilac: #c9b9e4;
  --moon: #fff4ec;
  --gold: #f1cca0;
  --paper: #f8eff4;
  --paper-deep: #eddee9;
  --ink: #38243b;
  --ink-soft: #745e74;
  --white: #fff9f5;
  --margin: clamp(22px, 5vw, 76px);
  --display: "Songti SC", "Noto Serif CJK SC", "STSong", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.76, 0, .24, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--night); }
body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--night);
  color: var(--white);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
svg { display: block; }
p, h1, h2, h3 { margin: 0; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }
::selection { background: var(--rose); color: var(--night); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 5px; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--night-deep); }
::-webkit-scrollbar-thumb { background: var(--plum-soft); border: 3px solid var(--night-deep); border-radius: 10px; }

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--moon);
  color: var(--night);
  transform: translateY(-160%);
  transition: transform .2s;
}
.skip-link:focus { transform: none; }

#ambientCanvas {
  position: fixed;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.grain {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
}
main, .page-footer { position: relative; z-index: 1; }

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px var(--margin);
  color: var(--white);
  transition: color .3s ease, background-color .3s ease;
}
.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(23, 13, 34, .72);
  backdrop-filter: blur(14px);
  opacity: 0;
  transition: opacity .3s;
}
.topbar.is-scrolled::before { opacity: 1; }
.topbar.on-light { color: var(--ink); }
.topbar.on-light::before { background: rgba(248, 239, 244, .8); }
.brand {
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: .12em;
  text-decoration: none;
}
.topbar__right { display: flex; align-items: center; gap: 26px; }
.topbar time { font-size: 13px; letter-spacing: .12em; }
.sound-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
}
.sound-button svg { width: 20px; height: 20px; fill: currentColor; }
.sound-button .sound-wave { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; opacity: .25; }
.sound-button[aria-pressed="true"] .sound-wave { opacity: 1; }

.chapter-nav {
  position: fixed;
  right: 22px;
  top: 50%;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateY(-50%);
}
.chapter-nav a {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  text-decoration: none;
}
.chapter-nav a::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .35;
  transition: transform .25s, opacity .25s;
}
.chapter-nav a.is-active::before { opacity: 1; transform: scale(1.8); }
.chapter-nav.on-light { color: var(--ink); }
.chapter-nav a span {
  position: absolute;
  right: 25px;
  top: 50%;
  width: max-content;
  font-size: 12px;
  opacity: 0;
  transform: translate(6px, -50%);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.chapter-nav a:hover span, .chapter-nav a:focus-visible span { opacity: 1; transform: translate(0, -50%); }

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  min-height: 54px;
  padding: 14px 28px;
  border: 0;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  font-size: 15px;
  letter-spacing: .08em;
  transition: transform .16s var(--ease-out), background-color .2s, color .2s, opacity .2s;
}
.button svg { width: 30px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.button:active { transform: scale(.97); }
.button--light { background: var(--moon); color: var(--night); }
.button--plum { background: var(--plum); color: var(--white); }
.button.is-disabled { opacity: .5; }
.text-button {
  padding: 5px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.5;
}
.text-button--light { color: var(--rose-light); }

.section-heading { max-width: 660px; padding: 0 var(--margin); color: var(--ink); }
.section-heading h2 {
  font-family: var(--display);
  font-size: clamp(36px, 4.5vw, 64px);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -.03em;
}
.section-heading p { max-width: 570px; margin-top: 24px; color: var(--ink-soft); font-size: 17px; }
.section-heading--dark { color: var(--white); }
.section-heading--dark p { color: #cbb9ca; }

/* 开场 */
.opening {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(380px, .96fr);
  align-items: center;
  gap: 30px;
  min-height: 100svh;
  padding: 120px var(--margin) 92px;
  overflow: clip;
  background: var(--night);
  isolation: isolate;
}
.opening__wash {
  position: absolute;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(circle at 76% 42%, rgba(201, 185, 228, .16), transparent 33%),
    radial-gradient(circle at 16% 78%, rgba(181, 86, 125, .18), transparent 36%);
}
.curtain {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: -1;
  width: 36%;
  opacity: .55;
  pointer-events: none;
  transition: transform 1.8s var(--ease-in-out), opacity 1.4s;
}
.curtain::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0, rgba(255,255,255,.035) 12%, rgba(0,0,0,.12) 25%, transparent 38%);
}
.curtain--left {
  left: 0;
  background: linear-gradient(90deg, #3b1735, #6a2949 65%, transparent);
  clip-path: polygon(0 0, 100% 0, 67% 52%, 88% 100%, 0 100%);
}
.curtain--right {
  right: 0;
  background: linear-gradient(-90deg, #3b1735, #6a2949 65%, transparent);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 12% 100%, 33% 52%);
}
.opening.is-open .curtain--left { transform: translateX(-58%); opacity: .25; }
.opening.is-open .curtain--right { transform: translateX(58%); opacity: .25; }
.opening__copy { position: relative; z-index: 4; max-width: 720px; }
.opening__title {
  font-family: var(--display);
  font-size: clamp(58px, 7.4vw, 112px);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -.055em;
}
.title-line { display: block; overflow: hidden; padding: 0 .08em .1em 0; margin-bottom: -.08em; }
.title-line > span { display: block; }
.opening__lead { margin-top: 32px; color: #e4cfdf; font-size: clamp(17px, 1.6vw, 21px); letter-spacing: .08em; }
.opening .button { margin-top: 38px; }
.opening__note { margin-top: 16px; color: #a996ad; font-size: 13px; }
.opening__art {
  position: relative;
  justify-self: center;
  width: min(44vw, 620px);
  height: min(73svh, 690px);
  min-height: 540px;
  z-index: 2;
}
.moon-halo {
  position: absolute;
  left: 50%;
  top: 47%;
  width: 74%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 38% 32%, #fff8ed 0, #efd9e4 42%, #b49ac7 72%, rgba(137,99,154,.05) 73%);
  box-shadow: 0 35px 90px rgba(8, 3, 15, .35);
}
.orbit { position: absolute; left: 50%; top: 47%; border: 1px solid rgba(244,201,219,.24); border-radius: 50%; transform: translate(-50%,-50%) rotate(-15deg); }
.orbit--outer { width: 100%; height: 68%; }
.orbit--inner { width: 85%; height: 85%; transform: translate(-50%,-50%) rotate(32deg); }
#heroCanvas { position: absolute; inset: -12%; width: 124%; height: 124%; }
.dancer { overflow: visible; filter: drop-shadow(0 24px 20px rgba(32,15,39,.2)); }
.dancer--hero {
  position: absolute;
  left: 50%;
  bottom: 3%;
  width: 64%;
  height: 85%;
  transform: translateX(-50%);
  transform-origin: 50% 85%;
}
.floating-star { position: absolute; width: 28px; color: var(--gold); filter: drop-shadow(0 0 12px rgba(241,204,160,.55)); }
.floating-star svg { fill: currentColor; }
.floating-star--one { left: 9%; top: 27%; }
.floating-star--two { right: 6%; top: 54%; width: 18px; color: var(--rose-light); }
.date-card {
  position: absolute;
  right: -2%;
  bottom: 5%;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 116px;
  padding: 20px 12px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 12px 18px 40px rgba(7,3,12,.25);
  transform: rotate(4deg);
}
.date-card strong { font-family: var(--display); font-size: 56px; font-weight: 400; line-height: 1.1; }
.date-card span { font-size: 13px; letter-spacing: .12em; }
.scroll-cue {
  position: absolute;
  left: var(--margin);
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: #ad99b2;
  font-size: 12px;
  text-decoration: none;
}
.scroll-cue i { display: block; width: 46px; height: 1px; background: currentColor; transform-origin: left; }

/* 起舞 */
.dance { position: relative; padding: 150px 0 120px; background: var(--night-deep); }
.dance .section-heading { margin-bottom: 62px; }
.dance-stage {
  position: relative;
  height: min(78svh, 790px);
  min-height: 690px;
  margin: 0 var(--margin);
  overflow: hidden;
  background: #1d1028;
  border-radius: 32px;
  isolation: isolate;
  touch-action: pan-y;
}
#danceCanvas { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; }
.stage-spotlight {
  position: absolute;
  left: 50%;
  top: -20%;
  z-index: 0;
  width: 62%;
  height: 100%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(239,218,239,.16), rgba(239,218,239,.02) 75%, transparent);
  clip-path: polygon(39% 0, 61% 0, 100% 100%, 0 100%);
}
.dancer--stage {
  position: absolute;
  left: 50%;
  top: 5%;
  z-index: 1;
  width: min(42%, 420px);
  height: 70%;
  transform: translateX(-50%);
  transform-origin: 50% 82%;
  opacity: .92;
  transition: filter .25s;
}
.dance-hint {
  position: absolute;
  top: 28px;
  left: 32px;
  z-index: 4;
  color: #b9a4bc;
  font-size: 13px;
  pointer-events: none;
}
.beat-panel {
  position: absolute;
  left: 50%;
  bottom: 26px;
  z-index: 5;
  width: min(760px, calc(100% - 48px));
  padding: 22px 28px 18px;
  transform: translateX(-50%);
  background: rgba(20, 11, 29, .86);
  border: 1px solid rgba(244,201,219,.16);
  border-radius: 26px;
  backdrop-filter: blur(16px);
}
.beat-panel__top { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.beat-progress { display: flex; gap: 8px; list-style: none; margin: 0; padding: 0; }
.beat-progress li { width: 7px; height: 7px; border-radius: 50%; background: #5b465f; transition: background .25s, transform .25s; }
.beat-progress li.is-on { background: var(--gold); transform: scale(1.3); }
.beat-pads { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.beat-pad {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 68px;
  border: 1px solid #684c6a;
  border-radius: 50%;
  background: #2d1937;
  color: #d5bfd2;
  cursor: pointer;
  transition: background-color .18s, color .18s, transform .16s, border-color .18s;
}
.beat-pad span { font-family: var(--display); font-size: 23px; }
.beat-pad:active { transform: scale(.94); }
.beat-pad.is-lit { background: var(--rose-light); border-color: var(--rose-light); color: var(--night); }
.beat-pad.is-correct { background: var(--gold); border-color: var(--gold); color: var(--night); }
.beat-pad:disabled { cursor: default; }
.beat-status { min-height: 23px; margin-top: 12px; color: #bca9bf; text-align: center; font-size: 13px; }

/* 愿望 */
.wishes {
  position: relative;
  min-height: 100svh;
  padding: 150px 0 130px;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  text-align: center;
}
.wishes .section-heading { margin: 0 auto; }
.constellation {
  position: relative;
  width: min(1080px, calc(100% - var(--margin) * 2));
  height: 540px;
  margin: 48px auto 0;
}
.constellation__lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.constellation__lines path {
  fill: none;
  stroke: #a882a7;
  stroke-width: 1.5;
  stroke-dasharray: 7 10;
  stroke-dashoffset: 500;
  opacity: 0;
  transition: stroke-dashoffset 1.6s var(--ease-out), opacity .5s;
}
.constellation__lines path.is-drawn { stroke-dashoffset: 0; opacity: .75; }
.constellation__moon {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 290px;
  height: 290px;
  border-radius: 50%;
  background: #ead5e5;
  transform: translate(-50%,-50%);
  box-shadow: 28px 30px 0 #f2e5ed;
}
.wish-star {
  position: absolute;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 140px;
  padding: 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.wish-star--one { left: 8%; top: 42%; }
.wish-star--two { left: 50%; top: 13%; transform: translateX(-50%); }
.wish-star--three { right: 8%; top: 43%; }
.wish-star svg { width: 72px; height: 72px; fill: #bca6bd; transition: fill .35s, transform .7s var(--ease-out), filter .35s; }
.wish-star span { font-family: var(--display); font-size: 22px; }
.wish-star:hover svg { transform: rotate(12deg) scale(1.08); }
.wish-star.is-lit svg { fill: var(--gold); transform: rotate(45deg) scale(1.13); filter: drop-shadow(0 8px 14px rgba(159,105,121,.25)); }
.wish-message {
  position: absolute;
  left: 50%;
  bottom: 6px;
  z-index: 4;
  width: min(560px, 90%);
  min-height: 62px;
  transform: translateX(-50%);
  color: var(--ink-soft);
  font-size: 16px;
}
.secret-stars { position: absolute; inset: 0; pointer-events: none; }
.secret-star {
  position: absolute;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--rose);
  box-shadow: 0 0 20px rgba(221,162,189,.7);
}
.secret-wish { width: min(520px, calc(100% - 44px)); margin: 24px auto 36px; text-align: left; }
.secret-wish label { display: block; margin-bottom: 12px; font-family: var(--display); font-size: 20px; }
.secret-wish__row { display: flex; align-items: stretch; background: #fff9fb; border-radius: 999px; padding: 5px; }
.secret-wish input {
  min-width: 0;
  flex: 1;
  height: 48px;
  padding: 0 18px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  caret-color: var(--plum-soft);
}
.secret-wish input::placeholder { color: #9b8498; }
.secret-wish__row:focus-within { outline: 2px solid var(--plum-soft); outline-offset: 3px; }
.secret-wish button { padding: 0 20px; border: 0; border-radius: 999px; background: var(--plum); color: var(--white); cursor: pointer; }
.secret-wish > p { margin: 9px 0 0 18px; color: var(--ink-soft); font-size: 12px; }

/* 蜡烛 */
.cake-scene { position: relative; min-height: 100svh; padding: 150px 0 120px; background: #251128; }
.cake-scene .section-heading { margin: 0 auto; text-align: center; }
.cake-stage {
  position: relative;
  width: min(900px, calc(100% - var(--margin) * 2));
  height: 610px;
  margin: 26px auto 0;
  overflow: hidden;
}
.cake-glow {
  position: absolute;
  left: 50%;
  top: 43%;
  width: 550px;
  height: 550px;
  border-radius: 50%;
  transform: translate(-50%,-50%);
  background: radial-gradient(circle, rgba(238,183,167,.2), rgba(197,132,171,.06) 44%, transparent 70%);
  transition: opacity 1s;
}
.birthday-cake { position: absolute; left: 50%; bottom: 2%; width: min(560px, 90%); transform: translateX(-50%); overflow: visible; transition: opacity 1s, transform 1.2s var(--ease-out); }
.flame-group { transform-box: fill-box; transform-origin: 50% 100%; transition: opacity .45s, transform .45s; }
.flame-shape { transform-box: fill-box; transform-origin: 50% 100%; }
.flame-aura { transform-box: fill-box; transform-origin: center; }
.smoke-wisps { opacity: 0; }
.birthday-cake.is-blown .flame-group { opacity: 0; transform: scale(.2,.05); }
.birthday-cake.is-blown .smoke-wisps { opacity: .5; }
.birthday-cake.is-blown .smoke-wisps path { stroke-dasharray: 160; }
.cake-stage.is-blown .birthday-cake { opacity: .13; transform: translateX(-50%) scale(.9); }
.cake-stage.is-blown .cake-glow { opacity: .2; }
.birthday-reveal {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
  opacity: 0;
  transform: translateY(24px);
  pointer-events: none;
  transition: opacity 1s var(--ease-out), transform 1s var(--ease-out);
}
.birthday-reveal > svg { width: 40px; fill: var(--gold); margin-bottom: 22px; }
.birthday-reveal h3 { font-family: var(--display); font-size: clamp(40px, 5.2vw, 70px); font-weight: 400; line-height: 1.2; }
.birthday-reveal p { margin-top: 22px; color: #e4c9da; font-size: 18px; line-height: 1.9; }
.birthday-reveal .button { margin-top: 34px; }
.cake-stage.is-blown .birthday-reveal { opacity: 1; transform: none; pointer-events: auto; }
.cake-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 18px 28px; padding: 0 var(--margin); }
.cake-controls > p { flex-basis: 100%; margin-top: 0; color: #bba2b6; text-align: center; font-size: 13px; }
.button--hold { min-width: 190px; user-select: none; touch-action: none; }
.hold-fill { position: absolute; inset: 0; background: var(--rose); transform: scaleX(0); transform-origin: left; }
.hold-label { position: relative; }
.button--hold.is-holding .hold-fill { transform: scaleX(1); transition: transform 1.25s linear; }
.cake-controls.is-finished { opacity: 0; pointer-events: none; transition: opacity .5s; }

/* 信 */
.letter-scene {
  position: relative;
  padding: 150px var(--margin) 100px;
  overflow: hidden;
  background: #e7d6e5;
  color: var(--ink);
}
.letter-stars i { position: absolute; width: 10px; height: 10px; background: #b08aa9; transform: rotate(45deg); }
.letter-stars i:nth-child(1) { left: 9%; top: 15%; }
.letter-stars i:nth-child(2) { right: 12%; top: 10%; width: 18px; height: 18px; }
.letter-stars i:nth-child(3) { left: 15%; bottom: 20%; width: 7px; height: 7px; }
.letter-stars i:nth-child(4) { right: 8%; bottom: 28%; }
.letter-stars i:nth-child(5) { right: 20%; top: 48%; width: 6px; height: 6px; }
.letter-paper {
  position: relative;
  width: min(790px, 100%);
  margin: 0 auto;
  padding: clamp(42px, 7vw, 88px) clamp(28px, 8vw, 94px);
  background: #fff9f5;
  box-shadow: 24px 34px 80px rgba(63,34,62,.15);
}
.letter-paper::before {
  content: "";
  position: absolute;
  left: 24px;
  top: 24px;
  width: 18px;
  height: 18px;
  background: var(--rose);
  transform: rotate(45deg);
}
.letter-paper h2 { margin-bottom: 46px; font-family: var(--display); font-size: clamp(40px, 5vw, 62px); font-weight: 500; letter-spacing: -.03em; }
.letter-body { font-family: var(--display); font-size: clamp(17px, 1.6vw, 20px); line-height: 2.05; }
.letter-body p + p { margin-top: 24px; }
.letter-signoff { display: flex; justify-content: space-between; gap: 20px; margin-top: 50px; color: var(--ink-soft); font-size: 13px; }
.replay-button {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 42px auto 0;
  padding: 12px 18px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
}
.replay-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.page-footer { display: flex; justify-content: space-between; gap: 20px; padding: 32px var(--margin); background: var(--night); color: #a58ea9; font-size: 13px; }

#celebrationCanvas { position: fixed; inset: 0; z-index: 60; width: 100%; height: 100%; pointer-events: none; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 100;
  max-width: calc(100% - 40px);
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--moon);
  color: var(--night);
  box-shadow: 0 10px 30px rgba(14,7,20,.2);
  font-size: 14px;
  opacity: 0;
  transform: translate(-50%, 16px);
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%,0); }

@media (prefers-reduced-motion: no-preference) {
  .js .title-line > span { transform: translateY(110%); animation: title-arrive 1.1s var(--ease-out) forwards; }
  .js .title-line:nth-child(2) > span { animation-delay: .12s; }
  .js .opening__lead, .js .opening .button, .js .opening__note { opacity: 0; animation: soft-arrive .8s var(--ease-out) .45s forwards; }
  .js .opening .button { animation-delay: .56s; }
  .js .opening__note { animation-delay: .66s; }
  .js .opening__art { opacity: 0; animation: art-arrive 1.3s var(--ease-out) .18s forwards; }
  .floating-star--one { animation: star-breathe 3.6s ease-in-out infinite; }
  .floating-star--two { animation: star-breathe 4.2s ease-in-out -1.4s infinite; }
  .dancer--hero { animation: dancer-sway 7s ease-in-out infinite; }
  .scroll-cue i { animation: line-breathe 2s ease-in-out infinite; }
  .flame-shape { animation: flame-dance 1.8s ease-in-out infinite; }
  .flame-aura { animation: aura-dance 2.4s ease-in-out infinite; }
  .birthday-cake.is-blown .smoke-wisps path { animation: smoke-rise 3s var(--ease-out) forwards; }
  .secret-star { animation: secret-arrive 1.2s var(--ease-out) both, star-breathe 3s ease-in-out 1.2s infinite; }
  .js [data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease-out), transform .8s var(--ease-out); }
  .js [data-reveal].is-visible { opacity: 1; transform: none; }
}

@keyframes title-arrive { to { transform: none; } }
@keyframes soft-arrive { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes art-arrive { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes star-breathe { 0%,100% { opacity: .45; transform: scale(.8) rotate(0); } 50% { opacity: 1; transform: scale(1.15) rotate(20deg); } }
@keyframes dancer-sway { 0%,100% { transform: translateX(-50%) rotate(-1.5deg); } 50% { transform: translateX(-50%) rotate(1.5deg); } }
@keyframes line-breathe { 0%,100% { transform: scaleX(.45); opacity: .4; } 50% { transform: scaleX(1); opacity: 1; } }
@keyframes flame-dance { 0%,100% { transform: rotate(-2deg) scale(1); } 40% { transform: rotate(3deg) scale(.94,1.08); } 70% { transform: rotate(-1deg) scale(1.04,.95); } }
@keyframes aura-dance { 0%,100% { opacity: .1; transform: scale(.9); } 50% { opacity: .2; transform: scale(1.12); } }
@keyframes smoke-rise { from { stroke-dashoffset: 160; transform: translateY(8px); } to { stroke-dashoffset: 0; transform: translateY(-24px); } }
@keyframes secret-arrive { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 1000px) {
  .opening { grid-template-columns: 1fr 400px; }
  .opening__art { width: 420px; height: 600px; }
  .opening__title { font-size: clamp(58px, 8vw, 82px); }
  .date-card { right: 0; }
  .chapter-nav { right: 10px; }
  .dancer--stage { width: min(52%, 390px); }
}

@media (max-width: 760px) {
  :root { --margin: 22px; }
  .topbar { padding-top: 15px; padding-bottom: 15px; }
  .topbar time, .sound-button span, .chapter-nav { display: none; }
  .brand { font-size: 15px; }
  .sound-button { min-width: 42px; justify-content: flex-end; }
  .opening {
    display: block;
    min-height: 100svh;
    padding-top: 116px;
    padding-bottom: 84px;
  }
  .opening__copy { position: relative; z-index: 5; }
  .opening__title { font-size: clamp(55px, 17vw, 76px); line-height: 1.07; }
  .opening__lead { margin-top: 22px; font-size: 16px; letter-spacing: .04em; }
  .opening .button { margin-top: 28px; }
  .opening__art { width: min(100%, 410px); height: 440px; min-height: 0; margin: -6px auto 0; }
  .moon-halo { width: 78%; }
  .dancer--hero { height: 90%; width: 65%; }
  .date-card { right: 1%; bottom: 1%; width: 90px; padding: 14px 8px; }
  .date-card strong { font-size: 42px; }
  .date-card span { font-size: 10px; }
  .scroll-cue { bottom: 20px; }
  .section-heading h2 { font-size: 39px; }
  .section-heading p { margin-top: 18px; font-size: 16px; }
  .dance { padding: 110px 0 90px; }
  .dance .section-heading { margin-bottom: 38px; }
  .dance-stage { height: 760px; min-height: 0; margin: 0 12px; border-radius: 26px; }
  .dance-hint { top: 20px; left: 22px; }
  .dancer--stage { top: 7%; width: 88%; height: 61%; }
  .beat-panel { bottom: 16px; width: calc(100% - 28px); padding: 18px 16px 14px; border-radius: 22px; }
  .beat-pad { min-height: 60px; }
  .beat-progress { gap: 6px; }
  .beat-progress li { width: 6px; height: 6px; }
  .wishes { padding: 110px 0 100px; }
  .constellation { width: 100%; height: 590px; margin-top: 24px; }
  .constellation__moon { width: 220px; height: 220px; top: 42%; }
  .wish-star { width: 116px; gap: 8px; }
  .wish-star svg { width: 58px; height: 58px; }
  .wish-star span { font-size: 19px; }
  .wish-star--one { left: 1%; top: 39%; }
  .wish-star--two { top: 10%; }
  .wish-star--three { right: 1%; top: 40%; }
  .wish-message { bottom: 34px; font-size: 15px; }
  .secret-wish { margin-top: 0; }
  .secret-wish__row { border-radius: 24px; }
  .secret-wish input { width: 55%; padding: 0 14px; font-size: 14px; }
  .secret-wish button { padding: 0 15px; font-size: 14px; }
  .cake-scene { padding: 110px 0 90px; }
  .cake-stage { width: 100%; height: 560px; margin-top: 8px; }
  .birthday-cake { width: 440px; max-width: 105%; bottom: 6%; }
  .birthday-reveal { padding: 24px; }
  .birthday-reveal h3 { font-size: 43px; }
  .birthday-reveal p { font-size: 16px; }
  .cake-controls { gap: 16px; }
  .letter-scene { padding-top: 100px; padding-bottom: 80px; }
  .letter-paper { padding: 48px 28px; box-shadow: 12px 20px 50px rgba(63,34,62,.13); }
  .letter-paper h2 { margin-bottom: 34px; }
  .letter-body { font-size: 18px; line-height: 1.95; }
  .letter-body p + p { margin-top: 21px; }
  .letter-signoff { flex-direction: column; gap: 2px; margin-top: 38px; }
  .page-footer { flex-direction: column; gap: 4px; }
}

@media (max-width: 390px) {
  .opening__title { font-size: 55px; }
  .opening__art { height: 400px; }
  .beat-panel__top { gap: 10px; }
  .beat-progress { gap: 5px; }
  .text-button { font-size: 13px; }
}

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