.nutri-score {
    display: inline-flex;
    flex-direction: column;
    background: white;
    border: 3.5px solid #777; /* Thick border for quality feel */
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2); /* Matching high quality shadow */
    font-family: 'Arial Black', sans-serif;
    width: fit-content;
    margin: 10px 0;
}

.nutri-score-title {
    font-weight: 900;
    color: #444;
    text-transform: uppercase;
    font-size: 14px;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
    text-align: left;
    padding-left: 2px;
}

.nutri-score-bar {
    display: flex;
    align-items: center; /* Center horizontally aligned items */
    height: 48px; /* Fixed height to accommodate scaling */
}

.score-segment {
    width: 28px;
    height: 34px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    color: white;
    font-size: 18px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0.5; /* Faded for inactive */
}

/* Rounded corners for the edges of the bar */
.score-a { background-color: #038141; border-top-left-radius: 18px; border-bottom-left-radius: 18px; }
.score-b { background-color: #85BB2F; }
.score-c { background-color: #FECB02; }
.score-d { background-color: #EE8100; }
.score-e { background-color: #E63E11; border-top-right-radius: 18px; border-bottom-right-radius: 18px; }

/* Active State - The "Pop" effect */
.nutri-score.grade-a .score-a,
.nutri-score.grade-b .score-b,
.nutri-score.grade-c .score-c,
.nutri-score.grade-d .score-d,
.nutri-score.grade-e .score-e {
    transform: scale(1.3);
    z-index: 2;
    opacity: 1;
    height: 46px;
    width: 38px;
    border-radius: 12px; /* Make the active one a rounded rectangle */
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    font-size: 24px;
    margin: 0 4px;
}

/* Grayed out state when no score is available */
.nutri-score.grayed-out {
    filter: grayscale(1);
    opacity: 0.6;
    border-color: #ccc;
}

.nutri-score.grayed-out .nutri-score-title {
    color: #999;
}