:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #070b1b;
  color: #f7f2e8;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }
.play-enhancement { display: none; }
.js .play-enhancement { display: block; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 15% 10%, #273b73 0, transparent 32%),
    radial-gradient(circle at 86% 84%, #4a2d5e 0, transparent 36%),
    #070b1b;
}

.unlock-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.unlock-card {
  width: min(100%, 560px);
  padding: clamp(28px, 7vw, 48px);
  border: 1px solid rgb(247 242 232 / 18%);
  border-radius: 24px;
  background: rgb(10 15 37 / 80%);
  box-shadow: 0 24px 80px rgb(0 0 0 / 36%);
}

.eyebrow {
  margin: 0 0 16px;
  color: #c8b8e8;
  font-size: 0.88rem;
  letter-spacing: 0.12em;
}

h1 {
  margin: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(2rem, 9vw, 3.1rem);
  font-weight: 600;
  line-height: 1.22;
}

.intro { color: #d2cfda; line-height: 1.7; }

form { display: grid; gap: 12px; margin-top: 30px; }

label { font-weight: 600; line-height: 1.55; }

input,
button {
  min-height: 48px;
  border-radius: 12px;
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid #8d90ab;
  padding: 0 14px;
  background: #111938;
  color: inherit;
}

button {
  margin-top: 4px;
  border: 0;
  padding: 0 18px;
  background: linear-gradient(135deg, #d7be85, #b87ca9);
  color: #130f1d;
  cursor: pointer;
  font-weight: 700;
}

input:focus-visible,
button:focus-visible { outline: 3px solid #f5d98e; outline-offset: 3px; }

button:disabled { cursor: wait; opacity: 0.72; }

.status { min-height: 1.5em; margin: 18px 0 0; color: #d2cfda; line-height: 1.6; }

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

.gift-body { overflow-x: hidden; }

.starfield {
  position: fixed;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 20%, rgb(124 137 218 / 24%) 0 1px, transparent 2px),
    radial-gradient(circle at 78% 32%, rgb(247 242 232 / 42%) 0 1px, transparent 2px),
    radial-gradient(circle at 48% 76%, rgb(215 190 133 / 25%) 0 1px, transparent 2px),
    radial-gradient(ellipse at 70% 16%, rgb(77 56 125 / 56%), transparent 42%),
    radial-gradient(ellipse at 18% 88%, rgb(35 63 115 / 46%), transparent 48%),
    #070b1b;
}

.starfield span {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #fff9e7;
  box-shadow: 9vw 17vh #fff9e7, 29vw 59vh #d8d9ff, 53vw 11vh #fff9e7, 74vw 77vh #d8d9ff, 91vw 38vh #fff9e7;
  opacity: 0.72;
}

.starfield span:nth-child(1) { top: 12%; left: 8%; }
.starfield span:nth-child(2) { top: 44%; left: 23%; transform: scale(0.75); }
.starfield span:nth-child(3) { top: 68%; left: 44%; transform: scale(1.15); }

.gift-page {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 32px 20px 56px;
}

.nebula-panel,
.timeline-item {
  border: 1px solid rgb(247 242 232 / 16%);
  border-radius: 24px;
  background: linear-gradient(140deg, rgb(19 28 61 / 78%), rgb(21 15 43 / 72%));
  box-shadow: 0 18px 52px rgb(0 0 0 / 25%);
  backdrop-filter: blur(10px);
}

.gift-hero { padding: clamp(28px, 8vw, 52px); }
.gift-hero h1 { max-width: 10ch; }
.gift-subtitle { max-width: 29rem; color: #e0ddeb; font-size: 1.08rem; line-height: 1.8; }

.gift-jump {
  display: inline-grid;
  min-height: 44px;
  place-items: center;
  margin-top: 12px;
  padding: 0 18px;
  border: 1px solid rgb(247 242 232 / 32%);
  border-radius: 999px;
  color: #fff7e5;
  text-decoration: none;
}

.gift-jump:hover { background: rgb(247 242 232 / 10%); }
.gift-jump:focus-visible,
.gift-page :focus-visible { outline: 3px solid #f5d98e; outline-offset: 4px; }

.gift-timeline { margin-top: clamp(48px, 10vw, 84px); }
.gift-timeline > h2,
.ai-entry h2 { margin-top: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(1.7rem, 7vw, 2.5rem); }

.timeline {
  display: grid;
  gap: 18px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.timeline-item { padding: 24px; }
.timeline-item h2 { margin: 4px 0 10px; font-family: Georgia, "Songti SC", serif; font-size: 1.35rem; }
.timeline-item p:last-child,
.ai-entry p { margin-bottom: 0; color: #ded9e7; line-height: 1.8; }
.timeline-label { margin: 0; color: #d9bd82; font-size: 0.86rem; font-weight: 700; letter-spacing: 0.08em; }

.ai-entry { margin-top: clamp(48px, 10vw, 84px); padding: clamp(28px, 7vw, 44px); }
.gift-closing { padding: 56px 0 12px; color: #f6edda; font-family: Georgia, "Songti SC", serif; font-size: 1.2rem; text-align: center; }
.gift-page picture { display: block; margin-top: 20px; overflow: hidden; border-radius: 16px; background: rgb(247 242 232 / 8%); }
.gift-page picture img { display: block; width: 100%; min-height: 180px; object-fit: cover; color: transparent; }
.memory-gallery { display: grid; gap: 16px; margin-top: 22px; }
.memory-card { position: relative; margin: 0; overflow: hidden; border: 1px solid rgb(247 242 232 / 13%); border-radius: 18px; background: rgb(7 11 27 / 48%); }
.memory-card picture { margin: 0; border-radius: 0; }
.memory-card picture img { aspect-ratio: 4 / 5; min-height: 0; }
.memory-card--landscape picture img { aspect-ratio: 4 / 3; }
.memory-card figcaption { padding: 14px 16px 16px; color: #eee5f1; line-height: 1.6; }
.memory-card--featured { border-color: rgb(215 190 133 / 45%); box-shadow: 0 16px 44px rgb(0 0 0 / 30%); }
.music-player {
  display: grid;
  align-items: center;
  gap: 28px;
  margin-top: clamp(48px, 10vw, 84px);
  padding: clamp(24px, 7vw, 42px);
}

.cd-disc {
  position: relative;
  width: min(68vw, 260px);
  min-height: 0;
  aspect-ratio: 1;
  margin: 0 auto;
  border: 8px solid rgb(8 10 20 / 84%);
  border-radius: 50%;
  padding: 0;
  overflow: hidden;
  background: #0a0d1c;
  box-shadow: 0 16px 44px rgb(0 0 0 / 42%), inset 0 0 20px rgb(247 242 232 / 20%);
  transform: rotate(0turn);
}

.cd-disc::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 34%, rgb(255 255 255 / 20%) 47%, transparent 59%);
  content: "";
  pointer-events: none;
}

.cd-disc picture { height: 100%; margin: 0; border-radius: 50%; }
.cd-disc picture img { width: 100%; height: 100%; min-height: 0; object-fit: cover; }

.cd-hole {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 32px;
  aspect-ratio: 1;
  border: 7px solid rgb(247 242 232 / 78%);
  border-radius: 50%;
  background: #080b18;
  box-shadow: 0 0 0 5px rgb(10 13 28 / 52%);
  transform: translate(-50%, -50%);
}

.music-copy { text-align: center; }
.music-copy .eyebrow { margin-bottom: 10px; }
.music-copy h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(1.8rem, 7vw, 2.5rem); }
.music-copy > p:not(.eyebrow) { color: #ded9e7; }
.music-copy [data-music-toggle] { min-width: 96px; min-height: 44px; }
.music-copy [role="status"] { min-height: 1.5em; margin-bottom: 0; color: #d9bd82; }

.music-player.is-playing .cd-disc { animation: cd-spin 12s linear infinite; }

.chat-entry {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  margin-top: 24px;
  border: 1px solid rgb(215 190 133 / 42%);
  border-radius: 999px;
  padding: 0 20px;
  background: rgb(215 190 133 / 10%);
  color: #fff7e5;
  font-weight: 700;
  text-decoration: none;
}

.chat-entry:hover { background: rgb(215 190 133 / 18%); }

.star-hunt {
  position: sticky;
  z-index: 5;
  top: 12px;
  margin-top: 22px;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: none;
}

.star-progress {
  margin: 0;
  color: #fff5d7;
  font-weight: 750;
  letter-spacing: .02em;
}

.star-hunt [data-missing-stars] {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.js .star-hunt [data-missing-stars]:not([hidden]) { display: flex; }
.star-hunt [data-missing-stars] p { margin: 0; color: #ded9e7; font-size: .92rem; }
.star-hunt button { min-height: 40px; margin: 0; padding-inline: 14px; }
.storage-warning { margin: 10px 0 0; color: #f0cf96; font-size: .88rem; line-height: 1.55; }

.memory-star {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  min-height: 0;
  margin: 0;
  border-radius: inherit;
  padding: 0;
  background: transparent;
  color: #fff5c4;
}

.memory-star:hover { background: rgb(215 190 133 / 4%); }
.memory-star:focus-visible { outline-offset: -5px; }

.memory-star-icon {
  position: absolute;
  right: 13px;
  bottom: 13px;
  display: grid;
  width: 39px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgb(255 244 202 / 45%);
  border-radius: 50%;
  background: rgb(7 11 27 / 72%);
  box-shadow: 0 0 8px rgb(245 217 142 / 36%);
  font-size: 1.08rem;
  transition: transform 220ms cubic-bezier(.22, 1, .36, 1), background 220ms ease;
}

.memory-star:hover .memory-star-icon,
.memory-star:focus-visible .memory-star-icon { background: #d7be85; color: #1a1422; transform: scale(1.08) rotate(8deg); }
.memory-star.is-found .memory-star-icon { background: #f5d98e; color: #1a1422; }

.memory-card p.memory-star-reveal {
  position: relative;
  z-index: 3;
  margin: 0 14px 15px;
  border: 1px solid rgb(245 217 142 / 44%);
  border-radius: 10px;
  padding: 12px 14px;
  background: #171329;
  color: #fff4d0;
  font-family: Georgia, "Songti SC", serif;
  font-weight: 600;
  line-height: 1.6;
  pointer-events: none;
}

.has-found-star picture img { filter: saturate(1.08) brightness(1.04); }
.has-found-star { border-color: rgb(245 217 142 / 68%); }
.is-star-replayed .memory-star-icon { animation: star-pulse 520ms cubic-bezier(.22, 1, .36, 1); }
.star-effect--wind picture img { animation: memory-wind 760ms cubic-bezier(.16, 1, .3, 1); }
.star-effect--stage picture { animation: memory-stage 820ms ease-out; }
.star-effect--steam .memory-star-icon { animation: steam-rise 900ms ease-out; }
.star-effect--web .memory-star-icon { animation: web-glint 760ms ease-out; }
.star-effect--polaroid picture { animation: polaroid-flash 720ms ease-out; }

.star-reward {
  margin-top: 24px;
  border: 1px solid #d7be85;
  border-radius: 14px;
  padding: 22px;
  background: linear-gradient(135deg, #f5d98e, #c8948f);
  color: #221629;
}

.star-reward > span { float: right; font-size: 2rem; }
.star-reward .eyebrow { margin-bottom: 6px; color: #5b395a; }
.star-reward h2 { margin: 0; font: 700 clamp(1.55rem, 6vw, 2rem)/1.25 Georgia, "Songti SC", serif; }
.star-reward p { margin: 8px 0 0; line-height: 1.65; }

.heart-game {
  margin-top: clamp(48px, 10vw, 84px);
  border-radius: 16px;
  padding: clamp(22px, 6vw, 42px);
  overflow: hidden;
}

.heart-game h2 {
  max-width: 12ch;
  margin: 0;
  font: 650 clamp(1.9rem, 7vw, 2.7rem)/1.22 Georgia, "Songti SC", serif;
  text-wrap: balance;
}

.heart-game-intro > p:not(.eyebrow) { max-width: 34rem; color: #ded9e7; line-height: 1.75; text-wrap: pretty; }
.heart-game-intro > button { margin-top: 10px; }

.game-score-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  color: #ded9e7;
}

.game-score-row p { margin: 0; }
.game-score-row strong { display: block; margin-top: 3px; color: #fff5d7; font-size: 1.05rem; }

.heart-board {
  display: grid;
  width: min(100%, 470px);
  aspect-ratio: 1;
  margin-inline: auto;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: clamp(6px, 1.8vw, 10px);
  border-radius: 14px;
  padding: clamp(7px, 2vw, 11px);
  background: #090d20;
  box-shadow: inset 0 0 0 1px rgb(245 217 142 / 18%);
  touch-action: none;
  user-select: none;
}

.heart-cell {
  display: grid;
  min-width: 0;
  place-items: center;
  border-radius: clamp(7px, 2vw, 11px);
  background: #202746;
  color: #fff8e9;
  font-size: clamp(.64rem, 2.8vw, .9rem);
  font-weight: 750;
  line-height: 1.28;
  text-align: center;
  white-space: pre-line;
  transition: transform 150ms cubic-bezier(.22, 1, .36, 1), background 180ms ease;
}

.heart-cell--2, .heart-cell--4 { background: #39456f; }
.heart-cell--8 { background: #644f79; }
.heart-cell--16 { background: #80556f; }
.heart-cell--32 { background: #9a5e75; }
.heart-cell--64 { background: #a15f69; }
.heart-cell--128 { background: #b87876; color: #181121; }
.heart-cell--256 { background: #ca9780; color: #181121; }
.heart-cell--512 { background: #d7b47d; color: #181121; }
.heart-cell--1024 { background: #efd58d; color: #181121; box-shadow: inset 0 0 0 2px #fff0bd; }
.heart-cell--2048 { background: #fff0bd; color: #181121; box-shadow: 0 0 8px rgb(255 231 155 / 70%); }

.heart-board.is-complete .heart-cell { animation: tile-to-heart 700ms cubic-bezier(.22, 1, .36, 1) both; }
.heart-board.is-complete .heart-cell:nth-child(3n) { animation-delay: 60ms; }
.heart-board.is-complete .heart-cell:nth-child(4n) { animation-delay: 110ms; }

.direction-pad {
  display: grid;
  width: 168px;
  margin: 18px auto 0;
  grid-template-columns: repeat(3, 48px);
  gap: 8px;
}

.direction-pad button { min-width: 48px; min-height: 48px; margin: 0; padding: 0; font-size: 1.15rem; }
.direction-pad [data-direction="up"] { grid-column: 2; }
.direction-pad [data-direction="left"] { grid-column: 1; grid-row: 2; }
.direction-pad [data-direction="down"] { grid-column: 2; grid-row: 2; }
.direction-pad [data-direction="right"] { grid-column: 3; grid-row: 2; }

.game-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  margin-top: 18px;
}

.game-actions button { min-height: 42px; margin: 0; padding-inline: 13px; background: rgb(247 242 232 / 10%); color: #fff5d7; box-shadow: inset 0 0 0 1px rgb(247 242 232 / 24%); }
.game-actions button:not(:disabled):hover { background: rgb(247 242 232 / 17%); }
.game-actions [data-game-booster]:not(:disabled) { background: #f0d58d; color: #1b1422; box-shadow: none; }
.game-actions button:disabled { cursor: not-allowed; opacity: .5; }
.game-reshuffle, .game-skip { display: block; margin: 14px auto 0; }
.game-skip { background: transparent; color: #f4d591; text-decoration: underline; text-underline-offset: 4px; }
.game-status { min-height: 1.55em; margin: 14px 0 0; color: #f0d696; line-height: 1.55; text-align: center; }

.game-finale { text-align: center; }
.game-finale:focus-visible, .love-letter:focus-visible {
  outline: 2px solid #f0d696;
  outline-offset: 5px;
  border-radius: 12px;
}
.finale-copy { max-width: 28rem; margin: 0 auto 22px; color: #f5dd9e; font: 600 1.15rem/1.7 Georgia, "Songti SC", serif; }

.love-envelope {
  position: relative;
  display: grid;
  width: min(100%, 360px);
  min-height: 190px;
  margin: 0 auto;
  place-content: center;
  gap: 5px;
  border: 1px solid #ddbd7b;
  border-radius: 12px;
  padding: 34px 24px 24px;
  overflow: hidden;
  background: #e5c982;
  color: #25172a;
  box-shadow: none;
}

.love-envelope::before {
  position: absolute;
  inset: 0 0 42%;
  background: #f1dda5;
  clip-path: polygon(0 0, 50% 82%, 100% 0);
  content: "";
  transition: transform 500ms cubic-bezier(.22, 1, .36, 1);
  transform-origin: top;
}

.love-envelope:hover::before { transform: perspective(400px) rotateX(18deg); }
.love-envelope > * { position: relative; z-index: 1; }
.love-envelope > span { font-size: 1.35rem; }
.love-envelope strong { font: 700 1.4rem/1.3 Georgia, "Songti SC", serif; }
.love-envelope small { font-weight: 600; }

.love-letter {
  max-width: 570px;
  margin: 24px auto 0;
  border: 1px solid rgb(245 217 142 / 44%);
  border-radius: 12px;
  padding: clamp(22px, 6vw, 42px);
  background: #141832;
  color: #f7f0df;
  text-align: left;
}

.love-letter > p { margin: 0 0 1.15em; font: 1rem/1.95 Georgia, "Songti SC", serif; text-wrap: pretty; }
.letter-signature { text-align: right; }
.next-page-choice { margin-top: 32px; padding-top: 24px; border-top: 1px solid rgb(245 217 142 / 24%); }
.next-page-choice .eyebrow { color: #f0d696; font-size: 1rem; letter-spacing: 0; }

.next-page-card {
  width: 100%;
  min-height: 58px;
  margin: 8px 0 0;
  border: 1px solid rgb(247 242 232 / 24%);
  border-radius: 10px;
  padding: 12px 14px;
  background: transparent;
  color: #f8f1e3;
  font-weight: 600;
  line-height: 1.55;
  text-align: left;
}

.next-page-card:hover, .next-page-card.is-selected { border-color: #f0d58d; background: rgb(240 213 141 / 12%); }

.future-ticket {
  position: relative;
  margin-top: 24px;
  border: 1px dashed #765b82;
  border-radius: 10px;
  padding: 24px 20px;
  background: #f1dda5;
  color: #24162a;
  text-align: center;
}

.future-ticket::before, .future-ticket::after {
  position: absolute;
  top: 50%;
  width: 18px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #141832;
  content: "";
  transform: translateY(-50%);
}

.future-ticket::before { left: -10px; }
.future-ticket::after { right: -10px; }
.future-ticket p { margin: 10px 0 0; line-height: 1.65; }
.future-ticket [data-ticket-choice] { font: 700 1.2rem/1.6 Georgia, "Songti SC", serif; }
.ticket-kicker { margin: 0 !important; color: #65496a; font-size: .76rem; font-weight: 800; letter-spacing: .12em; }

.final-actions { display: flex; flex-direction: column; align-items: stretch; gap: 9px; margin-top: 26px; }
.final-actions a, .final-actions button { display: grid; min-height: 46px; margin: 0; place-items: center; border-radius: 10px; padding: 10px 14px; font: inherit; font-weight: 700; text-align: center; }
.final-actions a { border: 1px solid rgb(247 242 232 / 24%); color: #fff5d7; text-decoration: none; }
.final-actions button { background: rgb(247 242 232 / 10%); color: #fff5d7; }
.final-actions .final-action--rose { border-color: #e9c978; background: #e4c579; color: #211526; }
.final-actions .final-action--rose:hover { background: #f0d88f; }

@keyframes star-pulse { 50% { transform: scale(1.22) rotate(18deg); box-shadow: 0 0 8px #f5d98e; } }
@keyframes memory-wind { 45% { transform: scale(1.025) translateX(3px); filter: saturate(1.18) brightness(1.08); } }
@keyframes memory-stage { 35% { filter: brightness(1.28) saturate(1.28); } 70% { filter: brightness(.96) saturate(1.1); } }
@keyframes steam-rise { 45% { transform: translateY(-10px) scale(1.08); opacity: .82; } }
@keyframes web-glint { 40% { transform: scale(1.16) rotate(30deg); } }
@keyframes polaroid-flash { 28% { filter: brightness(1.65); } }
@keyframes tile-to-heart { 45% { transform: scale(.84) rotate(4deg); filter: brightness(1.28); } 100% { transform: scale(.94); opacity: .34; } }

.interaction-heart {
  position: fixed;
  z-index: 40;
  left: var(--heart-x);
  top: var(--heart-y);
  color: #d78aaa;
  font-size: 16px;
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 2px 8px rgb(0 0 0 / 24%);
  transform: translate(-50%, -50%);
  animation: heart-float 900ms ease-out var(--heart-delay) forwards;
}

.interaction-heart:nth-of-type(even) { color: #d7be85; }

@keyframes cd-spin { to { transform: rotate(1turn); } }
@keyframes heart-float { to { opacity: 0; transform: translate(var(--heart-drift), -52px) scale(.7); } }

html.js [data-reveal] { opacity: 0; transform: translateY(18px); }
html.js [data-reveal].is-visible { opacity: 1; transform: translateY(0); transition: opacity 600ms ease, transform 600ms ease; }

@media (prefers-reduced-motion: reduce) {
  .music-player.is-playing .cd-disc, .interaction-heart { animation: none !important; }
  html.js [data-reveal] { opacity: 1; transform: none; }
  .memory-card *, .heart-board *, .love-envelope::before { animation: none !important; transition: none !important; }
  .heart-board.is-complete .heart-cell { opacity: .34; }
}

@media (min-width: 620px) {
  .memory-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .memory-card--featured { grid-column: 1 / -1; width: min(100%, 420px); justify-self: center; }
  .music-player { grid-template-columns: minmax(0, 1fr) minmax(180px, .75fr); }
  .music-copy { text-align: left; }
  .heart-game { padding-inline: 48px; }
  .final-actions { flex-direction: row; flex-wrap: wrap; }
  .final-actions > * { flex: 1 1 180px; }
}
