:root {
  color-scheme: light;
  --ink: #4e2431;
  --muted: #76505a;
  --rose: #a13956;
  --berry: #792440;
  --paper: #fff9f4;
  --line: #e9cbd0;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --serif: Georgia, 'Times New Roman', serif;
  --sans: 'Segoe UI', system-ui, sans-serif;
  --grain: radial-gradient(#64293815 .55px, transparent .8px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 280px;
  color: var(--ink);
  font: 1rem/1.55 var(--sans);
  background-color: #f9e1e4;
  background-image: radial-gradient(ellipse at 43% 20%, #fff0e68c, transparent 68%), repeating-linear-gradient(90deg, #c7596913 0 23px, transparent 23px 46px), repeating-linear-gradient(0deg, #c7596916 0 23px, transparent 23px 46px);
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--berry); outline-offset: 5px; }
h1:focus, h2:focus { outline: none; }
p { margin: 0; }

.site { width: min(1120px, calc(100% - 48px)); min-height: 100svh; margin: auto; display: grid; grid-template-rows: auto auto auto; align-content: center; padding: 24px 0; gap: 17px; }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 9px; padding: 0 5px; }
.signature { display: inline-flex; gap: 12px; align-items: center; font: italic 1.43rem/1.3 var(--serif); padding: 8px 0; }
.signature .heart { width: 9px; color: var(--rose); }
.music, .chapters { background: #fff8f2db; border: 1px solid #fff7f1; box-shadow: 0 4px 15px #8038480f; border-radius: 24px; }
.music { display: inline-flex; gap: 9px; align-items: center; min-height: 46px; min-width: 0; padding: 5px 11px 5px 5px; text-align: left; }
.music:hover, .music[aria-pressed='true'] { background: #fffaf6; }
.music-cover { flex: none; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px #66304924; }
.music-copy { display: grid; min-width: 0; line-height: 1.15; gap: 3px; }
.music-copy strong { font-size: .8rem; }
.music-copy span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .7rem; }
.equalizer { flex: none; display: flex; align-items: end; justify-content: space-between; width: 17px; height: 15px; margin-left: 2px; }
.equalizer i { width: 2px; height: 14px; border-radius: 2px; background: var(--rose); transform: scaleY(.24); transform-origin: bottom; }
.music.is-playing .equalizer i { animation: equalize .69s ease-in-out infinite alternate; }
.music.is-playing .equalizer i:nth-child(2) { animation-duration: .83s; animation-delay: -.45s; }
.music.is-playing .equalizer i:nth-child(3) { animation-duration: .57s; animation-delay: -.24s; }
.music.is-playing .equalizer i:nth-child(4) { animation-delay: -.61s; }
@keyframes equalize { from { transform: scaleY(.35); } to { transform: scaleY(1); } }

.book { position: relative; border: 1px solid #fff9f3; border-radius: 27px; background: var(--paper); box-shadow: 0 23px 73px #79304124, 0 4px 11px #a7415614; isolation: isolate; }
.scene { border-radius: inherit; min-height: 550px; }
.scene--home, .scene--split { display: grid; grid-template-columns: 42% 58%; }
.intro { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 24px; padding: clamp(28px, 5vw, 72px); }
.kicker { color: var(--rose); font-size: .75rem; line-height: 1.3; font-weight: 700; letter-spacing: .155em; text-transform: uppercase; }
h1, h2 { margin: 0; font: 400 clamp(3rem, 7.25vw, 7rem)/.91 var(--serif); letter-spacing: -.091em; }
h1 em, h2 em { color: var(--rose); font-weight: inherit; }
.scene--home h1 em { font-size: .72em; }
.intro-note { font-size: clamp(1rem, 1.4vw, 1.17rem); color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 11px 21px; border: 1px solid transparent; border-radius: 10px; background: var(--berry); color: #fff9f5; font-size: .91rem; font-weight: 650; text-align: center; transition: background-color .2s, transform .3s var(--ease), box-shadow .3s; box-shadow: 0 5px 10px #79244020; }
.button:hover { background: #962c50; transform: translateY(-2px); box-shadow: 0 8px 17px #7924402d; }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .65; cursor: default; }
.chapters { justify-self: center; display: flex; justify-content: center; padding: 4px; gap: 3px; }
.chapters a { text-align: center; padding: 8px 15px; min-height: 41px; border-radius: 20px; font-size: .87rem; font-weight: 600; transition: background-color .2s, color .2s; }
.chapters a:hover { background: #f7dde1; }
.chapters a[aria-current='page'] { color: #fff7f3; background: var(--berry); }

.gift-stage, .worktop { position: relative; display: grid; place-items: center; isolation: isolate; min-width: 0; margin: 12px 12px 12px 0; border-radius: 19px; overflow: hidden; }
.gift-stage { background-color: #eaa5b1; background-image: var(--grain), radial-gradient(ellipse at 25% 10%, #ffddd5 0%, transparent 66%), linear-gradient(138deg,#f1b2bd,#dc8197); background-size: 4px 4px, auto, auto; }
.gift-stage::before { content: ''; position: absolute; inset: 13px; border: 1px solid #fff1e9a6; border-radius: 12px; pointer-events: none; }
.gift-stage::after { content: ''; position: absolute; z-index: -1; width: 95%; height: 125%; background: linear-gradient(129deg,transparent 22%,#fff7db26 43%,transparent 57%); transform: rotate(4deg); pointer-events: none; }
.gift-mat { position: absolute; top: 50%; left: 50%; width: 76%; max-width: 440px; aspect-ratio: 1.32; background: #f8c4cb7a; border: 1px solid #fff0ed6e; border-radius: 50%; transform: translate(-50%,-50%) rotate(-14deg); box-shadow: inset 0 0 24px #fff5e24a; z-index: -1; }
.gift-mat::after { content: ''; position: absolute; inset: 8px; border: 1px dashed #fff7f377; border-radius: inherit; }
.gift-caption { position: absolute; bottom: 29px; display: flex; gap: 12px; align-items: center; color: #63273b; font: italic 1.08rem var(--serif); }
.gift-caption span { height: 1px; width: 23px; background: currentColor; opacity: .45; }
.envelope-button { display: grid; place-items: center; width: min(66%, 385px); aspect-ratio: 1.55; border: 0; padding: 0; background: transparent; perspective: 950px; touch-action: manipulation; }
.envelope { position: relative; display: block; width: 100%; height: 100%; transform: rotate(-9deg); transform-style: preserve-3d; transition: transform .65s var(--ease); filter: drop-shadow(5px 17px 15px #69304746); }
.envelope-button:hover .envelope, .envelope-button:focus-visible .envelope { transform: translateY(-6px) rotate(-5deg); }
.envelope-back, .envelope-front, .envelope-flap, .envelope-card { position: absolute; inset: 0; border-radius: 4px; }
.envelope-back { background: #9b425d; }
.envelope-front { background: var(--grain) 0 0 / 4px 4px, conic-gradient(from 48deg at 50% 57%, #bd637a 0 23%,#cf8295 0 51%, #c47588 0 77%,#ac536b 0); clip-path: polygon(0 0,50% 56%,100% 0,100% 100%,0 100%); box-shadow: inset 0 0 0 1px #84324e38; }
.envelope-flap { background: var(--grain) 0 0 / 4px 4px, linear-gradient(164deg,#e5aeb2,#bd6b82); clip-path: polygon(0 0,100% 0,53% 65%,50% 67%,47% 65%); transform-origin: top; transition: transform .56s var(--ease); }
.envelope-card { display: grid; justify-items: center; align-content: center; gap: 12px; inset: 6% 8% 10%; background: var(--grain) 0 0 / 4px 4px, #fff0e4; color: var(--berry); font: clamp(.98rem, 2.5vw, 1.8rem) var(--serif); transition: transform .75s var(--ease) .13s; }
.envelope-card::after { content: ''; position: absolute; inset: 6px; border: 1px solid #c38396; border-radius: 2px; }
.envelope-seal { position: absolute; z-index: 3; top: 54%; left: 50%; transform: translate(-50%,-20%) rotate(6deg); width: 16%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 44% 48% 46% 50%; color: #f8c9cd; background: radial-gradient(circle at 32% 22%, #b95173 15%,#902948 82%); box-shadow: inset 0 0 0 2px #c65f7f, inset 0 0 0 5px #a03c5c, 2px 4px 5px #6c1a3c55; transition: opacity .3s, transform .5s var(--ease); }
.envelope-seal .heart { width: 28%; filter: drop-shadow(1px 2px #6c1a3c); }
.envelope-button.is-open .envelope { transform: translateY(27px) rotate(-3deg); }
.envelope-button.is-open .envelope-flap { transform: rotateX(171deg); z-index: -1; }
.envelope-button.is-open .envelope-card { transform: translateY(-48%) rotate(3deg); }
.envelope-button.is-open .envelope-seal { opacity: 0; transform: translate(-50%,-20%) scale(.65); }
.heart { display: inline-block; position: relative; width: 15px; aspect-ratio: 1; background: currentColor; transform: rotate(-45deg) scale(.8); }
.heart::before, .heart::after { content: ''; position: absolute; width: 100%; height: 100%; border-radius: 50%; background: currentColor; }
.heart::before { top: -50%; left: 0; }
.heart::after { top: 0; left: 50%; }

.scene-copy { gap: 20px; }
.scene-copy h2, .letter-paper h2 { font-size: clamp(2.6rem, 5.9vw, 5.55rem); line-height: .97; letter-spacing: -.065em; }
.scene-copy > p:not(.kicker) { color: var(--muted); max-width: 29ch; }
.worktop { min-height: 500px; background: var(--grain) 0 0 / 4px 4px, radial-gradient(ellipse at 25% 0%, #fff7ed, transparent 70%), #efc3c9; }
.album-table { background-color: #ebbdc4; background-image: repeating-linear-gradient(0deg, #ac5b7218 0 1px, transparent 1px 26px), var(--grain), radial-gradient(ellipse at 26% 12%,#ffe8db,transparent 65%); background-size: auto, 4px 4px, auto; }
.album-display { display: grid; justify-items: center; gap: 23px; width: 100%; margin: 0; padding-top: 12px; }
.album-deck { position: relative; width: min(47%, 265px); aspect-ratio: .82; margin-top: -12px; perspective: 900px; }
.photo-caption { max-width: 34ch; width: 86%; min-height: 2.5em; color: var(--ink); font: italic clamp(1.03rem, 2.15vw, 1.32rem)/1.25 var(--serif); text-align: center; text-wrap: balance; }
.polaroid { position: absolute; inset: 0; display: grid; grid-template-rows: minmax(0,1fr) 25px; padding: 11px 11px 6px; border: 1px solid #eddfd6; border-radius: 3px; background: #fff9ee; box-shadow: 0 6px 18px #67313b2d, 0 1px 4px #67313b24; will-change: transform; }
button.polaroid { width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
button.polaroid:active { cursor: grabbing; }
.polaroid-media { display: grid; overflow: hidden; place-items: center; min-width: 0; background: var(--grain) 0 0 / 4px 4px, linear-gradient(145deg,#fff8f36b,transparent 70%), #e7c1c6; border: 1px solid #5b354011; }
.polaroid-media img { width: 100%; height: 100%; min-height: 0; object-fit: cover; }
.polaroid-mark { align-self: center; justify-self: center; height: 6px; width: 6px; color: #b66b80; margin-top: 4px; }
.album-controls, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 11px 13px; }
.photo-count { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .83rem; }
.text-button { background: transparent; border: 0; padding: 10px 4px; min-height: 42px; color: var(--berry); font-size: .88rem; font-weight: 650; text-underline-offset: 4px; }
.text-button:hover { text-decoration: underline; }
.actions .text-button { padding-inline: 8px; }
.game-status { min-height: 1.55em; font-size: .9rem; font-weight: 650; }

.match-table { background-color: #eec9c2; }
.memory-grid { width: min(80%, 360px); display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: clamp(9px, 1.4vw, 16px); perspective: 1000px; }
.memory-card { min-width: 0; width: 100%; aspect-ratio: .82; position: relative; border: 0; padding: 0; background: transparent; perspective: 660px; touch-action: manipulation; transition: transform .33s var(--ease); }
.memory-card:hover { transform: translateY(-4px); }
.memory-card:active { transform: translateY(2px) scale(.97); }
.memory-card.is-matched { cursor: default; }
.memory-card.is-matched:hover { transform: none; }
.card-turn { position: absolute; inset: 0; display: block; transform-style: preserve-3d; transition: transform .55s var(--ease); }
.memory-card.is-flipped .card-turn { transform: rotateY(180deg); }
.card-face { position: absolute; inset: 0; display: grid; place-items: center; backface-visibility: hidden; border-radius: 9px; border: 1px solid #fff6eb; box-shadow: 2px 5px 10px #7d3d4633; }
.card-cover { background: var(--grain) 0 0 / 4px 4px, repeating-linear-gradient(45deg,#a83f6021 0 3px,transparent 3px 8px), #bf657d; color: #ffe7df; }
.card-cover::after, .card-value::after { content: ''; pointer-events: none; position: absolute; inset: 7px; border: 1px solid #fff3e6ad; border-radius: 4px; }
.card-value { background: #fff2e8; color: #a84463; transform: rotateY(180deg); }
.card-value::after { border-color: #d89baa8c; }
.memory-card.is-matched .card-value { background: #f1f0df; color: #657246; }
.memory-card.is-matched .card-value::after { border-color: #a6a9848c; }
.motif { width: 23px; height: 23px; display: grid; place-items: center; }
.motif--flower { border-radius: 50%; width: 8px; height: 8px; background: #f4bc69; box-shadow: 0 -8px 0 2px currentColor, 7.7px -2.4px 0 2px currentColor, 4.8px 6.5px 0 2px currentColor, -4.8px 6.5px 0 2px currentColor, -7.7px -2.4px 0 2px currentColor; }
.motif--bow { position: relative; border-radius: 50%; width: 8px; height: 8px; background: currentColor; }
.motif--bow::before, .motif--bow::after { content: ''; position: absolute; width: 14px; height: 11px; top: -4px; border: 2px solid currentColor; }
.motif--bow::before { right: 4px; border-radius: 45% 55% 22% 75%; transform: rotate(22deg); }
.motif--bow::after { left: 4px; border-radius: 55% 45% 75% 22%; transform: rotate(-22deg); }

.catch-table { background-color: #efb9c6; }
.catch-arena { position: relative; overflow: hidden; width: min(88%, 515px); height: min(410px, 75%); min-height: 280px; border: 1px solid #fff4ec; border-radius: 10px; touch-action: none; background: var(--grain) 0 0 / 4px 4px, repeating-linear-gradient(0deg, transparent 0 27px, #b2768b20 27px 28px), #fff0e6; box-shadow: 0 6px 20px #7d3d4627; }
.catch-guide { position: absolute; inset: 6px; border: 1px dashed #d5a3ab; border-radius: 5px; pointer-events: none; }
.catch-preview, .catch-pieces { position: absolute; inset: 0; pointer-events: none; }
.catch-preview { color: #c95878; opacity: .66; }
.catch-preview .heart { position: absolute; width: 13px; top: 35%; left: 28%; }
.catch-preview .heart:nth-child(2) { top: 20%; left: 50%; width: 17px; }
.catch-preview .heart:nth-child(3) { top: 38%; left: 69%; width: 12px; }
.catch-piece { position: absolute; top: 0; left: 0; display: grid; width: 26px; height: 26px; place-items: center; filter: drop-shadow(1px 3px 0 #8c284b2a); }
.catch-piece .heart { width: 14px; }
.jar { --fill: 0%; --jar-width: 90px; position: absolute; bottom: 19px; left: 50%; width: var(--jar-width); height: 73px; transform: translateX(-50%); border: 2px solid #a76478; border-top: 1px solid #a76478; border-radius: 12px 12px 20px 20px; background: linear-gradient(91deg,#ffe8e871,#fff7f481 21%,#e597ad39 48%,#f9cbd8b3 97%); box-shadow: inset 5px 0 0 #fffcf766, inset -5px -4px 0 #c770853b, 0 6px 7px #8c445333; }
.jar::before { content: ''; position: absolute; top: -7px; left: -4px; right: -4px; height: 10px; border: 1px solid #ab6579; border-radius: 50%; background: #f2c4cd; box-shadow: inset 0 2px 2px #99486052, 0 2px 0 #fff3ecad; z-index: 2; }
.jar-fill { position: absolute; inset: auto 4px 4px; height: var(--fill); max-height: calc(100% - 12px); border-radius: 5px 5px 14px 14px; background: #e17f9b78; transition: height .4s var(--ease); }
.jar-label { position: absolute; display: grid; place-items: center; top: 49%; left: 50%; transform: translate(-50%,-50%) rotate(-4deg); width: 30px; height: 26px; border: 1px solid #e8b3bc; border-radius: 2px; background: #fff4e9; color: #bb466d; }
.jar-label .heart { width: 8px; }

.scene--letter { position: relative; isolation: isolate; display: grid; place-items: center; padding: 24px; }
.letter-backdrop { position: absolute; inset: 12px; border-radius: 19px; background: var(--grain) 0 0 / 4px 4px, repeating-linear-gradient(45deg,#ad4a6b18 0 16px,transparent 16px 32px), linear-gradient(125deg,#f1c2c5,#d67f98); z-index: -1; }
.letter-paper { width: min(100%, 620px); color: var(--ink); padding: clamp(23px, 5vw, 49px); border: 1px solid #fff5eb; border-radius: 3px; box-shadow: 4px 10px 25px #6b2a3b38; background: var(--grain) 0 0 / 4px 4px, #fffaef; }
.letter-paper h2 { margin: 16px 0 24px; }
.letter-paper > p:not(.kicker) { margin-top: 13px; font-size: 1rem; line-height: 1.62; }
.letter-paper em { color: var(--rose); }
.letter-paper .letter-signature em { font: italic 1.7rem/1.05 var(--serif); }

@media (max-width: 760px) {
  .site { width: min(100% - 24px, 540px); gap: 11px; padding: 12px 0 18px; }
  .signature { font-size: 1.24rem; }
  .book { border-radius: 20px; }
  .scene { min-height: 0; }
  .scene--home, .scene--split { grid-template-columns: 1fr; }
  .intro { gap: 16px; padding: 25px 23px 17px; }
  h1 { font-size: clamp(2.25rem, 10vw, 4.5rem); }
  h1 br { display: none; }
  .scene--home h1 em { font-size: inherit; }
  .gift-stage, .worktop { margin: 0 8px 8px; border-radius: 14px; }
  .gift-stage { min-height: clamp(245px, 72vw, 345px); }
  .gift-stage::before { inset: 8px; border-radius: 8px; }
  .gift-caption { bottom: 16px; }
  .gift-mat { width: 72%; }
  .envelope-button { width: min(61%, 280px); }
  .worktop { min-height: clamp(280px, 81vw, 380px); }
  .scene-copy { gap: 12px; }
  .scene-copy h2 { font-size: clamp(2.6rem, 9.6vw, 4.8rem); }
  .scene-copy > p:not(.kicker) { max-width: 38ch; }
  .album-deck { width: min(40%, 210px); margin-top: 0; }
  .polaroid { padding: 7px 7px 3px; grid-template-rows: minmax(0,1fr) 19px; }
  .memory-grid { width: min(67%, 260px); }
  .catch-arena { width: calc(100% - 20px); height: calc(100% - 20px); min-height: 254px; }
  .jar { --jar-width: 74px; height: 62px; }
  .scene--letter { padding: 19px; }
  .letter-backdrop { inset: 8px; border-radius: 13px; }
}

@media (max-width: 370px) {
  .chapters { gap: 1px; }
  .chapters a { padding-inline: 9px; }
  .intro { padding-inline: 17px; }
  .music { gap: 6px; }
  .music-copy span { max-width: 94px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .music.is-playing .equalizer i { animation: none; transform: scaleY(.75); }
  .music.is-playing .equalizer i:nth-child(even) { transform: scaleY(.45); }
}
