* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #222237
}


.menu {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
}


.menu .toggle {
    position: absolute;
    width: 75px;
    height: 75px;
    background: #fff;
    border-radius: 50%;
    color: #222237;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3em;
    transition: 0.5s;
}


.menu .toggle.active {
    transform: rotate(315deg);
    box-shadow: 0 0 0 68px #fff;
    background: #222237;
    color: #fff;

}

.menu li {
    position: absolute;
    list-style: none;
    left: 10px;
    transform: rotate(calc(360deg / 8 * var(--i))) translateX(40px);
    transform-origin: 140px;
    visibility: hidden;
    transition: 0.5s;
    opacity: 0;
    z-index: 10;
}

.menu.active li {
    visibility: visible;
    opacity: 1;
}



.menu li a {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 55px;
    height: 55px;
    font-size: 1.75em;
    color: #222237;
    transform: rotate(calc(360deg / -8 * var(--i)));
    background: #eee; /* neutral color for inactive */
    border-radius: 50%;
    transition: background 0.3s, color 0.3s;
}

.menu li.active a {
    background: #29fd53; /* green for active */
    color: #222237;
}



.menu.active li.active {
    transform: rotate(calc(360deg / 8 * var(--i))) translateX(12px);
}



.indicator {
    position: absolute;
    left: calc(50% + 2.5px);
    transform-origin: right;
    width: 100px;
    height: 1px;
    /* background: #f00; */ /* <-- Remove or comment out this line */
    pointer-events: none;
    transition: 0.5s;
}


.indicator::before {
    content: '';
    position: absolute;
    top: -27.5px;
    left: 72px;
    width: 55px;
    height: 55px;
    background: #222237;
    border-radius: 50%;
    box-shadow: 0 0 0 6px #29fd53;
    transition: 0.5s;
    opacity: 0;

}


.menu.active .indicator::before {
    opacity: 1;
    top: -27.5px;
    left: -27.5px;
    background:#29fd53 ;
    box-shadow: 0 0 0 6px #222237;
}

.menu li:nth-child(2).active ~ .indicator
{ 
    transform:  translateX(-103px) rotate(0deg);
}

.menu li:nth-child(3).active ~ .indicator
{ 
    transform:  translateX(-103px) rotate(45deg);
}

.menu li:nth-child(4).active ~ .indicator
{ 
    transform:  translateX(-103px) rotate(90deg);
}
.menu li:nth-child(5).active ~ .indicator
{ 
    transform:  translateX(-103px) rotate(135deg);
}
.menu li:nth-child(6).active ~ .indicator
{ 
    transform:  translateX(-103px) rotate(180deg);
}