/* Canvas + scroll architecture */
body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Canvas starts as fixed, JS toggles to absolute when pinned */
#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    z-index: 5;
    pointer-events: none;
    overflow: hidden;
}

@media (max-width: 768px) {
    #canvas-container {
        display: none !important;
    }

    #coin-zone {
        display: none !important;
    }
}

#canvas-container canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* When JS adds .pinned class, canvas becomes absolute at exact scroll position */
#canvas-container.pinned {
    position: absolute;
}

main {
    position: relative;
}

/* Mobile parallax coins */
.mobile-coins {
    display: none;
}

@media (max-width: 768px) {
    .mobile-coins {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
        z-index: 4;
    }

    .mcoin {
        position: absolute;
        height: auto;
        will-change: transform;
        filter: drop-shadow(0 4px 12px rgba(0, 26, 255, 0.15));
        opacity: 0;
        animation: mcoin-enter 0.8s cubic-bezier(0.33, 1, 0.68, 1) forwards;
    }

    /* Odd coins slide from left */
    .mcoin:nth-child(odd) {
        --mcoin-dir: -60vw;
    }

    /* Even coins slide from right */
    .mcoin:nth-child(even) {
        --mcoin-dir: 60vw;
    }

    .mcoin:nth-child(1) {
        animation-delay: 0.1s;
    }

    .mcoin:nth-child(2) {
        animation-delay: 0.2s;
    }

    .mcoin:nth-child(3) {
        animation-delay: 0.3s;
    }

    .mcoin:nth-child(4) {
        animation-delay: 0.4s;
    }

    .mcoin:nth-child(5) {
        animation-delay: 0.5s;
    }

    .mcoin:nth-child(6) {
        animation-delay: 0.6s;
    }

    .mcoin:nth-child(7) {
        animation-delay: 0.7s;
    }

    .mcoin:nth-child(8) {
        animation-delay: 0.8s;
    }

    .mcoin:nth-child(9) {
        animation-delay: 0.9s;
    }

    @keyframes mcoin-enter {
        from {
            opacity: 0;
            translate: var(--mcoin-dir) 0;
        }

        to {
            opacity: 1;
            translate: 0 0;
        }
    }
}