body {
    font-family: system-ui, sans-serif;
    background: linear-gradient(to bottom, #eef2f3, #ffffff);
    color: #222;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
}

h1 {
    margin-bottom: 1rem;
}

.stats {
    text-align: center;
    margin-bottom: 2rem;
}

.progress-container {
    position: relative;
    width: 80%;
    max-width: 600px;
    height: 40px;
    background: #ddd;
    border-radius: 20px;
    overflow: visible; /* allow cyclist to sit above the bar */
}

/* progress bar: animate its width */
.progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #54af4c, #81c784);
    border-radius: 20px;
    transition: width 3s ; /* smooth ease-out */
    /* transition: width 3s cubic-bezier(.22,.9,.29,1); smooth ease-out */
    z-index: 1;
}

/* cyclist wrapper: centered on its left position */
.cyclist {
    position: absolute;
    top: -100%;               /* place cyclist vertically above the bar */
    left: 0%;                /* start at the very left */
    transform: translate(-50%, -10%); /* center the emoji on the left coordinate */
    font-size: 2rem;
    transition: left 3s;
    z-index: 3;              /* above the bar */
    pointer-events: none;
}

.cyclist img {
    width: auto;
    height: 80px;
}

/* when celebration starts, lift/rotate slightly */
.cyclist.celebrate {
    transform: translate(-50%, -10%) rotate(-40deg) scale(1.1);
}

/* flip cyclist if you want it to face right (useful if emoji faces left) */
.cyclist.face-right {
    transform: translate(-50%, -10%) scaleX(-1);
}

/* combine flip + celebration safely using CSS variables */
.cyclist.face-right.celebrate {
    transform: translate(-50%, -10%) rotate(-8deg) scaleX(-1) scale(1.05);
}

/* fireworks (unchanged) */
.firework {
    position: absolute;
    width: 8px;
    height: 8px;
    background: gold;
    border-radius: 50%;
    opacity: 0;
    animation: explode 900ms ease-out forwards;
}
@keyframes explode {
    0% { transform: scale(0.2); opacity: 1; }
    100% { transform: scale(4); opacity: 0; }
}


.finish-line {
    position: absolute;
    top: -10px;
    width: 4px;
    height: 60px;
    background: repeating-linear-gradient(
        45deg,
        black,
        black 5px,
        white 5px,
        white 10px
    );
    border-radius: 2px;
    z-index: 2;
    left: 75%;
}

.finish-flag {
    position: absolute;
    top: -45px;
    font-size: 1.5rem;
    transform: translateX(-50%);
}
