
        updateTopFromRow(row, false);
    }catch(e){}
    topRefreshBusy = false;
}

function updateTopEpgProgress(){
    const fill = document.getElementById('epgBarFillLive');
    const remain = document.getElementById('epgRemainLive');

    if(!fill || !remain || !topStartTsLive || !topEndTsLive || topEndTsLive <= topStartTsLive){
        if(fill) fill.style.width = '0%';
        if(remain) remain.textContent = '0 min';
        return;
    }

    const now = Math.floor(Date.now() / 1000);
    const total = topEndTsLive - topStartTsLive;
    const elapsed = Math.max(0, Math.min(total, now - topStartTsLive));
    const progress = Math.max(0, Math.min(100, Math.round((elapsed / total) * 100)));
    const mins = Math.max(0, Math.ceil((topEndTsLive - now) / 60));

    fill.style.width = progress + '%';
    remain.textContent = mins + ' min';

    if(mins <= 0){
        const row = topCurrentRow || document.querySelector('.row36.focus') || document.querySelector('.row36.active');
        if(row) refreshTopEpgFromServer(row);
    }
}

updateTopEpgProgress();
setInterval(updateTopEpgProgress, 1000);
</script>

</body>
</html>

<style>
/* SUBIR SOLO PANEL SUPERIOR DERECHO */
.info{
  padding-top:22px!important;
}
.info h2{
  margin-top:-4px!important;
  margin-bottom:8px!important;
}
.epgDetail{
  margin-top:-2px!important;
}
</style>
