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

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #000;
}

nav {
    position: relative;
    width: 500px;
    height: 50px;
    background: #222;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
}

nav a {
    position: relative;
    display: inline-block;
    font-size: 1em;
    font-weight: 500;
    color: #fff;
    text-decoration: none;
    padding: 0 23px;
    z-index: 1;
}

nav span {
    position: absolute;
    width: 95px; /* Match the width of the first link */
    height: 100%;
    background: linear-gradient(90deg, #ff105f, #ffad06);
    border-radius: 8px;
    transition: 0.5s;
    left: 0; /* Start at the first link (Home) */
}

nav a:nth-child(1):hover ~ span {
    left: 0;
}

nav a:nth-child(2):hover ~ span {
    left: 90px;
}

nav a:nth-child(3):hover ~ span {
    left: 189px;
    width: 94px;
}

nav a:nth-child(4):hover ~ span {
    left: 289px;
    width: 98px;
}

nav a:nth-child(5):hover ~ span {
    left: 394px;
    width: 100px;
}
