@keyframes loading {
    0% {
        cy: 10;
    }

    25% {
        cy: 3;
    }

    50% {
        cy: 10;
    }
}


#quizcanvas {
    height: 100vh;
    pointer-events: none;
    position: fixed;
    width: 100%;
    z-index: 9999;
}

#quizbutton {
    background: none;
    border: none;
    color: #f4f7ff;
    cursor: pointer;
    font-family: 'Quicksand', sans-serif;
    font-size: 14px;
    font-weight: 500;
    height: 40px;
    outline: none;
    overflow: hidden;
    padding: 0 10px;
    position: relative;
    width: 190px;
    -webkit-tap-highlight-color: transparent;
    z-index: 1;
}

#quizbutton::before {
    background: #1f2335;
    border-radius: 50px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .4) inset;
    content: '';
    display: block;
    height: 100%;
    margin: 0 auto;
    position: relative;
    transition: width .2s cubic-bezier(.39, 1.86, .64, 1) .3s;
    width: 100%;
}

/* READY STATE */
#quizbutton.ready .submitMessage svg {
    opacity: 1;
    top: 1px;
    transition: top .4s ease 600ms, opacity .3s linear 600ms;
}

#quizbutton.ready .submitMessage .button-text span {
    top: 0;
    opacity: 1;
    transition: all .2s ease calc(var(--dr) + 600ms);
}

/* LOADING STATE */
#quizbutton.loading::before {
    transition: width .3s ease;
    width: 80%;
}

#quizbutton.loading .loadingMessage {
    opacity: 1;
}

#quizbutton.loading .loadingCircle {
    animation-duration: 1s;
    animation-iteration-count: infinite;
    animation-name: loading;
    cy: 10;
}

/* COMPLETE STATE */
#quizbutton.complete .submitMessage svg {
    top: -30px;
    transition: none;
}

#quizbutton.complete .submitMessage .button-text span {
    top: -8px;
    transition: none;
}

#quizbutton.complete .loadingMessage {
    top: 80px;
}

#quizbutton.complete .successMessage .button-text span {
    left: 0;
    opacity: 1;
    transition: all .2s ease calc(var(--d) + 1000ms);
}

#quizbutton.complete .successMessage svg {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset .3s ease-in-out 1.4s;
}

.button-text span {
    opacity: 0;
    position: relative;
}

.message {
    left: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
}

.message svg {
    display: inline-block;
    fill: none;
    margin-right: 5px;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

#quizbutton .submitMessage .button-text span {
    top: 8px;
    transition: all .2s ease var(--d);
}

#quizbutton .submitMessage svg {
    color: #5c86ff;
    margin-left: -1px;
    opacity: 0;
    position: relative;
    top: 30px;
    transition: top .4s ease, opacity .3s linear;
    width: 14px;
}

#quizbutton .loadingMessage {
    opacity: 0;
    transition: opacity .3s linear .3s, top .4s cubic-bezier(.22, 0, .41, -0.57);
}

#quizbutton .loadingMessage svg {
    fill: #5c86ff;
    margin: 0;
    width: 22px;
}

#quizbutton .successMessage .button-text span {
    left: 5px;
    transition: all .2s ease var(--dr);
}

#quizbutton .successMessage svg {
    color: #5cffa1;
    stroke-dasharray: 20;
    stroke-dashoffset: 20;
    transition: stroke-dashoffset .3s ease-in-out;
}

#quizbutton .loadingCircle:nth-child(2) {
    animation-delay: .1s;
}

#quizbutton .loadingCircle:nth-child(3) {
    animation-delay: .2s;
}

/* Website Link */
.website-link {
    background: #f8faff;
    border-radius: 50px 0 0 50px;
    bottom: 30px;
    color: #324b77;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    height: 34px;
    filter: drop-shadow(2px 3px 4px rgba(0, 0, 0, .1));
    padding: 0 20px 0 40px;
    position: fixed;
    right: 0;
    text-align: left;
    text-decoration: none;
}

.website-link__icon {
    left: -10px;
    position: absolute;
    top: -12px;
    width: 44px;
}

.website-link__name {
    display: block;
    font-size: 14px;
    line-height: 14px;
    margin: 5px 0 3px;
}

.website-link__last-name {
    color: #55bada;
}

.website-link__message {
    color: #8aa8c5;
    display: block;
    font-size: 7px;
    line-height: 7px;
}

#quizbutton .failMessage {
    opacity: 0;
    transition: opacity .3s linear .3s, top .4s cubic-bezier(.22, 0, .41, -0.57);
    top: 50%;
}

#quizbutton .failMessage svg {
    color: #ff5c5c;
    /* red X */
}

#quizbutton.fail .failMessage .button-text span {
    left: 0;
    opacity: 1;
    transition: all .2s ease calc(var(--d) + 1000ms);
}

#quizbutton.fail .failMessage svg {
    stroke-dasharray: 20;
    stroke-dashoffset: 20;
    animation: dash 1.3s forwards ease-out 1.2s;
}

#quizbutton.fail .failMessage {
    opacity: 1;
    top: 50%;
    transition: opacity .3s linear .3s, top .4s cubic-bezier(.22, 0, .41, -0.57);
}

/* --- RESET (default hidden) --- */
#quizbutton .submitMessage,
#quizbutton .loadingMessage,
#quizbutton .successMessage,
#quizbutton .failMessage {
    opacity: 0;
    pointer-events: none;
    top: 50%;
}

/* --- READY STATE --- */
#quizbutton.ready .submitMessage {
    opacity: 1;
}

/* --- LOADING STATE --- */
#quizbutton.loading .submitMessage {
    opacity: 0;
    top: 80px;
}

#quizbutton.loading .loadingMessage {
    opacity: 1;
}

/* --- SUCCESS STATE --- */
#quizbutton.complete .submitMessage,
#quizbutton.complete .loadingMessage,
#quizbutton.complete .failMessage {
    opacity: 0;
    top: 80px;
}

#quizbutton.complete .successMessage {
    opacity: 1;
}

/* --- FAIL STATE --- */
#quizbutton.fail .submitMessage,
#quizbutton.fail .loadingMessage,
#quizbutton.fail .successMessage {
    opacity: 0;
    top: 80px;
}

#quizbutton.fail .failMessage {
    opacity: 1;
}


@keyframes dash {
    to {
        stroke-dashoffset: 0;
    }
}