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

:root {
  --navy: #1b1f3b;
  --navy2: #232a52;
  --gold: #f5c542;
  --gold-soft: #ffe9a8;
  --cream: #fff8ec;
  --ink: #2b2350;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy2) 45%, #2c1e4f 75%, #1b1230 100%);
  color: var(--cream);
  overflow-x: hidden;
}

h1, h2 { font-family: 'Playfair Display', serif; }

section { padding: 48px 18px; }

#scrollProgress {
  position: fixed; top: 0; left: 0; height: 4px; width: 0%;
  background: linear-gradient(90deg, var(--gold), #ffd97a);
  z-index: 99; transition: width .1s linear;
}

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }
.d1 { transition-delay: .12s; }
.d2 { transition-delay: .24s; }
.d3 { transition-delay: .36s; }

/* tombol musik */
#musicBtn {
  position: fixed; top: 14px; right: 14px; z-index: 97;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgba(245,197,66,.55);
  background: rgba(27,31,59,.75);
  color: var(--gold); font-size: 1.15rem;
  cursor: pointer; backdrop-filter: blur(4px);
}
#musicBtn.playing { animation: pulse 1.4s infinite; }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(245,197,66,.4); }
  50% { box-shadow: 0 0 0 8px rgba(245,197,66,0); }
}

/* ============ HERO ============ */
.hero {
  min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
  position: relative; text-align: center; padding: 32px 20px 56px;
}
.hero-inner { position: relative; z-index: 2; max-width: 520px; }

.hero-kicker {
  color: var(--gold); letter-spacing: .32em;
  font-size: .78rem; margin-bottom: 12px; text-transform: uppercase;
}
.hero-title { line-height: 1.18; }
.hero-title span { display: block; }
.hero-title > span:first-child { font-size: clamp(1.25rem, 4.6vw, 1.9rem); font-weight: 600; color: #dfe3ff; }
.hero-name {
  font-size: clamp(2rem, 8.5vw, 3.4rem);
  font-weight: 800;
  background: linear-gradient(90deg, var(--gold), #ffd97a, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-top: 4px;
}

.hero-age {
  margin-top: 20px;
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(245,197,66,.35);
  border-radius: 18px;
  padding: 14px 34px;
}
.age-num {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.3rem, 9vw, 3.4rem);
  font-weight: 800; color: var(--gold); line-height: 1.1;
}
.age-label { font-size: .85rem; color: #cdd3f7; }

.hero-scroll {
  margin-top: 26px; color: #aab3e8; font-size: .85rem;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.mouse {
  width: 24px; height: 38px;
  border: 2px solid #aab3e8; border-radius: 14px;
  display: inline-block; position: relative;
}
.wheel {
  position: absolute; left: 50%; top: 7px;
  width: 4px; height: 8px; margin-left: -2px;
  background: var(--gold); border-radius: 3px;
  animation: wheel 1.6s infinite;
}
@keyframes wheel {
  0% { opacity: 1; transform: translateY(0); }
  70% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 0; }
}
.hero-fade {
  position: absolute; bottom: 0; left: 0; right: 0; height: 110px;
  background: linear-gradient(180deg, transparent, rgba(35,42,82,.9));
  pointer-events: none;
}

.balloons-bg { position: absolute; inset: 0; overflow: hidden; z-index: 1; }
.bg-balloon {
  position: absolute; bottom: -120px;
  animation: floatUp linear infinite;
}
@keyframes floatUp { to { transform: translateY(-130vh) rotate(8deg); } }

/* ============ STORY ============ */
.story {
  max-width: 520px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 18px;
}
.story-card {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 18px;
  padding: 24px 20px;
  text-align: center;
}
.story-num {
  display: inline-block;
  font-family: 'Playfair Display', serif;
  color: var(--gold); font-size: 1rem; letter-spacing: .3em;
  margin-bottom: 8px;
}
.story-card h2 { color: var(--gold); font-size: 1.35rem; margin-bottom: 8px; }
.story-card p { color: #d9ddf5; line-height: 1.75; font-weight: 300; font-size: .95rem; }

.quote {
  text-align: center;
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: 1.1rem; color: var(--gold-soft);
  padding: 14px 6px 0; line-height: 1.7;
}
.quote-src { display: block; font-size: .75rem; color: #9aa3d8; margin-top: 8px; font-family: 'Poppins', sans-serif; font-style: normal; }

/* ============ GAME UMUM ============ */
.game { text-align: center; }
.game-inner { max-width: 520px; margin: 0 auto; }
.game h2 { color: var(--gold); font-size: 1.5rem; margin-bottom: 6px; }
.game-sub { color: #c7cdf1; margin-bottom: 16px; font-size: .92rem; }

.game-hud { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.hud-item {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px; padding: 7px 16px; font-size: .85rem;
}
.hud-item b { color: var(--gold); }

.game-arena {
  position: relative;
  height: min(52vh, 400px);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(110,198,255,.10), rgba(123,255,178,.06));
  border: 1px dashed rgba(255,255,255,.22);
  overflow: hidden;
  touch-action: manipulation;
}
.arena-msg {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(20,24,48,.55);
  transition: opacity .3s;
}
.arena-msg.hidden { opacity: 0; pointer-events: none; }
.arena-hint { color: #aab3e8; font-size: .85rem; }
.game-done { margin-top: 14px; color: #7bffb2; font-weight: 600; font-size: .95rem; }

/* balon game */
.balloon {
  position: absolute;
  width: 48px; height: 60px;
  border-radius: 50% 50% 50% 50% / 46% 46% 54% 54%;
  cursor: pointer; z-index: 2;
  animation: riseY linear forwards;
  box-shadow: inset -7px -9px 0 rgba(0,0,0,.12);
}
.balloon::after {
  content: ''; position: absolute; bottom: -13px; left: 50%;
  width: 2px; height: 14px;
  background: rgba(255,255,255,.55);
  transform: translateX(-50%);
}
.balloon::before {
  content: ''; position: absolute; top: 11px; left: 10px;
  width: 11px; height: 16px; border-radius: 50%;
  background: rgba(255,255,255,.45);
  transform: rotate(20deg);
}
@keyframes riseY {
  from { transform: translateY(0) rotate(-2deg); }
  to   { transform: translateY(-440px) rotate(3deg); }
}
.pop { position: absolute; pointer-events: none; font-size: 1.5rem; animation: popAnim .5s ease-out forwards; z-index: 3; }
@keyframes popAnim { 0% { transform: scale(.4); opacity: 1; } 100% { transform: scale(2.1); opacity: 0; } }

/* ============ GAME 2: MEMORY ============ */
.game2 { padding-top: 24px; }
.mem-board {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px; max-width: 400px; margin: 4px auto 0;
}
.mem-card { aspect-ratio: 3/4; perspective: 600px; cursor: pointer; }
.mem-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform .4s;
}
.mem-card.flip .mem-inner { transform: rotateY(180deg); }
.mem-face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
}
.mem-front {
  background: linear-gradient(160deg, #262d5c, #1b1f3b);
  border: 1px solid rgba(245,197,66,.4);
  color: var(--gold);
  font-family: 'Playfair Display', serif; font-size: 1.3rem;
}
.mem-back {
  background: var(--cream);
  border: 1px solid #e0d5b8;
  color: var(--ink);
  transform: rotateY(180deg);
}
.mem-card.matched { pointer-events: none; }
.mem-card.matched .mem-back { border-color: var(--gold); box-shadow: 0 0 12px rgba(245,197,66,.45); }
.mem-card.matched .mem-inner { animation: matchPop .45s ease; }
@keyframes matchPop { 50% { transform: rotateY(180deg) scale(1.1); } }

/* ============ KUE ============ */
.cake-section { text-align: center; }
.cake-section h2 { color: var(--gold); font-size: 1.5rem; margin-bottom: 6px; }
.cake-sub { color: #c7cdf1; margin-bottom: 26px; font-size: .92rem; }
.cake-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }

.cake { position: relative; width: 210px; margin-top: 70px; }
.plate {
  width: 260px; height: 18px; margin: 0 auto;
  background: linear-gradient(180deg, #f3f4ff, #c9cdf0);
  border-radius: 0 0 40px 40px / 0 0 20px 20px;
  box-shadow: 0 16px 26px rgba(0,0,0,.4);
}
.layer { margin: 0 auto; border-radius: 10px; position: relative; }
.layer-top { width: 140px; height: 48px; background: linear-gradient(180deg, #ffd9e8, #ff9dc0); }
.layer-mid { width: 175px; height: 52px; background: linear-gradient(180deg, #fff1cf, #ffd98a); margin-top: -4px; }
.layer-bottom { width: 210px; height: 56px; background: linear-gradient(180deg, #d9c6ff, #b79bff); margin-top: -4px; }
.layer::after {
  content: ''; position: absolute; top: 7px; left: 10px; right: 10px; height: 8px;
  border-radius: 8px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.65) 0 12px, transparent 12px 22px);
}
.candles {
  position: absolute; bottom: 100%; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 20px; margin-bottom: -5px;
}
.candle {
  position: relative; width: 10px; height: 38px;
  border-radius: 3px;
  background: repeating-linear-gradient(45deg, #fff 0 5px, #ff8fb3 5px 10px);
}
.candle .wick { position: absolute; top: -7px; left: 50%; width: 2px; height: 7px; background: #555; transform: translateX(-50%); }
.candle .flame {
  position: absolute; top: -22px; left: 50%;
  width: 12px; height: 19px;
  background: radial-gradient(ellipse at 50% 70%, #fff3b0 0%, #ffb340 55%, #ff7b25 100%);
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  transform: translateX(-50%);
  transform-origin: 50% 100%;
  animation: flicker .35s infinite alternate;
  box-shadow: 0 0 16px 5px rgba(255,170,60,.45);
  transition: opacity .3s, transform .3s;
}
@keyframes flicker {
  from { transform: translateX(-50%) scale(1) skewX(-3deg); }
  to   { transform: translateX(-50%) scale(1.12) skewX(4deg); }
}
.candle.out .flame { opacity: 0; transform: translateX(-50%) scale(.2); }
.smoke {
  position: absolute; top: -26px; left: 50%;
  font-size: .8rem; opacity: 0;
  animation: smokeUp 1.2s ease-out forwards;
  pointer-events: none;
}
@keyframes smokeUp {
  0% { opacity: .8; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-40%, -30px) scale(1.6); }
}
.wish-hint { color: #aab3e8; font-size: .88rem; min-height: 1.4em; }

/* ============ TOMBOL ============ */
.btn {
  font-family: 'Poppins', sans-serif;
  font-size: .95rem; font-weight: 600;
  color: #4a2c00;
  background: linear-gradient(135deg, var(--gold), #ffd97a);
  border: none; border-radius: 999px;
  padding: 12px 30px; cursor: pointer;
  box-shadow: 0 8px 20px rgba(245,197,66,.35);
  transition: transform .15s ease;
  user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.96); }
.blow-btn { touch-action: none; }

/* ============ FINALE ============ */
.finale { text-align: center; }
.finale-card {
  max-width: 520px; margin: 0 auto;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(245,197,66,.3);
  border-radius: 22px;
  padding: 30px 22px;
}
.finale-card h2 { color: var(--gold); font-size: 1.6rem; margin-bottom: 12px; }
.finale-text { color: #dfe3f8; line-height: 1.85; font-weight: 300; margin-bottom: 16px; font-size: .95rem; }
.finale-sign { color: var(--gold-soft); line-height: 1.6; margin-bottom: 20px; }
.finale footer {
  margin-top: 34px; font-size: .7rem; letter-spacing: .25em; color: #7d86bd;
}
.finale footer sup { letter-spacing: 0; }

#confettiCanvas { position: fixed; inset: 0; pointer-events: none; z-index: 98; }

/* ============ DESKTOP: tetap rapi ============ */
@media (min-width: 700px) {
  section { padding: 64px 20px; }
  .hero-inner, .story, .game-inner, .finale-card { max-width: 600px; }
  .cake { width: 240px; }
  .plate { width: 300px; }
}
