/* Boneka — ucapan hari jadi (monthsary & anniversary): boneka beruang 3D yang mengucapkan pesan per balon tiap diketuk. */
@font-face { font-family: "Fredoka"; src: url("fonts/fredoka.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("fonts/nunito.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }

/* --fur, --fur-light, --accent juga dibaca boneka.js untuk warna boneka 3D. */
:root { --bg: #fff3e4; --bg2: #ffdcc0; --ink: #4a2f1f; --soft: #9a7a66; --accent: #e5484d; --card: #ffffff; --line: #f1d5bd; --fur: #b9824f; --fur-light: #f0d6b3; --btn-ink: #ffffff; --round: "Fredoka", system-ui, sans-serif; --sans: "Nunito", system-ui, sans-serif; }

/* Tone warna (field "tone"): cokelat = bawaan di atas. */
:root[data-tone="krem"] { --bg: #ffe9ee; --bg2: #ffcfdc; --ink: #5a2a3c; --soft: #a3728a; --accent: #e85d8a; --line: #f7c3d2; --fur: #f1dcc0; --fur-light: #fff6ea; }
:root[data-tone="abu"] { --bg: #e9f1fb; --bg2: #cfe0f6; --ink: #24354d; --soft: #6c7f99; --accent: #3b82f6; --line: #c3d5ee; --fur: #aab4c4; --fur-light: #eef2f7; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(90% 55% at 50% 62%, var(--bg2) 0%, var(--bg) 70%) fixed; color: var(--ink); font: 600 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { max-width: 100%; display: block; }
h2, p { margin: 0; }
h2 { font: 600 28px/1.15 var(--round); }
em { font-style: normal; color: var(--accent); }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.js-only { display: none; }
.js .js-only { display: flex; }

/* Adegan 3D: kanvas menempel di layar, isi halaman bergulir di atasnya. Tanpa WebGL kanvas tetap tak terlihat. */
.scene { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; opacity: 0; transition: opacity .9s ease; }
.gl .scene { opacity: 1; }
main, footer { position: relative; z-index: 1; }
main { max-width: 480px; margin: 0 auto; padding: 0 22px; }

/* Satu layar: balon ucapan di atas, boneka di tengah, tombol di bawah. */
.stage { min-height: 100vh; min-height: 100svh; padding: 40px 0 28px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.js .stage { cursor: pointer; }
.kicker { padding: 6px 14px; border-radius: 999px; background: var(--card); box-shadow: 0 4px 0 var(--line); font: 600 13px/1.3 var(--round); letter-spacing: .04em; color: var(--accent); }
.bubble { position: relative; width: 100%; min-height: 132px; padding: 20px 22px; border-radius: 28px; background: var(--card); box-shadow: 0 6px 0 var(--line); display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -13px; width: 26px; height: 26px; margin-left: -13px; background: var(--card); border-radius: 0 0 8px 0; transform: rotate(45deg); box-shadow: 5px 5px 0 var(--line); }
.hello { font: 600 26px/1.2 var(--round); color: var(--accent); }
.msg { font: 500 20px/1.4 var(--round); white-space: pre-line; overflow-wrap: anywhere; }
.line { font: 500 22px/1.35 var(--round); overflow-wrap: anywhere; animation: muncul .35s cubic-bezier(.3, 1.4, .5, 1) both; }
.final { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.count { font: 500 22px/1.1 var(--round); }
.count b { display: block; font: 700 76px/.95 var(--round); color: var(--accent); }
.closing { font-size: 16px; color: var(--soft); }
.names { display: inline-flex; align-items: center; gap: 8px; font: 600 16px/1.2 var(--round); overflow-wrap: anywhere; }
.names svg { flex: none; width: 15px; height: 14px; color: var(--accent); }
/* Dengan JS balon menampilkan satu baris tiap ketukan; tanpa JS semua isi balon tampil sekaligus. */
.js .bubble > .hello, .js .bubble > .msg { display: none; }
.js .bubble > .final { display: none; }
.js .done .bubble > .final { display: flex; animation: muncul .45s cubic-bezier(.3, 1.4, .5, 1) both; }
.js .done .bubble > .line { display: none; }

.stagebox { flex: 1 1 auto; width: 100%; min-height: 260px; display: grid; place-items: center; }
.icon { width: 190px; height: 190px; color: var(--fur); animation: goyang 2.4s ease-in-out infinite; }
.gl .icon { visibility: hidden; } /* diganti boneka 3D di kanvas */

.controls { flex-direction: column; align-items: center; gap: 10px; }
.dots { display: flex; gap: 6px; }
.dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: background .2s, transform .2s; }
.dots span.on { background: var(--accent); transform: scale(1.25); }
.btn { min-height: 52px; padding: 0 30px; border: 0; border-radius: 999px; background: var(--accent); color: var(--btn-ink); font: 600 17px/1.2 var(--round); cursor: pointer; box-shadow: 0 5px 0 color-mix(in srgb, var(--accent) 65%, #000); transition: transform .1s, box-shadow .1s; }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 color-mix(in srgb, var(--accent) 65%, #000); }
.tip { font-size: 13px; color: var(--soft); }

/* Foto dan balasan baru muncul setelah boneka selesai bicara (tanpa JS langsung tampil). */
.content { display: flex; flex-direction: column; gap: 26px; padding: 12px 0 56px; }
.js body:not(.done) .content, .js body:not(.done) footer { display: none; }
.card { padding: 26px 22px; border-radius: 28px; background: var(--card); box-shadow: 0 6px 0 var(--line); }
.album h2 { margin-bottom: 18px; text-align: center; }
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.photos figure { margin: 0; padding: 7px; border-radius: 22px; background: var(--card); box-shadow: 0 5px 0 var(--line); }
.photos figure:nth-child(odd) { transform: rotate(-1.5deg); }
.photos figure:nth-child(even) { transform: rotate(1.5deg); }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 16px; }
.reply { text-align: center; }
.reply h2 { margin-bottom: 16px; }
.note { font-size: 15px; color: var(--soft); }
form { display: flex; flex-direction: column; gap: 12px; }
.quick { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.btn.ghost { min-height: 44px; padding: 0 16px; background: var(--bg); color: var(--ink); font-size: 15px; box-shadow: 0 4px 0 var(--line); }
.btn.ghost:active { box-shadow: 0 1px 0 var(--line); }
textarea { width: 100%; min-height: 96px; padding: 14px 16px; border: 2px solid var(--line); border-radius: 20px; background: var(--card); color: var(--ink); font: 600 15px/1.5 var(--sans); resize: vertical; }
textarea::placeholder { color: var(--soft); }

.music-toggle { position: fixed; top: 14px; right: 14px; z-index: 5; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--card); box-shadow: 0 4px 0 var(--line); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.music-toggle svg { width: 20px; height: 20px; }
.music-toggle[aria-pressed="true"] { background: var(--accent); color: var(--btn-ink); }
footer { padding: 8px 22px 34px; text-align: center; font-size: 12px; color: var(--soft); }

.anim .reveal { opacity: 0; transform: translateY(22px) scale(.97); transition: opacity .6s ease, transform .6s cubic-bezier(.3, 1.4, .5, 1); }
.anim .reveal.in { opacity: 1; transform: none; }
@keyframes muncul { from { opacity: 0; transform: translateY(8px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes goyang { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }

@media (max-height: 640px) { .stagebox { min-height: 200px; } .bubble { min-height: 110px; } .count b { font-size: 60px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Video unggahan (field video): ditaruh sebelum galeri, bingkai mengikuti warna teks template (currentColor). */
.vk { width: min(100%, 440px); margin: 34px auto; padding: 0 20px; text-align: center; flex-direction: column; align-items: center; justify-content: center; }
.vk-layar { width: 100%; }
.vk-judul { margin: 0 0 12px; font-weight: 700; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; opacity: .85; }
.vk-layar { position: relative; margin: 0; padding: 10px; border-radius: 20px; border: 1px solid color-mix(in srgb, currentColor 28%, transparent); background: color-mix(in srgb, currentColor 7%, transparent); box-shadow: 0 16px 34px rgba(0, 0, 0, .16); }
.vk-layar video { display: block; width: 100%; max-height: 70vh; border-radius: 12px; background: #000; }
.vk-layar figcaption { margin-top: 10px; font-size: 14px; font-style: italic; opacity: .75; }
