* { box-sizing: border-box; }


:root {
  --color-paper: #fffdfb;
  --color-ink: #1a1a1a;
  --color-rose: #bf3d5b;
  --color-cobalt: #3058cd;
  --color-heart: #d42b40;
  --color-mist: #8a8a8a;
  --font-script: "LEMY Handwritten VI", cursive;
  --font-flourish: "Allura", cursive;
  --font-serif: "LEMY Serif VI", Georgia, serif;
}

@layer base {
  button:not(:disabled),
  [role="button"]:not(:disabled) {
    cursor: pointer;
  }

  html,
  body {
    height: 100%;
  }

  body {
    margin: 0;
    background: var(--color-paper);
    color: var(--color-ink);
    overflow: hidden;
  }
}

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

.stage {
  position: relative;
  container-type: inline-size;
  width: min(100vw, 420px);
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--color-paper);
  touch-action: pan-y;
  user-select: none;
}

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

.deco {
  position: absolute;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

.cafe {
  left: -8%;
  top: -2%;
  width: 70%;
  z-index: 2;
}

.lamp {
  left: -6%;
  top: 34%;
  width: 34%;
  z-index: 2;
}

.skyline {
  left: 6%;
  bottom: 14%;
  width: 88%;
  z-index: 1;
}

.corner {
  right: -10%;
  bottom: 6%;
  width: 48%;
  z-index: 2;
}

.polaroid {
  position: absolute;
  right: 0;
  top: 46%;
  width: 23%;
  margin: 0;
  z-index: 3;
}

.polaroid img {
  display: block;
  width: 88%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center 22%;
  background: #fff;
  padding: 4px 4px 14px;
  box-shadow: 0 8px 16px rgba(40, 30, 20, 0.12);
}

.polaroid img:first-child {
  transform: rotate(7deg);
  margin-left: 12%;
}

.polaroid img:last-child {
  transform: rotate(-5deg) translateY(-22%);
}

.doodle {
  position: absolute;
  z-index: 4;
  font-family: var(--font-script);
  line-height: 1;
  pointer-events: none;
}

.heart-fill {
  right: 22%;
  top: 18%;
  color: var(--color-heart);
  font-size: 4.2cqw;
}

.star {
  left: 44%;
  top: 15%;
  color: var(--color-ink);
  font-size: 3.2cqw;
}

.xs {
  right: 7%;
  top: 44%;
  color: var(--color-ink);
  font-size: 3.4cqw;
  letter-spacing: -0.12em;
}

.sheet {
  position: absolute;
  inset: 0;
  z-index: 5;
}

.titles {
  position: absolute;
  top: 3.5%;
  left: 5%;
  right: 5%;
  z-index: 6;
  pointer-events: none;
  transition: opacity 280ms ease;
}

.cover-title,
.moment-title {
  transition: opacity 280ms ease;
}

.moment-title {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.cover-title h1,
.moment-title p {
  margin: 0;
  text-align: center;
  font-weight: 600;
  line-height: 1.25;
}

.cover-title h1 {
  font-family: var(--font-script);
  font-size: 11.5cqw;
  color: var(--color-ink);
}

.cover-title em,
.moment-title em {
  font-family: var(--font-flourish);
  font-style: italic;
  font-weight: 400;
  color: var(--color-rose);
}

.cover-title em {
  font-size: 1.2em;
  padding-left: 0.15em;
}

.cover-title p {
  margin: 0.35rem 0 0;
  text-align: center;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 3.15cqw;
  color: var(--color-ink);
}

.moment-title p {
  font-family: var(--font-script);
  font-size: 8.5cqw;
}

.moment-title em {
  display: block;
  margin-top: 0.1em;
  font-size: 1.35em;
}

.stage[data-phase="moment"] .cover-title,
.stage[data-phase="flip"] .cover-title,
.stage[data-phase="clear"] .cover-title,
.stage[data-phase="burst"] .cover-title,
.stage[data-phase="deck"] .titles {
  opacity: 0;
}

.stage[data-phase="moment"] .moment-title,
.stage[data-phase="flip"] .moment-title,
.stage[data-phase="clear"] .moment-title {
  opacity: 1;
}

.deck-slot {
  position: absolute;
  inset: 16% 0 18%;
}

.pcard {
  position: absolute;
  left: 50%;
  top: 40%;
  width: min(48%, 27vh);
  aspect-ratio: 5 / 7.15;
  transform-origin: center center;
  transition:
    transform 560ms cubic-bezier(0.2, 0.7, 0.2, 1),
    opacity 420ms ease;
  z-index: 1;
}

.pcard-inner {
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 14px 30px rgba(40, 30, 20, 0.14);
  transform-style: preserve-3d;
  transition: transform 680ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.face {
  position: relative;
  height: 100%;
  background: #fff;
}

.idx {
  position: absolute;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--color-heart);
  font-family: var(--font-serif);
  font-size: 3.4cqw;
  line-height: 0.9;
}

.idx b {
  font-weight: 400;
}

.idx .pip {
  font-size: 0.72em;
}

.idx.blue {
  color: var(--color-cobalt);
}

.idx.tl {
  top: 3.5%;
  left: 6%;
}

.idx.br {
  right: 6%;
  bottom: 3.5%;
  transform: rotate(180deg);
}

.couple-art {
  position: absolute;
  left: 7%;
  top: 9%;
  width: 86%;
  height: 74%;
  object-fit: contain;
  object-position: center bottom;
}

.for-you {
  position: absolute;
  right: 8%;
  bottom: 5%;
  left: 8%;
  margin: 0;
  text-align: center;
  color: var(--color-rose);
  font-family: var(--font-script);
  font-size: 4.6cqw;
  line-height: 1.35;
}

.qmark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--color-mist);
  font-family: var(--font-serif);
  font-size: 18cqw;
  opacity: 0;
}

.msg {
  position: absolute;
  inset: 16% 8% 14%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0;
  text-align: center;
  font-family: var(--font-script);
  font-size: 7.2cqw;
  line-height: 1.25;
}

.msg .rose {
  margin-top: 0.12em;
  color: var(--color-rose);
  font-family: var(--font-flourish);
  font-size: 1.2em;
  font-weight: 400;
}

.heart-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.stage[data-phase="hold"] .pcard-queen,
.stage[data-phase="gather"] .pcard-queen {
  z-index: 5;
  transform: translate(-72%, -18%) rotate(-8deg);
}

.stage[data-phase="hold"] .pcard-four,
.stage[data-phase="gather"] .pcard-four {
  z-index: 4;
  transform: translate(-22%, -14%) rotate(7deg);
}

.stage[data-phase="hold"] .pcard-two,
.stage[data-phase="gather"] .pcard-two {
  z-index: 3;
  transform: translate(-6%, -8%) rotate(12deg);
}

.stage[data-phase="hold"] .pcard-heart,
.stage[data-phase="gather"] .pcard-heart {
  z-index: 2;
  transform: translate(-42%, 4%) rotate(2deg) scale(0.92);
}

.stage[data-phase="scatter"] .pcard-queen {
  transform: translate(-130%, -70%) rotate(-22deg);
}

.stage[data-phase="scatter"] .pcard-four {
  transform: translate(36%, -78%) rotate(20deg);
}

.stage[data-phase="scatter"] .pcard-two {
  transform: translate(78%, 18%) rotate(28deg);
}

.stage[data-phase="scatter"] .pcard-heart {
  transform: translate(-120%, 36%) rotate(-16deg);
}

.stage[data-phase="moment"] .pcard-queen,
.stage[data-phase="flip"] .pcard-queen,
.stage[data-phase="clear"] .pcard-queen {
  z-index: 6;
  transform: translate(-50%, -8%) rotate(-1deg) scale(1.04);
}

.stage[data-phase="moment"] .pcard-four,
.stage[data-phase="moment"] .pcard-two,
.stage[data-phase="moment"] .pcard-heart,
.stage[data-phase="flip"] .pcard-four,
.stage[data-phase="flip"] .pcard-two,
.stage[data-phase="flip"] .pcard-heart,
.stage[data-phase="clear"] .pcard,
.stage[data-phase="clear"] .pcard-queen {
  opacity: 1;
}

.stage[data-phase="moment"] .pcard-four,
.stage[data-phase="flip"] .pcard-four,
.stage[data-phase="clear"] .pcard-four,
.stage[data-phase="moment"] .pcard-two,
.stage[data-phase="flip"] .pcard-two,
.stage[data-phase="clear"] .pcard-two,
.stage[data-phase="moment"] .pcard-heart,
.stage[data-phase="flip"] .pcard-heart,
.stage[data-phase="clear"] .pcard-heart {
  opacity: 0;
}

.stage[data-phase="moment"] .pcard-queen .pcard-inner {
  transform: rotateY(86deg);
}

.stage[data-phase="flip"] .pcard-queen .pcard-inner,
.stage[data-phase="clear"] .pcard-queen .pcard-inner {
  transform: rotateY(0deg);
}

.stage[data-phase="burst"] .pcard {
  opacity: 0;
}

.stage[data-phase="burst"] .pcard-queen {
  transform: translate(-70%, -130%) rotate(-18deg);
}

.stage[data-phase="burst"] .pcard-four {
  transform: translate(20%, -140%) rotate(16deg);
}

.stage[data-phase="burst"] .pcard-two {
  transform: translate(90%, -40%) rotate(24deg);
}

.stage[data-phase="burst"] .pcard-heart {
  transform: translate(-100%, -20%) rotate(-12deg);
}

.stage[data-phase="deck"] .is-top {
  z-index: 6;
  transform: translate(-64%, -4%) rotate(-3deg);
}

.stage[data-phase="deck"] .is-under {
  z-index: 5;
  transform: translate(-22%, 2%) rotate(8deg);
}

.stage[data-phase="deck"] .is-wait {
  z-index: 3;
  transform: translate(2%, 8%) rotate(14deg) scale(0.96);
}

.stage[data-phase="deck"] .is-gone {
  z-index: 1;
  opacity: 0;
  transform: translate(-170%, 10%) rotate(-18deg);
}

.stage[data-phase="deck"] .pcard-queen.is-featured {
  transform: translate(-58%, -6%) rotate(-2deg) scale(1.02);
}

.cta {
  position: absolute;
  right: 0;
  bottom: 3.5%;
  left: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  transition: opacity 280ms ease;
}

.turn {
  width: min(86%, 19.5rem);
  min-height: 2.75rem;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(40, 30, 20, 0.1);
  color: var(--color-ink);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 3.7cqw;
  transition: scale 150ms ease-out;
}

.turn:active {
  scale: 0.96;
}

.hint {
  margin: 0;
  color: var(--color-mist);
  font-family: var(--font-script);
  font-size: 4.3cqw;
  text-align: center;
}

.hint span {
  color: var(--color-rose);
}

@media (prefers-reduced-motion: reduce) {
  .pcard,
  .pcard-inner,
  .cover-title,
  .moment-title,
  .titles,
  .cta,
  .turn {
    transition: none;
  }
}

[data-fit] { max-width: 100%; overflow-wrap: anywhere; }
.cover-title h1, .moment-title p { text-wrap: balance; }
.for-you { max-height: 20%; }
.turn { padding: .4rem 1rem; }
.hint { max-width: 92%; }
.turn:focus-visible { outline: 2px solid var(--color-rose); outline-offset: 4px; }

/* All native text uses complete Vietnamese fonts, with room for tone marks. */
.cover-title h1 { font-size: 9.5cqw; }
.cover-title h1 { max-height: 29cqw; }
.cover-title h1, .moment-title p { padding-inline: 40px; }
.cover-title em { display: block; margin-top: -.12em; }
.cover-title p { line-height: 1.55; max-height: 16cqw; }
.moment-title p { font-size: 7.5cqw; }
.moment-title p { max-height: 41cqw; }
.for-you { left: 14%; right: 14%; bottom: 9%; }
.couple-art { height: calc(80% - var(--caption-height, 3rem)); }
.has-long-caption .for-you { left: 12%; right: 12%; max-height: 29%; }
.msg { font-size: 6.1cqw; gap: .08em; }
.msg > span { max-width: 100%; }
.msg .rose { line-height: 1.35; }
.pcard { will-change: transform, opacity; }
.stage[data-phase="deck"] .pcard { will-change: auto; }
.stage[data-phase="deck"] .deck-slot { bottom: calc(var(--cta-height, 100px) + max(3.5%, env(safe-area-inset-bottom)) + 16px); }
.stage[data-phase="deck"] .pcard { top: 50%; }
.stage[data-phase="deck"] .is-top { transform: translate(-64%, -50%) rotate(-3deg); }
.stage[data-phase="deck"] .is-under { transform: translate(-22%, -43%) rotate(8deg); }
.stage[data-phase="deck"] .is-wait { transform: translate(2%, -39%) rotate(14deg) scale(.96); }
.stage[data-phase="deck"] .pcard-queen.is-featured { transform: translate(-58%, -50%) rotate(-2deg) scale(1.02); }
.heart-art { display: block; }
.cta { bottom: max(3.5%, calc(env(safe-area-inset-bottom) + 12px)); }
.deck-actions { width: 92%; display: flex; align-items: center; justify-content: center; gap: 8px; }
.deck-actions .turn { width: min(86%, 19.5rem); font-size: 3.6cqw; line-height: 1.45; }
.deck-progress { display: flex; gap: 2px; }
.deck-progress button, .back { display: grid; place-items: center; min-width: 44px; min-height: 44px; border: 0; color: var(--color-rose); background: #fffdfbe8; font: inherit; }
.deck-progress button { border-radius: 50%; font-family: var(--font-script); font-size: 14px; }
.deck-progress button[aria-current="step"] { background: var(--color-rose); color: #fff; box-shadow: 0 3px 12px #bf3d5b22; }
.back { flex: 0 0 44px; border-radius: 50%; font: 30px Georgia, serif; box-shadow: 0 4px 16px #281e1410; }
.deck-progress button:focus-visible, .back:focus-visible { outline: 2px solid var(--color-rose); outline-offset: 2px; }
.hint { font-size: 3.5cqw; line-height: 1.5; color: #68605e; }
@media (max-height: 640px) {
  .titles { top: 2.5%; }
  .cover-title h1 { font-size: 8.5cqw; }
  .cover-title p { margin-top: .1rem; }
  .cta { gap: .2rem; }
  .deck-slot { bottom: 24%; }
}

/* The title is hidden while reading; use its space on short landscape screens. */
@media (max-height: 400px) {
  .stage[data-phase="deck"] .deck-slot { top: 12px; }
  .stage[data-phase="deck"] .pcard { width: min(48%, 36vh); }
  .stage[data-phase="deck"] .deck-actions .turn { font-size: 12px; }
  .stage[data-phase="deck"] .hint { font-size: 12px; line-height: 1.4; }
}
