@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:ital@1&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Josefin Sans', sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(to right, #36d1dc, #5b86e5);
}

.rating {
    position: relative;
    display: flex;
    flex-direction: row-reverse;
}

.rating input {
    display: none;
}

.rating label {
    position: relative;
    width: 0;
    height: 125px;
    cursor: pointer;
    transition: 0.5s;
    filter: grayscale(1);
    text-align: center;
    opacity: 0;
}

.rating img {
    height: 100px;
}

.rating:hover label {
    width: 160px;
    opacity: 0.2;
}

.rating input:hover+label,
.rating input:checked+label {
    filter: grayscale(0);
    opacity: 1;
    width: 160px;
}

.rating label h4 {
    color: #fff;
    font-size: 24px;
    padding-top: 10px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(-50) scale(0);
    transition: 0.5s;
}

.rating input:hover+label h4,
.rating input:checked+label h4 {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.text {
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    width: 500px;
    font-weight: 700;
    letter-spacing: 2px;
    text-align: center;
    white-space: nowrap;
    font-size: 36px;
}

@media screen and (max-width:800px) {

    .rating {
        flex-direction: column;
        max-width: 100%;
    }

    .rating img {
        height: 80px;
    }

    .rating label {
        top: 50px;
        text-align: center;
    }

    .text {
        top: 0px;
        color: whitesmoke;
        font-size: 25px;
    }
}