:root {
  --bg: #fbf3f6;
  --card: #fffaf9;
  --ink: #4a3242;
  --muted: #8d6b7d;
  --rose: #d98fa3;
  --rose-soft: #f3cdd9;
  --lavender: #b6a1d1;
  --lavender-soft: #e7ddf4;
  --gold: #d9b877;
  --serif: "Fraunces", Georgia, serif;
  --hand: "Caveat", cursive;
  --sans: "Karla", -apple-system, sans-serif;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.75;
  overflow-x: hidden;
  min-height: 100vh;
  transition: background-color 0.9s ease, color 0.9s ease;
}
body.night-mode {
  --bg: #0e111b;
  --card: #1b1e2a;
  --ink: #eadfd4;
  --muted: #aa9eaa;
  --rose: #c47f99;
  --rose-soft: #493343;
  --lavender: #8f88b5;
  --lavender-soft: #292a43;
  --gold: #e2c581;
}
body.night-mode .blob {
  opacity: 0.18;
}
body.night-mode #vignette {
  box-shadow: inset 0 0 170px rgba(0, 0, 0, 0.52);
}
.night-stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
}
body.night-mode .night-stars {
  opacity: 1;
}
.night-star {
  position: absolute;
  border-radius: 50%;
  background: #fff4cb;
  box-shadow: 0 0 6px 1px rgba(255, 238, 180, 0.72);
  animation: night-star-twinkle ease-in-out infinite;
}
@keyframes night-star-twinkle {
  0%,
  100% {
    opacity: 0.18;
    transform: scale(0.65);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.35);
  }
}
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
  z-index: 0;
  pointer-events: none;
  animation: drift 24s ease-in-out infinite;
}
.blob-a {
  width: 340px;
  height: 340px;
  background: var(--rose-soft);
  top: -90px;
  left: -90px;
}
.blob-b {
  width: 300px;
  height: 300px;
  background: var(--lavender-soft);
  bottom: 0;
  right: -110px;
  animation-delay: -9s;
}
@keyframes drift {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(18px, -22px) scale(1.06);
  }
}
#vignette {
  position: fixed;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  box-shadow: inset 0 0 140px rgba(74, 50, 66, 0.18);
}
#gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}
#gate.hidden {
  display: none;
}
#gate.opening {
  animation: gate-fade 0.42s ease forwards;
  pointer-events: none;
}
.access-panel {
  width: min(88vw, 390px);
  text-align: center;
  background: rgba(255, 250, 249, 0.8);
  border: 1px solid rgba(182, 161, 209, 0.34);
  border-radius: 16px;
  padding: 42px 32px 30px;
  box-shadow: 0 24px 60px rgba(74, 50, 66, 0.12);
  backdrop-filter: blur(8px);
}
.access-mark {
  color: var(--lavender);
  font-size: 2.1rem;
  line-height: 1;
  margin-bottom: 18px;
}
.access-kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.access-panel h2 {
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 500;
  margin: 0 0 8px;
}
.access-panel > p:not(.access-kicker) {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 0.85rem;
}
#nameInput {
  width: 100%;
  font-family: var(--sans);
  font-size: 0.95rem;
  padding: 11px 14px;
  border: 1px solid var(--rose-soft);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
#codeInput {
  width: 100%;
  font-family: var(--sans);
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  padding: 11px 14px;
  margin-top: 10px;
  border: 1px solid var(--rose-soft);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
#codeInput:focus {
  border-color: var(--rose);
}
.hidden-input {
  display: none;
}
.verified-letter.hidden-input {
  display: none;
}
.access-panel.verified > :not(.verified-letter) {
  display: none;
}
.access-panel.verified {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}
.verified-letter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  position: relative;
  overflow: hidden;
  width: min(88vw, 340px);
  min-height: 250px;
  margin: 0 auto;
  padding: 126px 20px 28px;
  border: 1px solid var(--rose-soft);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: 0 18px 40px rgba(139, 90, 110, 0.16);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.verified-letter::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  right: 0;
  height: 92px;
  background: var(--rose-soft);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.verified-letter::after {
  content: "?";
  position: absolute;
  z-index: 2;
  top: 58px;
  left: 50%;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--rose);
  color: #fff;
  font-family: var(--serif);
  font-size: 1.35rem;
  line-height: 48px;
  text-align: center;
  transform: translateX(-50%);
  box-shadow: 0 5px 12px rgba(217, 143, 163, 0.45);
}
.verified-letter:hover,
.verified-letter:focus-visible {
  transform: translateY(-4px) rotate(-1deg);
  box-shadow: 0 16px 28px rgba(139, 90, 110, 0.2);
  outline: none;
}
.verified-letter.opening {
  animation: letter-lift 0.85s cubic-bezier(0.22, 0.8, 0.3, 1) forwards;
  pointer-events: none;
}
.verified-letter.opening::before {
  transform: rotateX(178deg);
  transform-origin: top center;
  transition: transform 0.8s cubic-bezier(0.22, 0.8, 0.3, 1);
}
.verified-letter.opening::after {
  opacity: 0;
  transform: translateX(-50%) translateY(-12px) scale(0.7);
  transition: opacity 0.35s ease, transform 0.45s ease;
}
.verified-letter.opening .letter-icon,
.verified-letter.opening > span:not(.letter-icon),
.verified-letter.opening small {
  opacity: 0;
  transition: opacity 0.3s ease;
}
.letter-icon {
  color: var(--rose);
  font-size: 1.7rem;
  line-height: 1;
  opacity: 0.9;
}
.verified-letter small {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
@keyframes letter-opening {
  from {
    transform: translateY(0) rotate(-1deg);
  }
  to {
    transform: translateY(-5px) rotate(1deg);
  }
}
@keyframes letter-lift {
  0% {
    transform: translateY(0) rotate(0);
    box-shadow: 0 18px 40px rgba(139, 90, 110, 0.16);
  }
  55% {
    transform: translateY(-12px) rotate(-1deg) scale(1.015);
    box-shadow: 0 30px 52px rgba(139, 90, 110, 0.24);
  }
  100% {
    transform: translateY(-4px) rotate(0) scale(0.98);
    box-shadow: 0 12px 28px rgba(139, 90, 110, 0.08);
  }
}
@keyframes gate-fade {
  to {
    opacity: 0;
    transform: scale(1.025);
  }
}
#nameInput:focus {
  border-color: var(--rose);
}
#openBtn {
  margin-top: 12px;
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 8px;
  background: var(--rose);
  color: #fff;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
}
#openBtn:disabled {
  opacity: 0.6;
  cursor: default;
}
#gateMsg {
  min-height: 18px;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 10px;
}
#gateMsg.error {
  color: #c0546a;
}
main {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
  padding: 9vh 24px 16vh;
  opacity: 0;
  transition: opacity 1s ease;
  display: none;
}
main.show {
  opacity: 1;
  display: block;
}
.moon-ray {
  position: fixed;
  z-index: 0;
  top: 56px;
  right: -8vw;
  width: 76vw;
  height: 86vh;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    145deg,
    rgba(255, 250, 230, 0.3) 0%,
    rgba(246, 226, 200, 0.15) 32%,
    rgba(217, 184, 119, 0.04) 62%,
    transparent 82%
  );
  clip-path: polygon(42% 0, 100% 0, 76% 100%, 4% 100%);
  filter: blur(12px);
  mix-blend-mode: screen;
}
main.show .moon-ray {
  animation: moon-ray-reveal 1.8s 0.45s ease-out forwards,
    moon-ray-pulse 7s 2.3s ease-in-out infinite;
}
@keyframes moon-ray-reveal {
  from {
    opacity: 0;
    transform: translate(35px, -20px) scale(0.9);
  }
  to {
    opacity: 0.72;
    transform: translate(0, 0) scale(1);
  }
}
@keyframes moon-ray-pulse {
  0%,
  100% {
    opacity: 0.58;
  }
  50% {
    opacity: 0.82;
  }
}
.hero {
  text-align: center;
  padding-bottom: 7vh;
  position: relative;
}
.hero .kicker {
  font-family: var(--hand);
  font-size: 1.4rem;
  color: var(--rose);
  margin-bottom: 6px;
}
.hero h1 span {
  display: inline-block;
  opacity: 0;
  transform: translateY(6px);
  animation: ink 0.5s ease forwards;
}
@keyframes ink {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.hero h1 {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2.3rem, 9vw, 3.4rem);
  margin: 0 0 10px;
}
.postmark {
  position: absolute;
  top: 6px;
  right: 4%;
  width: 74px;
  height: 74px;
  border: 2px dashed var(--muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transform: rotate(-8deg);
  opacity: 0.75;
}
.postmark span {
  font-family: var(--sans);
  font-size: 0.58rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
}
.postmark .big {
  font-family: var(--hand);
  font-size: 1rem;
  color: var(--rose);
}
.tape {
  position: absolute;
  height: 26px;
  width: 90px;
  background: repeating-linear-gradient(
    45deg,
    var(--rose-soft),
    var(--rose-soft) 6px,
    #f7e0e7 6px,
    #f7e0e7 12px
  );
  opacity: 0.85;
}
.torn {
  width: 100%;
  height: 14px;
  margin: -1px 0 18px;
  overflow: hidden;
}
.torn svg {
  width: 100%;
  height: 100%;
  display: block;
}
.thread {
  position: relative;
  padding-left: 26px;
  border-left: 1px solid rgba(182, 161, 209, 0.35);
}
section.moment {
  position: relative;
  margin-bottom: 7vh;
  opacity: 0;
  transform: translateY(18px) rotate(0.7deg);
  transition:
    opacity 0.8s ease,
    transform 0.8s ease;
  background: var(--card);
  border: 1px solid rgba(139, 90, 110, 0.16);
  border-radius: 4px 14px 14px 14px;
  padding: 22px 22px 6px;
  box-shadow: 0 10px 24px rgba(139, 90, 110, 0.07);
  background-image:
    repeating-linear-gradient(
      rgba(139, 90, 110, 0.035) 0 1px,
      transparent 1px 28px
    ),
    radial-gradient(ellipse at 88% 8%, rgba(180, 140, 90, 0.1), transparent 55%);
  transition:
    opacity 0.8s ease,
    transform 0.8s ease,
    box-shadow 1.4s ease;
  overflow: hidden;
}
.moonbeam {
  position: absolute;
  z-index: 0;
  top: -105px;
  right: -92px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(246, 226, 200, 0.32) 0,
    rgba(217, 184, 119, 0.12) 34%,
    transparent 70%
  );
  pointer-events: none;
  opacity: var(--moon-glow, 0);
  transform: translate(
      calc((1 - var(--moon-glow, 0)) * 18px),
      calc((1 - var(--moon-glow, 0)) * -12px)
    )
    scale(calc(0.82 + var(--moon-glow, 0) * 0.22));
  transition:
    opacity 0.35s ease-out,
    transform 0.35s ease-out;
}
.moment p,
.moment time,
.moment .sign {
  position: relative;
  z-index: 1;
}
section.moment p {
  text-shadow: 0 0 16px rgba(246, 226, 200, 0.14);
}
body.night-mode section.moment {
  border-color: rgba(217, 184, 119, calc(0.08 + var(--moon-glow, 0) * 0.3));
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.28),
    inset 0 0 48px rgba(0, 0, 0, calc(0.2 - var(--moon-glow, 0) * 0.12)),
    0 0 30px rgba(217, 184, 119, calc(var(--moon-glow, 0) * 0.1));
}
body.night-mode section.moment p {
  color: rgba(234, 223, 212, calc(0.28 + var(--moon-glow, 0) * 0.62));
  text-shadow: 0 0 calc(4px + var(--moon-glow, 0) * 16px)
    rgba(255, 239, 194, calc(var(--moon-glow, 0) * 0.3));
}
body.night-mode section.moment time,
body.night-mode section.moment .sign {
  color: rgba(234, 223, 212, calc(0.36 + var(--moon-glow, 0) * 0.58));
}
@keyframes moonbeam-breathe {
  0%,
  100% {
    opacity: 0.72;
  }
  50% {
    opacity: 1;
  }
}
section.moment.visible {
  opacity: 1;
  transform: translateY(0) rotate(0);
}
section.moment:nth-of-type(even) {
  transform: translateY(18px) rotate(-0.7deg);
}
section.moment:nth-of-type(even).visible {
  transform: translateY(0) rotate(0);
}
section.moment::before {
  content: "";
  position: absolute;
  left: -31px;
  top: 26px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--rose);
}
section.moment:nth-of-type(even)::before {
  background: var(--lavender);
}
section.moment.dogear::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 34px;
  height: 34px;
  background:
    linear-gradient(135deg, transparent 50%, var(--bg) 50%),
    linear-gradient(315deg, rgba(139, 90, 110, 0.18), transparent 60%);
  box-shadow: -3px 3px 6px rgba(139, 90, 110, 0.18);
  border-radius: 0 4px 0 8px;
}
section.moment:not(.dogear)::after {
  content: "";
  position: absolute;
  top: -7px;
  left: 26px;
  width: 58px;
  height: 16px;
  background: repeating-linear-gradient(
    135deg,
    rgba(243, 205, 217, 0.82) 0 6px,
    rgba(247, 224, 231, 0.82) 6px 12px
  );
  border: 1px solid rgba(217, 143, 163, 0.2);
  transform: rotate(-4deg);
  opacity: 0.82;
}
.paper-stamp {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 4px 7px;
  border: 1px dashed rgba(139, 90, 110, 0.42);
  border-radius: 50%;
  color: rgba(139, 90, 110, 0.62);
  font-family: var(--sans);
  font-size: 0.52rem;
  letter-spacing: 0.08em;
  transform: rotate(8deg);
}
.paper-doodle {
  position: absolute;
  right: 20px;
  bottom: 18px;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(217, 143, 163, 0.58);
  border-radius: 70% 20% 70% 20%;
  transform: rotate(28deg);
  opacity: 0.75;
}
.paper-doodle::after {
  content: "";
  position: absolute;
  left: 11px;
  top: -4px;
  width: 1px;
  height: 32px;
  background: rgba(217, 143, 163, 0.58);
  transform: rotate(-28deg);
}
.scroll-doodle {
  position: absolute;
  top: 50%;
  right: 16px;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(182, 161, 209, 0.7);
  border-radius: 50% 45% 50% 40%;
  opacity: 0;
  transform: translateY(8px) rotate(-18deg) scale(0.55);
  transition:
    opacity 0.7s ease 0.35s,
    transform 0.7s ease 0.35s;
}
.scroll-doodle::before,
.scroll-doodle::after {
  content: "";
  position: absolute;
  background: rgba(182, 161, 209, 0.7);
}
.scroll-doodle::before {
  left: 8px;
  top: -5px;
  width: 1px;
  height: 28px;
  transform: rotate(-28deg);
}
.scroll-doodle::after {
  left: -4px;
  top: 8px;
  width: 26px;
  height: 1px;
  transform: rotate(26deg);
}
section.moment.visible .scroll-doodle {
  opacity: 0.72;
  transform: translateY(0) rotate(18deg) scale(1);
}
.inkspot {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(120, 80, 60, 0.1), transparent 70%);
  pointer-events: none;
}
.stain {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(
    circle,
    transparent 55%,
    rgba(120, 80, 40, 0.16) 58%,
    rgba(120, 80, 40, 0.05) 66%,
    transparent 70%
  );
}
.moment time {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 10px;
  background: var(--lavender-soft);
  padding: 3px 10px;
  border-radius: 10px;
}
.moment p {
  font-family: var(--serif);
  font-size: 1.06rem;
  color: var(--ink);
  margin: 0 0 16px;
  max-width: 62ch;
}
.moment p:last-child {
  margin-bottom: 0;
}
.greeting {
  font-family: var(--hand);
  font-size: 1.7rem;
  color: var(--ink);
  text-align: center;
  margin: 0 0 8px;
}
.uline {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='60' height='10'><path d='M0 6 Q7 1 14 6 T28 6 T42 6 T56 6' stroke='%23d98fa3' stroke-width='2' fill='none'/></svg>");
  background-repeat: repeat-x;
  background-position: 0 100%;
  background-size: 28px 9px;
  padding-bottom: 2px;
}
.moment.visible .uline {
  animation: ink-highlight 0.8s ease-out 0.45s both;
  background-size: 0 9px;
}
@keyframes ink-highlight {
  from {
    background-size: 0 9px;
  }
  to {
    background-size: 28px 9px;
  }
}
.ch {
  opacity: 0;
}
.ch.seen {
  opacity: 1;
  transition: opacity 0.04s linear;
}
.closing {
  text-align: center;
  margin-top: 8vh;
  padding-left: 0;
  border: none;
}
.closing .sign {
  font-family: var(--hand);
  font-size: 2.2rem;
  margin-top: 20px;
  color: var(--rose);
}
#pen-cursor {
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  z-index: 25;
  opacity: 0;
  visibility: visible;
  will-change: transform;
  transition: opacity 0.2s;
}
#pen-cursor::after {
  content: "";
  position: absolute;
  left: 1px;
  top: 21px;
  width: 13px;
  height: 2px;
  border-radius: 50%;
  background: var(--rose);
  opacity: 0;
  transform: rotate(-38deg) scaleX(0.4);
  transform-origin: right center;
}
#pen-cursor.active {
  opacity: 1;
}
#pen-cursor.active::after {
  animation: ink-stroke 0.24s ease-out infinite;
}
#pen-cursor svg {
  width: 22px;
  height: 22px;
}
#pen-cursor.active svg {
  animation: pen-writing 0.24s ease-in-out infinite;
  transform-origin: 4px 20px;
  filter: drop-shadow(1px 2px 1px rgba(74, 50, 66, 0.16));
}
@keyframes pen-writing {
  0% {
    transform: translate(-2px, 2px) rotate(-8deg);
  }
  35% {
    transform: translate(2px, -2px) rotate(6deg);
  }
  65% {
    transform: translate(-1px, 2px) rotate(-4deg);
  }
  100% {
    transform: translate(2px, -1px) rotate(8deg);
  }
}
@keyframes ink-stroke {
  0%,
  100% {
    opacity: 0.2;
    transform: rotate(-38deg) scaleX(0.35);
  }
  50% {
    opacity: 0.75;
    transform: rotate(-38deg) scaleX(1);
  }
}
#pen-cursor.active.lifting svg {
  animation: pen-lift 0.22s ease-out forwards;
}
@keyframes pen-lift {
  0% {
    transform: translate(0, 0) rotate(0);
  }
  45% {
    transform: translate(0, -8px) rotate(-10deg);
  }
  100% {
    transform: translate(2px, -2px) rotate(5deg);
  }
}
.skip-typing {
  position: fixed;
  left: 50%;
  bottom: 86px;
  z-index: 26;
  border: 1px solid rgba(217, 143, 163, 0.42);
  border-radius: 20px;
  padding: 6px 14px;
  background: rgba(255, 250, 249, 0.92);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.68rem;
  transform: translateX(-50%);
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(139, 90, 110, 0.12);
  animation: skip-enter 0.25s ease-out;
}
.skip-typing:hover,
.skip-typing:focus-visible {
  border-color: var(--rose);
  color: var(--ink);
  outline: none;
}
@keyframes skip-enter {
  from {
    opacity: 0;
    transform: translate(-50%, 6px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
#player {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--rose-soft);
  border-radius: 40px;
  padding: 9px 18px 9px 9px;
  box-shadow: 0 10px 28px rgba(139, 90, 110, 0.2);
  max-width: 90vw;
  display: none;
}
#player.playing {
  animation: player-glow 2.4s ease-in-out infinite;
}
#playBtn {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  border: none;
  background: var(--rose);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#playBtn:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(217, 143, 163, 0.38);
}
#player.playing #playBtn {
  animation: play-pulse 1.2s ease-in-out infinite;
}
#trackInfo {
  font-family: var(--sans);
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}
#trackInfo b {
  display: block;
  color: var(--ink);
  font-size: 0.78rem;
}
.eq {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
}
.eq span {
  width: 3px;
  background: var(--rose);
  border-radius: 2px;
  height: 4px;
  animation: eq 1s ease-in-out infinite;
  animation-play-state: paused;
}
.eq span:nth-child(2) {
  animation-delay: 0.15s;
}
.eq span:nth-child(3) {
  animation-delay: 0.3s;
}
.eq span:nth-child(4) {
  animation-delay: 0.45s;
}
#player.playing .eq span {
  animation-play-state: running;
}
@keyframes eq {
  0%,
  100% {
    height: 4px;
  }
  50% {
    height: 15px;
  }
}
@keyframes play-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(217, 143, 163, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(217, 143, 163, 0);
  }
}
@keyframes player-glow {
  0%,
  100% {
    box-shadow: 0 10px 28px rgba(139, 90, 110, 0.2);
  }
  50% {
    box-shadow: 0 10px 30px rgba(139, 90, 110, 0.28);
  }
}
.outro p {
  font-family: var(--hand);
  font-size: 1.3rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.author-initial {
  color: var(--rose);
  font-family: var(--hand);
  font-size: 2.4rem;
  line-height: 1;
  transform: rotate(-8deg);
  opacity: 0.9;
}
@media (max-width: 480px) {
  main {
    padding: 7vh 16px 14vh;
  }
  .hero h1 {
    font-size: clamp(2rem, 11vw, 2.6rem);
  }
  section.moment {
    padding: 18px 16px 4px;
  }
  .moment p {
    font-size: 0.96rem;
    max-width: 100%;
  }
  .postmark {
    width: 58px;
    height: 58px;
  }
  .thread {
    padding-left: 20px;
  }
  section.moment::before {
    left: -25px;
  }
}

@media (max-width: 600px) {
  .moon-ray {
    display: none;
  }
  .blob {
    filter: blur(36px);
  }
  .petal {
    animation-duration: 20s;
  }
  .firefly {
    animation-duration: 6s, 14s;
  }
  .moon-halo {
    animation-duration: 8s;
  }
}

/* ================= pernak-pernik tambahan ================= */

/* bunga jatuh */
.petals {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.petal {
  position: absolute;
  top: -5%;
  border-radius: 60% 0 60% 0;
  opacity: 0.55;
  animation: fall linear infinite;
}
@keyframes fall {
  to {
    transform: translateY(112vh) rotate(300deg);
  }
}

/* kunang-kunang */
.firefly {
  position: fixed;
  border-radius: 50%;
  background: var(--gold);
  z-index: 1;
  pointer-events: none;
  box-shadow: 0 0 8px 2px rgba(217, 184, 119, 0.7);
  animation:
    flicker 4s ease-in-out infinite,
    floaty 10s ease-in-out infinite;
}
@keyframes flicker {
  0%,
  100% {
    opacity: 0.15;
  }
  50% {
    opacity: 0.85;
  }
}
@keyframes floaty {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(14px, -24px);
  }
}

/* pita progress scroll di tepi kiri */
#ribbon-track {
  position: fixed;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: rgba(182, 161, 209, 0.18);
  z-index: 16;
}
#ribbon-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: linear-gradient(var(--rose), var(--lavender));
  border-radius: 0 3px 3px 0;
  transition: height 0.05s linear;
}

/* pita/bow dekoratif di atas judul */
.bow {
  width: 64px;
  margin: 0 auto 6px;
  opacity: 0.85;
}

/* amplop menutup lagi di akhir surat */
#outro {
  text-align: center;
  padding: 6vh 0 2vh;
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.9s ease,
    transform 0.9s ease;
}
#outro.visible {
  opacity: 1;
  transform: translateY(0);
}
.envelope-close {
  width: 110px;
  height: 74px;
  margin: 0 auto 16px;
  position: relative;
  background: var(--card);
  border: 1px solid var(--rose-soft);
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(139, 90, 110, 0.15);
  overflow: hidden;
}
.envelope-close::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  border-left: 55px solid transparent;
  border-right: 55px solid transparent;
  border-top: 38px solid var(--rose-soft);
  transform-origin: top center;
  animation: flapclose 1.4s ease forwards;
  animation-play-state: paused;
}
#outro.visible .envelope-close::before {
  animation-play-state: running;
}
@keyframes flapclose {
  0% {
    transform: rotateX(180deg);
  }
  100% {
    transform: rotateX(0deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .blob,
  .petal,
  .firefly {
    animation: none;
  }
}

/* ================= pernak-pernik bulan (Wulan â†’ Bulan) ================= */

.moon-wrap {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 18px);
  right: 22px;
  z-index: 2;
  width: 78px;
  height: 78px;
  pointer-events: auto;
  opacity: 0.96;
  border: 1px solid rgba(217, 184, 119, 0.24);
  border-radius: 50%;
  background: rgba(255, 250, 240, 0.22);
  backdrop-filter: blur(4px);
  filter: drop-shadow(0 8px 14px rgba(139, 108, 76, 0.1));
  cursor: pointer;
  transition: filter 0.8s ease, transform 0.8s ease, background 0.8s ease;
}
.moon-wrap::marker {
  display: none;
}
.moon-wrap:hover,
.moon-wrap:focus-visible {
  transform: scale(1.08);
}
.moon-wrap:hover::before,
.moon-wrap:focus-visible::before {
  animation: moon-click-ring 1.2s ease-in-out infinite;
}
.moon-wrap:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 6px;
  border-radius: 50%;
}
body.night-mode .moon-wrap {
  filter: drop-shadow(0 0 22px rgba(255, 236, 183, 0.5));
  transform: scale(1.06);
  background: rgba(255, 239, 194, 0.08);
  border-color: rgba(255, 239, 194, 0.42);
}
.moon-hint {
  position: absolute;
  top: 82px;
  right: -8px;
  width: 82px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  text-align: center;
  white-space: nowrap;
  opacity: 0.76;
  transition: color 0.5s ease, opacity 0.5s ease;
}
body.night-mode .moon-hint {
  display: none;
}
@keyframes moon-click-ring {
  0%,
  100% {
    opacity: 0.28;
    transform: rotate(-24deg) scaleX(1.16) scale(1);
  }
  50% {
    opacity: 0.82;
    transform: rotate(-24deg) scaleX(1.16) scale(1.12);
  }
}
.moon-wrap::before {
  content: "";
  position: absolute;
  inset: 1px;
  border: 1px solid rgba(217, 184, 119, 0.28);
  border-radius: 50%;
  transform: rotate(-24deg) scaleX(1.16);
  box-shadow: 0 0 12px rgba(217, 184, 119, 0.12);
}
.moon-wrap::after {
  content: "✦";
  position: absolute;
  top: -5px;
  left: 5px;
  color: var(--gold);
  font-size: 0.75rem;
  opacity: 0.72;
  animation: moonSpark 3.2s ease-in-out infinite;
}

.moon {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(
    circle at 35% 30%,
    #fffaf0,
    #f3ecd3 48%,
    #d9c79a 82%,
    #bda878 100%
  );
  box-shadow:
    0 0 22px 6px rgba(255, 250, 230, 0.55),
    0 0 55px 16px rgba(217, 184, 119, 0.3),
    inset -7px -7px 12px rgba(120, 100, 60, 0.2);
  animation:
    moonFloat 9s ease-in-out infinite,
    moonGlowPulse 5s ease-in-out infinite;
}
@keyframes moonGlowPulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.18);
  }
}

/* halo cahaya tambahan di belakang bulan */
.moon-halo {
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 250, 230, 0.38), transparent 72%);
  filter: blur(7px);
  pointer-events: none;
  animation: haloPulse 5s ease-in-out infinite;
}
@keyframes haloPulse {
  0%,
  100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.14);
  }
}
.moon::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 24% 64%, rgba(120, 100, 60, 0.11) 0 7%, transparent 8%),
    radial-gradient(circle at 70% 24%, rgba(120, 100, 60, 0.09) 0 9%, transparent 10%),
    radial-gradient(circle at 54% 74%, rgba(255, 250, 240, 0.3) 0 8%, transparent 9%);
  mix-blend-mode: multiply;
}
@keyframes moonFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(6px) rotate(2deg);
  }
}
@keyframes moonSpark {
  0%,
  100% {
    opacity: 0.32;
    transform: scale(0.8) rotate(0);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.25) rotate(18deg);
  }
}

/* penutup fase bulan: bergeser sesuai progres scroll (sabit -> purnama) */
.moon-shadow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--bg);
  transform: translateX(0%);
  transition: transform 0.25s ease-out;
}

.moon-crater {
  position: absolute;
  border-radius: 50%;
  background: rgba(120, 100, 60, 0.16);
  box-shadow: inset 1px 1px 2px rgba(255, 250, 240, 0.24);
}

.moon-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.star {
  position: absolute;
  width: 3px;
  height: 3px;
  background: #fffaf0;
  border-radius: 50%;
  opacity: 0.2;
  box-shadow: 0 0 5px 1px rgba(255, 250, 240, 0.75);
  animation: starTwinkle 3s ease-in-out infinite;
}
@keyframes starTwinkle {
  0%,
  100% {
    opacity: 0.15;
    transform: scale(1);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.4);
  }
}

@media (max-width: 480px) {
  .moon-wrap {
    width: 60px;
    height: 60px;
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    right: 14px;
  }
  .moon {
    width: 46px;
    height: 46px;
    top: 8px;
    right: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .moon {
    animation: none;
  }
  .star {
    animation: none;
  }
}