:root {
  --bg: #e0eaf3;
  --surface: #f4f8fb;
  --blue-100: #d4e4f1;
  --blue-200: #bfd5e6;
  --blue-300: #9fbdd2;
  --blue-400: #8eafc8;
  --blue-600: #527895;
  --blue-800: #35566f;
  --text: #334d61;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background-image: linear-gradient(rgba(82, 120, 149, .045) 1px, transparent 1px);
  background-size: 100% 31px;
}
button, input { font: inherit; }
button { color: inherit; }
:focus-visible { outline: 3px solid rgba(53, 86, 111, .35); outline-offset: 3px; }

.page-header {
  height: 68px;
  padding: 0 clamp(20px, 5vw, 70px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(111, 153, 183, .35);
  font-size: .74rem;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.page-header a {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--blue-300);
  border-radius: 50%;
  color: var(--text);
  text-decoration: none;
}
.page-header span { opacity: .65; }

main { padding: 70px clamp(18px, 4vw, 62px) 50px; }
.section-kicker {
  margin: 0 0 12px;
  color: var(--blue-600);
  font-size: .7rem;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.memory-section { text-align: center; }
.memory-section h1,
.friendship-counter h2,
.best-friend-card h2,
.stats-card h2,
.friendship-contract h2,
.best-friend-certificate h2 {
  margin: 0;
  font: 400 clamp(2rem, 4.5vw, 4rem)/1.05 Georgia, serif;
  letter-spacing: -.045em;
}
.heart-gallery {
  position: relative;
  width: min(820px, 94vw);
  height: min(500px, 58vw);
  min-height: 360px;
  margin: 22px auto 0;
}
.photo-slot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: clamp(50px, 7.4vw, 79px);
  aspect-ratio: .76;
  transform: translate(-50%, -50%) rotate(var(--r));
  padding: 5px 5px 21px;
  border: 0;
  border-radius: 3px;
  background: #fbfdff;
  box-shadow: 0 7px 18px rgba(42, 81, 108, .13);
  cursor: pointer;
  transition: transform 300ms ease, box-shadow 300ms ease;
  overflow: hidden;
}
.photo-slot:hover,
.photo-slot:focus-visible {
  z-index: 5;
  transform: translate(-50%, -50%) rotate(0) scale(1.06);
  box-shadow: 0 14px 30px rgba(42, 81, 108, .21);
}
.photo-slot img { width: 100%; height: 100%; display: block; object-fit: cover; background: var(--blue-100); }
.photo-slot .slot-number {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  color: #7893a6;
  font: 600 .56rem/1 ui-monospace, monospace;
}
.photo-slot.empty img { display: none; }
.photo-slot.empty::before {
  content: "+";
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--blue-400);
  font: 300 1.25rem/1 Georgia, serif;
  background: linear-gradient(145deg, #f8fcff, #e6f0f7);
}

.thin-divider { width: min(980px, 88vw); height: 1px; margin: 58px auto; background: var(--blue-300); }
blockquote {
  max-width: 830px;
  margin: 0 auto;
  text-align: center;
  font: italic 400 clamp(1.35rem, 2.8vw, 2.35rem)/1.45 Georgia, serif;
  color: var(--blue-800);
  animation: quote-in .4s ease both;
}
@keyframes quote-in { from { opacity: 0; transform: translateY(8px); } }

.letter-music {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: clamp(30px, 5vw, 64px);
  align-items: start;
}
.blue-letter-wrap { position: relative; text-align: center; }
.blue-envelope {
  position: relative;
  width: 100%;
  aspect-ratio: 1.62;
  overflow: hidden;
  border: 1px solid #86b5d1;
  border-radius: 6px;
  background: #bcd8e9;
  box-shadow: 0 20px 40px rgba(53, 87, 111, .14);
  cursor: pointer;
  transition: transform .35s, box-shadow .35s;
}
.blue-envelope:hover { transform: translateY(-4px); box-shadow: 0 28px 52px rgba(53, 87, 111, .19); }
.envelope-flap { position: absolute; inset: 0; z-index: 2; background: #cfe3ef; clip-path: polygon(0 0, 100% 0, 50% 57%); transform-origin: top; transition: transform .65s cubic-bezier(.22, 1, .36, 1); }
.envelope-fold { position: absolute; inset: 0; background: #afcfe2; }
.envelope-fold.left { clip-path: polygon(0 0, 52% 58%, 0 100%); }
.envelope-fold.right { clip-path: polygon(100% 0, 48% 58%, 100% 100%); }
.seal {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 49%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 4px double rgba(255, 255, 255, .55);
  border-radius: 50%;
  background: #6ca9cb;
  color: white;
  font-size: 1.25rem;
  transition: transform .45s, opacity .3s;
}
.envelope-label { position: absolute; z-index: 4; left: 50%; top: 71%; transform: translate(-50%, -50%); white-space: nowrap; font: 400 clamp(1.5rem, 3vw, 2.25rem) Georgia, serif; color: #41677f; }
.blue-envelope.open .envelope-flap { transform: rotateX(180deg); }
.blue-envelope.open .seal { transform: translate(-50%, -50%) scale(.4); opacity: 0; }
.open-note { color: var(--blue-600); font-size: .76rem; letter-spacing: .06em; }
.letter-paper {
  position: absolute;
  z-index: 8;
  left: 6%;
  right: 6%;
  top: 54px;
  min-height: 72%;
  padding: 38px 28px;
  border: 1px solid var(--blue-200);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 16px 38px rgba(53, 87, 111, .18);
  transform: translateY(35%) scale(.9);
  opacity: 0;
  pointer-events: none;
  transition: .65s cubic-bezier(.22, 1, .36, 1);
}
.letter-paper.visible { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }
.letter-paper h2 { font: 400 clamp(1.65rem, 3vw, 2.25rem) Georgia, serif; }
.letter-paper p { line-height: 1.72; color: #53758a; }

.song-card {
  border: 1px solid #8fc4df;
  border-radius: 22px;
  padding: 20px;
  background: rgba(247, 251, 255, .62);
  box-shadow: 0 20px 48px rgba(53, 87, 111, .1);
  backdrop-filter: blur(12px);
}
.song-top { display: grid; grid-template-columns: 82px minmax(0, 1fr) 44px minmax(78px, 105px) 30px; gap: 12px; align-items: center; }
.song-top img { width: 82px; height: 82px; object-fit: cover; border-radius: 12px; }
.song-meta { min-width: 0; text-align: left; }
.song-meta small { display: block; margin-bottom: 5px; color: var(--blue-600); font-size: .64rem; }
.song-meta strong { display: block; font: 400 1.08rem/1.1 Georgia, serif; }
.song-play { width: 44px; height: 44px; border: 1px solid #8fc4df; border-radius: 50%; background: #e8f4fb; cursor: pointer; }
.song-mute { width: 29px; height: 29px; border: 1px solid var(--blue-300); border-radius: 50%; background: transparent; cursor: pointer; font-size: .8rem; }
.song-volume { display: grid; gap: 7px; color: var(--blue-600); font-size: .62rem; text-align: left; }
.song-volume input { width: 100%; accent-color: #629fbe; cursor: pointer; }
.song-progress {
  --played: 0%;
  display: block;
  width: 100%;
  height: 4px;
  margin: 16px 0 0;
  appearance: none;
  border-radius: 10px;
  background: linear-gradient(90deg, #5599bc 0 var(--played), #c8dce8 var(--played));
  cursor: pointer;
}
.song-progress::-webkit-slider-thumb { appearance: none; width: 13px; height: 13px; border: 3px solid #eef7fc; border-radius: 50%; background: #5599bc; box-shadow: 0 0 0 1px #5599bc; }
.song-progress::-moz-range-thumb { width: 9px; height: 9px; border: 3px solid #eef7fc; border-radius: 50%; background: #5599bc; box-shadow: 0 0 0 1px #5599bc; }
.song-time { display: flex; justify-content: space-between; margin: 7px 1px 12px; color: var(--blue-600); font-size: .58rem; }
.lyrics-pair { display: grid; grid-template-columns: 1fr 1fr; max-height: 430px; overflow: hidden; border-top: 1px solid var(--blue-300); }
.lyrics-column { height: 430px; padding: 17px 20px 30px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #9bc3da transparent; }
.lyrics-column + .lyrics-column { border-left: 1px solid var(--blue-300); }
.lyrics-column h3 { position: sticky; top: -17px; z-index: 2; margin: 0 -20px 18px; padding: 16px 20px 10px; background: rgba(235, 244, 250, .96); color: var(--blue-600); font-size: .69rem; letter-spacing: .16em; text-transform: uppercase; }
.lyric-segment { margin: 0 0 22px; color: #587689; font-size: .86rem; line-height: 1.75; white-space: pre-line; opacity: .48; transition: opacity .3s, color .3s; }
.lyric-segment.active { color: #254c65; opacity: 1; }

.decorative-divider { width: min(980px, 88vw); margin: 84px auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.decorative-divider span { height: 1px; background: var(--blue-300); }
.decorative-divider i { width: 9px; height: 9px; border: 1px solid var(--blue-600); transform: rotate(45deg); }

.friendship-counter { width: min(980px, 100%); margin: 0 auto; text-align: center; }
.friendship-counter h2 { font-size: clamp(2rem, 4vw, 3.5rem); }
.distance-line { position: relative; margin: 38px auto 22px; display: grid; grid-template-columns: 190px minmax(100px, 1fr) auto minmax(100px, 1fr) 190px; align-items: center; }
.initial-card { padding: 20px; border: 1px solid var(--blue-200); border-radius: 22px; background: rgba(244, 248, 251, .85); box-shadow: 0 14px 32px rgba(53, 87, 111, .09); }
.initial-card span { width: 98px; aspect-ratio: 1; margin: 0 auto 12px; display: grid; place-items: center; background: var(--blue-200); color: white; font: 400 2rem Georgia, serif; clip-path: path("M49 88 C42 81 8 58 8 31 C8 12 32 4 49 23 C66 4 90 12 90 31 C90 58 56 81 49 88Z"); }
.initial-card small { color: var(--blue-600); }
.heart-path { height: 1px; display: flex; align-items: center; justify-content: space-around; border-top: 1px dashed var(--blue-300); color: var(--blue-400); }
.heart-path b { padding: 0 7px; background: var(--bg); transform: translateY(-50%); font: 400 1.2rem Georgia, serif; }
.days-together { min-width: 118px; padding: 10px 16px; border: 1px solid var(--blue-300); border-radius: 999px; background: var(--surface); box-shadow: 0 8px 20px rgba(53, 87, 111, .08); }
.days-together strong { display: block; font: 400 1.55rem Georgia, serif; }
.days-together span { color: var(--blue-600); font-size: .65rem; }
.start-date { margin: 0; color: var(--blue-600); font-size: .75rem; letter-spacing: .08em; }

.friendship-info { width: min(1180px, 100%); margin: 0 auto; display: grid; grid-template-columns: minmax(300px, .78fr) minmax(0, 1.22fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.best-friend-card,
.stats-card,
.friendship-contract,
.best-friend-certificate { position: relative; border: 1px solid var(--blue-200); border-radius: 24px; background: rgba(244, 248, 251, .9); box-shadow: 0 18px 42px rgba(53, 87, 111, .1); }
.best-friend-card { overflow: hidden; padding: 36px; }
.best-friend-card h2,
.stats-card h2 { margin-bottom: 28px; font-size: clamp(1.75rem, 3vw, 2.65rem); }
.card-ribbon { position: absolute; top: 21px; right: -40px; width: 170px; padding: 7px; transform: rotate(35deg); background: var(--blue-200); color: var(--blue-800); text-align: center; font-size: .57rem; letter-spacing: .1em; text-transform: uppercase; }
.id-photo { width: 160px; aspect-ratio: .82; padding: 7px 7px 30px; border: 0; background: white; box-shadow: 0 10px 25px rgba(53, 87, 111, .12); cursor: pointer; transform: rotate(-1.5deg); }
.id-photo img { width: 100%; height: 100%; object-fit: cover; display: block; background: var(--blue-100); }
.id-photo span { display: block; margin-top: 8px; color: var(--blue-600); font-size: .62rem; }
.id-photo.empty img { display: none; }
.id-photo.empty::before { content: "+"; height: calc(100% - 10px); display: grid; place-items: center; background: var(--blue-100); color: var(--blue-600); font: 300 2rem Georgia, serif; }
.best-friend-card dl { margin: 32px 0 26px; display: grid; gap: 14px; }
.best-friend-card dl div { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 9px; border-bottom: 1px dotted var(--blue-300); }
.best-friend-card dt { color: var(--blue-600); font-size: .7rem; }
.best-friend-card dd { margin: 0; font: 400 1rem Georgia, serif; text-align: right; }
.fake-barcode { width: 58%; height: 34px; margin-left: auto; background: repeating-linear-gradient(90deg, var(--blue-800) 0 2px, transparent 2px 5px, var(--blue-800) 5px 6px, transparent 6px 10px); opacity: .45; }
.stats-card { padding: 36px; }
.stats-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; }
.stat-row { min-height: 70px; padding: 13px 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; border-bottom: 1px solid rgba(159, 189, 210, .65); }
.stat-row span { color: #55758b; font-size: .78rem; line-height: 1.35; }
.stat-row strong { color: var(--blue-800); font: 400 1.35rem Georgia, serif; }

.friendship-contract { width: min(900px, 100%); margin: 0 auto; padding: clamp(30px, 6vw, 68px); background-image: repeating-linear-gradient(transparent 0 30px, rgba(82, 120, 149, .07) 31px, transparent 32px); }
.friendship-contract h2 { max-width: 680px; font-size: clamp(2rem, 4.3vw, 3.7rem); text-transform: uppercase; }
.contract-intro { max-width: 650px; margin: 25px 0; color: #55758b; line-height: 1.65; }
.friendship-contract ol { margin: 0; padding-left: 25px; columns: 2; column-gap: 45px; }
.friendship-contract li { margin: 0 0 16px; break-inside: avoid; color: #46677d; line-height: 1.5; }
.contract-stamp { position: absolute; top: 34px; right: 36px; width: 96px; height: 96px; display: grid; place-items: center; border: 2px solid var(--blue-400); border-radius: 50%; color: var(--blue-600); font: italic 1.1rem Georgia, serif; transform: rotate(8deg); opacity: .7; }
.contract-status { min-height: 25px; margin: 26px 0 10px; color: var(--blue-600); font: italic 1rem Georgia, serif; }
.contract-actions { min-height: 58px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.contract-actions button { min-width: 125px; padding: 13px 25px; border-radius: 999px; cursor: pointer; transition: transform .24s, opacity .24s, background .24s; }
.accept-button { border: 1px solid var(--blue-800); background: var(--blue-800); color: white; }
.deny-button { border: 1px solid var(--blue-300); background: var(--surface); transform: var(--deny-transform, translate(0, 0)); }
.deny-button.hidden { visibility: hidden; pointer-events: none; }
.accept-button:disabled { cursor: default; opacity: .72; }

#certificateMount:not(:empty) { margin-top: 78px; }
.best-friend-certificate { width: min(920px, 100%); margin: 0 auto; padding: 14px; animation: certificate-in .55s ease both; }
@keyframes certificate-in { from { opacity: 0; transform: translateY(12px); } }
.best-friend-certificate.closing { pointer-events: none; animation: certificate-out .45s ease both; }
@keyframes certificate-out { to { opacity: 0; transform: translateY(12px); } }
.certificate-border { padding: clamp(30px, 6vw, 70px); border: 2px solid var(--blue-400); outline: 1px solid var(--blue-200); outline-offset: -9px; text-align: center; }
.certificate-overline { margin: 0 0 22px; color: var(--blue-600); font-size: .65rem; letter-spacing: .18em; text-transform: uppercase; }
.best-friend-certificate h2 { text-transform: uppercase; }
.best-friend-certificate > .certificate-border > strong { display: block; margin: 16px auto; color: var(--blue-800); font: italic 400 clamp(2.5rem, 6vw, 5.2rem) Georgia, serif; }
.best-friend-certificate h3 { margin: 12px 0 24px; color: var(--blue-600); font: 400 clamp(1.6rem, 3vw, 2.5rem) Georgia, serif; text-transform: uppercase; letter-spacing: .08em; }
.certificate-bottom { margin-top: 42px; display: grid; grid-template-columns: 1fr 130px 1fr; gap: 24px; align-items: end; }
.certificate-bottom > div:not(.certificate-seal) { padding-bottom: 8px; border-bottom: 1px solid var(--blue-400); }
.certificate-bottom span { font: italic 1rem Georgia, serif; }
.certificate-bottom small { display: block; margin-top: 8px; color: var(--blue-600); font-size: .58rem; letter-spacing: .1em; text-transform: uppercase; }
.certificate-seal { width: 120px; aspect-ratio: 1; display: grid; place-content: center; border: 2px solid var(--blue-600); border-radius: 50%; color: var(--blue-800); font: 400 1.7rem Georgia, serif; }
.certificate-seal small { font-size: .48rem; }
.certificate-validity { margin: 30px 0 0; color: var(--blue-600); font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; }

footer { width: min(1180px, 100%); margin: 80px auto 0; padding-top: 24px; display: flex; justify-content: space-between; border-top: 1px solid var(--blue-300); color: var(--blue-600); font-size: .72rem; }
footer a { color: inherit; }

@media (max-width: 940px) {
  .letter-music,
  .friendship-info { grid-template-columns: 1fr; }
  .blue-letter-wrap { width: min(620px, 100%); margin: 0 auto; }
  .song-card { width: min(650px, 100%); margin: 0 auto; }
  .best-friend-card { width: min(620px, 100%); margin: 0 auto; }
  .distance-line { grid-template-columns: 160px 1fr auto 1fr 160px; }
}

@media (max-width: 650px) {
  main { padding: 48px 12px 40px; }
  .heart-gallery { width: 100%; height: 350px; min-height: 350px; }
  .photo-slot { width: clamp(43px, 12vw, 58px); padding: 4px 4px 17px; }
  .thin-divider { margin: 44px auto; }
  .song-card { padding: 13px; }
  .song-top { grid-template-columns: 68px minmax(0, 1fr) 42px 28px; gap: 9px; }
  .song-top img { width: 68px; height: 68px; }
  .song-volume { grid-column: 2 / 5; }
  .song-meta strong { font-size: .98rem; }
  .lyrics-pair { max-height: 380px; }
  .lyrics-column { height: 380px; padding: 15px 11px 25px; }
  .lyrics-column h3 { top: -15px; margin: 0 -11px 16px; padding: 14px 11px 9px; }
  .lyric-segment { font-size: .73rem; line-height: 1.65; }
  .decorative-divider { margin: 60px auto; }
  .distance-line { grid-template-columns: 1fr auto 1fr; gap: 12px; }
  .initial-card { padding: 14px 8px; }
  .initial-card span { width: 78px; }
  .initial-card small { font-size: .58rem; }
  .heart-path { display: none; }
  .days-together { grid-column: 2; grid-row: 1; min-width: 92px; padding-inline: 9px; }
  .stats-list { grid-template-columns: 1fr; }
  .best-friend-card,
  .stats-card,
  .friendship-contract { padding: 28px 20px; }
  .friendship-contract ol { columns: 1; }
  .contract-stamp { top: 18px; right: 18px; width: 68px; height: 68px; font-size: .8rem; }
  .contract-actions { justify-content: center; }
  .certificate-bottom { grid-template-columns: 1fr 82px 1fr; gap: 10px; }
  .certificate-seal { width: 78px; }
  footer { flex-direction: column; gap: 12px; }
}

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

/* Interactive letter */
.letter-stage {
  position: relative;
  width: min(620px, 100%);
  min-height: clamp(430px, 46vw, 560px);
  margin: 0 auto;
  isolation: isolate;
}
.letter-stage .blue-envelope {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 5%;
  width: min(100%, 600px);
  margin: auto;
  transform: translateY(0);
}
.letter-stage[data-state="closed"] .blue-envelope:hover { transform: translateY(-3px); }
.letter-stage .seal {
  border: 2px solid var(--blue-600);
  background: #f8fbfd;
  color: var(--blue-600);
  box-shadow: 0 5px 15px rgba(53, 86, 111, .13);
}
.letter-stage .seal span { display: block; transition: transform .25s ease; }
.letter-stage[data-state="closed"] .blue-envelope:hover .seal span { transform: scale(1.04); }
.envelope-for-you {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 68%;
  transform: translateX(-50%);
  color: var(--blue-800);
  font: 400 clamp(1rem, 2vw, 1.35rem) Georgia, serif;
  letter-spacing: .02em;
  transition: opacity .28s ease, transform .35s ease;
}
.letter-stage[data-state="open"] .envelope-flap,
.letter-stage[data-state="closing"] .envelope-flap { transform: rotateX(180deg); }
.letter-stage[data-state="open"] .seal,
.letter-stage[data-state="closing"] .seal { transform: translate(-50%, -50%) scale(.42); opacity: 0; }
.letter-stage[data-state="open"] .envelope-for-you,
.letter-stage[data-state="closing"] .envelope-for-you { transform: translateX(-50%) translateY(8px); opacity: 0; }
.letter-stage .letter-paper {
  z-index: 8;
  top: 2%;
  left: 5%;
  right: 5%;
  min-height: 72%;
  padding: clamp(28px, 4vw, 46px);
  border-radius: 12px;
  background: #f8fbfd;
  background-image: linear-gradient(rgba(82, 120, 149, .035) 1px, transparent 1px);
  background-size: 100% 27px;
  box-shadow: 0 14px 35px rgba(53, 86, 111, .12);
  transform: translateY(43%) scale(.94);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform .62s cubic-bezier(.22, 1, .36, 1), opacity .42s ease, visibility 0s linear .65s;
}
.letter-stage[data-state="open"] .letter-paper {
  transform: translateY(-3%) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: .38s, .38s, 0s;
}
.letter-stage[data-state="closing"] .letter-paper {
  transform: translateY(43%) scale(.95);
  opacity: 0;
  visibility: visible;
  pointer-events: none;
  transition-delay: 0s;
}
.store-letter {
  margin: 20px auto 0;
  padding: 11px 24px;
  border: 1px solid var(--blue-800);
  border-radius: 999px;
  background: var(--blue-800);
  color: white;
  cursor: pointer;
  box-shadow: 0 7px 16px rgba(53, 86, 111, .12);
}
.letter-copy { width: min(72%, 360px); text-align: left; }
.letter-copy h2 { margin: 18px 0; }
.letter-polaroid {
  position: absolute;
  z-index: 2;
  top: 24px;
  right: 24px;
  width: clamp(76px, 10vw, 104px);
  aspect-ratio: .78;
  padding: 6px 6px 24px;
  border: 0;
  background: white;
  box-shadow: 0 8px 18px rgba(53, 86, 111, .14);
  transform: rotate(5deg);
  cursor: pointer;
  transition: transform .25s ease, box-shadow .25s ease;
}
.letter-polaroid:hover,
.letter-polaroid:focus-visible { transform: rotate(2deg) scale(1.03); box-shadow: 0 11px 24px rgba(53, 86, 111, .18); }
.letter-polaroid img { display: block; width: 100%; height: 100%; object-fit: cover; background: var(--blue-100); }
.letter-polaroid span { position: absolute; left: 3px; right: 3px; bottom: 7px; color: var(--blue-600); font-size: .5rem; text-align: center; }
.letter-polaroid.empty img { display: none; }
.letter-polaroid.empty::before { content: "+"; height: 100%; display: grid; place-items: center; background: var(--blue-100); color: var(--blue-600); font: 300 1.5rem Georgia, serif; }

/* Symmetric friendship counter */
.initials-row {
  width: min(430px, 100%);
  margin: 34px auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.initial-box {
  width: 82px;
  height: 82px;
  flex: 0 0 82px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--blue-300);
  border-radius: 16px;
  background: rgba(244, 248, 251, .9);
  box-shadow: 0 10px 24px rgba(53, 87, 111, .08);
  color: var(--blue-800);
  font: 400 2rem/1 Georgia, serif;
}
.initial-connection { height: 1px; flex: 1 1 auto; background: var(--blue-300); }
.friendship-counter-row {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(10px, 2vw, 22px);
  text-align: center;
}
.counter-hearts {
  width: clamp(100px, 23vw, 250px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(3px, .7vw, 9px);
  color: var(--blue-600);
}
.counter-hearts span { font: 400 clamp(1rem, 2.1vw, 1.65rem)/1 Georgia, serif; }
.counter-main {
  min-width: 120px;
  padding: 11px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--blue-300);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(53, 87, 111, .08);
}
.counter-main strong { font: 400 1.7rem/1 Georgia, serif; }
.counter-main span { margin-top: 5px; color: var(--blue-600); font-size: .65rem; }
.friendship-counter .start-date { margin-top: 22px; }

/* Certificate signatures */
.certificate-date { margin: 32px 0 0; color: var(--blue-600); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
.certificate-signatures {
  display: grid;
  grid-template-columns: 1fr 120px 1fr;
  align-items: end;
  gap: 32px;
  margin-top: 32px;
}
.signature-block { padding-bottom: 8px; border-bottom: 1px solid var(--blue-400); text-align: center; }
.signature { display: inline-block; color: var(--blue-800); font-family: "Segoe Script", "Brush Script MT", cursive; font-size: clamp(1.25rem, 2vw, 1.6rem); }
.signature-block:first-child .signature { transform: rotate(-2deg); }
.signature-block:last-child .signature { transform: rotate(1deg); }
.signature-block small { display: block; margin-top: 8px; color: var(--blue-600); font-size: .58rem; letter-spacing: .1em; text-transform: uppercase; }
.certificate-validity { display: flex; align-items: center; justify-content: center; gap: 6px; }
.certificate-validity strong { font-weight: 500; }
.infinity-symbol { color: var(--blue-600); font: 400 1.65em/1 Georgia, serif; }

@media (max-width: 650px) {
  .letter-stage { min-height: 430px; }
  .letter-stage .blue-envelope { bottom: 12%; }
  .letter-stage .letter-paper { left: 3%; right: 3%; padding: 26px 18px; }
  .letter-copy { width: 67%; }
  .letter-polaroid { top: 20px; right: 16px; width: 76px; }
  .initial-box { width: 62px; height: 62px; flex-basis: 62px; border-radius: 13px; font-size: 1.55rem; }
  .initials-row { width: min(320px, 88vw); }
  .friendship-counter-row { gap: 7px; }
  .counter-hearts { width: clamp(76px, 26vw, 112px); gap: 2px; }
  .counter-hearts span { font-size: clamp(.72rem, 3vw, 1rem); }
  .counter-main { min-width: 90px; padding: 9px 10px; }
  .counter-main strong { font-size: 1.4rem; }
  .certificate-signatures { grid-template-columns: 1fr 70px 1fr; gap: 10px; }
  .certificate-signatures .certificate-seal { width: 68px; }
  .signature { font-size: 1.12rem; }
}

/* Restored friendship counter composition */
.friendship-counter .distance-line {
  width: min(980px, 100%);
  margin: 38px auto 22px;
  display: grid;
  grid-template-columns: 170px minmax(110px, 1fr) auto minmax(110px, 1fr) 170px;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.friendship-counter .initial-card {
  width: 170px;
  height: 156px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--blue-200);
  border-radius: 22px;
  background: rgba(244, 248, 251, .85);
  box-shadow: 0 14px 32px rgba(53, 87, 111, .09);
}
.friendship-counter .initial-heart {
  width: 92px;
  height: 92px;
  flex: 0 0 92px;
  margin: 0 auto 4px;
  display: grid;
  place-items: center;
  padding: 0;
  background: var(--blue-200);
  color: white;
  font: 400 2rem/1 Georgia, serif;
  clip-path: path("M46 83 C40 77 7 55 7 29 C7 11 30 4 46 21 C62 4 85 11 85 29 C85 55 52 77 46 83Z");
}
.friendship-counter .initial-card small { color: var(--blue-600); font-size: .67rem; white-space: nowrap; }
.friendship-counter .heart-path {
  height: 1px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  border-top: 1px dashed var(--blue-300);
  color: var(--blue-600);
}
.friendship-counter .heart-path b {
  padding: 0 5px;
  background: var(--bg);
  transform: translateY(-50%);
  font: 400 clamp(.78rem, 1.5vw, 1.05rem)/1 Georgia, serif;
}

/* Signature footer */
.signature-footer{position:relative;margin-top:92px;padding:30px 4px 16px;align-items:center;border-top:0;color:rgba(76,112,135,.78)}
.signature-footer::before{content:"";position:absolute;left:0;right:0;top:0;height:1px;background:linear-gradient(90deg,transparent,var(--blue-300) 18%,var(--blue-300) 82%,transparent)}
.signature-footer span{font:italic .8rem/1.5 Georgia,serif;letter-spacing:.025em}
.signature-footer a{display:inline-flex;align-items:center;gap:7px;padding:8px 12px;border-radius:999px;text-decoration:none;transition:color .22s ease,background .22s ease,transform .22s ease}
.signature-footer a i{font-style:normal;transition:transform .22s ease}
.signature-footer a:hover,.signature-footer a:focus-visible{color:var(--blue-800);background:rgba(190,218,234,.28);transform:translateY(-1px)}
.signature-footer a:hover i,.signature-footer a:focus-visible i{transform:translate(2px,-2px)}
@media(max-width:620px){.signature-footer{margin-top:70px;padding-top:25px;align-items:flex-start}.signature-footer a{margin-left:-12px}}
.friendship-counter .days-together {
  grid-column: auto;
  grid-row: auto;
  min-width: 110px;
  padding: 10px 16px;
  text-align: center;
}

@media (max-width: 650px) {
  .friendship-counter .distance-line {
    grid-template-columns: 92px minmax(24px, 1fr) 82px minmax(24px, 1fr) 92px;
    margin-top: 30px;
  }
  .friendship-counter .initial-card {
    width: 92px;
    height: 124px;
    padding: 10px 5px;
    border-radius: 17px;
  }
  .friendship-counter .initial-heart {
    width: 64px;
    height: 64px;
    flex-basis: 64px;
    margin-bottom: 5px;
    font-size: 1.45rem;
    clip-path: path("M32 58 C28 54 5 39 5 20 C5 8 21 3 32 15 C43 3 59 8 59 20 C59 39 36 54 32 58Z");
  }
  .friendship-counter .initial-card small { font-size: .51rem; }
  .friendship-counter .heart-path { display: flex; }
  .friendship-counter .heart-path b { padding: 0 1px; font-size: .6rem; }
  .friendship-counter .days-together { min-width: 82px; padding: 8px 7px; }
  .friendship-counter .days-together strong { font-size: 1.3rem; }
  .friendship-counter .days-together span { font-size: .54rem; }
}

/* Long birthday letter — keeps the existing paper and envelope composition */
.letter-stage {
  transition: min-height .62s cubic-bezier(.22, 1, .36, 1);
}
.letter-stage[data-state="open"],
.letter-stage[data-state="closing"] {
  min-height: var(--letter-open-height, 1760px);
}
.letter-stage .letter-paper {
  left: 2%;
  right: 2%;
  min-height: 0;
  padding: clamp(34px, 5vw, 54px);
  border: 1px solid rgba(159, 189, 210, .72);
}
.letter-copy {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  text-align: left;
}
.letter-copy p {
  margin: 0 0 1.35em;
  color: #466b82;
  font: 400 clamp(.98rem, 1.45vw, 1.08rem)/1.82 Georgia, "Times New Roman", serif;
}
.letter-copy p:first-child {
  min-height: 124px;
  padding-right: clamp(185px, 35%, 220px);
}
.letter-copy p:last-child {
  margin-bottom: 0;
  color: #315d77;
  font-style: italic;
}
.letter-polaroid {
  top: 30px;
  right: 30px;
  width: clamp(160px, 25vw, 198px);
  aspect-ratio: 1.48;
  padding: 7px 7px 25px;
  border: 1px solid rgba(167, 190, 204, .28);
  box-shadow: 0 8px 18px rgba(53, 86, 111, .11);
  transform: rotate(2.2deg);
}
.letter-polaroid::after {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  width: 52px;
  height: 19px;
  background: rgba(190, 218, 234, .62);
  box-shadow: 0 1px 2px rgba(53, 86, 111, .04);
  transform: translateX(-50%) rotate(-3deg);
  pointer-events: none;
}
.letter-polaroid img {
  object-fit: contain;
  background: #edf5f9;
}
.letter-polaroid span {
  bottom: 6px;
  font-size: .68rem;
}

@media (max-width: 650px) {
  .letter-stage .letter-paper {
    left: 0;
    right: 0;
    padding: 26px 18px 34px;
  }
  .letter-copy {
    padding-top: 112px;
  }
  .letter-copy p {
    margin-bottom: 1.25em;
    font-size: .98rem;
    line-height: 1.76;
  }
  .letter-copy p:first-child {
    min-height: 0;
    padding-right: 0;
  }
  .letter-polaroid {
    top: 22px;
    right: 18px;
    width: 142px;
  }
}
