:root {
  --bg: #0d0d0f;
  --bg2: #17171b;
  --card: rgba(30, 30, 35, 0.62);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f3f3f3;
  --muted: #b9b9c0;
  --accent: #d8bc93;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.25), 0 35px 90px rgba(0, 0, 0, 0.35);
  --radius: 34px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.background {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: radial-gradient(
    circle at top,
    #26262b 0%,
    #16161a 40%,
    #0d0d0f 100%
  );
}

.background::before {
  content: "";
  position: absolute;
  width: 65vmax;
  height: 65vmax;
  border-radius: 50%;
  left: -10%;
  top: -15%;
  background: rgba(216, 188, 147, 0.07);
  filter: blur(120px);
  animation: breathe 14s ease-in-out infinite;
}

#particles {
  position: absolute;
  inset: 0;
}

.particle {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  filter: blur(1px);
  animation: floatUp linear forwards;
}

#experience {
  width: min(92vw, 520px);
  height: min(86vh, 720px);
  height: min(86dvh, 720px);
  position: relative;
}

.stack {
  width: 100%;
  height: 100%;
  position: relative;
}

.card {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: var(--card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  padding: 48px;
  transition:
    transform 0.8s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.8s;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    130deg,
    transparent 20%,
    rgba(255, 255, 255, 0.05) 50%,
    transparent 75%
  );
  pointer-events: none;
}

.card-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}

.card-number {
  color: var(--accent);
  letter-spacing: 4px;
  font-size: 0.8rem;
}

h1 {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2.7rem, 5vw, 3.5rem);
  line-height: 1;
}

p {
  color: var(--muted);
  line-height: 1.9;
  font-size: 1.02rem;
}

#nextBtn {
  position: absolute;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  padding: 14px 24px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: 0.25s;
}

#nextBtn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.12);
}

#musicToggle {
  position: fixed;
  top: 22px;
  right: 22px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(30, 30, 35, 0.5);
  color: white;
  backdrop-filter: blur(10px);
  z-index: 999;
}

#finalCard {
  display: none;

  position: fixed;

  inset: 0;

  justify-content: center;

  align-items: center;

  background: rgba(13, 13, 16, 0.35);

  backdrop-filter: blur(8px);
}

.final-content {
  width: min(90vw, 520px);

  padding: 50px 40px;

  border-radius: 34px;

  background: rgba(30, 30, 35, 0.65);

  backdrop-filter: blur(18px);

  border: 1px solid rgba(255, 255, 255, 0.08);

  box-shadow:
    0 15px 40px rgba(0, 0, 0, 0.35),
    0 30px 90px rgba(0, 0, 0, 0.45);

  text-align: center;
}

.final-content h1 {
  margin-bottom: 25px;
}

.final-content p {
  margin: 18px 0;
}

.signature {
  display: block;

  margin-top: 30px;

  font-size: 2rem;

  color: var(--accent);

  font-family: Caveat, cursive;
}

.card.swipe {
  animation: swipe 0.9s forwards;
}

@keyframes swipe {
  0% {
    transform: translateX(0) rotate(0);
  }
  20% {
    transform: translateY(-12px) rotate(-2deg);
  }
  100% {
    transform: translateX(-170%) translateY(-20px) rotate(-18deg);
    opacity: 0;
  }
}

@keyframes breathe {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(8%, 6%) scale(1.12);
  }
}

@keyframes floatUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  to {
    transform: translateY(-120px);
    opacity: 0;
  }
}

@media (max-width: 600px) {
  .card {
    padding: 34px;
  }
  #experience {
    height: min(82vh, 680px);
    height: min(82dvh, 680px);
  }
  #nextBtn {
    left: 24px;
    right: 24px;
  }
}

@media (max-width: 380px) {
  .flowerContainer {
    transform: scale(0.8);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.2s !important;
  }

  .background::before,
  .flower {
    animation: none !important;
  }
}

#flowerScene {
  background: #0d0d10;

  display: none;

  position: fixed;

  inset: 0;

  justify-content: center;

  align-items: center;
}

.flowerContainer {
  display: flex;

  flex-direction: column;

  align-items: center;

  gap: 40px;
}

.flowerArea {
  position: relative;

  width: 320px;

  height: 420px;
}

.pot {
  position: absolute;

  bottom: 0;

  left: 50%;

  transform: translateX(-50%);

  width: 150px;

  height: 90px;

  background: #8d5b3d;

  border-radius: 0 0 28px 28px;

  z-index: 3;
}

.soil {
  width: 100%;

  height: 18px;

  background: #4d2e20;

  border-radius: 20px;
}

.flower {
  position: absolute;

  bottom: 70px;

  left: 50%;

  transform: translateX(-50%);

  z-index: 2;

  animation: sway 4s ease-in-out infinite;

  transform-origin: bottom center;
}

@keyframes sway {
  0% {
    transform: translateX(-50%) rotate(-2deg);
  }

  50% {
    transform: translateX(-50%) rotate(2deg);
  }

  100% {
    transform: translateX(-50%) rotate(-2deg);
  }
}

.stem {
  width: 8px;

  height: 0;

  background: #4caf50;

  margin: auto;

  border-radius: 10px;

  transition: 2s;
}

.leaf {
  position: absolute;

  width: 42px;

  height: 20px;

  background: #4caf50;

  opacity: 0;

  transition: 0.8s;
}

.left {
  left: -38px;

  top: 90px;

  border-radius: 100% 0;

  transform: rotate(-35deg) scale(0);
}

.right {
  right: -38px;

  top: 150px;

  border-radius: 0 100%;

  transform: rotate(35deg) scale(0);
}

.head {
  position: absolute;

  left: 50%;

  top: -80px;

  transform: translateX(-50%) scale(0);

  width: 120px;

  height: 120px;

  transition: 1s;
}

.center {
  position: absolute;

  left: 50%;

  top: 50%;

  transform: translate(-50%, -50%);

  width: 34px;

  height: 34px;

  background: #ffd54f;

  border-radius: 50%;

  z-index: 20;
}

.petal {
  position: absolute;

  width: 40px;

  height: 40px;

  background: #f7a8c8;

  border-radius: 50%;
}

.p1 {
  top: 0;
  left: 40px;
}
.p2 {
  top: 18px;
  right: 0;
}
.p3 {
  bottom: 18px;
  right: 0;
}
.p4 {
  bottom: 0;
  left: 40px;
}
.p5 {
  bottom: 18px;
  left: 0;
}
.p6 {
  top: 18px;
  left: 0;
}

.candleArea {
  position: absolute;

  bottom: 18px;

  left: 50%;

  transform: translateX(-50%);

  opacity: 0;

  transition: 1s;

  z-index: 1;
}

#candle {
  width: 18px;

  height: 38px;

  margin: auto;

  background: linear-gradient(to bottom, #fff, #ececec);

  border-radius: 8px;

  position: relative;

  box-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
}

.flame {
  position: absolute;

  left: 50%;

  top: -34px;

  transform: translateX(-50%);

  width: 26px;

  height: 42px;

  background: radial-gradient(
    circle at 50% 65%,
    #fff7b0 0%,
    #ffd54f 35%,
    #ff9f1c 70%,
    #ff6b35 100%
  );

  border-radius: 60% 60% 60% 60% / 75% 75% 35% 35%;

  filter: drop-shadow(0 0 10px rgba(255, 190, 80, 0.9));

  animation: flicker 0.18s infinite alternate;
}

@keyframes flicker {
  from {
    transform: translateX(-50%) rotate(-2deg) scale(1);
  }

  to {
    transform: translateX(-50%) rotate(2deg) scale(1.08);
  }
}

.wick {
  position: absolute;

  top: -5px;

  left: 50%;

  width: 2px;

  height: 8px;

  background: #222;

  transform: translateX(-50%);
}

.smoke {
  position: absolute;

  left: 50%;

  top: -40px;

  width: 16px;

  height: 16px;

  background: rgba(220, 220, 220, 0.55);

  border-radius: 50%;

  transform: translateX(-50%) scale(0);

  filter: blur(4px);

  opacity: 0;
}

.smoke.show {
  animation: smoke 2s forwards;
}

@keyframes smoke {
  0% {
    opacity: 1;

    transform: translateX(-50%) scale(0.3);
  }

  100% {
    opacity: 0;

    transform: translate(-50%, -80px) scale(2);
  }
}

.flame.out {
  animation: none;

  opacity: 0;

  transform: translateX(-50%) scale(0);
}
