*
{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

section
{
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.loader
{
    position: relative;
    width: 120px;
    height: 120px;
    background: #000;
    animation: rotate 1s linear infinite;
}

.loader div
{
    position: absolute;
    width: 100%;
    height: 100%;
    background: #000;
    animation: animate 1s linear infinite;
}

@keyframes animate
{
    0%
    {
        transform: rotate(0deg);
    }
    50%, 100%
    {
        transform: rotate(180deg);
    }
}

@keyframes rotate
{
    0%
    {
        transform: rotate(90deg);
    }
    50%, 100%
    {
        transform: rotate(0deg);
    }
}

.loader div:nth-child(1)
{
    top: -100%;
    left: -2px;
    transform-origin: bottom right;
}

.loader div:nth-child(1)::before
{
    background: #ff0;
}

.loader div:nth-child(2)
{
    right: -100%;
    top: -2px;
    transform-origin: bottom left;
}

.loader div:nth-child(2)::before
{
    background: #0f0;
}

.loader div:nth-child(3)
{
    bottom: -100%;
    left: 2px;
    transform-origin: top left;
}

.loader div:nth-child(3)::before
{
    background: #ff4786;
}

.loader div:nth-child(4)
{
    left: -100%;
    top: 2px;
    transform-origin: top right;
}

.loader div:nth-child(4)::before
{
    background: #2da2ff;
}

.loader:before,
.loader div::before
{
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: #fff;
}