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

:root {
  --rose: #e05575;
  --rose-deep: #9a2848;
  --petal: #fde4ec;
  --cream: #fef9f5;
  --text-dark: #4a1228;
}

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

body {
  background: radial-gradient(ellipse at 50% 55%, #2e0d1a 0%, #130810 65%, #0d0509 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Dancing Script', cursive, serif;
  /* cursor: none; */
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ── Custom cursor ─────────────────────────────── */
/* #cursor {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  font-size: 18px;
  transform: translate(-50%, -50%);
} */

/* ── Heart trail ───────────────────────────────── */
.trail {
  position: fixed;
  pointer-events: none;
  z-index: 9998;
  animation: trailRise 1.3s ease-out forwards;
}

@keyframes trailRise {
  0% {
    opacity: .75;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -160%) scale(.25) rotate(18deg);
  }
}

/* ── Ambient hearts ────────────────────────────── */
.ambient {
  position: fixed;
  pointer-events: none;
  z-index: 1;
  animation: ambientFloat linear forwards;
  opacity: 0;
}

@keyframes ambientFloat {
  0% {
    opacity: 0;
    transform: translateY(10vh) rotate(0deg);
  }

  12% {
    opacity: .28;
  }

  88% {
    opacity: .08;
  }

  100% {
    opacity: 0;
    transform: translateY(-110vh) rotate(25deg);
  }
}

/* ── Scene ─────────────────────────────────────── */
.scene {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}

.scene h1 {
  color: rgba(255, 185, 205, .48);
  margin-bottom: 12px;
}

.scene-title {
  font-size: 1.1rem;
  color: rgba(255, 185, 205, .45);
  letter-spacing: 3px;
  margin-bottom: 26px;
}

/* ── Jar wrapper ───────────────────────────────── */
.jar-wrap {
  position: relative;
  cursor: pointer;
}

/* Glow halo behind jar */
.jar-wrap::before {
  content: '';
  position: absolute;
  inset: -18%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(224, 85, 117, .18) 0%, transparent 70%);
  animation: haloBreath 3.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes haloBreath {

  0%,
  100% {
    opacity: .55;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.06);
  }
}

.jar-svg {
  width: min(195px, 46vw);
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 28px rgba(220, 70, 110, .35));
  transition: filter .3s ease, transform .15s ease;
}

.jar-wrap:hover .jar-svg {
  filter: drop-shadow(0 14px 44px rgba(220, 70, 110, .6));
}

.jar-wrap:active .jar-svg {
  transform: scale(.965);
}

/* Fill transition */
.jar-fill-rect {
  transition: y 1.3s cubic-bezier(.4, 0, .2, 1), height 1.3s cubic-bezier(.4, 0, .2, 1);
}

/* ── Hint & counter ────────────────────────────── */
.hint {
  margin-top: 22px;
  font-size: 1.1rem;
  color: rgba(255, 185, 205, .75);
  letter-spacing: 1.5px;
  animation: breathe 3.2s ease-in-out infinite;
}

@keyframes breathe {

  0%,
  100% {
    opacity: .55;
  }

  50% {
    opacity: 1;
  }
}

.counter {
  margin-top: 7px;
  font-size: .92rem;
  color: rgba(255, 185, 205, .55);
  letter-spacing: 1.5px;
  min-height: 1.1em;
  transition: color .5s;
}

/* ── Slip overlay ──────────────────────────────── */
.slip-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 2, 5, .72);
  backdrop-filter: blur(11px);
  -webkit-backdrop-filter: blur(11px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .45s ease;
}

.slip-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.slip-card {
  position: relative;
  background: linear-gradient(150deg, #fef9f5 0%, #feeef3 55%, #fde4ec 100%);
  border-radius: 9px;
  padding: 42px 30px 34px;
  width: min(310px, 86vw);
  text-align: center;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .44), 0 0 0 1.5px rgba(220, 80, 115, .16);
  opacity: 0;
  transform: scale(.6) rotate(-7deg) translateY(90px);
  transition:
    opacity .55s cubic-bezier(.34, 1.56, .64, 1),
    transform .55s cubic-bezier(.34, 1.56, .64, 1);
  overflow: hidden;
}

.slip-overlay.open .slip-card {
  opacity: 1;
  transform: scale(1) rotate(-1.5deg);
}

/* Ruled lines */
.slip-card::before {
  content: '';
  position: absolute;
  inset: 0;
  top: 50px;
  background: repeating-linear-gradient(180deg,
      transparent 0px, transparent 30px,
      rgba(196, 80, 110, .1) 30px, rgba(196, 80, 110, .1) 31px);
  pointer-events: none;
}

/* Left margin line */
.slip-card::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50px;
  width: 1px;
  background: rgba(196, 80, 110, .14);
}

.slip-label {
  position: relative;
  font-size: 1.5rem;
  color: rgba(140, 55, 80, .7);
  letter-spacing: 2.5px;
  margin-bottom: 16px;
  z-index: 1;
}

.slip-promise {
  position: relative;
  font-size: clamp(1.28rem, 4.4vw, 1.65rem);
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.55;
  z-index: 1;
  animation: textWobble 5s ease-in-out infinite;
}

@keyframes textWobble {

  0%,
  100% {
    transform: rotate(-.4deg);
  }

  50% {
    transform: rotate(.4deg);
  }
}

.slip-flower {
  display: block;
  font-size: 1.35rem;
  margin-top: 18px;
  position: relative;
  z-index: 1;
  animation: flowerSpin 4s ease-in-out infinite;
}

@keyframes flowerSpin {

  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }

  50% {
    transform: scale(1.16) rotate(10deg);
  }
}

.slip-back {
  display: inline-block;
  margin-top: 20px;
  font-size: 1.2rem;
  letter-spacing: 2px;
  color: rgba(140, 55, 80, .7);
  cursor: pointer;
  transition: color .2s;
  position: relative;
  z-index: 1;
}

.slip-back:hover {
  color: rgba(180, 30, 70, 1);
}

/* ── Final overlay ─────────────────────────────── */
.final-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, #3e0a1c 0%, #150410 100%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 2s ease;
}

.final-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.final-quote {
  font-size: clamp(1.4rem, 5vw, 2.6rem);
  color: #ffd4e0;
  text-align: center;
  line-height: 1.75;
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 1.6s ease .7s, transform 1.6s ease .7s;
}

.final-overlay.open .final-quote {
  opacity: 1;
  transform: translateY(0);
}

.final-hearts {
  margin-top: 26px;
  font-size: 2.4rem;
  opacity: 0;
  transition: opacity 1s ease 2.1s;
}

.final-overlay.open .final-hearts {
  opacity: 1;
  animation: heartPump 2s ease-in-out 3s infinite;
}

@keyframes heartPump {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.18);
  }
}

/* ── Burst hearts ──────────────────────────────── */
.burst {
  position: fixed;
  pointer-events: none;
  z-index: 201;
  animation: burstFly 1.9s ease-out forwards;
}

@keyframes burstFly {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(.5);
  }

  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(2);
  }
}