:root {
    /* NOU token: fosc amb to vermell, a joc amb la marca.
       (Si vols, afegeix-lo a Core Framework com --color-fosc-vermell i canvia-ho aquí) */
    --ri-bg: #1e0f11;
    /* Lligats al TEU sistema (Core Framework). El fallback només actua si la variable no existís */
    --ri-accent: var(--color-primario, #ff2222);
    --ri-live: var(--color-primario, #ff2222);
    --ri-text: var(--color-blanco, #ffffff);
    --ri-muted: color-mix(in srgb, var(--color-blanco, #fff) 60%, transparent);
    --ri-track: color-mix(in srgb, var(--color-blanco, #fff) 16%, transparent);
    --ri-height: 76px;
}

#ri-player {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    height: var(--ri-height);
    display: flex;
    align-items: center;
    gap: var(--space-m);
    padding: 0 var(--space-l);
    background: color-mix(in srgb, var(--ri-bg) 92%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 -6px 24px rgba(0, 0, 0, .22);
    color: var(--ri-text);
    box-sizing: border-box;
    /* OCULTA per defecte: fora de pantalla cap avall */
    transform: translateY(120%);
    transition: transform .4s cubic-bezier(.2, .8, .2, 1);
}

#ri-player.is-visible {
    transform: translateY(0);
}

/* apareix lliscant */

#ri-toggle {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--ri-accent);
    color: var(--color-blanco, #fff);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform .12s ease, background .2s ease;
}

#ri-toggle:hover {
    transform: scale(1.06);
}

#ri-toggle:focus-visible {
    outline: 3px solid var(--ri-accent);
    outline-offset: 3px;
}

#ri-toggle svg {
    width: 22px;
    height: 22px;
    display: block;
}

#ri-toggle .ico-pause {
    display: none;
}

#ri-player.is-playing #ri-toggle .ico-play {
    display: none;
}

#ri-player.is-playing #ri-toggle .ico-pause {
    display: block;
}

#ri-player.is-loading #ri-toggle {
    background: var(--ri-track);
    cursor: wait;
}

#ri-player.is-loading #ri-toggle .ico-play,
#ri-player.is-loading #ri-toggle .ico-pause {
    display: none;
}

#ri-player.is-loading #ri-toggle .ico-load {
    display: block;
    animation: ri-spin .8s linear infinite;
}

#ri-toggle .ico-load {
    display: none;
}

@keyframes ri-spin {
    to {
        transform: rotate(360deg);
    }
}

#ri-info {
    flex: 1 1 auto;
    min-width: 0;
}

#ri-live-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ri-muted);
}

#ri-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ri-muted);
    flex: 0 0 auto;
}

#ri-player.is-playing #ri-dot {
    background: var(--ri-live);
    animation: ri-pulse 1.4s ease-in-out infinite;
}

@keyframes ri-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--ri-live) 55%, transparent);
    }

    50% {
        box-shadow: 0 0 0 6px color-mix(in srgb, var(--ri-live) 0%, transparent);
    }
}

#ri-now {
    font-size: 15px;
    font-weight: 600;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#ri-vol-wrap {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

#ri-vol-wrap svg {
    width: 20px;
    height: 20px;
    color: var(--ri-muted);
}

#ri-vol {
    -webkit-appearance: none;
    appearance: none;
    width: 110px;
    height: 4px;
    border-radius: 4px;
    background: var(--ri-track);
    cursor: pointer;
}

#ri-vol::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--ri-accent);
    cursor: pointer;
}

#ri-vol::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 50%;
    background: var(--ri-accent);
    cursor: pointer;
}

#ri-close {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .06);
    color: var(--ri-muted);
    cursor: pointer;
    display: grid;
    place-items: center;
}

#ri-close:hover {
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

#ri-close svg {
    width: 16px;
    height: 16px;
}

#ri-error {
    display: none;
    font-size: 13px;
    color: var(--ri-live);
}

#ri-player.is-error #ri-error {
    display: block;
}

#ri-player.is-error #ri-now {
    display: none;
}

@media (max-width:560px) {
    :root {
        --ri-height: 66px;
    }

    #ri-player {
        gap: 12px;
        padding: 0 12px;
    }

    #ri-toggle {
        width: 42px;
        height: 42px;
    }

    #ri-vol-wrap {
        display: none;
    }

    #ri-now {
        font-size: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #ri-player {
        transition: none;
    }

    /* apareix sense lliscar */
    #ri-player #ri-dot {
        animation: none;
    }

    /* el punt no batega */
}