// Exercise Database - Comprehensive with detailed exercise information const exerciseDB = { chest: { easy: [ { name: "靠牆伏地挺身 Wall Push-up", description: "靠牆進行伏地挺身,減輕手腕與肩膀負荷,適合初學者。", precautions: "手肘不要張太開,避免肩膀壓力", targetMuscles: "胸大肌、三頭肌", keyPoints: "核心收緊,背部保持直線", videoUrl: "https://www.youtube.com/watch?v=Eh00_rniF8E" }, { name: "跪姿伏地挺身 Knee Push-up", description: "膝蓋著地降低難度,使胸部和手臂肌群能穩定發力。", precautions: "膝蓋墊軟墊", targetMuscles: "胸大肌、三頭肌", keyPoints: "下降時胸口接近地面,手肘約45度", videoUrl: "https://www.youtube.com/watch?v=65kH0J8qES0" }, { name: "椅子伏地挺身 Incline Push-up", description: "手放在椅子或穩固平台上,降低負荷,提高胸大肌上部訓練。", precautions: "選擇穩固平台", targetMuscles: "胸大肌上方、三頭肌", keyPoints: "背部直線,核心收緊", videoUrl: "https://www.youtube.com/watch?v=3jRPr5n4n2I" }, { name: "窄距離跪姿伏地挺身 Close-Knee Push-up", description: "雙手靠近身體,使胸大肌內側及三頭肌更集中發力。", precautions: "手距過窄易肩不適", targetMuscles: "胸大肌內側、三頭肌", keyPoints: "肘靠近身體下降", videoUrl: "https://www.youtube.com/watch?v=0W_fhLk_Cq4" } ], normal: [ { name: "標準伏地挺身 Push-up", description: "基本伏地挺身,全面訓練胸大肌、三頭肌與前鋸肌。", precautions: "腰背勿下垂", targetMuscles: "胸大肌、三頭肌、前鋸肌", keyPoints: "胸口下降至手肘彎90度", videoUrl: "https://www.youtube.com/watch?v=5dF4QBx2fFc" }, { name: "寬距伏地挺身 Wide Push-up", description: "手比肩寬,主要訓練胸大肌外側,增加胸部厚度。", precautions: "手距過寬肩膀受力大", targetMuscles: "胸大肌外側", keyPoints: "肩膀穩定,不聳肩", videoUrl: "https://www.youtube.com/watch?v=0B5FxyZSP84" }, { name: "鑽石伏地挺身 Diamond Push-up", description: "雙手成鑽石形,增加胸內側與三頭肌負荷。", precautions: "手指呈鑽石形", targetMuscles: "胸大肌內側、三頭肌", keyPoints: "核心收緊,胸口靠近手指", videoUrl: "https://www.youtube.com/watch?v=S5K5CjyQCXk" }, { name: "上斜伏地挺身 Incline Push-up", description: "雙手放高平台,強化胸大肌上部。", precautions: "穩固平台", targetMuscles: "胸大肌上部", keyPoints: "身體直線,控制下降", videoUrl: "https://www.youtube.com/watch?v=3jRPr5n4n2I" }, { name: "下斜伏地挺身 Decline Push-up", description: "雙腳放高平台,訓練胸大肌下部及肩前束。", precautions: "腳置高平台", targetMuscles: "胸大肌下部、肩前束", keyPoints: "核心收緊,胸口下降", videoUrl: "https://www.youtube.com/watch?v=OZO9QH4dO6U" } ], hard: [ { name: "單手伏地挺身 One Arm Push-up", description: "單手支撐,強化胸大肌、三頭肌與核心穩定性。", precautions: "肩膀與手腕承受高壓", targetMuscles: "胸大肌、三頭肌、核心", keyPoints: "核心穩定,避免身體旋轉", videoUrl: "https://www.youtube.com/watch?v=TLn3GYbWqL0" }, { name: "爆發伏地挺身 Plyometric Push-up", description: "快速向上爆發,增加胸、肩、核心爆發力。", precautions: "地面防滑", targetMuscles: "胸大肌、肩膀、核心", keyPoints: "爆發力向上推,落地膝微屈", videoUrl: "https://www.youtube.com/watch?v=QhKJi1LqE2A" }, { name: "拍手伏地挺身 Clap Push-up", description: "在上推時拍手,增強上肢爆發力及手眼協調。", precautions: "控制落地", targetMuscles: "胸大肌、肩膀、三頭肌", keyPoints: "手離地瞬間拍手", videoUrl: "https://www.youtube.com/watch?v=2rGhq0t8qps" }, { name: "弓箭式伏地挺身 Archer Push-up", description: "一側手臂伸直,另一側彎曲,單側發力,提升胸大肌單側控制力。", precautions: "單側支撐", targetMuscles: "胸大肌單側、肩膀、核心", keyPoints: "保持平衡", videoUrl: "https://www.youtube.com/watch?v=Gq6t0bY0I2U" }, { name: "偽俄式伏地挺身 Pseudo Push-up", description: "類似單手伏地挺身,但雙手寬距,身體略向前傾,增加肩膀與胸肌負荷,同時提升核心穩定。", precautions: "雙手寬距控制平衡", targetMuscles: "胸大肌、肩膀、核心", keyPoints: "控制下放速度", videoUrl: "https://www.youtube.com/watch?v=G_r_E5r3ePE" } ] }, back: { easy: [ { name: "超人式 Superman Hold", description: "俯臥地面,手腳同時抬起,訓練背伸肌與臀肌。", precautions: "不要過度抬頭", targetMuscles: "背部伸肌、臀大肌", keyPoints: "手腳同步抬起", videoUrl: "https://www.youtube.com/watch?v=J42d4J9nJ0w" }, { name: "俯臥抬手抬腳 Prone Arm & Leg Raise", description: "保持腰背自然曲線,手腳慢慢抬起並控制下降。", precautions: "腰背自然曲線", targetMuscles: "下背、臀部", keyPoints: "動作緩慢,避免甩動", videoUrl: "https://www.youtube.com/watch?v=J42d4J9nJ0w" }, { name: "毛巾划船 Towel Row", description: "利用毛巾固定在門把或支撐物,模擬划船動作訓練背肌。", precautions: "毛巾或門把穩固", targetMuscles: "背闊肌、菱形肌、二頭肌", keyPoints: "肩胛骨夾緊,核心收緊", videoUrl: "https://www.youtube.com/watch?v=QFqSLJq5KOs" } ], normal: [ { name: "反向划船 Inverted Row", description: "懸吊在低桿下拉身體,訓練背肌及手臂。", precautions: "手握穩固", targetMuscles: "背闊肌、菱形肌、二頭肌", keyPoints: "肩胛骨下沉,核心收緊", videoUrl: "https://www.youtube.com/watch?v=hS1jyNsYOxE" }, { name: "寬距反向划船 Wide Inverted Row", description: "手握寬距,增加背闊肌外側訓練。", precautions: "手距過寬易肩緊繃", targetMuscles: "背闊肌、肩後束", keyPoints: "身體直線,肩胛骨夾緊", videoUrl: "https://www.youtube.com/watch?v=Hlv0x2H8bAQ" }, { name: "窄距反向划船 Close Inverted Row", description: "手握窄距,強化背闊肌中段與二頭肌。", precautions: "手臂過靠近手腕不適", targetMuscles: "背闊肌中段、二頭肌", keyPoints: "核心收緊", videoUrl: "https://www.youtube.com/watch?v=HKxXCNXn6rw" }, { name: "T字背部抬手 T-Arm Raise", description: "俯身或躺地抬手呈T字,訓練後肩與菱形肌。", precautions: "肩關節不要過度旋轉", targetMuscles: "後肩、菱形肌", keyPoints: "慢慢抬高,動作控制", videoUrl: "https://www.youtube.com/watch?v=O9v6C8lWwf8" } ], hard: [ { name: "單手反向划船 One Arm Inverted Row", description: "單手拉動,訓練單側背闊肌與核心控制力。", precautions: "核心穩定", targetMuscles: "背闊肌、菱形肌", keyPoints: "控制下放", videoUrl: "https://www.youtube.com/watch?v=3dZ5y5lM6wQ" }, { name: "L坐引體向上 L-sit Pull-up", description: "懸垂雙腿前舉成L形,增加核心負荷。", precautions: "核心需先練好", targetMuscles: "背闊肌、核心", keyPoints: "雙腿前舉成L形", videoUrl: "https://www.youtube.com/watch?v=K2HR5Xz9tHc" }, { name: "引體向上 Pull-up", description: "標準引體向上,肩胛骨下沉,核心收緊。", precautions: "勿借力擺動", targetMuscles: "背闊肌、二頭肌", keyPoints: "肩胛骨下沉,核心收緊", videoUrl: "https://www.youtube.com/watch?v=aDjcqrlKQYI" }, { name: "寬握引體向上 Wide Grip Pull-up", description: "手握比肩寬,訓練背闊肌外側。", precautions: "手握過寬易肩緊", targetMuscles: "背闊肌外側", keyPoints: "核心收緊", videoUrl: "https://www.youtube.com/watch?v=8nG6T79hWaE" } ] }, shoulders: { easy: [ { name: "肩部繞圈 Arm Circles", description: "雙臂平舉,做小幅度圓周旋轉,熱身肩關節。", precautions: "幅度不要過大", targetMuscles: "三角肌前束/中束/後束", keyPoints: "肩膀保持放鬆", videoUrl: "https://www.youtube.com/watch?v=Gzyr8x4FhrE" }, { name: "牆面滑動 Wall Slides", description: "背靠牆,手臂向上滑動模仿推舉,增加肩關節活動度。", precautions: "背部貼牆", targetMuscles: "三角肌、肩胛肌群", keyPoints: "慢速控制", videoUrl: "https://www.youtube.com/watch?v=Jke8R7Z5N4E" }, { name: "啞鈴側平舉 Dumbbell Lateral Raise", description: "雙手握輕重量啞鈴,抬至肩高。", precautions: "重量輕,控制上升", targetMuscles: "三角肌中束", keyPoints: "核心收緊,肩膀下沉", videoUrl: "https://www.youtube.com/watch?v=JIvbcs1cWNw" } ], normal: [ { name: "啞鈴前平舉 Dumbbell Front Raise", description: "雙手持啞鈴向前抬至肩高,訓練三角肌前束。", precautions: "手肘微彎,控制下降", targetMuscles: "三角肌前束", keyPoints: "背部保持直線", videoUrl: "https://www.youtube.com/watch?v=3F4HjJ8y8rQ" }, { name: "啞鈴後平舉 Dumbbell Reverse Fly", description: "俯身或躺於斜板,雙手啞鈴往兩側抬起,訓練後肩。", precautions: "避免背部拱起", targetMuscles: "三角肌後束、菱形肌", keyPoints: "慢速控制", videoUrl: "https://www.youtube.com/watch?v=EA7u9d6vE0E" }, { name: "阿諾德推舉 Arnold Press", description: "坐姿或站姿,啞鈴由胸前旋轉向上推起,結合前、中束訓練。", precautions: "肩膀穩定", targetMuscles: "三角肌前/中束", keyPoints: "動作控制,避免借力", videoUrl: "https://www.youtube.com/watch?v=6xPE4K4r15s" } ], hard: [ { name: "手推俯臥撐 Pike Push-up", description: "臀部抬高呈倒V,手臂支撐下壓,訓練肩部。", precautions: "手腕不要過度承壓", targetMuscles: "肩膀、三頭肌", keyPoints: "控制下放,核心收緊", videoUrl: "https://www.youtube.com/watch?v=9h1jC6yCj6I" }, { name: "爆發手推俯臥撐 Plyo Pike Push-up", description: "下放後快速推起,增加肩膀爆發力。", precautions: "地面防滑", targetMuscles: "肩膀、胸、核心", keyPoints: "爆發力向上,控制落地", videoUrl: "https://www.youtube.com/watch?v=2QqkjS1b4xE" }, { name: "倒立牆壁推舉 Handstand Wall Press", description: "雙手倒立靠牆,進行推舉,訓練全肩與核心。", precautions: "初學者需有人協助", targetMuscles: "肩膀、三頭肌、核心", keyPoints: "肩膀穩定,核心收緊", videoUrl: "https://www.youtube.com/watch?v=6eHkE1WbH5Q" } ] }, arms: { easy: [ { name: "二頭肌彎舉 Dumbbell Bicep Curl", description: "雙手握啞鈴,手肘靠近身體做彎舉。", precautions: "手肘不前後移動", targetMuscles: "二頭肌", keyPoints: "控制下放", videoUrl: "https://www.youtube.com/watch?v=XKwNUWRgP6c" }, { name: "三頭肌伸展 Tricep Kickback", description: "俯身手肘固定,手腕向後伸展。", precautions: "手肘固定", targetMuscles: "三頭肌", keyPoints: "動作緩慢", videoUrl: "https://www.youtube.com/watch?v=6NXRrMx1j4E" } ], normal: [ { name: "啞鈴交替彎舉 Alternating Dumbbell Curl", description: "單手交替彎舉啞鈴,提高二頭肌控制力。", precautions: "避免身體晃動", targetMuscles: "二頭肌", keyPoints: "手肘固定", videoUrl: "https://www.youtube.com/watch?v=WkJNslo7d0Q" }, { name: "仰臥三頭肌伸展 Lying Tricep Extension", description: "平躺,雙手握啞鈴從額頭上方伸直。", precautions: "重量適中", targetMuscles: "三頭肌", keyPoints: "肘關節固定", videoUrl: "https://www.youtube.com/watch?v=ns-R2Xo0SrA" } ], hard: [ { name: "單手啞鈴交替彎舉 One Arm Dumbbell Curl", description: "單手彎舉,提高單側控制力。", precautions: "核心收緊", targetMuscles: "二頭肌", keyPoints: "控制下放", videoUrl: "https://www.youtube.com/watch?v=0tS3kX9l5nE" }, { name: "爆發式二頭肌彎舉 Plyometric Bicep Curl", description: "快速彎舉,提高手臂爆發力。", precautions: "注意手肘受力", targetMuscles: "二頭肌", keyPoints: "動作爆發,控制落下", videoUrl: "https://www.youtube.com/watch?v=Z8H4I1i8W7E" }, { name: "三頭肌鑽石伏地挺身 Tricep Diamond Push-up", description: "雙手成鑽石形做伏地挺身,專注三頭肌。", precautions: "手肘靠近身體", targetMuscles: "三頭肌", keyPoints: "核心收緊,控制下降", videoUrl: "https://www.youtube.com/watch?v=S5K5CjyQCXk" } ] }, legs: { easy: [ { name: "椅子深蹲 Chair Squat", description: "背靠椅子,臀部慢慢下坐至接觸椅子,再站起。", precautions: "膝蓋不超腳尖", targetMuscles: "大腿前側、臀部", keyPoints: "背直,核心收緊", videoUrl: "https://www.youtube.com/watch?v=Yf2Czzk3vXc" }, { name: "半蹲 Half Squat", description: "膝蓋微屈,下蹲至大腿與地面平行以上。", precautions: "膝蓋與腳尖同向", targetMuscles: "大腿前側、臀部", keyPoints: "核心收緊", videoUrl: "https://www.youtube.com/watch?v=QeW6C5Y4YtY" }, { name: "台階踩踏 Step Up", description: "單腳踏穩台階,另一腳跟上,再下來。", precautions: "踏板穩固", targetMuscles: "臀大肌、大腿後側", keyPoints: "全腳踩實,核心收緊", videoUrl: "https://www.youtube.com/watch?v=WC8R9V0k5oE" }, { name: "靠牆深蹲 Wall Squat", description: "背靠牆下蹲至大腿平行,保持姿勢。", precautions: "背靠牆,膝蓋不超腳尖", targetMuscles: "大腿、臀部", keyPoints: "保持穩定", videoUrl: "https://www.youtube.com/watch?v=-tE6kBk0EYw" } ], normal: [ { name: "深蹲 Squat", description: "雙腳與肩同寬,下蹲至大腿平行地面,再起身。", precautions: "膝蓋與腳尖同向", targetMuscles: "大腿前後側、臀部", keyPoints: "背直,核心收緊", videoUrl: "https://www.youtube.com/watch?v=mGvzVjuY8SY" }, { name: "跳深蹲 Jump Squat", description: "深蹲後用力跳起,落地再蹲。", precautions: "落地膝微屈", targetMuscles: "大腿、臀部", keyPoints: "核心收緊", videoUrl: "https://www.youtube.com/watch?v=Azl5tkCzDcc" }, { name: "弓箭步 Lunge", description: "單腿前跨下蹲,後膝接近地面,再回來。", precautions: "膝蓋不超腳尖", targetMuscles: "大腿前側、臀部", keyPoints: "上身直立,核心收緊", videoUrl: "https://www.youtube.com/watch?v=K6K2Nqx5hXo" }, { name: "交替弓箭步 Alternating Lunge", description: "左右腿交替前跨下蹲,保持節奏。", precautions: "控制平衡", targetMuscles: "大腿、臀部", keyPoints: "膝蓋不碰地", videoUrl: "https://www.youtube.com/watch?v=3XDjB00Q5rE" }, { name: "側弓箭步 Side Lunge", description: "單腿側跨下蹲,另一腿伸直,回來再換側。", precautions: "膝蓋與腳尖同向", targetMuscles: "大腿內外側、臀部", keyPoints: "核心收緊", videoUrl: "https://www.youtube.com/watch?v=MVkJWXyE2mE" } ], hard: [ { name: "單腳深蹲 Pistol Squat", description: "單腳下蹲,另一腿伸直前方,慢慢回站立。", precautions: "需平衡與柔軟度", targetMuscles: "大腿前側、臀部", keyPoints: "膝與腳尖同向", videoUrl: "https://www.youtube.com/watch?v=uH7xqgQ5abU" }, { name: "跳躍弓箭步 Jump Lunge", description: "弓箭步跳起換腿落地,再蹲。", precautions: "落地膝微彎", targetMuscles: "大腿、臀部", keyPoints: "雙腿交替跳", videoUrl: "https://www.youtube.com/watch?v=K6K2Nqx5hXo" }, { name: "保加利亞蹲 Bulgarian Split Squat", description: "後腳放在凳上,前腳下蹲,再起身。", precautions: "後腳穩定", targetMuscles: "大腿前側、臀部", keyPoints: "膝不超腳尖", videoUrl: "https://www.youtube.com/watch?v=6w7IqJ1N-_U" }, { name: "蝦式蹲 Shrimp Squat", description: "單腳支撐,另一腳屈膝抓腳踝,慢慢下蹲再起。", precautions: "需平衡", targetMuscles: "大腿、臀部", keyPoints: "慢控制下降與上升", videoUrl: "https://www.youtube.com/watch?v=4H0yN6tZ1vY" } ] }, glutes: { easy: [ { name: "臀橋 Glute Bridge", description: "仰躺,膝蓋彎曲,臀部向上抬起至頂點收緊。", precautions: "腰背自然曲線", targetMuscles: "臀大肌、腿後側", keyPoints: "頂點收緊", videoUrl: "https://www.youtube.com/watch?v=wPM8icPu6H8" }, { name: "側躺抬腿 Side Lying Leg Raise", description: "側躺單腿抬高至最高點,慢慢下降。", precautions: "動作緩慢", targetMuscles: "臀中肌", keyPoints: "腿慢慢抬高", videoUrl: "https://www.youtube.com/watch?v=jG5w2Yd8W3k" }, { name: "驢踢 Donkey Kick", description: "四足跪姿,單腿膝90度向上抬。", precautions: "膝90度彎", targetMuscles: "臀大肌", keyPoints: "臀部用力抬腿", videoUrl: "https://www.youtube.com/watch?v=ZxFAvE5wI7A" } ], normal: [ { name: "單腳臀橋 Single Leg Glute Bridge", description: "單腳支撐,另一腳抬起,臀橋頂點收緊。", precautions: "腰背穩定", targetMuscles: "臀大肌、腿後側", keyPoints: "頂點收緊", videoUrl: "https://www.youtube.com/watch?v=KFx-9t-Q2bE" }, { name: "蛙式臀橋 Frog Pump", description: "仰躺,雙腳腳底合攏,臀部抬起停留頂點。", precautions: "腳底接觸穩固", targetMuscles: "臀大肌", keyPoints: "頂點停留", videoUrl: "https://www.youtube.com/watch?v=KfHq3n5x8Uc" }, { name: "臀推 Hip Thrust", description: "背靠凳子,膝彎曲,臀部抬起至頂點收緊。", precautions: "肩膀靠凳", targetMuscles: "臀大肌", keyPoints: "頂點收緊,腰背自然", videoUrl: "https://www.youtube.com/watch?v=LM8XHjBnO8o" } ], hard: [ { name: "北歐腿彎曲 Nordic Curl", description: "膝蓋跪地,雙腳固定,慢慢控制前傾。", precautions: "膝保護", targetMuscles: "臀大肌、腿後肌", keyPoints: "控制下降", videoUrl: "https://www.youtube.com/watch?v=qLgbqmX4WFw" }, { name: "單腳臀推 Single Leg Hip Thrust", description: "單腳支撐,另一腳抬起,臀部頂點收緊。", precautions: "單腳支撐", targetMuscles: "臀大肌", keyPoints: "頂點收緊", videoUrl: "https://www.youtube.com/watch?v=uY4A5E6W8gA" }, { name: "跳臀橋 Jump Glute Bridge", description: "臀橋頂點爆發跳起,落地膝微屈再抬起。", precautions: "落地膝微屈", targetMuscles: "臀大肌、腿後肌", keyPoints: "頂點收緊", videoUrl: "https://www.youtube.com/watch?v=KxE9v8c3yV4" } ] }, core: { easy: [ { name: "棒式 Plank", description: "前臂撐地,身體呈一直線,維持姿勢。", precautions: "腰不要下塌", targetMuscles: "核心(腹直肌、腹橫肌)", keyPoints: "核心收緊,臀部不過高", videoUrl: "https://www.youtube.com/watch?v=pvIjsG5Svck" }, { name: "仰臥捲腹 Crunch", description: "仰躺,肩膀微抬離地,收縮腹部。", precautions: "避免拉脖子", targetMuscles: "腹直肌", keyPoints: "用腹部發力", videoUrl: "https://www.youtube.com/watch?v=8N4q3a9mXkU" }, { name: "抬腿 Leg Raise", description: "仰躺,雙腿伸直抬起再慢慢放下。", precautions: "腰貼地", targetMuscles: "下腹部", keyPoints: "控制下降", videoUrl: "https://www.youtube.com/watch?v=7FwNYPxQ5qE" } ], normal: [ { name: "側棒式 Side Plank", description: "側身撐地,身體呈一直線維持。", precautions: "肩膀穩定", targetMuscles: "腹斜肌", keyPoints: "核心收緊", videoUrl: "https://www.youtube.com/watch?v=K2U8J8K6Q3I" }, { name: "登山者 Mountain Climber", description: "撐地姿勢,雙腿交替往胸口收。", precautions: "速度可控", targetMuscles: "核心、下腹", keyPoints: "保持穩定", videoUrl: "https://www.youtube.com/watch?v=nmwgirgXLYM" }, { name: "俄羅斯轉體 Russian Twist", description: "坐姿身體後傾,左右旋轉軀幹。", precautions: "背部打直", targetMuscles: "腹斜肌", keyPoints: "控制轉動", videoUrl: "https://www.youtube.com/watch?v=wkD8rJK7UI8" } ], hard: [ { name: "懸垂抬腿 Hanging Leg Raise", description: "懸吊單槓,雙腿抬至水平或更高。", precautions: "避免擺動", targetMuscles: "下腹、核心", keyPoints: "慢慢抬起", videoUrl: "https://www.youtube.com/watch?v=7FwNYPxQ5qE" }, { name: "L坐 L-sit", description: "雙手撐地,雙腿伸直抬起呈L型。", precautions: "手腕壓力大", targetMuscles: "核心、髖屈肌", keyPoints: "核心收緊", videoUrl: "https://www.youtube.com/watch?v=IYZI6eA4k_o" }, { name: "V字捲腹 V-up", description: "手腳同時抬起,在空中接觸。", precautions: "控制速度", targetMuscles: "腹直肌", keyPoints: "核心發力", videoUrl: "https://www.youtube.com/watch?v=Z8H4I1i8W7E" } ] }, fullbody: { easy: [ { name: "開合跳 Jumping Jack", description: "雙腳跳開合併,雙手同步上舉。", precautions: "節奏穩定", targetMuscles: "全身、有氧系統", keyPoints: "輕鬆節奏", videoUrl: "https://www.youtube.com/watch?v=iSSAk4XJWG0" }, { name: "原地高抬腿 High Knees", description: "原地跑步,膝蓋抬高至腰部。", precautions: "核心穩定", targetMuscles: "核心、腿部", keyPoints: "節奏控制", videoUrl: "https://www.youtube.com/watch?v=ZC9e8J8b5nE" }, { name: "波比分解 Burpee Step", description: "分解動作進行波比,降低強度。", precautions: "動作分段", targetMuscles: "全身", keyPoints: "穩定完成", videoUrl: "https://www.youtube.com/watch?v=58TfjRnxXzk" } ], normal: [ { name: "波比跳 Burpee", description: "深蹲→撐地→跳回→起跳,完整動作。", precautions: "動作流暢", targetMuscles: "全身", keyPoints: "節奏穩定", videoUrl: "https://www.youtube.com/watch?v=dZg3zYvTg1E" }, { name: "登山者跳 Mountain Climber Jump", description: "快速登山者動作結合跳躍。", precautions: "核心穩定", targetMuscles: "核心、腿部", keyPoints: "速度控制", videoUrl: "https://www.youtube.com/watch?v=nmwgirgXLYM" }, { name: "深蹲推舉 Thruster", description: "深蹲後接肩推,一次完成。", precautions: "動作連貫", targetMuscles: "腿、肩、核心", keyPoints: "核心收緊", videoUrl: "https://www.youtube.com/watch?v=5G5E5G5a5LQ" } ], hard: [ { name: "波比跳加伏地挺身 Burpee Push-up", description: "波比過程加入伏地挺身。", precautions: "控制節奏", targetMuscles: "全身", keyPoints: "穩定動作", videoUrl: "https://www.youtube.com/watch?v=806hY7VfJyU" }, { name: "單腳波比 One Leg Burpee", description: "單腳進行波比動作,提高難度。", precautions: "平衡控制", targetMuscles: "全身、核心", keyPoints: "核心穩定", videoUrl: "https://www.youtube.com/watch?v=K9N5Q9q9Q3I" }, { name: "波比跳接高跳 Burpee Tuck Jump", description: "波比後接抱膝跳,提高爆發力。", precautions: "落地穩定", targetMuscles: "全身、爆發力", keyPoints: "膝蓋保護", videoUrl: "https://www.youtube.com/watch?v=pkN2xLQQx4Q" } ] } }; // Nutrition Calculator Functions function calculateNutrition(weight) { if (!weight || weight <= 0) return null; // Calculate protein servings (weight × 0.25–0.35 servings, each serving ~20-25g protein) const proteinMin = Math.round(weight * 0.25 * 10) / 10; const proteinMax = Math.round(weight * 0.35 * 10) / 10; // Calculate Vitamin C and B based on weight ranges let vitaminAmount = 1; if (weight <= 50) { vitaminAmount = 1; } else if (weight <= 70) { vitaminAmount = 2; } else if (weight <= 90) { vitaminAmount = 3; } else { vitaminAmount = 4; } return { protein: { min: proteinMin, max: proteinMax, unit: '份', perServing: '每份約20-25g蛋白質', timing: '運動後30分鐘內', description: '訓練後建議攝取,用於肌肉修復與增長,不代表一天總量' }, vitaminC: { amount: vitaminAmount, unit: '顆', weightRange: getWeightRangeText(weight), description: '抗氧化、幫助恢復' }, vitaminB: { amount: vitaminAmount, unit: '顆', weightRange: getWeightRangeText(weight), description: '幫助能量代謝、肌肉恢復' }, doubleX: { amount: 1, unit: '套', details: '共3顆(維生素、礦物質、植物精華各1顆)', description: '補充多種植物營養素、維生素、礦物質' }, water: { min: Math.round(weight * 5), max: Math.round(weight * 7), unit: 'ml', timing: '運動後30分鐘內', description: '每公斤體重5-7ml', example: `體重 ${weight}kg → 約 ${Math.round(weight * 5)}–${Math.round(weight * 7)} ml` } }; } // Helper function to get weight range text function getWeightRangeText(weight) { if (weight <= 50) return '≤50kg:1顆'; if (weight <= 70) return '51–70kg:2顆'; if (weight <= 90) return '71–90kg:3顆'; return '≥91kg:4顆'; } // Update nutrition display on the results page function updateNutritionDisplay() { const weight = personalInfo.weight; const nutrition = calculateNutrition(weight); // Update protein card const proteinCardAmount = document.getElementById('proteinCardAmount'); const proteinResult = document.getElementById('proteinResult'); if (proteinCardAmount) { if (nutrition && nutrition.protein) { proteinCardAmount.textContent = `${nutrition.protein.min}-${nutrition.protein.max} ${nutrition.protein.unit}`; } else { proteinCardAmount.textContent = '輸入體重計算份數'; } } if (proteinResult) { if (nutrition && nutrition.protein) { proteinResult.textContent = `${nutrition.protein.min}-${nutrition.protein.max} ${nutrition.protein.unit} (${nutrition.protein.perServing})`; } else { proteinResult.textContent = '體重×0.25-0.35份'; } } // Update Vitamin C card const vitaminCCardAmount = document.getElementById('vitaminCCardAmount'); if (vitaminCCardAmount) { if (nutrition && nutrition.vitaminC) { vitaminCCardAmount.textContent = `${nutrition.vitaminC.amount} ${nutrition.vitaminC.unit}`; } else { vitaminCCardAmount.textContent = '輸入體重計算顆數'; } } // Update Vitamin B card const vitaminBCardAmount = document.getElementById('vitaminBCardAmount'); if (vitaminBCardAmount) { if (nutrition && nutrition.vitaminB) { vitaminBCardAmount.textContent = `${nutrition.vitaminB.amount} ${nutrition.vitaminB.unit}`; } else { vitaminBCardAmount.textContent = '輸入體重計算顆數'; } } // Update Double X card const doubleXCardAmount = document.getElementById('doubleXCardAmount'); if (doubleXCardAmount) { if (nutrition && nutrition.doubleX) { doubleXCardAmount.textContent = `${nutrition.doubleX.amount} ${nutrition.doubleX.unit}`; } else { doubleXCardAmount.textContent = '建議1套'; } } // Update personal info summary const personalInfoSummary = document.getElementById('personalInfoSummary'); const personalInfoText = document.getElementById('personalInfoText'); if (personalInfoSummary && personalInfoText) { if (weight || personalInfo.height || personalInfo.gender) { personalInfoSummary.classList.remove('hidden'); const genderText = personalInfo.gender === 'male' ? '男性' : (personalInfo.gender === 'female' ? '女性' : ''); const heightText = personalInfo.height ? `${personalInfo.height}cm` : ''; const weightText = weight ? `${weight}kg` : ''; const parts = [genderText, heightText, weightText].filter(p => p); personalInfoText.textContent = parts.length > 0 ? parts.join(' / ') : '資料未提供'; } else { personalInfoSummary.classList.add('hidden'); } } } // Personal Info State let personalInfo = { gender: null, height: null, weight: null }; // Gender Selection function selectGender(gender) { personalInfo.gender = gender; // Update UI const maleBtn = document.getElementById('genderMale'); const femaleBtn = document.getElementById('genderFemale'); if (gender === 'male') { maleBtn.classList.add('border-blue-500', 'bg-blue-500/20'); maleBtn.classList.remove('border-transparent'); femaleBtn.classList.remove('border-pink-500', 'bg-pink-500/20'); femaleBtn.classList.add('border-transparent'); } else { femaleBtn.classList.add('border-pink-500', 'bg-pink-500/20'); femaleBtn.classList.remove('border-transparent'); maleBtn.classList.remove('border-blue-500', 'bg-blue-500/20'); maleBtn.classList.add('border-transparent'); } updatePersonalInfo(); } // Update Personal Info and Calculate Protein function updatePersonalInfo() { const heightInput = document.getElementById('heightInput'); const weightInput = document.getElementById('weightInput'); const proteinPreview = document.getElementById('proteinPreview'); const proteinAmount = document.getElementById('proteinAmount'); personalInfo.height = heightInput.value ? parseFloat(heightInput.value) : null; personalInfo.weight = weightInput.value ? parseFloat(weightInput.value) : null; // Calculate protein servings if weight is available (0.25-0.35 servings per kg) if (personalInfo.weight) { const minProtein = Math.round(personalInfo.weight * 0.25 * 10) / 10; const maxProtein = Math.round(personalInfo.weight * 0.35 * 10) / 10; proteinAmount.textContent = `${minProtein}-${maxProtein} 份 (每份約20-25g蛋白質)`; proteinPreview.classList.remove('hidden'); } else { proteinPreview.classList.add('hidden'); } } // Helper function to get exercise details based on muscle and difficulty function getExerciseDetails(muscle, difficulty) { // Core and Full Body use time-based format if (muscle === 'core' || muscle === 'fullbody') { const timeMap = { easy: '1分鐘動作,休息40秒,共3組', normal: '1分半動作,休息40秒,共3組', hard: '2分鐘動作,休息40秒,共3組' }; return { sets: '3', reps: timeMap[difficulty], isTimeBased: true, displaySets: '3組', displayReps: timeMap[difficulty] }; } else { // Rep-based for chest, back, shoulders, legs, glutes, arms const repMap = { easy: '12下 × 3組', normal: '15下 × 3組', hard: '12下 × 4組' }; const setMap = { easy: '3', normal: '3', hard: '4' }; return { sets: setMap[difficulty], reps: repMap[difficulty], isTimeBased: false, displaySets: setMap[difficulty] + '組', displayReps: (difficulty === 'hard' ? '12下' : (difficulty === 'normal' ? '15下' : '12下')) }; } } // State Management let selectedMuscles = []; let selectedDifficulty = null; let currentStep = 1; let particleAnimationId = null; let generatedExercises = []; // Store generated exercises for reuse // Initialize document.addEventListener('DOMContentLoaded', () => { lucide.createIcons(); initParticles(); initRippleEffect(); initKeyboardShortcuts(); // Add vibration support for mobile if ('vibrate' in navigator) { document.body.classList.add('vibration-supported'); } }); // Particle System function initParticles() { const canvas = document.getElementById('particles-canvas'); const ctx = canvas.getContext('2d'); function resize() { canvas.width = window.innerWidth; canvas.height = window.innerHeight; } resize(); window.addEventListener('resize', resize); const particles = []; const particleCount = 50; class Particle { constructor() { this.reset(); } reset() { this.x = Math.random() * canvas.width; this.y = Math.random() * canvas.height; this.size = Math.random() * 2 + 1; this.speedX = (Math.random() - 0.5) * 0.5; this.speedY = (Math.random() - 0.5) * 0.5; this.opacity = Math.random() * 0.5 + 0.2; this.color = Math.random() > 0.5 ? '#f59e0b' : '#10b981'; } update() { this.x += this.speedX; this.y += this.speedY; if (this.x < 0 || this.x > canvas.width) this.speedX *= -1; if (this.y < 0 || this.y > canvas.height) this.speedY *= -1; } draw() { ctx.beginPath(); ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2); ctx.fillStyle = this.color; ctx.globalAlpha = this.opacity; ctx.fill(); ctx.globalAlpha = 1; } } for (let i = 0; i < particleCount; i++) { particles.push(new Particle()); } function animate() { ctx.clearRect(0, 0, canvas.width, canvas.height); particles.forEach((particle, index) => { particle.update(); particle.draw(); // Connect nearby particles particles.slice(index + 1).forEach(other => { const dx = particle.x - other.x; const dy = particle.y - other.y; const distance = Math.sqrt(dx * dx + dy * dy); if (distance < 100) { ctx.beginPath(); ctx.strokeStyle = '#f59e0b'; ctx.globalAlpha = (1 - distance / 100) * 0.2; ctx.lineWidth = 1; ctx.moveTo(particle.x, particle.y); ctx.lineTo(other.x, other.y); ctx.stroke(); ctx.globalAlpha = 1; } }); }); particleAnimationId = requestAnimationFrame(animate); } animate(); } // Ripple Effect function initRippleEffect() { document.addEventListener('click', (e) => { if (e.target.closest('.energy-btn') || e.target.closest('.muscle-card') || e.target.closest('.difficulty-card')) { createRipple(e); } }); } function createRipple(e) { const button = e.target.closest('.energy-btn') || e.target.closest('.muscle-card') || e.target.closest('.difficulty-card'); if (!button) return; const rect = button.getBoundingClientRect(); const size = Math.max(rect.width, rect.height); const x = e.clientX - rect.left - size / 2; const y = e.clientY - rect.top - size / 2; const ripple = document.createElement('span'); ripple.classList.add('ripple'); ripple.style.width = ripple.style.height = size + 'px'; ripple.style.left = x + 'px'; ripple.style.top = y + 'px'; button.appendChild(ripple); setTimeout(() => ripple.remove(), 600); } // Confetti System function fireConfetti() { const canvas = document.getElementById('confetti-canvas'); const ctx = canvas.getContext('2d'); canvas.width = window.innerWidth; canvas.height = window.innerHeight; const pieces = []; const colors = ['#f59e0b', '#10b981', '#3b82f6', '#ec4899', '#8b5cf6']; for (let i = 0; i < 100; i++) { pieces.push({ x: canvas.width / 2, y: canvas.height / 2, w: Math.random() * 10 + 5, h: Math.random() * 10 + 5, color: colors[Math.floor(Math.random() * colors.length)], vx: (Math.random() - 0.5) * 20, vy: (Math.random() - 0.5) * 20, gravity: 0.5, rotation: Math.random() * 360, rotationSpeed: (Math.random() - 0.5) * 10 }); } let animationId; function animate() { ctx.clearRect(0, 0, canvas.width, canvas.height); pieces.forEach((piece, index) => { piece.x += piece.vx; piece.y += piece.vy; piece.vy += piece.gravity; piece.rotation += piece.rotationSpeed; ctx.save(); ctx.translate(piece.x, piece.y); ctx.rotate((piece.rotation * Math.PI) / 180); ctx.fillStyle = piece.color; ctx.fillRect(-piece.w / 2, -piece.h / 2, piece.w, piece.h); ctx.restore(); if (piece.y > canvas.height) { pieces.splice(index, 1); } }); if (pieces.length > 0) { animationId = requestAnimationFrame(animate); } else { cancelAnimationFrame(animationId); } } animate(); // Vibrate on mobile if (navigator.vibrate) { navigator.vibrate([100, 50, 100, 50, 200]); } } // Toast Notification function showToast(message, duration = 3000) { const toast = document.getElementById('toast'); const toastMessage = document.getElementById('toast-message'); toastMessage.textContent = message; toast.classList.add('show'); if (navigator.vibrate) { navigator.vibrate(50); } setTimeout(() => { toast.classList.remove('show'); }, duration); } // Keyboard Shortcuts function initKeyboardShortcuts() { document.addEventListener('keydown', (e) => { if (e.key === 'Enter') { if (currentStep === 1 && selectedMuscles.length > 0) { goToStep2(); } else if (currentStep === 2 && selectedDifficulty) { generateWorkout(); } } else if (e.key === 'Escape') { if (currentStep === 2) backToStep1(); else if (currentStep === 3) resetWorkout(); } else if (e.key === 'r' || e.key === 'R') { if (currentStep === 1) selectRandom(); } }); } // Share Workout function shareWorkout() { const muscleNames = { chest: '胸部', back: '背部', shoulders: '肩部', core: '核心', legs: '腿部', glutes: '臀部', arms: '手臂', fullbody: '全身' }; const difficultyNames = { easy: '簡單', normal: '普通', hard: '困難' }; const muscleText = selectedMuscles.map(m => muscleNames[m]).join('、'); const shareText = `我在 EliteFit Pro 生成了一個針對${muscleText}的${difficultyNames[selectedDifficulty]}強度訓練計畫!一起來運動吧!💪 #EliteFit #智能訓練`; if (navigator.share) { navigator.share({ title: 'EliteFit Pro 訓練計畫', text: shareText }); } else { navigator.clipboard.writeText(shareText).then(() => { showToast('已複製分享文字到剪貼簿!'); }); } } // Step 1: Muscle Selection function toggleMuscle(element) { const muscle = element.dataset.muscle; // Add click animation element.style.transform = 'scale(0.95)'; setTimeout(() => { element.style.transform = ''; }, 100); if (muscle === 'random') { selectRandom(); return; } if (element.classList.contains('selected')) { element.classList.remove('selected'); selectedMuscles = selectedMuscles.filter(m => m !== muscle); showToast(`已取消選擇 ${getMuscleName(muscle)}`, 1500); } else { // If fullbody is selected, deselect others if (muscle === 'fullbody') { document.querySelectorAll('.muscle-card.selected').forEach(card => { if (card.dataset.muscle !== 'fullbody') { card.classList.remove('selected'); } }); selectedMuscles = selectedMuscles.filter(m => m === 'fullbody'); } else { // If selecting other muscle, deselect fullbody const fullbodyCard = document.querySelector('[data-muscle="fullbody"]'); if (fullbodyCard.classList.contains('selected')) { fullbodyCard.classList.remove('selected'); selectedMuscles = selectedMuscles.filter(m => m !== 'fullbody'); } } element.classList.add('selected'); selectedMuscles.push(muscle); showToast(`已選擇 ${getMuscleName(muscle)}!`, 1500); } updateStep1Button(); } function getMuscleName(muscle) { const names = { chest: '胸部', back: '背部', shoulders: '肩部', core: '核心', legs: '腿部', glutes: '臀部', arms: '手臂', fullbody: '全身' }; return names[muscle] || muscle; } function selectRandom() { // Shake animation const randomCard = document.querySelector('[data-muscle="random"]'); randomCard.classList.add('shake'); setTimeout(() => randomCard.classList.remove('shake'), 500); // Clear all selections with animation document.querySelectorAll('.muscle-card.selected').forEach(card => { card.classList.remove('selected'); card.style.transform = 'rotate(360deg) scale(0.8)'; setTimeout(() => card.style.transform = '', 300); }); // Randomly select 1-2 muscles const muscles = ['chest', 'back', 'shoulders', 'core', 'legs', 'glutes', 'arms']; const numMuscles = Math.random() > 0.5 ? 2 : 1; const shuffled = muscles.sort(() => 0.5 - Math.random()); selectedMuscles = shuffled.slice(0, numMuscles); // Highlight selected with delay for drama selectedMuscles.forEach((muscle, index) => { setTimeout(() => { const card = document.querySelector(`[data-muscle="${muscle}"]`); if (card) { card.classList.add('selected'); card.classList.add('bounce-in'); setTimeout(() => card.classList.remove('bounce-in'), 600); } }, index * 200); }); // Flash random button randomCard.classList.add('selected'); setTimeout(() => randomCard.classList.remove('selected'), 500); // Show toast with suspense setTimeout(() => { const muscleNames = selectedMuscles.map(m => getMuscleName(m)).join(' + '); showToast(`🎲 隨機選擇:${muscleNames}!`, 2500); if (navigator.vibrate) { navigator.vibrate([50, 100, 50]); } }, 400); updateStep1Button(); } function updateStep1Button() { const btn = document.getElementById('step1Btn'); btn.disabled = selectedMuscles.length === 0; } function goToStep2() { if (selectedMuscles.length === 0) { // Shake the button to indicate error const btn = document.getElementById('step1Btn'); btn.classList.add('shake'); setTimeout(() => btn.classList.remove('shake'), 500); showToast('請先選擇至少一個訓練部位!', 2000); return; } // Transition animation document.getElementById('step1').style.opacity = '0'; document.getElementById('step1').style.transform = 'translateX(-50px)'; setTimeout(() => { document.getElementById('step1').classList.add('hidden'); document.getElementById('step2').classList.remove('hidden'); document.getElementById('step2').style.opacity = '0'; document.getElementById('step2').style.transform = 'translateX(50px)'; setTimeout(() => { document.getElementById('step2').style.transition = 'all 0.5s ease'; document.getElementById('step2').style.opacity = '1'; document.getElementById('step2').style.transform = 'translateX(0)'; }, 50); // Update progress bar to 50% const progressBar = document.getElementById('progressBar'); progressBar.style.width = '50%'; document.getElementById('progressPercent').textContent = '50%'; // Update connecting line to 50% document.getElementById('connectingLine').style.width = '50%'; // Update step 1 to completed state (checkmark) document.getElementById('step1Number').classList.add('hidden'); document.getElementById('step1Check').classList.remove('hidden'); document.getElementById('step1Indicator').classList.remove('from-amber-400', 'to-orange-600', 'shadow-orange-500/50'); document.getElementById('step1Indicator').classList.add('bg-gray-700', 'border-gray-600', 'shadow-gray-500/30'); document.getElementById('step1Pulse').classList.add('hidden'); document.getElementById('step1Glow').classList.remove('opacity-0'); document.getElementById('step1Glow').classList.add('opacity-100'); document.getElementById('step1Label').classList.remove('text-amber-400', 'bg-amber-500/10', 'border-amber-500/30'); document.getElementById('step1Label').classList.add('text-gray-400', 'bg-gray-800/30', 'border-gray-600/30'); document.getElementById('step1LabelGlow').classList.remove('opacity-100'); document.getElementById('step1LabelGlow').classList.add('opacity-0'); // Update step 2 to active state const step2Ind = document.getElementById('step2Indicator'); step2Ind.classList.remove('bg-gray-800', 'border-gray-600', 'text-gray-400'); step2Ind.classList.add('bg-gradient-to-br', 'from-amber-400', 'to-orange-600', 'text-black', 'border-amber-500', 'shadow-lg', 'shadow-orange-500/50', 'scale-110'); document.getElementById('step2OuterGlow').classList.remove('opacity-0'); document.getElementById('step2OuterGlow').classList.add('opacity-100', 'animate-pulse-slow'); document.getElementById('step2Pulse').classList.remove('opacity-0'); document.getElementById('step2Pulse').classList.add('opacity-75'); document.getElementById('step2Ring').classList.add('border-amber-500/50', 'shadow-[0_0_15px_rgba(245,158,11,0.4)]'); document.getElementById('step2Loading').classList.remove('hidden'); document.getElementById('step2Number').classList.add('hidden'); // Update step 2 text styling const step2Text = document.getElementById('step2Text'); step2Text.classList.remove('text-gray-500', 'bg-gray-800/50', 'border-gray-700'); step2Text.classList.add('text-amber-400', 'bg-amber-500/10', 'border-amber-500/20', 'font-bold', 'shadow-lg', 'shadow-amber-500/10'); currentStep = 2; showToast('很好!現在選擇你的難度等級 💪', 2000); }, 300); window.scrollTo({ top: 0, behavior: 'smooth' }); } function backToStep1() { document.getElementById('step2').classList.add('hidden'); document.getElementById('step1').classList.remove('hidden'); // Reset progress bar to 25% const progressBar = document.getElementById('progressBar'); progressBar.style.width = '25%'; document.getElementById('progressPercent').textContent = '25%'; // Reset connecting line document.getElementById('connectingLine').style.width = '0%'; // Reset step 1 to active state document.getElementById('step1Number').classList.remove('hidden'); document.getElementById('step1Check').classList.add('hidden'); document.getElementById('step1Indicator').classList.add('from-amber-400', 'to-orange-600', 'shadow-orange-500/50'); document.getElementById('step1Indicator').classList.remove('bg-gray-700', 'border-gray-600', 'shadow-gray-500/30'); document.getElementById('step1Pulse').classList.remove('hidden'); document.getElementById('step1Glow').classList.add('opacity-0'); document.getElementById('step1Glow').classList.remove('opacity-100'); document.getElementById('step1Label').classList.add('text-amber-400', 'bg-amber-500/10', 'border-amber-500/30'); document.getElementById('step1Label').classList.remove('text-gray-400', 'bg-gray-800/30', 'border-gray-600/30'); document.getElementById('step1LabelGlow').classList.add('opacity-100'); document.getElementById('step1LabelGlow').classList.remove('opacity-0'); // Reset step 2 to inactive state const step2Ind = document.getElementById('step2Indicator'); step2Ind.classList.add('bg-gray-800', 'border-gray-600', 'text-gray-400', 'scale-100'); step2Ind.classList.remove('bg-gradient-to-br', 'from-amber-400', 'to-orange-600', 'text-black', 'border-amber-500', 'shadow-lg', 'shadow-orange-500/50', 'scale-110'); document.getElementById('step2OuterGlow').classList.add('opacity-0'); document.getElementById('step2OuterGlow').classList.remove('opacity-100', 'animate-pulse-slow'); document.getElementById('step2Pulse').classList.add('opacity-0'); document.getElementById('step2Pulse').classList.remove('opacity-75'); document.getElementById('step2Ring').classList.remove('border-amber-500/50', 'shadow-[0_0_15px_rgba(245,158,11,0.4)]'); document.getElementById('step2Loading').classList.add('hidden'); document.getElementById('step2Number').classList.remove('hidden'); // Reset step 2 text styling const step2Text = document.getElementById('step2Text'); step2Text.classList.add('text-gray-500', 'bg-gray-800/50', 'border-gray-700'); step2Text.classList.remove('text-amber-400', 'bg-amber-500/10', 'border-amber-500/20', 'font-bold', 'shadow-lg', 'shadow-amber-500/10'); currentStep = 1; window.scrollTo({ top: 0, behavior: 'smooth' }); } // Step 2 -> Step 3 Navigation function goToStep3() { if (!selectedDifficulty) { showToast('請選擇難度等級!', 2000); return; } // Transition animation document.getElementById('step2').style.opacity = '0'; document.getElementById('step2').style.transform = 'translateX(-50px)'; setTimeout(() => { document.getElementById('step2').classList.add('hidden'); document.getElementById('step3').classList.remove('hidden'); document.getElementById('step3').style.opacity = '0'; document.getElementById('step3').style.transform = 'translateX(50px)'; setTimeout(() => { document.getElementById('step3').style.transition = 'all 0.5s ease'; document.getElementById('step3').style.opacity = '1'; document.getElementById('step3').style.transform = 'translateX(0)'; }, 50); // Update progress bar to 75% const progressBar = document.getElementById('progressBar'); progressBar.style.width = '75%'; document.getElementById('progressPercent').textContent = '75%'; // Update connecting line to 75% document.getElementById('connectingLine').style.width = '75%'; // Update step 2 to completed state document.getElementById('step2Loading').classList.add('hidden'); document.getElementById('step2Number').classList.remove('hidden'); document.getElementById('step2Number').textContent = '✓'; document.getElementById('step2Number').classList.add('text-green-400', 'font-bold'); document.getElementById('step2Indicator').classList.remove('scale-110'); document.getElementById('step2Indicator').classList.add('scale-100', 'bg-gray-700', 'border-gray-600'); document.getElementById('step2Indicator').classList.remove('from-amber-400', 'to-orange-600', 'border-amber-500', 'shadow-orange-500/50'); document.getElementById('step2OuterGlow').classList.add('opacity-0'); document.getElementById('step2OuterGlow').classList.remove('opacity-100', 'animate-pulse-slow'); document.getElementById('step2Pulse').classList.add('opacity-0'); document.getElementById('step2Pulse').classList.remove('opacity-75'); document.getElementById('step2Ring').classList.remove('border-amber-500/50', 'shadow-[0_0_15px_rgba(245,158,11,0.4)]'); document.getElementById('step2Text').classList.remove('text-amber-400', 'bg-amber-500/10', 'border-amber-500/20', 'shadow-lg', 'shadow-amber-500/10'); document.getElementById('step2Text').classList.add('text-green-400', 'bg-green-500/10', 'border-green-500/20'); // Update step 3 to active state const step3Ind = document.getElementById('step3Indicator'); step3Ind.classList.remove('bg-gray-800', 'border-gray-600', 'text-gray-400'); step3Ind.classList.add('bg-gradient-to-br', 'from-amber-400', 'to-orange-600', 'text-black', 'border-amber-500', 'shadow-lg', 'shadow-orange-500/50', 'scale-110'); document.getElementById('step3OuterGlow').classList.remove('opacity-0'); document.getElementById('step3OuterGlow').classList.add('opacity-100', 'animate-pulse-slow'); document.getElementById('step3Pulse').classList.remove('opacity-0'); document.getElementById('step3Pulse').classList.add('opacity-75'); document.getElementById('step3Ring').classList.add('border-amber-500/50', 'shadow-[0_0_15px_rgba(245,158,11,0.4)]'); document.getElementById('step3Number').classList.add('hidden'); document.getElementById('step3Icon').classList.remove('hidden'); // Update step 3 text styling const step3Text = document.getElementById('step3Text'); step3Text.classList.remove('text-gray-500', 'bg-gray-800/50', 'border-gray-700'); step3Text.classList.add('text-amber-400', 'bg-amber-500/10', 'border-amber-500/20', 'font-bold', 'shadow-lg', 'shadow-amber-500/10'); currentStep = 3; showToast('請輸入您的個人資料(選填)', 2000); }, 300); window.scrollTo({ top: 0, behavior: 'smooth' }); } function backToStep2() { document.getElementById('step3').classList.add('hidden'); document.getElementById('step2').classList.remove('hidden'); // Reset progress bar to 50% const progressBar = document.getElementById('progressBar'); progressBar.style.width = '50%'; document.getElementById('progressPercent').textContent = '50%'; // Reset connecting line to 50% document.getElementById('connectingLine').style.width = '50%'; // Reset step 2 to active state (undo completed state) document.getElementById('step2Number').textContent = '2'; document.getElementById('step2Number').classList.remove('text-green-400', 'font-bold'); document.getElementById('step2Indicator').classList.remove('bg-gray-700', 'border-gray-600', 'scale-100'); document.getElementById('step2Indicator').classList.add('bg-gradient-to-br', 'from-amber-400', 'to-orange-600', 'border-amber-500', 'shadow-lg', 'shadow-orange-500/50', 'scale-110', 'text-black'); document.getElementById('step2OuterGlow').classList.remove('opacity-0'); document.getElementById('step2OuterGlow').classList.add('opacity-100', 'animate-pulse-slow'); document.getElementById('step2Pulse').classList.remove('opacity-0'); document.getElementById('step2Pulse').classList.add('opacity-75'); document.getElementById('step2Ring').classList.add('border-amber-500/50', 'shadow-[0_0_15px_rgba(245,158,11,0.4)]'); document.getElementById('step2Text').classList.remove('text-green-400', 'bg-green-500/10', 'border-green-500/20'); document.getElementById('step2Text').classList.add('text-amber-400', 'bg-amber-500/10', 'border-amber-500/20', 'font-bold', 'shadow-lg', 'shadow-amber-500/10'); document.getElementById('step2Loading').classList.remove('hidden'); document.getElementById('step2Number').classList.add('hidden'); // Reset step 3 to inactive state const step3Ind = document.getElementById('step3Indicator'); step3Ind.classList.add('bg-gray-800', 'border-gray-600', 'text-gray-400', 'scale-100'); step3Ind.classList.remove('bg-gradient-to-br', 'from-amber-400', 'to-orange-600', 'text-black', 'border-amber-500', 'shadow-lg', 'shadow-orange-500/50', 'scale-110'); document.getElementById('step3OuterGlow').classList.add('opacity-0'); document.getElementById('step3OuterGlow').classList.remove('opacity-100', 'animate-pulse-slow'); document.getElementById('step3Pulse').classList.add('opacity-0'); document.getElementById('step3Pulse').classList.remove('opacity-75'); document.getElementById('step3Ring').classList.remove('border-amber-500/50', 'shadow-[0_0_15px_rgba(245,158,11,0.4)]'); document.getElementById('step3Text').classList.add('text-gray-500', 'bg-gray-800/50', 'border-gray-700'); document.getElementById('step3Text').classList.remove('text-amber-400', 'bg-amber-500/10', 'border-amber-500/20', 'font-bold', 'shadow-lg', 'shadow-amber-500/10'); currentStep = 2; window.scrollTo({ top: 0, behavior: 'smooth' }); } // Step 2: Difficulty Selection function selectDifficulty(element) { document.querySelectorAll('.difficulty-card').forEach(card => { card.classList.remove('selected'); }); element.classList.add('selected'); selectedDifficulty = element.dataset.difficulty; document.getElementById('step2Btn').disabled = false; } function generateWorkout() { if (!selectedDifficulty) { showToast('請選擇難度等級!', 2000); return; } // Show loading state const btn = document.getElementById('step3Btn'); const originalContent = btn.innerHTML; btn.innerHTML = '
生成中...'; btn.disabled = true; // Simulate AI processing time for drama setTimeout(() => { // Fire confetti fireConfetti(); // Generate exercises const exercises = generateExercises(); // Render exercises renderExercises(exercises); // Update nutrition calculations based on weight updateNutritionDisplay(); // Update summary with typing effect const muscleNames = { chest: '胸部', back: '背部', shoulders: '肩部', core: '核心', legs: '腿部', glutes: '臀部', arms: '手臂', fullbody: '全身' }; const difficultyNames = { easy: '簡單', normal: '普通', hard: '困難' }; const muscleText = selectedMuscles.map(m => muscleNames[m]).join('、'); const summaryText = `針對${muscleText}的${difficultyNames[selectedDifficulty]}強度訓練,共 ${exercises.length} 個動作`; // Transition document.getElementById('step3').style.opacity = '0'; document.getElementById('step3').style.transform = 'scale(0.9)'; setTimeout(() => { document.getElementById('step3').classList.add('hidden'); document.getElementById('step4').classList.remove('hidden'); document.getElementById('step4').style.opacity = '0'; // Update progress bar to 100% with glow effect const progressBar = document.getElementById('progressBar'); progressBar.style.width = '100%'; document.getElementById('progressPercent').textContent = '100%'; // Update connecting line to full document.getElementById('connectingLine').style.width = '100%'; // Update step 3 to completed state document.getElementById('step3Icon').classList.add('hidden'); document.getElementById('step3Number').classList.remove('hidden'); document.getElementById('step3Number').textContent = '✓'; document.getElementById('step3Number').classList.add('text-green-400', 'font-bold'); document.getElementById('step3Indicator').classList.remove('scale-110'); document.getElementById('step3Indicator').classList.add('scale-100', 'bg-gray-700', 'border-gray-600'); document.getElementById('step3Indicator').classList.remove('from-amber-400', 'to-orange-600', 'border-amber-500', 'shadow-orange-500/50'); document.getElementById('step3OuterGlow').classList.add('opacity-0'); document.getElementById('step3OuterGlow').classList.remove('opacity-100', 'animate-pulse-slow'); document.getElementById('step3Pulse').classList.add('opacity-0'); document.getElementById('step3Pulse').classList.remove('opacity-75'); document.getElementById('step3Ring').classList.remove('border-amber-500/50', 'shadow-[0_0_15px_rgba(245,158,11,0.4)]'); document.getElementById('step3Text').classList.remove('text-amber-400', 'bg-amber-500/10', 'border-amber-500/20', 'font-bold', 'shadow-lg', 'shadow-amber-500/10', 'animate-pulse'); document.getElementById('step3Text').classList.add('text-green-400', 'bg-green-500/10', 'border-green-500/20'); // Update step 4 to active/completed state with celebration styling const step4Ind = document.getElementById('step4Indicator'); step4Ind.classList.remove('bg-gray-800', 'border-gray-600', 'text-gray-400'); step4Ind.classList.add('bg-gradient-to-br', 'from-amber-400', 'to-orange-600', 'text-black', 'border-amber-500', 'shadow-lg', 'shadow-orange-500/50', 'scale-110', 'bounce-in'); document.getElementById('step4OuterGlow').classList.remove('opacity-0'); document.getElementById('step4OuterGlow').classList.add('opacity-100', 'animate-pulse-slow'); document.getElementById('step4Pulse').classList.remove('opacity-0'); document.getElementById('step4Pulse').classList.add('opacity-75'); document.getElementById('step4Ring').classList.add('border-amber-500/50', 'shadow-[0_0_15px_rgba(245,158,11,0.4)]'); document.getElementById('step4Number').classList.add('hidden'); document.getElementById('step4Icon').classList.remove('hidden'); // Update step 4 text styling const step4Text = document.getElementById('step4Text'); step4Text.classList.remove('text-gray-500', 'bg-gray-800/50', 'border-gray-700'); step4Text.classList.add('text-amber-400', 'bg-amber-500/10', 'border-amber-500/20', 'font-bold', 'shadow-lg', 'shadow-amber-500/10', 'animate-pulse'); // Type out summary const summaryElement = document.getElementById('workoutSummary'); summaryElement.textContent = ''; let i = 0; const typeInterval = setInterval(() => { if (i < summaryText.length) { summaryElement.textContent += summaryText.charAt(i); i++; } else { clearInterval(typeInterval); } }, 30); setTimeout(() => { document.getElementById('step4').style.transition = 'all 0.5s ease'; document.getElementById('step4').style.opacity = '1'; }, 100); currentStep = 4; // Show success toast setTimeout(() => { showToast('🎉 訓練計畫生成完成!加油!', 3000); }, 500); // Re-init icons for new content lucide.createIcons(); }, 300); // Reset button btn.innerHTML = originalContent; btn.disabled = false; }, 1500); window.scrollTo({ top: 0, behavior: 'smooth' }); } function generateExercises() { let allExercises = []; selectedMuscles.forEach(muscle => { if (exerciseDB[muscle] && exerciseDB[muscle][selectedDifficulty]) { // Get exercises for this muscle and add muscle info to each const muscleExercises = exerciseDB[muscle][selectedDifficulty].map(ex => ({ ...ex, muscle: muscle })); allExercises = allExercises.concat(muscleExercises); } }); // Shuffle and pick 3-5 exercises const shuffled = allExercises.sort(() => 0.5 - Math.random()); const count = Math.floor(Math.random() * 3) + 3; // 3 to 5 const selected = shuffled.slice(0, Math.min(count, shuffled.length)); // Add sets/reps details to each exercise return selected.map(exercise => { const details = getExerciseDetails(exercise.muscle, selectedDifficulty); return { ...exercise, sets: details.displaySets, reps: details.displayReps, rawSets: details.sets, rawReps: details.reps, isTimeBased: details.isTimeBased }; }); } function renderExercises(exercises) { const container = document.getElementById('exerciseContainer'); container.innerHTML = ''; const muscleNames = { chest: '胸部', back: '背部', shoulders: '肩部', core: '核心', legs: '腿部', glutes: '臀部', arms: '手臂', fullbody: '全身' }; exercises.forEach((exercise, index) => { const muscle = exercise.muscle || selectedMuscles[0]; const card = document.createElement('div'); card.className = 'exercise-card glass rounded-3xl p-6 md:p-8 hover:shadow-2xl hover:shadow-gold-500/10 transition-all duration-300'; card.style.animationDelay = `${index * 0.15}s`; // Add hover tilt effect card.addEventListener('mousemove', (e) => { const rect = card.getBoundingClientRect(); const x = e.clientX - rect.left; const y = e.clientY - rect.top; const centerX = rect.width / 2; const centerY = rect.height / 2; const rotateX = (y - centerY) / 20; const rotateY = (centerX - x) / 20; card.style.transform = `perspective(1000px) rotateX(${rotateX}deg) rotateY(${rotateY}deg) translateY(-5px)`; }); card.addEventListener('mouseleave', () => { card.style.transform = 'perspective(1000px) rotateX(0) rotateY(0) translateY(0)'; }); // Build detailed info sections if available let detailsSection = ''; if (exercise.description || exercise.precautions || exercise.targetMuscles || exercise.keyPoints) { detailsSection = `${englishName}