@foreach($topics as $index => $topic)
@php
$pct = max(0, min(100, (int) ($topic->progress_percentage ?? 0)));
$starsLit = $pct >= 100 ? 3 : ($pct >= 66 ? 2 : ($pct >= 25 ? 1 : 0));
$cDone = (int) ($topic->coding_completed ?? 0);
$cTotal = (int) ($topic->coding_count ?? 0);
$mDone = (int) ($topic->mcq_completed ?? 0);
$mTotal = (int) ($topic->mcq_count ?? 0);
$isDone = ($pct >= 100);
$stepLabel = str_pad((string) ($index + 1), 2, '0', STR_PAD_LEFT);
@endphp
@endforeach
@endif