:root {
  --ink: #030820;
  --deep: #0b1a52;
  --glow: #9dbcff;
  --moon: #eef3ff;
  --rose: #ffa9cf;
}
html,
body {
  overflow-x: hidden;
  max-width: 100%;
}
html {
  scrollbar-gutter: stable;
}
body {
  margin: 0;
  color: var(--moon);
  font-family: "Cormorant Garamond", serif;
  font-size: 1.2rem;
  line-height: 1.65;
  background: var(--ink);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 20% 10%, #14286e55, transparent 55%),
    radial-gradient(ellipse at 85% 60%, #2a1a6a44, transparent 55%),
    linear-gradient(#030820, #071238 50%, #030820);
  pointer-events: none;
}
.script {
  font-family: "Pinyon Script", cursive;
  font-weight: 400;
  text-shadow: 0 0 24px #7ea4ff99;
}
#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
#fx {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  overflow: hidden;
  contain: paint;
}
main,
section {
  position: relative;
  z-index: 1;
}
section {
  padding: 5rem 1.25rem;
  max-width: 64rem;
  margin: 0 auto;
  content-visibility: auto;
  contain-intrinsic-size: 600px;
}
#hero,
#final {
  content-visibility: visible;
  contain-intrinsic-size: auto;
}
.rv {
  opacity: 0;
  transform: translateY(28px) scale(0.98);
  filter: blur(6px);
  transition:
    opacity 1.1s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 1.1s cubic-bezier(0.2, 0.7, 0.2, 1),
    filter 1.1s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.rv.in {
  opacity: 1;
  transform: none;
  filter: none;
}
.glass {
  background: linear-gradient(145deg, #12247a40, #0a1a5a30);
  border: 1px solid #9dbcff33;
  border-radius: 1.5rem;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow:
    0 0 40px #4f7bff1f inset,
    0 10px 40px #00000055;
}
@supports not (backdrop-filter: blur(1px)) {
  .glass {
    background: linear-gradient(145deg, #12247acc, #0a1a5acc);
  }
}
.btn {
  border: 1px solid #9dbcff88;
  background: #1a3190aa;
  color: var(--moon);
  padding: 0.7rem 1.7rem;
  border-radius: 99px;
  font-style: italic;
  font-size: 1.15rem;
  transition:
    transform 0.3s,
    box-shadow 0.3s,
    background 0.3s;
  box-shadow: 0 0 18px #6f9bff55;
  cursor: pointer;
}
.btn:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 0 34px #9dbcffaa;
}
.btn:active {
  transform: scale(0.95);
}
.moon {
  width: min(46vw, 200px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #dfe8ff 45%, #9fb4ee 100%);
  box-shadow:
    0 0 60px 14px #9dbcff66,
    0 0 160px 40px #4f7bff44;
  position: relative;
  animation: bob 7s ease-in-out infinite;
  will-change: transform;
}
.moon:before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 62% 38%, #8fa3dd55 0 9%, transparent 10%),
    radial-gradient(circle at 35% 64%, #8fa3dd44 0 12%, transparent 13%),
    radial-gradient(circle at 70% 72%, #8fa3dd44 0 6%, transparent 7%);
}
@keyframes bob {
  50% {
    transform: translateY(-14px);
  }
}
.glowtxt {
  animation: gl 3s ease-in-out infinite;
}
@keyframes gl {
  50% {
    text-shadow:
      0 0 44px #bcd0ff,
      0 0 80px #6f9bff;
  }
}
.bh {
  position: fixed;
  pointer-events: none;
  color: var(--rose);
  text-shadow: 0 0 10px var(--rose);
  animation: bh 1.2s ease-out forwards;
  will-change: transform, opacity;
}
@keyframes bh {
  to {
    transform: translate(var(--dx), var(--dy)) scale(0.3) rotate(50deg);
    opacity: 0;
  }
}
.fh {
  position: fixed;
  bottom: -30px;
  color: #ff9cc8aa;
  animation: fh linear forwards;
  pointer-events: none;
  will-change: transform, opacity;
}
@keyframes fh {
  to {
    transform: translate(var(--sx), -110vh) rotate(30deg);
    opacity: 0;
  }
}
#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.3rem;
  text-align: center;
  padding: 1.5rem;
  transition:
    opacity 1.2s,
    visibility 1.2s;
}
#loader.off {
  opacity: 0;
  visibility: hidden;
}
.bar {
  width: min(70vw, 260px);
  height: 3px;
  background: #ffffff1a;
  border-radius: 9px;
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #6f9bff, #fff, var(--rose));
  transition: width 1.2s ease;
}
.tl {
  border-left: 2px solid #9dbcff44;
  margin-left: 0.6rem;
  padding-left: 1.6rem;
  position: relative;
  padding-bottom: 2rem;
}
.tl:before {
  content: "✦";
  position: absolute;
  left: -0.7rem;
  top: -0.1rem;
  color: #fff;
  text-shadow:
    0 0 14px #9dbcff,
    0 0 28px #6f9bff;
  font-size: 1.1rem;
  animation: tw 2.5s infinite;
}
@keyframes tw {
  50% {
    opacity: 0.35;
    transform: scale(0.7);
  }
}
.pol {
  background: #f7f4ee;
  padding: 0.55rem 0.55rem 2.3rem;
  border-radius: 4px;
  box-shadow: 0 14px 34px #000a;
  position: relative;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.5s;
  cursor: pointer;
  color: #1b2150;
  transform: rotate(var(--r));
}
.pol:hover {
  transform: rotate(0) scale(1.07) translateY(-6px);
  z-index: 5;
  box-shadow:
    0 0 40px #9dbcff99,
    0 20px 40px #000a;
}
.pol:before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 70px;
  height: 20px;
  margin-left: -35px;
  background: #9dbcff88;
  transform: rotate(-3deg);
}
.pol img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: linear-gradient(135deg, #1a3190, #ffa9cf);
  filter: saturate(0.9) contrast(1.05);
}
.pol p {
  position: absolute;
  bottom: 0.4rem;
  left: 0;
  right: 0;
  text-align: center;
  font-family: "Pinyon Script";
  font-size: 1.25rem;
}

/* ===== LETTER — paper direct (no envelope) ===== */
.letter-paper {
  background:
    radial-gradient(ellipse at 18% 0%, #ffffff 0%, transparent 58%),
    linear-gradient(180deg, #fffdf6 0%, #fff9ec 36%, #f6efe0 100%);
  color: #1b2150;
  border-radius: 18px;
  border: 1px solid #e8ddc2;
  box-shadow:
    0 16px 36px #0005,
    0 0 0 1px #fff inset,
    0 0 40px #fff6 inset;
  padding: 1.8rem 1.6rem 1.5rem;
  position: relative;
  overflow: hidden;
  text-align: left;
}
.letter-paper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 6%;
  right: 6%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e8ddc2 22%, #d9c9a5 50%, #e8ddc2 78%, transparent);
}
.letter-paper::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 28%, #ffe0ee 0%, #ff9ec3 32%, #f0448e 60%, #b91c5a 78%);
  opacity: 0.14;
  border: 1px dashed #e8a5c2;
  pointer-events: none;
}
.letter-paper .script {
  color: #1b2150;
  text-shadow: none;
}
#letter #lbody p {
  opacity: 0;
  transform: translateY(10px);
  animation: letterIn 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
#letter #lbody p:nth-child(1) { animation-delay: 0.15s; }
#letter #lbody p:nth-child(2) { animation-delay: 0.35s; }
#letter #lbody p:nth-child(3) { animation-delay: 0.55s; }
#letter #lbody p:nth-child(4) { animation-delay: 0.75s; }
@keyframes letterIn {
  to { opacity: 1; transform: none; }
}
#letter.rv.in #lbody p { animation-play-state: running; }
@media (max-width: 480px) {
  .letter-paper { padding: 1.4rem 1.2rem 1.2rem; border-radius: 16px; }
}
.lt {
  max-height: 0;
  overflow: hidden;
  transition: max-height 1.6s ease 0.7s;
}
.lt.show {
  max-height: 2000px;
}

.star {
  display: inline-block;
  transition: transform 0.4s;
}
.card {
  cursor: pointer;
  transition:
    transform 0.4s,
    box-shadow 0.4s;
  min-height: 7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 0 30px #9dbcff66;
}
.opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.8rem 1.1rem;
  margin: 0.5rem 0;
  border-radius: 1rem;
  border: 1px solid #9dbcff44;
  background: #ffffff0a;
  color: var(--moon);
  transition:
    background 0.3s,
    transform 0.3s,
    border-color 0.3s;
  cursor: pointer;
  font-size: 1.1rem;
}
.opt:hover {
  background: #9dbcff22;
  transform: translateX(5px);
}
.ok {
  background: #4ade8033 !important;
  border-color: #4ade80;
}
.no {
  background: #ff7a9a33 !important;
  border-color: #ff7a9a;
}
#arena {
  position: relative;
  height: 300px;
  overflow: hidden;
  border-radius: 1.5rem;
  touch-action: manipulation;
}
.fall {
  position: absolute;
  top: -40px;
  font-size: 2rem;
  color: var(--rose);
  text-shadow: 0 0 14px var(--rose);
  animation: fl linear forwards;
  cursor: pointer;
  padding: 6px;
  user-select: none;
  will-change: transform;
}
@keyframes fl {
  to {
    transform: translateY(350px) rotate(25deg);
  }
}
.sec-star {
  color: #fff;
  font-size: 1.3rem;
  opacity: 0.5;
  animation: tw 2s infinite;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0.7rem;
}
.gift {
  width: 130px;
  height: 130px;
  position: relative;
  margin: 2rem auto;
  cursor: pointer;
  animation: bob 3s infinite;
  will-change: transform;
}
.gift .bx {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 78px;
  background: linear-gradient(90deg, #2b4ac4 42%, var(--rose) 42% 58%, #2b4ac4 58%);
  border-radius: 6px;
  box-shadow: 0 0 30px #6f9bff88;
}
.gift .ld {
  position: absolute;
  top: 18px;
  left: -8px;
  right: -8px;
  height: 36px;
  background: linear-gradient(90deg, #3a5ce0 42%, #ff8fc0 42% 58%, #3a5ce0 58%);
  border-radius: 6px;
  transition: transform 0.8s cubic-bezier(0.3, 1.6, 0.5, 1);
  transform-origin: left bottom;
}
.gift.open .ld {
  transform: translate(18px, -60px) rotate(-28deg);
}
.gift.open {
  animation: none;
}
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--glow);
  outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  #sky {
    display: none;
  }
}
