/* =====================================================================
   BEFORE YOU GO — digital scrapbook
   ===================================================================== */
:root {
  --paper: #FFFDF7;
  --cream: #FFF8EC;
  --blue: #BFDDF2;
  --blue-d: #7FB5DD;
  --blue-dd: #4F8DBB;
  --pink: #F7C6D0;
  --pink-m: #F2A7B9;
  --pink-d: #E58DA3;
  --pink-dd: #C9667F;
  --yellow: #FFE7A3;
  --mint: #CDEBD9;
  --lilac: #D9C8F0;
  --ink: #4A4058;
  --ink-soft: #7A6F87;
  --hand: 'Caveat', 'Patrick Hand', cursive;
  --note: 'Patrick Hand', 'Caveat', cursive;
  --sans: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Courier Prime', ui-monospace, 'Courier New', monospace;
  --turn: .9s;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: #EEF5FB;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
img { max-width: 100%; display: block; }

/* ---------------------------------------------------------------- stage */
.stage { position: fixed; inset: 0; perspective: 2400px; overflow: hidden; }
.scene {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: none;
  background:
    radial-gradient(#cfe1f0 1.3px, transparent 1.6px) 0 0 / 22px 22px,
    linear-gradient(160deg, #EEF5FB 0%, #FBEFF3 100%);
  transform-origin: left center;
  backface-visibility: hidden;
}
.scene.active { display: block; }
.scene.turning { z-index: 3; pointer-events: none; animation: pageTurn var(--turn) cubic-bezier(.55, .05, .35, 1) forwards; }
.scene.coming .sheet { animation: settle var(--turn) ease-out; }
@keyframes pageTurn {
  0% { transform: rotateY(0); box-shadow: 0 0 0 rgba(0,0,0,0); }
  40% { box-shadow: 30px 0 60px rgba(74,64,88,.25); }
  85% { opacity: 1; }
  100% { transform: rotateY(-112deg); opacity: 0; box-shadow: 40px 0 80px rgba(74,64,88,.0); }
}
@keyframes settle { from { transform: scale(.975); filter: brightness(.93); } to { transform: none; filter: none; } }

/* ---------------------------------------------------------------- sheet (kertas) */
.sheet {
  position: relative;
  width: 100%; max-width: 640px; min-height: 100%;
  margin: 0 auto;
  padding: calc(72px + env(safe-area-inset-top)) 22px calc(56px + env(safe-area-inset-bottom)) 40px;
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, transparent 26px, rgba(229,141,163,.5) 26px, rgba(229,141,163,.5) 28px, transparent 28px),
    repeating-linear-gradient(180deg, transparent 0 33px, rgba(127,181,221,.24) 33px 34px);
  overflow: hidden;
}
.sheet::after { /* tekstur kertas */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .4 0 0 0 0 .35 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.sheet > :not(.tape):not(.deco):not(.dusk-glow):not(.letter-actions) { position: relative; z-index: 1; }
.sheet-plain {
  background-image: radial-gradient(rgba(127,181,221,.35) 1.2px, transparent 1.5px);
  background-size: 20px 20px;
  padding-left: 22px;
  transition: background-color 5s ease;
}

@media (min-width: 720px) {
  .sheet {
    margin: 44px auto;
    min-height: calc(100% - 88px);
    border-radius: 6px 18px 18px 6px;
    padding: 76px 56px 64px 78px;
    box-shadow: 0 1px 0 #e9dfcf, 0 3px 0 #fbf6ec, 0 5px 0 #e9dfcf, 0 7px 0 #fbf6ec, 0 9px 0 #e2d7c5, 0 24px 50px rgba(74,64,88,.16);
    background-image:
      linear-gradient(90deg, transparent 58px, rgba(229,141,163,.5) 58px, rgba(229,141,163,.5) 60px, transparent 60px),
      repeating-linear-gradient(180deg, transparent 0 33px, rgba(127,181,221,.24) 33px 34px);
  }
  .sheet-plain { padding-left: 78px; background-image: radial-gradient(rgba(127,181,221,.35) 1.2px, transparent 1.5px); }
  .sheet::before { /* spiral */
    content: ''; position: absolute; left: 12px; top: 26px; bottom: 26px; width: 26px; z-index: 2;
    background: radial-gradient(circle at 13px 13px, #EEF5FB 0 5.5px, #b9aec8 6px 7.5px, transparent 8px) 0 0 / 26px 38px repeat-y;
  }
}

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: fixed; z-index: 40; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 14px 0;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.chapters { display: flex; gap: 7px; list-style: none; margin: 0; padding: 7px 11px; border-radius: 999px; background: rgba(255,253,247,.85); border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); transition: opacity .4s, transform .4s; }
body[data-scene="intro"] .chapters { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.chapters li { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper); transition: background .4s, transform .4s; }
.chapters li.done { background: var(--pink-m); }
.chapters li.now { background: var(--yellow); transform: scale(1.3); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid var(--ink); background: var(--paper); box-shadow: 0 3px 0 var(--ink);
  cursor: pointer; padding: 0; font-size: 20px; line-height: 1;
  transition: transform .15s, box-shadow .15s;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

/* ---------------------------------------------------------------- dekorasi */
.tape {
  position: absolute; z-index: 3; width: var(--w, 96px); height: 26px;
  transform: rotate(var(--r, -4deg)); opacity: .9;
  clip-path: polygon(0 6%, 4% 0, 30% 4%, 60% 0, 96% 3%, 100% 0, 98% 50%, 100% 100%, 70% 96%, 40% 100%, 4% 97%, 0 100%, 2% 50%);
  background: repeating-linear-gradient(45deg, rgba(247,198,208,.95) 0 8px, rgba(255,255,255,.7) 8px 14px);
}
.tape.blue { background: repeating-linear-gradient(-45deg, rgba(191,221,242,.95) 0 8px, rgba(255,255,255,.7) 8px 14px); }
.tape.yellow { background: radial-gradient(rgba(255,255,255,.85) 2.2px, transparent 2.6px) 0 0 / 11px 11px, rgba(255,231,163,.95); }
.deco { position: absolute; z-index: 2; width: var(--s, 28px); height: var(--s, 28px); pointer-events: none; animation: bob 4.5s ease-in-out infinite; animation-delay: var(--d, 0s); }
.deco svg, .env-deco svg, [data-art] > svg { width: 100%; height: 100%; display: block; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-7px) rotate(6deg); } }

/* ---------------------------------------------------------------- teks */
.kicker { font-family: var(--note); font-size: 17px; text-align: center; color: var(--ink-soft); margin: 0 0 4px; letter-spacing: .03em; }
.title-hand {
  font-family: var(--hand); font-weight: 700; text-align: center;
  font-size: clamp(60px, 17vw, 92px); line-height: .9; margin: 0;
  text-shadow: 3px 3px 0 var(--pink);
  animation: popIn .9s cubic-bezier(.2, 1.4, .4, 1) both .1s;
}
.underline { display: block; width: min(300px, 80%); height: 20px; margin: -2px auto 0; }
.subtitle { font-family: var(--hand); font-size: 32px; font-weight: 700; text-align: center; color: var(--blue-dd); margin: 6px 0 0; transform: rotate(-2deg); }
.h-hand { font-family: var(--hand); font-weight: 700; font-size: 46px; line-height: 1; margin: 8px 0 4px; }
.h-hand.big { font-size: 48px; }
.muted { color: var(--ink-soft); margin: 4px 0 0; font-size: 15px; line-height: 1.5; }
.hand { font-family: var(--hand); }
.chip { display: inline-block; font-weight: 800; font-size: 13px; padding: 3px 12px; border-radius: 999px; border: 2px solid var(--ink); background: var(--yellow); transform: rotate(-3deg); }
.chip.blue { background: var(--blue); }
.chip.pink { background: var(--pink); }
.signoff { font-family: var(--hand); font-size: 22px; text-align: center; color: var(--ink-soft); margin: 30px 0 0; }
.center-col { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 26px; }
.hint { text-align: center; font-family: var(--note); color: var(--ink-soft); font-size: 17px; margin: 10px 0 0; }

/* ---------------------------------------------------------------- tombol */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--sans); font-weight: 800; font-size: 17px;
  padding: 13px 26px; min-height: 48px;
  border-radius: 999px; border: 2.5px solid var(--ink);
  background: var(--pink); color: var(--ink);
  box-shadow: 0 5px 0 var(--ink);
  cursor: pointer; transition: transform .15s, box-shadow .15s, background .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.btn-big { font-size: 22px; padding: 16px 38px; }
.btn-blue { background: var(--blue); }
.btn-ghost { background: var(--paper); }
.btn.small { font-size: 15px; padding: 9px 18px; min-height: 40px; }
.btn-pink-glow { animation: glow 2.4s ease-in-out infinite; }
@keyframes glow { 0%, 100% { box-shadow: 0 5px 0 var(--ink), 0 0 0 0 rgba(229,141,163,.5); } 50% { box-shadow: 0 5px 0 var(--ink), 0 0 0 12px rgba(229,141,163,0); } }
.wiggle { animation: wiggle 3.2s ease-in-out infinite 1.5s; }
@keyframes wiggle { 0%, 82%, 100% { rotate: 0deg; } 86% { rotate: -4deg; } 90% { rotate: 4deg; } 94% { rotate: -2deg; } }
.link-btn { background: none; border: 0; font-family: var(--note); font-size: 17px; color: var(--blue-dd); text-decoration: underline wavy rgba(79,141,187,.5); text-underline-offset: 5px; cursor: pointer; padding: 6px; }
.skip-btn { display: block; margin: 30px auto 0; background: none; border: 0; font-family: var(--note); font-size: 16px; color: var(--ink-soft); opacity: .8; cursor: pointer; padding: 8px; text-decoration: underline dotted; text-underline-offset: 4px; }
.skip-btn:hover { opacity: 1; }
:focus-visible { outline: 3px dashed var(--blue-dd); outline-offset: 3px; }

/* ---------------------------------------------------------------- 1. intro */
.intro-art { width: min(340px, 100%); margin: 14px auto 4px; animation: floaty 5s ease-in-out infinite; }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.note-card {
  position: relative; margin: 18px auto 0; max-width: 460px;
  background: #FFF6DA; padding: 24px 20px 18px;
  border-radius: 4px; transform: rotate(-1.2deg);
  box-shadow: 0 2px 0 rgba(74,64,88,.08), 0 12px 24px rgba(74,64,88,.12);
  font-family: var(--note); font-size: 19px; line-height: 1.55;
}
.note-card p { margin: 0 0 10px; }
.note-card p:first-of-type { font-family: var(--hand); font-size: 30px; font-weight: 700; color: var(--pink-dd); margin-bottom: 4px; }
.note-card p:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------- 2. kuis */
.game-head { text-align: center; margin-bottom: 16px; }
.progress { display: flex; align-items: center; gap: 10px; margin: 6px 0 18px; }
.progress-track { flex: 1; height: 16px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: repeating-linear-gradient(45deg, var(--pink-m) 0 8px, var(--pink) 8px 16px); border-right: 2px solid var(--ink); transition: width .6s cubic-bezier(.3, 1.4, .5, 1); }
.progress-label { font-weight: 800; font-size: 14px; min-width: 38px; text-align: right; }

.q-card {
  position: relative; background: #fff; border: 2px solid var(--ink); border-radius: 16px;
  padding: 22px 18px 18px; box-shadow: 6px 6px 0 var(--blue);
  background-image: linear-gradient(180deg, transparent 54px, rgba(229,141,163,.6) 54px, rgba(229,141,163,.6) 56px, transparent 56px);
}
.q-card.swap { animation: cardIn .55s cubic-bezier(.2, 1.2, .4, 1); }
@keyframes cardIn { from { transform: translateX(40px) rotate(3deg); opacity: 0; } to { transform: none; opacity: 1; } }
.q-num { display: inline-block; font-family: var(--hand); font-size: 24px; font-weight: 700; color: var(--pink-dd); }
.q-text { font-family: var(--note); font-size: 21px; line-height: 1.45; margin: 14px 0 6px; }
.q-opt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  margin-top: 12px; padding: 12px 14px; min-height: 54px;
  border: 2px solid var(--ink); border-radius: 14px; background: var(--paper);
  box-shadow: 0 4px 0 var(--ink); cursor: pointer;
  font-weight: 700; font-size: 16px;
  transition: transform .15s, box-shadow .15s, background .25s, opacity .25s;
}
.q-opt:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); background: #FFF6DA; }
.q-opt:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.q-letter { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--ink); background: var(--blue); font-weight: 800; }
.q-opt.correct { background: var(--mint); animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
.q-opt.correct .q-letter { background: #8fd4ac; }
.q-opt.correct::after { content: '✓'; margin-left: auto; font-size: 22px; font-weight: 800; color: #2f8f5b; }
.q-opt.wrong { animation: shake .45s; opacity: .55; cursor: not-allowed; }
.q-opt.wrong span:last-child { text-decoration: line-through wavy var(--pink-d); }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.06) rotate(-1deg); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { translate: 0; } 20% { translate: -8px; } 40% { translate: 7px; } 60% { translate: -5px; } 80% { translate: 3px; } }
.feedback { font-family: var(--hand); font-weight: 700; font-size: 30px; text-align: center; color: var(--pink-dd); min-height: 40px; margin: 18px 0 0; }
.feedback.show { animation: popIn .5s cubic-bezier(.2, 1.5, .4, 1); }
.fact { font-family: var(--note); text-align: center; color: var(--ink-soft); font-size: 16px; min-height: 22px; margin: 2px 0 0; }
@keyframes popIn { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* modal selesai */
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 22px; background: rgba(74,64,88,.3); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.done-card { position: relative; width: 100%; max-width: 380px; text-align: center; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 22px; padding: 38px 24px 28px; box-shadow: 8px 8px 0 var(--pink); animation: popIn .6s cubic-bezier(.2, 1.4, .4, 1); }
.done-card p { font-family: var(--note); font-size: 19px; line-height: 1.5; margin: 8px 0 22px; }
.stamp { width: 78px; height: 78px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; font-size: 40px; font-weight: 800; color: var(--pink-dd); border: 3px dashed var(--pink-d); background: #FFF0F3; transform: rotate(-10deg); animation: stampIn .6s cubic-bezier(.2, 1.6, .4, 1) .2s both; }
.stamp.blue { color: var(--blue-dd); border-color: var(--blue-d); background: #EEF6FC; }
@keyframes stampIn { from { transform: scale(2.2) rotate(-30deg); opacity: 0; } to { transform: scale(1) rotate(-10deg); opacity: 1; } }

/* ---------------------------------------------------------------- 3. memory */
.pairs { text-align: center; font-weight: 700; margin: 0 0 14px; }
.pairs b { color: var(--pink-dd); font-size: 20px; }
.mm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 470px; margin: 0 auto; }
.mm-card { aspect-ratio: 3 / 4; border: 0; padding: 0; background: none; cursor: pointer; perspective: 700px; }
.mm-inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.3, 1.3, .5, 1); }
.mm-card.flipped .mm-inner { transform: rotateY(180deg); }
.mm-face { position: absolute; inset: 0; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; box-shadow: 0 4px 0 var(--ink); }
.mm-back { background: radial-gradient(rgba(255,255,255,.7) 2px, transparent 2.5px) 0 0 / 12px 12px, var(--pink); }
.mm-back::before { content: ''; position: absolute; inset: 5px; border: 2px dashed rgba(74,64,88,.35); border-radius: 8px; }
.mm-back-art { width: 46%; }
.mm-front { transform: rotateY(180deg); background: #fff; grid-template-rows: 1fr auto; padding: 8% 6% 4%; }
.mm-front .mm-art { width: 88%; align-self: center; justify-self: center; }
.mm-front img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mm-front small { font-family: var(--hand); font-weight: 700; font-size: 18px; line-height: 1; position: relative; }
.mm-front.has-img small { background: rgba(255,253,247,.9); padding: 2px 6px; border-radius: 6px; align-self: end; }
.mm-card.matched .mm-front { background: var(--mint); animation: matchPop .6s cubic-bezier(.2, 1.6, .4, 1); }
.mm-card.matched { cursor: default; }
@keyframes matchPop { 0% { scale: 1; } 40% { scale: 1.1; } 100% { scale: 1; } }

/* ---------------------------------------------------------------- 4. absensi */
.scene.dusk .sheet-plain { background-color: #FCEBE3; }
.dusk-glow { position: absolute !important; inset: 0; z-index: 0 !important; pointer-events: none; opacity: 0; transition: opacity 5s ease; background: radial-gradient(120% 60% at 50% 0%, rgba(255,196,170,.55), transparent 60%), radial-gradient(90% 50% at 50% 100%, rgba(203,186,236,.5), transparent 70%); }
.scene.dusk .dusk-glow { opacity: 1; }
.att-lead { text-align: center; margin: 0 0 6px; font-family: var(--note); font-size: 19px; line-height: 1.5; }
.att-lead.hand { font-family: var(--hand); font-size: 30px; font-weight: 700; color: var(--pink-dd); line-height: 1.15; }

.machine {
  width: min(290px, 86vw); margin: 22px auto 0; padding: 16px 16px 20px;
  border-radius: 28px 28px 22px 22px; color: #E9F1F8;
  background: linear-gradient(170deg, #67768b, #3e4859);
  box-shadow: 0 12px 0 -3px #2b3340, 0 26px 40px rgba(40,40,70,.32), inset 0 2px 0 rgba(255,255,255,.25);
  user-select: none; -webkit-user-select: none;
}
.m-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; padding: 0 4px; }
.m-brand { font-weight: 800; font-size: 12px; letter-spacing: .24em; display: flex; align-items: center; gap: 6px; }
.m-brand img { height: 20px; width: auto; }
.m-led { width: 11px; height: 11px; border-radius: 50%; background: #f5a524; box-shadow: 0 0 8px #f5a524; animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.machine.scanning .m-led { background: #5ab4ff; box-shadow: 0 0 10px #5ab4ff; animation-duration: .4s; }
.machine.success .m-led { background: #5be39a; box-shadow: 0 0 14px #5be39a; animation: none; }
.m-screen { border-radius: 12px; padding: 10px 12px; min-height: 96px; text-align: center; color: #1f3b2c; font-family: var(--mono); background: linear-gradient(#c8edd4, #a7d8b9); box-shadow: inset 0 3px 8px rgba(0,0,0,.25); }
.m-clock { font-size: 30px; font-weight: 700; letter-spacing: .05em; line-height: 1.1; }
.m-date { font-size: 12px; opacity: .75; }
.m-status { font-size: 13px; font-weight: 700; margin-top: 6px; min-height: 18px; }
.machine.success .m-screen { animation: lcdFlash .9s ease 2; }
@keyframes lcdFlash { 50% { background: linear-gradient(#ecfff2, #c4f2d4); } }
.m-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0 0; }
.m-keys span { display: grid; place-items: center; height: 22px; border-radius: 6px; font-size: 10px; font-weight: 800; color: #a9b8ca; background: #2f3846; box-shadow: 0 2px 0 #1e242e; }
.m-sensor {
  --p: 0; position: relative; display: block; width: 118px; height: 138px; margin: 16px auto 0; padding: 0;
  border-radius: 48% / 42%; border: 4px solid #232a35; overflow: hidden; cursor: pointer;
  background: radial-gradient(circle at 50% 35%, #3f5470, #1b222d 75%);
  box-shadow: inset 0 0 18px rgba(0,0,0,.6), 0 0 0 4px #4b5668, 0 0 calc(var(--p) * 26px) calc(var(--p) * 6px) rgba(126,240,176,.55);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: transform .15s;
}
.m-sensor:active, .machine.scanning .m-sensor { transform: scale(.97); }
.m-fill { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--p) * 100%); background: linear-gradient(to top, rgba(126,240,176,.55), rgba(126,240,176,.12)); }
.m-fp { position: absolute; inset: 16% 18%; color: #86a7cc; transition: color .3s, filter .3s; pointer-events: none; }
.machine.scanning .m-fp, .machine.success .m-fp { color: #b9f5d3; filter: drop-shadow(0 0 6px rgba(126,240,176,.8)); }
.m-scanline { position: absolute; left: 6%; right: 6%; top: 12%; height: 3px; border-radius: 3px; background: #7ef0b0; box-shadow: 0 0 10px 2px rgba(126,240,176,.8); opacity: 0; }
.machine.scanning .m-scanline { opacity: 1; animation: scanline .9s ease-in-out infinite alternate; }
@keyframes scanline { from { top: 10%; } to { top: 86%; } }
.machine.success .m-sensor { cursor: default; }
.m-slot { width: 74%; height: 8px; margin: 18px auto 0; border-radius: 4px; background: #1a2029; box-shadow: inset 0 2px 3px rgba(0,0,0,.6); }

.receipt-wrap { width: min(284px, 88vw); margin: -14px auto 0; max-height: 0; overflow: hidden; position: relative; z-index: 0; transition: max-height 2.6s steps(26, end); }
.receipt-wrap.printing { max-height: 560px; }
#attHint { margin-top: 30px; }
.receipt { margin: 0; padding: 18px 14px 22px; background: #fff; color: #333; font-family: var(--mono); font-size: 12px; line-height: 1.5; white-space: pre; overflow: hidden; box-shadow: 0 8px 16px rgba(74,64,88,.15); -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - 8px) no-repeat, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 12px 8px repeat-x; mask: linear-gradient(#000 0 0) top / 100% calc(100% - 8px) no-repeat, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 12px 8px repeat-x; }
.receipt b { font-weight: 700; }

.att-story { margin: 30px auto 0; max-width: 480px; text-align: center; }
.att-story p { font-family: var(--hand); font-size: 29px; line-height: 1.25; margin: 0 0 20px; opacity: 0; transform: translateY(12px); filter: blur(5px); transition: opacity 1.8s ease, transform 1.8s ease, filter 1.8s ease; }
.att-story p.show { opacity: 1; transform: none; filter: none; }
.att-story p:last-child { color: var(--pink-dd); font-size: 33px; font-weight: 700; }
.fade-in { animation: fadeUp 1.2s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- 5. surat */
.letter-sheet { background-color: #FDF3F1; }
.env-area { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: calc(100vh - 150px); min-height: calc(100dvh - 150px); transition: opacity .6s, transform .6s; }
.env-area.gone { opacity: 0; transform: translateY(-30px) scale(.95); }
.teaser { font-family: var(--hand); font-weight: 700; font-size: clamp(32px, 8.5vw, 44px); text-align: center; line-height: 1.1; margin: 0 0 14px; max-width: 420px; animation: fadeUp 1.4s ease backwards; }
.teaser, .env-area .hint { transition: opacity .5s ease; }
.env-area.opening .teaser, .env-area.opening .hint { opacity: 0; }
.envelope { position: relative; width: min(300px, 80vw); aspect-ratio: 3 / 2; margin: 34px auto 18px; cursor: pointer; perspective: 900px; animation: floaty 3.4s ease-in-out infinite; outline-offset: 10px; }
.env-back { position: absolute; inset: 0; background: #EFA9BA; border: 2.5px solid var(--ink); border-radius: 8px; }
.env-paper { position: absolute; left: 7%; right: 7%; top: 6%; height: 86%; z-index: 2; display: flex; justify-content: center; padding-top: 14px; background: var(--paper) repeating-linear-gradient(180deg, transparent 0 15px, rgba(127,181,221,.3) 15px 16px); border: 2px solid var(--ink); border-radius: 5px; font-family: var(--hand); font-size: 24px; font-weight: 700; color: var(--pink-dd); transition: transform 1.1s cubic-bezier(.3, 1.2, .5, 1) .5s; }
.env-front { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; overflow: visible; }
.env-flap { position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; overflow: visible; transform-origin: top center; transition: transform .7s ease; }
.envelope.flap-back .env-flap { z-index: 1; }
.env-seal { position: absolute; z-index: 5; left: 50%; top: 58%; width: 50px; height: 50px; translate: -50% -50%; display: grid; place-items: center; border-radius: 50%; color: #fff; font-size: 24px; background: radial-gradient(circle at 35% 30%, #f3a3b7, #c9667f); border: 2.5px solid var(--ink); box-shadow: 0 3px 0 rgba(74,64,88,.4); transition: transform .4s, opacity .4s; }
.env-deco { position: absolute; z-index: 6; pointer-events: none; transform: rotate(var(--r, 0deg)); }
.envelope:hover .env-seal { transform: scale(1.1) rotate(-8deg); }
.envelope.open { animation: none; }
.envelope.open .env-flap { transform: rotateX(180deg); }
.envelope.open .env-seal { transform: scale(0); opacity: 0; }
.envelope.open .env-paper { transform: translateY(-62%); }

.letter {
  position: relative; max-width: 600px; margin: 6px auto 0;
  background: #fff; border-radius: 6px; padding: 38px 20px 34px 24px;
  box-shadow: 0 2px 0 rgba(74,64,88,.06), 0 16px 36px rgba(74,64,88,.14);
  transform: rotate(-.4deg); animation: letterRise 1.1s cubic-bezier(.2, 1, .3, 1) both;
}
@keyframes letterRise { from { opacity: 0; transform: translateY(60px) scale(.94) rotate(2deg); } to { opacity: 1; transform: rotate(-.4deg); } }
.letter-greet { font-family: var(--hand); font-size: 40px; font-weight: 700; color: var(--pink-dd); margin: 0 0 6px; line-height: 1.1; }
.letter-body {
  font-family: var(--note); font-size: 19px; line-height: 34px; white-space: pre-wrap; overflow-wrap: anywhere;
  background-image: repeating-linear-gradient(180deg, transparent 0 33px, rgba(127,181,221,.32) 33px 34px);
  min-height: 34px;
}
.caret { display: inline-block; width: 2px; height: 20px; margin-left: 1px; vertical-align: -3px; background: var(--pink-dd); animation: caret .8s steps(1) infinite; }
.caret.off { display: none; }
@keyframes caret { 50% { opacity: 0; } }
.letter-sign { font-family: var(--hand); font-size: 36px; font-weight: 700; text-align: right; margin: 18px 8px 0 0; transform: rotate(-3deg); color: var(--ink); animation: fadeUp 1.2s ease both; }
.letter-actions { position: sticky; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 5; display: flex; justify-content: center; gap: 10px; margin-top: 22px; }

/* ---------------------------------------------------------------- 6. galeri */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 26px 16px; margin: 26px 0 8px; }
@media (min-width: 720px) { .gallery { grid-template-columns: repeat(3, 1fr); gap: 34px 22px; } }
.polaroid {
  position: relative; display: block; width: 100%; padding: 9px 9px 0; border: 0; text-align: center; cursor: zoom-in;
  background: #fff; border-radius: 3px; box-shadow: 0 2px 0 rgba(74,64,88,.08), 0 10px 20px rgba(74,64,88,.16);
  opacity: 0; transform: translateY(30px) rotate(0deg) scale(.9);
  transition: opacity .7s ease, transform .7s cubic-bezier(.2, 1.3, .4, 1), box-shadow .2s;
}
.polaroid.show { opacity: 1; transform: rotate(var(--r, 0deg)); }
.polaroid.show:hover { transform: rotate(0deg) scale(1.04); z-index: 4; box-shadow: 0 18px 30px rgba(74,64,88,.22); }
.polaroid::before { content: ''; position: absolute; z-index: 2; top: -11px; left: 50%; width: 64px; height: 22px; translate: -50% 0; rotate: var(--tr, -4deg); opacity: .9; background: repeating-linear-gradient(45deg, rgba(247,198,208,.95) 0 7px, rgba(255,255,255,.7) 7px 12px); }
.polaroid:nth-child(3n+2)::before { background: repeating-linear-gradient(-45deg, rgba(191,221,242,.95) 0 7px, rgba(255,255,255,.7) 7px 12px); }
.polaroid:nth-child(3n)::before { background: radial-gradient(rgba(255,255,255,.85) 2px, transparent 2.4px) 0 0 / 10px 10px, rgba(255,231,163,.95); }
.ph-frame { aspect-ratio: 1; overflow: hidden; background: #eee; }
.ph-frame img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 68%; }
.ph { width: 100%; height: 100%; display: grid; place-content: center; justify-items: center; gap: 6px; color: rgba(74,64,88,.55); font-family: var(--note); font-size: 15px; background: linear-gradient(135deg, var(--pink), var(--blue)); }
.ph svg { width: 40px; height: 40px; }
.cap { display: block; font-family: var(--hand); font-weight: 700; font-size: 21px; line-height: 1.1; padding: 9px 4px 12px; min-height: 46px; }
.doodle-note { font-family: var(--hand); font-size: 26px; font-weight: 700; color: var(--blue-dd); text-align: right; transform: rotate(-4deg); margin: 16px 6px 0 0; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.doodle-note .arrow { width: 58px; height: 36px; transform: scaleY(-1) rotate(180deg); }

.lightbox { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 60px 14px; background: rgba(40,34,52,.78); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fadeIn .3s ease; }
.lb-card { margin: 0; width: min(520px, 92vw); background: #fff; padding: 14px 14px 0; border-radius: 4px; box-shadow: 0 30px 60px rgba(0,0,0,.35); transform: rotate(-1.5deg); animation: popIn .45s cubic-bezier(.2, 1.3, .4, 1); }
.lb-card .ph-frame { aspect-ratio: auto; max-height: 68vh; display: grid; }
.lb-card .ph-frame img { max-height: 68vh; object-fit: contain; background: #faf7f2; }
.lb-card .ph { aspect-ratio: 1; }
.lb-card .cap { font-size: 28px; }
.lb-close { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 14px; }
.lb-nav { position: absolute; top: 50%; translate: 0 -50%; font-size: 28px; }
.lb-nav.prev { left: 8px; } .lb-nav.next { right: 8px; }

/* ---------------------------------------------------------------- 7. penutup */
.ending { text-align: center; }
.end-art { width: min(300px, 88%); margin: 0 auto; animation: floaty 5s ease-in-out infinite; }
.end-steps { list-style: none; padding: 0; margin: 14px auto 0; max-width: 360px; text-align: left; }
.end-steps li { font-family: var(--note); font-size: 21px; padding: 8px 12px; margin: 8px 0; border-radius: 10px; background: rgba(255,246,218,.9); border: 2px dashed rgba(74,64,88,.25); opacity: 0; transform: translateX(-16px); transition: opacity .8s ease, transform .8s cubic-bezier(.2, 1.3, .4, 1); }
.end-steps li:nth-child(2) { background: rgba(238,246,252,.95); }
.end-steps li:nth-child(3) { background: rgba(255,240,243,.95); }
.end-steps li.show { opacity: 1; transform: none; }
.proud { font-family: var(--hand); font-weight: 700; font-size: clamp(58px, 16vw, 86px); line-height: 1; margin: 30px 0 0; color: var(--pink-dd); text-shadow: 3px 3px 0 #fff, 5px 5px 0 var(--blue); clip-path: inset(0 100% 0 0); opacity: 0; }
.proud.show { opacity: 1; animation: write 2s cubic-bezier(.5, 0, .3, 1) forwards; }
@keyframes write { from { clip-path: inset(-20% 100% -20% 0); } to { clip-path: inset(-20% -5% -20% 0); } }
.end-sub { font-family: var(--hand); font-size: 30px; color: var(--blue-dd); margin: 8px 0 0; opacity: 0; transition: opacity 1.2s ease, transform 1.2s ease; transform: translateY(10px); }
.end-sub.show { opacity: 1; transform: none; }
.end-actions { display: flex; flex-direction: column; align-items: stretch; gap: 14px; width: min(300px, 100%); margin: 30px auto 0; opacity: 0; transform: translateY(16px); transition: opacity 1s ease, transform 1s ease; pointer-events: none; }
.end-actions.show { opacity: 1; transform: none; pointer-events: auto; }

/* ---------------------------------------------------------------- 0. login */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.gate {
  position: fixed; inset: 0; z-index: 80; overflow-y: auto;
  display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
  background:
    radial-gradient(#cfe1f0 1.3px, transparent 1.6px) 0 0 / 22px 22px,
    linear-gradient(160deg, #EEF5FB 0%, #FBEFF3 100%);
  transition: opacity .7s ease, visibility .7s;
}
.gate.unlocking { opacity: 0; visibility: hidden; }
body.locked .topbar, body.locked .stage { visibility: hidden; }
.gate-card {
  position: relative; width: 100%; max-width: 380px; text-align: center;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 22px;
  padding: 34px 24px 26px; box-shadow: 8px 8px 0 var(--blue);
  background-image: repeating-linear-gradient(180deg, transparent 0 33px, rgba(127,181,221,.2) 33px 34px);
  animation: popIn .7s cubic-bezier(.2, 1.4, .4, 1);
}
.gate-card .h-hand { font-size: 40px; }
.lock { width: 78px; margin: 0 auto 4px; animation: floaty 3.5s ease-in-out infinite; }
.lock svg { width: 100%; display: block; overflow: visible; }
.lock-shackle { transition: transform .5s cubic-bezier(.3, 1.6, .5, 1); transform-origin: 58px 40px; }
.gate.open .lock-shackle { transform: translateY(-9px) rotate(28deg); }
.gate-card.shake { animation: shake .45s; }
.pw-field { position: relative; display: block; margin: 20px 0 0; }
.pw-field input {
  width: 100%; font: 600 17px var(--sans); color: var(--ink);
  padding: 14px 52px 14px 16px; border: 2.5px solid var(--ink); border-radius: 14px; background: #fff;
  box-shadow: inset 0 3px 0 rgba(74,64,88,.06); outline: none;
}
.pw-field input:focus { border-color: var(--pink-d); box-shadow: 0 0 0 4px rgba(229,141,163,.25); }
.pw-eye { position: absolute; right: 6px; top: 50%; translate: 0 -50%; width: 42px; height: 42px; border: 0; background: none; font-size: 20px; cursor: pointer; border-radius: 10px; }
.gate-msg { font-family: var(--hand); font-weight: 700; font-size: 24px; color: var(--pink-dd); min-height: 32px; margin: 8px 0 6px; }
.gate-hint { font-family: var(--note); font-size: 15px; color: var(--ink-soft); margin: 16px 0 0; }

/* ---------------------------------------------------------------- 3b. puzzle */
.pz-wrap { position: relative; width: min(100%, 460px); margin: 0 auto; }
.pz-board {
  position: relative; width: 100%; aspect-ratio: var(--ar, 4 / 3);
  border: 3px solid var(--ink); border-radius: 12px; background: var(--ink); overflow: hidden;
  box-shadow: 6px 6px 0 var(--pink);
  touch-action: manipulation;
}
.pz-tile {
  position: absolute; padding: 0; border: 0; cursor: pointer;
  background-repeat: no-repeat; background-color: var(--pink);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.85);
  transition: left .35s cubic-bezier(.3, 1.3, .5, 1), top .35s cubic-bezier(.3, 1.3, .5, 1), box-shadow .3s, transform .2s, filter .2s;
}
.pz-tile.sel { z-index: 3; transform: scale(.92); box-shadow: inset 0 0 0 4px var(--yellow), 0 8px 18px rgba(0,0,0,.35); filter: brightness(1.08); }
.pz-tile.moving { z-index: 4; }
.pz-board.solved .pz-tile { box-shadow: none; cursor: default; }
.pz-board.solved { animation: pop .7s cubic-bezier(.2, 1.6, .4, 1); }
.pz-peek { position: absolute; inset: 0; z-index: 5; border: 3px solid var(--ink); border-radius: 12px; background-size: cover; background-position: center; animation: fadeIn .25s ease; }

/* galeri: video */
.ph-frame video { width: 100%; height: 100%; object-fit: cover; display: block; background: #222; }
.play-badge { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; translate: -50% -50%; display: grid; place-items: center; border-radius: 50%; background: rgba(255,253,247,.92); border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); font-size: 20px; padding-left: 4px; pointer-events: none; }
.polaroid .ph-frame { position: relative; }
.lb-card video { width: 100%; max-height: 68vh; display: block; background: #111; }

/* ---------------------------------------------------------------- canvas */
#fx { position: fixed; inset: 0; z-index: 50; pointer-events: none; }

/* ---------------------------------------------------------------- aksesibilitas */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .2s !important; }
  .polaroid, .att-story p, .end-steps li { transition-duration: .4s !important; }
}
