* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #1a1a2e, #2b2b40);
    min-height: 100vh;
    font-family: "Segoe UI", sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
}

.outer {
    display: grid;
    place-items: center;
    min-height: inherit;
}

.ratings-box {
    display: flex;
    gap: 20px;
    position: relative;
}

.ratings-box__item label {
    position: relative;
    cursor: pointer;
    display: block;
}

.ratings-box__item label input {
    display: none;
    position: absolute;
}

.ratings-box__item p {
    display: inline-block;
    position: absolute;
    color: #FFD700;
    font-weight: bold;
    font-size: 16px;
    letter-spacing: 1px;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
    margin-top: 20px;
    text-transform: uppercase;
}

.ratings-box__item label span.rating-star {
    width: 40px;
    height: 40px;
    display: block;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.6);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%,
            68% 57%, 79% 91%, 50% 70%,
            21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.ratings-box__item label span.rating-star::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    background: #2b2b40;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    clip-path: inherit;
}

.ratings-box__item label:hover span.rating-star {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(255, 215, 0, 0.8);
}

.ratings-box:has(.ratings-box__item label input:checked) .ratings-box__item span.rating-star::after {
    transform: translate(-50%, -50%) scale(0);
}

.ratings-box__item:has(label > input:checked)~.ratings-box__item label .star-line-box span.rating-star::after {
    transform: translate(-50%, -50%) scale(1);
}

.ratings-box__item:has(label > input:checked) p {
    opacity: 1;
}

.rating-star-line {
    position: absolute;
    width: 2px;
    height: 10px;
    background: #FFD700;
    display: block;
    opacity: 0;
}

.ratings-box__item input:checked~.star-line-box {
    animation: scaleAnim 0.4s linear;
    transform-origin: center;
}

@keyframes scaleAnim {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(0);
    }
}

.rating-star-line:nth-of-type(3),
.rating-star-line:nth-of-type(2) {
    transform: rotate(45deg);
    right: 8px;
    bottom: 22px;
    transform-origin: bottom;
}

.rating-star-line:nth-of-type(3) {
    transform: rotate(-45deg);
    left: 7px;
}

.rating-star-line:nth-of-type(4) {
    transform: rotate(0deg);
    left: calc(50% - 1px);
    bottom: unset;
    top: 24px;
}

.ratings-box__item input:checked~.star-line-box .rating-star {
    background: linear-gradient(135deg, #FFA500, #FFD700);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.9);
}

.ratings-box__item input:checked~.star-line-box .rating-star-line:nth-of-type(2) {
    animation: topLinesAnim 0.4s 0.3s linear;
}

.ratings-box__item input:checked~.star-line-box .rating-star-line:nth-of-type(3) {
    animation: topLinesAnim2 0.4s 0.3s linear;
}

.ratings-box__item input:checked~.star-line-box .rating-star-line:nth-of-type(4) {
    animation: bottomLineAnim 0.4s 0.3s linear;
}

@keyframes topLinesAnim {
    from {
        transform: rotate(45deg);
        opacity: 1;
    }

    to {
        transform: rotate(45deg) scaleY(1.2) translateY(-5px);
        opacity: 0;
    }
}

@keyframes topLinesAnim2 {
    from {
        transform: rotate(-45deg);
        opacity: 1;
    }

    to {
        transform: rotate(-45deg) scaleY(1.2) translateY(-5px);
        opacity: 0;
    }
}

@keyframes bottomLineAnim {
    from {
        transform: rotate(0);
        opacity: 1;
    }

    to {
        transform: rotate(0) scaleY(1.2) translateY(5px);
        opacity: 0;
    }
}