export function guessCategory(activity: string): string | null {
  const lower = activity.toLowerCase();
  if (/吃|餐|饭|火锅|烧烤|面|菜|厨|食/.test(lower)) return "dining";
  if (/手作|工坊|烘焙|插花|陶艺|DIY|体验/.test(lower)) return "experience";
  if (/露营|徒步|赶海|农场|自然|野|营地/.test(lower)) return "nature";
  if (/公园|山|湖|海|户外|骑/.test(lower)) return "outdoor";
  if (/电影|KTV|密室|游戏|桌游|剧/.test(lower)) return "entertainment";
  if (/逛街|购物|商场|买/.test(lower)) return "shopping";
  if (/运动|健身|球|跑|游泳|瑜伽/.test(lower)) return "sports";
  if (/博物馆|展览|美术|书/.test(lower)) return "culture";
  if (/咖啡|茶|SPA|按摩|下午茶/.test(lower)) return "relaxation";
  return null;
}

export function formatDuration(minutes: number): string {
  if (minutes >= 60) {
    const h = Math.floor(minutes / 60);
    const m = minutes % 60;
    return m > 0 ? `${h}h${m}min` : `${h}h`;
  }
  return `${minutes}min`;
}
