body {
    background: #2e394d;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    font-family: 'Rubik', sans-serif;
}

* {
    box-sizing: border-box;
}

*:before,
*:after {
    content: "";
    position: absolute;
}

input {
    height: 40px;
    left: 0;
    opacity: 0;
    position: absolute;
    top: 0;
    width: 40px;
}

.container {
    text-align: center;
    padding: 20px;
}

.title {
    font-size: 2em;
    color: #ffffff;
    margin-bottom: 30px;
    font-weight: 500;
    animation: fadeIn 1s ease-in-out;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: translateY(-45px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.toggle-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    background: #decf87;
    margin: 0 auto;
    width: 640px;
    height: 320px;
}

.toggle {
    position: relative;
    display: inline-block;
}

label.toggle-item {
    width: 7em;
    background: #2e394d;
    height: 3em;
    display: inline-block;
    border-radius: 50px;
    margin: 40px;
    position: relative;
    transition: all 0.3s ease;
    transform-origin: 20% center;
    cursor: pointer;
}

label.toggle-item:before {
    display: block;
    transition: all 0.2s ease;
    width: 2.3em;
    height: 2.3em;
    top: 0.25em;
    left: 0.25em;
    border-radius: 2em;
    border: 2px solid #88cf8f;
    transition: 0.3s ease;
}

.beer-pong label:before {
    background: #f9f9f9;
    box-shadow: inset 0 -3px 0 0 #c6c5c5;
    border: none;
    width: 2.5em;
    height: 2.5em;
    top: 0.25em;
    left: 0.25em;
}

.beer-pong .cup {
    top: -3%;
    right: -118px;
    border-top: 90px solid #f44336;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    height: 3px;
    position: absolute;
    width: 80px;
    transform-origin: bottom right;
    transition: 0.2s cubic-bezier(0.42, 0.5, 0.58, 1);
}

.beer-pong .cup:before {
    box-shadow: 0 -10px 0 0px rgba(39, 39, 39, 0.1), 0px -20px 0 0px rgba(39, 39, 39, 0.1);
    border-radius: 3px;
    overflow: hidden;
    background: rgba(39, 39, 39, 0.1);
    width: 120%;
    left: -5px;
    height: 4px;
    top: -40px;
}

.beer-pong .cup .lid {
    position: absolute;
    width: 95px;
    height: 8px;
    border-radius: 20px;
    background: #efefef;
    bottom: 86px;
    left: -23px;
}

.beer-pong .cup .lid:after {
    background: #efefef;
    width: 48px;
    height: 5px;
    left: 50%;
    margin-left: -24px;
    top: 94px;
    border-radius: 0 0 3px 3px;
}

#beer-pong:checked~.cup {
    animation: 0.2s linear cup 1s forwards;
}

#beer-pong:checked+label:before {
    animation: 2s linear bounce-off forwards;
}

@keyframes cup {
    0% {
        transform: none;
    }

    50% {
        transform: rotate(75deg) translate(10px, 15px);
    }

    90% {
        transform: rotate(70deg) translate(10px, 15px);
    }

    100% {
        transform: rotate(75deg) translate(10px, 15px);
    }
}

@keyframes bounce-off {
    0% {
        transform: translateY(0);
    }

    10%,
    25% {
        transform: translate(-20px, -80px);
    }

    50% {
        transform: rotate(163deg);
        transform-origin: 100px -12px;
    }

    70% {
        transform: rotate(0) translate(-3px, -8px);
        transform-origin: 100px -12px;
    }

    75% {
        transform: translate(20px, -8px);
    }

    80% {
        transform: translate(30px, 0px);
    }

    85% {
        transform: translate(40px, -3px);
    }

    87% {
        transform: translate(46px, 0px);
    }

    90% {
        transform: translate(52px, -1px);
    }

    95% {
        transform: translate(60px, 0px);
    }

    100% {
        transform: translate(64px, 0px);
    }
}

@media (max-width: 960px) {
    .toggle-wrapper {
        flex: 1 1 calc(100% / 2);
    }

    .title {
        font-size: 2em;
    }
}

@media (max-width: 700px) {
    .toggle-wrapper {
        flex: 1 1 100%;
    }

    .title {
        font-size: 1.5em;
    }
}