:root {
  --bg: #fff7fb;
  --bg-strong: #fff0f6;
  --ink: #34202a;
  --muted: #826775;
  --rose: #e84f73;
  --rose-dark: #b92e55;
  --rose-soft: #ffd8e2;
  --gold: #ffd76a;
  --mint: #bfead8;
  --sky: #ccecf7;
  --paper: #fffdf8;
  --shadow: 0 22px 70px rgba(126, 36, 67, 0.18);
  --tight-shadow: 0 14px 34px rgba(126, 36, 67, 0.16);
  --radius: 8px;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.86) 0 12px, transparent 12px 24px),
    linear-gradient(180deg, #fff9fc 0%, #fff1f6 48%, #f7fff9 100%);
  background-size: 34px 34px, auto;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

#skyCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  min-height: 100vh;
  padding: 24px 0 72px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(184, 48, 84, 0.18);
  border-radius: 50%;
  color: var(--rose-dark);
  font-family: var(--font-serif);
  font-size: 22px;
  background: linear-gradient(145deg, #fff, #ffe4eb);
  box-shadow: 0 10px 26px rgba(126, 36, 67, 0.12);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid rgba(184, 48, 84, 0.16);
  border-radius: 999px;
  color: var(--rose-dark);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 28px rgba(126, 36, 67, 0.08);
  backdrop-filter: blur(16px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5bd29c;
  box-shadow: 0 0 0 5px rgba(91, 210, 156, 0.18);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 480px);
  gap: clamp(32px, 6vw, 86px);
  align-items: center;
  min-height: calc(100vh - 92px);
  padding: 56px 0 24px;
}

.hero-copy {
  max-width: 680px;
}

.eyebrow,
.details-kicker {
  margin: 0 0 12px;
  color: var(--rose-dark);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 660px;
  margin-bottom: 18px;
  font-family: var(--font-serif);
  font-size: clamp(3.45rem, 8.5vw, 7.25rem);
  line-height: 0.9;
  letter-spacing: 0;
  overflow-wrap: break-word;
  text-wrap: balance;
}

h2 {
  margin-bottom: 12px;
  font-family: var(--font-serif);
  font-size: clamp(2.1rem, 5vw, 4.6rem);
  line-height: 0.98;
}

h3 {
  margin-bottom: 12px;
  font-family: var(--font-serif);
  font-size: clamp(1.65rem, 3vw, 2.6rem);
  line-height: 1;
}

.hero-lede,
.section-heading p,
.letter-details p,
.modal-content > p {
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.16rem);
  line-height: 1.7;
}

.hero-lede {
  max-width: 610px;
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.primary-action,
.ghost-action {
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  border: 0;
  font-weight: 850;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.primary-action {
  color: #fff;
  background: linear-gradient(135deg, var(--rose), var(--rose-dark));
  box-shadow: 0 16px 34px rgba(184, 48, 84, 0.28);
}

.primary-action:hover,
.ghost-action:hover,
.letter-card:hover,
.featured-envelope:hover {
  transform: translateY(-2px);
}

.primary-action:active,
.ghost-action:active,
.letter-card:active,
.featured-envelope:active {
  transform: translateY(0);
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}

.primary-action.small {
  min-height: 42px;
  padding: 0 16px;
  font-size: 0.94rem;
}

.ghost-action {
  color: var(--rose-dark);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(184, 48, 84, 0.18);
  box-shadow: 0 14px 30px rgba(126, 36, 67, 0.1);
}

.hero-stage {
  position: relative;
  display: grid;
  min-height: 540px;
  place-items: center;
  isolation: isolate;
}

.moon {
  position: absolute;
  top: 58px;
  right: 36px;
  width: 120px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 35%, rgba(255, 255, 255, 0.9) 0 12px, transparent 13px),
    radial-gradient(circle at 65% 68%, rgba(255, 255, 255, 0.55) 0 9px, transparent 10px),
    linear-gradient(145deg, #fff7cf, #ffd76a);
  box-shadow: 0 24px 80px rgba(255, 215, 106, 0.52);
  opacity: 0.92;
}

.orbit {
  position: absolute;
  border: 1px dashed rgba(184, 48, 84, 0.22);
  border-radius: 50%;
  animation: orbit 18s linear infinite;
}

.orbit-one {
  width: min(440px, 88vw);
  aspect-ratio: 1;
}

.orbit-two {
  width: min(320px, 72vw);
  aspect-ratio: 1;
  animation-duration: 24s;
  animation-direction: reverse;
}

.featured-envelope {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 18px;
  place-items: center;
  width: min(100%, 420px);
  padding: 32px;
  border: 0;
  color: inherit;
  background: transparent;
  transition: transform 180ms ease;
}

.featured-date,
.featured-caption {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 12px 28px rgba(126, 36, 67, 0.1);
  backdrop-filter: blur(18px);
}

.featured-date {
  min-height: 36px;
  padding: 0 15px;
  color: var(--rose-dark);
  font-weight: 900;
}

.featured-caption {
  min-height: 34px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.letters-section {
  padding: 24px 0 96px;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 28px;
}

.mailbox-layout {
  display: grid;
  grid-template-columns: minmax(240px, 330px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.letter-details {
  position: sticky;
  top: 18px;
  min-height: 330px;
  padding: 26px;
  border: 1px solid rgba(184, 48, 84, 0.14);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 248, 251, 0.84)),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(232, 79, 115, 0.08) 32px);
  box-shadow: var(--tight-shadow);
  backdrop-filter: blur(18px);
}

.letter-details::after {
  content: "";
  position: absolute;
  right: 22px;
  bottom: 18px;
  width: 70px;
  height: 88px;
  border: 2px dashed rgba(184, 48, 84, 0.2);
  border-radius: 7px;
  transform: rotate(5deg);
}

.details-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.details-row span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border-radius: 999px;
  padding: 0 12px;
  color: var(--rose-dark);
  font-size: 0.86rem;
  font-weight: 850;
  background: #fff;
  border: 1px solid rgba(184, 48, 84, 0.13);
}

.calendar-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.letter-card {
  position: relative;
  display: grid;
  min-height: 254px;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid rgba(184, 48, 84, 0.13);
  border-radius: var(--radius);
  color: var(--ink);
  text-align: left;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 244, 249, 0.84)),
    var(--card-pattern, none);
  box-shadow: 0 14px 34px rgba(126, 36, 67, 0.11);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    opacity 180ms ease;
}

.letter-card::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px dashed rgba(184, 48, 84, 0.12);
  border-radius: 6px;
  pointer-events: none;
}

.letter-card:hover {
  border-color: rgba(184, 48, 84, 0.34);
  box-shadow: 0 22px 48px rgba(126, 36, 67, 0.17);
}

.letter-card.is-shaking {
  animation: shake 420ms ease;
}

.letter-card.is-locked {
  color: rgba(255, 255, 255, 0.74);
  cursor: not-allowed;
  background:
    linear-gradient(135deg, rgba(46, 34, 42, 0.88), rgba(78, 54, 68, 0.84)),
    var(--card-pattern, none);
  border-color: rgba(255, 255, 255, 0.08);
}

.letter-card.is-locked .envelope {
  filter: saturate(0.45) brightness(0.72);
  opacity: 0.86;
  animation: none;
}

.letter-card.is-locked .calendar-date,
.letter-card.is-locked .lock-badge {
  color: #f2c4d2;
  background: rgba(255, 255, 255, 0.1);
}

.letter-card.is-locked .card-meta {
  color: rgba(255, 255, 255, 0.62);
}

.letter-card.is-locked::before {
  border-color: rgba(255, 255, 255, 0.13);
}

.calendar-date {
  position: relative;
  z-index: 1;
  display: inline-flex;
  width: fit-content;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--rose-dark);
  font-size: 0.82rem;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.8);
}

.card-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 4px;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  line-height: 1.05;
}

.card-meta {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.lock-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--rose-dark);
  font-size: 0.78rem;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 24px rgba(126, 36, 67, 0.1);
}

.envelope {
  --env-width: 138px;
  --env-height: 96px;
  --env-paper: #ffd8e2;
  --env-paper-deep: #f189a0;
  --env-flap: #ffb5c7;
  --env-flap-deep: #ef6c86;
  --env-seal: #d84b68;
  --env-mark: #fff7fb;
  position: relative;
  z-index: 1;
  display: block;
  width: var(--env-width);
  height: var(--env-height);
  margin: auto;
  transform-style: preserve-3d;
  animation: envelopeFloat 5s ease-in-out infinite;
}

.envelope.large {
  --env-width: min(270px, 68vw);
  --env-height: min(186px, 47vw);
}

.modal-envelope {
  --env-width: 176px;
  --env-height: 122px;
  animation: envelopeOpen 1500ms ease forwards;
}

.envelope-shadow {
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: -18px;
  height: 22px;
  border-radius: 50%;
  background: rgba(92, 31, 54, 0.18);
  filter: blur(12px);
}

.body,
.flap,
.paper-preview {
  position: absolute;
  display: block;
}

.body {
  inset: 24% 0 0;
  z-index: 3;
  border-radius: 0 0 7px 7px;
  background:
    linear-gradient(135deg, transparent 0 49%, rgba(255, 255, 255, 0.24) 50%, transparent 51%),
    linear-gradient(225deg, transparent 0 49%, rgba(255, 255, 255, 0.2) 50%, transparent 51%),
    linear-gradient(180deg, var(--env-paper), var(--env-paper-deep));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.38),
    0 18px 36px rgba(126, 36, 67, 0.18);
}

.flap.back {
  inset: 0 0 32%;
  z-index: 1;
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
  background: linear-gradient(180deg, var(--env-flap), var(--env-flap-deep));
}

.flap.front {
  inset: 38% 0 0;
  z-index: 5;
  clip-path: polygon(0 100%, 50% 18%, 100% 100%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0)), var(--env-flap);
}

.flap.left,
.flap.right {
  inset: 24% 0 0;
  z-index: 4;
  background: linear-gradient(180deg, var(--env-flap), var(--env-paper-deep));
}

.flap.left {
  clip-path: polygon(0 0, 50% 50%, 0 100%);
}

.flap.right {
  clip-path: polygon(100% 0, 50% 50%, 100% 100%);
}

.paper-preview {
  left: 13%;
  right: 13%;
  top: 8%;
  z-index: 2;
  height: 64%;
  border-radius: 5px 5px 0 0;
  background:
    repeating-linear-gradient(0deg, transparent 0 16px, rgba(216, 75, 104, 0.12) 17px),
    linear-gradient(180deg, #fff, var(--env-mark));
  transform: translateY(6%);
  transition: transform 260ms ease;
}

.letter-card:hover .paper-preview,
.featured-envelope:hover .paper-preview {
  transform: translateY(-14%);
}

.paper-heart {
  position: absolute;
  top: 12%;
  left: 12%;
  width: 16%;
  aspect-ratio: 1;
  transform: rotate(45deg);
  background: var(--env-seal);
  border-radius: 3px;
}

.paper-heart::before,
.paper-heart::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
}

.paper-heart::before {
  left: -50%;
}

.paper-heart::after {
  top: -50%;
}

.paper-line {
  position: absolute;
  right: 12%;
  left: 36%;
  height: 7%;
  border-radius: 999px;
  background: rgba(216, 75, 104, 0.18);
}

.paper-line.short {
  top: 20%;
  right: 34%;
}

.paper-line:not(.short) {
  top: 38%;
}

.seal {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 49%;
  display: grid;
  width: 27%;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: clamp(0.68rem, 1.3vw, 0.82rem);
  font-weight: 950;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(circle at 32% 32%, rgba(255, 255, 255, 0.34), transparent 34%),
    var(--env-seal);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.26),
    0 10px 24px rgba(126, 36, 67, 0.24);
}

.art-birthday {
  --env-paper: #ffdbe5;
  --env-paper-deep: #f17892;
  --env-flap: #ffb9ca;
  --env-flap-deep: #ee6d87;
  --env-seal: #c83357;
  --env-mark: #fff8d9;
}

.art-birthday .body {
  background:
    radial-gradient(circle at 18% 26%, rgba(255, 215, 106, 0.7) 0 4%, transparent 4.5%),
    radial-gradient(circle at 76% 42%, rgba(255, 255, 255, 0.55) 0 5%, transparent 5.5%),
    linear-gradient(135deg, transparent 0 49%, rgba(255, 255, 255, 0.24) 50%, transparent 51%),
    linear-gradient(225deg, transparent 0 49%, rgba(255, 255, 255, 0.2) 50%, transparent 51%),
    linear-gradient(180deg, var(--env-paper), var(--env-paper-deep));
}

.art-stargaze {
  --env-paper: #d9f3ff;
  --env-paper-deep: #76c6df;
  --env-flap: #bfe9f8;
  --env-flap-deep: #6bb6cf;
  --env-seal: #e84f73;
  --env-mark: #f8fff8;
}

.art-picnic {
  --env-paper: #d8f2df;
  --env-paper-deep: #7ed3a6;
  --env-flap: #fff2ad;
  --env-flap-deep: #f1cf62;
  --env-seal: #e84f73;
  --env-mark: #ffffff;
}

.art-rain {
  --env-paper: #dfe9ff;
  --env-paper-deep: #a4bde8;
  --env-flap: #c8d9ff;
  --env-flap-deep: #8fa8db;
  --env-seal: #e84f73;
  --env-mark: #fff;
}

.art-keepsake {
  --env-paper: #ffe0d6;
  --env-paper-deep: #f49a82;
  --env-flap: #ffd2c4;
  --env-flap-deep: #ee8267;
  --env-seal: #b92e55;
  --env-mark: #fffdf8;
}

.art-sunrise {
  --env-paper: #fff0b8;
  --env-paper-deep: #f5c95c;
  --env-flap: #ffd8e2;
  --env-flap-deep: #f17892;
  --env-seal: #cf3f62;
  --env-mark: #f8fff8;
}

.art-placeholder {
  --env-paper: #56424c;
  --env-paper-deep: #2d2229;
  --env-flap: #6c5360;
  --env-flap-deep: #33262e;
  --env-seal: #8c7080;
  --env-mark: #20181d;
}

.art-placeholder .paper-heart,
.art-placeholder .paper-line {
  opacity: 0.34;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(61, 26, 42, 0.32);
  backdrop-filter: blur(12px);
}

.modal-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(180px, 270px) minmax(0, 1fr);
  gap: 24px;
  width: min(940px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: hidden;
  border: 1px solid rgba(184, 48, 84, 0.18);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.93), rgba(255, 246, 250, 0.93)),
    repeating-linear-gradient(0deg, transparent 0 35px, rgba(232, 79, 115, 0.08) 36px);
  box-shadow: var(--shadow);
  transform: translateY(12px) scale(0.98);
  transition: transform 260ms ease;
}

.modal.is-open .modal-card {
  transform: translateY(0) scale(1);
}

.close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 24px rgba(126, 36, 67, 0.12);
}

.close-button span {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 17px;
  height: 2px;
  border-radius: 999px;
  background: var(--rose-dark);
}

.close-button span:first-child {
  transform: translate(-50%, -50%) rotate(45deg);
}

.close-button span:last-child {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.modal-envelope-wrap {
  display: grid;
  min-height: 100%;
  place-items: center;
  padding: 42px 22px;
  background:
    linear-gradient(135deg, rgba(255, 216, 226, 0.8), rgba(204, 236, 247, 0.58)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.42) 0 10px, transparent 10px 20px);
}

.modal-content {
  min-height: 520px;
  max-height: min(760px, calc(100vh - 36px));
  min-width: 0;
  padding: clamp(28px, 4vw, 48px);
  overflow: auto;
}

.birthday-game {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  margin-top: 28px;
  padding: 18px;
  border: 1px solid rgba(184, 48, 84, 0.13);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 14px 34px rgba(126, 36, 67, 0.08);
}

.cake {
  position: relative;
  display: grid;
  height: 190px;
  place-items: end center;
}

.cake-top,
.cake-body,
.plate {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.cake-top {
  bottom: 66px;
  z-index: 3;
  width: 142px;
  height: 38px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 18% 50%, #fff 0 6px, transparent 7px),
    radial-gradient(circle at 48% 42%, #fff 0 5px, transparent 6px),
    radial-gradient(circle at 77% 52%, #fff 0 6px, transparent 7px),
    #ffdbe5;
  box-shadow: inset 0 -10px 0 rgba(232, 79, 115, 0.14);
}

.cake-body {
  bottom: 32px;
  z-index: 2;
  width: 136px;
  height: 62px;
  border-radius: 0 0 20px 20px;
  background:
    linear-gradient(90deg, transparent 0 13%, rgba(255, 255, 255, 0.46) 13% 18%, transparent 18% 42%, rgba(255, 255, 255, 0.42) 42% 47%, transparent 47% 72%, rgba(255, 255, 255, 0.36) 72% 77%, transparent 77%),
    linear-gradient(180deg, #ffafc2, #ec6682);
}

.plate {
  bottom: 20px;
  z-index: 1;
  width: 180px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 12px 26px rgba(126, 36, 67, 0.12);
}

.candle {
  position: absolute;
  bottom: 100px;
  z-index: 4;
  width: 18px;
  height: 62px;
  border: 0;
  border-radius: 6px;
  background:
    repeating-linear-gradient(135deg, #fff 0 7px, #ffd76a 7px 13px),
    #fff;
  box-shadow: inset 0 -6px 0 rgba(126, 36, 67, 0.08);
}

.candle:nth-child(1) {
  left: calc(50% - 52px);
}

.candle:nth-child(2) {
  left: calc(50% - 9px);
}

.candle:nth-child(3) {
  left: calc(50% + 34px);
}

.wick {
  position: absolute;
  top: -7px;
  left: 50%;
  width: 2px;
  height: 10px;
  border-radius: 999px;
  background: #55313f;
  transform: translateX(-50%);
}

.flame {
  position: absolute;
  left: 50%;
  top: -34px;
  width: 20px;
  height: 28px;
  border-radius: 50% 50% 45% 45%;
  opacity: 0;
  transform: translateX(-50%) rotate(45deg) scale(0.6);
  transform-origin: center bottom;
  background:
    radial-gradient(circle at 58% 68%, #fff7aa 0 22%, transparent 23%),
    linear-gradient(135deg, #ffd76a, #ff8a56);
  filter: drop-shadow(0 0 12px rgba(255, 215, 106, 0.7));
  transition:
    opacity 180ms ease,
    transform 220ms ease;
}

.candle.is-lit .flame {
  opacity: 1;
  transform: translateX(-50%) rotate(45deg) scale(1);
  animation: flicker 850ms ease-in-out infinite alternate;
}

.game-copy p {
  color: var(--muted);
  line-height: 1.6;
}

.letter-paper {
  margin-top: 28px;
  min-width: 0;
  padding: clamp(24px, 4vw, 44px);
  border: 1px solid rgba(184, 48, 84, 0.13);
  border-radius: var(--radius);
  color: #3d2330;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 253, 248, 0.96)),
    repeating-linear-gradient(0deg, transparent 0 34px, rgba(232, 79, 115, 0.09) 35px);
  box-shadow: 0 18px 42px rgba(126, 36, 67, 0.12);
  animation: paperIn 560ms ease both;
}

.letter-date {
  display: inline-flex;
  margin-bottom: 18px;
  min-height: 32px;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--rose-dark);
  font-size: 0.82rem;
  font-weight: 900;
  background: var(--rose-soft);
}

.reader-controls {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
  padding: 12px;
  border: 1px solid rgba(184, 48, 84, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 247, 251, 0.82);
}

.reader-progress {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(184, 48, 84, 0.12);
}

.reader-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rose), var(--gold));
  transition: width 120ms ease;
}

.reader-status {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}

.letter-paper p {
  color: #422231;
  font-family: var(--font-serif);
  font-size: clamp(1.12rem, 2vw, 1.34rem);
  font-weight: 600;
  line-height: 1.75;
  overflow-wrap: break-word;
}

.letter-word {
  border-radius: 0.3em;
  overflow-wrap: anywhere;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition:
    background 120ms ease,
    color 120ms ease,
    box-shadow 120ms ease,
    opacity 120ms ease;
}

.letter-word.is-read {
  color: #7d596a;
}

.letter-word.is-active {
  color: #3d2330;
  background: linear-gradient(180deg, rgba(255, 241, 184, 0.2), rgba(255, 215, 106, 0.7));
  box-shadow: 0 0 0 0.16em rgba(255, 215, 106, 0.34);
}

.letter-paper p:last-child {
  margin-bottom: 0;
}

.keepsakes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.keepsake {
  min-height: 36px;
  border: 1px solid rgba(184, 48, 84, 0.15);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--rose-dark);
  font-weight: 850;
  background: #fff7fb;
  transition:
    background 180ms ease,
    transform 180ms ease;
}

.keepsake.is-found {
  color: #68420f;
  background: #fff1b8;
  transform: translateY(-2px);
}

.spark {
  position: fixed;
  z-index: 30;
  width: 10px;
  height: 10px;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(45deg);
  background: var(--spark-color, #ffd76a);
  animation: sparkFly 760ms ease-out forwards;
}

.spark::before,
.spark::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
}

.spark::before {
  left: -50%;
}

.spark::after {
  top: -50%;
}

.confetti-piece {
  position: fixed;
  top: -24px;
  z-index: 40;
  width: var(--confetti-size);
  height: calc(var(--confetti-size) * 1.45);
  pointer-events: none;
  border-radius: 3px;
  background: var(--confetti-color);
  animation: confettiFall 2.7s cubic-bezier(0.2, 0.72, 0.35, 1) var(--confetti-delay) forwards;
}

.confetti-piece.shape-1 {
  border-radius: 50%;
}

.confetti-piece.shape-2 {
  height: var(--confetti-size);
  transform: rotate(45deg);
}

@keyframes envelopeFloat {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-8px) rotate(1deg);
  }
}

@keyframes envelopeOpen {
  0% {
    transform: translateY(0) rotate(-1deg);
  }
  55% {
    transform: translateY(-9px) rotate(1deg);
  }
  100% {
    transform: translateY(-4px) rotate(0);
  }
}

@keyframes orbit {
  to {
    transform: rotate(360deg);
  }
}

@keyframes flicker {
  from {
    transform: translateX(-50%) rotate(42deg) scale(0.94);
  }
  to {
    transform: translateX(-50%) rotate(48deg) scale(1.05);
  }
}

@keyframes paperIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sparkFly {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(45deg) scale(0.9);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--spark-x)), calc(-50% + var(--spark-y))) rotate(135deg) scale(0.2);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  50% {
    transform: translateX(5px);
  }
  75% {
    transform: translateX(-3px);
  }
}

@keyframes confettiFall {
  0% {
    opacity: 1;
    transform: translate3d(0, -24px, 0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--confetti-drift), 110vh, 0) rotate(var(--confetti-spin));
  }
}

@media (max-width: 920px) {
  .hero-grid,
  .mailbox-layout,
  .modal-card {
    grid-template-columns: 1fr;
  }

  .hero-stage {
    min-height: 420px;
  }

  .letter-details {
    position: relative;
    top: auto;
    min-height: 0;
  }

  .calendar-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal-envelope-wrap {
    min-height: 230px;
  }

  .modal-content {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(1180px, calc(100% - 22px));
    max-width: calc(100vw - 22px);
  }

  .hero {
    padding-top: 14px;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: start;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    max-width: calc(100vw - 22px);
    overflow: visible;
  }

  .brand span:last-child {
    display: none;
  }

  .hero-grid {
    min-height: auto;
    padding-top: 42px;
  }

  h1 {
    font-size: clamp(2.65rem, 13vw, 3.45rem);
    line-height: 0.96;
  }

  .status-pill {
    max-width: 100%;
    padding-inline: 10px;
    font-size: 0.86rem;
  }

  .status-pill span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hero-stage {
    min-height: 350px;
  }

  .featured-envelope {
    padding-inline: 0;
  }

  .calendar-board {
    grid-template-columns: 1fr;
  }

  .letter-card {
    min-height: 230px;
  }

  .birthday-game {
    grid-template-columns: 1fr;
  }

  .reader-controls {
    grid-template-columns: 1fr;
  }

  .reader-status {
    white-space: normal;
  }

  .modal {
    padding: 10px;
    align-items: start;
    justify-items: start;
  }

  .modal-card {
    width: min(370px, calc(100vw - 20px));
    max-height: calc(100vh - 20px);
    gap: 0;
  }

  .modal-envelope-wrap {
    min-height: 210px;
    padding: 34px 16px;
  }

  .modal-content {
    width: 100%;
    overflow-x: hidden;
    padding: 24px 18px 28px;
  }

  .modal-content h2 {
    font-size: clamp(2rem, 11vw, 2.8rem);
  }

  .modal-content > p {
    overflow-wrap: break-word;
  }

  .letter-paper {
    padding: 20px 14px 26px;
  }

  .reader-controls {
    overflow: hidden;
  }
}

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