File size: 264,584 Bytes
14422b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
14422b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
 
 
 
 
 
 
 
14422b0
 
 
6d6a6aa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6d6a6aa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18550fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6d6a6aa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18550fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6d6a6aa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
6d6a6aa
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14422b0
6b48067
 
 
 
 
 
14422b0
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
14422b0
 
6b48067
 
 
 
14422b0
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14422b0
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
14422b0
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14422b0
6b48067
 
 
 
 
14422b0
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
14422b0
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18550fb
6b48067
18550fb
6b48067
 
18550fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18550fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18550fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
18550fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18550fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
 
 
 
18550fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
18550fb
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18550fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
 
 
 
 
6b48067
ccd63d1
 
 
6b48067
ccd63d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b48067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14422b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
 
14422b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
 
14422b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
 
14422b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
 
14422b0
ccd63d1
14422b0
ccd63d1
14422b0
ccd63d1
 
14422b0
ccd63d1
 
 
 
 
 
 
14422b0
 
 
 
 
ccd63d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14422b0
 
 
 
 
 
 
 
 
 
 
 
ccd63d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14422b0
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Complete Deep Learning & Computer Vision Curriculum</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        :root {
            --bg: #0f1419;
            --surface: #1a1f2e;
            --text: #e4e6eb;
            --text-dim: #b0b7c3;
            --cyan: #00d4ff;
            --orange: #ff6b35;
            --green: #00ff88;
            --yellow: #ffa500;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: var(--bg);
            color: var(--text);
            line-height: 1.6;
            overflow-x: hidden;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 20px;
        }

        header {
            text-align: center;
            margin-bottom: 40px;
            padding: 30px 0;
            border-bottom: 2px solid var(--cyan);
        }

        h1 {
            font-size: 2.5em;
            background: linear-gradient(135deg, var(--cyan), var(--orange));
            background-clip: text;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            margin-bottom: 10px;
        }

        .subtitle {
            color: var(--text-dim);
            font-size: 1.1em;
        }

        .dashboard {
            display: none;
        }

        .dashboard.active {
            display: block;
        }

        .grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 25px;
            margin: 40px 0;
        }

        .card {
            background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(255, 107, 53, 0.1));
            border: 2px solid var(--cyan);
            border-radius: 12px;
            padding: 30px;
            cursor: pointer;
            transition: all 0.3s ease;
            text-align: center;
        }

        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 30px rgba(0, 212, 255, 0.2);
            border-color: var(--orange);
        }

        .card-icon {
            font-size: 3em;
            margin-bottom: 15px;
        }

        .card h3 {
            color: var(--cyan);
            font-size: 1.5em;
            margin-bottom: 10px;
        }

        .card p {
            color: var(--text-dim);
            font-size: 0.95em;
        }

        .category-label {
            display: inline-block;
            margin-top: 10px;
            padding: 5px 12px;
            background: rgba(0, 212, 255, 0.2);
            border-radius: 20px;
            font-size: 0.85em;
            color: var(--green);
        }

        .module {
            display: none;
        }

        .module.active {
            display: block;
            animation: fadeIn 0.3s ease;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
            }

            to {
                opacity: 1;
            }
        }

        .btn-back {
            padding: 10px 20px;
            background: var(--orange);
            color: var(--bg);
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-weight: 600;
            margin-bottom: 25px;
            transition: all 0.3s ease;
        }

        .btn-back:hover {
            background: var(--cyan);
        }

        .tabs {
            display: flex;
            gap: 10px;
            margin-bottom: 30px;
            flex-wrap: wrap;
            justify-content: center;
            border-bottom: 1px solid rgba(0, 212, 255, 0.2);
            padding-bottom: 15px;
            overflow-x: auto;
        }

        .tab-btn {
            padding: 10px 20px;
            background: var(--surface);
            color: var(--text);
            border: 2px solid transparent;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.95em;
            transition: all 0.3s ease;
            font-weight: 500;
            white-space: nowrap;
        }

        .tab-btn:hover {
            background: rgba(0, 212, 255, 0.1);
            border-color: var(--cyan);
        }

        .tab-btn.active {
            background: var(--cyan);
            color: var(--bg);
            border-color: var(--cyan);
        }

        .tab {
            display: none;
        }

        .tab.active {
            display: block;
            animation: fadeIn 0.3s ease;
        }

        .section {
            background: var(--surface);
            border: 1px solid rgba(0, 212, 255, 0.2);
            border-radius: 10px;
            padding: 30px;
            margin-bottom: 25px;
            transition: all 0.3s ease;
        }

        .section:hover {
            border-color: var(--cyan);
            box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
        }

        h2 {
            color: var(--cyan);
            font-size: 1.8em;
            margin-bottom: 15px;
        }

        h3 {
            color: var(--orange);
            font-size: 1.3em;
            margin-top: 20px;
            margin-bottom: 12px;
        }

        h4 {
            color: var(--green);
            font-size: 1.1em;
            margin-top: 15px;
            margin-bottom: 10px;
        }

        p {
            margin-bottom: 15px;
            line-height: 1.8;
        }

        ul {
            margin-left: 20px;
            margin-bottom: 15px;
        }

        ul li {
            margin-bottom: 8px;
        }

        .info-box {
            background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(255, 107, 53, 0.1));
            border: 1px solid var(--cyan);
            border-radius: 8px;
            padding: 20px;
            margin: 20px 0;
        }

        .box-title {
            color: var(--orange);
            font-weight: 700;
            margin-bottom: 10px;
            font-size: 1.1em;
        }

        .box-content {
            color: var(--text-dim);
            line-height: 1.7;
        }

        .formula {
            background: rgba(0, 212, 255, 0.1);
            border: 1px solid var(--cyan);
            border-radius: 8px;
            padding: 20px;
            margin: 20px 0;
            font-family: 'Courier New', monospace;
            overflow-x: auto;
            line-height: 1.8;
            color: var(--cyan);
        }

        .callout {
            border-left: 4px solid;
            padding: 15px;
            margin: 20px 0;
            border-radius: 6px;
        }

        .callout.tip {
            border-left-color: var(--green);
            background: rgba(0, 255, 136, 0.05);
        }

        .callout.warning {
            border-left-color: var(--yellow);
            background: rgba(255, 165, 0, 0.05);
        }

        .callout.insight {
            border-left-color: var(--cyan);
            background: rgba(0, 212, 255, 0.05);
        }

        .callout-title {
            font-weight: 700;
            margin-bottom: 8px;
        }

        .list-item {
            display: flex;
            gap: 12px;
            margin: 12px 0;
            padding: 12px;
            background: rgba(0, 212, 255, 0.05);
            border-left: 3px solid var(--cyan);
            border-radius: 4px;
        }

        .list-num {
            color: var(--orange);
            font-weight: 700;
            min-width: 30px;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin: 20px 0;
        }

        th,
        td {
            padding: 12px;
            text-align: left;
            border: 1px solid rgba(0, 212, 255, 0.2);
        }

        th {
            background: rgba(0, 212, 255, 0.1);
            color: var(--cyan);
            font-weight: 700;
        }

        .viz-container {
            background: rgba(0, 212, 255, 0.02);
            border: 1px solid rgba(0, 212, 255, 0.2);
            border-radius: 8px;
            padding: 20px;
            margin: 20px 0;
            display: flex;
            justify-content: center;
            overflow-x: auto;
        }

        .viz-controls {
            display: flex;
            gap: 10px;
            margin-top: 20px;
            justify-content: center;
            flex-wrap: wrap;
        }

        .btn-viz {
            padding: 10px 20px;
            background: var(--cyan);
            color: var(--bg);
            border: none;
            border-radius: 6px;
            font-weight: 600;
            cursor: pointer;
            font-size: 0.95em;
            transition: all 0.3s ease;
        }

        .btn-viz:hover {
            background: var(--orange);
            transform: scale(1.05);
        }

        canvas {
            max-width: 100%;
            height: auto;
        }

        @media (max-width: 768px) {
            h1 {
                font-size: 1.8em;
            }

            .tabs {
                flex-direction: column;
            }

            .tab-btn {
                width: 100%;
            }

            .grid {
                grid-template-columns: 1fr;
            }

            canvas {
                width: 100% !important;
                height: auto !important;
            }
        }
    </style>
</head>

<body>
    <div class="container">
        <!-- MAIN DASHBOARD -->
        <div id="dashboard" class="dashboard active">
            <header>
                <h1>🧠 Complete Deep Learning & Computer Vision</h1>
                <p class="subtitle">Comprehensive Curriculum | Foundations to Advanced Applications</p>
            </header>

            <div style="text-align: center; margin-bottom: 40px;">
                <p style="color: var(--text-dim); font-size: 1.1em;">
                    Master all aspects of deep learning and computer vision. 25+ modules covering neural networks, CNNs,
                    object detection, GANs, and more.
                </p>
            </div>

            <div class="grid" id="modulesGrid"></div>
        </div>

        <!-- MODULES CONTAINER -->
        <div id="modulesContainer"></div>
    </div>

    <script>
        const modules = [
            // Module 1: Deep Learning Foundations
            {
                id: "nn-basics",
                title: "Introduction to Neural Networks",
                icon: "🧬",
                category: "Foundations",
                color: "#0088ff",
                description: "Biological vs. Artificial neurons and network architecture"
            },
            {
                id: "perceptron",
                title: "The Perceptron",
                icon: "⚙️",
                category: "Foundations",
                color: "#0088ff",
                description: "Single layer networks and their limitations"
            },
            {
                id: "mlp",
                title: "Multi-Layer Perceptron (MLP)",
                icon: "🏗️",
                category: "Foundations",
                color: "#0088ff",
                description: "Hidden layers and deep architectures"
            },
            {
                id: "activation",
                title: "Activation Functions",
                icon: "⚡",
                category: "Foundations",
                color: "#0088ff",
                description: "Sigmoid, ReLU, Tanh, Leaky ReLU, ELU, Softmax"
            },
            {
                id: "weight-init",
                title: "Weight Initialization",
                icon: "🎯",
                category: "Foundations",
                color: "#0088ff",
                description: "Xavier, He, Random initialization strategies"
            },
            {
                id: "loss",
                title: "Loss Functions",
                icon: "📉",
                category: "Foundations",
                color: "#0088ff",
                description: "MSE, Binary Cross-Entropy, Categorical Cross-Entropy"
            },
            {
                id: "optimizers",
                title: "Optimizers",
                icon: "🎯",
                category: "Training",
                color: "#00ff00",
                description: "SGD, Momentum, Adam, Adagrad, RMSprop"
            },
            {
                id: "backprop",
                title: "Forward & Backpropagation",
                icon: "⬅️",
                category: "Training",
                color: "#00ff00",
                description: "Chain rule and gradient computation"
            },
            {
                id: "regularization",
                title: "Regularization",
                icon: "🛡️",
                category: "Training",
                color: "#00ff00",
                description: "L1/L2, Dropout, Early Stopping, Batch Norm"
            },
            {
                id: "batch-norm",
                title: "Batch Normalization",
                icon: "⚙️",
                category: "Training",
                color: "#00ff00",
                description: "Stabilizing and speeding up training"
            },
            // Module 2: Computer Vision Fundamentals
            {
                id: "cv-intro",
                title: "CV Fundamentals",
                icon: "👁️",
                category: "Computer Vision",
                color: "#ff6b35",
                description: "Why ANNs fail with images, parameter explosion"
            },
            {
                id: "conv-layer",
                title: "Convolutional Layers",
                icon: "🖼️",
                category: "Computer Vision",
                color: "#ff6b35",
                description: "Kernels, filters, feature maps, stride, padding"
            },
            {
                id: "pooling",
                title: "Pooling Layers",
                icon: "📦",
                category: "Computer Vision",
                color: "#ff6b35",
                description: "Max pooling, average pooling, spatial reduction"
            },
            {
                id: "cnn-basics",
                title: "CNN Architecture",
                icon: "🏗️",
                category: "Computer Vision",
                color: "#ff6b35",
                description: "Combining conv, pooling, and fully connected layers"
            },
            {
                id: "viz-filters",
                title: "Visualizing CNNs",
                icon: "🔍",
                category: "Computer Vision",
                color: "#ff6b35",
                description: "What filters learn: edges → shapes → objects"
            },
            // Module 3: Advanced CNN Architectures
            {
                id: "lenet",
                title: "LeNet-5",
                icon: "🔢",
                category: "CNN Architectures",
                color: "#ff00ff",
                description: "Classic digit recognizer (MNIST)"
            },
            {
                id: "alexnet",
                title: "AlexNet",
                icon: "🌟",
                category: "CNN Architectures",
                color: "#ff00ff",
                description: "The breakthrough in deep computer vision (2012)"
            },
            {
                id: "vgg",
                title: "VGGNet",
                icon: "📊",
                category: "CNN Architectures",
                color: "#ff00ff",
                description: "VGG-16/19: Deep networks with small filters"
            },
            {
                id: "resnet",
                title: "ResNet",
                icon: "🌉",
                category: "CNN Architectures",
                color: "#ff00ff",
                description: "Skip connections, solving vanishing gradients"
            },
            {
                id: "inception",
                title: "InceptionNet (GoogLeNet)",
                icon: "🎯",
                category: "CNN Architectures",
                color: "#ff00ff",
                description: "1x1 convolutions, multi-scale feature extraction"
            },
            {
                id: "mobilenet",
                title: "MobileNet",
                icon: "📱",
                category: "CNN Architectures",
                color: "#ff00ff",
                description: "Depth-wise separable convolutions for efficiency"
            },
            {
                id: "transfer-learning",
                title: "Transfer Learning",
                icon: "🔄",
                category: "CNN Architectures",
                color: "#ff00ff",
                description: "Fine-tuning and leveraging pre-trained models"
            },
            // Module 4: Object Detection & Segmentation
            {
                id: "localization",
                title: "Object Localization",
                icon: "📍",
                category: "Detection",
                color: "#00ff00",
                description: "Bounding boxes and classification together"
            },
            {
                id: "rcnn",
                title: "R-CNN Family",
                icon: "🎯",
                category: "Detection",
                color: "#00ff00",
                description: "R-CNN, Fast R-CNN, Faster R-CNN"
            },
            {
                id: "yolo",
                title: "YOLO",
                icon: "⚡",
                category: "Detection",
                color: "#00ff00",
                description: "Real-time object detection (v3, v5, v8)"
            },
            {
                id: "ssd",
                title: "SSD",
                icon: "🚀",
                category: "Detection",
                color: "#00ff00",
                description: "Single Shot MultiBox Detector"
            },
            {
                id: "semantic-seg",
                title: "Semantic Segmentation",
                icon: "🖌️",
                category: "Segmentation",
                color: "#00ff00",
                description: "Pixel-level classification (U-Net)"
            },
            {
                id: "instance-seg",
                title: "Instance Segmentation",
                icon: "👥",
                category: "Segmentation",
                color: "#00ff00",
                description: "Mask R-CNN and separate object instances"
            },
            {
                id: "face-recog",
                title: "Face Recognition",
                icon: "👤",
                category: "Segmentation",
                color: "#00ff00",
                description: "Siamese networks and triplet loss"
            },
            // Module 5: Generative Models
            {
                id: "autoencoders",
                title: "Autoencoders",
                icon: "🔀",
                category: "Generative",
                color: "#ffaa00",
                description: "Encoder-decoder, latent space, denoising"
            },
            {
                id: "gans",
                title: "GANs (Generative Adversarial Networks)",
                icon: "🎮",
                category: "Generative",
                color: "#ffaa00",
                description: "Generator vs. Discriminator, DCGAN"
            },
            {
                id: "diffusion",
                title: "Diffusion Models",
                icon: "🌊",
                category: "Generative",
                color: "#ffaa00",
                description: "Foundation of Stable Diffusion and DALL-E"
            },
            // Additional Advanced Topics
            {
                id: "rnn",
                title: "RNNs & LSTMs",
                icon: "🔄",
                category: "Sequence",
                color: "#ff6b35",
                description: "Recurrent networks for sequential data"
            },
            {
                id: "transformers",
                title: "Transformers",
                icon: "🔗",
                category: "Sequence",
                color: "#ff6b35",
                description: "Attention mechanisms and modern architectures"
            },
            {
                id: "bert",
                title: "BERT & NLP Transformers",
                icon: "📚",
                category: "NLP",
                color: "#ff6b35",
                description: "Bidirectional transformers for language"
            },
            {
                id: "gpt",
                title: "GPT & Language Models",
                icon: "💬",
                category: "NLP",
                color: "#ff6b35",
                description: "Autoregressive models and text generation"
            },
            {
                id: "vit",
                title: "Vision Transformers (ViT)",
                icon: "🎨",
                category: "Vision",
                color: "#ff6b35",
                description: "Transformers applied to image data"
            },
            {
                id: "gnn",
                title: "Graph Neural Networks",
                icon: "🕸️",
                category: "Advanced",
                color: "#9900ff",
                description: "Deep learning on non-Euclidean graph data"
            }
        ];

        // Comprehensive content for all modules
        const MODULE_CONTENT = {
            "nn-basics": {
                overview: `
                    <h3>What are Neural Networks?</h3>
                    <p>Neural Networks are computational models inspired by the human brain's structure. They consist of interconnected nodes (neurons) organized in layers that process information through weighted connections.</p>
                    
                    <h3>Why Use Neural Networks?</h3>
                    <ul>
                        <li><strong>Universal Approximation:</strong> Can theoretically approximate any continuous function</li>
                        <li><strong>Feature Learning:</strong> Automatically discover representations from raw data</li>
                        <li><strong>Adaptability:</strong> Learn from examples without explicit programming</li>
                        <li><strong>Parallel Processing:</strong> Highly parallelizable for modern hardware</li>
                    </ul>
                    
                    <div class="callout tip">
                        <div class="callout-title">✅ Advantages</div>
                        • Non-linear problem solving<br>
                        • Robust to noisy data<br>
                        • Works with incomplete information<br>
                        • Continuous learning capability
                    </div>
                    
                    <div class="callout warning">
                        <div class="callout-title">⚠️ Disadvantages</div>
                        • Requires large amounts of training data<br>
                        • Computationally expensive<br>
                        • "Black box" - difficult to interpret<br>
                        • Prone to overfitting without regularization
                    </div>
                `,
                concepts: `
                    <h3>Core Components</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Neurons (Nodes):</strong> Basic computational units that receive inputs, apply weights, add bias, and apply activation function</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Layers:</strong> Input layer (receives data), Hidden layers (feature extraction), Output layer (predictions)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Weights:</strong> Parameters learned during training that determine connection strength</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">04</div>
                        <div><strong>Bias:</strong> Allows shifting the activation function for better fitting</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">05</div>
                        <div><strong>Activation Function:</strong> Introduces non-linearity (ReLU, Sigmoid, Tanh)</div>
                    </div>
                `,
                applications: `
                    <h3>Real-World Applications</h3>
                    <div class="info-box">
                        <div class="box-title">🏥 Healthcare</div>
                        <div class="box-content">Disease diagnosis, medical image analysis, drug discovery, patient risk prediction</div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">💰 Finance</div>
                        <div class="box-content">Fraud detection, algorithmic trading, credit scoring, portfolio optimization</div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🛒 E-commerce</div>
                        <div class="box-content">Recommendation systems, demand forecasting, customer segmentation, price optimization</div>
                    </div>
                `
            },
            "activation": {
                overview: `
                    <h3>What are Activation Functions?</h3>
                    <p>Activation functions introduce non-linearity into neural networks, enabling them to learn complex patterns. Without activation functions, a neural network would be just a linear regression model regardless of depth.</p>
                    
                    <h3>Why Do We Need Them?</h3>
                    <ul>
                        <li><strong>Non-linearity:</strong> Real-world problems are rarely linear</li>
                        <li><strong>Complex Pattern Learning:</strong> Enable learning of intricate decision boundaries</li>
                        <li><strong>Gradient Flow:</strong> Control how gradients propagate during backpropagation</li>
                        <li><strong>Range Normalization:</strong> Keep activations in manageable ranges</li>
                    </ul>
                    
                    <h3>Common Activation Functions Comparison</h3>
                    <table>
                        <tr>
                            <th>Function</th>
                            <th>Range</th>
                            <th>Best Use</th>
                            <th>Issue</th>
                        </tr>
                        <tr>
                            <td>ReLU</td>
                            <td>[0, ∞)</td>
                            <td>Hidden layers (default)</td>
                            <td>Dying ReLU problem</td>
                        </tr>
                        <tr>
                            <td>Sigmoid</td>
                            <td>(0, 1)</td>
                            <td>Binary classification output</td>
                            <td>Vanishing gradients</td>
                        </tr>
                        <tr>
                            <td>Tanh</td>
                            <td>(-1, 1)</td>
                            <td>RNNs, zero-centered</td>
                            <td>Vanishing gradients</td>
                        </tr>
                        <tr>
                            <td>Leaky ReLU</td>
                            <td>(-∞, ∞)</td>
                            <td>Fixes dying ReLU</td>
                            <td>Extra hyperparameter</td>
                        </tr>
                        <tr>
                            <td>Softmax</td>
                            <td>(0, 1) sum=1</td>
                            <td>Multi-class output</td>
                            <td>Computationally expensive</td>
                        </tr>
                    </table>
                `,
                concepts: `
                    <h3>Key Properties</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Differentiability:</strong> Must have derivatives for backpropagation to work</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Monotonicity:</strong> Preferably monotonic for easier optimization</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Zero-Centered:</strong> Helps with faster convergence (Tanh)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">04</div>
                        <div><strong>Computational Efficiency:</strong> Should be fast to compute (ReLU wins)</div>
                    </div>
                    
                    <div class="callout tip">
                        <div class="callout-title">💡 Best Practices</div>
                        • Use <strong>ReLU</strong> for hidden layers by default<br>
                        • Use <strong>Sigmoid</strong> for binary classification output<br>
                        • Use <strong>Softmax</strong> for multi-class classification<br>
                        • Try <strong>Leaky ReLU</strong> or <strong>ELU</strong> if ReLU neurons are dying<br>
                        • Avoid Sigmoid/Tanh in deep networks (gradient vanishing)
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🧠 Neural Network Design</div>
                        <div class="box-content">
                            Critical choice for every neural network - affects training speed, convergence, and final accuracy
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🎯 Task-Specific Selection</div>
                        <div class="box-content">
                            Different tasks need different outputs: Sigmoid for binary, Softmax for multi-class, Linear for regression
                        </div>
                    </div>
                `,
                math: `
                    <h3>Derivatives: The Backprop Fuel</h3>
                    <p>Activation functions must be differentiable for backpropagation to work. Let's look at the derivatives on paper:</p>
                    
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Sigmoid:</strong> σ(z) = 1 / (1 + e⁻ᶻ)<br>
                        <strong>Derivative:</strong> σ'(z) = σ(z)(1 - σ(z))<br>
                        <span class="formula-caption">Max gradient is 0.25 (at z=0). This is why deep networks vanish!</span></div>
                    </div>

                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Tanh:</strong> tanh(z) = (eᶻ - e⁻ᶻ) / (eᶻ + e⁻ᶻ)<br>
                        <strong>Derivative:</strong> tanh'(z) = 1 - tanh²(z)<br>
                        <span class="formula-caption">Max gradient is 1.0 (at z=0). Better than Sigmoid, but still vanishes.</span></div>
                    </div>

                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>ReLU:</strong> max(0, z)<br>
                        <strong>Derivative:</strong> 1 if z > 0, else 0<br>
                        <span class="formula-caption">Gradient is 1.0 for all positive z. No vanishing! But 0 for negative (Dying ReLU).</span></div>
                    </div>

                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: The Chain Effect</div>
                        Each layer multiplies the gradient by σ'(z). <br>
                        For 10 Sigmoid layers: Total gradient ≈ (0.25)¹⁰ ≈ <strong>0.00000095</strong><br>
                        This is the mathematical proof of the Vanishing Gradient Problem!
                    </div>
                `
            },
            "conv-layer": {
                overview: `
                    <h3>What are Convolutional Layers?</h3>
                    <p>Convolutional layers are the fundamental building blocks of CNNs. They apply learnable filters (kernels) across input data to detect local patterns like edges, textures, and shapes.</p>
                    
                    <h3>Why Use Convolutions Instead of Fully Connected Layers?</h3>
                    <ul>
                        <li><strong>Parameter Efficiency:</strong> Share weights across spatial locations (fewer parameters)</li>
                        <li><strong>Translation Invariance:</strong> Detect features regardless of position</li>
                        <li><strong>Local Connectivity:</strong> Each neuron sees

 only a small region (receptive field)</li>
                        <li><strong>Hierarchical Learning:</strong> Build complex features from simple ones</li>
                    </ul>
                    
                    <div class="callout insight">
                        <div class="callout-title">🔍 Example: Parameter Comparison</div>
                        For a 224×224 RGB image:<br>
<strong>Fully Connected:</strong> 224 × 224 × 3 × 1000 = 150M parameters (for 1000 neurons)<br>
<strong>Convolutional (3×3):</strong> 3 × 3 × 3 × 64 = 1,728 parameters (for 64 filters)<br>
                        <strong>Result:</strong> 87,000x fewer parameters! 🚀
                    </div>
                    
                    <div class="callout tip">
                        <div class="callout-title">✅ Advantages</div>
                        • Drastically reduced parameters<br>
                        • Spatial hierarchy (edges → textures → parts → objects)<br>
                        • GPU-friendly (highly parallelizable)<br>
                        • Built-in translation equivariance
                    </div>
                    
                    <div class="callout warning">
                        <div class="callout-title">⚠️ Disadvantages</div>
                        • Not rotation invariant (require data augmentation)<br>
                        • Fixed receptive field size<br>
                        • Memory intensive during training<br>
                        • Require careful hyperparameter tuning (kernel size, stride, padding)
                    </div>
                `,
                concepts: `
                    <h3>Key Hyperparameters</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Kernel/Filter Size:</strong> Typically 3×3 or 5×5. Smaller = more layers needed, larger = more parameters</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Stride:</strong> Step size when sliding filter. Stride=1 (preserves size), Stride=2 (downsamples by 2×)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Padding:</strong> Add zeros around borders. 'SAME' keeps size, 'VALID' shrinks output</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">04</div>
                        <div><strong>Number of Filters:</strong> Each filter learns different features. More filters = more capacity but slower</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">05</div>
                        <div><strong>Dilation:</strong> Spacing between kernel elements. Increases receptive field without adding parameters</div>
                    </div>

                    <div class="formula">
                        Output Size Formula:<br>
                        W_out = floor((W_in + 2×padding - kernel_size) / stride) + 1<br>
                        H_out = floor((H_in + 2×padding - kernel_size) / stride) + 1
                    </div>
                `,
                math: `
                    <h3>The Mathematical Operation: Cross-Correlation</h3>
                    <p>In deep learning, what we call "convolution" is mathematically "cross-correlation". It is a local dot product of the kernel and image patch.</p>
                    
                    <div class="formula">
                        S(i, j) = (I * K)(i, j) = Σ_m Σ_n I(i+m, j+n) K(m, n)
                    </div>

                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: Manual Convolution</div>
                        **Input (3x3):**<br>
                        [1 2 0]<br>
                        [0 1 1]<br>
                        [1 0 2]<br>
                        <br>
                        **Kernel (2x2):**<br>
                        [1 0]<br>
                        [0 1]<br>
                        <br>
                        **Calculation:**<br>
                        Step 1 (Top-Left): (1x1) + (2x0) + (0x0) + (1x1) = <strong>2</strong><br>
                        Step 2 (Top-Right): (2x1) + (0x0) + (1x0) + (1x1) = <strong>3</strong><br>
                        ... Output is a 2x2 matrix.
                    </div>

                    <h3>Backprop through Conv</h3>
                    <p>Calculated using the same formula but with the kernel flipped vertically and horizontally (true convolution)!</p>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🔍 Feature Extraction</div>
                        <div class="box-content">
                            Early layers learn edges (Gabor-like filters), middle layers learn textures, deep layers learn specific object parts (eyes, wheels).
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🎨 Image Processing</div>
                        <div class="box-content">
                            Blurring, sharpening, and edge detection in Photoshop/GIMP are all done with 2D convolutions using fixed kernels.
                        </div>
                    </div>
                `
            },
            "yolo": {
                overview: `
                    <h3>What is YOLO?</h3>
                    <p>YOLO (You Only Look Once) treats object detection as a single regression problem, going directly from image pixels to bounding box coordinates and class probabilities in one forward pass.</p>
                    
                    <h3>Why YOLO Over R-CNN?</h3>
                    <ul>
                        <li><strong>Speed:</strong> 45+ FPS (real-time) vs R-CNN's ~0.05 FPS</li>
                        <li><strong>Global Context:</strong> Sees entire image during training (fewer background errors)</li>
                        <li><strong>One Network:</strong> Unlike R-CNN's multi-stage pipeline</li>
                        <li><strong>End-to-End Training:</strong> Optimize detection directly</li>
                    </ul>
                    
                    <div class="callout tip">
                        <div class="callout-title">✅ Advantages</div>
<strong>Lightning Fast:</strong> Real-time inference (YOLOv8 at 100+ FPS)<br>
<strong>Simple Architecture:</strong> Single network, easy to train<br>
<strong>Generalizes Well:</strong> Works on natural images and artwork<br>
<strong>Small Model Size:</strong> Can run on edge devices (mobile, IoT)
                    </div>
                    
                    <div class="callout warning">
                        <div class="callout-title">⚠️ Disadvantages</div>
<strong>Struggles with Small Objects:</strong> Grid limitation affects tiny items<br>
<strong>Localization Errors:</strong> Less precise than two-stage detectors<br>
<strong>Limited Objects per Cell:</strong> Can't detect many close objects<br>
<strong>Aspect Ratio Issues:</strong> Struggles with unusual object shapes
                    </div>
                    
                    <h3>YOLO Evolution</h3>
                    <table>
                        <tr>
                            <th>Version</th>
                            <th>Year</th>
                            <th>Key Innovation</th>
                            <th>mAP</th>
                        </tr>
                        <tr>
                            <td>YOLOv1</td>
                            <td>2015</td>
                            <td>Original single-shot detector</td>
                            <td>63.4%</td>
                        </tr>
                        <tr>
                            <td>YOLOv3</td>
                            <td>2018</td>
                            <td>Multi-scale predictions</td>
                            <td>57.9% (faster)</td>
                        </tr>
                        <tr>
                            <td>YOLOv5</td>
                            <td>2020</td>
                            <td>PyTorch, Auto-augment</td>
                            <td>~50% (optimized)</td>
                        </tr>
                        <tr>
                            <td>YOLOv8</td>
                            <td>2023</td>
                            <td>Anchor-free, SOTA speed</td>
                            <td>53.9% (real-time)</td>
                        </tr>
                    </table>
                `,
                concepts: `
                    <h3>How YOLO Works (3 Steps)</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Grid Division:</strong> Divide image into S×S grid (e.g., 7×7). Each cell predicts B bounding boxes</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Predictions Per Cell:</strong> Each box predicts (x, y, w, h, confidence) + class probabilities</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Non-Max Suppression:</strong> Remove duplicate detections, keep highest confidence boxes</div>
                    </div>
                    
                    <div class="formula">
                        Output Tensor Shape (YOLOv1):<br>
                        S × S × (B × 5 + C)<br>
                        Example: 7 × 7 × (2 × 5 + 20) = 7 × 7 × 30<br>
                        <br>
                        Where:<br>
                        • S = grid size (7)<br>
                        • B = boxes per cell (2)<br>
                        • 5 = (x, y, w, h, confidence)<br>
                        • C = number of classes (20 for PASCAL VOC)
                    </div>
                `,
                applications: `
                    <h3>Industry Applications</h3>
                    <div class="info-box">
                        <div class="box-title">🚗 Autonomous Vehicles</div>
                        <div class="box-content">
                            Real-time detection of pedestrians, vehicles, traffic signs, and lane markings for self-driving cars
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🏭 Manufacturing</div>
                        <div class="box-content">
                            Quality control, defect detection on assembly lines, robot guidance, inventory management
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🛡️ Security & Surveillance</div>
                        <div class="box-content">
                            Intrusion detection, crowd monitoring, suspicious behavior analysis, license plate recognition
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🏥 Medical Imaging</div>
                        <div class="box-content">
                            Tumor localization, cell counting, anatomical structure detection in X-rays/CT scans
                        </div>
                    </div>
                `,
                math: `
                    <h3>Intersection over Union (IoU)</h3>
                    <p>How do we measure if a predicted box is correct? We use the geometric ratio of intersection and union.</p>
                    <div class="formula">
                        IoU = Area of Overlap / Area of Union
                    </div>
                    
                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: Manual IoU</div>
                        **Box A (GT):** [0,0,10,10] (Area=100)<br>
                        **Box B (Pred):** [5,5,15,15] (Area=100)<br>
                        1. **Intersection:** Area between [5,5] and [10,10] = 5x5 = 25<br>
                        2. **Union:** Area A + Area B - Intersection = 100 + 100 - 25 = 175<br>
                        3. **IoU:** 25 / 175 ≈ <strong>0.142</strong> (Poor match!)
                    </div>

                    <h3>YOLO Multi-Part Loss</h3>
                    <p>YOLO uses a composite loss function combining localization, confidence, and classification errors.</p>
                    <div class="formula">
                        L = λ_coord Σ(Localization Loss) + Σ(Confidence Loss) + Σ(Classification Loss)
                    </div>
                `
            },
            "transformers": {
                overview: `
                    <h3>What are Transformers?</h3>
                    <p>Transformers are neural architectures based entirely on attention mechanisms, eliminating recurrence and convolutions. Introduced in "Attention is All You Need" (2017), they revolutionized NLP and are now conquering computer vision.</p>
                    
                    <h3>Why Transformers Over RNNs/LSTMs?</h3>
                    <ul>
                        <li><strong>Parallelization:</strong> Process entire sequence at once (vs sequential RNNs)</li>
                        <li><strong>Long-Range Dependencies:</strong> Direct connections between any two positions</li>
                        <li><strong>No Gradient Vanishing:</strong> Skip connections and attention bypass depth issues</li>
                        <li><strong>Scalability:</strong> Performance improves with more data and compute</li>
                    </ul>
                    
                    <div class="callout tip">
                        <div class="callout-title">✅ Advantages</div>
<strong>Superior Performance:</strong> SOTA on nearly all NLP benchmarks<br>
<strong>Highly Parallelizable:</strong> Train 100× faster than RNNs on TPUs/GPUs<br>
<strong>Transfer Learning:</strong> Pre-train once, fine-tune for many tasks<br>
<strong>Interpretability:</strong> Attention weights show what model focuses on<br>
<strong>Multi-Modal:</strong> Works for text, images, audio, video
                    </div>
                    
                    <div class="callout warning">
                        <div class="callout-title">⚠️ Disadvantages</div>
<strong>Quadratic Complexity:</strong> O(n²) in sequence length (memory intensive)<br>
<strong>Massive Data Requirements:</strong> Need millions of examples to train from scratch<br>
<strong>Computational Cost:</strong> Training GPT-3 cost ~$4.6M<br>
<strong>Position Encoding:</strong> Require explicit positional information<br>
<strong>Limited Context:</strong> Most models cap at 512-4096 tokens
                    </div>
                    
                    <h3>Transformer Variants</h3>
                    <table>
                        <tr>
                            <th>Model</th>
                            <th>Type</th>
                            <th>Architecture</th>
                            <th>Best For</th>
                        </tr>
                        <tr>
                            <td>BERT</td>
                            <td>Encoder-only</td>
                            <td>Bidirectional</td>
                            <td>Understanding (classification, QA)</td>
                        </tr>
                        <tr>
                            <td>GPT</td>
                            <td>Decoder-only</td>
                            <td>Autoregressive</td>
                            <td>Generation (text, code)</td>
                        </tr>
                        <tr>
                            <td>T5</td>
                            <td>Encoder-Decoder</td>
                            <td>Full Transformer</td>
                            <td>Text-to-text tasks (translation)</td>
                        </tr>
                        <tr>
                            <td>ViT</td>
                            <td>Encoder-only</td>
                            <td>Patch embeddings</td>
                            <td>Image classification</td>
                        </tr>
                    </table>
                `,
                concepts: `
                    <h3>Core Components</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Self-Attention:</strong> Each token attends to all other tokens, learning contextual relationships</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Multi-Head Attention:</strong> Multiple attention mechanisms in parallel (8-16 heads), each learning different patterns</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Positional Encoding:</strong> Add position information since attention is permutation-invariant</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">04</div>
                        <div><strong>Feed-Forward Networks:</strong> Two-layer MLPs applied to each position independently</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">05</div>
                        <div><strong>Layer Normalization:</strong> Stabilize training, applied before attention and FFN</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">06</div>
                        <div><strong>Residual Connections:</strong> Skip connections around each sub-layer for gradient flow</div>
                    </div>
                    
                    <div class="formula">
                        Self-Attention Formula:<br>
                        Attention(Q, K, V) = softmax(QK<sup>T</sup> / √d<sub>k</sub>) V<br>
                        <br>
                        Where:<br>
                        • Q = Queries (what we're looking for)<br>
                        • K = Keys (what each token represents)<br>
                        • V = Values (actual information to aggregate)<br>
                        • d<sub>k</sub> = dimension of keys (for scaling)<br>
                        <br>
                        Multi-Head Attention:<br>
                        MultiHead(Q,K,V) = Concat(head₁,...,head<sub>h</sub>)W<sup>O</sup><br>
                        where head<sub>i</sub> = Attention(QW<sub>i</sub><sup>Q</sup>, KW<sub>i</sub><sup>K</sup>, VW<sub>i</sub><sup>V</sup>)
                    </div>
                `,
                applications: `
                    <h3>Revolutionary Applications</h3>
                    <div class="info-box">
                        <div class="box-title">💬 Large Language Models</div>
                        <div class="box-content">
                            <strong>ChatGPT, GPT-4, Claude:</strong> Conversational AI, code generation, creative writing, reasoning<br>
                            <strong>BERT, RoBERTa:</strong> Search engines (Google), question answering, sentiment analysis
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🌐 Machine Translation</div>
                        <div class="box-content">
                            <strong>Google Translate, DeepL:</strong> Transformers achieved human-level translation quality<br>
                            Supports 100+ languages, real-time translation
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🎨 Multi-Modal AI</div>
                        <div class="box-content">
                            <strong>DALL-E, Midjourney:</strong> Text-to-image generation<br>
                            <strong>CLIP:</strong> Image-text understanding<br>
                            <strong>Whisper:</strong> Speech recognition
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🧬 Scientific Discovery</div>
                        <div class="box-content">
                            <strong>AlphaFold:</strong> Protein structure prediction (Nobel Prize-worthy breakthrough)<br>
                            <strong>Drug Discovery:</strong> Molecule generation and property prediction
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">💻 Code Intelligence</div>
                        <div class="box-content">
                            <strong>GitHub Copilot:</strong> AI pair programmer<br>
                            <strong>CodeGen, AlphaCode:</strong> Automated coding, bug detection
                        </div>
                    </div>
                `,
                math: `
                    <h3>Scaled Dot-Product Attention</h3>
                    <p>The "heart" of the Transformer. It computes how much "attention" to pay to different parts of the input sequence.</p>
                    
                    <div class="formula" style="font-size: 1.3rem; text-align: center; margin: 20px 0; background: rgba(0, 212, 255, 0.05); padding: 20px; border-radius: 8px;">
                        Attention(Q, K, V) = softmax( (QKᵀ) / √dₖ ) V
                    </div>

                    <h3>Step-by-Step Derivation</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Dot Product (QKᵀ):</strong> Compute raw similarity scores between Queries (what we want) and Keys (what we have)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Scaling (1/√dₖ):</strong> Divide by square root of key dimension. <strong>Why?</strong> With high dimensions, dot products grow large, pushing softmax into regions with vanishing gradients. Scaling prevents this.</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Softmax:</strong> Convert similarity scores into probabilities (attention weights) that sum to 1</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">04</div>
                        <div><strong>Weighted Sum (×V):</strong> Use attention weights to pull information from Values.</div>
                    </div>

                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: Multi-Head Attention</div>
                        Instead of one big attention, we split Q, K, V into <em>h</em> heads:<br>
                        1. Heads learn <strong>different aspects</strong> (e.g., syntax vs semantics)<br>
                        2. Concat all heads: MultiHead = Concat(head₁, ..., headₕ)Wᴼ<br>
                        3. Complexity: <strong>O(n² · d)</strong> - This is why long sequences are hard!
                    </div>

                    <div class="callout warning">
                        <div class="callout-title">📐 Sinusoidal Positional Encoding</div>
                        PE(pos, 2i) = sin(pos / 10000^{2i/d})<br>
                        PE(pos, 2i+1) = cos(pos / 10000^{2i/d})<br>
                        This allows the model to learn relative positions since PE(pos+k) is a linear function of PE(pos).
                    </div>
                `
            },
            "perceptron": {
                overview: `
                    <h3>What is a Perceptron?</h3>
                    <p>The perceptron is the simplest neural network, invented in 1958. It's a binary linear classifier that makes predictions based on weighted inputs.</p>
                    
                    <div class="callout tip">
                        <div class="callout-title">✅ Advantages</div>
                        • Simple and fast<br>
                        • Guaranteed convergence for linearly separable data<br>
                        • Interpretable weights
                    </div>
                    
                    <div class="callout warning">
                        <div class="callout-title">⚠️ Key Limitation</div>
                        <strong>Cannot solve XOR:</strong> Limited to linear decision boundaries only
                    </div>
                `,
                concepts: `
                    <h3>How Perceptron Works</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Weighted Sum:</strong> z = w₁x₁ + w₂x₂ + ... + b</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Step Function:</strong> Output = 1 if z ≥ 0, else 0</div>
                    </div>
                    <div class="formula">
                        Learning Rule: w_new = w_old + α(y_true - y_pred)x
                    </div>
                `,
                math: `
                    <h3>Perceptron Learning Algorithm</h3>
                    <p>The perceptron update rule is the simplest form of gradient descent.</p>
                    
                    <div class="formula">
                        For each misclassified sample (x, y):<br>
                        w ← w + α × y × x<br>
                        b ← b + α × y
                    </div>
                    
                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: Manual Training</div>
                        <strong>Data:</strong> x₁ = [1, 1], y₁ = 1 | x₂ = [0, 0], y₂ = 0<br>
                        <strong>Initial:</strong> w = [0, 0], b = 0, α = 1<br>
                        <br>
                        <strong>Iteration 1 (x₁):</strong><br>
                        z = 0×1 + 0×1 + 0 = 0 → ŷ = 1 ✓ (correct!)<br>
                        <br>
                        <strong>Iteration 2 (x₂):</strong><br>
                        z = 0×0 + 0×0 + 0 = 0 → ŷ = 1 ✗ (wrong! y=0)<br>
                        Update: w = [0,0] + 1×(0-1)×[0,0] = [0,0], b = 0 + 1×(0-1) = -1<br>
                        <br>
                        Now z(x₂) = 0 + 0 - 1 = -1 → ŷ = 0 ✓
                    </div>
                    
                    <h3>Convergence Theorem</h3>
                    <div class="formula">
                        If data is linearly separable with margin γ and ||x|| ≤ R,<br>
                        perceptron converges in at most (R/γ)² updates.
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">📚 Educational</div>
                        <div class="box-content">
                            Historical importance - first trainable neural model. Perfect for teaching ML fundamentals
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🔬 Simple Classification</div>
                        <div class="box-content">
                            Linearly separable problems: basic pattern recognition, simple binary decisions
                        </div>
                    </div>
                `
            },
            "mlp": {
                overview: `
                    <h3>Multi-Layer Perceptron (MLP)</h3>
                    <p>MLP adds hidden layers between input and output, enabling non-linear decision boundaries and solving the XOR problem that single perceptrons cannot.</p>
                    
                    <h3>Why MLPs?</h3>
                    <ul>
                        <li><strong>Universal Approximation:</strong> Can approximate any continuous function</li>
                        <li><strong>Non-Linear Learning:</strong> Solves complex problems</li>
                        <li><strong>Feature Extraction:</strong> Hidden layers learn hierarchical features</li>
                    </ul>
                    
                    <div class="callout insight">
                        <div class="callout-title">💡 The XOR Breakthrough</div>
                        Single perceptron: Cannot solve XOR<br>
                        MLP with 1 hidden layer (2 neurons): Solves XOR!<br>
                        This proves the power of depth.
                    </div>
                `,
                concepts: `
                    <h3>Architecture Components</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Input Layer:</strong> Raw features (no computation)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Hidden Layers:</strong> Extract progressively abstract features</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Output Layer:</strong> Final predictions</div>
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">📊 Tabular Data</div>
                        <div class="box-content">Credit scoring, fraud detection, customer churn, sales forecasting</div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🏭 Manufacturing</div>
                        <div class="box-content">Quality control, predictive maintenance, demand forecasting</div>
                    </div>
                `,
                math: `
                    <h3>Neural Network Forward Pass (Matrix Form)</h3>
                    <p>Vectorization is key to modern deep learning. We process entire layers as matrix multiplications.</p>
                    
                    <div class="formula">
                        Layer 1: z⁽¹⁾ = W⁽¹⁾x + b⁽¹⁾ | a⁽¹⁾ = σ(z⁽¹⁾)<br>
                        Layer 2: z⁽²⁾ = W⁽²⁾a⁽¹⁾ + b⁽²⁾ | a⁽²⁾ = σ(z⁽²⁾)<br>
                        ...<br>
                        Layer L: ŷ = Softmax(W⁽ᴸ⁾a⁽ᴸ⁻¹⁾ + b⁽ᴸ⁾)
                    </div>

                    <h3>Paper & Pain: Dimensionality Audit</h3>
                    <p>Understanding tensor shapes is the #1 skill for debugging neural networks.</p>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Input x:</strong> [n_features, 1]</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Weights W⁽¹⁾:</strong> [n_hidden, n_features]</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Bias b⁽¹⁾:</strong> [n_hidden, 1]</div>
                    </div>

                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: Solving XOR</div>
                        Input: [0,1], Target: 1<br>
                        Layer 1 (2 neurons):<br>
                        z₁ = 10x₁ + 10x₂ - 5 &nbsp; | &nbsp; a₁ = σ(z₁)<br>
                        z₂ = 10x₁ + 10x₂ - 15 | &nbsp; a₂ = σ(z₂)<br>
                        Layer 2 (1 neuron):<br>
                        y = σ(20a₁ - 20a₂ - 10)<br>
                        <strong>Try it on paper!</strong> This specific configuration correctly outputs XOR values.
                    </div>
                `
            },
            "weight-init": {
                overview: `
                    <h3>Weight Initialization Strategies</h3>
                    <table>
                        <tr>
                            <th>Method</th>
                            <th>Best For</th>
                            <th>Formula</th>
                        </tr>
                        <tr>
                            <td>Xavier/Glorot</td>
                            <td>Sigmoid, Tanh</td>
                            <td>N(0, √(2/(n_in+n_out)))</td>
                        </tr>
                        <tr>
                            <td>He/Kaiming</td>
                            <td>ReLU</td>
                            <td>N(0, √(2/n_in))</td>
                        </tr>
                    </table>
                    
                    <div class="callout warning">
                        <div class="callout-title">⚠️ Never Initialize to Zero!</div>
                        All neurons learn identical features (symmetry problem)
                    </div>
                `,
                concepts: `
                    <h3>Key Principles</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Variance Preservation:</strong> Keep activation variance similar across layers</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Symmetry Breaking:</strong> Different weights force different features</div>
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🎯 Critical for Deep Networks</div>
                        <div class="box-content">
                            Proper initialization is essential for training networks >10 layers. Wrong init = training failure
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">⚡ Faster Convergence</div>
                        <div class="box-content">
                            Good initialization reduces training time by 2-10×, especially with modern optimizers
                        </div>
                    </div>
                `,
                math: `
                    <h3>The Variance Preservation Principle</h3>
                    <p>To prevent gradients from vanishing or exploding, we want the variance of the activations to remain constant across layers.</p>
                    
                    <div class="formula">
                        For a linear layer: y = Σ wᵢxᵢ<br>
                        Var(y) = Var(Σ wᵢxᵢ) = Σ Var(wᵢxᵢ)<br>
                        Assuming w and x are independent with mean 0:<br>
                        Var(wᵢxᵢ) = E[wᵢ²]E[xᵢ²] - E[wᵢ]²E[xᵢ]² = Var(wᵢ)Var(xᵢ)<br>
                        So, Var(y) = n_in × Var(w) × Var(x)
                    </div>

                    <h3>1. Xavier (Glorot) Initialization</h3>
                    <p>Goal: Var(y) = Var(x) and Var(grad_out) = Var(grad_in)</p>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Forward Pass:</strong> n_in × Var(w) = 1  ⇒ Var(w) = 1/n_in</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Backward Pass:</strong> n_out × Var(w) = 1 ⇒ Var(w) = 1/n_out</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Compromise:</strong> Var(w) = 2 / (n_in + n_out)</div>
                    </div>

                    <h3>2. He (Kaiming) Initialization</h3>
                    <p>For ReLU activation, half the neurons are inactive (output 0), which halves the variance. We must compensate.</p>
                    <div class="formula">
                        Var(ReLU(y)) = 1/2 × Var(y)<br>
                        To keep Var(ReLU(y)) = Var(x):<br>
                        1/2 × n_in × Var(w) = 1<br>
                        <strong>Var(w) = 2 / n_in</strong>
                    </div>

                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain Calculation</div>
                        If n_in = 256 and you use ReLU:<br>
                        Weight Std Dev = √(2/256) = √(1/128) ≈ <strong>0.088</strong><br>
                        Initializing with std=1.0 or std=0.01 would cause immediate failure in a deep net!
                    </div>
                `
            },
            "loss": {
                overview: `
                    <h3>Loss Functions Guide</h3>
                    <table>
                        <tr>
                            <th>Task</th>
                            <th>Loss Function</th>
                        </tr>
                        <tr>
                            <td>Binary Classification</td>
                            <td>Binary Cross-Entropy</td>
                        </tr>
                        <tr>
                            <td>Multi-class</td>
                            <td>Categorical Cross-Entropy</td>
                        </tr>
                        <tr>
                            <td>Regression</td>
                            <td>MSE or MAE</td>
                        </tr>
                    </table>
                `,
                concepts: `
                    <h3>Common Loss Functions</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>MSE:</strong> (1/n)Σ(y - ŷ)² - Penalizes large errors</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Cross-Entropy:</strong> -Σ(y·log(ŷ)) - For classification</div>
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🎯 Task-Dependent Selection</div>
                        <div class="box-content">
                            Every ML task needs appropriate loss: classification (cross-entropy), regression (MSE/MAE), ranking (triplet loss)
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">📊 Custom Losses</div>
                        <div class="box-content">
                            Business-specific objectives: Focal Loss (imbalanced data), Dice Loss (segmentation), Contrastive Loss (similarity learning)
                        </div>
                    </div>
                `,
                math: `
                    <h3>Binary Cross-Entropy (BCE) Derivation</h3>
                    <p>Why do we use logs? BCE is derived from Maximum Likelihood Estimation (MLE) assuming a Bernoulli distribution.</p>
                    
                    <div class="formula">
                        L(ŷ, y) = -(y log(ŷ) + (1-y) log(1-ŷ))
                    </div>

                    <h3>Paper & Pain: Why not MSE for Classification?</h3>
                    <p>If we use MSE for sigmoid output, the gradient is:</p>
                    <div class="formula">
                        ∂L/∂w = (ŷ - y) <strong>σ'(z)</strong> x
                    </div>
                    <div class="callout warning">
                        <div class="callout-title">⚠️ The Saturation Problem</div>
                        If the model is very wrong (e.g., target 1, output 0.001), σ'(z) is near 0. <br>
                        The gradient vanishes, and the model <strong>stops learning!</strong>.
                    </div>

                    <h3>The BCE Advantage</h3>
                    <p>When using BCE, the σ'(z) term cancels out! The gradient becomes:</p>
                    <div class="formula" style="font-size: 1.2rem; color: #00d4ff;">
                        ∂L/∂w = (ŷ - y) x
                    </div>
                    <div class="list-item">
                        <div class="list-num">💡</div>
                        <div>This is beautiful: the gradient depends <strong>only on the error</strong> (ŷ-y), not on how saturated the neuron is. This enables much faster training.</div>
                    </div>
                `
            },
            "optimizers": {
                overview: `
                    <h3>Optimizer Selection Guide</h3>
                    <table>
                        <tr>
                            <th>Optimizer</th>
                            <th>When to Use</th>
                        </tr>
                        <tr>
                            <td>Adam/AdamW</td>
                            <td><strong>Default choice</strong> - works 90% of time</td>
                        </tr>
                        <tr>
                            <td>SGD + Momentum</td>
                            <td>CNNs (better final accuracy with patience)</td>
                        </tr>
                        <tr>
                            <td>RMSprop</td>
                            <td>RNNs</td>
                        </tr>
                    </table>
                    
                    <div class="formula">
                        Adam: m_t = β₁·m + (1-β₁)·∇L<br>
                        v_t = β₂·v + (1-β₂)·(∇L)²<br>
                        w = w - α·m_t/√(v_t)
                    </div>
                `,
                concepts: `
                    <h3>Optimizer Evolution</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>SGD:</strong> Simple but requires careful learning rate tuning</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Adam:</strong> Adaptive rates + momentum = works out-of-box</div>
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🚀 Training Acceleration</div>
                        <div class="box-content">
                            Modern optimizers (Adam) reduce training time by 5-10× compared to basic SGD
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🎯 Architecture-Specific</div>
                        <div class="box-content">
                            CNNs: SGD+Momentum | Transformers: AdamW | RNNs: RMSprop | Default: Adam
                        </div>
                    </div>
                `
            },
            "backprop": {
                overview: `
                    <h3>Backpropagation Algorithm</h3>
                    <p>Backprop efficiently computes gradients by applying the chain rule from output to input, enabling training of deep networks.</p>
                    
                    <h3>Why Backpropagation?</h3>
                    <ul>
                        <li><strong>Efficient:</strong> Computes all gradients in single backward pass</li>
                        <li><strong>Scalable:</strong> Works for networks of any depth</li>
                        <li><strong>Automatic:</strong> Modern frameworks do it automatically</li>
                    </ul>
                `,
                concepts: `
                    <div class="formula">
                        Chain Rule:<br>
                        ∂L/∂w = ∂L/∂y × ∂y/∂z × ∂z/∂w<br>
                        <br>
                        For layer l:<br>
                        δˡ = (W^(l+1))^T δ^(l+1) ⊙ σ'(z^l)<br>
                        ∂L/∂W^l = δ^l (a^(l-1))^T
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🧠 Universal Training Method</div>
                        <div class="box-content">
                            Every modern neural network uses backprop - from CNNs to Transformers to GANs
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🔧 Automatic Differentiation</div>
                        <div class="box-content">
                            PyTorch, TensorFlow implement automatic backprop - you define forward pass, framework does backward
                        </div>
                    </div>
                `,
                math: `
                    <h3>The 4 Fundamental Equations of Backprop</h3>
                    <p>Backpropagation is essentially the chain rule applied iteratively. We define the error signal δ = ∂L/∂z.</p>
                    
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Error at Output Layer (L):</strong><br>
                        δᴸ = ∇ₐL ⊙ σ'(zᴸ)<br>
                        <span class="formula-caption">Example for MSE: (aᴸ - y) ⊙ σ'(zᴸ)</span></div>
                    </div>

                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Error at Layer l (Backwards):</strong><br>
                        δˡ = ((Wˡ⁺¹)ᵀ δˡ⁺¹) ⊙ σ'(zˡ)</div>
                    </div>

                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Gradient w.r.t Bias:</strong><br>
                        ∂L / ∂bˡ = δˡ</div>
                    </div>

                    <div class="list-item">
                        <div class="list-num">04</div>
                        <div><strong>Gradient w.r.t Weights:</strong><br>
                        ∂L / ∂Wˡ = δˡ (aˡ⁻¹)ᵀ</div>
                    </div>

                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain Walkthrough</div>
                        Suppose single neuron: z = wx + b, Loss L = (σ(z) - y)²/2<br>
                        1. <strong>Forward:</strong> z=2, a=σ(2)≈0.88, y=1, L=0.007<br>
                        2. <strong>Backward:</strong><br>
                        &nbsp;&nbsp;&nbsp;∂L/∂a = (a-y) = -0.12<br>
                        &nbsp;&nbsp;&nbsp;∂a/∂z = σ(z)(1-σ(z)) = 0.88 * 0.12 = 0.1056<br>
                        &nbsp;&nbsp;&nbsp;δ = ∂L/∂z = -0.12 * 0.1056 = -0.01267<br>
                        &nbsp;&nbsp;&nbsp;<strong>∂L/∂w = δ * x</strong> | <strong>∂L/∂b = δ</strong>
                    </div>
                `
            },
            "regularization": {
                overview: `
                    <h3>Regularization Techniques</h3>
                    <table>
                        <tr>
                            <th>Method</th>
                            <th>How It Works</th>
                            <th>When to Use</th>
                        </tr>
                        <tr>
                            <td>L2 (Ridge)</td>
                            <td>Adds λΣw² to loss</td>
                            <td>Keeps all features, reduces magnitude</td>
                        </tr>
                        <tr>
                            <td>L1 (Lasso)</td>
                            <td>Adds λΣ|w| to loss</td>
                            <td>Feature selection (zeros out weights)</td>
                        </tr>
                        <tr>
                            <td>Dropout</td>
                            <td>Randomly drops neurons (p=0.5 typical)</td>
                            <td><strong>Most effective for deep networks</strong></td>
                        </tr>
                        <tr>
                            <td>Early Stopping</td>
                            <td>Stop when validation loss increases</td>
                            <td>Prevents overfitting during training</td>
                        </tr>
                        <tr>
                            <td>Data Augmentation</td>
                            <td>Artificially expand dataset</td>
                            <td>Computer vision (rotations, flips, crops)</td>
                        </tr>
                    </table>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🎯 Best Practices</div>
                        <div class="box-content">
                            • Start with Dropout (0.5) for hidden layers<br>
                            • Add L2 if still overfitting (λ=0.01, 0.001)<br>
                            • Always use Early Stopping<br>
                            • Data Augmentation for images
                        </div>
                    </div>
                `
            },
            "batch-norm": {
                overview: `
                    <h3>Batch Normalization</h3>
                    <p>Normalizes layer inputs to have mean=0 and variance=1, stabilizing and accelerating training.</p>
                    
                    <div class="callout tip">
                        <div class="callout-title">✅ Benefits</div>
<strong>Faster Training:</strong> Allows higher learning rates<br>
<strong>Reduces Vanishing Gradients:</strong> Better gradient flow<br>
<strong>Regularization Effect:</strong> Adds slight noise<br>
<strong>Less Sensitive to Init:</strong> Reduces initialization impact
                    </div>
                `,
                math: `
                    <h3>The 4 Steps of Batch Normalization</h3>
                    <p>Calculated per mini-batch B = {x₁, ..., xₘ}:</p>
                    
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Mini-Batch Mean:</strong> μ_B = (1/m) Σ xᵢ</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Mini-Batch Variance:</strong> σ²_B = (1/m) Σ (xᵢ - μ_B)²</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Normalize:</strong> x̂ᵢ = (xᵢ - μ_B) / √(σ²_B + ε)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">04</div>
                        <div><strong>Scale and Shift:</strong> yᵢ = γ x̂ᵢ + β</div>
                    </div>

                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: Why γ and β?</div>
                        If we only normalized to (0,1), we might restrict the representation power of the network. <br>
                        γ and β allow the network to <strong>undo</strong> the normalization if that's optimal: <br>
                        If γ = √(σ²) and β = μ, we get the original data back!
                    </div>
                `
            },
            "cv-intro": {
                overview: `
                    <h3>Why Computer Vision Needs Special Architectures</h3>
                    <p><strong>Problem:</strong> Images have huge dimensionality</p>
                    <ul>
                        <li>224×224 RGB image = 150,528 input features</li>
                        <li>Fully connected layer with 1000 neurons = 150M parameters!</li>
                        <li>Result: Overfitting, slow training, memory issues</li>
                    </ul>
                    
                    <h3>Solution: Convolutional Neural Networks</h3>
                    <ul>
                        <li><strong>Weight Sharing:</strong> Same filter applied everywhere (1000x fewer parameters)</li>
                        <li><strong>Local Connectivity:</strong> Neurons see small patches</li>
                        <li><strong>Translation Invariance:</strong> Detect cat anywhere in image</li>
                    </ul>
                `,
                concepts: `
                    <h3>Why CNNs Beat Fully Connected</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Parameter Efficiency:</strong> 1000× fewer parameters through weight sharing</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Translation Equivariance:</strong> Same object → same activation regardless of position</div>
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">📸 Real-World CV</div>
                        <div class="box-content">
                            Face ID, medical imaging (MRI/CT), autonomous drone navigation, manufacturing defect detection, and satellite imagery analysis
                        </div>
                    </div>
                `,
                math: `
                    <h3>The Parameter Explosion Problem</h3>
                    <p>Why do standard Neural Networks fail on images? Let's calculate the parameters for a small image.</p>
                    
                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: MLP vs Images</div>
                        1. **Input:** 224 × 224 pixels with 3 color channels (RGB)<br>
                        2. **Input Size:** 224 × 224 × 3 = <strong>150,528 features</strong><br>
                        3. **Hidden Layer:** Suppose we want just 1000 neurons.<br>
                        4. **Matrix size:** [1000, 150528]<br>
                        5. **Total Weights:** 1000 × 150528 ≈ <strong>150 Million parameters</strong> for just ONE layer!
                    </div>

                    <h3>The CNN Solution: Weight Sharing</h3>
                    <p>Instead of every neuron looking at every pixel, we use <strong>translation invariance</strong>. If an edge detector works in the top-left, it should work in the bottom-right.</p>
                    
                    <div class="formula">
                        Total Params = (Kernel_H × Kernel_W × Input_Channels) × Num_Filters<br>
                        <br>
                        For a 3x3 filter: (3 × 3 × 3) × 64 = <strong>1,728 parameters</strong><br>
                        Reduction: 150M / 1.7k ≈ <strong>86,000× more efficient!</strong>
                    </div>
                `
            },
            "pooling": {
                overview: `
                    <h3>Pooling Layers</h3>
                    <p>Pooling reduces spatial dimensions while retaining important information.</p>
                    
                    <table>
                        <tr>
                            <th>Type</th>
                            <th>Operation</th>
                            <th>Use Case</th>
                        </tr>
                        <tr>
                            <td>Max Pooling</td>
                            <td>Take maximum value</td>
                            <td><strong>Most common</strong> - preserves strong activations</td>
                        </tr>
                        <tr>
                            <td>Average Pooling</td>
                            <td>Take average</td>
                            <td>Smoother, less common (used in final layers)</td>
                        </tr>
                        <tr>
                            <td>Global Pooling</td>
                            <td>Pool entire feature map</td>
                            <td>Replace FC layers (reduces parameters)</td>
                        </tr>
                    </table>
                    
                    <div class="callout tip">
                        <div class="callout-title">✅ Benefits</div>
                        • Reduces spatial size (faster computation)<br>
                        • Adds translation invariance<br>
                        • Prevents overfitting<br>
                        • Typical: 2×2 window, stride 2 (halves dimensions)
                    </div>
                `,
                concepts: `
                    <h3>Pooling Mechanics</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Downsampling:</strong> Reduces H×W by pooling factor (typically 2×)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>No Learnable Parameters:</strong> Fixed operation (max/average)</div>
                    </div>
                    <div class="formula">
                        Example: 4×4 input → 2×2 max pooling → 2×2 output
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🎯 Standard CNN Component</div>
                        <div class="box-content">
                            Used after conv layers in AlexNet, VGG, and most classic CNNs to progressively reduce spatial dimensions
                        </div>
                    </div>
                `,
                math: `
                    <h3>Max Pooling: Winning Signal Selection</h3>
                    <p>Pooling operations are non-parametric (no weights). They simply select or average values within a local window.</p>
                    
                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: 2x2 Max Pooling</div>
                        **Input (4x4):**<br>
                        [1 3 | 2 1]<br>
                        [5 1 | 0 2]<br>
                        -----------<br>
                        [1 1 | 8 2]<br>
                        [0 2 | 4 1]<br>
                        <br>
                        **Output (2x2):**<br>
                        Step 1: max(1, 3, 5, 1) = <strong>5</strong><br>
                        Step 2: max(2, 1, 0, 2) = <strong>2</strong><br>
                        Step 3: max(1, 1, 0, 2) = <strong>2</strong><br>
                        Step 4: max(8, 2, 4, 1) = <strong>8</strong><br>
                        **Final:** [5 2] / [2 8]
                    </div>

                    <h3>Backprop through Pooling</h3>
                    <div class="list-item">
                        <div class="list-num">💡</div>
                        <div><strong>Max Pooling:</strong> Gradient is routed ONLY to the neuron that had the maximum value. All others get 0.</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">💡</div>
                        <div><strong>Average Pooling:</strong> Gradient is distributed evenly among all neurons in the window.</div>
                    </div>
                `
            },
            "cnn-basics": {
                overview: `
                    <h3>CNN Architecture Pattern</h3>
                    <div class="formula">
                        Input → [Conv → ReLU → Pool] × N → Flatten → FC → Softmax
                    </div>
                    
                    <h3>Typical Layering Strategy</h3>
                    <ul>
                        <li><strong>Early Layers:</strong> Detect low-level features (edges, textures) - small filters (3×3)</li>
                        <li><strong>Middle Layers:</strong> Combine into patterns, parts - more filters, same size</li>
                        <li><strong>Deep Layers:</strong> High-level concepts (faces, objects) - many filters</li>
                        <li><strong>Final FC Layers:</strong> Classification based on learned features</li>
                    </ul>
                    
                    <div class="callout insight">
                        <div class="callout-title">💡 Filter Progression</div>
                        Layer 1: 32 filters (edges)<br>
                        Layer 2: 64 filters (textures)<br>
                        Layer 3: 128 filters (patterns)<br>
                        Layer 4: 256 filters (parts)<br>
                        Common pattern: double filters after each pooling
                    </div>
                `,
                concepts: `
                    <h3>Module Design Principles</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Spatial Reduction:</strong> Progressively downsample (224→112→56→28...)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Channel Expansion:</strong> Increase filters as spatial dims decrease</div>
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🎯 All Modern Vision Models</div>
                        <div class="box-content">
                            This pattern forms the backbone of ResNet, MobileNet, EfficientNet - fundamental CNN design
                        </div>
                    </div>
                `,
                math: `
                    <h3>1. The Golden Formula for Output Size</h3>
                    <p>Given Input (W), Filter Size (F), Padding (P), and Stride (S):</p>
                    <div class="formula" style="font-size: 1.2rem; text-align: center; margin: 20px 0;">
                        Output Size = ⌊(W - F + 2P) / S⌋ + 1
                    </div>

                    <h3>2. Parameter Count Calculation</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Parameters PER Filter:</strong> (F × F × C_in) + 1 (bias)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Total Parameters:</strong> N_filters × ((F × F × C_in) + 1)</div>
                    </div>

                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain Calculation</div>
                        <strong>Input:</strong> 224x224x3 | <strong>Layer:</strong> 64 filters of 3x3 | <strong>Stride:</strong> 1 | <strong>Padding:</strong> 1<br>
                        1. <strong>Output Size:</strong> (224 - 3 + 2(1))/1 + 1 = 224 (Same Padding)<br>
                        2. <strong>Params:</strong> 64 * (3 * 3 * 3 + 1) = 64 * 28 = <strong>1,792 parameters</strong><br>
                        3. <strong>FLOPs:</strong> 224 * 224 * 1792 ≈ <strong>90 Million operations</strong> per image!
                    </div>
                `
            },
            "viz-filters": {
                overview: `
                    <h3>What CNNs Learn</h3>
                    <p>CNN filters automatically learn hierarchical visual features:</p>
                    
                    <h3>Layer-by-Layer Visualization</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Layer 1:</strong> Edges and colors (horizontal, vertical, diagonal lines)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Layer 2:</strong> Textures and patterns (corners, curves, simple shapes)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Layer 3:</strong> Object parts (eyes, wheels, windows)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">04</div>
                        <div><strong>Layer 4-5:</strong> Whole objects (faces, cars, animals)</div>
                    </div>
                `,
                concepts: `
                    <h3>Visualization Techniques</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Activation Maximization:</strong> Find input that maximizes filter response</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Grad-CAM:</strong> Highlight important regions for predictions</div>
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🔍 Model Interpretability</div>
                        <div class="box-content">
                            Understanding what CNNs learn helps debug failures, build trust, and improve architecture design
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🎨 Art & Style Transfer</div>
                        <div class="box-content">
                            Filter visualizations inspired neural style transfer (VGG features)
                        </div>
                    </div>
                `
            },
            "lenet": {
                overview: `
                    <h3>LeNet-5 (1998) - The Pioneer</h3>
                    <p>First successful CNN for digit recognition (MNIST). Introduced the Conv → Pool → Conv → Pool pattern still used today.</p>
                    
                    <h3>Architecture</h3>
                    <div class="formula">
                        Input 32×32 → Conv(6 filters, 5×5) → AvgPool → Conv(16 filters, 5×5) → AvgPool → FC(120) → FC(84)→ FC(10)
                    </div>
                    
                    <div class="callout insight">
                        <div class="callout-title">🏆 Historical Impact</div>
                        • Used by US Postal Service for zip code recognition<br>
                        • Proved CNNs work for real-world tasks<br>
                        • Template for modern architectures
                    </div>
                `,
                concepts: `
                    <h3>Key Innovations</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Layered Architecture:</strong> Hierarchical feature extraction</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Shared Weights:</strong> Convolutional parameter sharing</div>
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">✉️ Handwriting Recognition</div>
                        <div class="box-content">
                            USPS mail sorting, check processing, form digitization
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">📚 Educational Foundation</div>
                        <div class="box-content">
                            Perfect starting point for learning CNNs - simple enough to understand, complex enough to be useful
                        </div>
                    </div>
                `
            },
            "alexnet": {
                overview: `
                    <h3>AlexNet (2012) - The Deep Learning Revolution</h3>
                    <p>Won ImageNet 2012 by huge margin (15.3% vs 26.2% error), igniting the deep learning revolution.</p>
                    
                    <h3>Key Innovations</h3>
                    <ul>
                        <li><strong>ReLU Activation:</strong> Faster training than sigmoid/tanh</li>
                        <li><strong>Dropout:</strong> Prevents overfitting (p=0.5)</li>
                        <li><strong>Data Augmentation:</strong> Random crops/flips</li>
                        <li><strong>GPU Training:</strong> Used 2 GTX580 GPUs</li>
                        <li><strong>Deep:</strong> 8 layers (5 conv + 3 FC), 60M parameters</li>
                    </ul>
                    
                    <div class="callout tip">
                        <div class="callout-title">💡 Why So Important?</div>
                        First to show that deeper networks + more data + GPU compute = breakthrough performance
                    </div>
                `,
                concepts: `
                    <h3>Technical Contributions</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>ReLU:</strong> Solved vanishing gradients, enabled deeper networks</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Dropout:</strong> First major regularization for deep nets</div>
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🎯 ImageNet Challenge</div>
                        <div class="box-content">
                            Shattered records on 1000-class classification, proving deep learning superiority
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🚀 Industry Catalyst</div>
                        <div class="box-content">
                            Sparked AI renaissance - Google, Facebook, Microsoft pivoted to deep learning after AlexNet
                        </div>
                    </div>
                `,
                math: `
                    <h3>Paper & Pain: Parameter Counting</h3>
                    <p>Understanding AlexNet's 60M parameters:</p>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Conv Layers:</strong> Only ~2.3 Million parameters. They do most of the work with small memory!</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>FC Layers:</strong> Over **58 Million parameters**. The first FC layer (FC6) takes 4096 * (6*6*256) ≈ 37M params!</div>
                    </div>
                    <div class="callout warning">
                        <div class="callout-title">⚠️ The Design Flaw</div>
                        FC layers are the memory bottleneck. Modern models (ResNet, Inception) replace these with Global Average Pooling to save 90% parameters.
                    </div>
                `
            },
            "vgg": {
                overview: `
                    <h3>VGGNet (2014) - The Power of Depth</h3>
                    <p>VGG showed that depth matters - 16-19 layers using only small 3×3 filters.</p>
                `,
                concepts: `
                    <h3>Small Filters, Receptive Field</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Uniformity:</strong> Uses 3×3 filters everywhere with stride 1, padding 1.</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Pooling Pattern:</strong> 2×2 max pooling after every 2-3 conv layers.</div>
                    </div>
                `,
                math: `
                    <h3>The 5×5 vs 3×3+3×3 Equivalence</h3>
                    <p>Why stack 3x3 filters instead of one large filter?</p>
                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: Paramount Efficiency</div>
                        1. **Receptive Field:** Two 3x3 layers cover 5x5 area. Three 3x3 layers cover 7x7 area.<br>
                        2. **Param Count (C filters):**<br>
                        • One 7x7 layer: 7² × C² = 49C² parameters.<br>
                        • Three 3x3 layers: 3 × (3² × C²) = 27C² parameters.<br>
                        **Result:** 45% reduction in weights for the SAME "view" of the image!
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🖼️ Feature Backbone</div>
                        VGG is the preferred architectural backbone for Neural Style Transfer and early GANs due to its simple, clean feature extraction properties.
                    </div>
                `
            },
            "resnet": {
                overview: `
                    <h3>ResNet (2015) - Residual Connections</h3>
                    <p><strong>Problem:</strong> Very deep networks (>20 layers) had degradation - training accuracy got worse!</p>
                    
                    <h3>Solution: Skip Connections</h3>
                    <div class="formula">
                        Instead of learning H(x), learn residual F(x) = H(x) - x<br>
                        Output: y = F(x) + x  (shortcut connection)
                    </div>
                    
                    <h3>Why Skip Connections Work</h3>
                    <ul>
                        <li><strong>Gradient Flow:</strong> Gradients flow directly through shortcuts</li>
                        <li><strong>Identity Mapping:</strong> Easy to learn identity (just set F(x)=0)</li>
                        <li><strong>Feature Reuse:</strong> Earlier features directly available to later layers</li>
                    </ul>
                    
                    <div class="callout tip">
                        <div class="callout-title">🏆 Impact</div>
                        • Enabled training of 152-layer networks (even 1000+ layers)<br>
                        • Won ImageNet 2015<br>
                        • Skip connections now used everywhere (U-Net, Transformers, etc.)
                    </div>
                `,
                concepts: `
                    <h3>Identity & Projection Shortcuts</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Identity Shortcut:</strong> Used when dimensions match. y = F(x, {W}) + x</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Projection Shortcut (1×1 Conv):</strong> Used when dimensions change. y = F(x, {W}) + W_s x</div>
                    </div>
                `,
                math: `
                    <h3>The Vanishing Gradient Solution</h3>
                    <p>Why do skip connections help? Let's differentiate the output y = F(x) + x:</p>
                    <div class="formula">
                        ∂y/∂x = ∂F/∂x + 1
                    </div>
                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: Gradient Flow</div>
                        The "+1" term acts as a **gradient highway**. Even if the weights in F(x) are small (causing ∂F/∂x → 0), the gradient can still flow through the +1 term. <br>
                        This prevents the gradient from vanishing even in networks with 1000+ layers!
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🏗️ Modern Vision Backbones</div>
                        <div class="box-content">ResNet is the default starting point for nearly all computer vision tasks today (Mask R-CNN, YOLO, etc.).</div>
                    </div>
                `
            },
            "inception": {
                overview: `
                    <h3>Inception/GoogLeNet (2014) - Going Wider</h3>
                    <p>Instead of going deeper, Inception modules go wider - using multiple filter sizes in parallel.</p>
                    
                    <h3>Inception Module</h3>
                    <div class="formula">
                        Input → [1×1 conv] ⊕ [3×3 conv] ⊕ [5×5 conv] ⊕ [3×3 pool] → Concatenate
                    </div>
                `,
                concepts: `
                    <h3>Core Innovations</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>1×1 Bottlenecks:</strong> Dimensionality reduction before expensive convolutions.</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Auxiliary Classifiers:</strong> Used during training to combat gradient vanishing in middle layers.</div>
                    </div>
                `,
                math: `
                    <h3>1×1 Convolution Math (Network-in-Network)</h3>
                    <p>A 1×1 convolution acts like a channel-wise MLP. It maps input channels C to output channels C' using 1×1×C parameters per filter.</p>
                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: Compression</div>
                        Input: 28x28x256 | Target: 28x28x512 with 3x3 Filters.<br>
                        **Direct:** 512 * (3*3*256) ≈ 1.1 Million params.<br>
                        **Inception (1x1 bottleneck to 64):**<br>
                        Step 1 (1x1): 64 * (1*1*256) = 16k params.<br>
                        Step 2 (3x3): 512 * (3*3*64) = 294k params.<br>
                        **Total:** 310k params. **~3.5× reduction in parameters!**
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🏎️ Computational Efficiency</div>
                        Inception designs are optimized for running deep networks on limited compute budgets.
                    </div>
                `
            },
            "mobilenet": {
                overview: `
                    <h3>MobileNet - CNNs for Mobile Devices</h3>
                    <p>Designed for mobile/embedded vision using depthwise separable convolutions.</p>
                    
                    <h3>Depthwise Separable Convolution</h3>
                    <div class="formula">
                        Standard Conv = Depthwise Conv + Pointwise (1×1) Conv
                    </div>
                    
                    <h3>Computation Reduction</h3>
                    <table>
                        <tr>
                            <th>Method</th>
                            <th>Parameters</th>
                            <th>FLOPs</th>
                        </tr>
                        <tr>
                            <td>Standard 3×3 Conv</td>
                            <td>3×3×C_in×C_out</td>
                            <td>High</td>
                        </tr>
                        <tr>
                            <td>Depthwise Separable</td>
                            <td>3×3×C_in + C_in×C_out</td>
                            <td><strong>8-9× less!</strong></td>
                        </tr>
                    </table>
                    
                    <div class="callout tip">
                        <div class="callout-title">✅ Applications</div>
                        • Real-time mobile apps (camera filters, AR)<br>
                        • Edge devices (drones, IoT)<br>
                        • Latency-critical systems<br>
                        • Good accuracy with 10-20× speedup
                    </div>
                `,
                concepts: `
                    <h3>Efficiency Factors</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Width Multiplier (α):</strong> Thins the network by reducing channels.</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Resolution Multiplier (ρ):</strong> Reduces input image size.</div>
                    </div>
                `,
                math: `
                    <h3>Depthwise Separable Math</h3>
                    <p>Standard convolution complexity: F² × C_in × C_out × H × W</p>
                    <p>Separable complexity: (F² × C_in + C_in × C_out) × H × W</p>
                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: The 9× Speedup</div>
                        Reduction ratio is roughly: 1/C_out + 1/F². <br>
                        For 3x3 filters (F=3): Reduction is roughly **1/9th** the computation of standard conv!
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">📱 Edge Devices</div>
                        <div class="box-content">Real-time object detection on smartphones, web browsers (TensorFlow.js), and IoT devices.</div>
                    </div>
                `
            },
            "transfer-learning": {
                overview: `
                    <h3>Transfer Learning - Don't Train from Scratch!</h3>
                    <p>Use pre-trained models (ImageNet) as feature extractors for your custom task.</p>
                    
                    <h3>Two Strategies</h3>
                    <table>
                        <tr>
                            <th>Approach</th>
                            <th>When to Use</th>
                            <th>How</th>
                        </tr>
                        <tr>
                            <td>Feature Extraction</td>
                            <td><strong>Small dataset</strong> (<10K images)</td>
                            <td>Freeze all layers, train only final FC layer</td>
                        </tr>
                        <tr>
                            <td>Fine-tuning</td>
                            <td><strong>Medium dataset</strong> (10K-100K)</td>
                            <td>Freeze early layers, train last few + FC</td>
                        </tr>
                        <tr>
                            <td>Full Training</td>
                            <td><strong>Large dataset</strong> (>1M images)</td>
                            <td>Use pre-trained as initialization, train all</td>
                        </tr>
                    </table>
                    
                    <div class="callout tip">
                        <div class="callout-title">💡 Best Practices</div>
                        • Use pre-trained models when dataset < 100K images<br>
                        • Start with low learning rate (1e-4) for fine-tuning<br>
                        • Popular backbones: ResNet50, EfficientNet, ViT
                    </div>
                `,
                concepts: `
                    <h3>Why Transfer Learning Works</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Feature Hierarchy:</strong> Early layers learn universal features (edges, textures) that transfer across domains</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Domain Similarity:</strong> The more similar source and target domains, the better transfer</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Regularization Effect:</strong> Pre-trained weights act as strong priors, preventing overfitting</div>
                    </div>
                    
                    <h3>Transfer Learning Quadrant</h3>
                    <table>
                        <tr>
                            <th></th>
                            <th>Similar Domain</th>
                            <th>Different Domain</th>
                        </tr>
                        <tr>
                            <td><strong>Large Data</strong></td>
                            <td>Fine-tune all layers</td>
                            <td>Fine-tune top layers</td>
                        </tr>
                        <tr>
                            <td><strong>Small Data</strong></td>
                            <td>Feature extraction</td>
                            <td>Feature extraction (risky)</td>
                        </tr>
                    </table>
                `,
                math: `
                    <h3>Learning Rate Strategies</h3>
                    <p>Different layers need different learning rates during fine-tuning.</p>
                    
                    <div class="formula">
                        Discriminative Fine-tuning:<br>
                        lr_layer_n = lr_base × decay^(L-n)<br>
                        <br>
                        Where L = total layers, n = layer index<br>
                        Example: lr_base=1e-3, decay=0.9<br>
                        Layer 1: 1e-3 × 0.9^9 ≈ 3.9e-4<br>
                        Layer 10: 1e-3 × 0.9^0 = 1e-3
                    </div>
                    
                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: Domain Shift</div>
                        When source and target distributions differ:<br>
<strong>Covariate Shift:</strong> P(X) changes, P(Y|X) same<br>
<strong>Label Shift:</strong> P(Y) changes, P(X|Y) same<br>
<strong>Concept Shift:</strong> P(Y|X) changes<br>
                        Transfer learning handles covariate shift well but struggles with concept shift.
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🏥 Medical Imaging</div>
                        <div class="box-content">
                            Train on ImageNet, fine-tune for X-ray diagnosis with only 1000 labeled images. Achieves 90%+ accuracy vs 60% from scratch.
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🛒 Retail & E-commerce</div>
                        <div class="box-content">
                            Product classification, visual search, inventory management using pre-trained ResNet/EfficientNet models.
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🌍 Satellite Imagery</div>
                        <div class="box-content">
                            Land use classification, deforestation detection, urban planning using models pre-trained on aerial imagery.
                        </div>
                    </div>
                `
            },
            "localization": {
                overview: `
                    <h3>Object Localization</h3>
                    <p>Predict both class and bounding box for a single object in image.</p>
                    
                    <h3>Multi-Task Loss</h3>
                    <div class="formula">
                        Total Loss = L_classification + λ × L_bbox<br>
                        <br>
                        Where:<br>
                        L_classification = Cross-Entropy<br>
                        L_bbox = Smooth L1 or IoU loss<br>
                        λ = balance term (typically 1-10)
                    </div>
                    
                    <h3>Bounding Box Representation</h3>
                    <ul>
                        <li><strong>Option 1:</strong> (x_min, y_min, x_max, y_max)</li>
                        <li><strong>Option 2:</strong> (x_center, y_center, width, height) ← Most common</li>
                    </ul>
                `,
                concepts: `
                    <h3>Localization vs Detection</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Classification:</strong> What is in the image? → "Cat"</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Localization:</strong> Where is the single object? → "Cat at [100, 50, 200, 150]"</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Detection:</strong> Where are ALL objects? → Multiple bounding boxes</div>
                    </div>
                    
                    <h3>Network Architecture</h3>
                    <p>Modify a classification network (ResNet, VGG) by adding a regression head:</p>
                    <div class="formula">
                        CNN Backbone → Feature Map → [Classification Head (1000 classes)]<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;→ [Regression Head (4 coordinates)]
                    </div>
                `,
                math: `
                    <h3>Smooth L1 Loss (Huber Loss)</h3>
                    <p>Combines L1 and L2 loss for robust bounding box regression.</p>
                    
                    <div class="formula">
                        SmoothL1(x) = { 0.5x² if |x| < 1<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ |x| - 0.5 otherwise
                    </div>
                    
                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: Why Smooth L1?</div>
<strong>L2 Loss:</strong> Penalizes large errors too much (squared), sensitive to outliers<br>
<strong>L1 Loss:</strong> Robust to outliers but has discontinuous gradient at 0<br>
<strong>Smooth L1:</strong> Best of both worlds - quadratic near 0, linear for large errors
                    </div>
                    
                    <h3>IoU Loss</h3>
                    <div class="formula">
                        L_IoU = 1 - IoU(pred, target)<br>
                        Where IoU = Intersection / Union
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🚗 Self-Driving Cars</div>
                        <div class="box-content">Localize the primary vehicle ahead for adaptive cruise control</div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">📸 Photo Auto-Crop</div>
                        <div class="box-content">Detect main subject and automatically crop to optimal composition</div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🏥 Medical Imaging</div>
                        <div class="box-content">Localize tumors, organs, or anomalies in X-rays and CT scans</div>
                    </div>
                `
            },
            "rcnn": {
                overview: `
                    <h3>R-CNN Family Evolution</h3>
                    <table>
                        <tr>
                            <th>Model</th>
                            <th>Year</th>
                            <th>Speed (FPS)</th>
                            <th>Key Innovation</th>
                        </tr>
                        <tr>
                            <td>R-CNN</td>
                            <td>2014</td>
                            <td>0.05</td>
                            <td>Selective Search + CNN features</td>
                        </tr>
                        <tr>
                            <td>Fast R-CNN</td>
                            <td>2015</td>
                            <td>0.5</td>
                            <td>RoI Pooling (share conv features)</td>
                        </tr>
                        <tr>
                            <td>Faster R-CNN</td>
                            <td>2015</td>
                            <td>7</td>
                            <td>Region Proposal Network (RPN)</td>
                        </tr>
                        <tr>
                            <td>Mask R-CNN</td>
                            <td>2017</td>
                            <td>5</td>
                            <td>+ Instance Segmentation masks</td>
                        </tr>
                    </table>
                    
                    <div class="callout tip">
                        <div class="callout-title">💡 When to Use</div>
                        Faster R-CNN: Best accuracy for detection (not real-time)<br>
                        Mask R-CNN: Detection + instance segmentation
                    </div>
                `,
                concepts: `
                    <h3>Two-Stage Detection Pipeline</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Stage 1 - Region Proposal:</strong> Find ~2000 candidate regions that might contain objects</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Stage 2 - Classification:</strong> Classify each region and refine bounding box</div>
                    </div>
                    
                    <h3>Region Proposal Network (RPN)</h3>
                    <p>The key innovation of Faster R-CNN - learns to propose regions instead of using hand-crafted algorithms.</p>
                    <div class="formula">
                        RPN Output per location:<br>
                        • k anchor boxes × 4 coordinates = 4k regression outputs<br>
                        • k anchor boxes × 2 objectness scores = 2k classification outputs<br>
                        Typical k = 9 (3 scales × 3 aspect ratios)
                    </div>
                `,
                math: `
                    <h3>RoI Pooling: Fixed-Size Feature Maps</h3>
                    <p>Convert variable-size regions into fixed 7×7 feature maps for FC layers.</p>
                    
                    <div class="formula">
                        For each RoI of size H×W:<br>
                        1. Divide into 7×7 grid (cells of size H/7 × W/7)<br>
                        2. Max-pool each cell → single value<br>
                        3. Output: Fixed 7×7 feature map regardless of input size
                    </div>
                    
                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: RoI Align vs RoI Pool</div>
                        <strong>Problem:</strong> RoI Pooling quantizes coordinates, causing misalignment.<br>
                        <strong>Solution:</strong> RoI Align uses bilinear interpolation instead of rounding.<br>
                        This is critical for Mask R-CNN where pixel-level accuracy matters!
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🏥 Medical Imaging</div>
                        <div class="box-content">High-accuracy tumor detection where speed is less critical than precision</div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">📷 Photo Analysis</div>
                        <div class="box-content">Face detection, scene understanding, object counting in static images</div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🔬 Scientific Research</div>
                        <div class="box-content">Cell detection, particle tracking, microscopy image analysis</div>
                    </div>
                `
            },
            "ssd": {
                overview: `
                    <h3>SSD (Single Shot MultiBox Detector)</h3>
                    <p>Balances speed and accuracy by predicting boxes at multiple scales.</p>
                    
                    <h3>Key Ideas</h3>
                    <ul>
                        <li><strong>Multi-Scale:</strong> Predictions from different layers (early = small objects, deep = large)</li>
                        <li><strong>Default Boxes (Anchors):</strong> Pre-defined boxes of various aspects ratios</li>
                        <li><strong>Single Pass:</strong> No separate region proposal step</li>
                    </ul>
                    
                    <div class="callout insight">
                        <div class="callout-title">📊 Performance</div>
                        SSD300: 59 FPS, 74.3% mAP<br>
                        SSD512: 22 FPS, 76.8% mAP<br>
                        <br>
                        Sweet spot between YOLO (faster) and Faster R-CNN (more accurate)
                    </div>
                `,
                concepts: `
                    <h3>Multi-Scale Feature Maps</h3>
                    <p>SSD makes predictions at multiple layers, each detecting objects at different scales.</p>
                    
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Early Layers (38×38):</strong> Detect small objects (high resolution)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Middle Layers (19×19, 10×10):</strong> Detect medium objects</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Deep Layers (5×5, 3×3, 1×1):</strong> Detect large objects</div>
                    </div>
                    
                    <h3>Default Boxes (Anchors)</h3>
                    <p>At each feature map cell, SSD predicts offsets for k default boxes with different aspect ratios (1:1, 2:1, 1:2, 3:1, 1:3).</p>
                `,
                math: `
                    <h3>SSD Loss Function</h3>
                    <p>Weighted sum of localization and confidence losses.</p>
                    
                    <div class="formula">
                        L(x, c, l, g) = (1/N) × [L_conf(x, c) + α × L_loc(x, l, g)]<br>
                        <br>
                        Where:<br>
                        • L_conf = Softmax loss over class confidences<br>
                        • L_loc = Smooth L1 loss over box coordinates<br>
                        • α = Weight factor (typically 1)<br>
                        • N = Number of matched default boxes
                    </div>
                    
                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: Hard Negative Mining</div>
                        Problem: Most default boxes are background (class imbalance).<br>
                        Solution: Sort negative boxes by confidence loss, pick top ones so pos:neg = 1:3.<br>
                        This focuses training on hard negatives, not easy ones.
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">📹 Video Analytics</div>
                        <div class="box-content">Real-time object detection in security cameras, sports broadcasting</div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🤖 Robotics</div>
                        <div class="box-content">Object detection for manipulation tasks, obstacle avoidance</div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">📱 Mobile Apps</div>
                        <div class="box-content">Lightweight models for on-device detection (MobileNet-SSD)</div>
                    </div>
                `
            },
            "semantic-seg": {
                overview: `
                    <h3>Semantic Segmentation</h3>
                    <p>Classify every pixel in the image (pixel-wise classification).</p>
                    
                    <h3>Popular Architectures</h3>
                    <table>
                        <tr>
                            <th>Model</th>
                            <th>Key Feature</th>
                        </tr>
                        <tr>
                            <td>FCN</td>
                            <td>Fully Convolutional (no FC layers)</td>
                        </tr>
                        <tr>
                            <td>U-Net</td>
                            <td>Skip connections from encoder to decoder</td>
                        </tr>
                        <tr>
                            <td>DeepLab</td>
                            <td>Atrous (dilated) convolutions + ASPP</td>
                        </tr>
                    </table>
                    
                    <div class="formula">
                        U-Net Pattern:<br>
                        Input → Encoder (downsample) → Bottleneck → Decoder (upsample) → Pixel-wise Output<br>
                        With skip connections from encoder to decoder at each level
                    </div>
                `,
                concepts: `
                    <h3>Key Concepts</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Encoder-Decoder:</strong> Downsample to capture context, upsample to recover spatial detail</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Skip Connections:</strong> Pass high-resolution features from encoder to decoder (U-Net)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Atrous Convolution:</strong> Expand receptive field without losing resolution (DeepLab)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">04</div>
                        <div><strong>ASPP:</strong> Atrous Spatial Pyramid Pooling - capture multi-scale context</div>
                    </div>
                `,
                math: `
                    <h3>Dice Loss for Segmentation</h3>
                    <p>Better than cross-entropy for imbalanced classes (small objects).</p>
                    
                    <div class="formula">
                        Dice = 2 × |A ∩ B| / (|A| + |B|)<br>
                        Dice Loss = 1 - Dice<br>
                        <br>
                        Where A = predicted mask, B = ground truth mask
                    </div>
                    
                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: Why Dice > Cross-Entropy?</div>
                        If only 1% of pixels are foreground:<br>
                        • Cross-Entropy: Model can get 99% accuracy by predicting all background!<br>
                        • Dice: Penalizes missed foreground pixels heavily<br>
                        • Often use combination: L = BCE + Dice
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🏥 Medical Imaging</div>
                        <div class="box-content">Tumor segmentation, organ delineation, cell analysis</div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🚗 Autonomous Driving</div>
                        <div class="box-content">Road segmentation, free space detection, drivable area</div>
                    </div>
                `
            },
            "instance-seg": {
                overview: `
                    <h3>Instance Segmentation</h3>
                    <p>Detect AND segment each individual object (combines object detection + semantic segmentation).</p>
                    
                    <h3>Difference from Semantic Segmentation</h3>
                    <ul>
                        <li><strong>Semantic:</strong> All "person" pixels get same label</li>
                        <li><strong>Instance:</strong> Person #1, Person #2, Person #3 (separate instances)</li>
                    </ul>
                    
                    <h3>Main Approach: Mask R-CNN</h3>
                    <div class="formula">
                        Faster R-CNN + Segmentation Branch<br>
                        <br>
                        For each RoI:<br>
                        1. Bounding box regression<br>
                        2. Class prediction<br>
                        3. <strong>Binary mask for the object</strong>
                    </div>
                `,
                concepts: `
                    <h3>Mask R-CNN Architecture</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Backbone:</strong> ResNet-50/101 with Feature Pyramid Network (FPN)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>RPN:</strong> Region Proposal Network (same as Faster R-CNN)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>RoI Align:</strong> Better than RoI Pooling (no quantization)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">04</div>
                        <div><strong>Mask Head:</strong> Small FCN that outputs 28×28 binary mask per class</div>
                    </div>
                `,
                math: `
                    <h3>Multi-Task Loss</h3>
                    <p>Mask R-CNN optimizes three losses simultaneously:</p>
                    
                    <div class="formula">
                        L = L_cls + L_box + L_mask<br>
                        <br>
                        Where:<br>
                        • L_cls = Classification loss (cross-entropy)<br>
                        • L_box = Bounding box regression (smooth L1)<br>
                        • L_mask = Binary cross-entropy per-pixel mask loss
                    </div>
                    
                    <div class="callout insight">
                        <div class="callout-title">📝 Key Insight: Decoupled Masks</div>
                        Mask R-CNN predicts a binary mask for EACH class independently.<br>
                        This avoids competition between classes and improves accuracy.
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">📸 Photo Editing</div>
                        <div class="box-content">Auto-select objects for editing, background removal, composition</div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🤖 Robotics</div>
                        <div class="box-content">Object manipulation - need exact shape, not just bounding box</div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🎬 Video Production</div>
                        <div class="box-content">Rotoscoping, VFX, green screen replacement</div>
                    </div>
                `
            },
            "face-recog": {
                overview: `
                    <h3>Face Recognition with Siamese Networks</h3>
                    <p>Learn similarity between faces using metric learning instead of classification.</p>
                    
                    <h3>Triplet Loss Training</h3>
                    <div class="formula">
                        Loss = max(||f(A) - f(P)||² - ||f(A) - f(N)||² + margin, 0)<br>
                        <br>
                        Where:<br>
                        A = Anchor (reference face)<br>
                        P = Positive (same person)<br>
                        N = Negative (different person)<br>
                        margin = minimum separation (e.g., 0.2)
                    </div>
                    
                    <div class="callout tip">
                        <div class="callout-title">💡 One-Shot Learning</div>
                        After training, recognize new people with just 1-2 photos!<br>
                        No retraining needed - just compare embeddings.
                    </div>
                `,
                concepts: `
                    <h3>Face Recognition Pipeline</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Face Detection:</strong> Find faces in image (MTCNN, RetinaFace)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Alignment:</strong> Normalize face orientation and scale</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Embedding:</strong> Extract 128/512-dim feature vector (FaceNet, ArcFace)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">04</div>
                        <div><strong>Matching:</strong> Compare embeddings with cosine similarity or L2 distance</div>
                    </div>
                    
                    <h3>Key Models</h3>
                    <table>
                        <tr><th>Model</th><th>Key Innovation</th></tr>
                        <tr><td>FaceNet</td><td>Triplet loss, 128-dim embedding</td></tr>
                        <tr><td>ArcFace</td><td>Additive angular margin loss, SOTA accuracy</td></tr>
                        <tr><td>DeepFace</td><td>Facebook's early success</td></tr>
                    </table>
                `,
                math: `
                    <h3>Triplet Loss Intuition</h3>
                    <p>Push same-person faces closer, different-person faces apart.</p>
                    
                    <div class="formula">
                        ||f(A) - f(P)||² + margin < ||f(A) - f(N)||²
                    </div>
                    
                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: Hard Triplet Mining</div>
                        Easy triplets: Random selection - margin already satisfied, loss=0<br>
                        Hard triplets: Find P closest to anchor, N closest to anchor from different class<br>
                        <strong>Training on hard triplets is critical for convergence!</strong>
                    </div>
                    
                    <h3>ArcFace Angular Margin</h3>
                    <div class="formula">
                        L = -log(e^(s·cos(θ + m)) / (e^(s·cos(θ + m)) + Σ e^(s·cos(θ_j))))<br>
                        Where m = angular margin, s = scale factor
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">📱 Phone Unlock</div>
                        <div class="box-content">Face ID, biometric authentication</div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🔒 Security</div>
                        <div class="box-content">Access control, surveillance, identity verification</div>
                    </div>
                `
            },
            "autoencoders": {
                overview: `
                    <h3>Autoencoders</h3>
                    <p>Unsupervised learning to compress data into latent representation and reconstruct it.</p>
                    
                    <h3>Architecture</h3>
                    <div class="formula">
                        Input → Encoder → Latent Code (bottleneck) → Decoder → Reconstruction<br>
                        <br>
                        Loss = ||Input - Reconstruction||² (MSE)
                    </div>
                    
                    <h3>Variants</h3>
                    <ul>
                        <li><strong>Vanilla:</strong> Basic autoencoder</li>
                        <li><strong>Denoising:</strong> Input corrupted, output clean (learns robust features)</li>
                        <li><strong>Variational (VAE):</strong> Probabilistic latent space (for generation)</li>
                        <li><strong>Sparse:</strong> Encourage sparse activations</li>
                    </ul>
                `,
                concepts: `
                    <h3>Key Concepts</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Bottleneck:</strong> Force information compression by using fewer dimensions than input</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Reconstruction:</strong> Learn to recreate input - captures essential features</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Latent Space:</strong> Compressed representation captures data structure</div>
                    </div>
                    
                    <h3>Variational Autoencoder (VAE)</h3>
                    <p>Instead of encoding to a point, encode to a probability distribution (mean + variance).</p>
                    <div class="formula">
                        Encoder outputs: μ (mean) and σ (standard deviation)<br>
                        Sample: z = μ + σ × ε (where ε ~ N(0,1))<br>
                        This is the "reparameterization trick" for backprop!
                    </div>
                `,
                math: `
                    <h3>VAE Loss Function (ELBO)</h3>
                    <p>VAE maximizes the Evidence Lower Bound:</p>
                    
                    <div class="formula">
                        L = E[log p(x|z)] - KL(q(z|x) || p(z))<br>
                        <br>
                        Where:<br>
                        • First term: Reconstruction quality<br>
                        • Second term: KL divergence regularization (push q toward N(0,1))
                    </div>
                    
                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: KL Divergence</div>
                        For Gaussians:<br>
                        KL = -0.5 × Σ(1 + log(σ²) - μ² - σ²)<br>
                        This has a closed-form solution - no sampling needed!
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🗜️ Compression</div>
                        <div class="box-content">Dimensionality reduction, data compression, feature extraction</div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🔍 Anomaly Detection</div>
                        <div class="box-content">High reconstruction error = anomaly (fraud detection, defect detection)</div>
                    </div>
                `
            },
            "gans": {
                overview: `
                    <h3>GANs (Generative Adversarial Networks)</h3>
                    <p>Two networks compete: Generator creates fake data, Discriminator tries to detect fakes.</p>
                    
                    <h3>The GAN Game</h3>
                    <div class="formula">
                        Generator: Creates fake images from random noise<br>
                        Goal: Fool discriminator<br>
                        <br>
                        Discriminator: Classifies real vs fake<br>
                        Goal: Correctly identify fakes<br>
                        <br>
                        Minimax Loss:<br>
                        min_G max_D E[log D(x)] + E[log(1 - D(G(z)))]
                    </div>
                    
                    <div class="callout warning">
                        <div class="callout-title">⚠️ Training Challenges</div>
                        • Mode collapse (Generator produces limited variety)<br>
                        • Training instability (careful tuning needed)<br>
                        • Convergence issues<br>
                        • Solutions: Wasserstein GAN, Spectral Normalization, StyleGAN improvements
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🎨 Image Generation</div>
                        <div class="box-content">
                            <strong>StyleGAN:</strong> Photorealistic faces, art generation<br>
                            <strong>DCGAN:</strong> Bedroom images, object generation
                        </div>
                    </div>
                `,
                math: `
                    <h3>The Minimax Game Objective</h3>
                    <p>The original GAN objective from Ian Goodfellow (2014) is a zero-sum game between Discriminator (D) and Generator (G).</p>
                    
                    <div class="formula" style="font-size: 1.1rem; padding: 20px;">
                        min_G max_D V(D, G) = E_x∼p_data[log D(x)] + E_z∼p_z[log(1 - D(G(z)))]
                    </div>

                    <h3>Paper & Pain: Finding the Optimal Discriminator</h3>
                    <p>For a fixed Generator, the optimal Discriminator D* is:</p>
                    <div class="formula">
                        D*(x) = p_data(x) / (p_data(x) + p_g(x))
                    </div>
                    
                    <div class="callout insight">
                        <div class="callout-title">📝 Theoretical Insight</div>
                        When the Discriminator is optimal, the Generator's task is essentially to minimize the <strong>Jensen-Shannon Divergence (JSD)</strong> between the data distribution and the model distribution. <br>
                        <strong>Problem:</strong> JSD is "flat" when distributions don't overlap, leading to vanishing gradients. This is why <strong>Wasserstein GAN (WGAN)</strong> was invented—using Earth Mover's distance instead!
                    </div>

                    <h3>Generator Gradient Problem</h3>
                    <p>Early in training, D(G(z)) is near 0. The term log(1-D(G(z))) has a very small gradient. </p>
                    <div class="list-item">
                        <div class="list-num">💡</div>
                        <div><strong>Heuristic Fix:</strong> Instead of minimizing log(1-D(G(z))), we maximize <strong>log D(G(z))</strong>. This provides much stronger gradients early on!</div>
                    </div>
                `
            },
            "diffusion": {
                overview: `
                    <h3>Diffusion Models</h3>
                    <p>Learn to reverse a gradual noising process, generating high-quality images.</p>
                    
                    <h3>How Diffusion Works</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Forward Process:</strong> Gradually add Gaussian noise over T steps (x₀ → x₁ → ... → x_T = pure noise)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Reverse Process:</strong> Train neural network to denoise (x_T → x_{T-1} → ... → x₀ = clean image)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Generation:</strong> Start from random noise, iteratively denoise T steps</div>
                    </div>
                    
                    <div class="callout tip">
                        <div class="callout-title">✅ Advantages over GANs</div>
                        • More stable training (no adversarial dynamics)<br>
                        • Better sample quality and diversity<br>
                        • Mode coverage (no mode collapse)<br>
                        • Controllable generation (text-to-image)
                    </div>
                `,
                concepts: `
                    <h3>Key Components</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>U-Net Backbone:</strong> Encoder-decoder with skip connections predicts noise at each step</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Time Embedding:</strong> Tell the model which timestep it's at (sinusoidal encoding)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>CLIP Conditioning:</strong> Guide generation with text embeddings (Stable Diffusion)</div>
                    </div>
                    
                    <h3>Latent Diffusion</h3>
                    <p>Instead of diffusing in pixel space (expensive), work in VAE latent space (8× smaller).</p>
                    <div class="formula">
                        Image (512×512×3) → VAE Encoder → Latent (64×64×4) → Diffuse → Decode
                    </div>
                `,
                math: `
                    <h3>Forward Process (Noising)</h3>
                    <p>Add Gaussian noise according to a schedule β_t:</p>
                    
                    <div class="formula">
                        q(x_t | x_{t-1}) = N(x_t; √(1-β_t) × x_{t-1}, β_t × I)<br>
                        <br>
                        Or in closed form for any t:<br>
                        x_t = √(ᾱ_t) × x_0 + √(1-ᾱ_t) × ε<br>
                        Where ᾱ_t = Π_{s=1}^t (1-β_s)
                    </div>
                    
                    <h3>Training Objective</h3>
                    <p>Simple noise prediction loss:</p>
                    <div class="formula">
                        L = E[||ε - ε_θ(x_t, t)||²]
                    </div>
                    
                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: Simplified Loss</div>
                        The full variational bound is complex, but Ho et al. (2020) showed this simple MSE loss on noise prediction works just as well and is much easier to implement!
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🖼️ Text-to-Image</div>
                        <div class="box-content">
                            <strong>Stable Diffusion:</strong> Open-source, runs on consumer GPUs<br>
                            <strong>DALL-E 2:</strong> OpenAI's photorealistic generator<br>
                            <strong>Midjourney:</strong> Artistic image generation
                        </div>
                    </div>
                `
            },
            "rnn": {
                overview: `
                    <h3>RNNs & LSTMs</h3>
                    <p>Process sequences by maintaining hidden state that captures past information.</p>
                    
                    <h3>The Vanishing Gradient Problem</h3>
                    <p><strong>Problem:</strong> Standard RNNs can't learn long-term dependencies (gradients vanish over many time steps)</p>
                    <p><strong>Solution:</strong> LSTM (Long Short-Term Memory) with gating mechanisms</p>
                    
                    <h3>LSTM Gates</h3>
                    <ul>
                        <li><strong>Forget Gate:</strong> What to remove from cell state</li>
                        <li><strong>Input Gate:</strong> What new information to add</li>
                        <li><strong>Output Gate:</strong> What to output as hidden state</li>
                    </ul>
                    
                    <div class="callout warning">
                        <div class="callout-title">⚠️ Limitation</div>
                        Sequential processing (can't parallelize) - Transformers solved this!
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">📝 Text Generation</div>
                        <div class="box-content">Character-level generation, autocomplete (before Transformers)</div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🎵 Time Series</div>
                        <div class="box-content">Stock prediction, weather forecasting, music generation</div>
                    </div>
                `,
                math: `
                    <h3>RNN State Equations</h3>
                    <p>Standard RNN processes a sequence x₁, x₂, ..., xₜ using a recurring hidden state hₜ.</p>
                    
                    <div class="formula">
                        hₜ = tanh(Wₕₕhₜ₋₁ + Wₓₕxₜ + bₕ)<br>
                        yₜ = Wₕᵧhₜ + bᵧ
                    </div>

                    <h3>Paper & Pain: The Vanishing Gradient Derivation</h3>
                    <p>Why do RNNs fail on long sequences? Let's check the gradient ∂L/∂h₁:</p>
                    <div class="formula">
                        ∂L/∂h₁ = (∂L/∂hₜ) × (∂hₜ/∂hₜ₋₁) × (∂hₜ₋₁/∂hₜ₋₂) × ... × (∂h₂/∂h₁)<br>
                        <br>
                        Where ∂hⱼ/∂hⱼ₋₁ = Wₕₕᵀ diag(tanh'(zⱼ))
                    </div>
                    <div class="callout warning">
                        <div class="callout-title">⚠️ The Power Effect</div>
                        If the largest eigenvalue of Wₕₕ < 1: Gradients <strong>shrink exponentially</strong> (0.9¹⁰⁰ ≈ 0.00002).<br>
                        If > 1: Gradients <strong>explode</strong>.<br>
                        <strong>LSTM Solution:</strong> The "Constant Error Carousel" (CEC) ensures gradients flow via the cell state without multiplication.
                    </div>

                    <h3>LSTM Gating Math</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div>Forget Gate: fₜ = σ(W_f[hₜ₋₁, xₜ] + b_f)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div>Input Gate: iₜ = σ(W_i[hₜ₋₁, xₜ] + b_i)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div>Cell State Update: cₜ = fₜcₜ₋₁ + iₜtanh(W_c[hₜ₋₁, xₜ] + b_c)</div>
                    </div>
                `
            },
            "bert": {
                overview: `
                    <h3>BERT (Bidirectional Encoder Representations from Transformers)</h3>
                    <p>Pre-trained encoder-only Transformer for understanding language (not generation).</p>
                    
                    <h3>Key Innovation: Bidirectional Context</h3>
                    <p>Unlike GPT (left-to-right), BERT sees both left AND right context simultaneously.</p>
                    
                    <h3>Pre-training Tasks</h3>
                    <ul>
                        <li><strong>Masked Language Modeling:</strong> Mask 15% of tokens, predict them (e.g., "The cat [MASK] on the mat" → predict "sat")</li>
                        <li><strong>Next Sentence Prediction:</strong> Predict if sentence B follows A</li>
                    </ul>
                    
                    <div class="callout tip">
                        <div class="callout-title">💡 Fine-tuning BERT</div>
                        1. Start with pre-trained BERT (trained on billions of words)<br>
                        2. Add task-specific head (classification, QA, NER)<br>
                        3. Fine-tune on your dataset (10K-100K examples)<br>
                        4. Achieves SOTA with minimal data!
                    </div>
                `,
                concepts: `
                    <h3>BERT Architecture</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Encoder Only:</strong> 12/24 Transformer encoder layers (BERT-base/large)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Token Embedding:</strong> WordPiece tokenization (30K vocab)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Segment Embedding:</strong> Distinguish sentence A from sentence B</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">04</div>
                        <div><strong>[CLS] Token:</strong> Aggregated representation for classification tasks</div>
                    </div>
                    
                    <h3>Model Sizes</h3>
                    <table>
                        <tr><th>Model</th><th>Layers</th><th>Hidden</th><th>Params</th></tr>
                        <tr><td>BERT-base</td><td>12</td><td>768</td><td>110M</td></tr>
                        <tr><td>BERT-large</td><td>24</td><td>1024</td><td>340M</td></tr>
                    </table>
                `,
                math: `
                    <h3>Masked Language Modeling (MLM)</h3>
                    <p>BERT's main pre-training objective:</p>
                    
                    <div class="formula">
                        L_MLM = -Σ log P(x_masked | x_visible)<br>
                        <br>
                        For each masked token, predict using cross-entropy loss
                    </div>
                    
                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: Masking Strategy</div>
                        Of the 15% tokens selected for masking:<br>
                        • 80% → [MASK] token<br>
                        • 10% → Random token<br>
                        • 10% → Keep original<br>
                        This prevents over-reliance on [MASK] during fine-tuning!
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🔍 Search & QA</div>
                        <div class="box-content">
                            <strong>Google Search:</strong> Uses BERT for understanding queries<br>
                            Question answering systems, document retrieval
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">📊 Text Classification</div>
                        <div class="box-content">Sentiment analysis, topic classification, spam detection</div>
                    </div>
                `
            },
            "gpt": {
                overview: `
                    <h3>GPT (Generative Pre-trained Transformer)</h3>
                    <p>Decoder-only Transformer trained to predict next token (autoregressive language modeling).</p>
                    
                    <h3>GPT Evolution</h3>
                    <table>
                        <tr>
                            <th>Model</th>
                            <th>Params</th>
                            <th>Training Data</th>
                            <th>Capability</th>
                        </tr>
                        <tr>
                            <td>GPT-1</td>
                            <td>117M</td>
                            <td>BooksCorpus</td>
                            <td>Basic text generation</td>
                        </tr>
                        <tr>
                            <td>GPT-2</td>
                            <td>1.5B</td>
                            <td>WebText (40GB)</td>
                            <td>Coherent paragraphs</td>
                        </tr>
                        <tr>
                            <td>GPT-3</td>
                            <td>175B</td>
                            <td>570GB text</td>
                            <td>Few-shot learning</td>
                        </tr>
                        <tr>
                            <td>GPT-4</td>
                            <td>~1.8T</td>
                            <td>Multi-modal</td>
                            <td>Reasoning, coding, images</td>
                        </tr>
                    </table>
                    
                    <div class="callout insight">
                        <div class="callout-title">🚀 Emergent Abilities</div>
                        As models scale, new capabilities emerge:<br>
                        • In-context learning (learn from prompts)<br>
                        • Chain-of-thought reasoning<br>
                        • Code generation<br>
                        • Multi-step problem solving
                    </div>
                `,
                concepts: `
                    <h3>GPT Architecture</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Decoder Only:</strong> Uses causal (masked) attention - can only see past tokens</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Autoregressive:</strong> Generate one token at a time, feed back as input</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Pre-training:</strong> Next token prediction on massive text corpus</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">04</div>
                        <div><strong>RLHF:</strong> Reinforcement Learning from Human Feedback (ChatGPT)</div>
                    </div>
                    
                    <h3>In-Context Learning</h3>
                    <p>GPT-3+ can learn from examples in the prompt without updating weights!</p>
                    <div class="formula">
                        Zero-shot: "Translate to French: Hello" → "Bonjour"<br>
                        Few-shot: "cat→chat, dog→chien, house→?" → "maison"
                    </div>
                `,
                math: `
                    <h3>Causal Language Modeling</h3>
                    <p>GPT is trained to maximize the likelihood of the next token:</p>
                    
                    <div class="formula">
                        L = -Σ log P(x_t | x_{<t})<br>
                        <br>
                        Where P(x_t | x_{<t}) = softmax(h_t × W_vocab)
                    </div>
                    
                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: Scaling Laws</div>
                        Performance scales predictably with compute, data, and parameters:<br>
                        L ∝ N^(-0.076) for model size N<br>
                        This is why OpenAI trained GPT-3 (175B) and GPT-4 (1.8T)!
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">💬 ChatGPT & Assistants</div>
                        <div class="box-content">
                            Conversational AI, customer support, tutoring, brainstorming
                        </div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">💻 Code Generation</div>
                        <div class="box-content">
                            GitHub Copilot, code completion, bug fixing, documentation
                        </div>
                    </div>
                `
            },
            "vit": {
                overview: `
                    <h3>Vision Transformer (ViT)</h3>
                    <p>Apply Transformer architecture directly to images by treating them as sequences of patches.</p>
                    
                    <h3>How ViT Works</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Patchify:</strong> Split 224×224 image into 16×16 patches (14×14 = 196 patches)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Linear Projection:</strong> Flatten each patch → linear embedding (like word embeddings)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Positional Encoding:</strong> Add position information</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">04</div>
                        <div><strong>Transformer Encoder:</strong> Standard Transformer (self-attention, FFN)</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">05</div>
                        <div><strong>Classification:</strong> Use [CLS] token for final prediction</div>
                    </div>
                    
                    <div class="callout tip">
                        <div class="callout-title">💡 When ViT Shines</div>
<strong>Large Datasets:</strong> Needs 10M+ images (or pre-training on ImageNet-21K)<br>
<strong>Transfer Learning:</strong> Pre-trained ViT beats CNNs on many tasks<br>
<strong>Long-Range Dependencies:</strong> Global attention vs CNN's local receptive field
                    </div>
                `,
                concepts: `
                    <h3>ViT vs CNN Comparison</h3>
                    <table>
                        <tr><th>Aspect</th><th>CNN</th><th>ViT</th></tr>
                        <tr><td>Inductive Bias</td><td>Locality, translation invariance</td><td>Minimal - learns from data</td></tr>
                        <tr><td>Data Efficiency</td><td>Better with small datasets</td><td>Needs large datasets</td></tr>
                        <tr><td>Receptive Field</td><td>Local (grows with depth)</td><td>Global from layer 1</td></tr>
                        <tr><td>Scalability</td><td>Diminishing returns</td><td>Scales well with compute</td></tr>
                    </table>
                    
                    <h3>Key Innovations</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>No Convolutions:</strong> Pure attention - "An Image is Worth 16x16 Words"</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Learnable Position:</strong> Position embeddings are learned, not sinusoidal</div>
                    </div>
                `,
                math: `
                    <h3>Patch Embedding</h3>
                    <p>Convert image patches to token embeddings:</p>
                    
                    <div class="formula">
                        z_0 = [x_cls; x_p^1 E; x_p^2 E; ...; x_p^N E] + E_pos<br>
                        <br>
                        Where:<br>
                        • x_p^i = flattened patch (16×16×3 = 768 dimensions)<br>
                        • E = learnable linear projection<br>
                        • E_pos = position embedding
                    </div>
                    
                    <div class="callout insight">
                        <div class="callout-title">📝 Paper & Pain: Computation</div>
                        ViT-Base: 12 layers, 768 hidden, 12 heads ~ 86M params<br>
                        Self-attention cost: O(n²·d) where n=196 patches<br>
                        This is why ViT is efficient for images (196 tokens) vs text (1000+ tokens)
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">🖼️ Image Classification</div>
                        <div class="box-content">SOTA on ImageNet with pre-training. Google/DeepMind use for internal systems.</div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🔍 Object Detection</div>
                        <div class="box-content">DETR, DINO - Transformer-based detection replacing Faster R-CNN</div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🎬 Video Understanding</div>
                        <div class="box-content">VideoViT, TimeSformer - extend patches to 3D (space + time)</div>
                    </div>
                `
            },
            "gnn": {
                overview: `
                    <h3>Graph Neural Networks (GNNs)</h3>
                    <p>Deep learning on non-Euclidean data structures like social networks, molecules, and knowledge graphs.</p>
                    
                    <h3>Key Concepts</h3>
                    <div class="list-item">
                        <div class="list-num">01</div>
                        <div><strong>Graph Structure:</strong> Nodes (entities) and Edges (relationships).</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">02</div>
                        <div><strong>Message Passing:</strong> Nodes exchange information with neighbors.</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">03</div>
                        <div><strong>Aggregation:</strong> Combine incoming messages (Sum, Mean, Max).</div>
                    </div>
                    
                    <div class="callout tip">
                        <div class="callout-title">💡 Why GNNs?</div>
                        Standard CNNs expect a fixed grid (euclidean). Graphs have arbitrary size and topology. GNNs are permutation invariant!
                    </div>
                `,
                concepts: `
                    <h3>Message Passing Neural Networks (MPNN)</h3>
                    <p>The core framework for most GNNs.</p>
                    
                    <div class="list-item">
                        <div class="list-num">1</div>
                        <div><strong>Message Function:</strong> Compute message from neighbor to node.</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">2</div>
                        <div><strong>Aggregation Function:</strong> Sum all messages from neighbors.</div>
                    </div>
                    <div class="list-item">
                        <div class="list-num">3</div>
                        <div><strong>Update Function:</strong> Update node state based on aggregated messages.</div>
                    </div>
                `,
                math: `
                    <h3>Graph Convolution Network (GCN)</h3>
                    <p>The "Hello World" of GNNs (Kipf & Welling, 2017).</p>
                    
                    <div class="formula">
                        H^{(l+1)} = σ(D^{-1/2} A D^{-1/2} H^{(l)} W^{(l)})
                    </div>
                    
                    <p>Where:</p>
                    <ul>
                        <li><strong>A:</strong> Adjacency Matrix (connections)</li>
                        <li><strong>D:</strong> Degree Matrix (number of connections)</li>
                        <li><strong>H:</strong> Node Features</li>
                        <li><strong>W:</strong> Learnable Weights</li>
                    </ul>
                    
                    <div class="callout warning">
                        <div class="callout-title">⚠️ Over-smoothing</div>
                        If GNN is too deep, all node representations become indistinguishable. Usually 2-4 layers are enough.
                    </div>
                `,
                applications: `
                    <div class="info-box">
                        <div class="box-title">💊 Drug Discovery</div>
                        <div class="box-content">Predicting molecular properties, protein folding (AlphaFold)</div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🚗 Traffic Prediction</div>
                        <div class="box-content">Road networks, estimating travel times (Google Maps)</div>
                    </div>
                    <div class="info-box">
                        <div class="box-title">🛒 Recommender Systems</div>
                        <div class="box-content">Pinterest (PinSage), User-Item graphs</div>
                    </div>
                `
            }
        };

        function createModuleHTML(module) {
            const content = MODULE_CONTENT[module.id] || {};

            return `
                <div class="module" id="${module.id}-module">
                    <button class="btn-back" onclick="switchTo('dashboard')">← Back to Dashboard</button>
                    <header>
                        <h1>${module.icon} ${module.title}</h1>
                        <p class="subtitle">${module.description}</p>
                    </header>

                    <div class="tabs">
                        <button class="tab-btn active" onclick="switchTab(event, '${module.id}-overview')">Overview</button>
                        <button class="tab-btn" onclick="switchTab(event, '${module.id}-concepts')">Key Concepts</button>
                        <button class="tab-btn" onclick="switchTab(event, '${module.id}-visualization')">📊 Visualization</button>
                        <button class="tab-btn" onclick="switchTab(event, '${module.id}-math')">Math</button>
                        <button class="tab-btn" onclick="switchTab(event, '${module.id}-applications')">Applications</button>
                        <button class="tab-btn" onclick="switchTab(event, '${module.id}-summary')">Summary</button>
                    </div>

                    <div id="${module.id}-overview" class="tab active">
                        <div class="section">
                            <h2>📖 Overview</h2>
                            ${content.overview || `
                                <p>Complete coverage of ${module.title.toLowerCase()}. Learn the fundamentals, mathematics, real-world applications, and implementation details.</p>
                                <div class="info-box">
                                    <div class="box-title">Learning Objectives</div>
                                    <div class="box-content">
                                        ✓ Understand core concepts and theory<br>
                                        ✓ Master mathematical foundations<br>
                                        ✓ Learn practical applications<br>
                                        ✓ Implement and experiment
                                    </div>
                                </div>
                            `}
                        </div>
                    </div>

                    <div id="${module.id}-concepts" class="tab">
                        <div class="section">
                            <h2>🎯 Key Concepts</h2>
                            ${content.concepts || `
                                <p>Fundamental concepts and building blocks for ${module.title.toLowerCase()}.</p>
                                <div class="callout insight">
                                    <div class="callout-title">💡 Main Ideas</div>
                                    This section covers the core ideas you need to understand before diving into mathematics.
                                </div>
                            `}
                        </div>
                    </div>

                    <div id="${module.id}-visualization" class="tab">
                        <div class="section">
                            <h2>📊 Interactive Visualization</h2>
                            <p>Visual representation to help understand ${module.title.toLowerCase()} concepts intuitively.</p>
                            <div id="${module.id}-viz" class="viz-container">
                                <canvas id="${module.id}-canvas" width="800" height="400" style="border: 1px solid rgba(0, 212, 255, 0.3); border-radius: 8px; background: rgba(0, 212, 255, 0.02);"></canvas>
                            </div>
                            <div class="viz-controls">
                                <button onclick="drawVisualization('${module.id}')" class="btn-viz">🔄 Refresh Visualization</button>
                                <button onclick="toggleVizAnimation('${module.id}')" class="btn-viz">▶️ Animate</button>
                                <button onclick="downloadViz('${module.id}')" class="btn-viz">⬇️ Save Image</button>
                            </div>
                        </div>
                    </div>

                    <div id="${module.id}-math" class="tab">
                        <div class="section">
                            <h2>📐 Mathematical Foundation</h2>
                            ${content.math || `
                                <p>Rigorous mathematical treatment of ${module.title.toLowerCase()}.</p>
                                <div class="formula">
                                    Mathematical formulas and derivations go here
                                </div>
                            `}
                        </div>
                    </div>

                    <div id="${module.id}-applications" class="tab">
                        <div class="section">
                            <h2>🌍 Real-World Applications</h2>
                            ${content.applications || `
                                <p>How ${module.title.toLowerCase()} is used in practice across different industries.</p>
                                <div class="info-box">
                                    <div class="box-title">Use Cases</div>
                                    <div class="box-content">
                                        Common applications and practical examples
                                    </div>
                                </div>
                            `}
                        </div>
                    </div>

                    <div id="${module.id}-summary" class="tab">
                        <div class="section">
                            <h2>✅ Summary</h2>
                            <div class="info-box">
                                <div class="box-title">Key Takeaways</div>
                                <div class="box-content">
                                    ✓ Essential concepts covered<br>
                                    ✓ Mathematical foundations understood<br>
                                    ✓ Real-world applications identified<br>
                                    ✓ Ready for implementation
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            `;
        }

        function initDashboard() {
            const grid = document.getElementById("modulesGrid");
            const container = document.getElementById("modulesContainer");

            modules.forEach(module => {
                const card = document.createElement("div");
                card.className = "card";
                card.style.borderColor = module.color;
                card.onclick = () => switchTo(module.id + "-module");
                card.innerHTML = `
                    <div class="card-icon">${module.icon}</div>
                    <h3>${module.title}</h3>
                    <p>${module.description}</p>
                    <span class="category-label">${module.category}</span>
                `;
                grid.appendChild(card);

                const moduleHTML = createModuleHTML(module);
                container.innerHTML += moduleHTML;
            });
        }

        function switchTo(target) {
            document.querySelectorAll('.dashboard, .module').forEach(el => {
                el.classList.remove('active');
            });
            const elem = document.getElementById(target);
            if (elem) elem.classList.add('active');
        }

        function switchTab(e, tabId) {
            const module = e.target.closest('.module');
            if (!module) return;

            module.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
            module.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));

            const tab = document.getElementById(tabId);
            if (tab) tab.classList.add('active');
            e.target.classList.add('active');

            // Trigger visualization when tabs are clicked
            setTimeout(() => {
                const moduleId = tabId.split('-')[0];
                if (tabId.includes('-concepts')) {
                    drawConceptsVisualization(moduleId);
                } else if (tabId.includes('-visualization')) {
                    drawConceptsVisualization(moduleId);
                } else if (tabId.includes('-math')) {
                    drawMathVisualization(moduleId);
                } else if (tabId.includes('-applications')) {
                    drawApplicationVisualization(moduleId);
                }
            }, 150);
        }

        // Visualization Functions - Concepts Tab
        function drawConceptsVisualization(moduleId) {
            const canvas = document.getElementById(moduleId + '-canvas');
            if (!canvas) return;

            const ctx = canvas.getContext('2d');
            ctx.clearRect(0, 0, canvas.width, canvas.height);
            ctx.fillStyle = '#0f1419';
            ctx.fillRect(0, 0, canvas.width, canvas.height);

            const vizMap = {
                'nn-basics': drawNeuronAnimation,
                'perceptron': drawDecisionBoundary,
                'mlp': drawNetworkGraph,
                'activation': drawActivationFunctions,
                'weight-init': drawWeightDistribution,
                'loss': drawLossLandscape,
                'optimizers': drawConvergencePaths,
                'backprop': drawGradientFlow,
                'regularization': drawOverfitComparison,
                'batch-norm': drawBatchNormalization,
                'cv-intro': drawImageMatrix,
                'conv-layer': drawConvolutionAnimation,
                'pooling': drawPoolingDemo,
                'cnn-basics': drawCNNArchitecture,
                'viz-filters': drawLearnedFilters,
                'lenet': drawLeNetArchitecture,
                'alexnet': drawAlexNetArchitecture,
                'vgg': drawVGGArchitecture,
                'resnet': drawResNetArchitecture,
                'inception': drawInceptionModule,
                'mobilenet': drawMobileNetArchitecture,
                'transfer-learning': drawTransferLearning,
                'localization': drawBoundingBoxes,
                'rcnn': drawRCNNPipeline,
                'yolo': drawYOLOGrid,
                'ssd': drawSSDDetector,
                'semantic-seg': drawSemanticSegmentation,
                'instance-seg': drawInstanceSegmentation,
                'face-recog': drawFaceEmbeddings,
                'autoencoders': drawAutoencoderArchitecture,
                'gans': drawGANsGame,
                'diffusion': drawDiffusionProcess,
                'rnn': drawRNNUnrolled,
                'transformers': drawAttentionMatrix,
                'bert': drawBERTProcess,
                'gpt': drawGPTGeneration,
                'vit': drawVisionTransformer,
                'gnn': drawGraphNetwork
            };

            if (vizMap[moduleId]) {
                vizMap[moduleId](ctx, canvas);
            } else {
                drawDefaultVisualization(ctx, canvas);
            }
        }

        // Default Visualization
        function drawDefaultVisualization(ctx, canvas) {
            const centerX = canvas.width / 2;
            const centerY = canvas.height / 2;

            ctx.fillStyle = 'rgba(0, 212, 255, 0.2)';
            ctx.fillRect(centerX - 120, centerY - 60, 240, 120);
            ctx.strokeStyle = '#00d4ff';
            ctx.lineWidth = 2;
            ctx.strokeRect(centerX - 120, centerY - 60, 240, 120);

            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 18px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('📊 Interactive Visualization', centerX, centerY - 20);
            ctx.font = '13px Arial';
            ctx.fillText('Custom visualization for this topic', centerX, centerY + 20);
            ctx.font = '11px Arial';
            ctx.fillStyle = '#00ff88';
            ctx.fillText('Click Refresh to render', centerX, centerY + 45);
        }

        // Default Math Visualization
        function drawDefaultMathVisualization(ctx, canvas) {
            const centerX = canvas.width / 2;
            const centerY = canvas.height / 2;

            ctx.fillStyle = 'rgba(255, 107, 53, 0.2)';
            ctx.fillRect(centerX - 120, centerY - 60, 240, 120);
            ctx.strokeStyle = '#ff6b35';
            ctx.lineWidth = 2;
            ctx.strokeRect(centerX - 120, centerY - 60, 240, 120);

            ctx.fillStyle = '#ff6b35';
            ctx.font = 'bold 18px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('📐 Mathematical Formulas', centerX, centerY - 20);
            ctx.font = '13px Arial';
            ctx.fillText('Visual equation derivations', centerX, centerY + 20);
            ctx.font = '11px Arial';
            ctx.fillStyle = '#00ff88';
            ctx.fillText('Click Visualize to render', centerX, centerY + 45);
        }

        // Default Application Visualization
        function drawDefaultApplicationVisualization(ctx, canvas) {
            const centerX = canvas.width / 2;
            const centerY = canvas.height / 2;

            ctx.fillStyle = 'rgba(0, 255, 136, 0.2)';
            ctx.fillRect(centerX - 120, centerY - 60, 240, 120);
            ctx.strokeStyle = '#00ff88';
            ctx.lineWidth = 2;
            ctx.strokeRect(centerX - 120, centerY - 60, 240, 120);

            ctx.fillStyle = '#00ff88';
            ctx.font = 'bold 18px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('🌍 Real-World Applications', centerX, centerY - 20);
            ctx.font = '13px Arial';
            ctx.fillText('Practical use cases and examples', centerX, centerY + 20);
            ctx.font = '11px Arial';
            ctx.fillStyle = '#ffa500';
            ctx.fillText('Click Show Applications to render', centerX, centerY + 45);
        }

        // Activation Functions Visualization
        function drawActivationFunctions(ctx, canvas) {
            const width = canvas.width;
            const height = canvas.height;
            const centerX = width / 2;
            const centerY = height / 2;
            const scale = 40;

            // Draw grid
            ctx.strokeStyle = 'rgba(0, 212, 255, 0.1)';
            ctx.lineWidth = 1;
            for (let i = -5; i <= 5; i += 1) {
                const x = centerX + i * scale;
                ctx.beginPath();
                ctx.moveTo(x, centerY - 5 * scale);
                ctx.lineTo(x, centerY + 5 * scale);
                ctx.stroke();
            }

            // Draw axes
            ctx.strokeStyle = '#00d4ff';
            ctx.lineWidth = 2;
            ctx.beginPath();
            ctx.moveTo(centerX - 6 * scale, centerY);
            ctx.lineTo(centerX + 6 * scale, centerY);
            ctx.stroke();
            ctx.beginPath();
            ctx.moveTo(centerX, centerY - 6 * scale);
            ctx.lineTo(centerX, centerY + 6 * scale);
            ctx.stroke();

            // Draw activation functions
            const functions = [
                { name: 'ReLU', color: '#ff6b35', fn: x => Math.max(0, x) },
                { name: 'Sigmoid', color: '#00ff88', fn: x => 1 / (1 + Math.exp(-x)) },
                { name: 'Tanh', color: '#ffa500', fn: x => Math.tanh(x) }
            ];

            functions.forEach(func => {
                ctx.strokeStyle = func.color;
                ctx.lineWidth = 2;
                ctx.beginPath();
                for (let x = -5; x <= 5; x += 0.1) {
                    const y = func.fn(x);
                    const canvasX = centerX + x * scale;
                    const canvasY = centerY - y * scale;
                    if (x === -5) ctx.moveTo(canvasX, canvasY);
                    else ctx.lineTo(canvasX, canvasY);
                }
                ctx.stroke();
            });

            // Legend
            ctx.font = 'bold 12px Arial';
            functions.forEach((func, i) => {
                ctx.fillStyle = func.color;
                ctx.fillRect(10, 10 + i * 20, 10, 10);
                ctx.fillStyle = '#e4e6eb';
                ctx.fillText(func.name, 25, 19 + i * 20);
            });
        }

        // Neural Network Graph
        function drawNetworkGraph(ctx, canvas) {
            const layers = [2, 3, 3, 1];
            const width = canvas.width;
            const height = canvas.height;
            const layerWidth = width / (layers.length + 1);

            ctx.fillStyle = 'rgba(0, 212, 255, 0.05)';
            ctx.fillRect(0, 0, width, height);

            // Draw neurons and connections
            const neuronPositions = [];

            layers.forEach((numNeurons, layerIdx) => {
                const x = (layerIdx + 1) * layerWidth;
                const positions = [];

                for (let i = 0; i < numNeurons; i++) {
                    const y = height / (numNeurons + 1) * (i + 1);
                    positions.push({ x, y });

                    // Draw connections to next layer
                    if (layerIdx < layers.length - 1) {
                        const nextLayerPositions = [];
                        const nextX = (layerIdx + 2) * layerWidth;
                        for (let j = 0; j < layers[layerIdx + 1]; j++) {
                            const nextY = height / (layers[layerIdx + 1] + 1) * (j + 1);
                            nextLayerPositions.push({ x: nextX, y: nextY });
                        }

                        nextLayerPositions.forEach(next => {
                            ctx.strokeStyle = 'rgba(0, 212, 255, 0.2)';
                            ctx.lineWidth = 1;
                            ctx.beginPath();
                            ctx.moveTo(x, y);
                            ctx.lineTo(next.x, next.y);
                            ctx.stroke();
                        });
                    }
                }

                // Draw neurons
                positions.forEach(pos => {
                    ctx.fillStyle = '#00d4ff';
                    ctx.beginPath();
                    ctx.arc(pos.x, pos.y, 8, 0, Math.PI * 2);
                    ctx.fill();
                });

                neuronPositions.push(positions);
            });

            // Labels
            ctx.fillStyle = '#e4e6eb';
            ctx.font = 'bold 12px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Input', layerWidth, height - 10);
            ctx.fillText('Hidden 1', layerWidth * 2, height - 10);
            ctx.fillText('Hidden 2', layerWidth * 3, height - 10);
            ctx.fillText('Output', layerWidth * 4, height - 10);
        }

        // Convolution Animation
        function drawConvolutionAnimation(ctx, canvas) {
            const width = canvas.width;
            const height = canvas.height;

            // Draw input image
            ctx.fillStyle = 'rgba(0, 212, 255, 0.1)';
            ctx.fillRect(20, 20, 150, 150);
            ctx.strokeStyle = '#00d4ff';
            ctx.lineWidth = 2;
            ctx.strokeRect(20, 20, 150, 150);

            // Draw filter
            ctx.fillStyle = 'rgba(255, 107, 53, 0.1)';
            const filterPos = 60 + Math.sin(Date.now() / 1000) * 40;
            ctx.fillRect(filterPos, 60, 60, 60);
            ctx.strokeStyle = '#ff6b35';
            ctx.lineWidth = 3;
            ctx.strokeRect(filterPos, 60, 60, 60);

            // Draw output
            ctx.fillStyle = 'rgba(0, 255, 136, 0.1)';
            ctx.fillRect(width - 170, 20, 150, 150);
            ctx.strokeStyle = '#00ff88';
            ctx.lineWidth = 2;
            ctx.strokeRect(width - 170, 20, 150, 150);

            // Draw feature map
            for (let i = 0; i < 5; i++) {
                for (let j = 0; j < 5; j++) {
                    const intensity = Math.random() * 100;
                    ctx.fillStyle = `rgba(0, 212, 255, ${intensity / 100})`;
                    ctx.fillRect(width - 160 + i * 25, 30 + j * 25, 20, 20);
                }
            }

            // Labels
            ctx.fillStyle = '#e4e6eb';
            ctx.font = 'bold 12px Arial';
            ctx.textAlign = 'left';
            ctx.fillText('Input Image', 20, 190);
            ctx.fillText('Filter', filterPos, 140);
            ctx.fillText('Feature Map', width - 170, 190);
        }

        // Loss Landscape
        function drawLossLandscape(ctx, canvas) {
            const width = canvas.width;
            const height = canvas.height;

            for (let x = 0; x < width; x += 20) {
                for (let y = 0; y < height; y += 20) {
                    const nx = (x - width / 2) / (width / 4);
                    const ny = (y - height / 2) / (height / 4);
                    const loss = nx * nx + ny * ny;
                    const intensity = Math.min(255, loss * 50);
                    ctx.fillStyle = `rgb(${intensity}, ${100}, ${255 - intensity})`;
                    ctx.fillRect(x, y, 20, 20);
                }
            }

            // Draw descent path
            ctx.strokeStyle = '#00ff88';
            ctx.lineWidth = 2;
            ctx.beginPath();
            const startX = width / 2 + 80;
            const startY = height / 2 + 80;
            ctx.moveTo(startX, startY);

            for (let i = 0; i < 20; i++) {
                const angle = Math.atan2(startY - height / 2, startX - width / 2);
                const newX = startX - Math.cos(angle) * 15;
                const newY = startY - Math.sin(angle) * 15;
                ctx.lineTo(newX, newY);
            }
            ctx.stroke();

            // Minimum point
            ctx.fillStyle = '#00ff88';
            ctx.beginPath();
            ctx.arc(width / 2, height / 2, 8, 0, Math.PI * 2);
            ctx.fill();
        }

        // YOLO Grid
        function drawYOLOGrid(ctx, canvas) {
            const width = canvas.width;
            const height = canvas.height;
            const gridSize = 7;
            const cellWidth = width / gridSize;
            const cellHeight = height / gridSize;

            // Draw grid
            ctx.strokeStyle = 'rgba(0, 212, 255, 0.3)';
            ctx.lineWidth = 1;
            for (let i = 0; i <= gridSize; i++) {
                ctx.beginPath();
                ctx.moveTo(i * cellWidth, 0);
                ctx.lineTo(i * cellWidth, height);
                ctx.stroke();

                ctx.beginPath();
                ctx.moveTo(0, i * cellHeight);
                ctx.lineTo(width, i * cellHeight);
                ctx.stroke();
            }

            // Draw detected objects
            const detections = [
                { x: 2, y: 2, w: 2, h: 2, conf: 0.95 },
                { x: 4, y: 5, w: 1.5, h: 1.5, conf: 0.87 }
            ];

            detections.forEach(det => {
                ctx.fillStyle = `rgba(255, 107, 53, ${det.conf * 0.5})`;
                ctx.fillRect(det.x * cellWidth, det.y * cellHeight, det.w * cellWidth, det.h * cellHeight);
                ctx.strokeStyle = '#ff6b35';
                ctx.lineWidth = 2;
                ctx.strokeRect(det.x * cellWidth, det.y * cellHeight, det.w * cellWidth, det.h * cellHeight);

                ctx.fillStyle = '#ff6b35';
                ctx.font = 'bold 12px Arial';
                ctx.fillText((det.conf * 100).toFixed(0) + '%', det.x * cellWidth + 5, det.y * cellHeight + 15);
            });
        }

        // Attention Matrix
        function drawAttentionMatrix(ctx, canvas) {
            const size = 8;
            const cellSize = Math.min(canvas.width, canvas.height) / size;

            for (let i = 0; i < size; i++) {
                for (let j = 0; j < size; j++) {
                    const distance = Math.abs(i - j);
                    const attention = Math.exp(-distance / 2);
                    const intensity = Math.floor(attention * 255);
                    ctx.fillStyle = `rgb(${intensity}, 100, ${200 - intensity})`;
                    ctx.fillRect(i * cellSize, j * cellSize, cellSize, cellSize);
                }
            }

            // Add labels
            ctx.fillStyle = '#e4e6eb';
            ctx.font = '10px Arial';
            ctx.textAlign = 'center';
            for (let i = 0; i < size; i++) {
                ctx.fillText('w' + i, i * cellSize + cellSize / 2, canvas.height - 5);
            }
        }

        // Math Visualization
        function drawMathVisualization(moduleId) {
            const canvas = document.getElementById(moduleId + '-math-canvas');
            if (!canvas) return;

            const ctx = canvas.getContext('2d');
            ctx.clearRect(0, 0, canvas.width, canvas.height);
            ctx.fillStyle = '#0f1419';
            ctx.fillRect(0, 0, canvas.width, canvas.height);

            const mathVizMap = {
                'nn-basics': () => drawNNMath(ctx, canvas),
                'activation': () => drawActivationDerivatives(ctx, canvas),
                'loss': () => drawLossComparison(ctx, canvas),
                'optimizers': () => drawOptimizerSteps(ctx, canvas),
                'backprop': () => drawChainRule(ctx, canvas),
                'conv-layer': () => drawConvolutionMath(ctx, canvas),
                'pooling': () => drawPoolingMath(ctx, canvas),
                'regularization': () => drawRegularizationMath(ctx, canvas),
                'transformers': () => drawAttentionMath(ctx, canvas),
                'rnn': () => drawRNNMath(ctx, canvas),
                'gnn': () => drawGNNMath(ctx, canvas)
            };

            if (mathVizMap[moduleId]) {
                mathVizMap[moduleId]();
            } else {
                drawDefaultMathVisualization(ctx, canvas);
            }
        }

        // Application Visualization
        function drawApplicationVisualization(moduleId) {
            const canvas = document.getElementById(moduleId + '-app-canvas');
            if (!canvas) return;

            const ctx = canvas.getContext('2d');
            ctx.clearRect(0, 0, canvas.width, canvas.height);
            ctx.fillStyle = '#0f1419';
            ctx.fillRect(0, 0, canvas.width, canvas.height);

            const appVizMap = {
                'nn-basics': () => drawNNApplications(ctx, canvas),
                'cnn-basics': () => drawCNNApplications(ctx, canvas),
                'conv-layer': () => drawConvolutionApplications(ctx, canvas),
                'yolo': () => drawYOLOApplications(ctx, canvas),
                'semantic-seg': () => drawSegmentationApplications(ctx, canvas),
                'instance-seg': () => drawInstanceSegmentationApps(ctx, canvas),
                'face-recog': () => drawFaceRecognitionApps(ctx, canvas),
                'transformers': () => drawTransformerApps(ctx, canvas),
                'bert': () => drawBERTApplications(ctx, canvas),
                'gpt': () => drawGPTApplications(ctx, canvas),
                'gans': () => drawGANApplications(ctx, canvas),
                'diffusion': () => drawDiffusionApplications(ctx, canvas),
                'gnn': () => drawGNNApplications(ctx, canvas)
            };

            if (appVizMap[moduleId]) {
                appVizMap[moduleId]();
            } else {
                drawDefaultApplicationVisualization(ctx, canvas);
            }
        }

        // Math visualization helper functions
        function drawNNMath(ctx, canvas) {
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 18px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Forward Pass: y = σ(Wx + b)', canvas.width / 2, 50);
            ctx.font = '14px Arial';
            ctx.fillStyle = '#00ff88';
            ctx.fillText('Linear combination + Non-linearity', canvas.width / 2, 100);
            ctx.fillStyle = '#ffa500';
            ctx.fillText('W: weights, b: bias, σ: activation', canvas.width / 2, 150);
        }

        function drawActivationDerivatives(ctx, canvas) {
            const width = canvas.width;
            const height = canvas.height;
            const centerX = width / 2;
            const centerY = height / 2;
            const scale = 40;

            ctx.strokeStyle = 'rgba(0, 212, 255, 0.2)';
            ctx.lineWidth = 1;
            for (let i = -5; i <= 5; i += 1) {
                ctx.beginPath();
                ctx.moveTo(centerX + i * scale, centerY - 5 * scale);
                ctx.lineTo(centerX + i * scale, centerY + 5 * scale);
                ctx.stroke();
            }

            ctx.strokeStyle = '#00ff88';
            ctx.lineWidth = 3;
            ctx.beginPath();
            for (let x = -5; x <= 5; x += 0.1) {
                const y = 1 / (1 + Math.exp(-x)) * (1 - 1 / (1 + Math.exp(-x)));
                const canvasX = centerX + x * scale;
                const canvasY = centerY - y * scale * 10;
                if (x === -5) ctx.moveTo(canvasX, canvasY);
                else ctx.lineTo(canvasX, canvasY);
            }
            ctx.stroke();

            ctx.fillStyle = '#00ff88';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText("Sigmoid Derivative: σ'(x) = σ(x)(1-σ(x))", canvas.width / 2, 30);
        }

        function drawLossComparison(ctx, canvas) {
            const width = canvas.width;
            const height = canvas.height;

            // MSE
            ctx.fillStyle = 'rgba(0, 212, 255, 0.2)';
            ctx.fillRect(20, 60, width / 2 - 30, height - 100);
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 14px Arial';
            ctx.fillText('MSE Loss', width / 4, 45);
            ctx.font = '12px Arial';
            ctx.fillText('L = (1/n)Σ(y-ŷ)²', width / 4, 90);
            ctx.fillText('Regression', width / 4, 115);

            // Cross-Entropy
            ctx.fillStyle = 'rgba(255, 107, 53, 0.2)';
            ctx.fillRect(width / 2 + 10, 60, width / 2 - 30, height - 100);
            ctx.fillStyle = '#ff6b35';
            ctx.font = 'bold 14px Arial';
            ctx.fillText('Cross-Entropy Loss', width * 3 / 4, 45);
            ctx.font = '12px Arial';
            ctx.fillText('L = -Σ(y·log(ŷ))', width * 3 / 4, 90);
            ctx.fillText('Classification', width * 3 / 4, 115);
        }

        function drawOptimizerSteps(ctx, canvas) {
            const width = canvas.width;
            const height = canvas.height;
            const centerY = height / 2;

            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 16px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('SGD', width / 4, 50);
            ctx.font = '12px Arial';
            ctx.fillText('w = w - α·∇L', width / 4, 100);

            ctx.fillStyle = '#00ff88';
            ctx.font = 'bold 16px Arial';
            ctx.fillText('Momentum', width / 2, 50);
            ctx.font = '12px Arial';
            ctx.fillText('v = β·v + (1-β)·∇L', width / 2, 100);

            ctx.fillStyle = '#ffa500';
            ctx.font = 'bold 16px Arial';
            ctx.fillText('Adam', width * 3 / 4, 50);
            ctx.font = '12px Arial';
            ctx.fillText('Adaptive learning rate', width * 3 / 4, 100);
        }

        function drawChainRule(ctx, canvas) {
            const width = canvas.width;
            ctx.fillStyle = '#00ff88';
            ctx.font = 'bold 16px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Backpropagation Chain Rule', width / 2, 50);
            ctx.font = '12px Arial';
            ctx.fillStyle = '#00d4ff';
            ctx.fillText('dL/dW = dL/dŷ · dŷ/da · da/dz · dz/dW', width / 2, 100);
            ctx.fillStyle = '#ffa500';
            ctx.fillText('Compute gradient by multiplying partial derivatives', width / 2, 150);
        }

        function drawConvolutionMath(ctx, canvas) {
            ctx.fillStyle = '#ff6b35';
            ctx.font = 'bold 16px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Convolution Operation', canvas.width / 2, 50);
            ctx.font = '12px Arial';
            ctx.fillStyle = '#00d4ff';
            ctx.fillText('y[i,j] = Σ Σ w[m,n] * x[i+m,j+n] + b', canvas.width / 2, 100);
            ctx.fillStyle = '#00ff88';
            ctx.fillText('Sliding window element-wise multiplication and summation', canvas.width / 2, 150);
        }

        function drawPoolingMath(ctx, canvas) {
            const width = canvas.width;
            ctx.fillStyle = '#00ff88';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Max Pooling', width / 3, 50);
            ctx.font = '12px Arial';
            ctx.fillText('y = max(neighborhood)', width / 3, 100);

            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 14px Arial';
            ctx.fillText('Average Pooling', width * 2 / 3, 50);
            ctx.font = '12px Arial';
            ctx.fillText('y = avg(neighborhood)', width * 2 / 3, 100);

            ctx.fillStyle = '#ffa500';
            ctx.font = '11px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Reduces spatial dimensions', width / 2, 150);
        }

        function drawRegularizationMath(ctx, canvas) {
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('L1 Regularization: L = Loss + λΣ|w|', canvas.width / 2, 60);
            ctx.fillStyle = '#00ff88';
            ctx.fillText('L2 Regularization: L = Loss + λΣw²', canvas.width / 2, 110);
            ctx.fillStyle = '#ffa500';
            ctx.fillText('Prevents overfitting by penalizing large weights', canvas.width / 2, 160);
        }

        function drawAttentionMath(ctx, canvas) {
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Attention Mechanism', canvas.width / 2, 50);
            ctx.font = '12px Arial';
            ctx.fillStyle = '#00ff88';
            ctx.fillText('Attention(Q,K,V) = softmax(QK^T/√d_k) · V', canvas.width / 2, 100);
            ctx.fillStyle = '#ffa500';
            ctx.fillText('Query-Key matching determines how much to focus on each value', canvas.width / 2, 150);
        }

        function drawRNNMath(ctx, canvas) {
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('RNN Hidden State Update', canvas.width / 2, 50);
            ctx.font = '12px Arial';
            ctx.fillStyle = '#00ff88';
            ctx.fillText('h_t = σ(W_h·h_(t-1) + W_x·x_t + b)', canvas.width / 2, 100);
            ctx.fillStyle = '#ffa500';
            ctx.fillText('Processes sequences step-by-step with recurrent connections', canvas.width / 2, 150);
        }

        // Application visualization helper functions
        function drawNNApplications(ctx, canvas) {
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('📱 Stock Price Prediction', canvas.width / 4, 60);
            ctx.fillStyle = '#00ff88';
            ctx.fillText('🏥 Medical Diagnosis', canvas.width / 2, 60);
            ctx.fillStyle = '#ffa500';
            ctx.fillText('🎮 Game AI', canvas.width * 3 / 4, 60);

            ctx.fillStyle = '#ff6b35';
            ctx.font = '12px Arial';
            ctx.fillText('Fraud Detection', canvas.width / 4, 120);
            ctx.fillStyle = '#00d4ff';
            ctx.fillText('Recommendation Systems', canvas.width / 2, 120);
            ctx.fillStyle = '#00ff88';
            ctx.fillText('Credit Scoring', canvas.width * 3 / 4, 120);
        }

        function drawCNNApplications(ctx, canvas) {
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Image Classification', canvas.width / 3, 60);
            ctx.fillStyle = '#00ff88';
            ctx.fillText('Object Detection', canvas.width * 2 / 3, 60);

            ctx.fillStyle = '#ffa500';
            ctx.font = '12px Arial';
            ctx.fillText('Deep Learning Backbone', canvas.width / 2, 150);
        }

        function drawConvolutionApplications(ctx, canvas) {
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('📷 Image Feature Extraction', canvas.width / 3, 60);
            ctx.fillStyle = '#00ff88';
            ctx.fillText('🔍 Edge Detection', canvas.width * 2 / 3, 60);

            ctx.fillStyle = '#ffa500';
            ctx.font = '12px Arial';
            ctx.fillText('Foundation of Computer Vision', canvas.width / 2, 150);
        }

        function drawYOLOApplications(ctx, canvas) {
            ctx.fillStyle = '#ff6b35';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('🚗 Autonomous Driving', canvas.width / 3, 60);
            ctx.fillStyle = '#00d4ff';
            ctx.fillText('📹 Real-time Video Detection', canvas.width * 2 / 3, 60);

            ctx.fillStyle = '#00ff88';
            ctx.font = '12px Arial';
            ctx.fillText('Ultra-fast inference for live applications', canvas.width / 2, 150);
        }

        function drawSegmentationApplications(ctx, canvas) {
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('🏥 Medical Imaging', canvas.width / 3, 60);
            ctx.fillStyle = '#00ff88';
            ctx.fillText('🚗 Autonomous Vehicles', canvas.width * 2 / 3, 60);

            ctx.fillStyle = '#ffa500';
            ctx.font = '12px Arial';
            ctx.fillText('Pixel-level understanding of scenes', canvas.width / 2, 150);
        }

        function drawInstanceSegmentationApps(ctx, canvas) {
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('👥 Person Detection & Tracking', canvas.width / 3, 60);
            ctx.fillStyle = '#00ff88';
            ctx.fillText('🍎 Object Instance Counting', canvas.width * 2 / 3, 60);

            ctx.fillStyle = '#ffa500';
            ctx.font = '12px Arial';
            ctx.fillText('Separates overlapping objects', canvas.width / 2, 150);
        }

        function drawFaceRecognitionApps(ctx, canvas) {
            ctx.fillStyle = '#ffa500';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('📱 Phone Unlock', canvas.width / 3, 60);
            ctx.fillStyle = '#00d4ff';
            ctx.fillText('🔒 Security Systems', canvas.width * 2 / 3, 60);

            ctx.fillStyle = '#00ff88';
            ctx.font = '12px Arial';
            ctx.fillText('Identity verification and access control', canvas.width / 2, 150);
        }

        function drawTransformerApps(ctx, canvas) {
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('💬 ChatGPT / LLMs', canvas.width / 3, 60);
            ctx.fillStyle = '#00ff88';
            ctx.fillText('🌐 Machine Translation', canvas.width * 2 / 3, 60);

            ctx.fillStyle = '#ffa500';
            ctx.font = '12px Arial';
            ctx.fillText('Foundation of modern NLP and beyond', canvas.width / 2, 150);
        }

        function drawBERTApplications(ctx, canvas) {
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('🔍 Semantic Search', canvas.width / 3, 60);
            ctx.fillStyle = '#00ff88';
            ctx.fillText('❓ Question Answering', canvas.width * 2 / 3, 60);

            ctx.fillStyle = '#ffa500';
            ctx.font = '12px Arial';
            ctx.fillText('Deep language understanding', canvas.width / 2, 150);
        }

        function drawGPTApplications(ctx, canvas) {
            ctx.fillStyle = '#ff6b35';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('✍️ Text Generation', canvas.width / 3, 60);
            ctx.fillStyle = '#00d4ff';
            ctx.fillText('💡 Idea Assistance', canvas.width * 2 / 3, 60);

            ctx.fillStyle = '#00ff88';
            ctx.font = '12px Arial';
            ctx.fillText('Powerful autoregressive language models', canvas.width / 2, 150);
        }

        function drawGANApplications(ctx, canvas) {
            ctx.fillStyle = '#ff6b35';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('🎨 Image Generation', canvas.width / 3, 60);
            ctx.fillStyle = '#00d4ff';
            ctx.fillText('🎭 Style Transfer', canvas.width * 2 / 3, 60);

            ctx.fillStyle = '#00ff88';
            ctx.font = '12px Arial';
            ctx.fillText('Creative content generation and enhancement', canvas.width / 2, 150);
        }

        function drawDiffusionApplications(ctx, canvas) {
            ctx.fillStyle = '#ffa500';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('🖼️ Image Synthesis', canvas.width / 3, 60);
            ctx.fillStyle = '#00d4ff';
            ctx.fillText('🎬 Stable Diffusion', canvas.width * 2 / 3, 60);

            ctx.fillStyle = '#00ff88';
            ctx.font = '12px Arial';
            ctx.fillText('State-of-the-art generative AI', canvas.width / 2, 150);
        }

        // Missing visualization stub functions
        function drawNeuronAnimation(ctx, canvas) {
            drawNetworkGraph(ctx, canvas);
        }

        function drawDecisionBoundary(ctx, canvas) {
            const centerX = canvas.width / 2;
            const centerY = canvas.height / 2;

            // Draw decision boundary line
            ctx.strokeStyle = '#ff6b35';
            ctx.lineWidth = 3;
            ctx.beginPath();
            ctx.moveTo(0, centerY);
            ctx.lineTo(canvas.width, centerY);
            ctx.stroke();

            // Draw sample points
            for (let i = 0; i < 20; i++) {
                const x = Math.random() * canvas.width;
                const y = Math.random() * canvas.height;
                ctx.fillStyle = y < centerY ? '#00d4ff' : '#00ff88';
                ctx.beginPath();
                ctx.arc(x, y, 5, 0, Math.PI * 2);
                ctx.fill();
            }
        }

        function drawWeightDistribution(ctx, canvas) {
            const centerX = canvas.width / 2;
            const centerY = canvas.height / 2;

            // Draw Gaussian distribution
            ctx.strokeStyle = '#00d4ff';
            ctx.lineWidth = 2;
            ctx.beginPath();
            for (let x = -100; x <= 100; x += 2) {
                const y = Math.exp(-(x * x) / 500) * 80;
                const canvasX = centerX + x;
                const canvasY = centerY - y;
                if (x === -100) ctx.moveTo(canvasX, canvasY);
                else ctx.lineTo(canvasX, canvasY);
            }
            ctx.stroke();

            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Weight Distribution (Xavier/He Init)', centerX, 50);
        }

        function drawConvergencePaths(ctx, canvas) {
            drawLossLandscape(ctx, canvas);
        }

        function drawGradientFlow(ctx, canvas) {
            drawChainRule(ctx, canvas);
        }

        function drawOverfitComparison(ctx, canvas) {
            const width = canvas.width;
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Without Regularization', width / 4, 40);
            ctx.fillStyle = '#ff6b35';
            ctx.fillText('With Regularization', width * 3 / 4, 40);

            // Draw wavy overfit line
            ctx.strokeStyle = '#00d4ff';
            ctx.lineWidth = 2;
            ctx.beginPath();
            for (let x = 0; x < width / 2 - 20; x += 5) {
                const y = 100 + Math.sin(x / 10) * 30 + Math.random() * 20;
                if (x === 0) ctx.moveTo(x + 20, y);
                else ctx.lineTo(x + 20, y);
            }
            ctx.stroke();

            // Draw smooth regularized line
            ctx.strokeStyle = '#ff6b35';
            ctx.beginPath();
            for (let x = 0; x < width / 2 - 20; x += 5) {
                const y = 100 + Math.sin(x / 20) * 15;
                if (x === 0) ctx.moveTo(x + width / 2 + 20, y);
                else ctx.lineTo(x + width / 2 + 20, y);
            }
            ctx.stroke();
        }

        function drawBatchNormalization(ctx, canvas) {
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Batch Normalization: μ=0, σ²=1', canvas.width / 2, 50);

            // Draw before/after distributions
            ctx.fillStyle = '#ffa500';
            ctx.fillText('Input Distribution', canvas.width / 4, 100);
            ctx.fillStyle = '#00ff88';
            ctx.fillText('Normalized Distribution', canvas.width * 3 / 4, 100);
        }

        function drawImageMatrix(ctx, canvas) {
            const cellSize = 20;
            for (let i = 0; i < 10; i++) {
                for (let j = 0; j < 10; j++) {
                    const intensity = Math.random();
                    ctx.fillStyle = `rgba(0, 212, 255, ${intensity})`;
                    ctx.fillRect(i * cellSize + 100, j * cellSize + 100, cellSize, cellSize);
                }
            }
            ctx.fillStyle = '#e4e6eb';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Image as Matrix (Pixel Values)', canvas.width / 2, 50);
        }

        function drawPoolingDemo(ctx, canvas) {
            const cellSize = 30;
            const matrix = [[12, 20, 30, 0], [8, 12, 2, 0], [34, 70, 37, 4], [112, 100, 25, 12]];

            ctx.fillStyle = '#e4e6eb';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Max Pooling Demo (2x2)', canvas.width / 2, 30);

            // Draw input matrix
            for (let i = 0; i < 4; i++) {
                for (let j = 0; j < 4; j++) {
                    ctx.strokeStyle = '#00d4ff';
                    ctx.strokeRect(50 + j * cellSize, 50 + i * cellSize, cellSize, cellSize);
                    ctx.fillStyle = '#e4e6eb';
                    ctx.font = '10px Arial';
                    ctx.fillText(matrix[i][j], 50 + j * cellSize + cellSize / 2, 50 + i * cellSize + cellSize / 2 + 4);
                }
            }

            // Draw output (max pooled)
            const pooled = [[20, 30], [112, 37]];
            for (let i = 0; i < 2; i++) {
                for (let j = 0; j < 2; j++) {
                    ctx.strokeStyle = '#00ff88';
                    ctx.strokeRect(250 + j * cellSize * 1.5, 70 + i * cellSize * 1.5, cellSize * 1.5, cellSize * 1.5);
                    ctx.fillStyle = '#00ff88';
                    ctx.font = 'bold 12px Arial';
                    ctx.fillText(pooled[i][j], 250 + j * cellSize * 1.5 + cellSize * 0.75, 70 + i * cellSize * 1.5 + cellSize * 0.75 + 5);
                }
            }
        }

        function drawCNNArchitecture(ctx, canvas) {
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 12px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Input', 60, 200);
            ctx.fillText('Conv', 160, 200);
            ctx.fillText('Pool', 260, 200);
            ctx.fillText('Conv', 360, 200);
            ctx.fillText('Pool', 460, 200);
            ctx.fillText('FC', 560, 200);
            ctx.fillText('Output', 660, 200);

            // Draw blocks
            const blocks = [60, 160, 260, 360, 460, 560, 660];
            blocks.forEach((x, i) => {
                const height = i === 0 ? 100 : (i < blocks.length - 2 ? 80 - i * 10 : 60);
                ctx.strokeStyle = '#00d4ff';
                ctx.strokeRect(x - 30, 100, 60, height);
            });
        }

        function drawLearnedFilters(ctx, canvas) {
            ctx.fillStyle = '#e4e6eb';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('CNN Learned Filters', canvas.width / 2, 30);

            const labels = ['Edges', 'Textures', 'Patterns', 'Objects'];
            labels.forEach((label, i) => {
                const x = (i + 1) * canvas.width / 5;
                ctx.fillStyle = '#ff6b35';
                ctx.font = 'bold 12px Arial';
                ctx.fillText(label, x, 80);

                // Draw filter representation
                for (let j = 0; j < 3; j++) {
                    for (let k = 0; k < 3; k++) {
                        const intensity = Math.random();
                        ctx.fillStyle = `rgba(0, 212, 255, ${intensity})`;
                        ctx.fillRect(x - 20 + k * 12, 100 + j * 12, 10, 10);
                    }
                }
            });
        }

        function drawLeNetArchitecture(ctx, canvas) { drawCNNArchitecture(ctx, canvas); }
        function drawAlexNetArchitecture(ctx, canvas) { drawCNNArchitecture(ctx, canvas); }
        function drawVGGArchitecture(ctx, canvas) { drawCNNArchitecture(ctx, canvas); }
        function drawResNetArchitecture(ctx, canvas) { drawCNNArchitecture(ctx, canvas); }
        function drawInceptionModule(ctx, canvas) { drawCNNArchitecture(ctx, canvas); }
        function drawMobileNetArchitecture(ctx, canvas) { drawCNNArchitecture(ctx, canvas); }
        function drawTransferLearning(ctx, canvas) { drawCNNArchitecture(ctx, canvas); }

        function drawBoundingBoxes(ctx, canvas) {
            // Draw sample image
            ctx.fillStyle = 'rgba(0, 212, 255, 0.1)';
            ctx.fillRect(50, 50, 300, 300);

            // Draw bounding boxes
            ctx.strokeStyle = '#ff6b35';
            ctx.lineWidth = 3;
            ctx.strokeRect(100, 100, 150, 150);
            ctx.fillStyle = '#ff6b35';
            ctx.font = 'bold 12px Arial';
            ctx.fillText('Dog 95%', 105, 95);

            ctx.strokeStyle = '#00ff88';
            ctx.strokeRect(180, 200, 100, 80);
            ctx.fillStyle = '#00ff88';
            ctx.fillText('Cat 87%', 185, 195);
        }

        function drawRCNNPipeline(ctx, canvas) { drawBoundingBoxes(ctx, canvas); }
        function drawSSDDetector(ctx, canvas) { drawBoundingBoxes(ctx, canvas); }

        function drawSemanticSegmentation(ctx, canvas) {
            const cellSize = 15;
            const colors = ['rgba(0, 212, 255, 0.5)', 'rgba(255, 107, 53, 0.5)', 'rgba(0, 255, 136, 0.5)'];

            for (let i = 0; i < 20; i++) {
                for (let j = 0; j < 20; j++) {
                    ctx.fillStyle = colors[Math.floor(Math.random() * colors.length)];
                    ctx.fillRect(i * cellSize + 100, j * cellSize + 50, cellSize, cellSize);
                }
            }

            ctx.fillStyle = '#e4e6eb';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Pixel-wise Classification', canvas.width / 2, 30);
        }

        function drawInstanceSegmentation(ctx, canvas) { drawSemanticSegmentation(ctx, canvas); }

        function drawFaceEmbeddings(ctx, canvas) {
            ctx.fillStyle = '#e4e6eb';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Face Embedding Space', canvas.width / 2, 30);

            // Draw embedding vectors
            const faces = 5;
            for (let i = 0; i < faces; i++) {
                const x = 100 + Math.random() * (canvas.width - 200);
                const y = 100 + Math.random() * 200;
                ctx.fillStyle = '#00d4ff';
                ctx.beginPath();
                ctx.arc(x, y, 10, 0, Math.PI * 2);
                ctx.fill();
            }
        }

        function drawAutoencoderArchitecture(ctx, canvas) {
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 12px Arial';
            ctx.textAlign = 'center';

            const stages = ['Input', 'Encoder', 'Latent', 'Decoder', 'Output'];
            stages.forEach((label, i) => {
                const x = (i + 1) * canvas.width / 6;
                ctx.fillText(label, x, 50);
                const height = i === 2 ? 40 : (i === 0 || i === 4 ? 100 : 70);
                ctx.strokeStyle = '#00d4ff';
                ctx.strokeRect(x - 30, 100, 60, height);
            });
        }

        function drawGANsGame(ctx, canvas) {
            ctx.fillStyle = '#ff6b35';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Generator', canvas.width / 3, 50);
            ctx.fillStyle = '#00d4ff';
            ctx.fillText('Discriminator', canvas.width * 2 / 3, 50);

            // DrawGenerator
            ctx.strokeStyle = '#ff6b35';
            ctx.strokeRect(canvas.width / 3 - 50, 100, 100, 100);

            // Draw Discriminator
            ctx.strokeStyle = '#00d4ff';
            ctx.strokeRect(canvas.width * 2 / 3 - 50, 100, 100, 100);

            // Draw arrow
            ctx.strokeStyle = '#00ff88';
            ctx.lineWidth = 2;
            ctx.beginPath();
            ctx.moveTo(canvas.width / 3 + 50, 150);
            ctx.lineTo(canvas.width * 2 / 3 - 50, 150);
            ctx.stroke();
        }

        function drawDiffusionProcess(ctx, canvas) {
            const steps = 5;
            const stepWidth = canvas.width / (steps + 1);

            ctx.fillStyle = '#e4e6eb';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Diffusion Process: From Noise to Image', canvas.width / 2, 30);

            for (let i = 0; i < steps; i++) {
                const x = (i + 1) * stepWidth;
                const noise = 1 - (i / steps);
                ctx.fillStyle = `rgba(0, 212, 255, ${1 - noise})`;
                ctx.fillRect(x - 40, 100, 80, 80);
                ctx.strokeStyle = '#00d4ff';
                ctx.strokeRect(x - 40, 100, 80, 80);
            }
        }

        function drawRNNUnrolled(ctx, canvas) {
            const cells = 5;
            const cellWidth = canvas.width / (cells + 1);

            ctx.fillStyle = '#e4e6eb';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Unrolled RNN', canvas.width / 2, 30);

            for (let i = 0; i < cells; i++) {
                const x = (i + 1) * cellWidth;
                ctx.strokeStyle = '#00d4ff';
                ctx.strokeRect(x - 30, 100, 60, 60);

                if (i < cells - 1) {
                    ctx.strokeStyle = '#ff6b35';
                    ctx.lineWidth = 2;
                    ctx.beginPath();
                    ctx.moveTo(x + 30, 130);
                    ctx.lineTo(x + cellWidth - 30, 130);
                    ctx.stroke();
                }
            }
        }

        function drawBERTProcess(ctx, canvas) { drawAttentionMatrix(ctx, canvas); }
        function drawGPTGeneration(ctx, canvas) { drawAttentionMatrix(ctx, canvas); }
        function drawVisionTransformer(ctx, canvas) { drawAttentionMatrix(ctx, canvas); }

        function drawVisualization(moduleId) {
            drawConceptsVisualization(moduleId);
        }

        // Animation and download utilities
        let animationFrameId = null;

        function toggleVizAnimation(moduleId) {
            const btn = event.target;
            window.vizAnimating = !window.vizAnimating;

            if (window.vizAnimating) {
                btn.textContent = '⏹️ Stop';
                btn.style.background = 'linear-gradient(135deg, #ff4444, #cc0000)';
                animateVisualization(moduleId);
            } else {
                btn.textContent = '▶️ Animate';
                btn.style.background = '';
                if (animationFrameId) {
                    cancelAnimationFrame(animationFrameId);
                    animationFrameId = null;
                }
            }
        }

        function animateVisualization(moduleId) {
            if (!window.vizAnimating) return;

            const canvas = document.getElementById(moduleId + '-canvas');
            if (!canvas) return;

            const ctx = canvas.getContext('2d');
            ctx.clearRect(0, 0, canvas.width, canvas.height);
            ctx.fillStyle = '#0f1419';
            ctx.fillRect(0, 0, canvas.width, canvas.height);

            // Call the appropriate animated drawing function
            const animatedVizMap = {
                'nn-basics': drawAnimatedNetwork,
                'perceptron': drawAnimatedDecisionBoundary,
                'mlp': drawAnimatedMLP,
                'activation': drawAnimatedActivations,
                'conv-layer': drawAnimatedConvolution,
                'gnn': drawAnimatedGNN,
                'transformers': drawAnimatedAttention,
                'backprop': drawAnimatedGradientFlow,
                'gans': drawAnimatedGAN,
                'diffusion': drawAnimatedDiffusion,
                'rnn': drawAnimatedRNN
            };

            if (animatedVizMap[moduleId]) {
                animatedVizMap[moduleId](ctx, canvas, Date.now());
            } else {
                // Default animation - pulsing visualization
                drawDefaultAnimation(ctx, canvas, Date.now());
            }

            animationFrameId = requestAnimationFrame(() => animateVisualization(moduleId));
        }

        // Default animation for modules without specific animations
        function drawDefaultAnimation(ctx, canvas, time) {
            const centerX = canvas.width / 2;
            const centerY = canvas.height / 2;
            const pulse = Math.sin(time / 300) * 0.3 + 0.7;

            // Animated neural network
            const layers = [3, 4, 4, 2];
            const layerWidth = canvas.width / (layers.length + 1);

            layers.forEach((neurons, layerIdx) => {
                const x = (layerIdx + 1) * layerWidth;
                const layerHeight = canvas.height / (neurons + 1);

                for (let i = 0; i < neurons; i++) {
                    const y = (i + 1) * layerHeight;
                    const radius = 12 + Math.sin(time / 200 + layerIdx + i) * 3;

                    // Draw neuron
                    ctx.fillStyle = `rgba(0, 212, 255, ${pulse})`;
                    ctx.beginPath();
                    ctx.arc(x, y, radius, 0, Math.PI * 2);
                    ctx.fill();
                    
                    // Draw connections to next layer
                    if (layerIdx < layers.length - 1) {
                        const nextLayerHeight = canvas.height / (layers[layerIdx + 1] + 1);
                        const nextX = (layerIdx + 2) * layerWidth;
                        
                        for (let j = 0; j < layers[layerIdx + 1]; j++) {
                            const nextY = (j + 1) * nextLayerHeight;
                            const signalProgress = ((time / 500) + layerIdx * 0.5) % 1;
                            
                            ctx.strokeStyle = `rgba(0, 212, 255, ${0.3 + signalProgress * 0.3})`;
                            ctx.lineWidth = 1;
                            ctx.beginPath();
                            ctx.moveTo(x + radius, y);
                            ctx.lineTo(nextX - 12, nextY);
                            ctx.stroke();
                            
                            // Animated signal dot
                            const dotX = x + radius + (nextX - 12 - x - radius) * signalProgress;
                            const dotY = y + (nextY - y) * signalProgress;
                            ctx.fillStyle = '#00ff88';
                            ctx.beginPath();
                            ctx.arc(dotX, dotY, 3, 0, Math.PI * 2);
                            ctx.fill();
                        }
                    }
                }
            });
            
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 14px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('🔄 Neural Network Animation', centerX, 25);
        }
        
        // Animated GNN with message passing
        function drawAnimatedGNN(ctx, canvas, time) {
            ctx.fillStyle = '#9900ff';
            ctx.font = 'bold 16px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Graph Neural Network - Message Passing', canvas.width / 2, 30);

            const nodes = [
                { x: 100, y: 100 }, { x: 200, y: 60 }, { x: 320, y: 120 },
                { x: 150, y: 200 }, { x: 400, y: 80 }, { x: 450, y: 180 }
            ];
            const edges = [[0, 1], [0, 3], [1, 2], [1, 4], [2, 3], [2, 4], [4, 5]];

            // Draw edges
            ctx.strokeStyle = 'rgba(153, 0, 255, 0.4)';
            ctx.lineWidth = 2;
            edges.forEach(e => {
                ctx.beginPath();
                ctx.moveTo(nodes[e[0]].x, nodes[e[0]].y);
                ctx.lineTo(nodes[e[1]].x, nodes[e[1]].y);
                ctx.stroke();
            });

            // Draw animated message passing
            const messageProgress = (time / 1000) % 1;
            ctx.fillStyle = '#00ff88';
            edges.forEach((e, idx) => {
                const progress = (messageProgress + idx * 0.15) % 1;
                const x = nodes[e[0]].x + (nodes[e[1]].x - nodes[e[0]].x) * progress;
                const y = nodes[e[0]].y + (nodes[e[1]].y - nodes[e[0]].y) * progress;
                ctx.beginPath();
                ctx.arc(x, y, 5, 0, Math.PI * 2);
                ctx.fill();
            });

            // Draw nodes with pulse
            const pulse = Math.sin(time / 300) * 5 + 15;
            nodes.forEach((n, i) => {
                ctx.fillStyle = '#9900ff';
                ctx.beginPath();
                ctx.arc(n.x, n.y, pulse, 0, Math.PI * 2);
                ctx.fill();
                ctx.fillStyle = 'white';
                ctx.font = '12px Arial';
                ctx.textAlign = 'center';
                ctx.fillText(i, n.x, n.y + 4);
            });
        }
        
        // Animated attention matrix
        function drawAnimatedAttention(ctx, canvas, time) {
            const words = ['The', 'cat', 'sat', 'on', 'mat'];
            const cellSize = 50;
            const startX = (canvas.width - words.length * cellSize) / 2;
            const startY = 80;
            
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 16px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Self-Attention Animation', canvas.width / 2, 30);
            
            // Draw words
            ctx.font = '12px Arial';
            words.forEach((word, i) => {
                ctx.fillStyle = '#e4e6eb';
                ctx.fillText(word, startX + i * cellSize + cellSize/2, startY - 10);
                ctx.save();
                ctx.translate(startX - 20, startY + i * cellSize + cellSize/2);
                ctx.fillText(word, 0, 0);
                ctx.restore();
            });
            
            // Animated attention weights
            for (let i = 0; i < words.length; i++) {
                for (let j = 0; j < words.length; j++) {
                    const baseWeight = i === j ? 0.8 : 0.2 + Math.abs(i - j) * 0.1;
                    const animatedWeight = baseWeight + Math.sin(time / 500 + i + j) * 0.2;
                    const alpha = Math.max(0.1, Math.min(1, animatedWeight));
                    
                    ctx.fillStyle = `rgba(0, 212, 255, ${alpha})`;
                    ctx.fillRect(startX + j * cellSize + 2, startY + i * cellSize + 2, cellSize - 4, cellSize - 4);
                    
                    ctx.fillStyle = '#e4e6eb';
                    ctx.font = '10px Arial';
                    ctx.fillText(animatedWeight.toFixed(2), startX + j * cellSize + cellSize/2, startY + i * cellSize + cellSize/2 + 4);
                }
            }
        }
        
        // Animated gradient flow for backprop
        function drawAnimatedGradientFlow(ctx, canvas, time) {
            ctx.fillStyle = '#ff6b35';
            ctx.font = 'bold 16px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Backpropagation - Gradient Flow', canvas.width / 2, 30);
            
            const layers = [2, 4, 4, 1];
            const layerWidth = canvas.width / (layers.length + 1);
            
            // Forward pass (left to right) - blue
            const forwardProgress = (time / 2000) % 1;
            
            layers.forEach((neurons, layerIdx) => {
                const x = (layerIdx + 1) * layerWidth;
                const layerHeight = canvas.height / (neurons + 1);
                
                for (let i = 0; i < neurons; i++) {
                    const y = (i + 1) * layerHeight;
                    
                    // Pulse effect based on forward pass
                    const isActive = forwardProgress > layerIdx / layers.length;
                    const radius = isActive ? 15 + Math.sin(time / 200) * 3 : 12;
                    
                    ctx.fillStyle = isActive ? '#00d4ff' : 'rgba(0, 212, 255, 0.3)';
                    ctx.beginPath();
                    ctx.arc(x, y, radius, 0, Math.PI * 2);
                    ctx.fill();
                }
            });
            
            // Backward pass (right to left) - orange/red gradients
            const backwardProgress = ((time / 2000) + 0.5) % 1;
            
            for (let layerIdx = layers.length - 2; layerIdx >= 0; layerIdx--) {
                const x1 = (layerIdx + 1) * layerWidth;
                const x2 = (layerIdx + 2) * layerWidth;
                const gradientActive = backwardProgress > (layers.length - 2 - layerIdx) / (layers.length - 1);
                
                if (gradientActive) {
                    const gradX = x2 - (x2 - x1) * ((backwardProgress * (layers.length - 1)) % 1);
                    ctx.fillStyle = '#ff6b35';
                    ctx.beginPath();
                    ctx.arc(gradX, canvas.height / 2, 8, 0, Math.PI * 2);
                    ctx.fill();
                }
            }
            
            ctx.fillStyle = '#e4e6eb';
            ctx.font = '12px Arial';
            ctx.fillText('Forward: Blue →  |  Backward: Orange ←', canvas.width / 2, canvas.height - 20);
        }
        
        // Animated network for nn-basics
        function drawAnimatedNetwork(ctx, canvas, time) {
            drawDefaultAnimation(ctx, canvas, time);
        }
        
        // Animated decision boundary for perceptron
        function drawAnimatedDecisionBoundary(ctx, canvas, time) {
            const centerX = canvas.width / 2;
            const centerY = canvas.height / 2;
            
            ctx.fillStyle = '#ff6b35';
            ctx.font = 'bold 16px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Perceptron Decision Boundary', canvas.width / 2, 30);
            
            // Animated rotating decision boundary
            const angle = time / 2000;
            const length = 200;
            
            ctx.strokeStyle = '#ff6b35';
            ctx.lineWidth = 3;
            ctx.beginPath();
            ctx.moveTo(centerX - Math.cos(angle) * length, centerY - Math.sin(angle) * length);
            ctx.lineTo(centerX + Math.cos(angle) * length, centerY + Math.sin(angle) * length);
            ctx.stroke();
            
            // Fixed sample points
            const points = [
                {x: 100, y: 80, c: 1}, {x: 150, y: 100, c: 1}, {x: 120, y: 150, c: 1},
                {x: 400, y: 200, c: 0}, {x: 450, y: 180, c: 0}, {x: 380, y: 250, c: 0}
            ];
            
            points.forEach(p => {
                ctx.fillStyle = p.c === 1 ? '#00d4ff' : '#00ff88';
                ctx.beginPath();
                ctx.arc(p.x, p.y, 8, 0, Math.PI * 2);
                ctx.fill();
            });
        }
        
        function drawAnimatedMLP(ctx, canvas, time) {
            drawDefaultAnimation(ctx, canvas, time);
        }
        
        function drawAnimatedActivations(ctx, canvas, time) {
            drawActivationFunctions(ctx, canvas);
            
            // Add animated input marker
            const x = Math.sin(time / 500) * 4;
            const centerX = canvas.width / 2;
            const centerY = canvas.height / 2;
            const scale = 40;
            
            ctx.fillStyle = '#ffffff';
            ctx.beginPath();
            ctx.arc(centerX + x * scale, centerY, 6, 0, Math.PI * 2);
            ctx.fill();
            
            ctx.strokeStyle = '#ffffff';
            ctx.setLineDash([5, 5]);
            ctx.beginPath();
            ctx.moveTo(centerX + x * scale, 0);
            ctx.lineTo(centerX + x * scale, canvas.height);
            ctx.stroke();
            ctx.setLineDash([]);
        }
        
        function drawAnimatedConvolution(ctx, canvas, time) {
            drawConvolutionAnimation(ctx, canvas);
        }
        
        function drawAnimatedGAN(ctx, canvas, time) {
            ctx.fillStyle = '#ffaa00';
            ctx.font = 'bold 16px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('GAN Training Animation', canvas.width / 2, 30);
            
            const phase = Math.floor(time / 1000) % 4;
            
            // Generator
            ctx.fillStyle = phase <= 1 ? '#00ff88' : 'rgba(0, 255, 136, 0.3)';
            ctx.fillRect(50, 100, 100, 80);
            ctx.fillStyle = '#e4e6eb';
            ctx.font = '12px Arial';
            ctx.fillText('Generator', 100, 145);
            
            // Fake image
            const noiseToFake = Math.sin(time / 300) * 0.5 + 0.5;
            ctx.fillStyle = `rgba(255, 170, 0, ${noiseToFake})`;
            ctx.fillRect(200, 110, 60, 60);
            ctx.fillStyle = '#e4e6eb';
            ctx.fillText('Fake', 230, 200);
            
            // Discriminator
            ctx.fillStyle = phase >= 2 ? '#ff6b35' : 'rgba(255, 107, 53, 0.3)';
            ctx.fillRect(320, 100, 100, 80);
            ctx.fillStyle = '#e4e6eb';
            ctx.fillText('Discriminator', 370, 145);
            
            // Output
            const output = phase === 3 ? 'Real?' : 'Fake?';
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 14px Arial';
            ctx.fillText(output, 370, 220);
            
            // Arrows
            ctx.strokeStyle = '#e4e6eb';
            ctx.lineWidth = 2;
            ctx.beginPath();
            ctx.moveTo(150, 140);
            ctx.lineTo(200, 140);
            ctx.stroke();
            ctx.beginPath();
            ctx.moveTo(260, 140);
            ctx.lineTo(320, 140);
            ctx.stroke();
        }
        
        function drawAnimatedDiffusion(ctx, canvas, time) {
            ctx.fillStyle = '#9900ff';
            ctx.font = 'bold 16px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Diffusion Process Animation', canvas.width / 2, 30);
            
            const steps = 5;
            const stepWidth = canvas.width / (steps + 1);
            
            const progress = (time / 3000) % 1;
            const currentStep = Math.floor(progress * steps);
            
            for (let i = 0; i < steps; i++) {
                const x = (i + 1) * stepWidth;
                const y = 150;
                const noiseLevel = i / (steps - 1);
                const isActive = i <= currentStep;
                
                // Draw square with noise
                ctx.fillStyle = isActive ? '#9900ff' : 'rgba(153, 0, 255, 0.3)';
                ctx.fillRect(x - 30, y - 30, 60, 60);
                
                // Add noise dots
                if (noiseLevel > 0) {
                    for (let j = 0; j < noiseLevel * 20; j++) {
                        const nx = x - 25 + Math.random() * 50;
                        const ny = y - 25 + Math.random() * 50;
                        ctx.fillStyle = 'rgba(255, 255, 255, 0.5)';
                        ctx.fillRect(nx, ny, 2, 2);
                    }
                }
                
                ctx.fillStyle = '#e4e6eb';
                ctx.font = '10px Arial';
                ctx.fillText(`t=${i}`, x, y + 50);
            }
            
            ctx.fillStyle = '#e4e6eb';
            ctx.font = '12px Arial';
            ctx.fillText('Clean → Noisy (Forward) | Noisy → Clean (Reverse)', canvas.width / 2, canvas.height - 20);
        }
        
        function drawAnimatedRNN(ctx, canvas, time) {
            ctx.fillStyle = '#00d4ff';
            ctx.font = 'bold 16px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('RNN Unrolled Through Time', canvas.width / 2, 30);
            
            const steps = 5;
            const stepWidth = canvas.width / (steps + 1);
            const progress = (time / 500) % steps;
            const activeStep = Math.floor(progress);
            
            for (let i = 0; i < steps; i++) {
                const x = (i + 1) * stepWidth;
                const y = 150;
                const isActive = i === activeStep;
                
                // Hidden state
                ctx.fillStyle = isActive ? '#00d4ff' : 'rgba(0, 212, 255, 0.3)';
                ctx.beginPath();
                ctx.arc(x, y, 25, 0, Math.PI * 2);
                ctx.fill();
                
                ctx.fillStyle = '#e4e6eb';
                ctx.font = '10px Arial';
                ctx.fillText(`h${i}`, x, y + 4);
                
                // Input arrow
                ctx.strokeStyle = isActive ? '#00ff88' : 'rgba(0, 255, 136, 0.3)';
                ctx.lineWidth = 2;
                ctx.beginPath();
                ctx.moveTo(x, y + 60);
                ctx.lineTo(x, y + 25);
                ctx.stroke();
                ctx.fillText(`x${i}`, x, y + 75);
                
                // Recurrent connection
                if (i < steps - 1) {
                    ctx.strokeStyle = isActive ? '#ff6b35' : 'rgba(255, 107, 53, 0.3)';
                    ctx.beginPath();
                    ctx.moveTo(x + 25, y);
                    ctx.lineTo(x + stepWidth - 25, y);
                    ctx.stroke();
                    
                    // Animated signal
                    if (isActive) {
                        const signalX = x + 25 + (stepWidth - 50) * (progress % 1);
                        ctx.fillStyle = '#ff6b35';
                        ctx.beginPath();
                        ctx.arc(signalX, y, 5, 0, Math.PI * 2);
                        ctx.fill();
                    }
                }
            }
        }

        function downloadViz(moduleId) {
            const canvas = document.getElementById(moduleId + '-canvas');
            if (!canvas) return;

            const link = document.createElement('a');
            link.href = canvas.toDataURL('image/png');
            link.download = moduleId + '-visualization.png';
            link.click();
        }

        function drawGraphNetwork(ctx, canvas) {
            ctx.fillStyle = '#9900ff';
            ctx.font = 'bold 16px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Graph Structure & Message Passing', canvas.width / 2, 30);

            const nodes = [
                { x: 100, y: 100 }, { x: 200, y: 50 }, { x: 300, y: 150 },
                { x: 150, y: 250 }, { x: 400, y: 100 }, { x: 500, y: 200 }
            ];
            const edges = [
                [0, 1], [0, 3], [1, 2], [1, 4], [2, 3], [2, 4], [4, 5]
            ];

            // Draw edges
            ctx.strokeStyle = 'rgba(153, 0, 255, 0.4)';
            ctx.lineWidth = 2;
            edges.forEach(e => {
                ctx.beginPath();
                ctx.moveTo(nodes[e[0]].x, nodes[e[0]].y);
                ctx.lineTo(nodes[e[1]].x, nodes[e[1]].y);
                ctx.stroke();
            });

            // Draw nodes
            nodes.forEach((n, i) => {
                ctx.fillStyle = '#9900ff';
                ctx.beginPath();
                ctx.arc(n.x, n.y, 15, 0, Math.PI * 2);
                ctx.fill();
                ctx.fillStyle = 'white';
                ctx.font = '12px Arial';
                ctx.fillText(i, n.x, n.y + 4);
            });

            // Draw Message Passing Animation (fake)
            const t = (Date.now() / 1000) % 2;
            if (t > 1) {
                ctx.strokeStyle = '#00ff88';
                ctx.lineWidth = 4;
                edges.forEach((e, idx) => {
                    if (idx % 2 === 0) {
                        ctx.beginPath();
                        ctx.moveTo(nodes[e[0]].x, nodes[e[0]].y);
                        ctx.lineTo(nodes[e[1]].x, nodes[e[1]].y);
                        ctx.stroke();
                    }
                });
            }
        }

        function drawGNNMath(ctx, canvas) {
            ctx.fillStyle = '#9900ff';
            ctx.font = 'bold 16px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('Graph Convolution Math', canvas.width / 2, 50);

            ctx.fillStyle = '#e4e6eb';
            ctx.font = '14px Courier New';
            ctx.fillText('H(l+1) = σ(D^-½ A D^-½ H(l) W(l))', canvas.width / 2, 100);

            ctx.fillStyle = '#00ff88';
            ctx.fillText('A = Neighborhood Connections', canvas.width / 2, 150);
            ctx.fillStyle = '#ff6b35';
            ctx.fillText('D = Normalization Factor', canvas.width / 2, 180);
        }

        function drawGNNApplications(ctx, canvas) {
            ctx.fillStyle = '#9900ff';
            ctx.font = 'bold 16px Arial';
            ctx.textAlign = 'center';
            ctx.fillText('💊 Drug Discovery (Molecular Graphs)', canvas.width / 2, 60);

            ctx.fillStyle = '#00d4ff';
            ctx.fillText('🚗 Traffic Flow Prediction', canvas.width / 2, 120);

            ctx.fillStyle = '#ff6b35';
            ctx.fillText('🛒 Pinterest/Amazon Recommendations', canvas.width / 2, 180);
        }

        initDashboard();
    </script>
</body>

</html>