* {
    background-color: blue;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    height: 100%;
    width: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

#images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 100px);
    grid-template-rows: repeat(auto-fill, 100px);
    width: 100%;
    height: 100%;
}

.rotating-image {
    position: relative;
    width: 100px;
    height: 100px;
    background-size: cover;
}

.rotating-image.clockwise {
    animation: spinClockwise 3s linear infinite;
}

.rotating-image.counterclockwise {
    animation: spinCounterclockwise 3s linear infinite;
}

.rotating-image .overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    transition: opacity 1s ease;
    opacity: 0;
}

@keyframes spinClockwise {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes spinCounterclockwise {
    from { transform: rotate(0deg); }
    to { transform: rotate(-360deg); }
}


