:root {
  color-scheme: dark;
  --night: #090a12;
  --warm-light: rgba(255, 179, 91, 0.23);
  --table-width: min(86vw, 1050px);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100svh;
  overflow: hidden;
  background: var(--night);
  color: #f7eadb;
  font-family: Georgia, "Times New Roman", serif;
}

button {
  font: inherit;
}

.scene {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
  background:
    radial-gradient(
      ellipse at 50% 43%,
      rgba(36, 39, 57, 0.25),
      transparent 53%
    ),
    linear-gradient(180deg, #10121d 0%, #0b0c15 51%, #08090f 100%);
}

.wall {
  position: absolute;
  inset: 0 0 26% 0;
  opacity: 0.35;
  background:
    linear-gradient(
      90deg,
      transparent 19.8%,
      rgba(130, 132, 150, 0.08) 20%,
      transparent 20.2%,
      transparent 79.8%,
      rgba(130, 132, 150, 0.08) 80%,
      transparent 80.2%
    ),
    linear-gradient(
      180deg,
      transparent 70%,
      rgba(121, 124, 143, 0.07) 70.2%,
      transparent 70.5%
    );
}

.wall::before {
  content: "";
  position: absolute;
  top: 12%;
  left: 50%;
  width: min(52vw, 510px);
  height: 45%;
  transform: translateX(-50%);
  border: 1px solid rgba(178, 164, 166, 0.07);
  box-shadow:
    0 0 60px rgba(76, 72, 102, 0.08),
    inset 0 0 50px rgba(76, 72, 102, 0.04);
}

.vignette {
  position: absolute;
  z-index: 8;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 52% 48%,
    transparent 26%,
    rgba(2, 3, 8, 0.32) 68%,
    rgba(1, 2, 6, 0.85) 125%
  );
  transition: opacity 1.8s ease;
}

.scene.lit .vignette {
  opacity: 0.62;
}

.ambient-glow {
  position: absolute;
  z-index: 1;
  left: 65%;
  top: 51%;
  width: min(75vw, 850px);
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.55);
  background: radial-gradient(
    circle,
    rgba(255, 198, 123, 0.27) 0%,
    rgba(255, 158, 88, 0.14) 24%,
    rgba(244, 136, 87, 0.055) 48%,
    transparent 72%
  );
  filter: blur(8px);
  transition:
    opacity 1.8s ease,
    transform 2s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.scene.lit .ambient-glow {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.intro {
  position: absolute;
  z-index: 2;
  top: clamp(27px, 7vh, 65px);
  left: 50%;
  width: max-content;
  max-width: calc(100% - 36px);
  text-align: center;
  transform: translateX(-50%);
  animation: arrive 1.5s ease both;
}

.intro p {
  margin: 0;
  color: rgba(246, 226, 208, 0.56);
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.intro h1 {
  margin: 9px 0 0;
  color: rgba(255, 240, 221, 0.84);
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 400;
  letter-spacing: 0.03em;
}

.table-shadow {
  position: absolute;
  z-index: 2;
  bottom: 9%;
  left: 50%;
  width: var(--table-width);
  height: 12%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.74);
  filter: blur(18px);
  transform: translateX(-50%);
}

.table-top {
  position: absolute;
  z-index: 4;
  bottom: 19%;
  left: 50%;
  width: var(--table-width);
  height: clamp(45px, 9vh, 88px);
  border: 1px solid rgba(195, 151, 121, 0.3);
  border-radius: 50%;
  background:
    radial-gradient(
      ellipse at 66% 32%,
      rgba(255, 205, 151, 0.18),
      transparent 34%
    ),
    linear-gradient(180deg, #4b3534 0%, #2d2227 32%, #17151e 100%);
  box-shadow:
    inset 0 6px 12px rgba(238, 192, 155, 0.12),
    0 8px 26px rgba(0, 0, 0, 0.65);
  transform: translateX(-50%);
  transition:
    filter 1.5s ease,
    box-shadow 1.5s ease;
}

.table-front {
  position: absolute;
  z-index: 3;
  bottom: 7%;
  left: 50%;
  width: calc(var(--table-width) - 1.5%);
  height: 16%;
  border: 1px solid rgba(127, 91, 78, 0.25);
  border-top: 0;
  border-radius: 0 0 9px 9px;
  background: linear-gradient(
    90deg,
    #17151c 0%,
    #302328 18%,
    #211c23 48%,
    #352626 73%,
    #15141b 100%
  );
  box-shadow:
    inset 0 -12px 24px rgba(0, 0, 0, 0.35),
    0 18px 35px rgba(0, 0, 0, 0.58);
  transform: translateX(-50%);
}

.table-front::after {
  content: "";
  position: absolute;
  top: 17%;
  left: 3%;
  right: 3%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(235, 183, 144, 0.18),
    transparent
  );
}

.table-leg {
  position: absolute;
  z-index: 2;
  bottom: -8%;
  width: 5%;
  height: 17%;
  background: linear-gradient(90deg, #14131a, #292127 48%, #121219);
  filter: brightness(0.7);
}

.table-leg.left {
  left: 14%;
}
.table-leg.right {
  right: 14%;
}

.table-reflection {
  position: absolute;
  z-index: 5;
  right: 10%;
  bottom: 19%;
  width: 32%;
  height: 8%;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse,
    rgba(255, 185, 113, 0.72),
    rgba(255, 149, 89, 0.18) 44%,
    transparent 72%
  );
  filter: blur(11px);
  transition: opacity 1.5s ease;
}

.scene.lit .table-reflection {
  opacity: 0.9;
}

.gift {
  position: absolute;
  z-index: 6;
  bottom: calc(19% + 26px);
  left: calc(50% - min(32vw, 330px));
  width: clamp(125px, 17vw, 182px);
  height: clamp(125px, 18vh, 156px);
  transform-origin: 50% 100%;
  transition:
    transform 0.25s ease,
    filter 1.4s ease;
}

.gift-body {
  position: absolute;
  z-index: 2;
  right: 4%;
  bottom: 0;
  left: 4%;
  height: 74%;
  border: 1px solid rgba(255, 224, 227, 0.44);
  border-radius: 3px 3px 5px 5px;
  background: linear-gradient(
    110deg,
    #a94d6d 0%,
    #d67a91 24%,
    #c45e7c 55%,
    #8e3d61 100%
  );
  box-shadow:
    inset 9px 0 13px rgba(255, 211, 221, 0.13),
    inset -12px 0 16px rgba(44, 9, 31, 0.28),
    0 10px 19px rgba(0, 0, 0, 0.35);
}

.gift-body::before,
.gift-body::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 16%;
  background: linear-gradient(90deg, #fff0dd, #e9c8bd 46%, #fff4e5);
  box-shadow: 0 0 9px rgba(255, 232, 216, 0.16);
}

.gift-body::before {
  left: 42%;
}

.gift-lid {
  position: absolute;
  z-index: 5;
  top: 19%;
  left: 0;
  width: 100%;
  height: 19%;
  border: 1px solid rgba(255, 235, 234, 0.5);
  border-radius: 4px;
  background: linear-gradient(180deg, #e9a3ae, #bd617c 75%, #a14c6b);
  box-shadow:
    inset 0 3px 5px rgba(255, 241, 229, 0.25),
    0 4px 8px rgba(0, 0, 0, 0.28);
  transform-origin: 50% 100%;
  transition:
    transform 1s cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 0.8s ease;
}

.gift-lid::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 42%;
  width: 16%;
  height: calc(100% + 8px);
  background: linear-gradient(90deg, #fff2df, #e6c3b7 50%, #fff1df);
}

.bow {
  position: absolute;
  z-index: 7;
  top: 8%;
  left: 50%;
  width: 49px;
  height: 35px;
  transform: translateX(-50%);
  transition:
    transform 0.7s ease,
    opacity 0.5s ease;
}

.bow::before,
.bow::after {
  content: "";
  position: absolute;
  top: 3px;
  width: 23px;
  height: 17px;
  border: 2px solid #f4d9cc;
  background: linear-gradient(145deg, #fff1de, #cc9b9a);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.bow::before {
  left: 1px;
  border-radius: 75% 25% 65% 35%;
  transform: rotate(20deg);
}
.bow::after {
  right: 1px;
  border-radius: 25% 75% 35% 65%;
  transform: rotate(-20deg);
}

.bow-knot {
  position: absolute;
  z-index: 1;
  top: 8px;
  left: 19px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff1dc;
  box-shadow: 0 0 0 1px rgba(143, 80, 88, 0.4);
}

.letter {
  position: absolute;
  z-index: 7;
  left: var(--letter-start-x, 50%);
  top: var(--letter-start-y, 50%);
  width: var(--letter-width, min(70vw, 360px));
  height: var(--letter-height, min(42vh, 500px));
  min-height: 0;
  padding: 22px 20px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(122, 92, 75, 0.17);
  border-radius: 2px;
  background: linear-gradient(135deg, #fffaf0, #f1e4d3);
  box-shadow:
    0 5px 22px rgba(255, 185, 113, 0.17),
    0 9px 22px rgba(0, 0, 0, 0.34);
  color: #50453e;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 0) scale(0.42, 0.12);
  transform-origin: top center;
  transition:
    left 1.15s cubic-bezier(0.18, 0.8, 0.25, 1),
    top 1.15s cubic-bezier(0.18, 0.8, 0.25, 1),
    opacity 0.7s ease,
    transform 1.15s cubic-bezier(0.18, 0.8, 0.25, 1);
}

.letter::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(173, 139, 111, 0.17);
  pointer-events: none;
}

.letter h2,
.letter p {
  position: relative;
  z-index: 1;
}
.letter h2 {
  margin: 2px 0 13px;
  font-size: 17px;
  font-weight: 400;
}
.letter p {
  min-height: 12px;
  margin: 10px 0;
  font-size: 12px;
  line-height: 1.55;
}

.gift.open .gift-lid {
  transform: translate(12%, -115%) rotate(18deg);
  filter: brightness(1.2);
}
.gift.open .bow {
  opacity: 0;
  transform: translate(-50%, -70%) rotate(20deg);
}
.letter.in-air {
  opacity: 1;
  left: 50%;
  top: var(--letter-target-top, 5vh);
  pointer-events: auto;
  transform: translate(-50%, 0) scale(0.78, 0.22);
}
.letter.expanded {
  transform: translate(-50%, 0) scale(1, 1);
}
.gift.open .gift-body {
  box-shadow:
    0 -8px 31px rgba(255, 186, 119, 0.48),
    inset 9px 0 13px rgba(255, 211, 221, 0.13),
    inset -12px 0 16px rgba(44, 9, 31, 0.28),
    0 10px 19px rgba(0, 0, 0, 0.35);
}

.cake {
  position: absolute;
  z-index: 6;
  bottom: calc(19% + 28px);
  left: calc(50% + min(6vw, 70px));
  width: clamp(190px, 25vw, 270px);
  height: clamp(205px, 29vh, 260px);
  filter: brightness(0.74) saturate(0.84);
  transition: filter 1.6s ease;
}

.scene.lit .cake {
  filter: brightness(1.08) saturate(1.04)
    drop-shadow(0 0 18px rgba(255, 177, 108, 0.27));
}
.scene.lit .gift {
  filter: brightness(1.12) saturate(1.08);
}

.cake-stack {
  position: absolute;
  right: 2%;
  bottom: 0;
  left: 2%;
  height: 72%;
  filter: drop-shadow(0 12px 12px rgba(0, 0, 0, 0.36));
}

.cake-lower {
  position: absolute;
  bottom: 2%;
  left: 4%;
  width: 92%;
  height: 48%;
  border: 1px solid rgba(255, 240, 230, 0.5);
  border-radius: 13px 13px 24px 24px / 13px 13px 17px 17px;
  background: linear-gradient(
    90deg,
    #d77b91 0%,
    #f7dce0 17%,
    #fff0e7 47%,
    #f8d8df 77%,
    #c76180 100%
  );
  box-shadow:
    inset 0 -12px 0 rgba(186, 75, 112, 0.8),
    inset 0 -17px 0 rgba(255, 235, 229, 0.9),
    inset 0 10px 12px rgba(255, 255, 255, 0.5);
}

.cake-lower::before {
  content: "";
  position: absolute;
  top: -12px;
  left: -2px;
  right: -2px;
  height: 27px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff8f2, #f2c6d1 80%);
  box-shadow: 0 3px 4px rgba(172, 78, 107, 0.22);
}

.cake-upper {
  position: absolute;
  bottom: 43%;
  left: 15%;
  width: 70%;
  height: 38%;
  border: 1px solid rgba(255, 244, 235, 0.7);
  border-radius: 12px 12px 19px 19px / 12px 12px 14px 14px;
  background: linear-gradient(
    90deg,
    #d86f8b,
    #fff2ed 22%,
    #fffaf2 55%,
    #f7dce0 82%,
    #cc6382
  );
  box-shadow:
    inset 0 -9px 0 #f5b9c9,
    inset 0 -13px 0 #fff3ed,
    inset 0 7px 10px rgba(255, 255, 255, 0.65);
}

.cake-upper::before {
  content: "";
  position: absolute;
  top: -10px;
  left: -2px;
  right: -2px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fffaf3, #f5cad5);
}

.drip {
  position: absolute;
  z-index: 2;
  top: 4px;
  width: 12px;
  height: 24px;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(180deg, #f9d4dd, #e99aaf);
}

.drip.one {
  left: 18%;
  height: 20px;
}
.drip.two {
  left: 46%;
  height: 29px;
}
.drip.three {
  right: 17%;
  height: 18px;
}

.berry {
  position: absolute;
  z-index: 4;
  top: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 35% 28%,
    #ffe2e2 0 10%,
    #e47f99 32%,
    #ae395f 76%
  );
  box-shadow: 0 2px 3px rgba(84, 28, 52, 0.25);
}

.berry.one {
  left: 17%;
}
.berry.two {
  left: 46%;
  top: -3px;
  width: 15px;
  height: 15px;
}
.berry.three {
  right: 17%;
}

.candle-row {
  position: absolute;
  z-index: 7;
  top: -61px;
  left: 50%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(13px, 2vw, 22px);
  width: 170px;
  height: 55px;
  transform: translateX(-50%);
}

.candle {
  position: relative;
  width: 22px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 247, 221, 0.85);
  border-radius: 5px 5px 2px 2px;
  cursor: pointer;
  background: repeating-linear-gradient(
    135deg,
    #fff6eb 0 6px,
    #e8869b 6px 11px
  );
  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.24),
    inset -3px 0 3px rgba(182, 74, 101, 0.25);
  -webkit-tap-highlight-color: transparent;
}

.candle:nth-child(2) {
  height: 51px;
}
.candle:focus-visible {
  outline: 2px solid #ffe3a7;
  outline-offset: 7px;
}

.wick {
  position: absolute;
  top: -8px;
  left: 50%;
  width: 2px;
  height: 9px;
  background: #282127;
  transform: translateX(-50%);
}

.flame {
  position: absolute;
  z-index: 2;
  top: -30px;
  left: 50%;
  width: 16px;
  height: 25px;
  opacity: 0;
  border-radius: 60% 40% 55% 45% / 70% 65% 35% 30%;
  background: radial-gradient(
    ellipse at 50% 70%,
    #fff9cc 0 16%,
    #ffd366 33%,
    #ff8b32 62%,
    rgba(255, 76, 26, 0.82) 78%,
    transparent 82%
  );
  filter: drop-shadow(0 0 7px rgba(255, 172, 57, 0.95));
  transform: translateX(-50%) rotate(0deg) scale(0.55);
  transition:
    opacity 0.45s ease,
    transform 0.4s ease;
  pointer-events: none;
}

.scene.lit .flame {
  opacity: 1;
  transform: translateX(-50%) rotate(4deg) scale(1);
  animation: flicker 1.35s ease-in-out infinite alternate;
}
.scene.lit .candle:nth-child(2) .flame {
  animation-delay: -0.45s;
}
.scene.lit .candle:nth-child(3) .flame {
  animation-delay: -0.8s;
}

.prompt {
  position: absolute;
  z-index: 9;
  right: 0;
  bottom: 3.3%;
  left: 0;
  margin: 0;
  color: rgba(241, 222, 205, 0.51);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-align: center;
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}

.scene.lit .prompt {
  opacity: 0;
  transform: translateY(5px);
}

.confetti-layer {
  position: absolute;
  z-index: 7;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti {
  position: absolute;
  top: var(--start-y);
  left: var(--start-x);
  width: var(--size);
  height: calc(var(--size) * 1.5);
  opacity: 0;
  background: var(--color);
  border-radius: var(--rounding, 1px);
  box-shadow: 0 0 7px color-mix(in srgb, var(--color), transparent 45%);
  animation: celebrate var(--duration) cubic-bezier(0.16, 0.68, 0.34, 1)
    var(--delay) forwards;
}

.confetti.ribbon {
  width: calc(var(--size) * 0.55);
  height: calc(var(--size) * 2.2);
  border-radius: 50%;
}
.confetti.dot {
  border-radius: 50%;
}
.confetti.star {
  clip-path: polygon(
    50% 0,
    62% 36%,
    100% 38%,
    71% 60%,
    82% 100%,
    50% 76%,
    18% 100%,
    29% 60%,
    0 38%,
    38% 36%
  );
}

.scene.celebrating .gift {
  animation: tremble 0.55s ease-in-out 0.1s infinite;
}
.scene.opening .gift {
  animation: none;
}
.scene.opening .gift.open {
  animation: none;
}

@keyframes flicker {
  0% {
    filter: drop-shadow(0 0 6px rgba(255, 167, 54, 0.8));
    transform: translateX(-50%) rotate(3deg) scale(0.95, 1);
  }
  45% {
    filter: drop-shadow(0 0 12px rgba(255, 186, 67, 1));
    transform: translateX(-48%) rotate(-5deg) scale(1.05, 1.08);
  }
  100% {
    filter: drop-shadow(0 0 8px rgba(255, 119, 34, 0.9));
    transform: translateX(-53%) rotate(5deg) scale(0.94, 1.02);
  }
}

@keyframes celebrate {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(0.6);
  }
  9% {
    opacity: 1;
  }
  68% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--drift-x), var(--drift-y), 0)
      rotate(var(--spin)) scale(0.72);
  }
}

@keyframes tremble {
  0%,
  100% {
    transform: translateX(0) rotate(0);
  }
  20% {
    transform: translateX(-4px) rotate(-1.4deg);
  }
  42% {
    transform: translateX(4px) rotate(1.5deg);
  }
  64% {
    transform: translateX(-3px) rotate(-1deg);
  }
  82% {
    transform: translateX(2px) rotate(0.8deg);
  }
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: translate(-50%, -7px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@media (max-width: 680px) {
  :root {
    --table-width: 96vw;
  }
  .scene {
    min-height: 490px;
  }
  .wall {
    bottom: 29%;
  }
  .wall::before {
    top: 17%;
    width: 68vw;
    height: 38%;
  }
  .intro {
    top: 7vh;
  }
  .intro p {
    font-size: 9px;
  }
  .intro h1 {
    margin-top: 7px;
    font-size: 22px;
  }
  .table-top {
    bottom: 24%;
    height: 7.5vh;
  }
  .table-front {
    bottom: 10%;
    height: 17%;
  }
  .table-shadow {
    bottom: 11%;
  }
  .table-reflection {
    right: 4%;
    bottom: 24%;
    width: 45%;
  }
  .gift {
    bottom: calc(24% + 19px);
    left: 9%;
    width: clamp(100px, 29vw, 145px);
    height: clamp(112px, 17vh, 140px);
  }
  .cake {
    bottom: calc(24% + 20px);
    left: 44%;
    width: clamp(155px, 48vw, 220px);
    height: clamp(185px, 25vh, 220px);
  }
  .candle-row {
    gap: 13px;
    width: 145px;
  }
  .candle {
    width: 20px;
    height: 38px;
  }
  .candle:nth-child(2) {
    height: 45px;
  }
  .letter {
    padding: 18px 16px;
  }
  .letter h2 {
    font-size: 15px;
  }
  .letter p {
    font-size: 11px;
  }
  .prompt {
    bottom: 3%;
    font-size: 11px;
  }
  .ambient-glow {
    left: 68%;
    top: 56%;
    width: 110vw;
  }
}

@media (max-width: 390px) {
  .gift {
    left: 9%;
    width: 104px;
    height: 112px;
  }
  .cake {
    left: 42%;
    width: 160px;
    height: 180px;
  }
  .candle-row {
    gap: 10px;
  }
}

@media (max-height: 620px) and (min-width: 681px) {
  .intro {
    top: 4vh;
  }
  .cake,
  .gift {
    bottom: calc(17% + 22px);
  }
  .table-top {
    bottom: 17%;
  }
  .table-reflection {
    bottom: 17%;
  }
}

@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;
  }
}
