@font-face {
    font-family: "Mochi Boom DEMO";
    src: url(./mochi-boom-demo.regular.ttf);
}
* {
    box-sizing: border-box;
}
body {
    position: relative;
    padding: 0;
    margin: 0;
    height: 100dvh;
    width: 100vw;
    min-height: 160px;
    min-width: 120px;
    overflow: hidden;

    &.fart-police {
        background: 
            linear-gradient(
                90deg,
                rgba(4, 144, 199, 0.3) 0%, 
                rgba(4, 144, 199, 0.3) 42%, 
                rgba(219, 39, 39, 0.3) 57%, 
                rgba(219, 39, 39, 0.3) 100%
            );
            transition: background 1s ease-out;
        animation: fartPoliceBackground .4s infinite;
    }
}
#fart-loader-container {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 20px;
    height: 400px;
    border: 1px solid grey;
    border-radius: 2px;
    overflow: hidden;
}
#fart-loader-container > div {
    position: relative;
    right: 10px;
    bottom: 10px;
    width: 100%;
    height: 110%;
    background-color: greenyellow;
    top: 100%;
    left: 0;
    margin: 0;
    display: block;

    &.fart-overloading {
        animation: fartOverloadingBackground .1s infinite;
    }
}

main {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
main .button-container {
    flex: 1;
    display: flex;
    justify-content: center;
    flex-direction: column;
}
#button-position {
    position: relative;
    width: 100px;
    height: 100px;
}

#the-fart-button {
    z-index: 100;
    position: relative;
    display: inline-block;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #ff0000 0%, #cc0000 100%);
    border: none;
    border-radius: 50%;
    box-shadow: 0 8px 0 #880000, 0 15px 20px rgba(0, 0, 0, 0.35);
    text-align: center;
    outline: none;
    cursor: pointer;
    color: transparent;
    touch-action: manipulation;
}
#the-fart-button:hover {
    background: linear-gradient(to bottom, #ee0000 0%, #bb0000 100%);
}
#the-fart-button:active {
    box-shadow: 0 4px 0 #880000, 0 8px 6px rgba(0, 0, 0, 0.4);
    transform: translateY(4px);
}

footer {
    display: flex;
    justify-content: center;
    font-size: 2em;
    font-family: "Mochi Boom DEMO", Tahoma, sans-serif;
}
footer span {
    font-weight: bold;
    font-family: Consolas, "Courier New", monospace;
}

.fart-element {
    position: absolute;
    font-family: "Mochi Boom DEMO", Tahoma, sans-serif;
    color: brown;
    font-size: 1.5em;
    top: 50%;
    left: 50%;
    transform: translateX(50%) translateY(50%);
    animation: fadeOutAtTheEnd 1s forwards;
}

@keyframes fadeOutAtTheEnd {
    0% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes fartPoliceBackground {
    0% { 
        background: linear-gradient(
            90deg,
            rgba(4, 144, 199, 0.25) 0%, 
            rgba(4, 144, 199, 0.25) 42%, 
            rgba(219, 39, 39, 0.25) 57%, 
            rgba(219, 39, 39, 0.25) 100%
        ); 
    }
    50% { 
        background:linear-gradient(
            270deg,
            rgba(4, 144, 199, 0.25) 0%, 
            rgba(4, 144, 199, 0.25) 42%, 
            rgba(219, 39, 39, 0.25) 57%, 
            rgba(219, 39, 39, 0.25) 100%
        ); 
    }
    100% { 
        background: linear-gradient(
            90deg,
            rgba(4, 144, 199, 0.25) 0%, 
            rgba(4, 144, 199, 0.25) 42%, 
            rgba(219, 39, 39, 0.25) 57%, 
            rgba(219, 39, 39, 0.25) 100%
        ); 
    }
}

@keyframes fartOverloadingBackground {
    0% { 
        background-color: greenyellow;
    }
    50% { 
        background-color: red;
    }
    100% { 
        background-color: greenyellow;
    }
}

/* ==================================================
   CACA
   ================================================== */
#scene {
    position: relative;
    width: 100vw;
    height: 100vh;
}

.poop {
    position: absolute;
    z-index: 200;
    left: 50%;
    top: 50%;
    width: 440px;
    height: 190px;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 8px 4px rgba(0,0,0,.15));
}


/*
 * Chaque couche apparaît séparément.
 */
.poop-layer {
    position: absolute;
    background: #75451f;
    transform: scale(0);
    transform-origin: center 20%;
}


/* --------------------------------------------------
   BASE
   -------------------------------------------------- */

.layer-1 {
    width: 440px;
    height: 160px;
    left: 2px;
    bottom: 0;
    border-radius:
        49% 51% 53% 47% / 37% 31% 69% 63%;
    animation:
        layerAppear .4s ease-out
        forwards;
    animation-delay: 0s;
    transform-origin: center 15%;
    box-shadow: 0px -3px 5px 2px rgba(0, 0, 0, .4) inset;
}

.layer-2 {
    width: 295px;
    height: 105px;
    left: 72px;
    bottom: 75px;
    border-radius: 53% 47% 56% 44% / 40% 63% 37% 60% ;
    animation: layerAppear .25s ease-out forwards;
    animation-delay: .45s;
    transform-origin: center 25%;
    box-shadow: 0px -3px 5px 0px rgba(0, 0, 0, .4) inset;
}

.layer-3 {
    width: 202px;
    height: 75px;
    left: 132px;
    bottom: 125px;
    border-radius: 53% 47% 56% 44% / 58% 42% 58% 42% ;
    animation: layerAppear .25s ease-out forwards;
    animation-delay: .55s;
    transform-origin: center 65%;
    box-shadow: 0px -1px 5px 0px rgba(0, 0, 0, .4) inset;
}


.layer-4 {
    width: 82px;
    height: 85px;
    left: 192px;
    bottom: 165px;
    border-radius: 57% 34% 39% 34% / 59% 51% 33% 23%;
    animation: layerAppear .2s ease-out forwards;
    animation-delay: .65s;
    transform-origin: center 85%;
    box-shadow: 0px -2px 4px 0px rgba(0, 0, 0, .3) inset;
}


/*
 * Petit reflet
 */
.poop-layer::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 10px;
    left: 16px;
    top: 15px;
    background: rgba(255,255,255,.18);
    border-radius: 50%;
    transform: rotate(-10deg);
}


@keyframes layerAppear {

    0% {
        transform:
            scale(0);
    }

    100% {

        transform:
            scale(1);
    }
}

#rick {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 100%;
    display: none;
    justify-content: center;
    z-index: 1000;

    &.show {
        display: flex;
        animation: rickSlideUp linear 4s forwards;
    }

    img {
        display: block;
        bottom: -22px;
        position: absolute;
        max-width: 100%;
    }
}

@keyframes rickSlideUp {
    0% { top: 100%; }
    100% { top: 0%; }
}

/* Gradient Border — made with Image FX · https://cssimagelab.com/effects/gradient-border */
@property --ifx-border-angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes ifx-gradient-border-spin { to { --ifx-border-angle: 360deg; } }
#game-over {
    --ifx-c1: #e01b24;
    --ifx-c2: #f6d32d;
    --ifx-speed: 1s;
    --ifx-thick: 12px;
    --ifx-radius: 20px;

    position: absolute;
    z-index: 500;
    top: 5%;
    left: 5%;
    width: 90%;
    height: 90%;
    transition: transform .4s ease-in;
    transform: scale(0);
    display: block;
    overflow: visible;
    border-radius: var(--ifx-radius, 4px);

    &.show {
        transform: scale(1);
    }

    &::before {
        content: ""; position: absolute; inset: calc(-1 * var(--ifx-thick, 3px)); z-index: -1;
        border-radius: inherit;
        background: conic-gradient(from var(--ifx-border-angle), var(--ifx-c1, #e5c07b), var(--ifx-c2, #6db3ff), var(--ifx-c1, #e5c07b));
        animation: ifx-gradient-border-spin var(--ifx-speed, 6s) linear infinite;
    }

    > div {
        display: flex;
        justify-content: space-evenly;
        align-items: center;
        flex-direction: column;
        position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
        background-color: var(--ifx-c2, orange);
        border-radius: 12px;
        transition: transform var(--ifx-duration, 500ms) var(--ifx-ease, cubic-bezier(.2,.6,.2,1)),
                    filter var(--ifx-duration, 500ms) var(--ifx-ease, ease);
    }
}
