/* Panggilan — ucapan berupa video call masuk: telepon berdering, diangkat, video ucapan langsung tayang bersuara, chat & reaksi beterbangan, lalu riwayat chat untuk dibalas. */
@font-face { font-family: "Plus Jakarta Sans"; src: url("fonts/plus-jakarta-sans.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Caveat"; src: url("fonts/caveat.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

/* --bg = layar ponsel gelap; --hijau = tombol angkat; --merah = tolak/tutup; --wall = latar chat. */
:root { --bg: #0d1117; --panel: #161b24; --ink: #f4f6fb; --soft: #9aa3b5; --hijau: #22c55e; --merah: #ef4444; --aksen: #8b5cf6; --wall: #f3eee6; --wall-ink: #1f2430; --bubble: #ffffff; --bubble-out: #d9fbe3; --sans: "Plus Jakarta Sans", system-ui, sans-serif; --hand: "Caveat", "Comic Sans MS", cursive; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { max-width: 100%; display: block; }
p, h1, h2, figure { margin: 0; }
button { font: inherit; color: inherit; }
main { width: 100%; max-width: 480px; margin: 0 auto; overflow-x: clip; }
.ikon-def { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 24px; height: 24px; }

/* Avatar bulat: foto penelepon atau huruf awal. */
.avatar { position: relative; display: grid; place-items: center; width: 84px; aspect-ratio: 1; border-radius: 50%; background: linear-gradient(135deg, #f472b6, #8b5cf6 55%, #38bdf8); }
.avatar img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar span { position: relative; z-index: 1; font: 800 36px/1 var(--sans); color: #fff; text-transform: uppercase; }
.avatar.besar { width: 132px; margin: 26px auto 18px; box-shadow: 0 18px 50px rgb(139 92 246 / .45); }
.avatar.besar span { font-size: 56px; }
.avatar.kecil { width: 64px; margin: 0 auto 10px; }
.avatar.kecil span { font-size: 28px; }
.cincin { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgb(255 255 255 / .55); opacity: 0; }

/* ---------- Sampul: layar panggilan masuk ---------- */
.cover { position: relative; display: none; min-height: 100svh; flex-direction: column; align-items: center; padding: max(54px, env(safe-area-inset-top)) 24px max(40px, env(safe-area-inset-bottom)); text-align: center; overflow: hidden; background: radial-gradient(120% 70% at 50% 0%, #3b2a6b 0%, #1a1530 45%, var(--bg) 80%); transition: transform .55s cubic-bezier(.6, 0, .3, 1), opacity .55s ease; }
.cover > * { position: relative; z-index: 1; }
.cover-latar { position: absolute !important; inset: -40px; z-index: 0 !important; }
.cover-latar img { width: 100%; height: 100%; object-fit: cover; filter: blur(34px) saturate(1.3); opacity: .42; transform: scale(1.1); }
.masuk-label { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: rgb(255 255 255 / .1); font-size: 13px; font-weight: 600; color: #d8dcff; }
.masuk-label svg { width: 16px; height: 16px; }
.penelepon { font: 800 34px/1.1 var(--sans); letter-spacing: -.02em; overflow-wrap: anywhere; }
.status { margin-top: 8px; max-width: 300px; font-size: 16px; color: #d5d9e6; }
.berdering { margin-top: 10px; font-size: 13px; color: var(--soft); letter-spacing: .08em; }
.aksi { display: flex; justify-content: space-between; width: min(100%, 300px); margin-top: auto; padding-top: 40px; }
.aksi-item { display: grid; justify-items: center; gap: 10px; font-size: 13px; color: #d5d9e6; min-width: 90px; }
.bulat { display: grid; place-items: center; width: 70px; height: 70px; border: 0; border-radius: 50%; color: #fff; cursor: pointer; box-shadow: 0 12px 28px rgb(0 0 0 / .4); }
.bulat svg { width: 30px; height: 30px; }
.tolak { background: var(--merah); }
.tolak svg { transform: rotate(135deg); }
.terima { background: var(--hijau); }
.open.memuat { opacity: .6; pointer-events: none; }
.melayang { position: absolute !important; inset: 0; z-index: 0 !important; pointer-events: none; }
.melayang i { position: absolute; bottom: -60px; left: var(--x); font-style: normal; font-size: var(--s, 30px); opacity: 0; filter: drop-shadow(0 8px 14px rgb(0 0 0 / .35)); }
.melayang i:nth-child(1) { --x: 6%; --s: 38px; --d: 0s; --t: 11s; } .melayang i:nth-child(2) { --x: 22%; --s: 30px; --d: 3.5s; --t: 13s; }
.melayang i:nth-child(3) { --x: 40%; --s: 26px; --d: 7s; --t: 12s; } .melayang i:nth-child(4) { --x: 58%; --s: 24px; --d: 1.8s; --t: 14s; }
.melayang i:nth-child(5) { --x: 74%; --s: 32px; --d: 5.2s; --t: 12s; } .melayang i:nth-child(6) { --x: 88%; --s: 28px; --d: 9s; --t: 13s; }
.melayang i:nth-child(7) { --x: 50%; --s: 22px; --d: 10.5s; --t: 10s; } .melayang i:nth-child(8) { --x: 82%; --s: 40px; --d: 12s; --t: 15s; }
.goyang { animation: goyang .5s ease; }
@keyframes goyang { 20%, 60% { transform: translateX(-10px) rotate(-8deg); } 40%, 80% { transform: translateX(10px) rotate(8deg); } }

/* ---------- Layar panggilan ---------- */
.call { position: relative; height: 100svh; min-height: 560px; overflow: hidden; background: #000; isolation: isolate; }
.layar { position: absolute; inset: 0; background: radial-gradient(circle at 50% 40%, #1d2333, #07090d 75%); }
.layar-latar { position: absolute; inset: -60px; }
.layar-latar img { width: 100%; height: 100%; object-fit: cover; filter: blur(40px) brightness(.55) saturate(1.2); }
.film { position: relative; width: 100%; height: 100%; object-fit: cover; background: #000; }
.lanskap .film { background: transparent; }
.lanskap .film { object-fit: contain; }
.slide { position: absolute; inset: 0; }
.slide img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1s ease; }
.slide img:first-child, .slide img.on { opacity: 1; }
.slide.jalan img:not(.on) { opacity: 0; }
.slide.jalan img.on { animation: kenburns 5s ease-out both; }
@keyframes kenburns { from { transform: scale(1.14) translateY(2%); } to { transform: scale(1); } }
.suara-saja { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 26px; }
.suara-saja .avatar { width: 150px; }
.suara-saja .avatar span { font-size: 64px; }
.gelombang { display: flex; align-items: center; gap: 6px; height: 44px; }
.gelombang i { width: 6px; height: 30%; border-radius: 3px; background: var(--hijau); }
.menghubungkan { position: absolute; inset: 0; z-index: 4; display: grid; place-content: center; justify-items: center; gap: 18px; background: radial-gradient(120% 70% at 50% 0%, #3b2a6b 0%, #1a1530 45%, var(--bg) 80%); opacity: 0; pointer-events: none; transition: opacity .6s ease; font-weight: 600; color: #d5d9e6; }
.menghubungkan .avatar { width: 108px; }
.menghubungkan .avatar span { font-size: 46px; }
.bar-atas { position: absolute; left: 0; right: 0; top: 0; z-index: 3; padding: max(16px, env(safe-area-inset-top)) 18px 40px; background: linear-gradient(rgb(0 0 0 / .55), transparent); text-shadow: 0 1px 6px rgb(0 0 0 / .5); }
.nama-call { font: 700 18px/1.2 var(--sans); padding-right: 54px; overflow-wrap: anywhere; }
.waktu { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 13px; font-variant-numeric: tabular-nums; color: #e5e7eb; }
.titik { width: 8px; height: 8px; border-radius: 50%; background: var(--hijau); box-shadow: 0 0 8px var(--hijau); }
.pip { position: absolute; right: 14px; top: 84px; z-index: 5; width: 92px; aspect-ratio: 3 / 4; border-radius: 16px; overflow: hidden; display: grid; place-items: center; background: linear-gradient(135deg, #334155, #0f172a); border: 2px solid rgb(255 255 255 / .75); box-shadow: 0 12px 26px rgb(0 0 0 / .45); touch-action: none; cursor: grab; transition: opacity .4s ease, transform .3s ease, left .3s ease, right .3s ease; }
.pip img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pip span { font: 800 34px/1 var(--sans); text-transform: uppercase; color: #cbd5e1; }
.pip b { position: absolute; left: 6px; bottom: 5px; z-index: 1; padding: 1px 6px; border-radius: 6px; background: rgb(0 0 0 / .45); font-size: 11px; font-weight: 600; max-width: calc(100% - 12px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pip.seret { transition: opacity .4s ease; cursor: grabbing; }
.pip.mati { opacity: 0; transform: scale(.6); pointer-events: none; }
.obrolan { position: absolute; left: 12px; right: 12px; bottom: 168px; z-index: 3; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-height: 44%; overflow: hidden; -webkit-mask: linear-gradient(transparent, #000 18%); mask: linear-gradient(transparent, #000 18%); justify-content: flex-end; }
.gelembung { max-width: 86%; padding: 10px 14px; border-radius: 18px 18px 18px 6px; background: rgb(15 18 26 / .72); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); font-size: 15px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; box-shadow: 0 6px 18px rgb(0 0 0 / .25); }
.gelembung.mengetik { display: inline-flex; gap: 4px; padding: 13px 16px; }
.gelembung.mengetik i { width: 7px; height: 7px; border-radius: 50%; background: #cbd5e1; animation: ketik 1.1s ease-in-out infinite; }
.gelembung.mengetik i:nth-child(2) { animation-delay: .15s; } .gelembung.mengetik i:nth-child(3) { animation-delay: .3s; }
@keyframes ketik { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.gelembung.baru { animation: muncul .35s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes muncul { from { opacity: 0; transform: translateY(12px) scale(.9); } }
.reaksi-terbang { position: absolute; inset: 0; z-index: 6; pointer-events: none; overflow: hidden; }
.reaksi-terbang i { position: absolute; font-style: normal; font-size: var(--s, 34px); animation: terbang var(--t, 2.6s) cubic-bezier(.3, .6, .4, 1) forwards; }
@keyframes terbang { 0% { opacity: 0; transform: translate(0, 0) scale(.4); } 12% { opacity: 1; transform: translate(0, -20px) scale(1.15); } 100% { opacity: 0; transform: translate(var(--dx, 0), -62vh) scale(.9) rotate(var(--r, 0deg)); } }
.suara-btn { position: absolute; left: 50%; top: 42%; z-index: 6; translate: -50% 0; min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: rgb(255 255 255 / .92); color: #111; font-weight: 700; white-space: nowrap; box-shadow: 0 10px 24px rgb(0 0 0 / .4); cursor: pointer; }
.reaksi { position: absolute; left: 12px; right: 12px; bottom: 102px; z-index: 5; display: flex; justify-content: space-between; gap: 4px; padding: 6px 8px; border-radius: 999px; background: rgb(15 18 26 / .55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.reaksi button { width: 44px; height: 40px; border: 0; border-radius: 50%; background: transparent; font-size: 24px; line-height: 1; cursor: pointer; transition: transform .15s ease; }
.reaksi button:active { transform: scale(1.35); }
.kontrol { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: center; gap: 18px; padding: 18px 16px max(22px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgb(0 0 0 / .6)); }
.k { display: grid; place-items: center; width: 56px; height: 56px; border: 0; border-radius: 50%; background: rgb(255 255 255 / .18); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #fff; cursor: pointer; text-decoration: none; }
.k[aria-pressed="true"] { background: #fff; color: #111; }
.k.tutup { background: var(--merah); }
.k.tutup svg { transform: rotate(135deg); }
.jeda-ikon { position: absolute; left: 50%; top: 50%; z-index: 4; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%; background: rgb(0 0 0 / .45); display: grid; place-items: center; font-size: 30px; pointer-events: none; opacity: 0; transition: opacity .3s ease; }
.jeda .jeda-ikon { opacity: 1; }
.menyambung .jeda-ikon { opacity: 0; }

/* ---------- Setelah panggilan: riwayat chat ---------- */
.selesai { position: relative; padding: 34px 14px 30px; color: var(--wall-ink); background-color: var(--wall); background-image: radial-gradient(circle at 12px 12px, rgb(31 36 48 / .07) 2px, transparent 2.5px), radial-gradient(circle at 36px 30px, rgb(139 92 246 / .08) 3px, transparent 3.5px); background-size: 48px 48px; }
.ringkas { margin: 0 auto 22px; padding: 22px 18px; max-width: 320px; border-radius: 22px; background: rgb(255 255 255 / .8); text-align: center; box-shadow: 0 10px 30px rgb(31 36 48 / .08); }
.ringkas-judul { font: 800 20px/1.2 var(--sans); }
.ringkas-info { margin-top: 4px; font-size: 14px; color: #5b6475; }
.chat { display: flex; flex-direction: column; gap: 8px; }
.hari { align-self: center; margin-bottom: 6px; padding: 4px 12px; border-radius: 8px; background: rgb(255 255 255 / .85); font-size: 12px; font-weight: 600; color: #5b6475; }
.gelembung-list { display: flex; flex-direction: column; gap: 6px; }
.bubble { position: relative; max-width: 84%; padding: 9px 13px 10px; border-radius: 16px; font-size: 15px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; box-shadow: 0 1px 2px rgb(31 36 48 / .14); }
.bubble.masuk { align-self: flex-start; background: var(--bubble); border-top-left-radius: 4px; }
.bubble.keluar { align-self: flex-end; margin-left: auto; background: var(--bubble-out); border-top-right-radius: 4px; }
.foto-bubble, .video-bubble { padding: 5px 5px 8px; width: 84%; white-space: normal; }
.foto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.foto-grid figure:first-child:nth-last-child(odd) { grid-column: 1 / -1; }
.foto-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 11px; }
.video-bubble video { width: 100%; max-height: 60vh; border-radius: 11px; background: #000; }
.jam { display: block; margin: 6px 6px 0; font-size: 12px; color: #6b7280; }
.stiker { padding: 0; background: none !important; box-shadow: none; font-size: 64px; line-height: 1; }
.balas { margin-top: 26px; }
.balas h2 { margin: 0 0 10px; text-align: center; font: 700 15px/1.3 var(--sans); color: #5b6475; }
.balas form { display: grid; gap: 10px; }
.quick { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.chip { max-width: 90%; padding: 9px 14px; border: 1.5px dashed #22a05a; border-radius: 16px 16px 4px 16px; background: rgb(217 251 227 / .6); color: #14532d; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; }
.ketik { display: flex; align-items: flex-end; gap: 8px; }
.ketik textarea { flex: 1; min-height: 48px; max-height: 160px; padding: 13px 16px; border: 0; border-radius: 24px; background: #fff; color: var(--wall-ink); font: 400 15px/1.45 var(--sans); resize: none; box-shadow: 0 1px 3px rgb(31 36 48 / .15); }
.kirim { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--hijau); color: #fff; cursor: pointer; }
.kirim svg { width: 22px; height: 22px; }
.hint { text-align: center; font-size: 13px; color: #5b6475; }
.ulang { display: block; margin: 26px auto 0; min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--wall-ink); color: #fff; font-weight: 700; cursor: pointer; }
.ulang[hidden] { display: none; }

.music-toggle { position: fixed; top: 14px; right: 14px; z-index: 20; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgb(255 255 255 / .25); background: rgb(13 17 23 / .7); color: #fff; display: grid; place-items: center; cursor: pointer; }
.music-toggle svg { width: 20px; height: 20px; }
.music-toggle[aria-pressed="true"] { background: var(--aksen); border-color: var(--aksen); }
.foot { padding: 14px 22px 34px; text-align: center; font-size: 12px; color: var(--soft); }
.foot a { color: #c4b5fd; }

/* ---------- Urutan dengan JS. Tanpa JS: panggilan & riwayat langsung tampil. ---------- */
.js body[data-opener="amplop"]:not(.opened) .cover { display: flex; }
.js body[data-opener="amplop"]:not(.opened) main > section:not(.cover),
.js body[data-opener="amplop"]:not(.opened) .foot,
.js body[data-opener="amplop"]:not(.opened) .music-toggle { display: none; }
.js body.opening:not(.opened) .cover { transform: translateY(-6%) scale(.96); opacity: 0; }
.js body.menyambung .menghubungkan { opacity: 1; }
.js .suara-btn:not(.tampil) { display: none; }
.js .kontrol, .js .reaksi, .js .pip, .js .bar-atas, .js .obrolan { transition: opacity .6s ease, transform .6s ease; }
.js body.menyambung .reaksi, .js body.menyambung .obrolan { opacity: 0; transform: translateY(14px); }
.js body.menyambung .pip { opacity: 0; transform: scale(.7); }
.no-anim *, .no-anim *::before, .no-anim *::after { transition: none !important; animation: none !important; }

@media (prefers-reduced-motion: no-preference) {
  .cincin { animation: cincin 2.4s ease-out infinite; }
  .cincin:nth-child(2) { animation-delay: .8s; } .cincin:nth-child(3) { animation-delay: 1.6s; }
  .avatar.besar { animation: getar 2.4s ease-in-out infinite; }
  .terima { animation: angkat 1.4s ease-in-out infinite; }
  .berdering b { animation: kedip 1.4s steps(1) infinite; }
  .berdering b:nth-child(2) { animation-delay: .25s; } .berdering b:nth-child(3) { animation-delay: .5s; }
  .menghubungkan b { animation: kedip 1.2s steps(1) infinite; }
  .menghubungkan b:nth-child(2) { animation-delay: .2s; } .menghubungkan b:nth-child(3) { animation-delay: .4s; }
  .menghubungkan .avatar::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 3px solid transparent; border-top-color: #c4b5fd; animation: putar 1s linear infinite; }
  .melayang i { animation: naik var(--t) linear var(--d) infinite; }
  .gelombang i { animation: gelombang 1s ease-in-out infinite; }
  .gelombang i:nth-child(2) { animation-delay: .1s; } .gelombang i:nth-child(3) { animation-delay: .3s; } .gelombang i:nth-child(4) { animation-delay: .15s; }
  .gelombang i:nth-child(5) { animation-delay: .4s; } .gelombang i:nth-child(6) { animation-delay: .05s; } .gelombang i:nth-child(7) { animation-delay: .25s; }
  .titik { animation: denyut 1.6s ease-in-out infinite; }
  .suara-btn { animation: denyut-btn 1.6s ease-in-out infinite; }
  .stiker { animation: stiker 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
}
@keyframes cincin { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(1.9); } }
@keyframes getar { 0%, 40%, 100% { transform: rotate(0); } 5%, 15%, 25% { transform: rotate(-4deg); } 10%, 20%, 30% { transform: rotate(4deg); } }
@keyframes angkat { 0%, 100% { transform: translateY(0); box-shadow: 0 0 0 0 rgb(34 197 94 / .55), 0 12px 28px rgb(0 0 0 / .4); } 50% { transform: translateY(-6px); box-shadow: 0 0 0 16px rgb(34 197 94 / 0), 0 12px 28px rgb(0 0 0 / .4); } }
@keyframes kedip { 50% { opacity: .15; } }
@keyframes putar { to { transform: rotate(360deg); } }
@keyframes naik { 0% { opacity: 0; transform: translateY(0) rotate(-8deg); } 10% { opacity: .9; } 90% { opacity: .9; } 100% { opacity: 0; transform: translateY(-110svh) rotate(10deg); } }
@keyframes gelombang { 50% { height: 100%; } }
@keyframes denyut { 50% { opacity: .4; } }
@keyframes denyut-btn { 50% { transform: scale(1.06); } }
@keyframes stiker { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg) scale(1.06); } }

.anim .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1); }
.anim .reveal.in { opacity: 1; transform: none; }
