{#if isOpen}
e.key === "Escape" && onClose?.()} role="button" tabindex="-1" aria-label="Close achievements panel" transition:slide={{ duration: 300, easing: quintOut }} >

Achievements

{progress.unlocked} / {progress.total} Unlocked {progress.percentage}%
{#each achievementCategories as category (category.name)} {@const achievements = getAchievementsForCategory(category.ids)} {@const unlockedCount = achievements.filter((a) => a.unlocked).length}
{#if selectedCategory === category.name}
{#each achievements as achievement (achievement.id)}
{achievement.icon}

{achievement.name}

{achievement.rarity}

{achievement.description}

{#if achievement.unlocked && achievement.unlockedAt}

Unlocked {formatDate(achievement.unlockedAt)}

{:else if achievement.maxProgress && achievement.progress !== undefined}
Progress {achievement.progress} / {achievement.maxProgress}
{/if}
{/each}
{/if}
{/each}
{#if achievementsState.lastUnlocked}

Last Unlocked:

{achievementsState.lastUnlocked.icon}

{achievementsState.lastUnlocked.name}

{formatDate(achievementsState.lastUnlocked.unlockedAt)}

{/if}
{/if}