@font-face {
  font-family: "Death Bones";
  src: url("font/Death_Bones.ttf") format("truetype");
  font-display: swap
}

:root {
  --wh: clamp(44px, 6vw, 64px);
  --sh: clamp(100px, 24vw, 260px);
  --pw: clamp(84px, 17vw, 180px);
  --or: #f26a0f;
  --bk: #000;
  --pu: #4b1d8f;
  --ye: #ffd23f
}

* {
  box-sizing: border-box
}

[hidden] {
  display: none !important
}

html {
  scroll-behavior: smooth
}

body {
  margin: 0;
  background: var(--bk);
  color: #fff;
  font-family: 'Special Elite', Georgia, serif;
  overflow-x: hidden
}

h1,
h2,
h3 {
  font-family: Creepster, cursive;
  font-weight: 400;
  letter-spacing: .05em;
  margin: 0 0 .6rem;
  line-height: 1.1
}

h1 {
  font-size: clamp(2rem, 8vw, 3.6rem);
  color: #fff
}

h1 span {
  color: var(--or)
}

h2 {
  font-size: clamp(1.9rem, 7vw, 3.2rem)
}

.o {
  background: var(--or);
  --fg: #fff;
  --sil: #000;
  --eye: var(--ye)
}

.k {
  background: var(--bk);
  --fg: var(--or);
  --sil: #3a1670;
  --eye: var(--or)
}

.sec {
  position: relative;
  overflow: hidden;
  min-height: 100dvh;
  padding: 3.5rem 1rem 5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: .8rem;
  color: #fff
}

.sec>*,
.ground>* {
  position: relative;
  z-index: 2
}

.sec h2 {
  color: var(--fg)
}

.sub {
  opacity: .9;
  margin: 0
}

.fade {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 1s, transform 1s
}

.fade.in {
  opacity: 1;
  transform: none
}

.btn {
  font: inherit;
  font-size: 1.05rem;
  padding: .7rem 1.5rem;
  border: 3px solid var(--or);
  background: var(--bk);
  color: var(--or);
  border-radius: 999px;
  cursor: pointer
}

.o .btn {
  border-color: var(--bk);
  background: var(--bk);
  color: var(--or)
}

.btn:active {
  transform: scale(.96)
}

#cur {
  position: fixed;
  width: 38px;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-20%, -20%)
}

.deco {
  position: absolute;
  z-index: 0;
  pointer-events: none
}

svg.deco {
  color: var(--sil)
}

svg.sil {
  position: absolute;
  color: #000
}

/* intro */
#start {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1rem;
  padding: 2rem 1rem;
  text-align: center
}

#lines {
  font-family: Creepster, cursive;
  font-size: clamp(1.8rem, 7vw, 3.2rem);
  color: var(--or);
  min-height: 5rem
}

#lines p {
  margin: 0;
  animation: fin 1s both
}

@keyframes fin {
  from {
    opacity: 0;
    transform: scale(.9)
  }

  to {
    opacity: 1
  }
}

#pumpkin {
  all: unset;
  cursor: pointer;
  width: min(60vw, 260px);
  animation: float 3s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent
}

#pumpkin svg {
  width: 100%
}

.eyes {
  animation: blink 1.4s steps(1) infinite
}

@keyframes blink {

  0%,
  100% {
    opacity: 1
  }

  45%,
  55% {
    opacity: 0
  }
}

@keyframes float {
  50% {
    transform: translateY(-10px)
  }
}

.hint {
  color: var(--or);
  margin: 0;
  animation: blink 1.6s steps(1) infinite
}

/* bloom */
#bloom {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none
}

#bloom.go {
  visibility: visible;
  pointer-events: auto
}

.flower {
  position: absolute;
  left: var(--x);
  top: var(--y);
  translate: -50% -50%;
  width: var(--size);
  opacity: 0;
  pointer-events: none;
  user-select: none
}

#bloom.go .flower {
  animation: bloom 1.3s var(--d) cubic-bezier(.2, 1.3, .4, 1) both
}

@keyframes bloom {
  from {
    transform: scale(0) rotate(calc(var(--r)*-1));
    opacity: 0
  }

  to {
    transform: scale(var(--s)) rotate(0);
    opacity: 1
  }
}

#bloom.open .flower {
  animation: leave 1s calc(var(--d)*.4) ease-in both
}

@keyframes leave {
  from {
    transform: scale(var(--s));
    opacity: 1
  }

  to {
    transform: scale(calc(var(--s)*1.8)) rotate(var(--r));
    opacity: 0
  }
}

.bat {
  position: fixed;
  top: -60px;
  z-index: 50;
  pointer-events: none;
  animation: fly var(--t) linear forwards
}

@keyframes fly {
  to {
    transform: translate(var(--dx), 110vh) rotate(25deg)
  }
}

/* hero (seperti video: langit oranye, bulan, bukit hitam) */
#hero {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bk)
}

.scene {
  position: relative;
  flex: 1;
  min-height: 44dvh;
  overflow: hidden
}

.moon {
  position: absolute;
  left: 50%;
  top: 8%;
  translate: -50% 0;
  width: min(46vw, 200px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--ye);
  animation: rise 1.4s both
}

.h1 {
  left: 0;
  bottom: 0;
  width: min(44vw, 240px);
  height: auto;
  aspect-ratio: 120/140;
  animation: rise 1.6s .5s both
}

.h2 {
  left: 24%;
  bottom: 0;
  width: min(30vw, 160px);
  height: auto;
  aspect-ratio: 120/140;
  animation: rise 1.6s .8s both
}

.h3 {
  right: 36%;
  bottom: 0;
  width: min(26vw, 140px);
  height: auto;
  aspect-ratio: 120/140;
  animation: rise 1.6s .9s both
}

.t1 {
  right: -2%;
  bottom: 0;
  width: min(46vw, 270px);
  height: auto;
  aspect-ratio: 1;
  animation: rise 1.6s .7s both
}

.t2 {
  right: 20%;
  bottom: 0;
  width: min(34vw, 190px);
  height: auto;
  aspect-ratio: 1;
  animation: rise 1.6s 1s both
}

@keyframes rise {
  from {
    transform: translateY(70px);
    opacity: 0
  }

  to {
    transform: none;
    opacity: 1
  }
}

.ground {
  position: relative;
  overflow: hidden;
  flex: none;
  margin-top: -28px;
  background: var(--bk);
  border-radius: 50% 50% 0 0/36px 36px 0 0;
  padding: 1.8rem 1rem 4.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .8rem;
  --sil: #3a1670;
  --eye: var(--or)
}

.ground .sub {
  color: #ddd
}

/* jam berhantu */
.clock {
  position: relative;
  display: flex;
  gap: .6rem;
  padding: 1.6rem 1.2rem 1rem;
  border: 6px double #8a5a2b;
  border-radius: 30px 30px 8px 8px;
  background: #140c06;
  max-width: 100%;
  animation: flick 5s steps(1) infinite
}

.clock div {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px
}

.clock b {
  font-family: Eater, cursive;
  font-weight: 400;
  font-size: clamp(1.8rem, 8vw, 3rem);
  color: var(--or);
  animation: shake 4s steps(1) infinite
}

.clock i {
  font-style: normal;
  font-size: .8rem;
  color: #d9b27a
}

.web {
  position: absolute;
  top: 0;
  left: 0;
  width: 46px;
  height: 46px
}

.web.r {
  left: auto;
  right: 0;
  transform: scaleX(-1)
}

.cg {
  position: absolute;
  top: -52px;
  left: 12%;
  width: 40px;
  height: 54px;
  color: #eee;
  --eye: #000;
  animation: haunt 7s ease-in-out infinite
}

@keyframes haunt {

  0%,
  100% {
    transform: translate(0, 0)
  }

  25% {
    transform: translate(120px, -8px)
  }

  50% {
    transform: translate(220px, 4px) scaleX(-1)
  }

  75% {
    transform: translate(90px, -10px) scaleX(-1)
  }
}

@keyframes flick {

  0%,
  100% {
    opacity: 1
  }

  92% {
    opacity: .35
  }

  94% {
    opacity: 1
  }

  96% {
    opacity: .5
  }
}

@keyframes shake {

  0%,
  100% {
    transform: none
  }

  90% {
    transform: translate(-3px, 2px) skewX(8deg)
  }

  95% {
    transform: translate(3px, -2px)
  }
}

/* HAPPY BIRTHDAY + kue */
.candle {
  cursor: pointer
}

.flame {
  transform-origin: center bottom;
  animation: flk .5s ease-in-out infinite alternate
}

.candle.off .flame {
  display: none
}

.candle.off .smoke {
  animation: smoke 1.6s forwards
}

.smoke {
  opacity: 0
}

@keyframes flk {
  to {
    transform: scale(1.15, .9) rotate(4deg)
  }
}

@keyframes smoke {
  0% {
    opacity: .8
  }

  100% {
    opacity: 0;
    transform: translateY(-40px)
  }
}

/* surat: kertas putih bergerigi seperti undangan */
#paper {
  position: relative;
  width: min(94vw, 540px);
  padding: 2.4rem 1.8rem 4.8rem;
  margin: 1.5rem 0;
  color: #2a2230;
  background: #fff;
  -webkit-mask: radial-gradient(circle 8px at 8px 8px, #0000 98%, #000) -8px -8px;
  mask: radial-gradient(circle 8px at 8px 8px, #0000 98%, #000) -8px -8px;
  animation: fin .9s both
}

#paper h3 {
  font-size: 2.2rem;
  color: var(--or)
}

#paper p {
  white-space: pre-line;
  line-height: 1.6;
  text-align: left;
  margin: 0
}

#paper img {
  position: absolute;
  z-index: 1
}

.p1 {
  width: 84px;
  top: -6px;
  right: -8px;
  transform: rotate(14deg)
}

.p2 {
  width: 56px;
  bottom: -4px;
  left: 2px
}

.p3 {
  width: 60px;
  bottom: -4px;
  right: 6px
}

#paper h3,
#paper p {
  position: relative;
  z-index: 2
}

/* galeri */
#frames {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  width: min(96vw, 760px)
}

.fr {
  aspect-ratio: 3/4;
  padding: 12px;
  background: #000;
  border: 3px solid #6b3a12;
  border-radius: 6px 6px 40px 40px;
  outline: 3px solid #4b1d8f
}

.fr div {
  width: 100%;
  height: 100%;
  background: #1a0f08 center/cover;
  filter: sepia(.7) contrast(1.1) brightness(.85);
  border-radius: 4px 4px 30px 30px;
  display: grid;
  place-content: center;
  font-size: 2rem
}

/* game */
#cv {
  width: min(92vw, 360px);
  height: auto;
  touch-action: none;
  border: 3px solid var(--or);
  border-radius: 12px;
  background: #000
}

/* wish */
#wt {
  font-family: Creepster, cursive;
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  color: #fff;
  max-width: 92vw;
  min-height: 12rem;
  white-space: pre-line;
  line-height: 1.3
}

/* musik */
#music {
  position: fixed;
  right: 10px;
  bottom: 10px;
  z-index: 9000;
  display: flex;
  gap: 6px
}

#music button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--or);
  background: var(--bk);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer
}

#music.min #mt {
  display: none
}

#music.min {
  opacity: .6
}

@media(prefers-reduced-motion:reduce) {
  * {
    animation-duration: .01s !important
  }
}

@media(pointer:coarse) {
  #cur {
    display: none
  }
}

/* gelombang gradient, kelelawar, laba-laba */
.wave {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 70px;
  z-index: 1;
  pointer-events: none
}

.bt {
  position: absolute;
  left: 0;
  z-index: 1;
  pointer-events: none;
  animation: batx var(--t) linear infinite
}

.bt img {
  display: block;
  animation: flap .35s ease-in-out infinite alternate
}

@keyframes batx {
  0% {
    transform: translate(-15vw, 0)
  }

  25% {
    transform: translate(25vw, -30px)
  }

  50% {
    transform: translate(55vw, 20px)
  }

  75% {
    transform: translate(85vw, -25px)
  }

  100% {
    transform: translate(115vw, 0)
  }
}

@keyframes flap {
  to {
    transform: scaleY(.55)
  }
}

.sp {
  position: absolute;
  top: 0;
  z-index: 1;
  pointer-events: none;
  animation: spud var(--t) ease-in-out infinite alternate
}

.sp::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 2px;
  height: 100dvh;
  margin-left: -1px;
  background: #000
}

.sp svg {
  display: block;
  width: 34px;
  height: 34px;
  color: #000
}

@keyframes spud {
  from {
    transform: translateY(-34px)
  }

  to {
    transform: translateY(var(--drop))
  }
}

@media(prefers-reduced-motion:reduce) {

  .bt,
  .sp {
    display: none
  }
}

/* HAPPY BIRTHDAY + kue (gaya gambar referensi) */
.bd {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: center;
  align-items: center;
  gap: clamp(1rem, 4vw, 3.5rem);
  width: min(96vw, 820px)
}

.bd h2 {
  font-family: 'Death Bones', 'Almendra Display', Creepster, cursive;
  font-size: clamp(2.8rem, 10vw, 5.8rem);
  text-align: center;
  color: #fff;
  margin: 0;
  letter-spacing: .02em;
  text-transform: uppercase;
  line-height: .95;
  text-shadow: 0 4px 0 rgba(0, 0, 0, .35)
}

.bd h2 span {
  display: block
}

.hb1,
.hb2 {
  font-size: 1em
}

.hb3 {
  position: relative;
  display: inline-block !important;
  font-size: .62em;
  color: #5b2aa6;
  text-shadow: none;
  margin-top: -.05em;
  line-height: 1;
  padding: 0 2.2em
}

.hb3::before,
.hb3::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 1.5em;
  height: .8em;
  margin-top: -.4em;
  background: var(--bat) center/contain no-repeat
}

.hb3::before {
  left: 0
}

.hb3::after {
  right: 0;
  transform: scaleX(-1)
}

.bc {
  display: flex;
  flex-direction: column;
  align-items: center
}

.hint2 {
  font-family: 'Caveat Brush', cursive;
  font-size: clamp(1.3rem, 6vw, 1.8rem);
  color: #000;
  margin: .5rem 0 0;
  transform: rotate(-3deg)
}

#cake {
  width: min(80vw, 320px)
}

#cake svg {
  width: 100%;
  overflow: visible
}

.flame {
  transform-box: fill-box
}

.dh {
  left: 1%;
  bottom: 0;
  width: 130px;
  height: 152px
}

.dg {
  right: 5%;
  bottom: 14%;
  width: 56px;
  height: 75px
}

#toWish {
  margin-top: .4rem
}

@media(max-width:640px) {
  :root {
    --wh: clamp(44px, 6vw, 64px);
    --sh: clamp(100px, 24vw, 260px);
    --pw: 56px
  }

  .bd {
    grid-template-columns: 1fr;
    text-align: center;
    gap: .4rem
  }

  .bd h2 {
    text-align: center
  }

  .dh {
    width: 84px;
    height: 98px
  }

  .dg {
    width: 38px;
    height: 51px
  }

  .scene {
    min-height: 40dvh
  }
}

/* dua siluet PNG kiri & kanan; wave setinggi siluet */
.sec.o {
  padding-bottom: calc(var(--sh)*.6)
}

.sec.o .wave {
  height: var(--wh)
}

img.strip {
  position: absolute;
  bottom: calc(var(--wh)*.2);
  height: var(--sh);
  width: auto;
  max-width: 50%;
  object-fit: cover;
  z-index: 1;
  pointer-events: none
}

img.strip.lf {
  left: 0;
  object-position: left bottom
}

img.strip.rt {
  right: 0;
  object-position: right bottom
}

/* labu tap: mata, hidung, mulut menyala hitam > kuning > oranye */
#pumpkin {
  position: relative;
  width: min(70vw, 320px)
}

#pumpkin img {
  display: block;
  width: 100%;
  height: auto
}

.glow {
  position: absolute;
  inset: 0;
  background: #000;
  -webkit-mask: url(img/tap-glow.png) center/100% 100% no-repeat;
  mask: url(img/tap-glow.png) center/100% 100% no-repeat;
  animation: glow 2.4s ease-in-out infinite;
  filter: drop-shadow(0 0 10px #ffa000)
}

@keyframes glow {

  0%,
  100% {
    background: #000
  }

  35% {
    background: #ffd23f
  }

  70% {
    background: #f26a0f
  }
}

/* wave di bawah siluet: lebih tinggi di tablet & mobile */
@media(max-width:1024px) {
  :root {
    --wh: clamp(64px, 12vw, 100px)
  }
}

/* ikon tombol */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:.5em}
.ic{width:1.2em;height:1.2em;flex:none}
#music button{display:grid;place-items:center;padding:0}
#music .ic{width:22px;height:22px}
