/* Arah 2A · Mainan Empuk — satu warna jenuh per layar, objek tebal yang ingin dipencet */
:root {
  --bg: #ff7a2d;
  --ink: #1b1330;
  --cream: #fff1dc;
  --cream-2: #ffe2bd;
  --lav: #b6a2ff;
  --violet: #6a4ff0;
  --violet-dark: #3f2aa8;
  --lime: #d4ff3f;
  --coral: #ff5d5d;
  --shade: rgba(27, 19, 48, .22);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Bricolage Grotesque", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); overflow: hidden; transition: background-color .6s var(--ease); }
body.night { color: var(--cream); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
body.night button:focus-visible { outline-color: var(--cream); }
[hidden] { display: none !important; }

.stage { position: relative; height: 100dvh; max-width: 440px; margin: 0 auto; }
.topbar > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar { position: absolute; z-index: 20; top: max(16px, env(safe-area-inset-top)); left: 24px; right: 76px; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 600; font-size: 15px; }
.progress { display: flex; gap: 5px; }
.progress span { width: 18px; height: 8px; border-radius: 8px; background: var(--shade); transition: width .4s var(--spring), background .3s; }
.progress span.done { background: currentColor; }
.progress span.now { width: 30px; }

.slide {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: stretch;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;   /* pesan panjang bisa digulir, tanpa scrollbar */
  padding: calc(max(16px, env(safe-area-inset-top)) + 46px) 24px max(26px, env(safe-area-inset-bottom));
  opacity: 0; visibility: hidden; transform: translateY(30px) scale(.98);
  transition: opacity .45s var(--ease), transform .55s var(--spring), visibility 0s .45s;
}
.slide::-webkit-scrollbar { display: none; }
.slide.active { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }

.head { margin: 0; font-weight: 800; font-size: clamp(38px, 11.5vw, 46px); line-height: .95; letter-spacing: -.035em; font-variation-settings: "opsz" 96; }
.head.sm { font-size: clamp(32px, 9.5vw, 38px); }
.head .kick { display: block; font-size: 20px; font-weight: 600; letter-spacing: -.01em; opacity: .75; margin-bottom: 10px; line-height: 1.2; }
.note { margin: 12px 0 0; font-weight: 600; font-size: 16px; opacity: .78; }
.note.small { font-size: 15px; text-align: center; }
.body-txt { margin: 16px 0 0; font-size: 18px; line-height: 1.45; font-weight: 500; }
.step { margin: 0 0 10px; font-weight: 600; font-size: 16px; opacity: .75; }

.dock { margin-top: auto; padding-top: 16px; display: flex; gap: 12px; }
.dock + .dock { margin-top: 0; }
.btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; min-height: 64px; padding: 0 22px; border-radius: 22px;
  font-weight: 800; font-size: 20px; text-decoration: none; transition: transform .12s, box-shadow .12s; animation: pop .5s var(--spring) both; }
.btn.dark { background: var(--ink); color: var(--cream); box-shadow: 0 7px 0 #000, inset 0 2px 0 rgba(255, 255, 255, .14); }
.btn.cream { background: var(--cream); color: var(--ink); box-shadow: 0 7px 0 var(--shade), inset 0 2px 0 #fff; }
.btn.short { flex: .55; }
.btn:active { transform: translateY(6px); box-shadow: 0 1px 0 #000; }
.btn.cream:active { box-shadow: 0 1px 0 var(--shade); }
@keyframes pop { from { opacity: 0; transform: scale(.7); } }

/* ---------- Kado ---------- */
.gift-zone { position: relative; flex: 1; display: grid; place-items: center; min-height: 260px; }
.gift { position: relative; width: 240px; height: 240px; transform: rotate(-6deg); animation: squish 2.2s ease-in-out infinite; touch-action: manipulation; }
@keyframes squish { 0%, 100% { transform: rotate(-6deg) scale(1); } 50% { transform: rotate(-3deg) scale(1.03, .97); } }
.gift.press { animation: press .35s var(--spring); }
.gift.shake { animation: shake .5s ease-in-out; }
@keyframes press { 40% { transform: rotate(-6deg) scale(1.12, .82); } 70% { transform: rotate(-6deg) scale(.94, 1.08); } }
@keyframes shake { 20% { transform: rotate(-18deg); } 40% { transform: rotate(10deg); } 60% { transform: rotate(-12deg); } 80% { transform: rotate(4deg); } }
.g-body { position: absolute; left: 16px; right: 16px; bottom: 0; height: 160px; border-radius: 30px;
  background: radial-gradient(120% 90% at 30% 15%, #fff7ea 0, var(--cream-2) 40%, #f4b97a 100%);
  box-shadow: 0 14px 0 rgba(120, 50, 10, .35), 0 30px 40px rgba(60, 20, 0, .3), inset 0 -10px 18px rgba(170, 80, 20, .22), inset 0 8px 10px rgba(255, 255, 255, .8); }
.g-lid { position: absolute; left: 0; right: 0; bottom: 144px; height: 62px; border-radius: 26px; z-index: 2;
  background: radial-gradient(120% 120% at 30% 10%, #fff 0, #ffe8c8 45%, #f2b273 100%);
  box-shadow: 0 10px 0 rgba(120, 50, 10, .35), inset 0 6px 8px rgba(255, 255, 255, .9), inset 0 -6px 10px rgba(170, 80, 20, .22);
  transition: transform .8s var(--spring), opacity .8s; }
.g-rib { position: absolute; left: 50%; width: 42px; margin-left: -21px; top: 0; bottom: 0; border-radius: 14px; background: linear-gradient(90deg, #5b3fd6, #8f78ff 45%, #5b3fd6); box-shadow: inset 0 3px 4px rgba(255, 255, 255, .4); }
.g-body .g-rib { top: 28px; }
.knot { position: absolute; left: 50%; top: -30px; width: 130px; height: 60px; margin-left: -65px; }
.knot i { position: absolute; top: 8px; width: 62px; height: 40px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #b8a8ff, var(--violet) 70%); box-shadow: 0 6px 0 var(--violet-dark); }
.knot i::after { content: ""; position: absolute; inset: 11px 14px; border-radius: 50%; background: #4b33c4; box-shadow: inset 0 3px 4px rgba(0, 0, 0, .35); }
.knot i:first-child { left: 0; transform: rotate(-22deg); }
.knot i:last-child { right: 0; transform: rotate(22deg); }
.knot b { position: absolute; left: 50%; top: 22px; width: 34px; height: 30px; margin-left: -17px; border-radius: 12px; background: radial-gradient(circle at 40% 30%, #a796ff, #5b3fd6); box-shadow: 0 5px 0 var(--violet-dark); z-index: 2; }
.gift.open { animation: none; }
.gift.open .g-lid { transform: translate(60px, -230px) rotate(40deg); opacity: 0; }
.badge { position: absolute; right: 18px; top: 22%; width: 66px; height: 66px; border-radius: 50%; background: var(--ink); color: var(--lime); display: grid; place-items: center;
  font-weight: 800; font-size: 24px; transform: rotate(10deg); box-shadow: 0 5px 0 #000; transition: transform .3s var(--spring); }
.badge.bump { transform: rotate(-6deg) scale(1.2); }

/* ---------- Hero ---------- */
.mega { margin: 2px 0 0; font-weight: 800; font-size: clamp(76px, 25vw, 104px); line-height: .9; letter-spacing: -.05em; font-variation-settings: "opsz" 96; }
.slide.active .mega { animation: pop .7s var(--spring) .15s both; }
.sticker { align-self: center; margin-top: 22px; padding: 10px; background: var(--cream); border-radius: 30px; transform: rotate(5deg); box-shadow: 0 10px 0 var(--shade); }
.sticker img { display: block; width: min(190px, 50vw); height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 22px; }
.sticker.tilt { transform: rotate(-5deg); margin-top: 0; margin-bottom: 20px; }
.sticker.tilt img { width: min(200px, 52vw); aspect-ratio: 6 / 7; }
.slide.active .sticker { animation: drop .8s var(--spring) .1s both; }
@keyframes drop { from { opacity: 0; transform: translateY(-50px) rotate(20deg); } }

/* ---------- Game ---------- */
.tube { position: relative; height: 40px; margin-top: 16px; border-radius: 999px; background: var(--cream); box-shadow: inset 0 3px 0 var(--shade); overflow: hidden; }
.tube-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px; background: linear-gradient(180deg, #ff8a8a, var(--coral) 60%, #d63c3c); box-shadow: inset 0 4px 0 rgba(255, 255, 255, .45); transition: width .35s var(--spring); }
.tube-txt { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 17px; }
.arena { position: relative; flex: 1; margin-top: 16px; min-height: 280px; border-radius: 30px; overflow: hidden; background: rgba(27, 19, 48, .08); box-shadow: inset 0 6px 0 var(--shade); touch-action: none; }
.arena-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 26px; text-align: center; z-index: 3; }
.arena-msg p { margin: 0; font-size: 20px; font-weight: 800; line-height: 1.3; letter-spacing: -.01em; }
.arena-msg .btn { flex: none; width: 70%; }
.candy { display: block; width: 100%; height: 100%; background: radial-gradient(circle at 34% 30%, #ffb0b0 0 10%, var(--coral) 45%, #c02f3a 100%);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.5 3.4 13A5.6 5.6 0 0 1 12 5.6 5.6 5.6 0 0 1 20.6 13Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.5 3.4 13A5.6 5.6 0 0 1 12 5.6 5.6 5.6 0 0 1 20.6 13Z'/%3E%3C/svg%3E") center / contain no-repeat; }
.candy.big { width: 110px; height: 110px; animation: beat 1.2s ease-in-out infinite; filter: drop-shadow(0 8px 0 var(--shade)); }
@keyframes beat { 15%, 45% { transform: scale(1.12); } 30%, 60% { transform: scale(1); } }
.drop { position: absolute; top: -70px; left: var(--x); width: 62px; height: 62px; margin-left: -31px; animation: fall var(--d) linear forwards; touch-action: none; filter: drop-shadow(0 6px 0 var(--shade)); }
.drop .candy { animation: wobble 1s ease-in-out infinite alternate; }
@keyframes fall { to { transform: translateY(calc(var(--h) + 90px)); } }
@keyframes wobble { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }
.drop.hit { animation: none; pointer-events: none; }
.drop.hit .candy { animation: burst .3s var(--ease) forwards; }
@keyframes burst { to { transform: scale(1.9); opacity: 0; } }
.plus { position: absolute; font-weight: 800; font-size: 26px; pointer-events: none; animation: plus .7s var(--ease) forwards; }
@keyframes plus { to { transform: translateY(-46px) rotate(-8deg); opacity: 0; } }

/* ---------- Quiz ---------- */
.opts { display: grid; gap: 14px; margin-top: 26px; }
.opt { min-height: 64px; border-radius: 22px; background: var(--cream); color: var(--ink); font-weight: 800; font-size: 20px; text-align: left; padding: 0 22px;
  display: flex; align-items: center; justify-content: space-between; box-shadow: 0 7px 0 var(--shade), inset 0 2px 0 #fff; transition: transform .12s, box-shadow .12s, background .2s; animation: pop .45s var(--spring) both; }
.opt:nth-child(2) { animation-delay: .06s; } .opt:nth-child(3) { animation-delay: .12s; }
.opt:active { transform: translateY(6px); box-shadow: 0 1px 0 var(--shade); }
.opt.right { background: var(--lime); }
.opt.wrong { background: var(--coral); color: #fff; animation: no .4s; }
.opt[disabled] { cursor: default; }
@keyframes no { 25%, 75% { transform: translateX(-8px) rotate(-1deg); } 50% { transform: translateX(8px) rotate(1deg); } }
.feedback { min-height: 30px; margin: 22px 0 0; font-weight: 800; font-size: 20px; letter-spacing: -.01em; }

/* ---------- Scratch ---------- */
.ticket { position: relative; align-self: center; width: min(330px, 100%); aspect-ratio: 330 / 210; margin-top: 30px; border-radius: 30px; overflow: hidden; transform: rotate(-3deg); box-shadow: 0 10px 0 var(--shade); }
.prize { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 6px; padding: 22px 24px; background: var(--cream); }
.prize-tag { font-weight: 800; font-size: 16px; padding: 4px 12px; border-radius: 999px; background: var(--ink); color: var(--lime); }
.prize strong { font-weight: 800; font-size: 28px; line-height: 1.05; letter-spacing: -.03em; }
.prize small { font-weight: 600; font-size: 15px; opacity: .75; }
#scratchCv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; transition: opacity .6s; }
#scratchCv.clear { opacity: 0; pointer-events: none; }
/* tutup isi voucher sebelum lapisan gosok selesai digambar */
.ticket:not(.ready) .prize { visibility: hidden; }
.ticket:not(.ready) #scratchCv { background: #1b1330; }

/* ---------- Kue ---------- */
.slide.dark .head, .slide.dark .note { color: var(--cream); }
.cake-wrap { position: relative; align-self: center; width: 250px; margin: auto 0 0; padding-top: 30px; }
.candles { display: flex; justify-content: center; gap: 28px; height: 96px; align-items: flex-end; position: relative; z-index: 2; margin-bottom: -8px; }
.candle { position: relative; width: 22px; height: 60px; border-radius: 10px; background: linear-gradient(90deg, #8f78ff, #c5b8ff 40%, #6a4ff0); box-shadow: 0 4px 0 var(--violet-dark); }
.candle::before { content: ""; position: absolute; left: 50%; top: -9px; width: 3px; height: 10px; background: #2a2235; margin-left: -1.5px; }
.candle::after { content: ""; position: absolute; left: -22px; right: -22px; top: -64px; bottom: 0; }
.flame { position: absolute; left: 50%; top: -42px; width: 22px; height: 34px; margin-left: -11px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(ellipse at 50% 70%, #fff 10%, var(--lime) 40%, #ffb02e 75%, transparent 77%); filter: drop-shadow(0 0 14px rgba(212, 255, 63, .7));
  transform-origin: 50% 90%; animation: flicker .14s ease-in-out infinite alternate; transition: transform .3s, opacity .3s; }
@keyframes flicker { from { transform: rotate(-4deg) scaleY(1); } to { transform: rotate(4deg) scaleY(1.1); } }
.candle.out .flame { transform: scale(0); opacity: 0; animation: none; }
.smoke { position: absolute; left: 50%; top: -22px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: rgba(255, 241, 220, .45); animation: smoke 1.4s ease-out forwards; pointer-events: none; }
@keyframes smoke { to { transform: translate(10px, -80px) scale(3); opacity: 0; } }
.cake { position: relative; height: 150px; }
.c-top { position: absolute; left: 14px; right: 14px; top: 0; height: 70px; border-radius: 30px 30px 18px 18px; background: radial-gradient(120% 100% at 30% 10%, #fff7ea, var(--cream-2) 50%, #f4b97a); box-shadow: inset 0 6px 6px rgba(255, 255, 255, .8), 0 8px 0 rgba(120, 50, 10, .35); z-index: 2; }
.c-mid { position: absolute; left: -4px; right: -4px; top: 58px; height: 74px; border-radius: 26px; background: radial-gradient(120% 120% at 30% 10%, #ff9a5c, #ff7a2d 50%, #d4551a); box-shadow: inset 0 6px 6px rgba(255, 255, 255, .35), 0 8px 0 rgba(0, 0, 0, .35); }
.c-plate { position: absolute; left: -26px; right: -26px; bottom: -6px; height: 22px; border-radius: 50%; background: var(--lav); box-shadow: 0 6px 0 var(--violet-dark); z-index: -1; }
.wish-done { margin: 22px 0 0; text-align: center; font-weight: 800; font-size: 28px; letter-spacing: -.02em; color: var(--lime); animation: pop .6s var(--spring); }

.os-music { position: fixed; z-index: 50; top: max(8px, calc(env(safe-area-inset-top) - 8px)); right: 16px; width: 46px; height: 46px; border-radius: 16px;
  background: var(--ink); color: var(--cream); display: grid; place-items: center; box-shadow: 0 5px 0 #000; }
.os-music.on svg { animation: spin 4s linear infinite; }
body.night .os-music { background: var(--cream); color: var(--ink); box-shadow: 0 5px 0 rgba(0, 0, 0, .5); }
body.night .progress span { background: rgba(255, 241, 220, .25); }
body.night .progress span.done { background: var(--cream); }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-height: 700px) {
  .gift { transform: scale(.8); }
  .sticker img { width: 130px; }
  .head { font-size: 34px; }
  .mega { font-size: 70px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .2s !important; }
}
