/* ==========================================================
   BUKA SAAT… — style.css
   Konsep: "meja tulis tengah malam".
   Layarnya gelap & hangat seperti kamar berlampu satu,
   dan satu-satunya benda yang benar-benar terang adalah kertas suratnya.
   ========================================================== */

:root {
    /* Warna tema — diganti oleh script.js tiap surat */
    --t1: #17111c;          /* dasar gelap */
    --t2: #2a1f33;          /* dasar sedang */
    --glow: #c9a0dc;        /* cahaya lampu */
    --accent: #e0a9b8;      /* aksen tombol & garis */

    /* Warna tetap */
    --paper: #f7f0e3;
    --paper-2: #efe4d0;
    --paper-ink: #1f1915;     /* Dipergelap agar teks utama jauh lebih kontras */
    --paper-soft: #5c5045;    /* Dipergelap agar teks kecil/keterangan tetap terbaca */
    --on-dark: #f3eae2;
    --gold: #d9a441;

    /* Bentuk */
    --r-sm: 10px;
    --r-md: 16px;
    --r-lg: 24px;

    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);

    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: #120d17;
}

body {
    font-family: 'Karla', ui-sans-serif, system-ui, -apple-system, sans-serif;
    color: var(--on-dark);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; }

::selection { background: var(--accent); color: #1a1118; }

/* ==========================================================
   LAPISAN SUASANA
   ========================================================== */
#bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(120% 80% at 50% 0%, var(--t2), transparent 70%),
        linear-gradient(170deg, var(--t1), #0b0810 120%);
    transition: background 1.6s ease;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.5;
    background: radial-gradient(circle, var(--glow), transparent 70%);
    transition: background 1.6s ease;
    will-change: transform;
}
.orb-a { width: 60vmax; height: 60vmax; left: -22vmax; top: -18vmax; animation: drift-a 26s ease-in-out infinite; }
.orb-b { width: 46vmax; height: 46vmax; right: -16vmax; bottom: -14vmax; opacity: 0.38; animation: drift-b 32s ease-in-out infinite; }
.orb-c { width: 30vmax; height: 30vmax; left: 55%; top: 55%; opacity: 0.22; animation: drift-c 38s ease-in-out infinite; }

@keyframes drift-a { 50% { transform: translate3d(10vmax, 6vmax, 0) scale(1.15); } }
@keyframes drift-b { 50% { transform: translate3d(-9vmax, -7vmax, 0) scale(1.1); } }
@keyframes drift-c { 50% { transform: translate3d(-12vmax, 8vmax, 0) scale(0.85); } }

/* Cahaya "lampu meja" yang mengikuti jari / kursor */
#lamp {
    position: fixed;
    left: 50%;
    top: 40%;
    width: 46vmax;
    height: 46vmax;
    margin: -23vmax 0 0 -23vmax;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.3;
    background: radial-gradient(circle, var(--glow), transparent 62%);
    mix-blend-mode: screen;
    filter: blur(20px);
    transition: transform 1.4s cubic-bezier(.22,.61,.36,1), background 1.6s ease;
}

#particles { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }

#vignette {
    position: fixed;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: radial-gradient(130% 100% at 50% 45%, transparent 45%, rgba(0,0,0,.55) 100%);
}

#grain {
    position: fixed;
    inset: -50%;
    z-index: 4;
    pointer-events: none;
    opacity: .045;
    background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"%3E%3Cfilter id="n"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="3"/%3E%3C/filter%3E%3Crect width="200" height="200" filter="url(%23n)"/%3E%3C/svg%3E');
    animation: grain 700ms steps(3) infinite;
}
@keyframes grain {
    0%   { transform: translate(0, 0); }
    33%  { transform: translate(-3%, 2%); }
    66%  { transform: translate(2%, -3%); }
    100% { transform: translate(0, 0); }
}

/* ==========================================================
   KONTROL ATAS
   ========================================================== */
.topbar {
    position: fixed;
    top: calc(var(--safe-t) + 14px);
    left: 0;
    right: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
}
.topbar-spacer { flex: 1; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: .8rem;
    letter-spacing: .02em;
    color: var(--on-dark);
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: pointer;
    transition: background .25s ease, opacity .25s ease, transform .25s ease;
}
.chip:hover { background: rgba(255,255,255,.14); }
.chip:active { transform: scale(.96); }
.chip[hidden] { display: none; }

/* Ikon equalizer kecil di tombol musik */
.eq { display: flex; align-items: flex-end; gap: 2px; height: 11px; }
.eq i {
    width: 2px;
    height: 4px;
    background: var(--accent);
    border-radius: 1px;
    opacity: .45;
}
.chip-sound[aria-pressed="true"] .eq i { opacity: 1; animation: eq 900ms ease-in-out infinite; }
.chip-sound[aria-pressed="true"] .eq i:nth-child(2) { animation-delay: .18s; }
.chip-sound[aria-pressed="true"] .eq i:nth-child(3) { animation-delay: .36s; }
@keyframes eq { 50% { height: 11px; } }

/* ==========================================================
   KERANGKA LAYAR
   ========================================================== */
.view {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: calc(var(--safe-t) + 66px) 20px calc(var(--safe-b) + 26px);
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 0;
    visibility: hidden;
    transform: scale(.985);
    filter: blur(8px);
    transition: opacity .65s ease, transform .65s ease, filter .65s ease, visibility 0s .65s;
}
.view.active {
    opacity: 1;
    visibility: visible;
    transform: none;
    filter: none;
    transition: opacity .8s ease, transform .8s ease, filter .8s ease, visibility 0s 0s;
}

/* ==========================================================
   TIPOGRAFI
   ========================================================== */
.display {
    font-family: 'Fraunces', Georgia, serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-size: clamp(2.6rem, 11vw, 4.4rem);
    line-height: 1.02;
    letter-spacing: -.02em;
    margin: 0;
    text-wrap: balance;
}
.display.sm { font-size: clamp(1.5rem, 5.4vw, 2rem); font-style: italic; font-weight: 300; }
.dots { color: var(--accent); }

.kicker {
    font-family: 'Caveat', cursive;
    font-size: 1.35rem;
    color: var(--accent);
    margin: 0 0 6px;
    letter-spacing: .01em;
}

.lede {
    max-width: 30ch;
    margin: 14px auto 26px;
    font-size: .98rem;
    line-height: 1.6;
    opacity: .72;
    text-wrap: pretty;
}

.muted { opacity: .6; font-size: .82rem; margin: 6px 0 0; }
.hint-sm { font-size: .75rem; opacity: .45; margin: 16px 0 0; }

/* ==========================================================
   TOMBOL
   ========================================================== */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 13px 26px;
    font-size: .95rem;
    font-weight: 500;
    letter-spacing: .01em;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--on-dark);
    cursor: pointer;
    overflow: hidden;
    transition: transform .22s cubic-bezier(.34,1.56,.64,1), background .25s ease, box-shadow .25s ease;
}
.btn:hover { background: color-mix(in srgb, var(--accent) 26%, transparent); box-shadow: 0 8px 30px -10px var(--glow); }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }

.btn-primary { padding: 15px 34px; font-size: 1rem; }
.btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.28), transparent 70%);
    transform: translateX(-120%);
    animation: sheen 4.5s ease-in-out infinite;
}
@keyframes sheen { 0%, 62% { transform: translateX(-120%); } 88%, 100% { transform: translateX(120%); } }

.btn-sm { min-height: 42px; padding: 10px 18px; font-size: .85rem; }

.ghost-link {
    margin-top: 22px;
    padding: 10px 6px;
    background: none;
    border: none;
    font-size: .82rem;
    opacity: .5;
    letter-spacing: .02em;
    cursor: pointer;
    transition: opacity .25s ease;
}
.ghost-link:hover { opacity: .9; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ==========================================================
   1. HALAMAN DEPAN
   ========================================================== */
.landing-inner {
    margin: auto 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: rise .9s cubic-bezier(.22,.61,.36,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

/* Amplop utama, dibuat dari CSS supaya tajam di layar apa pun */
.cover-envelope {
    position: relative;
    width: clamp(150px, 46vw, 190px);
    aspect-ratio: 1.45 / 1;
    margin: 4px 0 30px;
    animation: breathe 6s ease-in-out infinite;
    cursor: pointer;
}
@keyframes breathe {
    50% { transform: translateY(-9px) rotate(-1.2deg); }
}
.ce-body {
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background: linear-gradient(165deg, var(--paper) 0%, var(--paper-2) 100%);
    box-shadow:
        0 30px 60px -20px rgba(0,0,0,.65),
        0 0 70px -12px var(--glow),
        inset 0 -14px 26px -18px rgba(0,0,0,.35);
}
.ce-body::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background:
        linear-gradient(to bottom right, transparent 49.4%, rgba(0,0,0,.07) 50%, transparent 50.6%),
        linear-gradient(to bottom left,  transparent 49.4%, rgba(0,0,0,.07) 50%, transparent 50.6%);
}
.ce-flap {
    position: absolute;
    left: 0; right: 0; top: 0;
    height: 62%;
    background: linear-gradient(175deg, var(--paper-2), color-mix(in srgb, var(--paper-2) 78%, #000));
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    border-radius: 8px 8px 0 0;
    filter: drop-shadow(0 3px 4px rgba(0,0,0,.18));
}
.ce-seal {
    position: absolute;
    left: 50%;
    top: 56%;
    width: 46px;
    height: 46px;
    margin: -23px 0 0 -23px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    color: #fff5f6;
    background: radial-gradient(circle at 34% 30%, #e0687f, #9d2f4b);
    box-shadow: 0 6px 16px -4px rgba(0,0,0,.6), inset 0 -3px 6px rgba(0,0,0,.3), inset 0 2px 4px rgba(255,255,255,.35);
    animation: seal-pulse 3.2s ease-in-out infinite;
}
@keyframes seal-pulse { 50% { transform: scale(1.06); } }

/* ==========================================================
   2. MEJA SURAT
   ========================================================== */
.desk-inner { margin: auto 0; width: 100%; max-width: 780px; }
.desk-head { text-align: center; margin-bottom: 26px; }
.desk-foot { text-align: center; font-size: .75rem; opacity: .38; margin: 26px 0 0; }

.desk-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}
@media (min-width: 620px) { .desk-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; } }

/* Kartu amplop */
.env {
    position: relative;
    aspect-ratio: 1 / 1.04;
    border: none;
    padding: 0;
    border-radius: 12px;
    background: linear-gradient(168deg, var(--paper) 0%, var(--paper-2) 100%);
    box-shadow: 0 16px 30px -18px rgba(0,0,0,.8), inset 0 -10px 20px -16px rgba(0,0,0,.4);
    cursor: pointer;
    overflow: hidden;
    text-align: center;
    transform: rotate(var(--tilt, 0deg));
    transition: transform .4s cubic-bezier(.34,1.4,.64,1), box-shadow .4s ease;
    animation: env-in .6s cubic-bezier(.22,.61,.36,1) backwards;
    animation-delay: var(--d, 0ms);
}
@keyframes env-in { from { opacity: 0; transform: translateY(16px) rotate(var(--tilt, 0deg)) scale(.94); } }

.env:nth-child(3n+1) { --tilt: -1.6deg; }
.env:nth-child(3n+2) { --tilt: 1.2deg; }
.env:nth-child(3n+3) { --tilt: -.6deg; }

.env:hover, .env:focus-visible {
    transform: translateY(-7px) rotate(0deg) scale(1.035);
    box-shadow: 0 26px 44px -20px rgba(0,0,0,.85), 0 0 46px -14px var(--glow);
}
.env:active { transform: translateY(-2px) scale(.99); }

.env-flap {
    position: absolute;
    left: 0; right: 0; top: 0;
    height: 46%;
    background: linear-gradient(178deg, color-mix(in srgb, var(--paper-2) 96%, #fff), color-mix(in srgb, var(--paper-2) 72%, #000));
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.env-icon {
    position: absolute;
    left: 0; right: 0;
    top: 46%;
    font-size: 1.7rem;
    line-height: 1;
    transform: translateY(-58%);
    filter: drop-shadow(0 4px 6px rgba(0,0,0,.25));
}
.env-text {
    position: absolute;
    left: 10px; right: 10px;
    bottom: 14px;
}
.env-kick {
    display: block;
    font-size: .62rem;
    letter-spacing: .14em;
    color: var(--paper-soft);
    margin-bottom: 3px;
}
.env-title {
    display: block;
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 500;
    font-size: .98rem;
    line-height: 1.15;
    color: var(--paper-ink);
    text-wrap: balance;
}
.env-read {
    position: absolute;
    top: 8px;
    right: 9px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: .55rem;
    color: #fff;
    background: radial-gradient(circle at 34% 30%, #d38a4f, #93502a);
    opacity: 0;
    transform: scale(.4);
    transition: opacity .3s ease, transform .3s cubic-bezier(.34,1.56,.64,1);
}
.env.opened .env-read { opacity: .9; transform: scale(1); }
.env.opened .env-flap { background: linear-gradient(178deg, color-mix(in srgb, var(--paper-2) 88%, #fff), color-mix(in srgb, var(--paper-2) 66%, #000)); }

/* Amplop terkunci */
.env.locked { cursor: not-allowed; }
.env.locked .env-icon, .env.locked .env-title { filter: blur(3px); opacity: .55; }
.env.locked::after {
    content: '🔒';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 1.4rem;
    background: rgba(24,16,28,.42);
    backdrop-filter: blur(1px);
}
.env.unlocking { animation: unlock-shake .6s ease; }
@keyframes unlock-shake {
    20% { transform: rotate(var(--tilt)) translateX(-5px); }
    45% { transform: rotate(var(--tilt)) translateX(5px); }
    70% { transform: rotate(var(--tilt)) translateX(-3px); }
}

/* Animasi amplop terbang ke tengah saat dipilih */
.env-fly {
    position: fixed;
    z-index: 60;
    perspective: 700px;
    border-radius: 12px;
    background: linear-gradient(168deg, var(--paper), var(--paper-2));
    box-shadow: 0 30px 60px -20px rgba(0,0,0,.8), 0 0 80px -10px var(--glow);
    pointer-events: none;
    transition: transform .85s cubic-bezier(.62,.02,.28,1), opacity .4s ease .6s;
}
.env-fly .env-flap {
    transform-origin: top center;
    transition: transform .55s cubic-bezier(.62,.02,.28,1) .25s;
    backface-visibility: hidden;
}
.env-fly.go .env-flap { transform: rotateX(-172deg); }

/* ==========================================================
   3. JEDA CERITA
   ========================================================== */
.story {
    margin: auto 0;
    max-width: 22ch;
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 300;
    font-size: clamp(1.7rem, 7vw, 2.5rem);
    line-height: 1.25;
    text-align: center;
    text-wrap: balance;
    opacity: 0;
    filter: blur(6px);
    transform: translateY(14px);
    transition: opacity 1s ease, filter 1s ease, transform 1s ease;
}
.story.show { opacity: 1; filter: none; transform: none; }

/* ==========================================================
   4. KERTAS SURAT
   ========================================================== */
#view-letter { padding-top: calc(var(--safe-t) + 74px); }

.paper {
    position: relative;
    margin: auto 0;
    width: 100%;
    max-width: 540px;
    padding: 30px 26px 28px;
    color: var(--paper-ink);
    background:
        linear-gradient(168deg, var(--paper) 0%, color-mix(in srgb, var(--paper) 88%, var(--paper-2)) 100%);
    box-shadow:
        0 40px 80px -30px rgba(0,0,0,.85),
        0 0 100px -30px var(--glow),
        inset 0 0 70px -30px rgba(120, 90, 60, .35);
    opacity: 0;
    transform: translateY(26px) scale(.985) rotate(-.3deg);
    transition: opacity .8s ease, transform .9s cubic-bezier(.22,.61,.36,1);
}
.paper.open { opacity: 1; transform: rotate(-.3deg); }

/* Tepi kertas disobek pelan-pelan, bukan dipotong mesin */
.paper::before, .paper::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 9px;
    background: radial-gradient(circle at 7px 9px, var(--paper) 6.5px, transparent 7px) repeat-x 0 0 / 14px 9px;
}
.paper::before { top: -8px; }
.paper::after { bottom: -8px; transform: scaleY(-1); background-color: transparent; }

.paper-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}
.stamp {
    display: grid;
    place-items: center;
    width: 46px;
    height: 54px;
    font-size: 1.5rem;
    border-radius: 3px;
    transform: rotate(-4deg);
    background: color-mix(in srgb, var(--accent) 22%, var(--paper));
    box-shadow: 0 2px 6px rgba(0,0,0,.14);
    /* gigi perangko */
    -webkit-mask: radial-gradient(circle at 0 0, transparent 3px, #000 3.5px) 0 0 / 8px 8px;
            mask: radial-gradient(circle at 0 0, transparent 3px, #000 3.5px) 0 0 / 8px 8px;
}
.postmark {
    font-family: 'Caveat', cursive;
    font-size: 1.05rem;
    color: var(--paper-soft);
    transform: rotate(-1.5deg);
}

.paper-to {
    font-family: 'Caveat', cursive;
    font-size: 1.7rem;
    margin: 0 0 12px;
    color: color-mix(in srgb, var(--paper-ink) 85%, var(--accent));
}

.paper-body {
    font-family: 'Fraunces', Georgia, serif;
    font-optical-sizing: auto;
    font-weight: 300;
    font-size: 1.02rem;
    line-height: 1.78;
    max-width: 62ch;
}
.paper-body p { margin: 0 0 1.05em; }
.paper-body .line {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .7s ease, transform .7s ease;
}
.paper-body .line.in { opacity: 1; transform: none; }

.paper-body > p:first-of-type::first-letter {
    float: left;
    font-size: 3.1em;
    line-height: .84;
    padding: 6px 9px 0 0;
    font-weight: 500;
    color: color-mix(in srgb, var(--accent) 65%, var(--paper-ink));
}

.paper-tag {
    font-family: 'Karla', sans-serif;
    font-size: .72rem;
    letter-spacing: .12em;
    color: var(--paper-soft);
    margin-bottom: 14px !important;
}
.paper-body .big-line {
    font-size: 1.24rem;
    line-height: 1.6;
    text-align: center;
    font-style: italic;
}
.paper-body > p:first-of-type.paper-tag::first-letter,
.paper-body > p:first-of-type.big-line::first-letter { float: none; font-size: inherit; padding: 0; color: inherit; line-height: inherit; }

.paper-ps {
    font-family: 'Caveat', cursive;
    font-size: 1.4rem;
    line-height: 1.35;
    color: color-mix(in srgb, var(--paper-ink) 75%, var(--paper-soft));
    border-top: 1px dashed color-mix(in srgb, var(--paper-soft) 45%, transparent);
    padding-top: 14px;
    margin: 22px 0 0;
    opacity: 0;
    transition: opacity .8s ease;
}
.paper-sign {
    font-family: 'Caveat', cursive;
    font-size: 1.55rem;
    text-align: right;
    margin: 18px 0 0;
    color: color-mix(in srgb, var(--paper-ink) 80%, var(--accent));
    opacity: 0;
    transform: rotate(-2deg);
    transition: opacity 1s ease;
}
.paper-ps.in, .paper-sign.in { opacity: 1; }

.paper-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 26px;
    opacity: 0;
    transition: opacity .8s ease;
}
.paper-actions.in { opacity: 1; }
.paper-actions .btn {
    min-height: 44px;
    padding: 11px 20px;
    font-size: .86rem;
    color: var(--paper-ink);
    border-color: color-mix(in srgb, var(--paper-ink) 28%, transparent);
    background: color-mix(in srgb, var(--paper-ink) 5%, transparent);
}
.paper-actions .btn:hover {
    background: color-mix(in srgb, var(--paper-ink) 11%, transparent);
    box-shadow: none;
}

/* ==========================================================
   5. KERANGKA PERMAINAN
   ========================================================== */
.exp-wrap {
    margin: auto 0;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: opacity .6s ease;
}
.exp-title {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1.35rem, 5.4vw, 1.7rem);
    line-height: 1.25;
    margin: 0 0 8px;
    text-wrap: balance;
}
.exp-sub { font-size: .85rem; opacity: .65; margin: 0 0 22px; line-height: 1.5; max-width: 30ch; }
.exp-status { font-size: .76rem; opacity: .55; margin: 12px 0 0; letter-spacing: .04em; }
.exp-say {
    font-family: 'Caveat', cursive;
    font-size: 1.5rem;
    line-height: 1.3;
    min-height: 3.2rem;
    margin: 14px 0 0;
    transition: opacity .3s ease;
}
.stack { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.stack.wide > .btn { width: 100%; max-width: 300px; }
.row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hide { display: none !important; }
.mt { margin-top: 20px; }

/* Meteran umum */
.meter {
    width: min(270px, 78vw);
    height: 10px;
    margin-top: 16px;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,.4);
}
.meter-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--glow));
    box-shadow: 0 0 14px var(--glow);
    transition: width .3s cubic-bezier(.22,.61,.36,1);
}

/* Ledakan emoji saat diketuk */
.fx-burst {
    position: fixed;
    z-index: 70;
    pointer-events: none;
    animation: burst-out .9s ease-out forwards;
}
@keyframes burst-out {
    0%   { opacity: 1; transform: translate(-50%, -50%) scale(.4); }
    100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2); }
}

/* Pesan singkat di bawah layar */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--safe-b) + 26px);
    z-index: 80;
    transform: translate(-50%, 16px);
    max-width: min(340px, 86vw);
    padding: 12px 18px;
    font-size: .84rem;
    line-height: 1.45;
    text-align: center;
    border-radius: 14px;
    background: rgba(18,12,22,.86);
    border: 1px solid rgba(255,255,255,.14);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s ease, transform .35s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================
   6. KOMPONEN TIAP PERMAINAN
   ========================================================== */

/* — Kangen: ketuk hati — */
.tap-heart {
    font-size: 4.6rem;
    line-height: 1;
    background: none;
    border: none;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    filter: drop-shadow(0 0 26px color-mix(in srgb, var(--glow) 70%, transparent));
    transition: transform .18s cubic-bezier(.34,1.56,.64,1), filter .3s ease;
    animation: heart-beat 1.9s ease-in-out infinite;
}
@keyframes heart-beat { 12% { transform: scale(1.07); } 24% { transform: scale(1); } }
.tap-heart:active { transform: scale(.9); }
.tap-heart.full { animation: none; filter: drop-shadow(0 0 40px var(--glow)); }

/* — Sedih: awan jadi matahari — */
.cloud-btn {
    font-size: 4.2rem;
    line-height: 1;
    background: none;
    border: none;
    cursor: pointer;
    touch-action: manipulation;
    filter: drop-shadow(0 10px 22px rgba(0,0,0,.45));
    transition: transform .3s cubic-bezier(.34,1.4,.64,1), filter .6s ease;
}
.cloud-btn:hover { transform: scale(1.08); }
.cloud-btn:active { transform: scale(.94); }
.cloud-btn.sunny { filter: drop-shadow(0 0 34px #ffd27a); }
.comfort-text {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 300;
    font-size: 1.22rem;
    line-height: 1.55;
    min-height: 5.2rem;
    max-width: 26ch;
    display: flex;
    align-items: center;
    text-wrap: balance;
    transition: opacity .45s ease;
}

/* — Capek: tahan cangkir — */
.hold-btn {
    position: relative;
    width: 148px;
    height: 148px;
    display: grid;
    place-items: center;
    border: none;
    background: none;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
}
.hold-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(var(--accent) calc(var(--p, 0) * 1%), rgba(255,255,255,.1) 0);
    box-shadow: 0 0 30px -6px color-mix(in srgb, var(--glow) 60%, transparent);
}
.hold-ring::after {
    content: '';
    position: absolute;
    inset: 9px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 30%, rgba(255,255,255,.1), rgba(0,0,0,.35));
    backdrop-filter: blur(4px);
}
.hold-emoji {
    position: relative;
    z-index: 1;
    font-size: 3.2rem;
    line-height: 1;
    transition: transform .25s ease;
}
.hold-btn.holding .hold-emoji { transform: scale(1.14) rotate(-6deg); }
.steam {
    position: absolute;
    top: 14px;
    width: 5px;
    height: 34px;
    border-radius: 999px;
    background: linear-gradient(to top, transparent, rgba(255,255,255,.5));
    opacity: 0;
    filter: blur(3px);
}
.hold-btn.holding .steam { animation: steam 1.6s ease-out infinite; }
.hold-btn.holding .steam:nth-of-type(2) { animation-delay: .5s; margin-left: 16px; }
@keyframes steam {
    0% { opacity: 0; transform: translateY(6px) scaleY(.6); }
    40% { opacity: .7; }
    100% { opacity: 0; transform: translateY(-26px) scaleY(1.3); }
}

/* Voucher / kupon */
.voucher {
    position: relative;
    width: 100%;
    max-width: 320px;
    margin-top: 6px;
    padding: 18px 20px;
    border-radius: 14px;
    text-align: left;
    background: linear-gradient(150deg, var(--paper), var(--paper-2));
    color: var(--paper-ink);
    box-shadow: 0 24px 40px -22px rgba(0,0,0,.8), 0 0 50px -18px var(--glow);
    animation: voucher-in .6s cubic-bezier(.34,1.4,.64,1) both;
}
.voucher::before, .voucher::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    border-radius: 50%;
    background: var(--t1);
    box-shadow: inset 0 0 6px rgba(0,0,0,.4);
}
.voucher::before { left: -9px; }
.voucher::after { right: -9px; }
.voucher-tag { font-size: .66rem; letter-spacing: .16em; color: var(--paper-soft); margin-bottom: 8px; }
.voucher-text { font-family: 'Fraunces', Georgia, serif; font-size: 1.02rem; line-height: 1.5; }
@keyframes voucher-in { from { opacity: 0; transform: scale(.9) translateY(12px) rotate(-2deg); } }

/* — Malam: tangkap bintang jatuh — */
.sky {
    position: relative;
    width: 100%;
    max-width: 330px;
    height: 250px;
    border-radius: 20px;
    overflow: hidden;
    background:
        radial-gradient(90% 60% at 20% 0%, rgba(255,255,255,.1), transparent 70%),
        linear-gradient(to bottom, rgba(255,255,255,.06), rgba(0,0,0,.25));
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: inset 0 -20px 40px -30px #fff;
}
.sky-moon { position: absolute; left: 16px; top: 12px; font-size: 1.9rem; filter: drop-shadow(0 0 16px #fff9c4); }
.shoot-star {
    position: absolute;
    padding: 14px;
    font-size: 1.7rem;
    line-height: 1;
    background: none;
    border: none;
    cursor: pointer;
    touch-action: manipulation;
    animation: shoot 3s linear forwards;
    filter: drop-shadow(0 0 12px #fff);
}
@keyframes shoot {
    0%   { opacity: 0; transform: translate(0,0) scale(.7); }
    14%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-165px, 185px) scale(1); }
}

/* — Senyum: petik kelopak — */
.flower { position: relative; width: 210px; height: 210px; margin: 4px auto 0; }
.flower-center {
    position: absolute;
    top: 50%; left: 50%;
    width: 60px; height: 60px;
    transform: translate(-50%,-50%);
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    background: radial-gradient(circle at 35% 30%, #ffe9a3, #e8a33c);
    box-shadow: 0 6px 18px rgba(0,0,0,.35), 0 0 30px -6px #ffd98a;
    z-index: 2;
}
.petal {
    position: absolute;
    left: calc(50% - 21px);
    top: calc(50% - 92px);
    width: 42px; height: 70px;
    padding: 0;
    border: none;
    border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
    background: linear-gradient(180deg, #ffd7e4, #f58fb0);
    box-shadow: 0 3px 10px rgba(0,0,0,.25);
    transform-origin: 21px 92px;
    transform: rotate(var(--rot, 0deg));
    cursor: pointer;
    touch-action: manipulation;
}
.petal:hover { filter: brightness(1.08); }
.petal.gone { pointer-events: none; animation: petal-fly 1s ease-in forwards; }
.petal.grow { animation: petal-grow .6s cubic-bezier(.34,1.56,.64,1); }
@keyframes petal-fly {
    from { opacity: 1; transform: rotate(var(--rot)) translate(0,0) rotate(0); }
    to   { opacity: 0; transform: rotate(var(--rot)) translate(46px,-220px) rotate(220deg); }
}
@keyframes petal-grow {
    from { opacity: 0; transform: rotate(var(--rot)) scale(0); }
    to   { opacity: 1; transform: rotate(var(--rot)) scale(1); }
}

/* — Insecure: usap cermin berembun — */
.mirror {
    position: relative;
    width: min(260px, 74vw);
    aspect-ratio: 3 / 4;
    border-radius: 130px 130px 18px 18px;
    overflow: hidden;
    background: linear-gradient(150deg, rgba(255,255,255,.22), rgba(255,255,255,.06) 40%, rgba(255,255,255,.16));
    border: 3px solid color-mix(in srgb, var(--accent) 45%, rgba(255,255,255,.25));
    box-shadow: 0 30px 60px -28px rgba(0,0,0,.9), 0 0 60px -20px var(--glow), inset 0 0 40px rgba(255,255,255,.1);
    touch-action: none;
    cursor: grab;
}
.mirror::after {
    content: '';
    position: absolute;
    top: -40%; left: -30%;
    width: 60%; height: 180%;
    background: linear-gradient(transparent, rgba(255,255,255,.18), transparent);
    transform: rotate(18deg);
    pointer-events: none;
}
.mirror-text {
    position: absolute;
    inset: 12% 14%;
    display: grid;
    place-items: center;
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 300;
    font-size: 1.18rem;
    line-height: 1.5;
    text-wrap: balance;
}
.mist { position: absolute; inset: 0; display: grid; }
.mist i {
    background: rgba(233, 230, 240, .93);
    box-shadow: 0 0 6px 3px rgba(233,230,240,.93);
    transition: opacity .5s ease;
}
.mist i.wiped { opacity: 0; }

/* — Habis berantem: satukan hati yang retak — */
.mend {
    position: relative;
    width: 230px;
    height: 200px;
    margin-top: 4px;
}
.shard {
    position: absolute;
    left: 50%; top: 50%;
    width: 58px; height: 58px;
    margin: -29px 0 0 -29px;
    border: none;
    padding: 0;
    font-size: 2.1rem;
    line-height: 1;
    background: none;
    cursor: pointer;
    touch-action: manipulation;
    transform: translate(var(--x), var(--y)) rotate(var(--r));
    transition: transform .8s cubic-bezier(.34,1.3,.64,1), opacity .5s ease;
    filter: drop-shadow(0 6px 10px rgba(0,0,0,.4));
}
.shard.fixed { transform: translate(0,0) rotate(0); pointer-events: none; }
.mend.whole { animation: mend-pulse 1.6s ease-in-out infinite; }
@keyframes mend-pulse { 50% { transform: scale(1.06); } }

/* — Butuh semangat: toples kertas semangat — */
.jar {
    position: relative;
    width: 140px;
    height: 165px;
    border-radius: 16px 16px 26px 26px;
    background: linear-gradient(150deg, rgba(255,255,255,.2), rgba(255,255,255,.05));
    border: 2px solid rgba(255,255,255,.3);
    box-shadow: inset 0 -30px 40px -30px #fff, 0 20px 40px -24px rgba(0,0,0,.8), 0 0 50px -18px var(--glow);
    cursor: pointer;
    overflow: hidden;
    transition: transform .25s cubic-bezier(.34,1.5,.64,1);
}
.jar:active { transform: scale(.96) rotate(-2deg); }
.jar-lid {
    position: absolute;
    left: 50%; top: -12px;
    width: 104px; height: 20px;
    margin-left: -52px;
    border-radius: 8px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 70%, #fff), var(--accent));
    box-shadow: 0 4px 10px rgba(0,0,0,.4);
    transition: transform .4s cubic-bezier(.34,1.5,.64,1);
}
.jar.pop .jar-lid { transform: translateY(-14px) rotate(-8deg); }
.jar-fill {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    display: flex;
    flex-wrap: wrap-reverse;
    justify-content: center;
    gap: 4px;
    padding: 8px;
}
.jar-fill b {
    width: 22px; height: 14px;
    border-radius: 3px;
    background: var(--paper);
    box-shadow: 0 1px 3px rgba(0,0,0,.4);
    transform: rotate(var(--r, 0deg));
    animation: note-drop .5s cubic-bezier(.34,1.5,.64,1) both;
}
@keyframes note-drop { from { opacity: 0; transform: translateY(-26px) rotate(0); } }
.note {
    width: 100%;
    max-width: 300px;
    margin-top: 18px;
    padding: 16px 18px;
    border-radius: 10px;
    background: linear-gradient(150deg, var(--paper), var(--paper-2));
    color: var(--paper-ink);
    font-family: 'Caveat', cursive;
    font-size: 1.35rem;
    line-height: 1.35;
    box-shadow: 0 20px 34px -20px rgba(0,0,0,.8);
    transform-origin: top center;
    animation: note-unfold .6s cubic-bezier(.34,1.4,.64,1) both;
}
@keyframes note-unfold { from { opacity: 0; transform: rotateX(-80deg) translateY(-10px); } }

/* — Hari spesial: tiup lilin — */
.cake {
    position: relative;
    width: 210px;
    height: 150px;
    margin-top: 10px;
}
.cake-base {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 92px;
    border-radius: 14px 14px 10px 10px;
    background:
        linear-gradient(180deg, #f7d9c4 0 22%, #e7b9a0 22% 32%, #f3cbb3 32%);
    box-shadow: 0 18px 36px -20px rgba(0,0,0,.8), inset 0 -10px 18px -12px rgba(0,0,0,.3);
}
.cake-base::after {
    content: '';
    position: absolute;
    left: 6px; right: 6px; top: 16px;
    height: 12px;
    border-radius: 8px;
    background: repeating-linear-gradient(90deg, #fff 0 8px, transparent 8px 18px);
    opacity: .5;
}
.candle {
    position: absolute;
    bottom: 88px;
    width: 12px; height: 42px;
    border: none;
    padding: 0;
    border-radius: 3px;
    background: repeating-linear-gradient(180deg, #fff 0 7px, var(--accent) 7px 14px);
    cursor: pointer;
    touch-action: manipulation;
}
.flame {
    position: absolute;
    left: 50%; top: -18px;
    width: 14px; height: 20px;
    margin-left: -7px;
    border-radius: 50% 50% 50% 50% / 68% 68% 32% 32%;
    background: radial-gradient(circle at 50% 70%, #fff6c9, #ffb703 60%, #ff7b00);
    box-shadow: 0 0 22px 6px rgba(255,183,3,.55);
    animation: flicker 1.1s ease-in-out infinite;
    transform-origin: bottom center;
}
@keyframes flicker {
    50% { transform: scaleY(1.15) rotate(3deg); opacity: .88; }
}
.candle.out .flame { opacity: 0; transform: scale(.2) translateY(-8px); transition: all .35s ease; animation: none; }
.candle.out { opacity: .75; }

/* — Gabut: tombol kabur — */
.dodge-area {
    position: relative;
    width: 100%;
    height: 240px;
    border-radius: 18px;
    border: 1px dashed color-mix(in srgb, var(--on-dark) 25%, transparent);
    background: rgba(255,255,255,.03);
}
.dodge-btn { position: absolute; white-space: nowrap; transition: left .28s cubic-bezier(.34,1.3,.64,1), top .28s cubic-bezier(.34,1.3,.64,1); }

/* — Gabut: gacha — */
.reel {
    width: 74px; height: 92px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 2.4rem;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.16);
    box-shadow: inset 0 0 18px rgba(0,0,0,.45);
    user-select: none;
}
.reel.win { animation: reel-win .5s ease-in-out infinite alternate; box-shadow: 0 0 30px -4px var(--glow); }
@keyframes reel-win { to { transform: scale(1.1) rotate(2deg); } }

/* — Gabut: tangkap muka — */
.mole-grid { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; justify-content: center; }
.hole {
    width: 76px; height: 76px;
    border-radius: 50%;
    border: none;
    display: grid;
    place-items: center;
    font-size: 2.2rem;
    line-height: 1;
    background: rgba(0,0,0,.3);
    box-shadow: inset 0 8px 14px rgba(0,0,0,.55), inset 0 -3px 0 rgba(255,255,255,.06);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}
.hole.up { background: rgba(255,255,255,.1); animation: hole-up .18s ease-out; }
@keyframes hole-up { from { transform: scale(.6) translateY(12px); } }

/* — Gabut: suit jari — */
.suit-btn {
    width: 84px; height: 84px;
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,.16);
    background: rgba(255,255,255,.07);
    font-size: 2.3rem;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform .2s cubic-bezier(.34,1.5,.64,1), background .2s ease;
}
.suit-btn:hover { background: rgba(255,255,255,.14); transform: translateY(-4px); }
.suit-stage { display: flex; align-items: center; justify-content: center; gap: 18px; font-size: 3rem; min-height: 80px; }
.suit-vs { font-family: 'Fraunces', serif; font-size: 1rem; opacity: .5; }
.shaking { animation: shake-hand .35s ease-in-out infinite; }
@keyframes shake-hand { 50% { transform: translateY(-10px) rotate(-8deg); } }

/* — Gabut: tombol yang dilarang dipencet — */
.no-press {
    padding: 18px 30px;
    border-radius: 18px;
    border: 2px solid #ff8fab;
    background: rgba(255,143,171,.14);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 0 34px -10px #ff8fab;
    transition: transform .18s cubic-bezier(.34,1.6,.64,1);
}
.no-press:active { transform: scale(.94); }

/* ==========================================================
   7. PARTIKEL
   ========================================================== */
.p {
    position: absolute;
    pointer-events: none;
    will-change: transform;
}
.p-bokeh {
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--glow) 85%, #fff), transparent 70%);
    filter: blur(1px);
    animation: float-up linear infinite;
}
.p-emoji { animation: float-up linear infinite; }
@keyframes float-up {
    0%   { transform: translate3d(0, 110vh, 0) rotate(0); opacity: 0; }
    12%  { opacity: var(--o, .6); }
    88%  { opacity: var(--o, .6); }
    100% { transform: translate3d(var(--drift, 20px), -12vh, 0) rotate(260deg); opacity: 0; }
}
.p-rain {
    width: 1.5px;
    height: 68px;
    border-radius: 999px;
    background: linear-gradient(transparent, rgba(190,215,235,.55));
    animation: rain-fall linear infinite;
}
@keyframes rain-fall {
    0%   { transform: translate3d(0, -20vh, 0); }
    100% { transform: translate3d(-40px, 110vh, 0); }
}
.p-star {
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 8px 1px rgba(255,255,255,.8);
    animation: twinkle ease-in-out infinite;
}
@keyframes twinkle { 0%, 100% { opacity: .15; transform: scale(.7); } 50% { opacity: 1; transform: scale(1); } }
.p-petal {
    width: 11px; height: 11px;
    border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
    background: linear-gradient(180deg, #ffd7e4, #f58fb0);
    animation: petal-fall linear infinite;
}
@keyframes petal-fall {
    0%   { transform: translate3d(0, -12vh, 0) rotate(0); opacity: 0; }
    10%  { opacity: .85; }
    100% { transform: translate3d(var(--drift, 60px), 110vh, 0) rotate(420deg); opacity: 0; }
}
.p-conf {
    width: 7px; height: 11px;
    border-radius: 2px;
    animation: petal-fall linear infinite;
}

/* ==========================================================
   8. LAYAR KECIL & PREFERENSI
   ========================================================== */
@media (max-width: 400px) {
    .paper { padding: 26px 20px 24px; }
    .paper-body { font-size: .98rem; line-height: 1.74; }
    .mole-grid { grid-template-columns: repeat(3, 68px); }
    .hole { width: 68px; height: 68px; font-size: 2rem; }
    .suit-btn { width: 72px; height: 72px; font-size: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .18s !important;
    }
    #grain { animation: none; }
    .p { display: none; }
}

/* ==========================================================
   9. TAMBALAN KECIL
   ========================================================== */
.paper-body { transition: opacity .25s ease; }

.meter-fill.fast { transition: width .08s linear; }

.mirror-text { transition: opacity .5s ease; }

/* Pecahan hati */
.mend-core {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.4rem;
    line-height: 1;
    filter: drop-shadow(0 0 26px color-mix(in srgb, var(--glow) 60%, transparent));
}
.shard {
    background: linear-gradient(160deg, #ffd7e4, #f58fb0);
    width: 46px;
    height: 46px;
    margin: -23px 0 0 -23px;
    font-size: 0;
}
.shard.fixed { opacity: 0; }

#note-box:empty { display: none; }
.suit-stage span { transition: transform .2s ease; }

/* ==========================================================
   10. FOTO, ALBUM, KARTU GOSOK, DAN KEJUTAN
   Catatan: kemiringan pakai properti `rotate` (bukan transform)
   supaya tidak bentrok dengan animasi muncul baris surat.
   ========================================================== */

/* — Polaroid yang ditempel di kertas — */
.polaroid {
    position: relative;
    width: min(76%, 250px);
    margin: 8px auto 1.5em;
    padding: 10px 10px 13px;
    background: #fffdf8;
    box-shadow: 0 16px 30px -14px rgba(60, 35, 20, .55), 0 2px 5px rgba(0, 0, 0, .13);
    rotate: var(--tilt, -2deg);
}
.polaroid[data-zoom] { cursor: zoom-in; }
.polaroid::before {           /* selotip */
    content: '';
    position: absolute;
    top: -11px; left: 50%;
    width: 72px; height: 22px;
    margin-left: -36px;
    background: rgba(255, 233, 160, .58);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
    transform: rotate(-3deg);
}
.polaroid img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    background: #e9dfcf;
    filter: sepia(.12) saturate(1.05) contrast(1.02);
}
.polaroid figcaption {
    font-family: 'Caveat', cursive;
    font-size: 1.28rem;
    line-height: 1.15;
    text-align: center;
    color: #4a3b30;
    margin-top: 9px;
}

/* — Album kecil: geser ke samping — */
.album { margin: 10px -26px 1.5em; }
.paper-body .album-title {
    font-family: 'Caveat', cursive;
    font-size: 1.5rem;
    text-align: center;
    margin: 0 0 4px;
    color: color-mix(in srgb, var(--paper-ink) 80%, var(--accent));
}
.album-track {
    display: flex;
    gap: 16px;
    padding: 16px 26px 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 26px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.album-track::-webkit-scrollbar { display: none; }
.album-track .polaroid {
    flex: 0 0 62%;
    max-width: 220px;
    width: auto;
    margin: 0;
    scroll-snap-align: center;
}
.paper-body .album-hint {
    font-size: .7rem;
    letter-spacing: .08em;
    text-align: center;
    margin: 0;
    color: var(--paper-soft);
    opacity: .8;
}

/* — Strip ala photobooth — */
.strip {
    width: 150px;
    margin: 10px auto 1.8em;
    padding: 12px 10px 8px;
    background: #1c1418;
    box-shadow: 0 18px 32px -14px rgba(0, 0, 0, .65);
    rotate: 2.2deg;
}
.strip-frame { margin-bottom: 8px; background: #3a2d33; }
.strip-frame img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    filter: grayscale(.25) sepia(.18) contrast(1.05);
}
.strip figcaption {
    font-family: 'Caveat', cursive;
    font-size: 1.2rem;
    text-align: center;
    color: #f1d9a8;
    padding: 2px 0 4px;
}

/* — Kartu gosok — */
.scratch {
    width: min(80%, 270px);
    margin: 10px auto 1.6em;
    padding: 10px 10px 12px;
    background: #fffdf8;
    box-shadow: 0 16px 30px -14px rgba(60, 35, 20, .55), 0 2px 5px rgba(0, 0, 0, .13);
    rotate: var(--tilt, 1.6deg);
}
.scratch-stage {
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: #e9dfcf;
}
.scratch-stage img {
    display: block;
    width: 100%; height: 100%;
    object-fit: cover;
    filter: sepia(.12) saturate(1.05);
}
.scratch canvas {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    touch-action: none;
    cursor: grab;
    transition: opacity .9s ease;
}
.scratch canvas.gone { opacity: 0; pointer-events: none; }
.paper-body .scratch-hint {
    font-family: 'Caveat', cursive;
    font-size: 1.2rem;
    text-align: center;
    margin: 9px 0 0;
    color: #6b5a4c;
    transition: opacity .4s ease;
}
.scratch.done .scratch-hint { display: none; }
.scratch figcaption {
    font-family: 'Caveat', cursive;
    font-size: 1.28rem;
    line-height: 1.15;
    text-align: center;
    color: #4a3b30;
    margin-top: 9px;
    display: none;
}
.scratch.done figcaption { display: block; animation: rise .8s ease both; }
.scratch.done { cursor: zoom-in; }

/* — Foto blur yang makin jelas (surat kangen) — */
.blur-photo { width: 150px; margin: 0 0 18px; cursor: default; }
.blur-photo img {
    filter: blur(var(--b, 22px)) saturate(.85);
    transition: filter .55s ease;
}
.blur-photo figcaption { min-height: 1.2em; }

/* — Hujan foto (surat hari spesial) — */
.fall-pol {
    position: fixed;
    top: 0;
    z-index: 60;
    width: 92px;
    padding: 5px 5px 16px;
    background: #fffdf8;
    box-shadow: 0 10px 22px -8px rgba(0, 0, 0, .7);
    pointer-events: none;
    visibility: hidden;
    animation: pol-fall 9s linear both;
}
.fall-pol.ok { visibility: visible; }
.fall-pol img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
@keyframes pol-fall {
    from { transform: translate(0, -26vh) rotate(var(--r0, -8deg)); }
    50%  { transform: translate(var(--sway, 30px), 48vh) rotate(calc(var(--r0, -8deg) * -1)); }
    to   { transform: translate(calc(var(--sway, 30px) * -1), 120vh) rotate(var(--r1, 14deg)); }
}

/* — Foto yang mengintip dari amplop sampul — */
.cover-envelope.has-photo { margin-top: 70px; }
.ce-photo {
    position: absolute;
    left: 50%;
    top: -40%;
    width: 60%;
    margin-left: -30%;
    padding: 5px 5px 16px;
    background: #fffdf8;
    box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .6);
    rotate: -5deg;
    opacity: 0;
    transition: opacity 1.1s ease .3s;
}
.has-photo .ce-photo { opacity: 1; }
.ce-photo img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }

/* — Cermin yang ada fotonya — */
.mirror.has-photo { background-size: cover; background-position: center; }
.mirror.has-photo .mirror-text { text-shadow: 0 2px 14px rgba(0, 0, 0, .65); color: #fff8f2; }

/* — Penghitung hari (halaman depan & surat terakhir) — */
.days {
    font-family: 'Caveat', cursive;
    font-size: 1.3rem;
    line-height: 1.25;
    color: var(--accent);
    margin: -6px 0 22px;
    max-width: 26ch;
}
.days[hidden] { display: none; }
.paper-days {
    font-family: 'Caveat', cursive;
    font-size: 1.45rem;
    text-align: center;
    margin: 18px 0 0;
    color: color-mix(in srgb, var(--paper-ink) 78%, var(--accent));
    opacity: 0;
    transition: opacity 1s ease;
}
.paper-days.in { opacity: 1; }
.paper-days:empty { display: none; }

/* — Tombol suara — */
.btn-voice.playing { animation: voice-pulse 1.6s ease-in-out infinite; }
@keyframes voice-pulse {
    50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--paper-ink) 10%, transparent); }
}

/* — Surat yang menunggu tanggalnya — */
.env.timed::after { content: '🎁'; }

/* — Pembesar foto — */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(9, 6, 13, .9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: zoom-out;
    opacity: 0;
    visibility: hidden;
    transition: opacity .35s ease, visibility 0s .35s;
}
.lightbox.show { opacity: 1; visibility: visible; transition: opacity .35s ease; }
.lb-frame {
    margin: 0;
    max-width: min(92vw, 470px);
    padding: 12px 12px 18px;
    background: #fffdf8;
    box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .9);
    rotate: -1.2deg;
    transform: scale(.94);
    transition: transform .5s cubic-bezier(.34, 1.4, .64, 1);
}
.lightbox.show .lb-frame { transform: none; }
.lb-frame img { display: block; max-width: 100%; max-height: 66vh; margin: 0 auto; }
.lb-frame img[hidden] { display: none; }
.lb-frame figcaption {
    font-family: 'Caveat', cursive;
    font-size: 1.5rem;
    line-height: 1.2;
    text-align: center;
    color: #4a3b30;
    margin-top: 10px;
}
.lb-close {
    position: absolute;
    bottom: calc(var(--safe-b) + 22px);
    font-size: .72rem;
    letter-spacing: .06em;
    opacity: .5;
}

/* ==========================================================
   11. VARIASI FOTO — selotip, sticky note, coretan
   ========================================================== */
.polaroid[data-tape="pink"]::before   { background: rgba(245,177,197,.6); }
.polaroid[data-tape="washi"]::before  { background: repeating-linear-gradient(45deg, rgba(255,255,255,.7) 0 4px, rgba(201,160,220,.55) 4px 8px); }
.polaroid[data-tape="mint"]::before   { background: rgba(170,214,190,.6); }
.polaroid.wavy { clip-path: polygon(0% 2%,4% 0%,9% 2%,14% 0%,19% 2%,24% 0%,29% 2%,34% 0%,39% 2%,44% 0%,49% 2%,54% 0%,59% 2%,64% 0%,69% 2%,74% 0%,79% 2%,84% 0%,89% 2%,94% 0%,100% 2%,100% 98%,96% 100%,91% 98%,86% 100%,81% 98%,76% 100%,71% 98%,66% 100%,61% 98%,56% 100%,51% 98%,46% 100%,41% 98%,36% 100%,31% 98%,26% 100%,21% 98%,16% 100%,11% 98%,6% 100%,0% 98%); }

/* Posisi bervariasi supaya tidak selalu terpusat */
.pl-left  { rotate: -3.4deg; margin-left: -4%; margin-right: auto; }
.pl-right { rotate: 3.1deg; margin-right: -4%; margin-left: auto; }
.pl-center{ rotate: -1.6deg; }
.pl-wide  { width: min(92%, 300px); rotate: 1.1deg; }

.pol-note {
    position: absolute;
    bottom: -14px;
    width: 92px;
    padding: 8px 9px 10px;
    font-family: 'Caveat', cursive;
    font-size: 1.05rem;
    line-height: 1.15;
    text-align: center;
    color: #4a3b30;
    box-shadow: 0 8px 16px -8px rgba(0,0,0,.45);
    rotate: var(--nr, -4deg);
    z-index: 2;
}
.pol-note.n-y { background: #fff2a8; right: -16px; }
.pol-note.n-p { background: #ffd3e0; left: -16px; }
.pol-note.n-b { background: #cfe7ff; right: 50%; margin-right: -46px; bottom: -22px; }

.pol-doodle { position: absolute; width: 34px; height: 34px; pointer-events: none; opacity: .82; rotate: var(--dr, 0deg); z-index: 2; }
.pol-doodle.pd-tl { left: -12px; top: -12px; }
.pol-doodle.pd-tr { right: -12px; top: -10px; }
.pol-doodle svg { width: 100%; height: 100%; overflow: visible; }
.pol-doodle path {
    fill: none;
    stroke: color-mix(in srgb, var(--accent) 78%, #7a3b48);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: doodle-draw 1.1s .4s ease forwards;
}
@keyframes doodle-draw { to { stroke-dashoffset: 0; } }

/* ==========================================================
   12. CORETAN TULISAN TANGAN DI TEKS SURAT
   ========================================================== */
.sc { position: relative; display: inline; white-space: nowrap; }
.sc-svg {
    position: absolute;
    left: -3%;
    width: 106%;
    pointer-events: none;
    overflow: visible;
}
.sc-svg path {
    fill: none;
    stroke: color-mix(in srgb, var(--accent) 70%, #a23b52);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: doodle-draw 1s 1.1s ease forwards;
}
.sc-circle { padding: 0 .12em; }
.sc-circle .sc-svg { top: -22%; height: 145%; }
.sc-circle .sc-svg path { stroke-width: 2.6; }
.sc-underline .sc-svg { bottom: -18%; height: 24%; }
.sc-underline .sc-svg path { stroke-width: 3; }
.sc-hl { background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 40%, transparent) 0%, color-mix(in srgb, var(--accent) 55%, transparent) 100%); padding: 0 .12em; border-radius: 2px; }
.sc-strike { opacity: .68; }
.sc-strike .sc-svg { top: 30%; height: 40%; }
.sc-strike .sc-svg path { stroke-width: 2.4; }
.sc-fix {
    display: inline-block;
    margin-left: .35em;
    font-family: 'Caveat', cursive;
    font-style: normal;
    font-size: 1.12em;
    color: color-mix(in srgb, var(--accent) 75%, #7a3b48);
    rotate: -3deg;
}

/* ==========================================================
   14. GABUT — Cari pasangan (memory)
   ========================================================== */
.mem-grid { display: grid; grid-template-columns: repeat(4, 62px); gap: 9px; justify-content: center; }
.mem-card {
    position: relative;
    width: 62px; height: 62px;
    border: none;
    border-radius: 12px;
    background: none;
    cursor: pointer;
    perspective: 600px;
    touch-action: manipulation;
}
.mc-face {
    position: absolute; inset: 0;
    display: grid; place-items: center;
    border-radius: 12px;
    font-size: 1.7rem;
    backface-visibility: hidden;
    transition: transform .45s cubic-bezier(.34,1.2,.64,1);
}
.mc-back { background: linear-gradient(150deg, rgba(255,255,255,.14), rgba(255,255,255,.04)); border: 1px solid rgba(255,255,255,.18); color: color-mix(in srgb, var(--accent) 70%, #fff); }
.mc-front { background: color-mix(in srgb, var(--accent) 20%, var(--paper)); color: var(--paper-ink); transform: rotateY(180deg); }
.mem-card.flip .mc-back { transform: rotateY(180deg); }
.mem-card.flip .mc-front { transform: rotateY(0deg); }
.mem-card.done { opacity: .55; cursor: default; }
.mem-card.done .mc-front { box-shadow: 0 0 0 2px var(--glow) inset; }

/* ==========================================================
   15. GABUT — Susun ulang (sliding puzzle)
   ========================================================== */
.pz-grid {
    display: grid;
    grid-template-columns: repeat(var(--n), 1fr);
    gap: 3px;
    width: min(240px, 76vw);
    aspect-ratio: 1;
    margin: 4px auto 0;
    padding: 3px;
    border-radius: 14px;
    background: rgba(255,255,255,.08);
    box-shadow: inset 0 0 20px rgba(0,0,0,.4);
}
.pz-cell {
    border: none;
    border-radius: 6px;
    padding: 0;
    cursor: pointer;
    background-image: linear-gradient(160deg, #ffd7e4, #f58fb0);
    background-size: calc(var(--n) * 100%) calc(var(--n) * 100%);
    background-position: var(--bx, 0) var(--by, 0);
    box-shadow: 0 3px 6px rgba(0,0,0,.35);
    transition: opacity .2s ease;
}
.pz-cell::after {
    content: '♡';
    position: absolute;
    color: rgba(255,255,255,.001);
}
.pz-empty { background: rgba(0,0,0,.25); box-shadow: none; cursor: default; }

/* ==========================================================
   16. "FILM PENDEK KITA"
   ========================================================== */
.film-wrap { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 380px; }
.film-loading { font-family: 'Caveat', cursive; font-size: 1.3rem; opacity: .7; }
.film-frame {
    position: relative;
    width: min(320px, 82vw);
    aspect-ratio: 4 / 5;
    border-radius: 4px;
    overflow: hidden;
    background: #0c0810;
    box-shadow: 0 30px 60px -24px rgba(0,0,0,.85), 0 0 60px -18px var(--glow);
}
.film-frame img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    filter: sepia(.15) saturate(1.05) contrast(1.05);
    opacity: 0;
    transition: opacity .28s ease;
}
.film-bars { position: absolute; left: 0; right: 0; top: 0; height: 9%; background: #0c0810; pointer-events: none; z-index: 1; }
.film-bars.bottom { top: auto; bottom: 0; }
.film-grain {
    position: absolute; inset: 0;
    opacity: .06;
    mix-blend-mode: overlay;
    background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"%3E%3Cfilter id="n"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="2"/%3E%3C/filter%3E%3Crect width="200" height="200" filter="url(%23n)"/%3E%3C/svg%3E');
    animation: grain 500ms steps(3) infinite;
}
.film-caption {
    font-family: 'Caveat', cursive;
    font-size: 1.4rem;
    line-height: 1.35;
    text-align: center;
    max-width: 30ch;
    min-height: 3.6rem;
    margin: 16px 0 0;
}
.film-dots { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; max-width: 240px; margin-top: 8px; }
.film-dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.25); }
.film-dots i.on { background: var(--accent); }

/* ==========================================================
   17. ALBUM KENANGAN (halaman setelah surat ulang tahun)
   Memakai polaroid yang sama dengan di surat.
   ========================================================== */
.album-inner { margin: auto 0; width: 100%; max-width: 520px; text-align: center; padding-bottom: 10px; }
.album-head { margin-bottom: 14px; }
.album-wall { display: flex; flex-direction: column; gap: 38px; padding: 30px 0 14px; }
.album-wall .polaroid {
    margin-top: 0;
    margin-bottom: 0;
    opacity: 0;
    translate: 0 26px;
    transition: opacity .9s ease, translate .9s cubic-bezier(.22,.61,.36,1);
}
.album-wall .polaroid.in { opacity: 1; translate: 0 0; }
.album-wall .strip { opacity: 0; transition: opacity .9s ease; }
.album-wall .strip.in { opacity: 1; }
.album-empty { font-family: 'Caveat', cursive; font-size: 1.3rem; opacity: .7; margin: 30px 0; }
.album-end {
    font-family: 'Caveat', cursive;
    font-size: 1.45rem;
    line-height: 1.3;
    color: var(--accent);
    margin: 18px auto 20px;
    max-width: 24ch;
}
.album-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
@media (prefers-reduced-motion: reduce) {
    .album-wall .polaroid, .album-wall .strip { opacity: 1; translate: 0 0; }
}

/* Perbaikan album: tidak ada geser samping, sticky note tidak menutupi caption */
#view-album { overflow-x: hidden; }
.album-wall { gap: 54px; }
.album-wall .polaroid { padding-bottom: 36px; }
.album-wall .polaroid figcaption { margin-top: 9px; }
.album-wall .pol-note { bottom: -30px; }
.album-wall .pol-note.n-b { bottom: -34px; }
.album-wall .polaroid[data-tape] { clip-path: none; }
.album-wall .pl-left  { margin-left: 3%; margin-right: auto; }
.album-wall .pl-right { margin-right: 3%; margin-left: auto; }
.album-wall .pl-wide  { width: min(88%, 300px); }
