@font-face {
  font-family: 'Mali';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/mali-thai-400-normal.woff2) format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Mali';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/mali-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Mali';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../fonts/mali-thai-600-normal.woff2) format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Mali';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../fonts/mali-latin-600-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Mali';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/mali-thai-700-normal.woff2) format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Mali';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/mali-latin-700-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Sriracha';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/sriracha-thai-400-normal.woff2) format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Sriracha';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/sriracha-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #fff1f5;
  --bg-2: #ffe1ea;
  --rose: #ff5c8a;
  --rose-deep: #e8466f;
  --rose-soft: #ffb3c8;
  --blush: #ffd6e2;
  --ink: #5b2a3d;
  --ink-soft: #8a5468;
  --paper: #fffaf6;
  --shadow: 0 10px 30px -12px rgba(184, 58, 98, 0.35), 0 2px 6px -2px rgba(184, 58, 98, 0.12);
  --radius: 24px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --font-body: 'Mali', -apple-system, 'Thonburi', sans-serif;
  --font-hand: 'Sriracha', 'Mali', cursive;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

body.is-locked {
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

img,
video,
svg {
  display: block;
}

:focus-visible {
  outline: 3px solid var(--rose);
  outline-offset: 3px;
}

/* Background */

.sky {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(60vmax 50vmax at 10% 0%, #ffd9e5 0%, transparent 60%),
    radial-gradient(55vmax 45vmax at 100% 30%, #ffe8d9 0%, transparent 60%),
    radial-gradient(60vmax 50vmax at 30% 100%, #ffe0ee 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

.hearts {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.float-heart {
  position: absolute;
  bottom: -40px;
  left: var(--x);
  width: var(--size);
  height: var(--size);
  opacity: 0;
  color: var(--color);
  animation: float-up var(--duration) linear var(--delay) infinite;
  will-change: transform, opacity;
}

.float-heart > span {
  display: block;
  width: 100%;
  height: 100%;
  animation: sway calc(var(--duration) / 3) ease-in-out var(--delay) infinite alternate;
}

.float-heart svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

@keyframes float-up {
  0% { transform: translate3d(0, 0, 0) rotate(var(--rot)); opacity: 0; }
  10% { opacity: var(--alpha); }
  85% { opacity: var(--alpha); }
  100% { transform: translate3d(0, calc(-100vh - 80px), 0) rotate(calc(var(--rot) * -1)); opacity: 0; }
}

@keyframes sway {
  from { transform: translate3d(-14px, 0, 0); }
  to { transform: translate3d(14px, 0, 0); }
}

.burst-heart {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 60;
  width: var(--size);
  height: var(--size);
  margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
  color: var(--color);
  pointer-events: none;
  animation: burst 900ms var(--ease-out) forwards;
  will-change: transform, opacity;
}

.burst-heart svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

@keyframes burst {
  0% { transform: translate3d(var(--x0), var(--y0), 0) scale(0.2); opacity: 1; }
  60% { opacity: 1; }
  100% { transform: translate3d(var(--x1), var(--y1), 0) scale(1) rotate(var(--rot)); opacity: 0; }
}

/* Intro */

.intro {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-top) + 24px) calc(var(--safe-right) + 24px) calc(var(--safe-bottom) + 24px) calc(var(--safe-left) + 24px);
  background: radial-gradient(80vmax 60vmax at 50% 42%, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0) 60%);
  transition: opacity 700ms var(--ease-out), transform 900ms var(--ease-out), visibility 0s 900ms;
}

.intro.is-leaving {
  opacity: 0;
  transform: scale(1.06);
  visibility: hidden;
  pointer-events: none;
}

.intro__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: rise-in 900ms var(--ease-out) both;
}

.intro__kicker {
  margin: 0 0 18px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.3em;
  padding-left: 0.3em;
  color: var(--ink-soft);
}

.intro__title {
  margin: 28px 0 0;
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: clamp(36px, 11vw, 52px);
  line-height: 1.2;
  color: var(--rose-deep);
}

.intro__hint {
  margin: 6px 0 0;
  font-size: 15px;
  color: var(--ink-soft);
  animation: hint 2.4s ease-in-out 1.2s infinite;
}

@keyframes hint {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@keyframes rise-in {
  from { opacity: 0; transform: translate3d(0, 24px, 0); }
  to { opacity: 1; transform: none; }
}

.envelope {
  --w: min(68vw, 280px);
  position: relative;
  width: var(--w);
  height: calc(var(--w) * 0.66);
  perspective: 900px;
  animation: wiggle 3.2s ease-in-out 1.4s infinite;
}

:where(.envelope > span) {
  position: absolute;
  inset: 0;
}

.envelope__back {
  border-radius: 14px;
  background: linear-gradient(180deg, #ff9db8 0%, #ff8aab 100%);
  box-shadow: var(--shadow);
}

.envelope__card {
  inset: 8% 7% 6%;
  z-index: 2;
  display: grid;
  place-items: start center;
  padding-top: 12%;
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 0 2px 10px rgba(184, 58, 98, 0.15);
  transition: transform 800ms var(--ease-out) 350ms;
}

.envelope__card-text {
  font-family: var(--font-hand);
  font-size: calc(var(--w) * 0.11);
  line-height: 1;
  color: var(--rose-deep);
}

.heart-glyph {
  color: var(--rose);
}

.envelope__front {
  z-index: 3;
  border-radius: 14px;
  background: linear-gradient(160deg, #ffc4d4 0%, #ffb0c6 100%);
  clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%);
}

.envelope__flap {
  z-index: 4;
  height: 62%;
  bottom: auto;
  transform-origin: 50% 0;
  background: linear-gradient(180deg, #ffa3bd 0%, #ff93b1 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: 14px 14px 0 0;
  transition: transform 650ms var(--ease-out), z-index 0s 300ms;
}

.envelope__seal {
  z-index: 5;
  left: 50%;
  top: 62%;
  width: calc(var(--w) * 0.2);
  height: calc(var(--w) * 0.2);
  margin: calc(var(--w) * -0.12) 0 0 calc(var(--w) * -0.1);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8fae, var(--rose-deep));
  box-shadow: 0 4px 12px rgba(184, 58, 98, 0.4), inset 0 -2px 4px rgba(0, 0, 0, 0.12);
  transition: transform 400ms var(--ease-out), opacity 300ms;
}

.envelope__seal svg {
  width: 52%;
  fill: #fff;
  animation: beat 1.4s ease-in-out infinite;
}

.envelope.is-open {
  animation: none;
}

.envelope.is-open .envelope__flap {
  transform: rotateX(180deg);
  z-index: 1;
}

.envelope.is-open .envelope__seal {
  opacity: 0;
  transform: scale(0.4);
}

.envelope.is-open .envelope__card {
  transform: translate3d(0, -62%, 0);
}

@keyframes wiggle {
  0%, 84%, 100% { transform: rotate(0); }
  88% { transform: rotate(-3deg); }
  92% { transform: rotate(3deg); }
  96% { transform: rotate(-1.5deg); }
}

@keyframes beat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.18); }
  30% { transform: scale(1); }
  45% { transform: scale(1.12); }
}

/* Layout */

.main {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 calc(var(--safe-right) + 18px) calc(var(--safe-bottom) + 24px) calc(var(--safe-left) + 18px);
}

.card {
  position: relative;
  margin: 0 0 28px;
  padding: 28px 22px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.reveal {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition: opacity 800ms var(--ease-out), transform 800ms var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Hero */

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 32px) 0 56px;
  text-align: center;
}

.hero > * {
  opacity: 0;
  transform: translate3d(0, 20px, 0);
}

.is-opened .hero > * {
  animation: rise-in 900ms var(--ease-out) forwards;
}

.is-opened .hero > :nth-child(2) { animation-delay: 120ms; animation-name: pop-in; }
.is-opened .hero > :nth-child(3) { animation-delay: 260ms; }
.is-opened .hero > :nth-child(4) { animation-delay: 380ms; }
.is-opened .hero > :nth-child(5) { animation-delay: 1100ms; }

@keyframes pop-in {
  0% { opacity: 0; transform: scale(0.4); }
  70% { opacity: 1; transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1); }
}

.hero__kicker {
  margin: 0;
  font-family: var(--font-hand);
  font-size: clamp(26px, 8vw, 38px);
  line-height: 1.25;
  color: var(--rose-deep);
}

.hero__kicker sup {
  font-size: 0.5em;
  vertical-align: 0.9em;
  line-height: 0;
}

.hero__badge {
  position: relative;
  width: min(48vw, 210px);
  margin: 22px 0 14px;
}

.hero__badge svg {
  width: 100%;
  height: auto;
  fill: var(--rose);
  filter: drop-shadow(0 14px 22px rgba(232, 70, 111, 0.35));
  animation: beat 1.8s ease-in-out infinite;
}

.hero__badge-text {
  position: absolute;
  inset: 0 0 10%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: clamp(20px, 6vw, 26px);
  pointer-events: none;
}

.hero__badge-text b {
  font-size: 2.6em;
  line-height: 1;
}

.hero__names {
  margin: 0;
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: clamp(40px, 13vw, 60px);
  line-height: 1.15;
  color: var(--ink);
}

.hero__amp {
  color: var(--rose);
}

.hero__dates {
  margin: 10px 0 0;
  padding-left: 0.12em;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}

.hero__scroll {
  margin: 44px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.hero__scroll span {
  display: inline-block;
  animation: bob 1.6s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, 5px, 0); }
}

/* Counter */

.counter {
  text-align: center;
}

.counter__label {
  margin: 0;
  font-weight: 600;
  color: var(--ink-soft);
}

.counter__days {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin: 0;
  font-weight: 700;
  font-size: clamp(64px, 22vw, 96px);
  line-height: 1.1;
  color: var(--rose-deep);
  font-variant-numeric: tabular-nums;
}

.counter__days small {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
}

.counter__clock {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 8px 0 0;
}

.counter__clock span {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 76px;
  padding: 8px 6px 6px;
  border-radius: 16px;
  background: var(--blush);
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.counter__clock b {
  font-size: 26px;
  line-height: 1.2;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.counter__since {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.counter__note {
  margin: 16px 0 0;
  text-wrap: balance;
  padding: 12px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #ff7aa0, var(--rose-deep));
  color: #fff;
  font-weight: 600;
  line-height: 1.6;
}

.counter__note.is-celebration {
  animation: glow 2.4s ease-in-out infinite;
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 92, 138, 0.45); }
  50% { box-shadow: 0 0 0 10px rgba(255, 92, 138, 0); }
}

/* Letter */

.letter {
  padding: 34px 24px 30px;
  background: var(--paper);
  line-height: 1.95;
}

.letter::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  width: 96px;
  height: 26px;
  margin-left: -48px;
  border-radius: 4px;
  background: rgba(255, 179, 200, 0.75);
  transform: rotate(-2deg);
}

.letter__to {
  margin: 0 0 10px;
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.5;
  color: var(--rose-deep);
}

.letter p {
  margin: 0 0 14px;
  text-wrap: pretty;
}

.letter .letter__sign {
  margin: 24px 0 0;
  text-align: right;
  color: var(--ink-soft);
}

.letter__sign span {
  font-family: var(--font-hand);
  font-size: 34px;
  line-height: 1.3;
  color: var(--rose-deep);
}

/* Gallery */

.memories {
  margin: 44px 0 0;
  padding-bottom: 32px;
}

.memories__head {
  text-align: center;
  margin-bottom: 8px;
}

.memories__title {
  margin: 0;
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: clamp(34px, 10vw, 44px);
  line-height: 1.2;
  color: var(--rose-deep);
}

.memories__sub {
  margin: 4px 0 0;
  font-size: 15px;
  color: var(--ink-soft);
}

.memories__sub span {
  display: block;
  font-size: 13px;
}

.memories__progress {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 18px 0 0;
  padding-top: 4px;
}

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rose-soft);
  opacity: 0.55;
  transition: transform 400ms var(--ease-spring), opacity 300ms, background-color 300ms;
}

.progress-dot.is-seen {
  background: var(--rose);
  opacity: 1;
}

.progress-dot.is-current {
  transform: scale(1.5);
}

.progress-dot--heart {
  width: 14px;
  height: 13px;
  border-radius: 0;
  background: none;
  color: var(--rose-soft);
}

.progress-dot--heart svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.progress-dot--heart.is-seen {
  background: none;
  color: var(--rose);
}

.memories__stage {
  min-height: calc(100vh - 60px);
  min-height: calc(100svh - 60px);
  margin: 14px 0 0;
}

.chapter {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.chapter--in-next { animation: chapter-in-next 600ms var(--ease-out) both; }
.chapter--in-prev { animation: chapter-in-prev 600ms var(--ease-out) both; }
.chapter--out-next { animation: chapter-out-next 280ms ease-in forwards; }
.chapter--out-prev { animation: chapter-out-prev 280ms ease-in forwards; }

@keyframes chapter-in-next {
  from { opacity: 0; transform: translate3d(36px, 0, 0); }
  to { opacity: 1; transform: none; }
}

@keyframes chapter-in-prev {
  from { opacity: 0; transform: translate3d(-36px, 0, 0); }
  to { opacity: 1; transform: none; }
}

@keyframes chapter-out-next {
  to { opacity: 0; transform: translate3d(-36px, 0, 0) scale(0.98); }
}

@keyframes chapter-out-prev {
  to { opacity: 0; transform: translate3d(36px, 0, 0) scale(0.98); }
}

.chapter__step {
  margin: 0;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.chapter__title {
  margin: 2px 0 0;
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: clamp(32px, 10vw, 42px);
  line-height: 1.3;
  color: var(--rose-deep);
  outline: none;
  animation: pop-in 700ms var(--ease-out) 120ms both;
}

.chapter__count {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--ink-soft);
}

.chapter__lead {
  margin: 6px 0 0;
  color: var(--ink);
  line-height: 1.8;
}

.chapter__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 28px 0 0;
}

.chapter__nav--center {
  justify-content: center;
}

.chapter__hint {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
  text-wrap: balance;
}

.next-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff7aa0 0%, var(--rose-deep) 100%);
  box-shadow: 0 12px 24px -10px rgba(232, 70, 111, 0.7);
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  white-space: nowrap;
  animation: nudge 2.6s ease-in-out 1.2s infinite;
  transition: transform 160ms var(--ease-spring);
}

.next-btn svg {
  width: 20px;
  height: 18px;
  fill: #fff;
  animation: beat 1.4s ease-in-out infinite;
}

.next-btn:active {
  animation: none;
  transform: scale(0.94);
}

@keyframes nudge {
  0%, 80%, 100% { transform: translate3d(0, 0, 0); }
  86% { transform: translate3d(5px, 0, 0); }
  92% { transform: translate3d(-2px, 0, 0); }
}

.back-btn {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
}

.back-btn:active {
  background: rgba(255, 255, 255, 0.7);
}

.gift,
.finale__heart {
  position: relative;
  width: 120px;
  margin: 6px 0 14px;
  animation: pop-in 800ms var(--ease-out) both;
}

.gift svg,
.finale__heart svg {
  width: 100%;
  height: auto;
  fill: var(--rose);
  filter: drop-shadow(0 12px 18px rgba(232, 70, 111, 0.35));
  animation: beat 1.8s ease-in-out infinite;
}

.finale__heart {
  width: 150px;
}

.finale__heart > span {
  position: absolute;
  inset: 0 0 12%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 20px;
}

.finale__heart b {
  font-size: 2.4em;
  line-height: 1;
}

.chapter--finale .chapter__title {
  font-size: clamp(26px, 8vw, 32px);
  text-wrap: balance;
}

.chapter--finale {
  padding: 28px 20px 22px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.finale__text {
  margin: 0;
  line-height: 1.9;
  text-wrap: balance;
}

.finale__wish {
  margin: 14px 0 18px;
  font-family: var(--font-hand);
  font-size: 26px;
  line-height: 1.4;
  color: var(--rose-deep);
}

.love-btn {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow);
  transition: transform 200ms var(--ease-spring);
}

.love-btn:active {
  transform: scale(0.9);
}

.love-btn svg {
  width: 44px;
  fill: var(--rose);
  animation: beat 1.6s ease-in-out infinite;
}

.finale__line {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
}

.finale__sign {
  margin: 4px 0 0;
  font-family: var(--font-hand);
  font-size: 22px;
  color: var(--rose-deep);
}

.month__grid {
  --cols: 2;
  --gap: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px var(--gap);
  width: 100%;
}

.polaroid {
  --tilt: -1.6deg;
  display: block;
  flex: 0 0 auto;
  width: calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols));
  min-width: 0;
  padding: 8px 8px 0;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 20px -10px rgba(120, 40, 70, 0.45), 0 1px 3px rgba(120, 40, 70, 0.12);
  text-align: center;
  transform: rotate(var(--tilt));
  transition: transform 150ms ease;
  animation: photo-in 650ms var(--ease-spring) calc(200ms + min(var(--i), 8) * 90ms) backwards;
}

.polaroid:nth-child(even) {
  --tilt: 1.4deg;
}

.polaroid:nth-child(3n) {
  --tilt: -0.6deg;
}

.polaroid:active {
  transform: rotate(0deg) scale(0.97);
}

@keyframes photo-in {
  from { opacity: 0; transform: translate3d(0, 30px, 0) scale(0.85) rotate(0deg); }
  to { opacity: 1; transform: rotate(var(--tilt)); }
}

.polaroid__photo {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 3px;
  background: var(--blush);
}

.polaroid__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 500ms ease;
}

.polaroid__photo img.is-loaded {
  opacity: 1;
}

.polaroid__badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.polaroid__badge svg {
  width: 12px;
  height: 12px;
  margin-left: 2px;
  fill: var(--rose-deep);
}

.polaroid__date {
  display: block;
  padding: 6px 2px 8px;
  font-family: var(--font-hand);
  font-size: 16px;
  line-height: 1.4;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.memories__error {
  margin: 24px 0;
  text-align: center;
  color: var(--ink-soft);
}

/* Lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  background: rgba(36, 14, 24, 0.94);
  touch-action: none;
  overscroll-behavior: contain;
  opacity: 0;
  transition: opacity 280ms ease;
}

.lightbox[hidden] {
  display: none;
}

.lightbox.is-open {
  opacity: 1;
}

.lightbox:focus {
  outline: none;
}

.lightbox__track {
  position: absolute;
  inset: 0;
  will-change: transform;
}

.lightbox__track.is-animating {
  transition: transform 320ms var(--ease-out);
}

.lightbox__slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 56px) calc(var(--safe-right) + 12px) calc(var(--safe-bottom) + 64px) calc(var(--safe-left) + 12px);
}

.lightbox__slide:nth-child(1) { transform: translate3d(-100%, 0, 0); }
.lightbox__slide:nth-child(3) { transform: translate3d(100%, 0, 0); }

.lightbox__slide img,
.lightbox__slide video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.lightbox__top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 8px) calc(var(--safe-right) + 10px) 8px calc(var(--safe-left) + 18px);
  color: #fff;
  pointer-events: none;
}

.lightbox__count {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.05em;
  opacity: 0.85;
}

.lightbox__close,
.lightbox__nav {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  pointer-events: auto;
}

.lightbox__close svg,
.lightbox__nav svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  margin-top: -22px;
  display: none;
}

.lightbox.is-single .lightbox__nav {
  display: none;
}

.lightbox__nav--prev { left: calc(var(--safe-left) + 12px); }
.lightbox__nav--next { right: calc(var(--safe-right) + 12px); }

@media (hover: hover) and (pointer: fine) {
  .lightbox__nav { display: grid; }
}

.lightbox__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 12px calc(var(--safe-right) + 20px) calc(var(--safe-bottom) + 16px) calc(var(--safe-left) + 20px);
  text-align: center;
  font-family: var(--font-hand);
  font-size: 18px;
  line-height: 1.4;
  color: #ffd6e2;
  pointer-events: none;
}

/* Wider screens and iPhone landscape */

@media (min-width: 560px) {
  .month__grid {
    --cols: 3;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .main {
    max-width: 760px;
  }

  .hero {
    padding-top: calc(var(--safe-top) + 20px);
    padding-bottom: 28px;
  }

  .hero__badge {
    width: 120px;
    margin: 10px 0 6px;
  }

  .hero__scroll {
    margin-top: 16px;
  }

  .month__grid {
    --cols: 4;
  }

  .intro__inner {
    flex-direction: column;
  }

  .envelope {
    --w: min(42vh, 220px);
  }

  .intro__kicker {
    margin-bottom: 10px;
  }

  .intro__title {
    margin-top: 14px;
    font-size: 34px;
  }

  .lightbox__slide {
    padding-top: calc(var(--safe-top) + 56px);
    padding-bottom: calc(var(--safe-bottom) + 12px);
    padding-left: calc(var(--safe-left) + 64px);
    padding-right: calc(var(--safe-right) + 64px);
  }

  .lightbox__caption {
    top: 0;
    bottom: auto;
    padding: calc(var(--safe-top) + 16px) 120px 0;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 360px) {
  body {
    font-size: 16px;
  }

  .counter__clock span {
    min-width: 66px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 1ms !important;
    transition-delay: 0s !important;
  }

  .hearts {
    display: none;
  }

  .reveal,
  .hero > * {
    opacity: 1;
    transform: none;
  }
}

/* Unlock screen */

.unlock {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(var(--safe-top) + 20px) calc(var(--safe-right) + 18px) calc(var(--safe-bottom) + 20px) calc(var(--safe-left) + 18px);
}

.unlock__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 380px;
  padding: 30px 22px 22px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  text-align: center;
  animation: rise-in 800ms var(--ease-out) both;
}

.unlock__card.is-wrong {
  animation: shake 520ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-8px, 0, 0); }
  40%, 60% { transform: translate3d(8px, 0, 0); }
}

.lock-heart {
  position: relative;
  width: 104px;
  margin-bottom: 18px;
  transition: transform 600ms var(--ease-spring);
}

.lock-heart svg {
  width: 100%;
  height: auto;
  fill: var(--rose);
  filter: drop-shadow(0 12px 18px rgba(232, 70, 111, 0.35));
  animation: beat 1.8s ease-in-out infinite;
}

.lock-heart__hole {
  position: absolute;
  left: 50%;
  top: 34%;
  width: 16px;
  height: 26px;
  margin-left: -8px;
  transition: opacity 300ms, transform 400ms var(--ease-out);
}

.lock-heart__hole::before,
.lock-heart__hole::after {
  content: '';
  position: absolute;
  left: 50%;
  background: #fff;
}

.lock-heart__hole::before {
  top: 0;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
}

.lock-heart__hole::after {
  top: 9px;
  width: 8px;
  height: 15px;
  margin-left: -4px;
  border-radius: 2px 2px 4px 4px;
}

.is-right .lock-heart {
  transform: scale(1.18);
}

.is-right .lock-heart__hole {
  opacity: 0;
  transform: scale(0.3);
}

.unlock__kicker {
  margin: 0;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-soft);
}

.unlock__title {
  margin: 4px 0 20px;
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: clamp(28px, 8.4vw, 34px);
  line-height: 1.35;
  color: var(--rose-deep);
}

.code {
  position: relative;
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 12px 12px 10px;
  border: 2px solid var(--blush);
  border-radius: 20px;
  background: #fff;
  cursor: text;
  transition: border-color 200ms, box-shadow 200ms;
}

.code:focus-within {
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(255, 92, 138, 0.18);
}

.is-wrong .code {
  border-color: var(--rose-deep);
}

/* The real field sits invisibly over the hearts so a tap opens the iPhone number pad. */
.code__input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  font-size: 16px;
  color: transparent;
  caret-color: transparent;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.code__slots {
  display: flex;
  align-items: baseline;
  justify-content: center;
  font-weight: 700;
  font-size: 30px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.code__slots i {
  position: relative;
  width: 0.72em;
  font-style: normal;
  text-align: center;
  color: #ecc3d0;
  font-weight: 600;
}

.code__slots i.is-filled {
  color: var(--ink);
  font-weight: 700;
  animation: digit-pop 280ms var(--ease-spring);
}

.code__slots i.is-next::after {
  content: '';
  position: absolute;
  left: 15%;
  right: 15%;
  bottom: 0.05em;
  height: 3px;
  border-radius: 2px;
  background: var(--rose);
  animation: caret-blink 1s steps(1) infinite;
}

.code__slots b {
  margin: 0 0.12em;
  color: var(--rose-soft);
  font-weight: 600;
}

@keyframes digit-pop {
  0% { transform: translate3d(0, 4px, 0) scale(0.6); }
  100% { transform: none; }
}

@keyframes caret-blink {
  50% { opacity: 0; }
}

.unlock__hint {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
  text-wrap: balance;
}

.unlock__message {
  min-height: 1.6em;
  margin: 12px 0 0;
  font-size: 15px;
  color: var(--ink-soft);
}

.unlock__message[data-tone='wrong'] {
  color: var(--rose-deep);
  font-weight: 600;
}

.unlock__message[data-tone='right'] {
  font-family: var(--font-hand);
  font-size: 22px;
  color: var(--rose-deep);
}

@media (orientation: landscape) and (max-height: 500px) {
  .unlock__card {
    max-width: 560px;
    padding: 16px 22px 12px;
  }

  .lock-heart {
    width: 56px;
    margin-bottom: 4px;
  }

  .lock-heart__hole {
    transform: scale(0.55);
    transform-origin: 50% 0;
  }

  .unlock__title {
    margin-bottom: 12px;
    font-size: 26px;
  }

  .unlock__title br {
    display: none;
  }

  .unlock__hint {
    margin-top: 8px;
  }
}

@media (max-width: 340px) {
  .code__slots {
    font-size: 26px;
  }
}
