:root {
    --paper: #fff7d6;
}

.backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 9999;
}

    .backdrop.show {
        opacity: 1;
        pointer-events: auto;
    }

.cookie-modal {
    width: min(96vw,560px);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 22px 80px rgba(0,0,0,.5);
    background: #000;
}

.poster {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1; /* square poster */
    background: #000;
}

    .poster img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block
    }

.cookie-btn {
    position: absolute;
    left: 50%;
    top: 52%;
    transform: translate(-50%,-50%);
    width: min(80%,420px);
    aspect-ratio: 1.55 / 1;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.cookie {
    width: 100%;
    height: 100%;
    position: relative;
    filter: drop-shadow(0 14px 16px var(--shadow));
}

.whole {
    position: absolute;
    inset: 0;
    display: block;
}

    .whole img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        display: block;
        pointer-events: none;
    }

.halves {
    position: absolute;
    inset: 0;
    display: none;
}

.half {
    position: absolute;
    inset: 0;
    will-change: transform;
}

    .half img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        display: block;
        pointer-events: none;
    }

.left {
    transform-origin: 80% 80%;
}

.right {
    transform-origin: 32% 110%;
}

.shine {
    position: absolute;
    inset: -10%;
    background: radial-gradient(circle at 50% 50%, rgba(255,235,140,.95), rgba(255,235,140,0) 55%);
    opacity: 0;
    transform: scale(.8);
    pointer-events: none;
}

.fortune {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%) rotate(-12deg) translateY(18px);
    width: min(65%,180px);
    background: linear-gradient(#fffdf2,var(--paper));
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 10px 26px rgba(0,0,0,.22);
    text-align: center;
    opacity: 0;
    pointer-events: none;
}

.num {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 1px;
    color: #c40000
}

.label {
    font-size: 12px;
    opacity: .75;
    margin-top: 2px;
    color: var(--ink)
}

.shake {
    animation: shake .28s ease-in-out;
}

@keyframes shake {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    30% {
        transform: translateY(-2px) rotate(-2deg);
    }

    60% {
        transform: translateY(0) rotate(2deg);
    }

    100% {
        transform: translateY(0) rotate(0deg);
    }
}

.cracked .shine {
    animation: popshine .55s ease-out forwards;
}

@keyframes popshine {
    0% {
        opacity: 0;
        transform: scale(.7);
    }

    30% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(1.15);
    }
}

.cracked .left {
    animation: splitL .55s cubic-bezier(.2,.9,.2,1) forwards;
}

.cracked .right {
    animation: splitR .55s cubic-bezier(.2,.9,.2,1) forwards;
}

@keyframes splitL {
    to {
        transform: rotate(-22deg) translate(-10%, 6%);
    }
}

@keyframes splitR {
    to {
        transform: rotate(22deg) translate(10%, 6%);
    }
}

.cracked .fortune {
    animation: paperUp .55s .08s cubic-bezier(.2,.9,.2,1) forwards;
}

@keyframes paperUp {
    to {
        opacity: 1;
        transform: translate(-50%,-50%) rotate(-12deg) translateY(-18px);
    }
}

.cracked .whole {
    display: none;
}

.cracked .halves {
    display: block;
}

.footer {
    background: rgb(247 235 189);
    backdrop-filter: blur(10px);
    padding: 16px 18px;
    display: flex;
    gap: 14px;
    justify-content: center;
    /*border-top: 1px solid rgba(0,0,0,.06);*/
}


.btn {
    border: 0;
    border-radius: 999px;
    padding: 12px 22px;
    font-weight: 900;
    letter-spacing: .2px;
    cursor: pointer;
    min-width: 150px;
    box-shadow: 0 10px 20px rgba(0,0,0,.12);
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}

    .btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 14px 26px rgba(0,0,0,.16);
    }

    .btn:active {
        transform: translateY(1px) scale(.99);
        box-shadow: 0 8px 16px rgba(0,0,0,.12);
    }

    .btn:focus-visible {
        outline: 3px solid rgba(255,210,90,.9);
        outline-offset: 3px;
    }


    .btn.secondary {
        background: linear-gradient(180deg, #1a1aa8 0%, #000080 55%, #00005a 100%);
        color: #fff;
        position: relative;
        box-shadow: 0 10px 22px rgba(0,0,128,.35);
        border: 1px solid rgba(255,210,120,.45); /* optional gold outline */
    }

        .btn.secondary::after {
            content: "";
            position: absolute;
            inset: -3px;
            border-radius: 999px;
            background: radial-gradient(circle at 30% 20%, rgba(255,225,160,.55), transparent 55%), radial-gradient(circle at 70% 80%, rgba(255,255,255,.25), transparent 55%);
            opacity: 1;
            pointer-events: none;
            mix-blend-mode: screen;
        }

    .btn.primary {
        background: linear-gradient(180deg, #e03b33 0%, #c6261d 55%, #9f1c16 100%);
        color: #fff;
        position: relative;
        box-shadow: 0 10px 22px rgba(198,38,29,.35);
    }

        .btn.primary::after {
            content: "";
            position: absolute;
            inset: -3px;
            border-radius: 999px;
            background: radial-gradient(circle at 30% 20%, rgba(255,225,160,.75), transparent 55%), radial-gradient(circle at 70% 80%, rgba(255,255,255,.35), transparent 55%);
            opacity: 1;
            pointer-events: none;
            mix-blend-mode: screen;
        }

    .btn.primary {
        border: 1px solid rgba(255,210,120,.55);
    }

        .btn.primary:disabled {
            opacity: .55;
            cursor: not-allowed;
            transform: none;
            box-shadow: 0 6px 14px rgba(0,0,0,.10);
        }

@media (max-width:420px) {
    .footer {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        min-width: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .shake, .cracked .left, .cracked .right, .cracked .fortune, .cracked .shine {
        animation: none !important;
    }

    .cracked .fortune {
        opacity: 1;
        transform: translate(-50%,-50%) rotate(-12deg) translateY(-18px);
    }
}
