import type { Cost } from '~/types/game' const pad = (n: number) => String(n).padStart(2, '0') /** 3725 → "1:02:05" */ export function formatDuration(totalSeconds: number) { const s = Math.max(0, Math.round(totalSeconds)) return `${Math.floor(s / 3600)}:${pad(Math.floor((s % 3600) / 60))}:${pad(s % 60)}` } export const formatAmount = (n: number) => String(Math.floor(n)) /** 12.5 → "+12.5", -3 → "-3" */ export const formatRate = (n: number) => `${n >= 0 ? '+' : ''}${Math.round(n * 10) / 10}` export const formatCost = (cost: Cost) => `${cost.wood} / ${cost.clay} / ${cost.iron}`