/* ==========================================================================
   ENGINE: KIDS  (Tema anak 0-10 tahun)
   Karakter: warna cerah, bentuk bulat, tipografi ramah, animasi balon
   yang naik + goyang lembut. Semua motion dimatikan bila reduce-motion.
   ========================================================================== */
.inv-engine-kids {
    --kids-1: #ff6b9d;
    --kids-2: #4ecdc4;
    --kids-3: #ffd93d;
    --kids-4: #6c5ce7;
    --kids-5: #95e1d3;
}

/* ---------- Latar playful ---------- */
.inv-engine-kids .inv-section {
    background-image:
        radial-gradient(circle at 12% 18%, rgba(255, 214, 224, .55) 0 42px, transparent 43px),
        radial-gradient(circle at 88% 72%, rgba(214, 240, 255, .5) 0 34px, transparent 35px);
    background-attachment: fixed;
}

/* ---------- Balon animasi (dekoratif + bisa dimeletuskan) ----------
   Catatan penting soal pointer-events:
     - .kd-balloons (layer) tetap pointer-events:none supaya area kosongnya
       TIDAK pernah menahan klik pengguna.
     - hanya .kd-balloon yang pointer-events:auto, jadi hanya balon itu sendiri
       yang bisa diklik. Teilchen dari ledakan dibikin pointer-events:none.
   Jangan diubah jadi auto di layer, atau tombol RSVP / "Buka Undangan"
   ikut tertahan dan tidak bisa diklik. */
.kd-balloons {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 900;
    overflow: hidden;
}
.kd-balloons.kd-playable .kd-balloon {
    pointer-events: auto;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
/* Fokus keyboard (aksesibilitas) */
.kd-balloons.kd-playable .kd-balloon:focus-visible {
    outline: 2px solid var(--inv-accent, #ffd93d);
    outline-offset: 4px;
    border-radius: 50%;
}
.kd-balloon {
    position: absolute;
    bottom: -14vh;             /* mulai dari bawah layar */
    opacity: .7;               /* cukup terasa, tapi tidak menutupi teks */
    will-change: transform;
    transform-origin: 50% 120%;
    animation: kd-rise linear infinite;
}
.kd-balloon.kd-hit { animation: none; opacity: 0; transition: none; }
.kd-balloon i {
    display: block;
    width: var(--bw, 34px);
    height: calc(var(--bw, 34px) * 1.24);
    border-radius: 50% 50% 48% 48%;
    background: var(--bcol, #ff6b9d);
    /* Kilau kecil supaya terlihat seperti balonLateks, bukan lingkaran datar. */
    box-shadow: inset -3px -4px 8px rgba(0, 0, 0, .12), inset 3px 4px 7px rgba(255, 255, 255, .45);
    position: relative;
}
.kd-balloon i::before {  /* simpul di bawah balon */
    content: "";
    position: absolute;
    left: 50%;
    bottom: -4px;
    width: 7px; height: 6px;
    margin-left: -3.5px;
    background: var(--bcol, #ff6b9d);
    border-radius: 0 0 60% 60%;
}
.kd-balloon i::after {   /* kilau putih */
    content: "";
    position: absolute;
    left: 24%; top: 18%;
    width: 26%; height: 18%;
    border-radius: 50%;
    background: rgba(255, 255, 255, .55);
    transform: rotate(-28deg);
}
.kd-balloon .kd-string {
    display: block;
    width: 1.5px;
    height: calc(var(--bw, 34px) * 1.6);
    margin: 0 auto;
    background: linear-gradient(180deg, rgba(120, 120, 140, .55), rgba(120, 120, 140, 0));
    transform-origin: 50% 0;
    animation: kd-string 1.6s ease-in-out infinite alternate;
}

@keyframes kd-rise {
    0%   { transform: translate3d(0, 0, 0) rotate(-6deg); }
    50%  { transform: translate3d(14px, -52vh, 0) rotate(6deg); }
    100% { transform: translate3d(-10px, -108vh, 0) rotate(-4deg); }
}
@keyframes kd-string {
    0%   { transform: rotate(-4deg); }
    100% { transform: rotate(4deg); }
}

/* ---------- Bintang twinkling ---------- */
.kd-stars {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 899;
    overflow: hidden;
}
.kd-star {
    position: absolute;
    color: #ffd93d;
    font-size: var(--ss, 15px);
    opacity: .55;
    animation: kd-twinkle 2.4s ease-in-out infinite;
}
@keyframes kd-twinkle {
    0%, 100% { opacity: .15; transform: scale(.7) rotate(0); }
    50%      { opacity: .7; transform: scale(1.1) rotate(18deg); }
}

/* ---------- Tipografi ramah anak ---------- */
.inv-engine-kids .inv-section-title,
.inv-engine-kids h1, .inv-engine-kids h2 {
    font-weight: 800;
    letter-spacing: .01em;
    text-shadow: 0 2px 0 rgba(255, 255, 255, .65);
}
.inv-engine-kids .inv-event-card,
.inv-engine-kids .inv-couple-card,
.inv-engine-kids .inv-rsvp-card {
    border-radius: 26px;
    border-width: 3px;
    box-shadow: 0 10px 0 rgba(0, 0, 0, .06);
}
/* Judul utama di cover diberi gradasi playful */
.inv-engine-kids .inv-cover-title {
    background: linear-gradient(96deg, var(--kids-1), var(--kids-4) 45%, var(--kids-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 0 rgba(255, 255, 255, .8));
}

/* Tombol membulat & menggembung saat ditekan (ramah jari kecil anak) */
.inv-engine-kids .btn,
.inv-engine-kids button.inv-open-inv {
    border-radius: 999px;
    font-weight: 800;
    letter-spacing: .02em;
    box-shadow: 0 5px 0 var(--kids-4);
    transition: transform .12s ease, box-shadow .12s ease;
}
.inv-engine-kids .btn:active,
.inv-engine-kids button.inv-open-inv:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 var(--kids-4);
}

/* ---------- Confetti pada RSVP berhasil ---------- */
.kd-confetti-bit {
    position: fixed;
    z-index: 3000;
    width: 8px; height: 11px;
    border-radius: 2px;
    pointer-events: none;
    animation: kd-confetti-fall 1.5s cubic-bezier(.25, .6, .4, 1) forwards;
}
@keyframes kd-confetti-fall {
    0%   { transform: translate3d(0, 0, 0) rotate(0); opacity: 1; }
    100% { transform: translate3d(var(--cx, 0), 105vh, 0) rotate(var(--cr, 540deg)); opacity: 0; }
}

/* ---------- Efek meletus: pecahan lateks ---------- */
/* Serpihan dibuat di layer terpisah (pointer-events:none) supaya tidak
   pernah menahan klik, dan dihapus otomatis oleh JS setelah animasi. */
.kd-shards {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 950;
    overflow: hidden;
}
.kd-shard {
    position: absolute;
    will-change: transform, opacity;
    animation: kd-shard-fly .62s cubic-bezier(.2, .7, .35, 1) forwards;
}
@keyframes kd-shard-fly {
    0%   { transform: translate3d(0, 0, 0) rotate(0) scale(1);   opacity: 1; }
    100% { transform: translate3d(var(--sx), var(--sy), 0) rotate(var(--sr)) scale(.35); opacity: 0; }
}

/* Riak/ring expand saat pecah */
.kd-ripple {
    position: absolute;
    width: 10px; height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    border: 2px solid var(--rc, #ff6b9d);
    animation: kd-ripple-out .45s ease-out forwards;
}
@keyframes kd-ripple-out {
    0%   { transform: scale(.4); opacity: .85; }
    100% { transform: scale(5.5); opacity: 0; }
}

/* Teks skor "+1" melayang ke atas */
.kd-score {
    position: absolute;
    font-weight: 800;
    font-size: 15px;
    color: var(--rc, #ff6b9d);
    text-shadow: 0 1px 3px rgba(255, 255, 255, .9);
    animation: kd-score-up .8s ease-out forwards;
    white-space: nowrap;
}
@keyframes kd-score-up {
    0%   { transform: translate(-50%, 0) scale(.6); opacity: 0; }
    30%  { transform: translate(-50%, -14px) scale(1.15); opacity: 1; }
    100% { transform: translate(-50%, -52px) scale(1); opacity: 0; }
}

/* Tombol kecil penghitung di pojok kiri-bawah */
.kd-counter {
    position: fixed;
    left: 12px;
    bottom: 12px;
    z-index: 960;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .16);
    font-weight: 800;
    font-size: 13px;
    color: #3a2f4a;
    pointer-events: none;
    user-select: none;
}
.kd-balloons.kd-playable ~ .kd-counter,
.kd-counter.is-on { display: inline-flex; }
.kd-counter i { color: #ff4d6d; }

/* ---------- Motif mengambang per tema (roket, kucing, polisi, dokter) ----------
   Muncul hanya jika <body data-kids-motif="space|animals|police|doctor">.
   Murni dekoratif (pointer-events:none) supaya tidak menahan klik tamu. */
.kd-motifs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 895;
    overflow: hidden;
}
.kd-motif {
    position: absolute;
    bottom: -12vh;
    color: var(--mc, #ff6b9d);
    font-size: var(--ms, 24px);
    opacity: .5;
    will-change: transform;
    animation: kd-motif-rise linear infinite;
    text-shadow: 0 2px 6px rgba(255, 255, 255, .35);
}
@keyframes kd-motif-rise {
    0%   { transform: translate3d(0, 0, 0) rotate(-10deg); }
    100% { transform: translate3d(var(--mx, 0), -116vh, 0) rotate(10deg); }
}

/* ---------- Hormati preferensi pengguna ---------- */
@media (prefers-reduced-motion: reduce) {
    .kd-balloons, .kd-stars, .kd-motifs { display: none; }
    .kd-confetti-bit, .kd-shards, .kd-counter { display: none; }
}
@media print {
    .kd-balloons, .kd-stars, .kd-motifs, .kd-shards, .kd-counter { display: none; }
}
