File size: 230,126 Bytes
e4e1bf1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>CLAT UG Ultimate Study Guide 2027</title>
  <link
    href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,900;1,700&family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap"
    rel="stylesheet">
  <style>
    :root {
      --ink: #1a1a2e;
      --deep: #16213e;
      --accent: #e94560;
      --gold: #f5a623;
      --teal: #0f9b8e;
      --paper: #faf8f3;
      --muted: #6b7280;
      --light: #f3f0e8;
      --border: #e2ddd4;
      --green: #16a34a;
      --purple: #7c3aed;
    }

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      font-family: 'DM Sans', sans-serif;
      background: var(--paper);
      color: var(--ink);
      line-height: 1.7;
      font-size: 15px;
    }

    .hero {
      background: var(--ink);
      color: white;
      padding: 60px 40px 50px;
      position: relative;
      overflow: hidden;
    }

    .hero::before {
      content: '';
      position: absolute;
      top: -80px;
      right: -80px;
      width: 320px;
      height: 320px;
      border-radius: 50%;
      background: radial-gradient(circle, rgba(233, 69, 96, 0.35) 0%, transparent 70%);
    }

    .hero::after {
      content: '';
      position: absolute;
      bottom: -60px;
      left: 10%;
      width: 200px;
      height: 200px;
      border-radius: 50%;
      background: radial-gradient(circle, rgba(15, 155, 142, 0.25) 0%, transparent 70%);
    }

    .hero-badge {
      display: inline-block;
      background: var(--accent);
      color: white;
      font-size: 11px;
      font-weight: 600;
      letter-spacing: 2px;
      text-transform: uppercase;
      padding: 5px 14px;
      border-radius: 20px;
      margin-bottom: 18px;
    }

    .hero h1 {
      font-family: 'Playfair Display', serif;
      font-size: clamp(30px, 5vw, 52px);
      font-weight: 900;
      line-height: 1.1;
      margin-bottom: 14px;
    }

    .hero h1 span {
      color: var(--accent);
    }

    .hero p {
      font-size: 15px;
      color: rgba(255, 255, 255, 0.7);
      max-width: 580px;
      margin-bottom: 28px;
    }

    .hero-stats {
      display: flex;
      gap: 20px;
      flex-wrap: wrap;
    }

    .stat-box {
      background: rgba(255, 255, 255, 0.08);
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 10px;
      padding: 12px 20px;
      text-align: center;
    }

    .stat-box .num {
      font-family: 'Playfair Display', serif;
      font-size: 24px;
      font-weight: 700;
      color: var(--gold);
      display: block;
    }

    .stat-box .label {
      font-size: 11px;
      color: rgba(255, 255, 255, 0.55);
      text-transform: uppercase;
      letter-spacing: 1px;
    }

    .tabs-wrap {
      background: var(--deep);
      padding: 0 30px;
      display: flex;
      gap: 0;
      overflow-x: auto;
      scrollbar-width: none;
      position: sticky;
      top: 0;
      z-index: 100;
    }

    .tabs-wrap::-webkit-scrollbar {
      display: none;
    }

    .tab-btn {
      background: none;
      border: none;
      color: rgba(255, 255, 255, 0.5);
      font-family: 'DM Sans', sans-serif;
      font-size: 13px;
      font-weight: 500;
      padding: 15px 18px;
      cursor: pointer;
      white-space: nowrap;
      border-bottom: 3px solid transparent;
      transition: all 0.2s;
    }

    .tab-btn:hover {
      color: white;
    }

    .tab-btn.active {
      color: var(--gold);
      border-bottom-color: var(--gold);
    }

    .container {
      max-width: 920px;
      margin: 0 auto;
      padding: 40px 24px 80px;
    }

    .section {
      display: none;
    }

    .section.active {
      display: block;
    }

    .sec-header {
      display: flex;
      align-items: center;
      gap: 16px;
      margin-bottom: 32px;
      padding-bottom: 20px;
      border-bottom: 2px solid var(--border);
    }

    .sec-icon {
      width: 52px;
      height: 52px;
      border-radius: 14px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 22px;
      flex-shrink: 0;
    }

    .sec-header h2 {
      font-family: 'Playfair Display', serif;
      font-size: 26px;
      font-weight: 700;
    }

    .sec-header p {
      font-size: 13px;
      color: var(--muted);
      margin-top: 2px;
    }

    .card {
      background: white;
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 24px;
      margin-bottom: 20px;
      transition: box-shadow 0.2s;
    }

    .card:hover {
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
    }

    .card-title {
      font-family: 'Playfair Display', serif;
      font-size: 18px;
      font-weight: 700;
      margin-bottom: 10px;
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }

    .tag {
      font-family: 'DM Mono', monospace;
      font-size: 10px;
      padding: 3px 10px;
      border-radius: 20px;
      font-weight: 500;
    }

    .tag-red {
      background: #fde8ec;
      color: var(--accent);
    }

    .tag-teal {
      background: #e0f5f3;
      color: var(--teal);
    }

    .tag-gold {
      background: #fef3dc;
      color: #b07d1a;
    }

    .tag-blue {
      background: #e0e8f9;
      color: #3a5bbf;
    }

    .tag-purple {
      background: #ede8f9;
      color: #6b4bbf;
    }

    .tag-green {
      background: #e0f5e9;
      color: #16a34a;
    }

    ul.notes {
      padding-left: 0;
      list-style: none;
    }

    ul.notes li {
      padding: 7px 0 7px 24px;
      position: relative;
      border-bottom: 1px solid var(--light);
      font-size: 14.5px;
    }

    ul.notes li:last-child {
      border-bottom: none;
    }

    ul.notes li::before {
      content: '→';
      position: absolute;
      left: 0;
      color: var(--accent);
      font-weight: 700;
    }

    .highlight-box {
      background: linear-gradient(135deg, #fff8e1, #fff3cd);
      border-left: 4px solid var(--gold);
      border-radius: 0 10px 10px 0;
      padding: 16px 20px;
      margin: 16px 0;
      font-size: 14px;
    }

    .highlight-box strong {
      color: #8a6200;
    }

    .tip-box {
      background: #e8f8f6;
      border-left: 4px solid var(--teal);
      border-radius: 0 10px 10px 0;
      padding: 16px 20px;
      margin: 16px 0;
      font-size: 14px;
      color: #1a4a45;
    }

    .warn-box {
      background: #fdecea;
      border-left: 4px solid var(--accent);
      border-radius: 0 10px 10px 0;
      padding: 16px 20px;
      margin: 16px 0;
      font-size: 14px;
      color: #7a1c1c;
    }

    .success-box {
      background: #e8f5e9;
      border-left: 4px solid var(--green);
      border-radius: 0 10px 10px 0;
      padding: 16px 20px;
      margin: 16px 0;
      font-size: 14px;
      color: #14532d;
    }

    .grid-2 {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
      margin-bottom: 20px;
    }

    @media (max-width: 600px) {
      .grid-2 {
        grid-template-columns: 1fr;
      }
    }

    .mini-card {
      background: white;
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 18px;
    }

    .mini-card h4 {
      font-size: 13px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: var(--muted);
      margin-bottom: 10px;
    }

    .mini-card p,
    .mini-card li {
      font-size: 14px;
    }

    .pattern-table {
      width: 100%;
      border-collapse: collapse;
      margin-bottom: 20px;
      font-size: 14px;
    }

    .pattern-table th {
      background: var(--ink);
      color: white;
      padding: 12px 16px;
      text-align: left;
      font-weight: 600;
    }

    .pattern-table th:first-child {
      border-radius: 10px 0 0 0;
    }

    .pattern-table th:last-child {
      border-radius: 0 10px 0 0;
    }

    .pattern-table td {
      padding: 12px 16px;
      border-bottom: 1px solid var(--border);
    }

    .pattern-table tr:nth-child(even) td {
      background: var(--light);
    }

    .pattern-table tr:last-child td {
      font-weight: 700;
      background: #f0ede4;
    }

    .term-entry {
      padding: 14px 0;
      border-bottom: 1px solid var(--border);
      display: grid;
      grid-template-columns: 200px 1fr;
      gap: 12px;
      align-items: start;
    }

    .term-entry:last-child {
      border-bottom: none;
    }

    .term-name {
      font-family: 'DM Mono', monospace;
      font-size: 13px;
      font-weight: 500;
      color: var(--accent);
      padding-top: 2px;
    }

    .term-def {
      font-size: 14px;
    }

    @media (max-width: 550px) {
      .term-entry {
        grid-template-columns: 1fr;
        gap: 4px;
      }
    }

    .timeline {
      position: relative;
      padding-left: 30px;
    }

    .timeline::before {
      content: '';
      position: absolute;
      left: 9px;
      top: 0;
      bottom: 0;
      width: 2px;
      background: var(--border);
    }

    .tl-item {
      position: relative;
      padding-bottom: 24px;
      padding-left: 24px;
    }

    .tl-item::before {
      content: '';
      position: absolute;
      left: -25px;
      top: 5px;
      width: 12px;
      height: 12px;
      border-radius: 50%;
      background: var(--accent);
      border: 2px solid var(--paper);
      box-shadow: 0 0 0 2px var(--accent);
    }

    .tl-item h4 {
      font-weight: 600;
      font-size: 15px;
    }

    .tl-item p {
      font-size: 13px;
      color: var(--muted);
      margin-top: 3px;
    }

    .month-card {
      background: white;
      border: 1px solid var(--border);
      border-radius: 14px;
      overflow: hidden;
      margin-bottom: 16px;
    }

    .month-header {
      padding: 14px 20px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      cursor: pointer;
      background: white;
    }

    .month-header:hover {
      background: var(--light);
    }

    .month-header h3 {
      font-size: 16px;
      font-weight: 600;
    }

    .month-body {
      padding: 0 20px 20px;
      display: none;
      border-top: 1px solid var(--border);
    }

    .month-body.open {
      display: block;
    }

    .month-body ul {
      padding-left: 18px;
      margin-top: 12px;
    }

    .month-body li {
      font-size: 14px;
      padding: 4px 0;
    }

    .resource-item {
      display: flex;
      gap: 14px;
      align-items: flex-start;
      padding: 14px 0;
      border-bottom: 1px solid var(--border);
    }

    .resource-item:last-child {
      border-bottom: none;
    }

    .res-icon {
      width: 40px;
      height: 40px;
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      flex-shrink: 0;
    }

    .resource-item h4 {
      font-size: 15px;
      font-weight: 600;
      margin-bottom: 2px;
    }

    .resource-item p {
      font-size: 13px;
      color: var(--muted);
    }

    /* ASSESSMENT */
    .assess-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      gap: 16px;
      margin-bottom: 24px;
    }

    .assess-card {
      background: white;
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 20px;
      text-align: center;
      cursor: pointer;
      transition: all 0.2s;
    }

    .assess-card:hover {
      border-color: var(--accent);
      box-shadow: 0 4px 20px rgba(233, 69, 96, 0.1);
      transform: translateY(-2px);
    }

    .assess-card .icon {
      font-size: 28px;
      margin-bottom: 10px;
    }

    .assess-card h4 {
      font-size: 15px;
      font-weight: 600;
      margin-bottom: 4px;
    }

    .assess-card p {
      font-size: 12px;
      color: var(--muted);
    }

    .assess-card .badge {
      display: inline-block;
      font-size: 10px;
      font-weight: 600;
      padding: 2px 8px;
      border-radius: 20px;
      margin-top: 8px;
    }

    #quiz-area {
      background: white;
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 28px;
      margin-top: 20px;
    }

    .quiz-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20px;
      padding-bottom: 14px;
      border-bottom: 1px solid var(--border);
    }

    .quiz-header h3 {
      font-family: 'Playfair Display', serif;
      font-size: 20px;
    }

    .quiz-meta {
      font-size: 13px;
      color: var(--muted);
    }

    .progress-bar {
      width: 100%;
      height: 6px;
      background: var(--light);
      border-radius: 3px;
      margin-bottom: 24px;
      overflow: hidden;
    }

    .progress-fill {
      height: 100%;
      background: var(--accent);
      border-radius: 3px;
      transition: width 0.4s;
    }

    .passage-box {
      background: var(--light);
      border-radius: 10px;
      padding: 18px 20px;
      margin-bottom: 20px;
      font-size: 14px;
      line-height: 1.8;
      border-left: 4px solid var(--teal);
    }

    .passage-box p {
      margin-bottom: 8px;
    }

    .question-text {
      font-size: 16px;
      font-weight: 600;
      margin-bottom: 16px;
      line-height: 1.5;
    }

    .options-list {
      list-style: none;
      padding: 0;
    }

    .options-list li {
      margin-bottom: 10px;
    }

    .option-btn {
      width: 100%;
      text-align: left;
      padding: 12px 18px;
      background: white;
      border: 1.5px solid var(--border);
      border-radius: 10px;
      font-family: 'DM Sans', sans-serif;
      font-size: 14px;
      cursor: pointer;
      transition: all 0.2s;
      line-height: 1.5;
    }

    .option-btn:hover:not(:disabled) {
      border-color: var(--accent);
      background: #fff5f6;
    }

    .option-btn.correct {
      border-color: var(--green);
      background: #e8f5e9;
      color: #14532d;
    }

    .option-btn.wrong {
      border-color: var(--accent);
      background: #fdecea;
      color: #7a1c1c;
    }

    .option-btn.reveal {
      border-color: var(--green);
      background: #e8f5e9;
      color: #14532d;
    }

    .explanation-box {
      background: #f0fdf4;
      border: 1px solid #bbf7d0;
      border-radius: 10px;
      padding: 14px 18px;
      margin-top: 14px;
      font-size: 14px;
      display: none;
    }

    .explanation-box.show {
      display: block;
    }

    .explanation-box strong {
      color: var(--green);
    }

    .quiz-nav {
      display: flex;
      gap: 12px;
      margin-top: 20px;
      align-items: center;
    }

    .btn-primary {
      background: var(--accent);
      color: white;
      border: none;
      padding: 10px 24px;
      border-radius: 8px;
      font-family: 'DM Sans', sans-serif;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: opacity 0.2s;
    }

    .btn-primary:hover {
      opacity: 0.9;
    }

    .btn-secondary {
      background: white;
      color: var(--ink);
      border: 1.5px solid var(--border);
      padding: 10px 24px;
      border-radius: 8px;
      font-family: 'DM Sans', sans-serif;
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s;
    }

    .btn-secondary:hover {
      border-color: var(--ink);
    }

    .score-panel {
      text-align: center;
      padding: 30px 20px;
    }

    .score-circle {
      width: 120px;
      height: 120px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto 20px;
      font-family: 'Playfair Display', serif;
      font-size: 36px;
      font-weight: 700;
    }

    .score-great {
      background: #e8f5e9;
      color: var(--green);
      border: 3px solid var(--green);
    }

    .score-ok {
      background: #fff8e1;
      color: #b07d1a;
      border: 3px solid var(--gold);
    }

    .score-low {
      background: #fdecea;
      color: var(--accent);
      border: 3px solid var(--accent);
    }

    .score-breakdown {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 12px;
      margin: 20px 0;
    }

    .score-stat {
      background: var(--light);
      border-radius: 10px;
      padding: 12px;
      text-align: center;
    }

    .score-stat .n {
      font-size: 22px;
      font-weight: 700;
      font-family: 'Playfair Display', serif;
    }

    .score-stat .l {
      font-size: 12px;
      color: var(--muted);
    }

    .ai-loading {
      display: flex;
      align-items: center;
      gap: 10px;
      color: var(--muted);
      font-size: 14px;
      padding: 12px;
    }

    .spinner {
      width: 18px;
      height: 18px;
      border: 2px solid var(--border);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: spin 0.7s linear infinite;
      flex-shrink: 0;
    }

    @keyframes spin {
      to {
        transform: rotate(360deg);
      }
    }

    .ai-feedback {
      background: linear-gradient(135deg, #f0f4ff, #ede8f9);
      border: 1px solid #c4b5fd;
      border-radius: 10px;
      padding: 16px 20px;
      margin-top: 16px;
      font-size: 14px;
    }

    .ai-feedback .ai-label {
      font-size: 11px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--purple);
      margin-bottom: 6px;
    }

    /* NOTES SECTION */
    .notes-tabs {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-bottom: 20px;
    }

    .notes-tab {
      padding: 8px 18px;
      border-radius: 20px;
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      border: 1.5px solid var(--border);
      background: white;
      transition: all 0.2s;
    }

    .notes-tab.active {
      background: var(--ink);
      color: white;
      border-color: var(--ink);
    }

    .notes-panel {
      display: none;
    }

    .notes-panel.active {
      display: block;
    }

    .concept-box {
      background: white;
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 18px 20px;
      margin-bottom: 14px;
    }

    .concept-box h4 {
      font-size: 15px;
      font-weight: 600;
      color: var(--ink);
      margin-bottom: 8px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .concept-box p {
      font-size: 14px;
      line-height: 1.7;
      color: #374151;
    }

    .concept-box ul {
      padding-left: 16px;
      margin-top: 6px;
    }

    .concept-box ul li {
      font-size: 14px;
      padding: 3px 0;
    }

    .key-pill {
      display: inline-block;
      background: #fde8ec;
      color: var(--accent);
      font-size: 11px;
      font-weight: 600;
      padding: 2px 10px;
      border-radius: 20px;
    }

    .flashcard-wrap {
      perspective: 1000px;
      cursor: pointer;
      margin-bottom: 16px;
    }

    .flashcard {
      width: 100%;
      min-height: 120px;
      position: relative;
      transform-style: preserve-3d;
      transition: transform 0.5s;
    }

    .flashcard.flipped {
      transform: rotateY(180deg);
    }

    .fc-front,
    .fc-back {
      position: absolute;
      width: 100%;
      min-height: 120px;
      backface-visibility: hidden;
      border-radius: 12px;
      padding: 20px 24px;
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
    }

    .fc-front {
      background: var(--ink);
      color: white;
      flex-direction: column;
      gap: 8px;
    }

    .fc-front .fc-label {
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: rgba(255, 255, 255, 0.5);
    }

    .fc-front .fc-q {
      font-size: 16px;
      font-weight: 500;
      line-height: 1.5;
    }

    .fc-back {
      background: var(--teal);
      color: white;
      transform: rotateY(180deg);
      font-size: 15px;
      line-height: 1.6;
      flex-direction: column;
      gap: 8px;
    }

    .fc-back .fc-label {
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: rgba(255, 255, 255, 0.6);
    }

    .fc-nav {
      display: flex;
      gap: 10px;
      align-items: center;
      justify-content: center;
      margin-top: 4px;
    }

    .fc-count {
      font-size: 13px;
      color: var(--muted);
    }

    .footer {
      text-align: center;
      padding: 30px;
      background: var(--ink);
      color: rgba(255, 255, 255, 0.4);
      font-size: 12px;
    }

    /* ═══════════ CHATBOT — AUTONOMOUS v4 ═══════════ */
    .chatbot-wrap {
      display: flex;
      flex-direction: column;
      height: 660px;
      background: white;
      border: 1px solid var(--border);
      border-radius: 20px;
      overflow: hidden;
      box-shadow: 0 8px 40px rgba(0, 0, 0, 0.09);
    }

    .chat-header-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 16px;
      background: var(--ink);
      color: white;
      flex-wrap: wrap;
      gap: 8px;
    }

    .chat-header-left {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .chat-header-avatar {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: linear-gradient(135deg, var(--accent), var(--purple));
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      flex-shrink: 0;
    }

    .chat-header-name {
      font-weight: 600;
      font-size: 14px;
    }

    .chat-header-status {
      font-size: 11px;
      color: rgba(255, 255, 255, 0.5);
      display: flex;
      align-items: center;
      gap: 4px;
      cursor: pointer;
    }

    .status-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: #94a3b8;
      display: inline-block;
      transition: background 0.4s;
      flex-shrink: 0;
    }

    .chat-header-actions {
      display: flex;
      gap: 6px;
      align-items: center;
    }

    .hdr-btn {
      background: rgba(255, 255, 255, 0.1);
      border: 1px solid rgba(255, 255, 255, 0.15);
      color: rgba(255, 255, 255, 0.8);
      padding: 5px 10px;
      border-radius: 16px;
      font-size: 11px;
      cursor: pointer;
      font-family: 'DM Sans', sans-serif;
      transition: all 0.2s;
      white-space: nowrap;
    }

    .hdr-btn:hover {
      background: rgba(255, 255, 255, 0.2);
      color: white;
    }

    .hdr-btn.active {
      background: var(--accent);
      border-color: var(--accent);
      color: white;
    }

    .streak-badge {
      font-size: 11px;
      color: var(--gold);
      font-weight: 600;
      padding: 4px 10px;
      background: rgba(245, 166, 35, 0.15);
      border-radius: 20px;
      border: 1px solid rgba(245, 166, 35, 0.3);
    }

    .chat-toolbar {
      display: flex;
      gap: 6px;
      padding: 8px 12px;
      background: #f7f5f0;
      border-bottom: 1px solid var(--border);
      flex-wrap: wrap;
      align-items: center;
    }

    .toolbar-label {
      font-size: 11px;
      color: var(--muted);
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin-right: 4px;
    }

    .tool-btn {
      background: white;
      border: 1.5px solid var(--border);
      border-radius: 14px;
      padding: 5px 12px;
      font-size: 12px;
      cursor: pointer;
      color: var(--ink);
      transition: all 0.2s;
      font-family: 'DM Sans', sans-serif;
    }

    .tool-btn:hover {
      border-color: var(--teal);
      color: var(--teal);
    }

    .streaming-bubble {
      border-color: var(--teal) !important;
      box-shadow: 0 0 0 2px rgba(15, 155, 142, 0.1) !important;
    }

    .stream-indicator {
      color: var(--teal);
      animation: blink 0.8s infinite;
      font-size: 10px;
      margin-left: 4px;
    }

    .chat-system-msg {
      text-align: center;
      font-size: 12px;
      color: var(--muted);
      padding: 6px 12px;
      background: var(--light);
      border-radius: 20px;
      margin: 6px auto;
      max-width: 85%;
    }

    .msg-actions-row {
      display: flex;
      gap: 4px;
      margin-top: 4px;
    }

    .chat-msg.internal-msg {
      background: linear-gradient(135deg, #1a3a4e, #0f2d3e);
      font-size: 12px;
      opacity: 0.7;
      font-style: italic;
    }

    .chat-messages {
      flex: 1;
      overflow-y: auto;
      padding: 20px 16px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      background: #fafafa;
      scroll-behavior: smooth;
    }

    .chat-messages::-webkit-scrollbar {
      width: 4px;
    }

    .chat-messages::-webkit-scrollbar-thumb {
      background: var(--border);
      border-radius: 2px;
    }

    .chat-msg-wrap {
      display: flex;
      flex-direction: column;
      margin-bottom: 12px;
    }

    .chat-msg-wrap.user {
      align-items: flex-end;
    }

    .chat-msg-wrap.bot {
      align-items: flex-start;
    }

    .chat-msg {
      max-width: 88%;
      font-size: 14px;
      line-height: 1.65;
      border-radius: 18px;
    }

    .chat-msg.user {
      background: linear-gradient(135deg, var(--ink), #2d2d4e);
      color: white;
      padding: 12px 18px;
      border-radius: 18px 18px 4px 18px;
    }

    .chat-msg.bot {
      background: white;
      color: var(--ink);
      padding: 14px 18px;
      border-radius: 18px 18px 18px 4px;
      border: 1px solid var(--border);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }

    .chat-typing-msg {
      background: white;
      border: 1px solid var(--border);
      padding: 14px 18px;
      border-radius: 18px 18px 18px 4px;
      max-width: 140px;
    }

    .bot-label {
      font-size: 10px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1.2px;
      color: var(--accent);
      margin-bottom: 8px;
      display: flex;
      align-items: center;
      gap: 5px;
    }

    .bot-avatar {
      font-size: 14px;
    }

    .bot-content {
      font-size: 14px;
      line-height: 1.7;
    }

    .chat-p {
      margin: 0 0 8px;
    }

    .chat-p:last-child {
      margin-bottom: 0;
    }

    .chat-ol {
      padding-left: 0;
      list-style: none;
      margin: 8px 0;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .chat-ul {
      padding-left: 0;
      list-style: none;
      margin: 8px 0;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .num-item {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      font-size: 14px;
    }

    .num-badge {
      background: var(--accent);
      color: white;
      font-size: 11px;
      font-weight: 700;
      min-width: 20px;
      height: 20px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      margin-top: 1px;
    }

    .bul-item {
      display: flex;
      align-items: flex-start;
      gap: 8px;
      font-size: 14px;
      padding-left: 4px;
    }

    .bul-item::before {
      content: '→';
      color: var(--accent);
      font-weight: 700;
      flex-shrink: 0;
    }

    .inline-code {
      background: #f0ede4;
      color: var(--accent);
      padding: 1px 6px;
      border-radius: 4px;
      font-family: 'DM Mono', monospace;
      font-size: 12.5px;
    }

    .chat-divider {
      border: none;
      border-top: 1px dashed var(--border);
      margin: 12px 0;
    }

    .typing-dots {
      display: flex;
      gap: 4px;
      padding: 4px 0;
    }

    .typing-dots span {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--muted);
      animation: blink 1.3s infinite;
    }

    .typing-dots span:nth-child(2) {
      animation-delay: 0.2s;
    }

    .typing-dots span:nth-child(3) {
      animation-delay: 0.4s;
    }

    @keyframes blink {

      0%,
      80%,
      100% {
        opacity: 0.2;
      }

      40% {
        opacity: 1;
      }
    }

    .msg-action-btn {
      background: none;
      border: none;
      color: var(--muted);
      font-size: 11px;
      cursor: pointer;
      padding: 3px 8px;
      border-radius: 12px;
      transition: all 0.15s;
      margin-top: 4px;
      font-family: 'DM Sans', sans-serif;
    }

    .msg-action-btn:hover {
      background: var(--light);
      color: var(--ink);
    }

    .followup-wrap {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 10px;
      align-items: center;
      max-width: 88%;
    }

    .followup-label {
      font-size: 11px;
      color: var(--muted);
      font-weight: 500;
      white-space: nowrap;
    }

    .followup-btn {
      background: white;
      border: 1.5px solid var(--border);
      color: var(--ink);
      border-radius: 16px;
      padding: 5px 12px;
      font-size: 12px;
      cursor: pointer;
      font-family: 'DM Sans', sans-serif;
      transition: all 0.2s;
      line-height: 1.4;
    }

    .followup-btn:hover {
      border-color: var(--accent);
      color: var(--accent);
      background: #fff5f6;
    }

    .chat-input-area {
      padding: 12px 16px;
      border-top: 1px solid var(--border);
      background: white;
    }

    .chat-input-row {
      display: flex;
      gap: 10px;
      align-items: flex-end;
    }

    .chat-input {
      flex: 1;
      border: 1.5px solid var(--border);
      border-radius: 14px;
      padding: 10px 16px;
      font-family: 'DM Sans', sans-serif;
      font-size: 14px;
      outline: none;
      background: var(--light);
      resize: none;
      max-height: 120px;
      line-height: 1.5;
      transition: border-color 0.2s;
    }

    .chat-input:focus {
      border-color: var(--accent);
      background: white;
    }

    .chat-send {
      background: var(--accent);
      color: white;
      border: none;
      border-radius: 12px;
      padding: 10px 20px;
      font-family: 'DM Sans', sans-serif;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
      white-space: nowrap;
      display: flex;
      align-items: center;
      gap: 6px;
      height: 42px;
    }

    .chat-send:hover {
      background: #d63051;
      transform: translateY(-1px);
    }

    .chat-send:disabled {
      opacity: 0.6;
      cursor: not-allowed;
      transform: none;
    }

    .btn-spinner {
      width: 16px;
      height: 16px;
      border: 2px solid rgba(255, 255, 255, 0.3);
      border-top-color: white;
      border-radius: 50%;
      animation: spin 0.7s linear infinite;
    }

    .chat-hint {
      font-size: 11px;
      color: var(--muted);
      text-align: center;
      margin-top: 6px;
    }

    .chat-nudge {
      background: linear-gradient(135deg, #e8f8f6, #e0f5e9);
      border: 1px solid #a7f3d0;
      border-radius: 12px;
      padding: 10px 16px;
      font-size: 13px;
      color: #065f46;
      text-align: center;
      margin: 8px 0;
      transition: opacity 0.5s;
    }

    .chat-starters {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-bottom: 20px;
    }

    .starter-btn {
      background: white;
      border: 1.5px solid var(--border);
      border-radius: 20px;
      padding: 7px 14px;
      font-size: 12px;
      font-family: 'DM Sans', sans-serif;
      cursor: pointer;
      color: var(--ink);
      transition: all 0.2s;
    }

    .starter-btn:hover {
      border-color: var(--accent);
      color: var(--accent);
      background: #fff5f6;
      transform: translateY(-1px);
    }

    /* PYQ SECTION */
    .pyq-filter {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-bottom: 24px;
    }

    .pyq-filter-btn {
      padding: 7px 18px;
      border-radius: 20px;
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      border: 1.5px solid var(--border);
      background: white;
      font-family: 'DM Sans', sans-serif;
      transition: all 0.2s;
    }

    .pyq-filter-btn.active {
      background: var(--ink);
      color: white;
      border-color: var(--ink);
    }

    .pyq-question {
      background: white;
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 20px 24px;
      margin-bottom: 16px;
    }

    .pyq-question .pyq-meta {
      font-size: 11px;
      font-family: 'DM Mono', monospace;
      color: var(--muted);
      margin-bottom: 10px;
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .pyq-question .pyq-meta span {
      background: var(--light);
      padding: 2px 10px;
      border-radius: 20px;
    }

    .pyq-question .pyq-passage {
      background: var(--light);
      border-radius: 8px;
      padding: 14px 16px;
      margin-bottom: 14px;
      font-size: 13.5px;
      line-height: 1.8;
      border-left: 3px solid var(--teal);
    }

    .pyq-question .pyq-q {
      font-size: 15px;
      font-weight: 600;
      margin-bottom: 12px;
    }

    .pyq-option {
      padding: 9px 14px;
      border: 1.5px solid var(--border);
      border-radius: 8px;
      margin-bottom: 8px;
      font-size: 14px;
      cursor: pointer;
      transition: all 0.2s;
    }

    .pyq-option:hover {
      border-color: var(--accent);
      background: #fff5f6;
    }

    .pyq-option.correct {
      border-color: var(--green);
      background: #e8f5e9;
      color: #14532d;
    }

    .pyq-option.wrong {
      border-color: var(--accent);
      background: #fdecea;
      color: #7a1c1c;
    }

    .pyq-option.reveal {
      border-color: var(--green);
      background: #e8f5e9;
      opacity: 0.7;
    }

    .pyq-answer-box {
      background: #f0fdf4;
      border: 1px solid #bbf7d0;
      border-radius: 8px;
      padding: 12px 16px;
      margin-top: 12px;
      font-size: 13.5px;
      display: none;
    }

    .pyq-answer-box.show {
      display: block;
    }
  </style>
</head>

<body>

  <div class="hero">
    <div class="hero-badge">Ultimate Study Guide · AI-Powered</div>
    <h1>CLAT UG <span>2027</span><br>Preparation Hub</h1>
    <p>Complete notes, smart flashcards, and AI-powered assessment tests for all 5 sections. Built for serious CLAT
      preparation.</p>
    <div class="hero-stats">
      <div class="stat-box"><span class="num">120</span><span class="label">Questions</span></div>
      <div class="stat-box"><span class="num">2 hrs</span><span class="label">Duration</span></div>
      <div class="stat-box"><span class="num">5</span><span class="label">Sections</span></div>
      <div class="stat-box"><span class="num">−0.25</span><span class="label">Neg. Marking</span></div>
      <div class="stat-box"><span class="num">22+</span><span class="label">NLUs</span></div>
      <div class="stat-box"><span class="num">PYQs</span><span class="label">AILET 2026</span></div>
      <div class="stat-box"><span class="num">AI</span><span class="label">Tutor</span></div>
    </div>
  </div>

  <div class="tabs-wrap">
    <button class="tab-btn active" onclick="showTab('overview')">📋 Overview</button>
    <button class="tab-btn" onclick="showTab('english')">📖 English</button>
    <button class="tab-btn" onclick="showTab('gk')">🌍 GK & CA</button>
    <button class="tab-btn" onclick="showTab('legal')">⚖️ Legal</button>
    <button class="tab-btn" onclick="showTab('logical')">🧠 Logical</button>
    <button class="tab-btn" onclick="showTab('quant')">📐 Quant</button>
    <button class="tab-btn" onclick="showTab('flashcards')">🗂️ Flashcards</button>
    <button class="tab-btn" onclick="showTab('assessment')">🎯 Tests</button>
    <button class="tab-btn" onclick="showTab('strategy')">📅 Strategy</button>
    <button class="tab-btn" onclick="showTab('resources')">📚 Resources</button>
    <button class="tab-btn" onclick="showTab('pyq')">📝 PYQs</button>
    <button class="tab-btn" onclick="showTab('chatbot')">🤖 AI Tutor</button>
  </div>

  <div class="container">

    <!-- OVERVIEW -->
    <div id="overview" class="section active">
      <div class="sec-header">
        <div class="sec-icon" style="background:#f0ede4;">📋</div>
        <div>
          <h2>Exam Overview</h2>
          <p>Pattern, eligibility & what CLAT actually tests</p>
        </div>
      </div>

      <div class="highlight-box">
        <strong>⏰ Your Timeline:</strong> If you're in Class 12 (2025–26), you'll appear for CLAT UG 2027 (held in
        December 2026). That's approximately 8–18 months of prep — excellent time if you start now!
      </div>

      <div class="card">
        <div class="card-title">Exam Pattern <span class="tag tag-gold">Official CLAT UG</span></div>
        <table class="pattern-table">
          <tr>
            <th>Section</th>
            <th>Questions</th>
            <th>Marks</th>
            <th>Key Skill</th>
          </tr>
          <tr>
            <td>📖 English Language</td>
            <td>22–26</td>
            <td>22–26</td>
            <td>Reading Comprehension</td>
          </tr>
          <tr>
            <td>🌍 Current Affairs & GK</td>
            <td>28–32</td>
            <td>28–32</td>
            <td>News Awareness + Passage</td>
          </tr>
          <tr>
            <td>⚖️ Legal Reasoning</td>
            <td>28–32</td>
            <td>28–32</td>
            <td>Principle–Fact Application</td>
          </tr>
          <tr>
            <td>🧠 Logical Reasoning</td>
            <td>22–26</td>
            <td>22–26</td>
            <td>Argument Analysis</td>
          </tr>
          <tr>
            <td>📐 Quantitative Techniques</td>
            <td>10–14</td>
            <td>10–14</td>
            <td>Data Interpretation</td>
          </tr>
          <tr>
            <td><strong>Total</strong></td>
            <td><strong>120</strong></td>
            <td><strong>120</strong></td>
            <td>2 Hours</td>
          </tr>
        </table>
        <div class="warn-box">🚫 <strong>Negative Marking:</strong> −0.25 marks per wrong answer. Never guess blindly —
          only attempt if you can eliminate at least 2 options.</div>
      </div>

      <div class="grid-2">
        <div class="mini-card">
          <h4>Eligibility</h4>
          <ul class="notes">
            <li>10+2 from a recognised board</li>
            <li>Minimum 45% marks (40% for SC/ST/PwD)</li>
            <li>No upper age limit for UG</li>
            <li>Class 12 appearing students eligible</li>
          </ul>
        </div>
        <div class="mini-card">
          <h4>Exam Format</h4>
          <ul class="notes">
            <li>Offline (pen and paper based)</li>
            <li>Duration: 2 hours exactly</li>
            <li>English medium only</li>
            <li>MCQs with 4 options each</li>
            <li>~25–30 reading passages total</li>
          </ul>
        </div>
      </div>

      <div class="card">
        <div class="card-title">🔍 What CLAT Actually Tests</div>
        <p style="margin-bottom:12px; font-size:14px;">CLAT is <strong>NOT a knowledge exam</strong> — it's an
          <strong>aptitude and comprehension exam</strong>. Every single question is passage-based. You don't need to
          memorise law — you need to read fast, reason carefully, and apply principles logically.</p>
        <ul class="notes">
          <li>Read and understand dense passages of ~450 words very quickly</li>
          <li>Apply rules/principles from a passage to new situations (not prior knowledge)</li>
          <li>Identify conclusions, premises, and logical gaps in arguments</li>
          <li>Interpret numerical data from text-based descriptions</li>
          <li>Demonstrate current affairs awareness through passage comprehension</li>
        </ul>
      </div>

      <div class="card">
        <div class="card-title">🏛️ Top NLUs & Expected Cut-offs</div>
        <table class="pattern-table">
          <tr>
            <th>NLU</th>
            <th>Location</th>
            <th>Approx. Cut-off (General)</th>
          </tr>
          <tr>
            <td>NLSIU (Rank 1)</td>
            <td>Bangalore</td>
            <td>~105–110 / 120</td>
          </tr>
          <tr>
            <td>NALSAR</td>
            <td>Hyderabad</td>
            <td>~100–105 / 120</td>
          </tr>
          <tr>
            <td>WBNUJS</td>
            <td>Kolkata</td>
            <td>~98–103 / 120</td>
          </tr>
          <tr>
            <td>NLU Jodhpur</td>
            <td>Jodhpur</td>
            <td>~95–100 / 120</td>
          </tr>
          <tr>
            <td>NLIU</td>
            <td>Bhopal</td>
            <td>~90–96 / 120</td>
          </tr>
          <tr>
            <td>GNLU</td>
            <td>Gandhi Nagar</td>
            <td>~88–94 / 120</td>
          </tr>
          <tr>
            <td>RMLNLU</td>
            <td>Lucknow</td>
            <td>~85–92 / 120</td>
          </tr>
        </table>
        <div class="tip-box">💡 Cut-offs vary yearly. Above are indicative ranges. Target 95+ for top 5 NLUs. A score of
          80+ gives good options among the 22 NLUs.</div>
      </div>
    </div>

    <!-- ENGLISH -->
    <div id="english" class="section">
      <div class="sec-header">
        <div class="sec-icon" style="background:#fde8ec;">📖</div>
        <div>
          <h2>English Language</h2>
          <p>~22–26 questions • Passage-based comprehension</p>
        </div>
      </div>

      <div class="notes-tabs">
        <button class="notes-tab active" onclick="switchNotes(this,'eng-notes')">📝 Notes</button>
        <button class="notes-tab" onclick="switchNotes(this,'eng-traps')">⚠️ Common Traps</button>
        <button class="notes-tab" onclick="switchNotes(this,'eng-vocab')">📚 Vocabulary</button>
        <button class="notes-tab" onclick="switchNotes(this,'eng-strategy')">⚡ Strategy</button>
      </div>

      <div id="eng-notes" class="notes-panel active">
        <div class="card">
          <div class="card-title">What to Expect <span class="tag tag-red">Section A</span></div>
          <p style="font-size:14px; margin-bottom:12px;">3–4 passages of ~450 words each (fiction, non-fiction,
            journalistic). 5–8 questions follow each passage. No grammar fill-in-the-blanks or isolated vocabulary.</p>
        </div>

        <div class="concept-box">
          <h4>🎯 Main Idea / Central Theme</h4>
          <p>Ask: <em>"What is the author's primary purpose in writing this?"</em> The correct option will cover the
            whole passage — not just one paragraph. Avoid options that are too narrow (one example) or too broad
            (general topic).</p>
        </div>
        <div class="concept-box">
          <h4>🔍 Inference Questions</h4>
          <p>CLAT wants <strong>conservative inferences</strong> — only what is logically required by the passage. Don't
            bring in outside knowledge. The answer must be supportable by specific lines in the text. Keywords:
            "implies," "suggests," "can be inferred."</p>
        </div>
        <div class="concept-box">
          <h4>🎭 Author's Tone & Viewpoint</h4>
          <p>Common tones: critical, appreciative, neutral/objective, ironic, sarcastic, cautious, optimistic. Look for
            <em>tone words</em> — adjectives and verbs the author uses. Extreme tones ("furious," "ecstatic") are rarely
            correct in formal passages.</p>
        </div>
        <div class="concept-box">
          <h4>🔤 Meaning in Context</h4>
          <p>The question asks what a word/phrase means <strong>in this passage</strong>, not in general. Substitute
            each option into the sentence and pick the one that preserves the meaning. Don't rely on dictionary
            definitions.</p>
        </div>
        <div class="concept-box">
          <h4>✅ Fact vs. Opinion</h4>
          <p>Facts: verifiable, stated objectively. Opinions: subjective, debatable. Signal words for opinions:
            "should," "must," "believe," "argue," "ought to." CLAT often asks you to distinguish what the author
            <em>claims</em> vs. what the passage <em>establishes</em>.</p>
        </div>
        <div class="concept-box">
          <h4>💪 Strengthen/Weaken Questions</h4>
          <p>These appear in both English and Logical sections. To <strong>strengthen</strong>: find an option that
            supports the argument's key assumption or provides new evidence for it. To <strong>weaken</strong>: find an
            option that undermines the assumption or provides counter-evidence.</p>
        </div>
      </div>

      <div id="eng-traps" class="notes-panel">
        <div class="warn-box">⚠️ These are the most common reasons students lose marks in the English section.</div>
        <div class="concept-box">
          <h4>❌ "True but Not From Passage" Trap</h4>
          <p>An option may be factually true or seem reasonable, but if it's not supported by the passage, it's wrong.
            CLAT English is a <em>closed-book</em> exercise — only what the text says counts.</p>
        </div>
        <div class="concept-box">
          <h4>❌ "Extreme Language" Trap</h4>
          <p>Options with "always," "never," "only," "completely," "entirely," "must" are almost always wrong.
            Real-world arguments are rarely absolute. CLAT rewards nuanced, qualified answers.</p>
        </div>
        <div class="concept-box">
          <h4>❌ "Paraphrased Distractor" Trap</h4>
          <p>The wrong option rephrases something from the passage but <em>subtly changes the meaning</em>. Read very
            carefully — a small word like "not" or "only" can flip the meaning entirely.</p>
        </div>
        <div class="concept-box">
          <h4>❌ "Over-Inference" Trap</h4>
          <p>You might logically extend the author's argument beyond what they actually said. CLAT does not reward
            creative thinking here — stick to what's written, not what you think follows logically.</p>
        </div>
        <div class="concept-box">
          <h4>❌ First Paragraph Bias</h4>
          <p>Students often answer "main idea" questions based only on the first paragraph. The passage's core argument
            is often stated in the conclusion or developed throughout. Read the <em>whole</em> passage.</p>
        </div>
      </div>

      <div id="eng-vocab" class="notes-panel">
        <div class="card">
          <div class="card-title">High-Frequency Words in CLAT Passages</div>
          <div class="term-entry">
            <div class="term-name">Acrimonious</div>
            <div class="term-def">Bitter and sharp in speech or manner; "the debate turned acrimonious."</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Ambivalent</div>
            <div class="term-def">Having mixed feelings about something; uncertain how to feel.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Anachronism</div>
            <div class="term-def">Something out of place in time; applying old ideas to modern contexts.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Cogent</div>
            <div class="term-def">Clear, logical, and convincing. "A cogent argument."</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Contentious</div>
            <div class="term-def">Causing or likely to cause controversy or disagreement.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Equivocal</div>
            <div class="term-def">Open to more than one interpretation; ambiguous and often deliberately so.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Inimical</div>
            <div class="term-def">Tending to obstruct or harm; hostile. "Policies inimical to growth."</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Mitigate</div>
            <div class="term-def">To make less severe, serious, or painful. "Mitigate the damage."</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Obfuscate</div>
            <div class="term-def">To render unclear or obscure; to confuse deliberately.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Pedantic</div>
            <div class="term-def">Overly concerned with minor details or rules; excessively academic.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Perfidious</div>
            <div class="term-def">Deceitful and untrustworthy; guilty of betrayal.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Sanguine</div>
            <div class="term-def">Optimistic, especially in difficult situations.</div>
          </div>
        </div>
        <div class="tip-box">💡 Don't memorise lists — instead, read these words in sentences. The context is what CLAT
          tests, not the dictionary definition.</div>
      </div>

      <div id="eng-strategy" class="notes-panel">
        <div class="card">
          <div class="card-title">⚡ The 5-Step Passage Attack Strategy</div>
          <div class="timeline">
            <div class="tl-item">
              <h4>Step 1: Skim the questions first (60 sec)</h4>
              <p>Before reading the passage, scan all questions. This tells you what to look for — tone? main idea?
                specific inference? This saves 1–2 minutes per passage.</p>
            </div>
            <div class="tl-item">
              <h4>Step 2: Active reading (3 min)</h4>
              <p>Read with a purpose. Underline (mentally or on paper): the main claim, transitions ("however,"
                "therefore," "despite"), and the conclusion. Don't re-read sentences.</p>
            </div>
            <div class="tl-item">
              <h4>Step 3: Answer structure questions first</h4>
              <p>Main idea, title, author's purpose — these rely on full passage understanding, so do them after
                reading. Fact-retrieval questions first (easiest, builds confidence).</p>
            </div>
            <div class="tl-item">
              <h4>Step 4: Eliminate, don't just identify</h4>
              <p>For tricky questions, eliminate wrong options first. Cross out extremes, off-topic options, and "true
                but not from passage" options. Pick the best remaining answer.</p>
            </div>
            <div class="tl-item">
              <h4>Step 5: Time check</h4>
              <p>Target 6–7 minutes per English passage. If stuck on a question for 90+ seconds, make your best guess
                and move on. Don't let one question derail the whole section.</p>
            </div>
          </div>
        </div>
        <div class="success-box">✅ <strong>Daily habit:</strong> Read one Hindu/Indian Express editorial daily. After
          reading, ask yourself: What is the main argument? What evidence is given? What is the author's tone? This
          directly mirrors CLAT question types.</div>
      </div>
    </div>

    <!-- GK & CA -->
    <div id="gk" class="section">
      <div class="sec-header">
        <div class="sec-icon" style="background:#e0e8f9;">🌍</div>
        <div>
          <h2>Current Affairs & General Knowledge</h2>
          <p>~28–32 questions • Highest weightage section</p>
        </div>
      </div>

      <div class="notes-tabs">
        <button class="notes-tab active" onclick="switchNotes(this,'gk-ca')">📰 Current Affairs</button>
        <button class="notes-tab" onclick="switchNotes(this,'gk-static')">🏛️ Static GK</button>
        <button class="notes-tab" onclick="switchNotes(this,'gk-cases')">⚖️ Landmark Cases</button>
        <button class="notes-tab" onclick="switchNotes(this,'gk-const')">📜 Constitution</button>
      </div>

      <div id="gk-ca" class="notes-panel active">
        <div class="warn-box">🔥 This is the largest section (~28–32 Qs). Daily reading for 12–18 months before the exam
          is the ONLY sustainable strategy. No shortcut works here.</div>
        <div class="card">
          <div class="card-title">What to Expect <span class="tag tag-blue">Section B</span></div>
          <p style="font-size:14px;">~450-word passages from news sources. Questions test both comprehension AND
            contextual current affairs knowledge. You must have heard of the event/issue to understand the passage
            deeply.</p>
        </div>
        <div class="concept-box">
          <h4>🏛️ National & Political Affairs</h4>
          <ul>
            <li>Parliament sessions, major bills passed (DPDP Act, Waqf Amendment, etc.)</li>
            <li>Supreme Court & High Court landmark judgements (last 2 years)</li>
            <li>Central government schemes (PM SVAMITVA, Jal Jeevan Mission, etc.)</li>
            <li>State elections and political developments</li>
            <li>Constitutional amendments (if any)</li>
          </ul>
        </div>
        <div class="concept-box">
          <h4>🌐 International Affairs</h4>
          <ul>
            <li>India's bilateral relations (US, Russia, China, UAE)</li>
            <li>G20, BRICS, SCO summits and outcomes</li>
            <li>UN resolutions and Security Council actions</li>
            <li>Major global conflicts and peace deals</li>
            <li>Climate agreements (COP summits, NDCs)</li>
          </ul>
        </div>
        <div class="concept-box">
          <h4>💰 Economy & Finance</h4>
          <ul>
            <li>Union Budget highlights (key schemes, tax changes)</li>
            <li>RBI monetary policy and repo rate changes</li>
            <li>GDP growth figures and Economic Survey data</li>
            <li>Major trade deals and FTAs</li>
            <li>Significant corporate news (mergers, IPOs)</li>
          </ul>
        </div>
        <div class="concept-box">
          <h4>🚀 Science, Space & Environment</h4>
          <ul>
            <li>ISRO missions (Chandrayaan-3, Gaganyaan updates, Aditya-L1)</li>
            <li>Important scientific discoveries</li>
            <li>COP climate conference outcomes</li>
            <li>Species extinction/conservation news</li>
            <li>Significant technology developments (AI regulation, etc.)</li>
          </ul>
        </div>
        <div class="concept-box">
          <h4>🏆 Awards, Sports & Culture</h4>
          <ul>
            <li>Nobel Prize winners (all categories) — year and reason</li>
            <li>Bharat Ratna, Padma awards recipients</li>
            <li>Olympic Games, Cricket World Cup results</li>
            <li>Booker Prize, Man Booker, Sahitya Akademi winners</li>
            <li>International art and film awards</li>
          </ul>
        </div>
      </div>

      <div id="gk-static" class="notes-panel">
        <div class="concept-box">
          <h4>🗺️ Indian Geography — Key Facts</h4>
          <ul>
            <li><strong>Longest river:</strong> Ganga (but Indus is longest overall including Pakistan)</li>
            <li><strong>Highest peak:</strong> Kangchenjunga in India; K2 in undivided India</li>
            <li><strong>Largest state by area:</strong> Rajasthan | Smallest: Goa</li>
            <li><strong>Most populous state:</strong> Uttar Pradesh</li>
            <li><strong>Tropics:</strong> Tropic of Cancer passes through 8 Indian states</li>
            <li><strong>Coastline:</strong> 7,516 km (includes islands); Gujarat has longest mainland coast</li>
          </ul>
        </div>
        <div class="concept-box">
          <h4>🏛️ National Symbols</h4>
          <ul>
            <li><strong>National Emblem:</strong> Lion Capital of Ashoka (Sarnath)</li>
            <li><strong>National Bird:</strong> Indian Peacock | <strong>Animal:</strong> Bengal Tiger</li>
            <li><strong>National Flower:</strong> Lotus | <strong>Tree:</strong> Banyan</li>
            <li><strong>National Fruit:</strong> Mango | <strong>River:</strong> Ganga</li>
            <li><strong>National Sport:</strong> No official national sport (Hockey is traditional)</li>
          </ul>
        </div>
        <div class="concept-box">
          <h4>🌍 International Organisations</h4>
          <ul>
            <li><strong>UN:</strong> 193 members. HQ: New York. 6 principal organs including ICJ (The Hague)</li>
            <li><strong>WTO:</strong> 166 members. HQ: Geneva. Dispute settlement + trade rules</li>
            <li><strong>IMF:</strong> Founded 1944 (Bretton Woods). Economic stability + loans</li>
            <li><strong>World Bank:</strong> Development loans. HQ: Washington D.C.</li>
            <li><strong>SAARC:</strong> 8 South Asian nations. HQ: Kathmandu. (Currently dysfunctional)</li>
            <li><strong>ASEAN:</strong> 10 Southeast Asian nations. HQ: Jakarta</li>
          </ul>
        </div>
        <div class="concept-box">
          <h4>📅 Important Days (CLAT-relevant)</h4>
          <ul>
            <li>Jan 26 — Republic Day | Jan 30 — Martyrs' Day</li>
            <li>Apr 14 — B.R. Ambedkar Jayanti (Equality Day)</li>
            <li>Jun 5 — World Environment Day</li>
            <li>Aug 15 — Independence Day | Nov 19 — World Toilet Day</li>
            <li>Dec 10 — Human Rights Day | Dec 3 — International Day of Persons with Disabilities</li>
          </ul>
        </div>
      </div>

      <div id="gk-cases" class="notes-panel">
        <div class="card">
          <div class="card-title">⚖️ Landmark Supreme Court Judgements</div>
          <div class="term-entry">
            <div class="term-name">Kesavananda Bharati (1973)</div>
            <div class="term-def"><strong>Basic Structure Doctrine:</strong> Parliament can amend the Constitution but
              cannot alter its "basic structure" (federalism, secularism, democracy, judicial review).</div>
          </div>
          <div class="term-entry">
            <div class="term-name">ADM Jabalpur (1976)</div>
            <div class="term-def"><strong>Emergency & Habeas Corpus:</strong> SC held rights can be suspended during
              emergency (later overruled in Puttaswamy). Considered SC's darkest hour.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Maneka Gandhi (1978)</div>
            <div class="term-def"><strong>Expanded Art. 21:</strong> "Procedure established by law" must be fair, just,
              and reasonable — not arbitrary. Right to life is expansive.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Vishaka v. Rajasthan (1997)</div>
            <div class="term-def"><strong>Sexual Harassment:</strong> Laid down guidelines for workplaces until
              Parliament enacted the POSH Act (2013).</div>
          </div>
          <div class="term-entry">
            <div class="term-name">S.R. Bommai (1994)</div>
            <div class="term-def"><strong>President's Rule:</strong> SC can review imposition of Art. 356. Floor test
              before dismissal of state govt. federalism strengthened.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Indra Sawhney (1992)</div>
            <div class="term-def"><strong>OBC Reservations:</strong> Upheld 27% OBC quota. Set 50% ceiling on total
              reservations. Creamy layer exclusion mandated.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">K.S. Puttaswamy (2017)</div>
            <div class="term-def"><strong>Right to Privacy:</strong> Privacy is a fundamental right under Art. 21.
              Overruled ADM Jabalpur. Basis for data protection law.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Navtej Singh Johar (2018)</div>
            <div class="term-def"><strong>Section 377:</strong> Decriminalised consensual same-sex relations among
              adults. Overruled Suresh Kumar Koushal (2013).</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Joseph Shine (2018)</div>
            <div class="term-def"><strong>Adultery (Sec. 497):</strong> Struck down as unconstitutional. Treated women
              as husband's property. Violates dignity and equality.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Electoral Bonds (2024)</div>
            <div class="term-def"><strong>Political Funding:</strong> SC struck down Electoral Bond Scheme as
              unconstitutional — violated voters' right to information under Art. 19(1)(a).</div>
          </div>
        </div>
      </div>

      <div id="gk-const" class="notes-panel">
        <div class="card">
          <div class="card-title">📜 Key Constitutional Articles</div>
          <div class="term-entry">
            <div class="term-name">Preamble</div>
            <div class="term-def">Sovereign, Socialist, Secular, Democratic Republic. Justice, Liberty, Equality,
              Fraternity. Added "Socialist" and "Secular" by 42nd Amendment (1976).</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Art. 12–35</div>
            <div class="term-def">Part III — Fundamental Rights. Enforceable in courts. Art. 13: Laws inconsistent with
              FRs are void.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Art. 14</div>
            <div class="term-def">Right to Equality: Equal before law + equal protection of laws. Allows reasonable
              classification (not arbitrary).</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Art. 19</div>
            <div class="term-def">6 freedoms: speech/expression, assembly, association, movement, residence, profession.
              All subject to reasonable restrictions.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Art. 21</div>
            <div class="term-def">Right to Life and Personal Liberty. Most expansive FR — includes privacy, livelihood,
              education, health, dignity.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Art. 21A</div>
            <div class="term-def">Right to Education (added by 86th Amendment, 2002). Free and compulsory education for
              6–14 years. → Led to RTE Act 2009.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Art. 32</div>
            <div class="term-def">Right to Constitutional Remedies. Dr. Ambedkar: "Heart and soul of the Constitution."
              Writs: Habeas Corpus, Mandamus, Prohibition, Certiorari, Quo Warranto.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Art. 36–51 (DPSP)</div>
            <div class="term-def">Directive Principles — non-justiciable (cannot be enforced in court) but fundamental
              to governance. Art. 44 = Uniform Civil Code; Art. 45 = Early childhood care; Art. 48A = Environment
              protection.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Art. 51A</div>
            <div class="term-def">11 Fundamental Duties (added by 42nd Amendment). Non-justiciable but used by courts to
              interpret laws.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Art. 368</div>
            <div class="term-def">Amendment procedure. Parliament can amend but not destroy Basic Structure (Kesavananda
              Bharati).</div>
          </div>
        </div>
      </div>
    </div>

    <!-- LEGAL REASONING -->
    <div id="legal" class="section">
      <div class="sec-header">
        <div class="sec-icon" style="background:#e0f5f3;">⚖️</div>
        <div>
          <h2>Legal Reasoning</h2>
          <p>~28–32 questions • No prior law knowledge required</p>
        </div>
      </div>

      <div class="notes-tabs">
        <button class="notes-tab active" onclick="switchNotes(this,'leg-method')">🔑 IRAC Method</button>
        <button class="notes-tab" onclick="switchNotes(this,'leg-terms')">📖 Legal Terms</button>
        <button class="notes-tab" onclick="switchNotes(this,'leg-torts')">⚠️ Torts & Contracts</button>
        <button class="notes-tab" onclick="switchNotes(this,'leg-writs')">📜 Writs</button>
      </div>

      <div id="leg-method" class="notes-panel active">
        <div class="success-box">✅ <strong>Great news:</strong> You do NOT need to know law to ace this section. All
          legal principles are provided in the passage. Your job is to apply the rule to the facts — exactly like a
          lawyer using IRAC.</div>
        <div class="card">
          <div class="card-title">The IRAC Method <span class="tag tag-teal">Master This</span></div>
          <div class="concept-box" style="border-left: 4px solid var(--accent); background: #fff5f6;">
            <h4><span class="key-pill">I</span> Issue — What legal question needs to be answered?</h4>
            <p>Identify what is being asked. Is it about liability? Rights? Validity of contract? The issue frames your
              entire analysis.</p>
          </div>
          <div class="concept-box" style="border-left: 4px solid var(--teal); background: #f0fdf9;">
            <h4><span
                style="background:#e0f5f3; color:var(--teal); display:inline-block; font-size:11px; font-weight:600; padding:2px 10px; border-radius:20px;">R</span>
              Rule — What principle is stated in the passage?</h4>
            <p>Extract the exact legal rule from the passage. <strong>Do not use your own knowledge.</strong> Even if
              you know real law differs, use ONLY the passage's rule.</p>
          </div>
          <div class="concept-box" style="border-left: 4px solid var(--gold); background: #fffbeb;">
            <h4><span
                style="background:#fef3dc; color:#b07d1a; display:inline-block; font-size:11px; font-weight:600; padding:2px 10px; border-radius:20px;">A</span>
              Application — Does the rule cover these facts?</h4>
            <p>Match each element of the rule to the facts. If the rule requires three conditions, check each condition
              against the facts. Apply mechanically, not intuitively.</p>
          </div>
          <div class="concept-box" style="border-left: 4px solid var(--green); background: #f0fdf4;">
            <h4><span
                style="background:#e0f5e9; color:var(--green); display:inline-block; font-size:11px; font-weight:600; padding:2px 10px; border-radius:20px;">C</span>
              Conclusion — What does the application yield?</h4>
            <p>State the answer clearly: liable / not liable, valid / invalid, guilty / not guilty. Pick the option that
              matches your IRAC conclusion.</p>
          </div>
        </div>
        <div class="warn-box">🚫 <strong>Biggest mistake:</strong> Applying real-world legal knowledge instead of the
          passage rule. If the passage says "an agreement made on a Thursday is invalid," accept it — don't bring in
          contract law knowledge.</div>
      </div>

      <div id="leg-terms" class="notes-panel">
        <div class="card">
          <div class="card-title">Essential Legal Terms for CLAT</div>
          <div class="term-entry">
            <div class="term-name">Tort</div>
            <div class="term-def">A civil wrong causing harm, giving the victim the right to sue for compensation. Not a
              crime. Examples: negligence, defamation, nuisance, trespass.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Negligence</div>
            <div class="term-def">Failure to take reasonable care resulting in damage. Three elements: (1) Duty of care
              owed, (2) Breach of that duty, (3) Damage caused by the breach.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Mens Rea</div>
            <div class="term-def">"Guilty mind" — criminal intent. Most crimes need both act (Actus Reus) AND intent.
              Without mens rea, usually no criminal liability.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Actus Reus</div>
            <div class="term-def">"Guilty act" — the physical element of a crime. A voluntary wrongful action or
              forbidden omission.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Consideration</div>
            <div class="term-def">Something of value exchanged in a contract. "Past consideration is no consideration."
              Without consideration, a contract is not enforceable (with exceptions).</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Offer & Acceptance</div>
            <div class="term-def">Essential elements of a contract. Counter-offer = rejection of original + new offer.
              Acceptance must be unconditional and communicated.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Strict Liability</div>
            <div class="term-def">Liability without proof of fault. For inherently dangerous activities. Based on
              Rylands v. Fletcher — "a person who brings onto land something likely to do mischief is strictly liable."
            </div>
          </div>
          <div class="term-entry">
            <div class="term-name">Vicarious Liability</div>
            <div class="term-def">Holding A liable for acts of B. Common example: employer for employee's acts done in
              the course of employment.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Volenti Non Fit Injuria</div>
            <div class="term-def">"No injury to one who consents." Complete defence to tort claims. E.g., a boxer
              consents to being punched in a match.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Res Ipsa Loquitur</div>
            <div class="term-def">"The thing speaks for itself." When the facts so clearly indicate negligence that no
              further proof is needed. Burden shifts to defendant.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Judicial Review</div>
            <div class="term-def">Power of courts to review constitutionality of laws and government actions. A basic
              structure feature of Indian Constitution.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Locus Standi</div>
            <div class="term-def">Legal standing to sue — the right to bring a case before a court. Relaxed in India
              through PIL (Public Interest Litigation).</div>
          </div>
        </div>
      </div>

      <div id="leg-torts" class="notes-panel">
        <div class="concept-box">
          <h4>🔴 Law of Torts — Key Principles</h4>
          <ul>
            <li><strong>Defamation:</strong> False statement lowering reputation. Libel (written) vs. Slander (spoken).
              Truth is a complete defence.</li>
            <li><strong>Nuisance:</strong> Private nuisance = unreasonable interference with use/enjoyment of land.
              Public nuisance = affects community.</li>
            <li><strong>Trespass:</strong> To person (battery, assault), to land (entering without permission), to
              goods.</li>
            <li><strong>Absolute Liability (India):</strong> MC Mehta v. Union of India — no exceptions for hazardous
              industry causing harm. Stricter than Rylands.</li>
          </ul>
        </div>
        <div class="concept-box">
          <h4>📝 Law of Contracts — Essentials</h4>
          <ul>
            <li><strong>Valid contract needs:</strong> Offer + Acceptance + Consideration + Capacity + Free consent +
              Lawful object</li>
            <li><strong>Void contract:</strong> Never had legal effect (e.g., by minor)</li>
            <li><strong>Voidable contract:</strong> Valid until challenged (e.g., obtained by fraud/coercion)</li>
            <li><strong>Free consent lacks when:</strong> Coercion, undue influence, fraud, misrepresentation, or
              mistake</li>
            <li><strong>Invitation to treat:</strong> NOT an offer — just an invitation to make offers (e.g., shop
              display, advertisement)</li>
          </ul>
        </div>
        <div class="concept-box">
          <h4>⚖️ Criminal Law Basics</h4>
          <ul>
            <li><strong>IPC (now BNS):</strong> Governs substantive criminal law in India</li>
            <li><strong>Culpable Homicide vs. Murder:</strong> Murder = intention to kill + no exception. Culpable
              Homicide = killing without full murder intent.</li>
            <li><strong>General Exceptions:</strong> Private defence, necessity, consent, accident, insanity,
              intoxication</li>
            <li><strong>Abetment:</strong> Instigating or assisting someone to commit a crime = also criminal liability
            </li>
          </ul>
        </div>
      </div>

      <div id="leg-writs" class="notes-panel">
        <div class="card">
          <div class="card-title">📜 The Five Constitutional Writs</div>
          <div class="term-entry">
            <div class="term-name">Habeas Corpus</div>
            <div class="term-def">"Have the body." Challenges unlawful detention — requires the detaining authority to
              produce the person before a court and justify detention. Available under Art. 32 (SC) and Art. 226 (HC).
            </div>
          </div>
          <div class="term-entry">
            <div class="term-name">Mandamus</div>
            <div class="term-def">"We command." Orders a public official or body to perform a duty they are legally
              required to do. Cannot be issued against President/Governor or private individuals generally.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Certiorari</div>
            <div class="term-def">"To be certified." Issued by superior court to quash (cancel) the order of a lower
              court/tribunal that acted beyond its jurisdiction or violated natural justice.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Prohibition</div>
            <div class="term-def">Prevents a lower court/tribunal from exceeding its jurisdiction. Issued BEFORE an
              inferior court makes a final decision. Preventive in nature (unlike Certiorari which is curative).</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Quo Warranto</div>
            <div class="term-def">"By what authority?" Challenges someone's right to hold a public office. Requires them
              to prove legal authority to exercise the office.</div>
          </div>
        </div>
        <div class="highlight-box"><strong>Memory trick — HMCPQ:</strong> "Habeas Mandamus Certiorari Prohibition Quo
          Warranto" → "<strong>H</strong>uge <strong>M</strong>ango <strong>C</strong>akes <strong>P</strong>lease,
          <strong>Q</strong>uickly!"</div>
      </div>
    </div>

    <!-- LOGICAL REASONING -->
    <div id="logical" class="section">
      <div class="sec-header">
        <div class="sec-icon" style="background:#fef3dc;">🧠</div>
        <div>
          <h2>Logical Reasoning</h2>
          <p>~22–26 questions • Argument analysis from passages</p>
        </div>
      </div>

      <div class="tip-box">💡 <strong>CLAT Logical ≠ Puzzles.</strong> NO syllogisms, blood relations, seating
        arrangements, or coding-decoding. CLAT only tests <strong>argument analysis from written passages</strong>.
        Practice by reading op-ed columns critically.</div>

      <div class="notes-tabs">
        <button class="notes-tab active" onclick="switchNotes(this,'log-types')">🔍 Argument Types</button>
        <button class="notes-tab" onclick="switchNotes(this,'log-questions')">❓ Question Types</button>
        <button class="notes-tab" onclick="switchNotes(this,'log-fallacies')">🚩 Fallacies</button>
      </div>

      <div id="log-types" class="notes-panel active">
        <div class="concept-box">
          <h4>📌 Deductive Arguments</h4>
          <p>Conclusion <strong>necessarily follows</strong> from premises. If premises are true, the conclusion MUST be
            true. Example: "All cats are mammals. Whiskers is a cat. Therefore Whiskers is a mammal." Focus: Is the
            argument valid (properly structured)?</p>
        </div>
        <div class="concept-box">
          <h4>📌 Inductive Arguments</h4>
          <p>Conclusion <strong>probably follows</strong> from premises — evidence supports but doesn't guarantee.
            Example: "The last 10 swans I saw were white. Therefore all swans are white." Focus: Is the argument strong
            (is the evidence sufficient)?</p>
        </div>
        <div class="concept-box">
          <h4>📌 Abductive Arguments</h4>
          <p>"Best explanation" reasoning — inferring the most likely cause from observed effects. Example: "The floor
            is wet. It probably rained, or someone spilled water." Used in legal reasoning to establish facts.</p>
        </div>
        <div class="concept-box">
          <h4>🔑 Identifying an Argument's Structure</h4>
          <p>In any passage, identify:</p>
          <ul>
            <li><strong>Conclusion:</strong> The main claim being made. Signal words: "therefore," "thus," "hence,"
              "so," "consequently."</li>
            <li><strong>Premises:</strong> The evidence/reasons. Signal words: "because," "since," "given that," "as,"
              "for."</li>
            <li><strong>Assumption:</strong> Unstated premise the argument depends on — never explicitly stated but must
              be true for conclusion to hold.</li>
          </ul>
        </div>
      </div>

      <div id="log-questions" class="notes-panel">
        <div class="concept-box">
          <h4>🔵 Strengthen Questions</h4>
          <p>Find the option that makes the conclusion MORE likely. Usually adds new evidence supporting the argument's
            key assumption, or eliminates an alternative explanation. Ask: "Which option, if true, would make the
            argument stronger?"</p>
        </div>
        <div class="concept-box">
          <h4>🔴 Weaken Questions</h4>
          <p>Find the option that attacks the argument's assumption or provides counter-evidence. Doesn't have to
            destroy the argument — just make it less convincing. Most common CLAT question type.</p>
        </div>
        <div class="concept-box">
          <h4>🟡 Assumption Questions</h4>
          <p>The assumption is the hidden premise without which the argument breaks down. Use the <strong>Negation
              Test</strong>: negate each option. If negating it destroys the argument, that's the assumption.</p>
        </div>
        <div class="concept-box">
          <h4>🟢 Inference Questions</h4>
          <p>What can be concluded from the passage? Must be <strong>necessarily</strong> true given the passage — not
            just possibly true. More conservative than "what might be inferred."</p>
        </div>
        <div class="concept-box">
          <h4>🟣 Flaw Questions</h4>
          <p>What logical error does the argument commit? Common flaws: hasty generalisation, correlation-causation
            confusion, false analogy, circular reasoning, ad hominem. Name the flaw type.</p>
        </div>
        <div class="concept-box">
          <h4>⚪ Parallel Reasoning</h4>
          <p>Find the option that follows the <strong>same logical structure</strong> as the original argument —
            regardless of subject matter. Focus on the form/pattern, not the content.</p>
        </div>
      </div>

      <div id="log-fallacies" class="notes-panel">
        <div class="card">
          <div class="card-title">Common Logical Fallacies</div>
          <div class="term-entry">
            <div class="term-name">Ad Hominem</div>
            <div class="term-def">Attacking the person making the argument rather than the argument itself. "You can't
              trust her opinion on healthcare — she's not a doctor."</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Straw Man</div>
            <div class="term-def">Misrepresenting an opponent's argument in a weaker form to more easily attack it.
            </div>
          </div>
          <div class="term-entry">
            <div class="term-name">False Dichotomy</div>
            <div class="term-def">Presenting only two options when more exist. "Either you support this policy or you
              don't care about children."</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Slippery Slope</div>
            <div class="term-def">Claiming one event will inevitably lead to extreme consequences without justification.
              "If we legalise X, soon everything will be legal."</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Correlation ≠ Causation</div>
            <div class="term-def">Two things occurring together doesn't mean one caused the other. Ice cream sales and
              drowning rates both rise in summer — they don't cause each other.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Hasty Generalisation</div>
            <div class="term-def">Broad conclusion from too small or unrepresentative a sample. "I met two rude people
              from Delhi. People from Delhi are rude."</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Circular Reasoning</div>
            <div class="term-def">The conclusion is used as a premise. "The law is just because it is the law." The
              argument assumes what it's trying to prove.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Appeal to Authority</div>
            <div class="term-def">Claiming something is true because an authority (not necessarily expert on this topic)
              said so.</div>
          </div>
          <div class="term-entry">
            <div class="term-name">Red Herring</div>
            <div class="term-def">Introducing an irrelevant topic to distract from the main issue.</div>
          </div>
        </div>
      </div>
    </div>

    <!-- QUANT -->
    <div id="quant" class="section">
      <div class="sec-header">
        <div class="sec-icon" style="background:#ede8f9;">📐</div>
        <div>
          <h2>Quantitative Techniques</h2>
          <p>~10–14 questions • Class 10 maths only</p>
        </div>
      </div>

      <div class="highlight-box"><strong>📊 Strategy:</strong> Only 10–14 questions but highly scoring — all Class 10
        level. No calculus, trigonometry, or complex algebra. Aim for 80%+ accuracy. The hard part isn't the math — it's
        reading and extracting numbers from text.</div>

      <div class="notes-tabs">
        <button class="notes-tab active" onclick="switchNotes(this,'q-topics')">📚 Topics</button>
        <button class="notes-tab" onclick="switchNotes(this,'q-formulas')">🔢 Formulas</button>
        <button class="notes-tab" onclick="switchNotes(this,'q-tips')">⚡ Tips</button>
      </div>

      <div id="q-topics" class="notes-panel active">
        <div class="concept-box">
          <h4>📊 Percentages</h4>
          <ul>
            <li>Percentage increase: [(New − Old) / Old] × 100</li>
            <li>Percentage decrease: [(Old − New) / Old] × 100</li>
            <li>X% of Y = (X/100) × Y</li>
            <li>Most common in data interpretation: "what percentage is X of total Y?"</li>
          </ul>
        </div>
        <div class="concept-box">
          <h4>⚖️ Ratio & Proportion</h4>
          <ul>
            <li>Ratio a:b means a/(a+b) and b/(a+b) of total respectively</li>
            <li>If a:b = 2:3 and total = 50, then a = 20, b = 30</li>
            <li>Compound ratio: multiply ratios; Inverse ratio: flip them</li>
          </ul>
        </div>
        <div class="concept-box">
          <h4>📈 Averages & Weighted Averages</h4>
          <ul>
            <li>Simple average = sum / count</li>
            <li>Weighted average = (sum of value × weight) / sum of weights</li>
            <li>If average changes when one item is added — use algebra</li>
          </ul>
        </div>
        <div class="concept-box">
          <h4>💰 Profit, Loss & Interest</h4>
          <ul>
            <li>Profit% = (SP − CP)/CP × 100 | Loss% = (CP − SP)/CP × 100</li>
            <li>Simple Interest = PRT/100 (P=principal, R=rate, T=time in years)</li>
            <li>Compound Interest = P[(1 + R/100)ⁿ − 1]</li>
            <li>Effective rate: for CI, always slightly higher than SI</li>
          </ul>
        </div>
        <div class="concept-box">
          <h4>📉 Data Interpretation</h4>
          <ul>
            <li>Extract the right numbers from the passage — don't rush</li>
            <li>Common formats: comparison tables, growth data, budget allocations</li>
            <li>Check units carefully (crores vs. lakhs, % vs. absolute numbers)</li>
            <li>Estimate when exact calculation is slow — CLAT doesn't need 5-decimal precision</li>
          </ul>
        </div>
      </div>

      <div id="q-formulas" class="notes-panel">
        <div class="card">
          <div class="card-title">All Formulas to Memorise</div>
          <div class="concept-box">
            <h4>Percentage</h4>
            <p>% Change = [(New − Old) / Old] × 100 &nbsp;|&nbsp; X is what % of Y = (X/Y) × 100</p>
          </div>
          <div class="concept-box">
            <h4>Profit & Loss</h4>
            <p>SP = CP × (1 + P%/100) &nbsp;|&nbsp; CP = SP / (1 + P%/100) &nbsp;|&nbsp; Discount = MP − SP
              &nbsp;|&nbsp; Discount% = (Discount/MP) × 100</p>
          </div>
          <div class="concept-box">
            <h4>Interest</h4>
            <p>SI = PRT/100 &nbsp;|&nbsp; A (SI) = P + PRT/100 &nbsp;|&nbsp; CI = P[(1+r/100)ⁿ − 1] &nbsp;|&nbsp; A (CI)
              = P(1+r/100)ⁿ</p>
          </div>
          <div class="concept-box">
            <h4>Averages</h4>
            <p>Mean = ΣX / n &nbsp;|&nbsp; If avg of n items is A, and one item X is removed, new avg = (nA − X)/(n−1)
            </p>
          </div>
          <div class="concept-box">
            <h4>Speed, Distance, Time</h4>
            <p>D = S × T &nbsp;|&nbsp; Average speed = 2S₁S₂/(S₁+S₂) for equal distances &nbsp;|&nbsp; Time = D/S</p>
          </div>
          <div class="concept-box">
            <h4>Ratio Tips</h4>
            <p>If A:B = m:n, then A = m/(m+n) × Total &nbsp;|&nbsp; If A:B = 2:3, B:C = 4:5, then A:B:C = 8:12:15</p>
          </div>
        </div>
      </div>

      <div id="q-tips" class="notes-panel">
        <div class="card">
          <div class="card-title">⚡ High-Impact Tips</div>
          <ul class="notes">
            <li><strong>Read twice, calculate once:</strong> Most errors come from misreading the data, not wrong math.
            </li>
            <li><strong>Estimate aggressively:</strong> For MCQs, approximate calculations to 2 significant figures. If
              options are far apart, rounding works fine.</li>
            <li><strong>Check units:</strong> Watch out for lakhs vs. crores, per annum vs. total, etc.</li>
            <li><strong>No calculator:</strong> Practice mental math — particularly mental percentages (e.g., 17.5% =
              10% + 5% + 2.5%)</li>
            <li><strong>Spend time here wisely:</strong> This section has the fewest questions. Aim for 8–10 minutes
              total. Don't let one DI question eat 4 minutes.</li>
            <li><strong>Do this section near the end:</strong> Fresh eyes for calculation reduce errors.</li>
          </ul>
        </div>
      </div>
    </div>

    <!-- FLASHCARDS -->
    <div id="flashcards" class="section">
      <div class="sec-header">
        <div class="sec-icon" style="background:#fde8ec;">🗂️</div>
        <div>
          <h2>Smart Flashcards</h2>
          <p>Click a card to flip it. Test your memory.</p>
        </div>
      </div>

      <div class="notes-tabs">
        <button class="notes-tab active" onclick="loadDeck('legal')">⚖️ Legal Terms</button>
        <button class="notes-tab" onclick="loadDeck('writs')">📜 Writs</button>
        <button class="notes-tab" onclick="loadDeck('cases')">🏛️ Landmark Cases</button>
        <button class="notes-tab" onclick="loadDeck('articles')">📋 Constitutional Articles</button>
        <button class="notes-tab" onclick="loadDeck('fallacies')">🧠 Fallacies</button>
        <button class="notes-tab" onclick="loadDeck('english')">📖 English RC</button>
        <button class="notes-tab" onclick="loadDeck('gk')">🌍 GK & CA</button>
        <button class="notes-tab" onclick="loadDeck('quant')">📐 Quant</button>
      </div>

      <div style="margin-bottom:12px;" id="fc-progress" class="fc-count">Card 1 of 10</div>
      <div class="flashcard-wrap" id="fcWrap" onclick="flipCard()">
        <div class="flashcard" id="fc">
          <div class="fc-front"><span class="fc-label">Click to reveal</span><span class="fc-q"
              id="fc-q">Loading...</span></div>
          <div class="fc-back"><span class="fc-label">Answer</span><span id="fc-a">Loading...</span></div>
        </div>
      </div>
      <div class="fc-nav">
        <button class="btn-secondary" onclick="prevCard()">← Prev</button>
        <button class="btn-secondary" onclick="nextCard()">Next →</button>
      </div>
    </div>

    <!-- ASSESSMENT TESTS -->
    <div id="assessment" class="section">
      <div class="sec-header">
        <div class="sec-icon" style="background:#e0e8f9;">🎯</div>
        <div>
          <h2>Assessment Tests</h2>
          <p>AI-powered practice tests with instant feedback</p>
        </div>
      </div>

      <div id="quiz-selector">
        <div class="highlight-box"><strong>🤖 AI-Powered:</strong> These tests use real CLAT-style passages and
          questions. After each test, you'll get AI analysis of your performance and personalised tips.</div>
        <div class="assess-grid">
          <div class="assess-card" onclick="startQuiz('english')">
            <div class="icon">📖</div>
            <h4>English Language</h4>
            <p>RC passages with inference, tone & vocabulary</p>
            <span class="badge" style="background:#fde8ec; color:var(--accent);">5 Questions</span>
          </div>
          <div class="assess-card" onclick="startQuiz('legal')">
            <div class="icon">⚖️</div>
            <h4>Legal Reasoning</h4>
            <p>Principle-fact application via IRAC</p>
            <span class="badge" style="background:#e0f5f3; color:var(--teal);">5 Questions</span>
          </div>
          <div class="assess-card" onclick="startQuiz('gk')">
            <div class="icon">🌍</div>
            <h4>GK & Current Affairs</h4>
            <p>News passages + static GK</p>
            <span class="badge" style="background:#e0e8f9; color:#3a5bbf;">5 Questions</span>
          </div>
          <div class="assess-card" onclick="startQuiz('logical')">
            <div class="icon">🧠</div>
            <h4>Logical Reasoning</h4>
            <p>Argument analysis and fallacy detection</p>
            <span class="badge" style="background:#fef3dc; color:#b07d1a;">5 Questions</span>
          </div>
          <div class="assess-card" onclick="startQuiz('quant')">
            <div class="icon">📐</div>
            <h4>Quantitative Techniques</h4>
            <p>Data interpretation and maths</p>
            <span class="badge" style="background:#ede8f9; color:#6b4bbf;">5 Questions</span>
          </div>
          <div class="assess-card" onclick="startQuiz('mixed')">
            <div class="icon">🎲</div>
            <h4>Mixed Mock Test</h4>
            <p>Questions from all 5 sections</p>
            <span class="badge" style="background:#e8f5e9; color:#16a34a);">10 Questions</span>
          </div>
        </div>
      </div>

      <div id="quiz-area" style="display:none;">
        <div class="quiz-header">
          <h3 id="quiz-title">Loading Quiz...</h3>
          <div class="quiz-meta" id="quiz-meta">Question 1 of 5</div>
        </div>
        <div class="progress-bar">
          <div class="progress-fill" id="progress-fill" style="width:0%"></div>
        </div>
        <div id="quiz-content">
          <div class="ai-loading">
            <div class="spinner"></div>Generating your question...
          </div>
        </div>
      </div>
    </div>

    <!-- STRATEGY -->
    <div id="strategy" class="section">
      <div class="sec-header">
        <div class="sec-icon" style="background:#fde8ec;">📅</div>
        <div>
          <h2>Preparation Strategy</h2>
          <p>Month-by-month plan for Class 12 students targeting CLAT 2027</p>
        </div>
      </div>

      <div class="card">
        <div class="card-title">The Golden Rules of CLAT Prep</div>
        <ul class="notes">
          <li><strong>Read daily without exception.</strong> The Hindu editorial + news = your CLAT foundation. This is
            non-negotiable.</li>
          <li><strong>Passage practice beats rote learning.</strong> CLAT rewards comprehension and application, not
            memorisation.</li>
          <li><strong>Start mock tests 6 months before exam.</strong> The habit of timed, pressured practice is
            irreplaceable.</li>
          <li><strong>Analyse WHY you got something wrong,</strong> not just that you did. Pattern recognition in your
            errors is the key to improvement.</li>
          <li><strong>Balance Class 12 boards with CLAT.</strong> You need 45% in boards for eligibility — and college
            performance matters for law school applications.</li>
          <li><strong>GK is built daily, not in a week.</strong> Start now. No amount of last-minute cramming can
            substitute for 12 months of reading.</li>
        </ul>
      </div>

      <div class="month-card">
        <div class="month-header" onclick="toggleMonth(this)">
          <h3>📅 Phase 1: Foundation (Apr – Jun 2026)</h3><span>▼</span>
        </div>
        <div class="month-body">
          <ul>
            <li>Start <strong>The Hindu</strong> daily — editorial + national/international pages. This is your single
              most important CLAT habit.</li>
            <li>Complete NCERT Class 10 Maths — percentages, ratios, averages, SI/CI. 2 weeks is enough.</li>
            <li>Read NCERT Class 11 Political Science (Indian Constitution at Work) — covers Fundamental Rights, DPSPs,
              Parliament, Judiciary.</li>
            <li>Start a Current Affairs Diary — note 5 key news items daily. Review every Sunday.</li>
            <li>Read 1–2 official CLAT sample papers to understand format and passage length.</li>
            <li>Begin vocabulary building — 10 new words/week from editorial reading (in context, not lists).</li>
            <li>Watch free YouTube orientation videos: CLAT Possible, iQuanta Law, LexiConn.</li>
          </ul>
        </div>
      </div>

      <div class="month-card">
        <div class="month-header" onclick="toggleMonth(this)">
          <h3>📅 Phase 2: Concept Building (Jul – Sep 2026)</h3><span>▼</span>
        </div>
        <div class="month-body">
          <ul>
            <li>Deep-dive into <strong>Legal Reasoning</strong> — practice IRAC daily. Solve 2–3 passages per day from
              past papers.</li>
            <li>Study logical fallacies and argument structure — read op-ed columns critically (2–3 hrs/week).</li>
            <li>Solve <strong>Reading Comprehension</strong> passages daily — time yourself at 5–6 minutes per passage.
            </li>
            <li>Compile Landmark Judgements notes (use the GK section of this guide).</li>
            <li>Start past CLAT papers (2020–2025) — one full paper per week. Analyse errors by section.</li>
            <li>Build Static GK notes: Constitutional Articles, Indian Geography, National Symbols, World Organisations.
            </li>
            <li>Continue daily newspaper reading; add <strong>Indian Express Explained</strong> section.</li>
          </ul>
        </div>
      </div>

      <div class="month-card">
        <div class="month-header" onclick="toggleMonth(this)">
          <h3>📅 Phase 3: Intensive Practice (Oct – Nov 2026)</h3><span>▼</span>
        </div>
        <div class="month-body">
          <ul>
            <li>Give <strong>2 full mock tests per week</strong> under strict timed conditions (120 minutes, offline).
            </li>
            <li>After each mock — deep error analysis by section. Identify your 3 weakest areas and address them
              immediately.</li>
            <li>Revise all landmark judgements, constitutional articles, and legal terms (use flashcards from this
              guide).</li>
            <li>Compile last 18 months' CA into a quick-revision booklet — one page per month.</li>
            <li>Track your reading speed: aim for 200+ words per minute for CLAT passages.</li>
            <li>Solve all past CLAT papers 2018–2025. Identify recurring question types.</li>
            <li>Attempt AILET and SLAT mock papers for additional exposure.</li>
          </ul>
        </div>
      </div>

      <div class="month-card">
        <div class="month-header" onclick="toggleMonth(this)">
          <h3>📅 Phase 4: Revision & Mastery (Dec 2026)</h3><span>▼</span>
        </div>
        <div class="month-body">
          <ul>
            <li>Give a mock test every 2 days. Focus on time management and accuracy, not new learning.</li>
            <li>Only revise — no new topics in the last 3 weeks before the exam.</li>
            <li>Review CA booklet daily in the final 2 weeks.</li>
            <li>Do sectional tests for Legal Reasoning and GK (your highest-weightage sections).</li>
            <li>Maintain sleep schedule and physical routine. Cognitive performance degrades with sleep deprivation.
            </li>
            <li>Re-read all notes: legal terms, constitutional articles, landmark judgements.</li>
          </ul>
        </div>
      </div>

      <div class="card">
        <div class="card-title">📅 Ideal Daily Schedule (2.5 hrs alongside Class 12)</div>
        <div class="timeline">
          <div class="tl-item">
            <h4>Morning — 30 mins — Newspaper Reading</h4>
            <p>The Hindu editorial + 2 key news stories. Add to CA diary. This builds GK, vocabulary, and reading speed
              simultaneously.</p>
          </div>
          <div class="tl-item">
            <h4>After School/College — 60 mins — Section Practice</h4>
            <p>Mon/Wed = Legal Reasoning passages &nbsp;|&nbsp; Tue/Thu = Logical Reasoning &nbsp;|&nbsp; Fri = English
              RC (timed) &nbsp;|&nbsp; Sat = GK revision + CA quiz &nbsp;|&nbsp; Sun = Full mock or past paper</p>
          </div>
          <div class="tl-item">
            <h4>Evening — 30 mins — Quant + Vocab</h4>
            <p>10 min: 3–4 Quant problems &nbsp;|&nbsp; 10 min: vocabulary review (from editorial) &nbsp;|&nbsp; 10 min:
              legal terms or flashcards</p>
          </div>
          <div class="tl-item">
            <h4>Weekend — 2–3 hours — Mock or Deep Sectional</h4>
            <p>One full mock test OR two full-section practices. Always follow with a written error analysis. What type
              of question did you get wrong? Why?</p>
          </div>
        </div>
      </div>

      <div class="card">
        <div class="card-title">🏁 Exam Day Attempt Strategy</div>
        <ul class="notes">
          <li><strong>Recommended order:</strong> Legal Reasoning → English → GK → Logical → Quant</li>
          <li><strong>Approximate time:</strong> Legal 28 min → English 20 min → GK 25 min → Logical 20 min → Quant 10
            min → Review 17 min</li>
          <li><strong>Skip-and-return rule:</strong> Stuck on a question for 90 seconds? Mark it and move on. Don't let
            one question cost three marks elsewhere.</li>
          <li><strong>Negative marking threshold:</strong> Only attempt if you can eliminate at least 2 options. Skip if
            genuinely unsure — −0.25 hurts.</li>
          <li><strong>Keep 10–15 minutes at end</strong> to return to flagged questions. Never end the exam early.</li>
          <li><strong>Mental reset between passages:</strong> Take one deep breath before each new passage. Carry over
            comprehension from previous passage will mislead you.</li>
        </ul>
      </div>
    </div>

    <!-- RESOURCES -->
    <div id="resources" class="section">
      <div class="sec-header">
        <div class="sec-icon" style="background:#e0f5f3;">📚</div>
        <div>
          <h2>Books & Resources</h2>
          <p>Curated material for every stage of CLAT preparation</p>
        </div>
      </div>

      <div class="card">
        <div class="card-title">📘 Best Books for CLAT UG</div>
        <div class="resource-item">
          <div class="res-icon" style="background:#fde8ec;">📖</div>
          <div>
            <h4>Universal's CLAT Guide — R.K. Gupta</h4>
            <p>All-in-one for beginners. Covers all 5 sections with theory, solved examples, and past year papers. Good
              starting point.</p>
          </div>
        </div>
        <div class="resource-item">
          <div class="res-icon" style="background:#e0e8f9;">⚖️</div>
          <div>
            <h4>Lexis Nexis CLAT Guide</h4>
            <p>Strong legal reasoning and GK sections. Trusted by toppers. Updated with new passage-based format.</p>
          </div>
        </div>
        <div class="resource-item">
          <div class="res-icon" style="background:#e0f5f3;">🔢</div>
          <div>
            <h4>NCERT Class 10 Mathematics (Free)</h4>
            <p>Covers all Quantitative Techniques topics at the right level. Download free from ncert.nic.in.</p>
          </div>
        </div>
        <div class="resource-item">
          <div class="res-icon" style="background:#fef3dc;">🇮🇳</div>
          <div>
            <h4>NCERT Class 11 Political Science — Indian Constitution at Work (Free)</h4>
            <p>Best and free introduction to constitutional law for CLAT. Covers Fundamental Rights, Parliament,
              Judiciary.</p>
          </div>
        </div>
        <div class="resource-item">
          <div class="res-icon" style="background:#ede8f9;">🧠</div>
          <div>
            <h4>Word Power Made Easy — Norman Lewis</h4>
            <p>Classic vocabulary book. Builds contextual word understanding — far more useful than rote word lists.</p>
          </div>
        </div>
        <div class="resource-item">
          <div class="res-icon" style="background:#fde8ec;">📄</div>
          <div>
            <h4>Past CLAT Papers 2015–2024</h4>
            <p>Your most important resource. Free on consortiumofnlus.ac.in. Do all of them under timed conditions.</p>
          </div>
        </div>
      </div>

      <div class="card">
        <div class="card-title">💻 Online Resources</div>
        <div class="resource-item">
          <div class="res-icon" style="background:#e0f5f3;">🌐</div>
          <div>
            <h4>consortiumofnlus.ac.in (Official)</h4>
            <p>Official CLAT website — sample papers, syllabus updates, model questions. Read everything here. Bookmark
              it.</p>
          </div>
        </div>
        <div class="resource-item">
          <div class="res-icon" style="background:#fde8ec;">📱</div>
          <div>
            <h4>CLAT Possible / iQuanta Law / LexiConn (YouTube — Free)</h4>
            <p>Free video lectures, strategy sessions, and paper analysis. Excellent for Legal Reasoning walkthroughs.
            </p>
          </div>
        </div>
        <div class="resource-item">
          <div class="res-icon" style="background:#e0e8f9;">📄</div>
          <div>
            <h4>legalbites.in (Free)</h4>
            <p>Free Legal Reasoning notes, monthly CA compilations, and practice questions. Very CLAT-focused.</p>
          </div>
        </div>
        <div class="resource-item">
          <div class="res-icon" style="background:#fef3dc;">📰</div>
          <div>
            <h4>The Hindu + Indian Express (Daily)</h4>
            <p>The single most important daily habit for CLAT. Editorials for English + GK; news for CA. Free with
              student subscription at many schools.</p>
          </div>
        </div>
        <div class="resource-item">
          <div class="res-icon" style="background:#ede8f9;">🎯</div>
          <div>
            <h4>CLATapult / Endeavor / CLAT Gurukul (Paid Mocks)</h4>
            <p>Paid mock test series — recommended from 5–6 months before exam. Gives national percentile data for
              benchmarking.</p>
          </div>
        </div>
      </div>

      <div class="card">
        <div class="card-title">✅ Humanities Background = Your Advantage</div>
        <div class="tip-box">A Humanities background is a <strong>real advantage</strong> in CLAT. Students with
          History, Political Science, and English have a natural edge in:
          <ul style="padding-left:18px; margin-top:8px;">
            <li>Legal Reasoning — exposure to social, moral, and policy issues</li>
            <li>Current Affairs — History and Pol. Science give strong contextual understanding of news</li>
            <li>English — regular essay and comprehension training directly prepares for CLAT passages</li>
            <li>Logical Reasoning — humanities essay writing trains argument analysis</li>
          </ul>
          <strong>Only focus area:</strong> Spend extra time on Quantitative Techniques — 2–3 weeks of Class 10 maths
          practice will build full confidence there.
        </div>
      </div>
    </div>

  </div><!-- end container -->

  <!-- PYQ SECTION -->
  <div id="pyq" class="section">
    <div class="sec-header">
      <div class="sec-icon" style="background:#fde8ec;">📝</div>
      <div>
        <h2>Previous Year Questions</h2>
        <p>AILET 2026 & CLAT English — real exam questions with solutions</p>
      </div>
    </div>

    <div class="highlight-box"><strong>💡 How to use:</strong> Click any option to check your answer. Read the
      explanation carefully — understanding WHY an option is wrong is more valuable than just knowing the right one.
    </div>

    <div class="pyq-filter">
      <button class="pyq-filter-btn active" onclick="filterPYQ('all', this)">All</button>
      <button class="pyq-filter-btn" onclick="filterPYQ('english', this)">📖 English</button>
      <button class="pyq-filter-btn" onclick="filterPYQ('gk', this)">🌍 GK</button>
      <button class="pyq-filter-btn" onclick="filterPYQ('logical', this)">🧠 Logical</button>
    </div>

    <div id="pyq-list">

      <!-- ENGLISH PYQs from AILET 2026 -->
      <div class="pyq-question" data-cat="english">
        <div class="pyq-meta"><span>AILET 2026</span><span>English — Reading Comprehension</span><span>Q1</span></div>
        <div class="pyq-passage">The integration of Artificial Intelligence (AI) into law enforcement practices has
          sparked a global debate on ethics, privacy, and accountability. From facial recognition systems in public
          spaces to predictive policing algorithms, AI is transforming how crimes are detected and prevented. However,
          the benefits of efficiency and data-driven decision-making are accompanied by concerns about fairness, bias,
          and the potential erosion of civil liberties. Predictive policing uses historical crime data to forecast where
          crimes are likely to occur or who might commit them. Proponents argue that this allows police to allocate
          resources more efficiently and reduce crime rates. However, critics warn that such systems may reinforce
          existing societal biases. The lack of transparency in how these systems operate — the "Black Box" problem —
          makes it difficult to challenge wrongful predictions or decisions in a court of law.</div>
        <div class="pyq-q">1. What is the central concern raised in the passage regarding AI in law enforcement?</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">A. Replacing human officers</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">B. High operational costs</div>
        <div class="pyq-option" onclick="selectPYQ(this, true)">C. Reinforcing bias and reducing fairness</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">D. Inability to analyze real-time data</div>
        <div class="pyq-answer-box"><strong>✅ Answer: C</strong> — The passage repeatedly highlights concerns about
          fairness, bias, and erosion of civil liberties. Predictive policing and FRT are criticised mainly because they
          may perpetuate injustice against marginalized communities. Bias and fairness are the core concerns.</div>
      </div>

      <div class="pyq-question" data-cat="english">
        <div class="pyq-meta"><span>AILET 2026</span><span>English — RC</span><span>Q3</span></div>
        <div class="pyq-passage">[Same AI in Law Enforcement passage as above]</div>
        <div class="pyq-q">3. Based on the passage, how does facial recognition technology potentially lead to
          injustice?</div>
        <div class="pyq-option" onclick="selectPYQ(this, true)">A. By exhibiting higher error rates for specific
          demographic groups</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">B. By decreasing reliance on human judgment in policing
        </div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">C. By increasing costs and limiting deployment in
          critical areas</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">D. By generating occasional misidentifications across
          all populations equally</div>
        <div class="pyq-answer-box"><strong>✅ Answer: A</strong> — The passage says "FRT is less accurate in identifying
          people of colour and women," resulting in false accusations and wrongful detentions. Injustice arises from
          unequal error rates — not equal mistakes across all groups.</div>
      </div>

      <div class="pyq-question" data-cat="english">
        <div class="pyq-meta"><span>AILET 2026</span><span>English — Vocabulary in Context</span><span>Q5</span></div>
        <div class="pyq-passage">[AI in Law Enforcement passage] — "This opaqueness undermines accountability, making it
          difficult to challenge wrongful predictions or decisions in a court of law."</div>
        <div class="pyq-q">5. The word 'opaqueness' in the paragraph refers to:</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">A. Clear and understandable legal processes</div>
        <div class="pyq-option" onclick="selectPYQ(this, true)">B. Lack of visibility or understanding</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">C. Openness and transparency in systems</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">D. Restricted access due to security levels</div>
        <div class="pyq-answer-box"><strong>✅ Answer: B</strong> — 'Opaqueness' is used in the context of AI algorithms
          being hard to understand and decision-making not being visible. This aligns with lack of clarity or
          transparency.</div>
      </div>

      <div class="pyq-question" data-cat="english">
        <div class="pyq-meta"><span>CLAT English PYQ</span><span>English — Inference</span><span>Passage 3</span></div>
        <div class="pyq-passage">The curdling of the social internet happened slowly and then all at once. The tipping
          point, I'd guess, was around 2012. People were losing excitement about the internet, starting to articulate a
          set of new truisms. Facebook had become tedious, trivial, exhausting. Instagram seemed better, but would soon
          reveal its underlying function as a three-ring circus of happiness and popularity and success. Twitter, for
          all its discursive promise, was where everyone tweeted complaints at airlines. As a medium, the internet is
          defined by a built-in performance incentive. On the internet—for anyone to see you, you have to act. The
          everyday madness perpetuated by the internet is the madness of this architecture, which positions personal
          identity as the centre of the universe.</div>
        <div class="pyq-q">Q11. Which of the following statements can be inferred from the above passage?</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">A. The internet expanded very slowly</div>
        <div class="pyq-option" onclick="selectPYQ(this, true)">B. The internet can be used to cause harm</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">C. The internet is addictive</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">D. The main purpose of social media platforms is to
          dissuade people from showing off</div>
        <div class="pyq-answer-box"><strong>✅ Answer: B</strong> — The passage talks about how the internet causes
          "everyday madness," alienation, and self-destructive performance incentives — all forms of harm. The internet
          expanded rapidly (not slowly), and option D is the opposite of what the passage says.</div>
      </div>

      <div class="pyq-question" data-cat="english">
        <div class="pyq-meta"><span>CLAT English PYQ</span><span>English — Metaphor</span><span>Passage 3</span></div>
        <div class="pyq-passage">[Social internet passage above]</div>
        <div class="pyq-q">Q14. Which of the following is a metaphor in the passage?</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">A. the village of the internet</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">B. this feverish, electric, unliveable hell</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">C. three-ring circus of happiness and popularity and
          success</div>
        <div class="pyq-option" onclick="selectPYQ(this, true)">D. All the above</div>
        <div class="pyq-answer-box"><strong>✅ Answer: D</strong> — All three phrases are metaphors. "Village of the
          internet" compares the internet to a village. "Unliveable hell" is a metaphorical description of the
          experience. "Three-ring circus" compares Instagram to a circus performance.</div>
      </div>

      <!-- GK PYQs from AILET 2026 -->
      <div class="pyq-question" data-cat="gk">
        <div class="pyq-meta"><span>AILET 2026</span><span>GK & Current Affairs</span><span>Q51</span></div>
        <div class="pyq-q">India's first woman Chief Minister was:</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">A. Nandini Satpathy</div>
        <div class="pyq-option" onclick="selectPYQ(this, true)">B. Sucheta Kripalani</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">C. Janaki Ramachandran</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">D. Sheila Dikshit</div>
        <div class="pyq-answer-box"><strong>✅ Answer: B</strong> — Sucheta Kripalani became India's first woman Chief
          Minister in 1963, serving as CM of Uttar Pradesh. She was also a prominent freedom fighter and member of the
          Constituent Assembly.</div>
      </div>

      <div class="pyq-question" data-cat="gk">
        <div class="pyq-meta"><span>AILET 2026</span><span>GK & Current Affairs</span><span>Q57</span></div>
        <div class="pyq-q">Which country instituted proceedings against Israel before the International Court of
          Justice, alleging that Israeli military action in Gaza violated the Genocide Convention?</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">A. India</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">B. Belgium</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">C. France</div>
        <div class="pyq-option" onclick="selectPYQ(this, true)">D. South Africa</div>
        <div class="pyq-answer-box"><strong>✅ Answer: D</strong> — South Africa approached the ICJ alleging that
          Israel's military actions in Gaza violated the Genocide Convention. The case gained global attention due to
          its serious legal and humanitarian implications.</div>
      </div>

      <div class="pyq-question" data-cat="gk">
        <div class="pyq-meta"><span>AILET 2026</span><span>GK — Science & Tech</span><span>Q68</span></div>
        <div class="pyq-q">In late 2024, Google announced development of a state-of-the-art quantum chip considered a
          big step towards developing a large-scale, error-corrected quantum computer. The chip is named:</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">A. Sentinel</div>
        <div class="pyq-option" onclick="selectPYQ(this, true)">B. Willow</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">C. Polaris</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">D. Orion</div>
        <div class="pyq-answer-box"><strong>✅ Answer: B</strong> — Google's Willow chip (2024) is designed to improve
          quantum error correction and scalability — two of the biggest challenges in practical quantum computing.</div>
      </div>

      <div class="pyq-question" data-cat="gk">
        <div class="pyq-meta"><span>AILET 2026</span><span>GK — Sports</span><span>Q76</span></div>
        <div class="pyq-q">Which franchise won the 2025 edition of Indian Premier League (IPL)?</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">A. Mumbai Indians</div>
        <div class="pyq-option" onclick="selectPYQ(this, true)">B. Royal Challengers Bengaluru</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">C. Gujarat Titans</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">D. Chennai Super Kings</div>
        <div class="pyq-answer-box"><strong>✅ Answer: B</strong> — Royal Challengers Bengaluru won IPL 2025, marking a
          historic first title for the franchise after years of near-misses.</div>
      </div>

      <div class="pyq-question" data-cat="gk">
        <div class="pyq-meta"><span>AILET 2026</span><span>GK — Environment</span><span>Q77</span></div>
        <div class="pyq-q">GRAP framework was introduced as an emergency response mechanism to combat extreme air
          quality conditions in Delhi-NCR. What does GRAP stand for?</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">A. Generalised Response Assessment Protocol</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">B. Graded Response against Air Pollution</div>
        <div class="pyq-option" onclick="selectPYQ(this, true)">C. Graded Response Action Plan</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">D. Ground-level Restoration and Action Policy</div>
        <div class="pyq-answer-box"><strong>✅ Answer: C</strong> — GRAP (Graded Response Action Plan) is a set of
          emergency measures implemented in Delhi-NCR to tackle air pollution based on its severity levels.</div>
      </div>

      <!-- LOGICAL PYQs from AILET 2026 -->
      <div class="pyq-question" data-cat="logical">
        <div class="pyq-meta"><span>AILET 2026</span><span>Logical Reasoning — Syllogism</span><span>Q84</span></div>
        <div class="pyq-passage">Shopkeepers are Big. Some Big persons violate night curfew. All who violate night
          curfew are fined. Anil is Big.</div>
        <div class="pyq-q">Examine the following statements: I. Anil is a Shopkeeper II. Anil may violate a night curfew
          III. Anil will definitely violate night curfew IV. If Anil is a shopkeeper, he will get fined V. Anil will
          definitely get fined. Select the correct option:</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">A. Only I, III and IV</div>
        <div class="pyq-option" onclick="selectPYQ(this, true)">B. Only II</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">C. Only I and III</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">D. Only I and V</div>
        <div class="pyq-answer-box"><strong>✅ Answer: B — Only II is true.</strong> I is false (all shopkeepers are big,
          but not all big persons are shopkeepers). II is true (some big persons violate curfew; since Anil is big, he
          MAY violate). III is false (only SOME big persons violate — not certainty). IV is false (shopkeeper → big →
          may violate → may be fined, not definite). V is false for same reason.</div>
      </div>

      <div class="pyq-question" data-cat="logical">
        <div class="pyq-meta"><span>AILET 2026</span><span>Logical Reasoning — Principle-Fact</span><span>Q86</span>
        </div>
        <div class="pyq-passage"><strong>Principle:</strong> A driver is responsible for controlling their vehicle and
          avoiding harm to pedestrians, unless the pedestrian acted recklessly or unlawfully. <strong>Facts:</strong> A
          driver hits a pedestrian who suddenly runs across the road outside a crosswalk without looking. The driver was
          obeying all traffic rules.</div>
        <div class="pyq-q">Which of the following is correct?</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">A. The driver is liable for the pedestrian's injuries.
        </div>
        <div class="pyq-option" onclick="selectPYQ(this, true)">B. The pedestrian's reckless action absolves the driver
          of liability.</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">C. Both the driver and pedestrian share liability
          equally.</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">D. The driver is always liable in pedestrian accidents.
        </div>
        <div class="pyq-answer-box"><strong>✅ Answer: B</strong> — The principle has an exception: if the pedestrian
          acted recklessly or unlawfully. Running across the road outside a crosswalk without looking =
          reckless/unlawful behaviour. The exception applies → driver not liable. Option D contradicts the principle's
          own exception clause.</div>
      </div>

      <div class="pyq-question" data-cat="logical">
        <div class="pyq-meta"><span>AILET 2026</span><span>Logical Reasoning — Principle-Fact</span><span>Q90</span>
        </div>
        <div class="pyq-passage"><strong>Principle:</strong> A public official must avoid conflicts of interest that
          could undermine public trust, even if no actual wrongdoing occurs. <strong>Facts:</strong> A city mayor awards
          a major construction contract to a company owned by her cousin. She discloses the relationship publicly and
          follows all procurement procedures.</div>
        <div class="pyq-q">Apply the principle and select the most appropriate option:</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">A. Contract should proceed since procedures were
          followed.</div>
        <div class="pyq-option" onclick="selectPYQ(this, true)">B. Contract should be avoided to maintain public trust.
        </div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">C. Cousin should sell the company before bidding.</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">D. Mayor should resign.</div>
        <div class="pyq-answer-box"><strong>✅ Answer: B</strong> — The principle says avoid conflicts that "could
          undermine public trust" — even with no actual wrongdoing. Disclosing and following procedures doesn't
          eliminate the conflict of interest itself. The appearance of a conflict is sufficient under this principle.
          The contract should be avoided. Option A ignores the conflict-of-interest aspect. Option D is too extreme —
          the principle doesn't require resignation.</div>
      </div>

      <div class="pyq-question" data-cat="logical">
        <div class="pyq-meta"><span>AILET 2026</span><span>Logical Reasoning — Analogy</span><span>Q83</span></div>
        <div class="pyq-q">4, 10, 18, 28, ?</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">A. 46</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">B. 42</div>
        <div class="pyq-option" onclick="selectPYQ(this, true)">C. 40</div>
        <div class="pyq-option" onclick="selectPYQ(this, false)">D. 48</div>
        <div class="pyq-answer-box"><strong>✅ Answer: C — 40</strong> — The pattern: differences are +6, +8, +10, +12.
          So next term = 28 + 12 = 40. Each step the difference increases by 2.</div>
      </div>

    </div><!-- end pyq-list -->
  </div>

  <!-- CHATBOT SECTION -->
  <div id="chatbot" class="section">
    <div class="sec-header">
      <div class="sec-icon" style="background:#ede8f9;">🤖</div>
      <div>
        <h2>AI CLAT Tutor</h2>
        <p>Autonomous AI tutor — streams answers, tracks progress, sends you daily drills</p>
      </div>
    </div>

    <div class="tip-box" style="margin-bottom:16px;">💡 <strong>Autonomous Mode:</strong> Turn on Auto to get proactive
      practice questions, weak-spot analysis, and insights without asking. The AI tracks your study streak and topics!
    </div>

    <div id="chat-starters-wrap" class="chat-starters">
      <button class="starter-btn"
        onclick="chatSend('Explain the difference between Void and Voidable contracts with CLAT-style examples.')">⚖️
        Void vs Voidable</button>
      <button class="starter-btn" onclick="chatSend('What are the 5 writs? Explain each with a real-world example.')">📜
        5 Writs</button>
      <button class="starter-btn"
        onclick="chatSend('Give me a challenging principle-fact legal reasoning question with detailed explanation.')">🎯
        Practice Legal Q</button>
      <button class="starter-btn"
        onclick="chatSend('How should I approach a Reading Comprehension passage in CLAT?')">📖 RC Strategy</button>
      <button class="starter-btn"
        onclick="chatSend('What are the most important current affairs topics for CLAT 2027?')">🌍 Key CA
        Topics</button>
      <button class="starter-btn"
        onclick="chatSend('Explain the Basic Structure Doctrine — meaning, history, and CLAT application.')">🏛️ Basic
        Structure</button>
      <button class="starter-btn"
        onclick="chatSend('Give me a tough syllogism question from CLAT pattern with full explanation.')">🧠 Syllogism
        Q</button>
      <button class="starter-btn"
        onclick="chatSend('I have 6 months for CLAT prep. Give me a detailed month-by-month study plan.')">📅 6-Month
        Plan</button>
    </div>

    <div class="chatbot-wrap">
      <!-- Header -->
      <div class="chat-header-bar">
        <div class="chat-header-left">
          <div class="chat-header-avatar">🤖</div>
          <div>
            <div class="chat-header-name">CLAT AI Tutor</div>
            <div class="chat-header-status" onclick="checkConnection()">
              <span class="status-dot" id="status-dot"></span>
              <span id="status-label">Click to check connection</span>
            </div>
          </div>
        </div>
        <div class="chat-header-actions">
          <span class="streak-badge" id="streak-badge">🔥 0d streak</span>
          <button class="hdr-btn" id="check-conn-btn" onclick="checkConnection()">⟳ Test</button>
          <button class="hdr-btn" id="auto-mode-btn" onclick="toggleAutonomousMode()">🤖 Auto: OFF</button>
          <button class="hdr-btn" onclick="clearChat()">🗑 Clear</button>
        </div>
      </div>

      <!-- Autonomous Toolbar -->
      <div class="chat-toolbar">
        <span class="toolbar-label">Quick Drill:</span>
        <button class="tool-btn" onclick="askDailyQuestion('legal')">⚖️ Legal</button>
        <button class="tool-btn" onclick="askDailyQuestion('english')">📖 English</button>
        <button class="tool-btn" onclick="askDailyQuestion('gk')">🌍 GK</button>
        <button class="tool-btn" onclick="askDailyQuestion('logical')">🧠 Logical</button>
        <button class="tool-btn" onclick="askDailyQuestion('quant')">📐 Quant</button>
        <button class="tool-btn" onclick="autonomousInsight()">💡 Get Insight</button>
        <button class="tool-btn" onclick="autonomousWeakSpotCheck()">🎯 Weak Spot</button>
      </div>

      <!-- Messages -->
      <div class="chat-messages" id="chat-messages">
        <div class="chat-system-msg">🤖 CLAT AI Tutor · Autonomous Mode Available · Streams Responses</div>
        <div class="chat-msg-wrap bot">
          <div class="chat-msg bot">
            <div class="bot-label"><span class="bot-avatar">🤖</span> CLAT AI Tutor</div>
            <div class="bot-content">
              <p class="chat-p">Namaste! I'm your <strong>Autonomous CLAT AI Tutor</strong>. I don't just answer — I
                proactively help you prepare! Here's what I can do:</p>
              <ul class="chat-ul">
                <li class="bul-item">💬 Answer any CLAT doubt with streaming responses</li>
                <li class="bul-item">🤖 <strong>Autonomous Mode</strong> — sends you drills, insights & weak-spot alerts
                  automatically</li>
                <li class="bul-item">📊 Track your study streak and topics covered</li>
                <li class="bul-item">🎯 Quick Drill buttons above for instant practice Qs</li>
                <li class="bul-item">↺ Regenerate any answer you want rephrased</li>
                <li class="bul-item">⟳ Connection tester — know if AI is reachable</li>
              </ul>
              <p class="chat-p">Turn on <strong>Auto mode</strong> above and I'll proactively check in with practice
                questions every few minutes. Or just ask me anything! 🎯</p>
            </div>
          </div>
        </div>
      </div>

      <!-- Input -->
      <div class="chat-input-area">
        <div class="chat-input-row">
          <textarea class="chat-input" id="chat-input"
            placeholder="Ask any CLAT doubt... (Enter to send, Shift+Enter for new line)" rows="1"
            onkeydown="if(event.key==='Enter' && !event.shiftKey){event.preventDefault(); chatSend();}"
            oninput="this.style.height='auto'; this.style.height=Math.min(this.scrollHeight,100)+'px'"></textarea>
          <button class="chat-send" id="chat-send-btn" onclick="chatSend()">Send ➤</button>
        </div>
        <div class="chat-hint">Enter to send · Shift+Enter for newline · AI remembers your full conversation</div>
      </div>
    </div>
  </div>
  </div><!-- end container -->

  <div class="footer">CLAT UG Ultimate Study Guide v2 · AI-Powered Assessment & Tutor · PYQs from AILET 2026 & CLAT ·
    Based on Official Syllabus (consortiumofnlus.ac.in) · For CLAT UG 2027</div>

  <script>
    // TAB NAVIGATION
    function showTab(id) {
      document.querySelectorAll('.section').forEach(s => s.classList.remove('active'));
      document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
      document.getElementById(id).classList.add('active');
      event.target.classList.add('active');
      window.scrollTo({ top: 0, behavior: 'smooth' });
      if (id === 'flashcards') loadDeck('legal');
    }

    // NOTES TABS
    function switchNotes(btn, id) {
      const parent = btn.closest('.section');
      parent.querySelectorAll('.notes-tab').forEach(b => b.classList.remove('active'));
      parent.querySelectorAll('.notes-panel').forEach(p => p.classList.remove('active'));
      btn.classList.add('active');
      document.getElementById(id).classList.add('active');
    }

    // ACCORDION
    function toggleMonth(header) {
      const body = header.nextElementSibling;
      const isOpen = body.classList.contains('open');
      document.querySelectorAll('.month-body').forEach(b => b.classList.remove('open'));
      document.querySelectorAll('.month-header span').forEach(s => s.textContent = '▼');
      if (!isOpen) { body.classList.add('open'); header.querySelector('span').textContent = '▲'; }
    }

    // FLASHCARDS
    const DECKS = {
      legal: [
        { q: "What is Tort?", a: "A civil wrong (not a crime) causing harm, giving the victim the right to sue for compensation. Examples: negligence, defamation, trespass." },
        { q: "What are the 3 elements of Negligence?", a: "(1) Duty of care owed to the claimant, (2) Breach of that duty, (3) Damage actually caused by the breach." },
        { q: "What is Mens Rea?", a: "The 'guilty mind' — criminal intent. Most crimes require both the act (Actus Reus) AND the mental intent (Mens Rea)." },
        { q: "What is Vicarious Liability?", a: "When one person is held responsible for the acts of another. Common example: employer liable for employee's wrongful acts done in the course of employment." },
        { q: "What is Volenti Non Fit Injuria?", a: "'No injury is done to one who consents.' A complete defence to tort claims. A boxer cannot sue for injuries received in a match." },
        { q: "What is Strict Liability?", a: "Liability without proof of fault or negligence. Applied to inherently dangerous activities. Based on Rylands v. Fletcher principle." },
        { q: "What is Res Ipsa Loquitur?", a: "'The thing speaks for itself.' When facts so clearly indicate negligence that no further proof is needed — burden shifts to defendant." },
        { q: "What is the difference between Void and Voidable contracts?", a: "Void: Never had legal effect from the start (e.g., agreement by a minor). Voidable: Valid until challenged by one party (e.g., obtained by fraud)." },
        { q: "What is Consideration in Contract Law?", a: "Something of value exchanged between contracting parties. A contract without consideration is generally unenforceable. 'Past consideration is no consideration.'" },
        { q: "What is Locus Standi?", a: "Legal standing to bring a case before a court. Relaxed in India through PIL — any citizen can file on behalf of others who cannot." },
        { q: "What is Absolute Liability?", a: "Evolved from Strict Liability in M.C. Mehta v. Union of India (1987). NO exceptions or defences — enterprises engaged in inherently dangerous activity are absolutely liable for any harm." },
        { q: "What is the IRAC method?", a: "Issue → Rule → Application → Conclusion. The standard approach for CLAT legal reasoning. Identify the legal issue, state the rule/principle, apply it to facts, then conclude." },
        { q: "What is Defamation?", a: "Making a false statement that harms a person's reputation. Libel = written; Slander = spoken. Truth is a complete defence in civil defamation." },
        { q: "What is a Contract of Indemnity?", a: "A contract where one party promises to save the other from loss caused by the promisor's own conduct or third-party conduct. E.g., insurance policies." },
        { q: "What is Nuisance in Tort Law?", a: "Private nuisance: unlawful interference with a person's use and enjoyment of their land. Public nuisance: affects a class of citizens generally — a crime AND a tort." },
        { q: "What does 'Natural Justice' mean?", a: "Two core principles: (1) Audi alteram partem — hear the other side before deciding; (2) Nemo judex in causa sua — no one should be a judge in their own cause (no bias)." },
        { q: "What is a Bailment?", a: "Delivery of goods by the owner (bailor) to another (bailee) for a specific purpose, on condition they will be returned once the purpose is accomplished." },
        { q: "What is Promissory Estoppel?", a: "If A makes a clear promise to B, and B relies on it to their detriment, A is estopped (prevented) from going back on that promise — even without consideration." },
        { q: "What is Contributory Negligence?", a: "When the claimant themselves is partly responsible for the harm suffered. In India, it can reduce the compensation awarded, not necessarily extinguish the claim entirely." },
        { q: "What is a PIL (Public Interest Litigation)?", a: "Allows any public-spirited citizen to file a case in the High Court (Art. 226) or Supreme Court (Art. 32) on behalf of those who cannot access justice. Expanded standing." }
      ],
      writs: [
        { q: "Habeas Corpus — meaning and purpose?", a: "'Have the body.' Challenges unlawful detention. Requires the detaining authority to produce the person before a court and justify detention." },
        { q: "Mandamus — when is it issued?", a: "'We command.' Issued to a public official or body to perform a legal duty they are obligated to do. Cannot be issued against President or Governor." },
        { q: "Certiorari — what does it do?", a: "'To be certified.' Quashes (cancels) orders of a lower court/tribunal that acted beyond jurisdiction or violated natural justice. Curative in nature." },
        { q: "Prohibition — how is it different from Certiorari?", a: "Prohibition is PREVENTIVE — stops a lower court from exceeding jurisdiction BEFORE it makes a final decision. Certiorari is curative — quashes after the decision." },
        { q: "Quo Warranto — what does it challenge?", a: "'By what authority?' Challenges a person's right to hold a public office. They must prove they have legal authority to exercise the office." },
        { q: "Under which Articles can writs be filed?", a: "Art. 32 — Supreme Court (Right to Constitutional Remedies is itself a Fundamental Right). Art. 226 — High Court (wider jurisdiction, can also be used for non-FR violations)." },
        { q: "Which writ protects personal liberty most directly?", a: "Habeas Corpus. It is available even during emergencies (except when Art. 359 suspends it). During the Emergency of 1975, this writ was controversially suspended — ADM Jabalpur case." },
        { q: "Can Mandamus be issued against a private company?", a: "Generally NO. Mandamus is issued against public authorities performing public duties. However, if a private entity has a public function (like a Board of Directors of a government company), it may apply." },
        { q: "What is the scope of Art. 226 vs Art. 32?", a: "Art. 226 (High Court) is wider — can issue writs for any purpose, not just FR violations. Art. 32 (Supreme Court) is limited to enforcement of Fundamental Rights only. Both are equally important." },
        { q: "Against whom CANNOT writs be issued?", a: "Mandamus cannot be issued against President or Governor. No writ lies against a legislature for passing a law. Writ jurisdiction doesn't extend to private individuals generally." }
      ],
      cases: [
        { q: "Kesavananda Bharati (1973) — what was established?", a: "Basic Structure Doctrine: Parliament can amend the Constitution but cannot alter its 'basic structure' (democracy, federalism, secularism, judicial review)." },
        { q: "Maneka Gandhi (1978) — what changed?", a: "Expanded Art. 21. Held that 'procedure established by law' must be fair, just, and reasonable. Right to life includes a broad range of rights." },
        { q: "Justice K.S. Puttaswamy (2017) — significance?", a: "Declared Privacy a fundamental right under Art. 21. Overruled the ADM Jabalpur judgment. Foundation for India's data protection legislation." },
        { q: "Navtej Singh Johar (2018) — what was decriminalised?", a: "Decriminalised consensual same-sex relations between adults. Struck down Section 377 of IPC as unconstitutional to that extent." },
        { q: "Vishaka v. State of Rajasthan (1997) — what was laid down?", a: "SC laid down guidelines for prevention and redressal of sexual harassment at the workplace. These were binding until Parliament enacted the POSH Act (2013)." },
        { q: "S.R. Bommai v. Union of India (1994) — significance?", a: "SC can judicially review imposition of President's Rule (Art. 356). Floor test must be held before dismissing a state government. Strengthened federalism." },
        { q: "Indra Sawhney (1992) — what was decided about reservations?", a: "Upheld 27% OBC quota. Set a 50% ceiling on total reservations. Made 'creamy layer' exclusion mandatory. Reservations can't be made in promotions (later amended)." },
        { q: "Electoral Bond Case (2024) — why was it struck down?", a: "SC struck down Electoral Bond Scheme as unconstitutional. Violated voters' right to know political funding sources under Art. 19(1)(a) — freedom of information." },
        { q: "M.C. Mehta v. Union of India (1987) — what principle emerged?", a: "Established Absolute Liability — an enterprise engaged in inherently dangerous activity is absolutely liable for harm with NO exceptions. Arose from Oleum Gas Leak case." },
        { q: "Joseph Shine v. Union of India (2018) — what was struck down?", a: "Section 497 IPC (Adultery) declared unconstitutional. Treated women as husband's property. Violated Art. 21 (dignity) and Art. 14 (equality)." },
        { q: "ADM Jabalpur v. Shivkant Shukla (1976) — why infamous?", a: "The 'Habeas Corpus case.' During Emergency, SC held rights could be suspended — even Habeas Corpus. Called SC's darkest hour. Effectively overruled by Puttaswamy (2017)." },
        { q: "Shreya Singhal v. Union of India (2015) — what was struck down?", a: "Section 66A of IT Act — criminalising 'offensive' online content. Struck down as unconstitutionally vague and overbroad, violating Art. 19(1)(a) freedom of speech." },
        { q: "Olga Tellis v. Bombay Municipal Corporation (1985) — significance?", a: "Right to livelihood included within Art. 21 (right to life). Pavement dwellers cannot be evicted without due process — their livelihood depends on proximity to workplaces." },
        { q: "State of Madras v. Champakam Dorairajan (1951) — why significant?", a: "First major case on reservations. SC held state could not reserve seats based on religion, race, caste for admission to state educational institutions under Art. 29(2). Led to First Constitutional Amendment." },
        { q: "Subramanian Swamy v. Union of India (2016) — what was decided?", a: "Criminal defamation under Sections 499-500 IPC upheld as constitutional. Court rejected the argument that criminal liability for defamation violates freedom of speech under Art. 19(1)(a)." }
      ],
      articles: [
        { q: "What do Articles 12–35 cover?", a: "Part III — Fundamental Rights. These are enforceable in courts. Art. 13: Any law inconsistent with Fundamental Rights is void." },
        { q: "What does Article 14 guarantee?", a: "Right to Equality — equal before law + equal protection of laws. Allows reasonable classification but prohibits arbitrary discrimination." },
        { q: "What does Article 21 protect?", a: "Right to Life and Personal Liberty. Most expansively interpreted FR — includes privacy, livelihood, education, health, dignity, and environment." },
        { q: "Article 32 — why did Dr. Ambedkar call it the 'heart of the Constitution'?", a: "It gives the right to move the Supreme Court directly for enforcement of Fundamental Rights. Without Art. 32, FRs would be unenforceable. It is itself a Fundamental Right." },
        { q: "What are DPSPs (Articles 36–51)?", a: "Directive Principles of State Policy — guidelines to the state for governance. Non-justiciable (can't be enforced in courts) but fundamental to policymaking. Art. 44 = UCC; Art. 48A = environment." },
        { q: "What does Article 368 deal with?", a: "The procedure to amend the Constitution. Parliament can amend but cannot alter the Basic Structure. Some provisions require ratification by at least half the state legislatures." },
        { q: "What are Fundamental Duties (Article 51A)?", a: "11 duties added by 42nd Amendment (1976). Non-justiciable but used by courts to interpret laws. Examples: respect national symbols, protect environment, promote harmony." },
        { q: "What does Article 19 protect?", a: "Six freedoms: speech and expression, assembly without arms, association, movement throughout India, residence, and profession. All subject to reasonable restrictions." },
        { q: "What does Article 15 prohibit?", a: "Discrimination on grounds of religion, race, caste, sex, or place of birth. Allows state to make special provisions for women, children, SCs, STs, OBCs (Art. 15(3) and (4))." },
        { q: "What does Article 16 guarantee?", a: "Equality of opportunity in matters of public employment. Allows reservations for SCs, STs, OBCs (Art. 16(4)), and economically weaker sections (Art. 16(6) — 103rd Amendment)." },
        { q: "What does Article 20 protect?", a: "Protection against arbitrary conviction: (1) No ex-post-facto laws; (2) No double jeopardy; (3) No self-incrimination. These rights CANNOT be suspended even during Emergency." },
        { q: "Which Fundamental Rights cannot be suspended during a National Emergency?", a: "Articles 20 and 21 — protection against arbitrary conviction and right to life. All other FRs can be suspended under Art. 358/359 during Emergency." },
        { q: "What does Article 22 protect?", a: "Protection against arbitrary arrest and detention: right to be informed of grounds, right to consult a lawyer, must be produced before magistrate within 24 hours. Preventive detention has separate provisions." },
        { q: "What does Article 25 guarantee?", a: "Freedom of conscience and free profession, practice, and propagation of religion — subject to public order, morality, and health. State can regulate secular aspects of religion." },
        { q: "What does Article 300A protect?", a: "Right to property — NOT a Fundamental Right since 44th Amendment (1978). Now a Constitutional Right only — state can deprive property by authority of law, but must pay compensation." }
      ],
      fallacies: [
        { q: "What is an Ad Hominem fallacy?", a: "Attacking the person making an argument rather than the argument itself. 'You can't trust her opinion — she has a conflict of interest.'" },
        { q: "What is a Straw Man fallacy?", a: "Misrepresenting an opponent's argument in a weaker, easier-to-attack form. Arguing against a position the opponent didn't actually take." },
        { q: "What is a False Dichotomy?", a: "Presenting only two options as if no other possibilities exist. 'Either you support this bill or you don't care about justice.' (There could be middle grounds.)" },
        { q: "What is a Slippery Slope fallacy?", a: "Claiming one event will inevitably lead to extreme consequences without justifying the chain of causation. 'If we allow X, eventually Z will happen.'" },
        { q: "What is Hasty Generalisation?", a: "Drawing a broad conclusion from a small or unrepresentative sample. 'I met two dishonest lawyers — lawyers are all dishonest.'" },
        { q: "What is Circular Reasoning?", a: "Using the conclusion as a premise. 'This law is just because it is the law.' The argument assumes what it's trying to prove." },
        { q: "What does 'Correlation ≠ Causation' mean?", a: "Two things occurring together doesn't mean one causes the other. Both might be caused by a third factor (a confounding variable)." },
        { q: "What is the Negation Test used for?", a: "Testing whether something is an ASSUMPTION. Negate the option — if negating it destroys the argument's conclusion, it is the assumption the argument depends on." },
        { q: "What is an Appeal to Authority fallacy?", a: "Claiming something is true because an authority figure says so, without logical justification. 'This celebrity says the drug works, so it must.' Weak when the authority is outside their expertise." },
        { q: "What is a Red Herring?", a: "Introducing irrelevant information to distract from the real issue. Diverts attention rather than addressing the argument. Very common in CLAT logical reasoning passages." },
        { q: "What is an Appeal to Popularity (Ad Populum)?", a: "'Everyone believes X, therefore X is true.' Majority opinion doesn't determine truth or correctness. Historically, majorities have been wrong." },
        { q: "What is Begging the Question?", a: "A form of circular reasoning where the conclusion is embedded in the premise. 'Lying is wrong because all falsehoods are immoral.' Assumes what it needs to prove." },
        { q: "What is the Bandwagon Fallacy?", a: "Arguing something is correct or good because many people do it. 'Everyone is investing in crypto, so it must be a good idea.' Popularity ≠ correctness." },
        { q: "What is a Post Hoc fallacy?", a: "'Post hoc ergo propter hoc' — 'after this, therefore because of this.' Assuming X caused Y just because X came before Y. A rooster crowing before sunrise doesn't cause the sunrise." },
        { q: "What is an Appeal to Ignorance (Ad Ignorantiam)?", a: "Claiming something is true because it hasn't been proved false, or false because it hasn't been proved true. 'We've never proved ghosts don't exist, so they must.'" }
      ],
      english: [
        { q: "What is an Inference question in CLAT English?", a: "Asks what can be reasonably concluded from the passage. Key rule: CLAT wants CONSERVATIVE inferences — only what the passage logically requires. Don't go beyond the text." },
        { q: "How to identify the 'Main Idea' of a passage?", a: "Look for the sentence that the ENTIRE passage supports. Too narrow = one example. Too broad = general topic. The main idea covers the whole passage's argument." },
        { q: "What does 'Author's Tone' mean and common examples?", a: "The author's attitude toward the subject. Common CLAT tones: critical, appreciative, neutral/objective, ironic, sarcastic, cautious, optimistic, ambivalent. Look for tone words (adjectives, verbs)." },
        { q: "What is the 'True but Not From Passage' trap?", a: "An answer option that is factually correct in the real world but NOT supported by the specific passage. In CLAT English, only what the passage says matters — outside knowledge is irrelevant." },
        { q: "How to approach 'Meaning in Context' questions?", a: "Substitute each option into the sentence and pick the one that preserves the meaning in that specific context. Don't rely on dictionary definitions — context determines meaning in CLAT." },
        { q: "What is a 'Strengthen/Weaken' question?", a: "To STRENGTHEN: find an option supporting the argument's key assumption or adding new evidence. To WEAKEN: find an option undermining the assumption or providing counter-evidence. Very common in CLAT." },
        { q: "What words signal an opinion vs a fact?", a: "Opinions: 'should,' 'must,' 'believe,' 'argue,' 'ought to,' 'claim.' Facts: stated objectively, verifiable. CLAT tests whether you can distinguish what the author claims vs. what is established." },
        { q: "What is 'Extreme Language' trap in options?", a: "Options with 'always,' 'never,' 'only,' 'completely,' 'entirely,' 'must' are almost always wrong in CLAT. Real-world arguments are rarely absolute. Choose nuanced, qualified answers." },
        { q: "What is an Analogy question?", a: "Asks you to identify a parallel relationship. 'A is to B as C is to ___.' Understand the RELATIONSHIP between A and B, then apply the same relationship to find the answer." },
        { q: "5-Step Passage Attack Strategy?", a: "(1) Skim questions first (60s). (2) Active reading — note main claim, transitions, conclusion (3 min). (3) Answer fact-retrieval Qs first. (4) Eliminate wrong options. (5) 6-7 minutes per passage." },
        { q: "What is a 'Paraphrased Distractor' trap?", a: "The wrong option rephrases something from the passage but subtly changes the meaning. A small word like 'not' or 'only' can flip the meaning entirely. Read very carefully." },
        { q: "What does 'Assumption' mean in logical/English questions?", a: "A hidden premise that the argument DEPENDS on but does not state. Use the Negation Test: negate the option — if it destroys the argument, it IS the assumption." }
      ],
      gk: [
        { q: "What is the Basic Structure of the Indian Constitution?", a: "Features that Parliament cannot amend even by constitutional amendment: supremacy of Constitution, republican and democratic form, secular character, separation of powers, federal character, fundamental rights, judicial review." },
        { q: "Name the 5 Permanent Members of the UN Security Council.", a: "USA, UK, France, Russia, China. Each holds veto power. India has sought permanent membership but is not currently a P5 member." },
        { q: "What is the Preamble's significance?", a: "Declares India to be Sovereign, Socialist, Secular, Democratic, Republic. Secures Justice, Liberty, Equality, Fraternity. 'Socialist' and 'Secular' added by 42nd Amendment (1976). Not enforceable but aids interpretation." },
        { q: "What is BRICS? Current members?", a: "Brazil, Russia, India, China, South Africa. Expanded in 2024 to include Egypt, Ethiopia, Iran, UAE, and Saudi Arabia (though Saudi Arabia's full membership is pending). HQ: New Business Development Bank in Shanghai." },
        { q: "What is the G20? India's role?", a: "Group of 20 major economies. India held G20 Presidency in 2023 (New Delhi Summit). Permanent members include USA, UK, EU, Japan, India, China, etc. Covers ~85% of world GDP." },
        { q: "What is the Right to Information Act?", a: "RTI Act 2005 — gives citizens the right to request information from public authorities. Creates Central and State Information Commissions. Officers must respond within 30 days (48 hours for life/liberty matters)." },
        { q: "What is Operation Sindoor (2025)?", a: "India's military strikes against terrorist infrastructure in Pakistan and Pakistan-Occupied Kashmir, launched in May 2025 following the Pahalgam terror attack. Marked a significant escalation in India's counter-terrorism posture." },
        { q: "What is the Chandrayaan-3 achievement?", a: "India's lunar mission that soft-landed near the Moon's south pole on Aug 23, 2023. India became the 4th country to achieve a soft lunar landing and the FIRST to land at the lunar south pole." },
        { q: "What is the DPDP Act 2023?", a: "Digital Personal Data Protection Act — India's comprehensive data protection law. Establishes Data Fiduciaries, Data Principals (individuals), consent requirements, and a Data Protection Board for adjudication." },
        { q: "What is the WTO Dispute Settlement?", a: "WTO's mechanism to resolve trade disputes between member countries. Has a two-tier process: Panels (first instance) and Appellate Body (appeal). Currently the Appellate Body is non-functional due to USA blocking appointments." },
        { q: "Who won Nobel Peace Prize 2024?", a: "Nihon Hidankyo — a Japanese organisation of atomic bomb survivors (Hibakusha) from Hiroshima and Nagasaki. Awarded for efforts toward a world free of nuclear weapons." },
        { q: "What is the Uniform Civil Code (UCC)?", a: "Art. 44 DPSP — directs the state to secure a UCC for all citizens. Governs personal matters (marriage, divorce, inheritance) under a single law regardless of religion. Uttarakhand was the first state to implement it (2024)." },
        { q: "What is India's rank in the UN Human Development Index (HDI)?", a: "India ranked 134th out of 193 countries in the HDI 2023/24 report. HDI measures life expectancy, education, and per capita income. India is classified as a 'medium human development' country." },
        { q: "What is the Waqf Amendment Bill 2024?", a: "Amended the Waqf Act 1995. Key changes: government can audit Waqf properties, non-Muslims can be on Waqf boards, 'user waqf' doctrine reformed. Controversial — challenged by Muslim groups and opposition as unconstitutional." },
        { q: "What is the International Criminal Court (ICC)?", a: "An intergovernmental organization and court that sits in The Hague. Prosecutes individuals for war crimes, crimes against humanity, genocide, and aggression. NOT part of the UN system. India is NOT a member (has not ratified the Rome Statute)." }
      ],
      quant: [
        { q: "What is Simple Interest formula?", a: "SI = (P × R × T) / 100. Where P = Principal, R = Rate % per annum, T = Time in years. Amount = P + SI." },
        { q: "What is Compound Interest formula?", a: "A = P(1 + R/100)^T. CI = A - P. When compounded half-yearly: A = P(1 + R/200)^2T. CLAT usually tests DI-based CI, not formula calculations." },
        { q: "Profit and Loss key formulas?", a: "Profit% = (Profit/CP) × 100. SP = CP × (100+P%)/100. CP = SP × 100/(100+P%). Marked Price, Discount: SP = MP × (100-D%)/100." },
        { q: "What is Ratio and Proportion — key trick?", a: "If A:B = 2:3 and B:C = 4:5, find A:B:C → make B common: A:B:C = 8:12:15. Always make the common element equal before combining ratios." },
        { q: "Percentage change formula?", a: "% Change = (New - Old)/Old × 100. If value increases by x% then decreases by x%, the net change is LOSS of x²/100 %. (Not zero!)" },
        { q: "How to read a Data Interpretation table?", a: "(1) Read all labels and units first. (2) Note the base year or reference point. (3) Only calculate what the question asks. (4) Use approximation — CLAT doesn't need exact answers." },
        { q: "Average formula and weighted average?", a: "Average = Sum of values / Number of values. Weighted Average = (w₁x₁ + w₂x₂ + ...) / (w₁ + w₂ + ...). Used when groups have different sizes." },
        { q: "What is a Pie Chart DI question approach?", a: "(1) Note total value the pie represents. (2) Degrees/percentage for each sector. (3) Value of sector = (% / 100) × Total. Never assume — always use given data." },
        { q: "Time and Work: key concept?", a: "If A finishes work in x days, A's one-day work = 1/x. If A and B work together: combined one-day work = 1/x + 1/y. Days together = xy/(x+y)." },
        { q: "CLAT Quant section strategy?", a: "(1) 10-14 questions, only 2 hours total — spend ~8-10 minutes max on this section. (2) Always approximate — exact calculation wastes time. (3) Work backwards from options when stuck. (4) Skip if passage is too complex." }
      ]
    };
    let currentDeck = [];
    let currentCardIndex = 0;

    function loadDeck(name) {
      document.querySelectorAll('#flashcards .notes-tab').forEach(t => t.classList.remove('active'));
      event.target.classList.add('active');
      currentDeck = DECKS[name];
      currentCardIndex = 0;
      renderCard();
    }

    function renderCard() {
      const fc = document.getElementById('fc');
      const card = currentDeck[currentCardIndex];
      fc.classList.remove('flipped');
      setTimeout(() => {
        document.getElementById('fc-q').textContent = card.q;
        document.getElementById('fc-a').textContent = card.a;
        document.getElementById('fc-progress').textContent = `Card ${currentCardIndex + 1} of ${currentDeck.length}`;
        document.getElementById('fcWrap').style.minHeight = '120px';
      }, 50);
    }

    function flipCard() {
      document.getElementById('fc').classList.toggle('flipped');
    }

    function nextCard() {
      if (currentCardIndex < currentDeck.length - 1) {
        currentCardIndex++;
        renderCard();
      }
    }

    function prevCard() {
      if (currentCardIndex > 0) {
        currentCardIndex--;
        renderCard();
      }
    }

    // ASSESSMENT / QUIZ SYSTEM
    const QUIZ_DATA = {
      english: {
        title: "English Language Assessment",
        color: "#e94560",
        questions: [
          {
            passage: "The idea that technology is 'neutral' — a mere tool — has long been popular among tech enthusiasts. According to this view, the hammer is neither good nor bad; it is the person wielding it who determines the moral character of the act. But this analogy fails to capture something essential about complex socio-technical systems. A hammer does not shape the hand that holds it, nor does it change the community around the carpenter. Digital platforms, by contrast, actively mould the behaviour of their users through algorithmic incentives. The very architecture of these systems — designed to maximise engagement — transforms how people seek information, form relationships, and construct identity. The hammer metaphor, then, is not merely simplistic; it is actively misleading.",
            question: "The author's primary purpose in this passage is to:",
            options: ["Explain why technology companies use engagement-maximising algorithms.", "Argue against the view that technology is a neutral tool without moral implications.", "Demonstrate that digital platforms are more harmful than physical tools.", "Advocate for stricter regulation of digital technology companies."],
            correct: 1,
            explanation: "The author's central argument is against the 'neutral tool' view of technology. The passage doesn't advocate regulation (D) nor simply explain how algorithms work (A). Option C is too extreme — the author doesn't compare harm levels, but argues that digital platforms 'actively mould behaviour' unlike simple tools."
          },
          {
            passage: "Historically, pandemics have been among the most powerful catalysts of social transformation. The Black Death reshaped medieval European society by decimating the labour force, inadvertently empowering the surviving peasants who could now command higher wages. The 1918 influenza pandemic, which killed more people than the First World War, accelerated the adoption of public health institutions that persist to this day. In each case, the disruption was not merely biological but profoundly social — exposing existing inequalities, dissolving entrenched hierarchies, and generating new political demands. Whether the COVID-19 pandemic produces similar lasting transformations remains, as of writing, an open question.",
            question: "Which of the following can most reasonably be inferred from the passage?",
            options: ["Pandemics are more socially transformative than wars.", "The COVID-19 pandemic will not produce lasting social transformations.", "Social inequality is a prerequisite for a pandemic to have lasting social effects.", "Historical pandemics have had consequences that extended beyond their immediate health impacts."],
            correct: 3,
            explanation: "Option D is directly supported — the author notes pandemics reshape social structures, empower groups, and generate political demands. Option A is not supported — the passage doesn't compare pandemics to wars in terms of transformation. Option B contradicts the passage's open stance. Option C is not stated anywhere."
          },
          {
            passage: "There is something paradoxical about the discourse of 'authentic' travel. Travellers who seek destinations 'off the beaten path' to escape mass tourism inadvertently create the very phenomenon they wish to avoid. Once a location is identified as 'undiscovered,' it is swiftly crowded by like-minded adventurers, each seeking the same authentic experience, each disappointed to find others already there. The guidebook that promises to reveal secret places guarantees, by its very circulation, that those places will soon cease to be secret. Authenticity, in this context, is a commodity that destroys itself in the moment of its consumption.",
            question: "The phrase 'a commodity that destroys itself in the moment of its consumption' most nearly means that:",
            options: ["Authentic experiences are too fragile to be enjoyed by more than a few people.", "The very act of seeking and consuming authenticity eliminates it.", "Guidebooks are counterproductive because they spread information too widely.", "Travellers are hypocritical in claiming to seek authentic experiences."],
            correct: 1,
            explanation: "The author's point is that seeking authenticity is self-defeating — the moment you find and share an 'authentic' place, it ceases to be authentic. Option B precisely captures this. Option A is about fragility (not stated). Option C is a detail, not the full meaning. Option D introduces 'hypocrisy' which is not the author's claim."
          },
          {
            passage: "The concept of 'food miles' — the distance food travels from farm to consumer — gained significant traction in the early 2000s as a metric for assessing the environmental impact of food choices. Proponents argued that buying local food reduces carbon emissions from transportation and supports local economies. However, critics have pointed out that food miles can be deeply misleading. Transportation, it turns out, accounts for only around 10% of a food product's total carbon footprint. The remaining 90% is determined largely by the method of production. A tomato grown in a heated greenhouse in Britain and sold locally may have a far larger carbon footprint than one grown outdoors in Spain and transported by truck to a British supermarket.",
            question: "The author uses the example of the tomato to:",
            options: ["Prove that locally grown food is always worse for the environment than imported food.", "Illustrate that the carbon footprint of food is determined primarily by transportation distance.", "Show that food miles can be a misleading measure of environmental impact.", "Argue that Britain should import more food from Spain."],
            correct: 2,
            explanation: "The tomato example illustrates the central claim: food miles are misleading because they focus on transportation (only 10% of footprint) while ignoring production methods (90%). Option A is too absolute ('always'). Option B contradicts the passage — transportation accounts for only 10%. Option D is never suggested."
          },
          {
            passage: "The term 'cancel culture' is frequently used — often as a pejorative — to describe the phenomenon of withdrawing public support from individuals who have expressed views deemed offensive or harmful. Critics of cancel culture argue that it constitutes an unprecedented threat to free speech and open debate. But this framing is, at best, incomplete. What is called 'cancel culture' is, in many cases, simply the aggregation of individual consumer and audience choices. A boycott coordinated by private citizens is not censorship; censorship involves the state's suppression of expression. Conflating the two fundamentally misrepresents both concepts.",
            question: "Which of the following best describes the author's argument?",
            options: ["Cancel culture is a legitimate form of free speech and should be encouraged.", "The term 'cancel culture' is entirely inaccurate and should not be used.", "Critics who conflate private boycotts with censorship are making a conceptual error.", "Freedom of speech protects individuals from consequences of their public statements."],
            correct: 2,
            explanation: "The author's argument is specific: conflating private boycotts with state censorship is a conceptual error — they are different things. Option A goes beyond what the author claims (the author doesn't say it 'should be encouraged'). Option B is too extreme — the author doesn't say the term is 'entirely inaccurate.' Option D contradicts the passage's implication."
          },
          {
            passage: "Memory, neuroscientists tell us, is not a static record of the past but a dynamic reconstruction. Each time we recall an event, we do not simply retrieve a stored file; instead, we rebuild the memory from fragmentary traces, coloured by our current emotional state, expectations, and beliefs. This means that memory is inherently malleable — susceptible to subtle distortions each time it is accessed. The legal system's reliance on eyewitness testimony becomes, in this light, deeply problematic. Studies have consistently shown that eyewitness accounts — even from confident, sincere witnesses — are among the least reliable forms of evidence.",
            question: "The author would most likely agree with which of the following?",
            options: ["Eyewitness testimony should be entirely banned from legal proceedings.", "Courts should treat confident eyewitnesses as more reliable than uncertain ones.", "The reliability of a memory does not necessarily increase with the witness's confidence.", "Neuroscience has conclusively solved the problem of false memory."],
            correct: 2,
            explanation: "The passage says 'even confident, sincere witnesses' produce unreliable accounts — so confidence does NOT equal reliability. Option C directly follows from this. Option A is too extreme — the author says the reliance is 'problematic,' not that it should be banned. Option B contradicts the passage. Option D is not stated."
          }
        ]
      },
      legal: {
        title: "Legal Reasoning Assessment",
        color: "#0f9b8e",
        questions: [
          {
            passage: "PRINCIPLE: A person is liable for negligence if (i) they owe a duty of care to the claimant, (ii) they breach that duty by failing to act as a reasonable person would, and (iii) that breach directly causes the claimant to suffer damage. All three elements must be established. If any one element is absent, there is no liability in negligence.",
            question: "FACTS: Priya is a surgeon who performs a routine appendix removal on Rajesh. During the operation, an unforeseen complication arises that could not have been anticipated even by the most skilled surgeon. Priya acts in the only way a reasonable surgeon could in the circumstances. Rajesh nonetheless suffers permanent injury due to the complication. Rajesh sues Priya for negligence. Is Priya liable?",
            options: ["Yes, because Priya owed Rajesh a duty of care as his surgeon.", "Yes, because Priya caused Rajesh's injury, which is the key element of negligence.", "No, because Priya did not breach her duty — she acted as a reasonable surgeon would.", "No, because complications during surgery cannot give rise to negligence claims."],
            correct: 2,
            explanation: "Applying IRAC: (I) Was there negligence? (R) Negligence requires all three elements — duty, breach, and damage. (A) Priya owed Rajesh a duty of care ✓. But she did NOT breach it — she acted exactly as a reasonable surgeon would ✗. Since breach is absent, the chain breaks. (C) No liability. Note: Option D is wrong — complications CAN give rise to negligence claims if there's a breach."
          },
          {
            passage: "PRINCIPLE: An agreement is void if it is made by a minor (a person under 18 years of age). A minor cannot be held to any contract, and any agreement purportedly made with a minor has no legal effect. However, if a minor has received a benefit under the contract (such as goods), they may not retain those goods without paying for them.",
            question: "FACTS: Arjun, aged 17, purchases a high-end laptop from TechMart on credit, agreeing to pay in 12 monthly instalments. He uses the laptop for three months, then refuses to pay the remaining instalments. TechMart sues for recovery of the remaining amount. Decide:",
            options: ["Arjun must pay the remaining instalments because he freely entered into the agreement.", "The entire agreement is void; Arjun need not pay anything.", "The agreement is void, but Arjun must return the laptop or pay its value since he received a benefit.", "TechMart cannot sue a minor under any circumstances."],
            correct: 2,
            explanation: "Applying IRAC: (R) Agreements with minors are void — no legal effect. However, minors cannot retain benefits without paying. (A) The contract is void, so Arjun is not bound by the instalments. But he received the laptop (a benefit) and used it for 3 months. He cannot retain it without paying for it. (C) He must return the laptop or compensate for its value. Option B is wrong because it ignores the benefit-retention clause."
          },
          {
            passage: "PRINCIPLE: Under the rule of strict liability, a person who keeps a dangerous thing on their land is liable for any damage caused if that thing escapes, regardless of whether they were at fault or negligent. The escape must be from the land of the person who keeps the dangerous thing. This rule applies to non-natural uses of land — keeping tigers, storing toxic chemicals, or constructing water reservoirs would qualify; keeping a domestic dog would generally not.",
            question: "FACTS: Vijay owns a chemical factory located near a residential area. He stores large quantities of industrial acid in sealed containers on his premises. One night, during a freak storm, floodwaters breach his compound and carry the acid containers into neighbouring homes, causing severe damage. Vijay argues he could not have foreseen or prevented the storm. Are the affected residents entitled to compensation?",
            options: ["No, because Vijay took reasonable precautions and could not have prevented the storm.", "No, because the damage was caused by natural forces, not by Vijay's act.", "Yes, because Vijay is strictly liable — he kept a dangerous thing and it escaped, causing damage.", "Yes, but only if the residents can prove Vijay was negligent in storing the acid."],
            correct: 2,
            explanation: "Strict liability does not require fault — that's its defining feature. (R) Person who keeps a dangerous thing is liable for escape and damage, regardless of fault. (A) Industrial acid = dangerous thing ✓. It escaped from Vijay's land ✓. Damage caused ✓. Whether Vijay was negligent or could have prevented it is IRRELEVANT under strict liability. (C) Residents are entitled to compensation. Option D incorrectly imports a negligence requirement into strict liability."
          },
          {
            passage: "PRINCIPLE: A public official shall be disqualified from participating in any decision in which they have a personal financial interest. 'Personal financial interest' means any situation where the official or a direct family member stands to gain or lose financially from the outcome of the decision. Disclosure of the interest alone does not cure the disqualification.",
            question: "FACTS: Minister Rao is on a committee that decides which company will receive a lucrative infrastructure contract. Minister Rao's daughter holds a 5% shareholding in one of the bidding companies. Minister Rao discloses this fact to the committee and then recuses herself from the final vote, but she participates in all preliminary discussions that narrow down the field from 10 to 2 companies. Was Minister Rao's participation in the preliminary discussions lawful?",
            options: ["Yes, because she disclosed her interest and recused herself from the final vote.", "Yes, because preliminary discussions are not 'decisions' and the principle doesn't apply to them.", "No, because she had a personal financial interest and participated in proceedings that affected the outcome, regardless of the final vote.", "No, because disclosure alone does not cure disqualification, and she should have withdrawn entirely."],
            correct: 3,
            explanation: "The principle says disclosure alone does not cure disqualification. Minister Rao has a personal financial interest (daughter's shareholding). She participated in preliminary discussions that narrowed the field — this directly influenced the outcome. Both C and D are close, but D is more precise: it captures both the disclosure-inadequacy rule AND the need for full withdrawal. The preliminary discussions are part of the 'decision' process."
          },
          {
            passage: "PRINCIPLE: Defamation is the publication of a false statement of fact that causes harm to a person's reputation. Truth is an absolute defence to defamation. Fair comment — expressing an honest opinion on a matter of public interest based on true facts — is also a complete defence. A statement must be 'published' (communicated to at least one person other than the subject) to constitute defamation.",
            question: "FACTS: Kavya, a journalist, writes an article claiming that Ramesh, a local politician, 'misappropriated public funds.' This claim is entirely false. However, Kavya only sends the draft of the article by email to Ramesh personally, to give him an opportunity to respond before publication. She never publishes it. Ramesh sues Kavya for defamation. Will he succeed?",
            options: ["Yes, because the statement was false and damaging to Ramesh's reputation.", "Yes, because Kavya knew the statement was false when she wrote it.", "No, because the statement was never published to a third party — only sent to Ramesh himself.", "No, because journalists have special immunity when fact-checking with subjects."],
            correct: 2,
            explanation: "Key rule: defamation requires 'publication' to at least one person OTHER THAN the subject. Kavya only sent the draft to Ramesh — the subject himself. There was no third-party publication. Without publication, there is no defamation regardless of the statement's falsity or Kavya's intent. Option D (journalist immunity) is not stated in the principle. Ramesh's suit will fail."
          },
          {
            passage: "PRINCIPLE: The doctrine of res judicata (the matter has been decided) prevents a party from re-litigating an issue that has already been finally decided by a competent court between the same parties. For res judicata to apply: (1) the earlier case must have been decided on merits; (2) the parties must be the same; (3) the cause of action must be the same.",
            question: "FACTS: In 2022, Sunita filed a suit against her neighbour Ajay claiming he encroached on her land. The court dismissed the case because Sunita failed to appear on the hearing date — the dismissal was for want of prosecution, not on merits. In 2024, Sunita again files a case against Ajay on the same encroachment claim. Ajay's lawyer argues that res judicata applies. Is the lawyer correct?",
            options: ["Yes, because the parties and cause of action are the same as the earlier case.", "Yes, because Sunita had her opportunity and chose not to appear.", "No, because the earlier dismissal was not on merits — a key condition for res judicata is unmet.", "No, because two years have elapsed and the limitation period prevents Ajay from relying on res judicata."],
            correct: 2,
            explanation: "Res judicata requires all 3 conditions: same parties ✓, same cause of action ✓, earlier case decided ON MERITS ✗. Dismissal for want of prosecution (non-appearance) is NOT a decision on merits. The condition is unmet. Res judicata does NOT apply. Sunita can re-file. Option A ignores the merits requirement. Option D introduces limitation — unrelated to res judicata's applicability."
          }
        ]
      },
      gk: {
        title: "GK & Current Affairs Assessment",
        color: "#3a5bbf",
        questions: [
          {
            passage: "In a landmark 9-0 ruling, the Supreme Court of India in 2024 struck down the Electoral Bonds Scheme introduced by the government in 2018, declaring it unconstitutional. The Court held that the scheme, which allowed anonymous corporate donations to political parties, violated the constitutional right of citizens to access information about political funding. The ruling invoked Article 19(1)(a) — the right to freedom of speech and expression, which includes the right to know. The Court directed the State Bank of India to stop issuing bonds and to submit details of all transactions to the Election Commission of India, which would then make the data public.",
            question: "Based on the passage, what was the primary constitutional basis on which the Electoral Bonds Scheme was struck down?",
            options: ["Violation of the right to equality under Article 14.", "Violation of the right to information as a dimension of Article 19(1)(a).", "Violation of the fundamental right to conduct trade under Article 19(1)(g).", "Violation of the right against arbitrary state action under Article 21."],
            correct: 1,
            explanation: "The passage explicitly states the Court invoked Article 19(1)(a) — freedom of speech and expression, which includes the right to know. The anonymity of donations violated citizens' right to know who funds political parties. Option A (Art. 14) is not mentioned. Option C (Art. 19(1)(g)) concerns trade, which is unrelated. Option D (Art. 21) is not cited."
          },
          {
            passage: "India's Chandrayaan-3 mission achieved a historic soft landing near the lunar south pole on August 23, 2023, making India the fourth country in the world to achieve a soft lunar landing, and the first to land near the Moon's south pole. The Pragyan rover, deployed from the Vikram lander, conducted several experiments over approximately two weeks before it entered a planned hibernation mode as the lunar night approached. The mission's primary scientific objective was to study the composition of the lunar surface, particularly looking for evidence of water ice, which is believed to exist in permanently shadowed craters near the poles.",
            question: "Which of the following is NOT supported by the passage?",
            options: ["India was the fourth country to successfully soft-land on the Moon.", "The Pragyan rover was part of the Chandrayaan-3 mission.", "Water ice was conclusively discovered at the lunar south pole by Chandrayaan-3.", "The Vikram lander deployed the Pragyan rover after landing."],
            correct: 2,
            explanation: "Option C is NOT supported — the passage says water ice is 'believed to exist' and was being looked for; it does not say it was 'conclusively discovered.' This is a classic CLAT trap: the passage mentions the search for water ice, not its discovery. Options A, B, and D are all directly supported by the passage."
          },
          {
            passage: "The Paris Agreement, adopted in 2015 under the United Nations Framework Convention on Climate Change (UNFCCC), established the goal of limiting global average temperature rise to 'well below 2°C above pre-industrial levels' and pursuing efforts to limit the increase to 1.5°C. Each signatory nation submits Nationally Determined Contributions (NDCs) — voluntary pledges to reduce emissions. Unlike its predecessor the Kyoto Protocol, the Paris Agreement applies to both developed and developing nations. However, critics argue its voluntary nature and lack of enforcement mechanisms make it insufficient to meet the stated temperature goals.",
            question: "Which of the following statements about the Paris Agreement can be inferred from the passage?",
            options: ["The Paris Agreement replaced the UNFCCC entirely.", "The Kyoto Protocol applied to both developed and developing nations, unlike the Paris Agreement.", "Countries can submit NDCs but face no binding legal penalty if they fail to meet their pledges.", "The Paris Agreement guarantees that global temperature rise will be limited to 1.5°C."],
            correct: 2,
            explanation: "The passage states NDCs are 'voluntary pledges' with 'lack of enforcement mechanisms' — this means countries face no binding legal penalty for non-compliance. Option C correctly infers this. Option A is false — Paris Agreement is under UNFCCC, not a replacement. Option B reverses the comparison (Kyoto applied to developed nations only, not developing). Option D contradicts the passage ('critics argue it is insufficient')."
          },
          {
            passage: "Operation Sindoor was a military operation launched by India in May 2025 in response to the Pahalgam terror attack in Kashmir. The Indian Armed Forces conducted precision strikes on terrorist infrastructure in Pakistan and Pakistan-Occupied Kashmir, targeting multiple sites. The operation marked one of the most significant military actions by India across the Line of Control in decades. International reactions were divided, with some countries calling for de-escalation while others expressed understanding of India's right to self-defence.",
            question: "Based on the passage, which of the following can be concluded about Operation Sindoor?",
            options: ["It was a response to a terror attack and involved strikes on multiple sites across the LoC.", "The international community unanimously condemned Operation Sindoor.", "Operation Sindoor was the first military action India ever took across the Line of Control.", "The operation was launched to defend Indian territory from a Pakistani military invasion."],
            correct: 0,
            explanation: "Option A is directly supported: the operation was a 'response to the Pahalgam terror attack' and 'targeted multiple sites' across/beyond the LoC. Option B is wrong — 'international reactions were divided,' not unanimous condemnation. Option C is wrong — the passage says it was 'one of the most significant' not 'the first.' Option D is wrong — it targeted terrorist infrastructure, not a response to a military invasion."
          },
          {
            passage: "The Indian Constitution's Eighth Schedule lists the officially recognised languages of India. When the Constitution was adopted in 1950, the Schedule listed 14 languages. Through subsequent amendments, this list has grown. The 21st Amendment (1967) added Sindhi; the 71st Amendment (1992) added Konkani, Manipuri, and Nepali; and the 92nd Amendment (2004) added Bodo, Dogri, Maithili, and Santhali. The total currently stands at 22 scheduled languages.",
            question: "According to the passage, how many languages were added to the Eighth Schedule between 1967 and 2004?",
            options: ["4 languages", "7 languages", "8 languages", "6 languages"],
            correct: 2,
            explanation: "Counting from the passage: 21st Amendment (1967): Sindhi = 1 language. 71st Amendment (1992): Konkani, Manipuri, Nepali = 3 languages. 92nd Amendment (2004): Bodo, Dogri, Maithili, Santhali = 4 languages. Total added 1967–2004 = 1 + 3 + 4 = 8 languages. Answer: C."
          }
        ]
      },
      logical: {
        title: "Logical Reasoning Assessment",
        color: "#7c3aed",
        questions: [
          {
            passage: "All doctors are intelligent. Some intelligent people are musicians. No musician is an athlete.",
            question: "Which of the following conclusions DEFINITELY follows?",
            options: ["All doctors are musicians.", "Some doctors are athletes.", "No athlete is a doctor.", "No athlete is a musician."],
            correct: 3,
            explanation: "From 'No musician is an athlete' → No athlete is a musician (D) definitely follows — it's a valid conversion. Option A is wrong (we can't say all intelligent people are musicians). Option B is wrong (no connection established between doctors and athletes). Option C is wrong — we know no musician is an athlete, but we can't say doctors and athletes have no overlap (doctors aren't necessarily musicians)."
          },
          {
            passage: "ARGUMENT: The government should ban the sale of all junk food in school canteens. Studies show that children who consume junk food regularly have lower academic performance. Since schools exist to promote academic success, they should eliminate anything that hinders it.",
            question: "Which of the following, if true, would most WEAKEN the argument?",
            options: ["Some children perform well academically despite consuming junk food regularly.", "Junk food is significantly cheaper than healthy food options.", "The correlation between junk food consumption and poor academic performance is caused by socioeconomic factors, not the food itself.", "Many children prefer junk food to healthy alternatives."],
            correct: 2,
            explanation: "The argument assumes junk food CAUSES poor academic performance. Option C directly attacks this assumption — if the real cause is socioeconomic factors, removing junk food won't improve academic performance. This is the classic 'correlation ≠ causation' attack on causal arguments. Option A shows exceptions but doesn't break the general pattern. Options B and D are irrelevant to the causal claim."
          },
          {
            passage: "In a school, five students — Amara, Ben, Chirag, Divya, and Eshan — are ranked 1 to 5 (1st is best). Amara is not 1st. Ben is ranked higher than Chirag. Divya is ranked 3rd. Eshan is ranked better than Amara but worse than Ben.",
            question: "Who is ranked 1st?",
            options: ["Amara", "Ben", "Chirag", "Eshan"],
            correct: 1,
            explanation: "Divya = 3rd (given). Ben > Chirag (given). Eshan > Amara but Eshan < Ben. Since Amara is not 1st, let's place: Ben must be 1st or 2nd. Eshan is between Ben and Amara. If Ben = 2nd, Eshan = 3rd or 4th, but Divya is 3rd. So Eshan = 4th, Amara = 5th, Chirag must be between 1st and Ben — making Chirag 1st. But Ben > Chirag means Chirag can't be 1st if Ben is 2nd (2nd is not > 1st... wait, higher rank = lower number). Ben (2nd) is higher than Chirag (1st) would mean Chirag ranks worse. So if Chirag = 1st, Ben can't be higher. Correct placement: Ben = 1st, Chirag = 2nd, Divya = 3rd, Eshan = 4th, Amara = 5th. Verification: Ben(1) > Chirag(2) ✓, Eshan(4) > Amara(5) ✓, Eshan(4) < Ben(1) ✓. Answer: Ben."
          },
          {
            passage: "STATEMENT: 'We should legalise assisted dying for terminally ill patients who are suffering intolerably and have made a clear, voluntary, and informed request.' ASSUMPTION being tested: Is this an underlying assumption of the argument?",
            question: "Which of the following is an ASSUMPTION on which the above statement depends?",
            options: ["All terminally ill patients wish to end their lives.", "A person can make a voluntary and informed decision even while severely ill.", "Assisted dying is currently illegal in most countries.", "The suffering of terminally ill patients cannot be adequately managed by palliative care."],
            correct: 1,
            explanation: "Apply the Negation Test: If we negate Option B — 'A person CANNOT make a voluntary and informed decision while severely ill' — the entire argument collapses. The statement specifically says 'clear, voluntary, informed request' — if this is impossible, there's no basis for the policy. This is the key hidden assumption. Option A is too extreme (not all patients need to wish it). Option C is a fact, not an assumption the argument depends on. Option D may strengthen but isn't a core assumption."
          },
          {
            passage: "Every time Meera eats strawberries, she gets hives. Yesterday, Meera got hives.",
            question: "Which conclusion is VALID based only on the above statements?",
            options: ["Meera ate strawberries yesterday.", "Meera is allergic to strawberries.", "Meera may or may not have eaten strawberries yesterday.", "Strawberries always cause hives."],
            correct: 2,
            explanation: "Critical logic point: 'Every time A happens, B happens' does NOT mean 'Every time B happens, A happened.' The given statements tell us strawberries → hives. But hives can be caused by other things too. So from 'Meera got hives,' we CANNOT conclude she ate strawberries. Option C is the only logically valid conclusion. Option A commits the fallacy of affirming the consequent. Option B is an inference not supported by the text. Option D is too broad."
          },
          {
            passage: "A company gives bonuses only to employees who completed at least 3 projects in the year AND received a performance rating of 'Excellent.' Ritu completed 4 projects and received a 'Good' rating. Suresh completed 2 projects and received 'Excellent.' Pavan completed 3 projects and received 'Excellent.'",
            question: "Who among the following receives a bonus?",
            options: ["Ritu only", "Suresh only", "Pavan only", "Both Ritu and Pavan"],
            correct: 2,
            explanation: "Both conditions must be met: (1) ≥3 projects AND (2) 'Excellent' rating. Ritu: 4 projects ✓ but 'Good' rating ✗ → No bonus. Suresh: 2 projects ✗ (needs ≥3) → No bonus. Pavan: 3 projects ✓ and 'Excellent' ✓ → BONUS. Only Pavan qualifies. Answer: C."
          }
        ]
      },
      quant: {
        title: "Quantitative Techniques Assessment",
        color: "#f5a623",
        questions: [
          {
            passage: "A town had a population of 50,000 in 2020. The population grew at a constant rate of 4% per year. The town has a health clinic that serves one doctor for every 2,500 residents. The town council has not added any new doctors since 2020.",
            question: "By approximately how much will the number of residents per doctor increase between 2020 and 2022?",
            options: ["About 204 more residents per doctor", "About 104 more residents per doctor", "About 308 more residents per doctor", "About 150 more residents per doctor"],
            correct: 0,
            explanation: "Population in 2022 = 50,000 × (1.04)² = 50,000 × 1.0816 = 54,080 (approx). Doctors in 2020 = 50,000 / 2,500 = 20. (No new doctors added.) Residents per doctor in 2022 = 54,080 / 20 = 2,704. Increase = 2,704 − 2,500 = 204. Answer: About 204 (Option A)."
          },
          {
            passage: "A school has three sections — A, B, and C — with 30, 40, and 50 students respectively. In an examination, the average score of Section A was 72, Section B was 68, and Section C was 74.",
            question: "What is the overall average score of all students across the three sections?",
            options: ["71.33", "71.0", "71.5", "70.83"],
            correct: 2,
            explanation: "Weighted average = (30×72 + 40×68 + 50×74) / (30+40+50). Calculate: 30×72=2160, 40×68=2720, 50×74=3700. Sum=8580. Total students=120. 8580÷120 = 71.5. Answer: C (71.5). Many students take a simple average of 72, 68, 74 = 71.33 — but this ignores the different class sizes!"
          },
          {
            passage: "A shopkeeper marks up goods by 40% above cost price and then offers a discount of 20% on the marked price.",
            question: "What is the shopkeeper's actual profit percentage on the cost price?",
            options: ["20%", "12%", "8%", "16%"],
            correct: 1,
            explanation: "Let CP = 100. Marked Price = 140 (40% markup). After 20% discount: SP = 140 × 0.80 = 112. Profit = 112 - 100 = 12. Profit% = 12%. Answer: B. Key trick: markup × discount ≠ simple subtraction. Always calculate step by step."
          },
          {
            passage: "The table below shows the revenue (in crores) of a company for 5 years: 2019: ₹120 cr | 2020: ₹108 cr | 2021: ₹135 cr | 2022: ₹162 cr | 2023: ₹180 cr",
            question: "In which year did the company experience the highest percentage growth in revenue compared to the previous year?",
            options: ["2021", "2022", "2023", "2020"],
            correct: 0,
            explanation: "Calculate % growth year-over-year: 2020: (108-120)/120 × 100 = -10% (decline). 2021: (135-108)/108 × 100 = 27/108 × 100 ≈ 25%. 2022: (162-135)/135 × 100 = 27/135 × 100 = 20%. 2023: (180-162)/162 × 100 = 18/162 × 100 ≈ 11.1%. Highest growth = 2021 at 25%. Answer: A."
          },
          {
            passage: "A train travels from City A to City B, a distance of 360 km, at an average speed of 90 km/h. On the return journey from B to A, it travels at 60 km/h due to track maintenance.",
            question: "What is the average speed for the entire round trip?",
            options: ["75 km/h", "72 km/h", "70 km/h", "78 km/h"],
            correct: 1,
            explanation: "Average speed for a round trip = 2ab/(a+b) where a and b are speeds. = 2×90×60/(90+60) = 10800/150 = 72 km/h. CLAT Trap: Many students take (90+60)/2 = 75 km/h — this is WRONG for distance-based average speed. Always use the harmonic mean formula for equal distances. Answer: B (72 km/h)."
          }
        ]
      },
      mixed: {
        title: "Mixed Mock Assessment",
        color: "#16a34a",
        questions: []
      }
    };
    // Build mixed quiz — draw from all sections
    QUIZ_DATA.mixed.questions = [
      QUIZ_DATA.english.questions[0],
      QUIZ_DATA.legal.questions[0],
      QUIZ_DATA.gk.questions[0],
      QUIZ_DATA.logical.questions[0],
      QUIZ_DATA.quant.questions[0],
      QUIZ_DATA.english.questions[3],
      QUIZ_DATA.legal.questions[3],
      QUIZ_DATA.gk.questions[2],
      QUIZ_DATA.logical.questions[3],
      QUIZ_DATA.quant.questions[2],
      QUIZ_DATA.english.questions[5],
      QUIZ_DATA.legal.questions[5],
      QUIZ_DATA.gk.questions[4],
      QUIZ_DATA.logical.questions[5],
      QUIZ_DATA.quant.questions[4]
    ];

    let quizState = { type: '', questions: [], current: 0, score: 0, answered: [], wrongAnswers: [] };

    function startQuiz(type) {
      const data = QUIZ_DATA[type];
      quizState = { type, questions: data.questions, current: 0, score: 0, answered: [], wrongAnswers: [] };
      document.getElementById('quiz-selector').style.display = 'none';
      const qArea = document.getElementById('quiz-area');
      qArea.style.display = 'block';
      document.getElementById('quiz-title').textContent = data.title;
      renderQuestion();
    }

    function renderQuestion() {
      const q = quizState.questions[quizState.current];
      const total = quizState.questions.length;
      const idx = quizState.current;
      document.getElementById('quiz-meta').textContent = `Question ${idx + 1} of ${total}`;
      document.getElementById('progress-fill').style.width = `${((idx) / total) * 100}%`;
      const content = document.getElementById('quiz-content');

      let html = '';
      if (q.passage) {
        html += `<div class="passage-box"><p>${q.passage}</p></div>`;
      }
      html += `<div class="question-text">${idx + 1}. ${q.question}</div>`;
      html += `<ul class="options-list">`;
      q.options.forEach((opt, i) => {
        html += `<li><button class="option-btn" id="opt-${i}" onclick="selectOption(${i})">${String.fromCharCode(65 + i)}. ${opt}</button></li>`;
      });
      html += `</ul>`;
      html += `<div class="explanation-box" id="exp-box"><strong>✅ Explanation:</strong> ${q.explanation}</div>`;
      html += `<div class="quiz-nav"><button class="btn-primary" id="next-btn" onclick="nextQuestion()" style="display:none">${quizState.current < total - 1 ? 'Next Question →' : 'See Results'}</button></div>`;
      content.innerHTML = html;
    }

    function selectOption(selected) {
      if (quizState.answered[quizState.current]) return;
      quizState.answered[quizState.current] = true;
      const q = quizState.questions[quizState.current];
      const isCorrect = selected === q.correct;
      if (isCorrect) { quizState.score++; }
      else { quizState.wrongAnswers.push({ q: q.question, section: quizState.type }); }

      document.querySelectorAll('.option-btn').forEach((btn, i) => {
        btn.disabled = true;
        if (i === q.correct) btn.classList.add('correct');
        else if (i === selected && !isCorrect) btn.classList.add('wrong');
      });

      document.getElementById('exp-box').classList.add('show');
      document.getElementById('next-btn').style.display = 'inline-block';
    }

    function nextQuestion() {
      if (quizState.current < quizState.questions.length - 1) {
        quizState.current++;
        renderQuestion();
      } else {
        showResults();
      }
    }

    async function showResults() {
      const total = quizState.questions.length;
      const score = quizState.score;
      const pct = Math.round((score / total) * 100);
      const scoreClass = pct >= 70 ? 'score-great' : pct >= 50 ? 'score-ok' : 'score-low';
      const emoji = pct >= 70 ? '🎉' : pct >= 50 ? '👍' : '📚';

      document.getElementById('quiz-meta').textContent = 'Results';
      document.getElementById('progress-fill').style.width = '100%';

      const content = document.getElementById('quiz-content');
      content.innerHTML = `
    <div class="score-panel">
      <div class="score-circle ${scoreClass}">${pct}%</div>
      <h3 style="font-family:'Playfair Display',serif; font-size:22px; margin-bottom:8px;">${emoji} ${pct >= 70 ? 'Excellent Work!' : pct >= 50 ? 'Good Effort!' : 'Keep Practising!'}</h3>
      <p style="color:var(--muted); font-size:14px; margin-bottom:20px;">${score} correct out of ${total} questions</p>
      <div class="score-breakdown">
        <div class="score-stat"><div class="n" style="color:var(--green)">${score}</div><div class="l">Correct</div></div>
        <div class="score-stat"><div class="n" style="color:var(--accent)">${total - score}</div><div class="l">Wrong</div></div>
        <div class="score-stat"><div class="n">${pct}%</div><div class="l">Score</div></div>
      </div>
      <div id="ai-analysis">
        <div class="ai-loading"><div class="spinner"></div>Getting AI feedback on your performance...</div>
      </div>
    </div>
    <div class="quiz-nav" style="justify-content:center; margin-top:0;">
      <button class="btn-secondary" onclick="retryQuiz()">↩ Retry Test</button>
      <button class="btn-secondary" onclick="backToSelector()">← All Tests</button>
    </div>
  `;

      // Get AI feedback
      try {
        const wrongList = quizState.wrongAnswers.length > 0
          ? `The student got these questions wrong: ${quizState.wrongAnswers.map(w => w.q).join('; ')}`
          : 'The student answered all questions correctly.';

        const prompt = `A student just completed a CLAT ${quizState.type} practice test and scored ${score}/${total} (${pct}%). ${wrongList}

Give brief, specific, actionable feedback in 3–4 sentences:
1. One sentence acknowledging the score
2. One specific improvement tip based on the wrong answers (or strengths if all correct)
3. One recommended study action for this section
4. One motivational closing sentence

Be direct, specific, and encouraging. No generic advice.`;

        const resp = await fetch("https://api.anthropic.com/v1/messages", {
          method: "POST",
          headers: { "Content-Type": "application/json" },
          body: JSON.stringify({
            model: "claude-sonnet-4-20250514",
            max_tokens: 300,
            messages: [{ role: "user", content: prompt }]
          })
        });
        const data = await resp.json();
        const feedback = data.content?.[0]?.text || "Keep practising — every test helps you improve!";
        document.getElementById('ai-analysis').innerHTML = `
      <div class="ai-feedback">
        <div class="ai-label">✨ AI Feedback</div>
        <p>${feedback}</p>
      </div>`;
      } catch (e) {
        document.getElementById('ai-analysis').innerHTML = `<div class="tip-box">Keep practising — every attempt builds CLAT intuition!</div>`;
      }
    }

    function retryQuiz() {
      quizState.current = 0;
      quizState.score = 0;
      quizState.answered = [];
      quizState.wrongAnswers = [];
      renderQuestion();
    }

    function backToSelector() {
      document.getElementById('quiz-selector').style.display = 'block';
      document.getElementById('quiz-area').style.display = 'none';
    }


    // PYQ SYSTEM
    function selectPYQ(el, isCorrect) {
      const qBlock = el.closest('.pyq-question');
      if (qBlock.dataset.answered) return;
      qBlock.dataset.answered = '1';
      qBlock.querySelectorAll('.pyq-option').forEach(opt => {
        opt.onclick = null;
        if (opt === el) {
          opt.classList.add(isCorrect ? 'correct' : 'wrong');
        } else if (opt.onclick === null && !opt.classList.contains('wrong')) {
          // highlight correct answer
          if (opt.textContent.trim().startsWith(qBlock.querySelector('.pyq-answer-box').textContent.trim()[12])) {
            opt.classList.add('reveal');
          }
        }
      });
      // Reveal all correct options
      const ansBox = qBlock.querySelector('.pyq-answer-box');
      const correctLetter = ansBox.textContent.match(/Answer: ([A-D])/)?.[1];
      if (correctLetter) {
        qBlock.querySelectorAll('.pyq-option').forEach(opt => {
          if (opt.textContent.trim().startsWith(correctLetter + '.') || opt.textContent.trim().startsWith(correctLetter + ' ')) {
            if (!opt.classList.contains('wrong')) opt.classList.add('reveal');
          }
        });
      }
      ansBox.classList.add('show');
    }

    function filterPYQ(cat, btn) {
      document.querySelectorAll('.pyq-filter-btn').forEach(b => b.classList.remove('active'));
      btn.classList.add('active');
      document.querySelectorAll('.pyq-question').forEach(q => {
        q.style.display = (cat === 'all' || q.dataset.cat === cat) ? 'block' : 'none';
      });
    }

    // ═══════════════════════════════════════════════════════════
    // CHATBOT — AUTONOMOUS MODE · Streaming · Self-testing
    // ═══════════════════════════════════════════════════════════

    const CLAT_SYSTEM_PROMPT = `You are an expert CLAT (Common Law Admission Test) tutor for Indian law school aspirants preparing for CLAT UG 2027. You specialise in all 5 sections: English Language, Current Affairs & GK, Legal Reasoning, Logical Reasoning, and Quantitative Techniques.

Your expertise:
- CLAT exam pattern: 120 questions, 2 hours, -0.25 negative marking, all passage-based
- Legal Reasoning: IRAC method, Torts, Contracts, Constitutional Law, IPC basics
- Indian Constitutional Law: Fundamental Rights, DPSPs, amendments, landmark cases
- Landmark SC judgements: Kesavananda Bharati, Maneka Gandhi, Puttaswamy, Navtej Johar, etc.
- All 5 writs: Habeas Corpus, Mandamus, Certiorari, Prohibition, Quo Warranto
- Logical Reasoning: Syllogisms, Assumptions, Inferences, Argument analysis, Analogies
- English: RC strategies, inference, tone, meaning-in-context, strengthen/weaken
- Current Affairs: Indian politics, international relations, economy, S&T, awards (2024-2027)
- Quant: Percentages, ratios, averages, profit/loss, DI from tables and graphs (Class 10 level)
- Top NLU cut-offs, preparation strategy, mock test analysis

Response formatting rules:
- Use **bold** for key terms, concepts, case names
- Use numbered lists (1. 2. 3.) for steps or sequential info
- Use bullet points (• or -) for non-sequential lists
- When explaining a legal concept, use format: Concept → Definition → Example → CLAT application
- For practice questions: state the Q clearly, give 4 options (A/B/C/D), then explain the answer
- Add a section divider line "---" between major sections when response is long
- Keep responses focused and exam-oriented — no fluff

Personality:
- Warm, encouraging, direct — like a senior who cracked CLAT at NLSIU
- Use relatable language for Class 11-12 students
- Occasionally use phrases like "Here's the thing:", "Key trap here:", "CLAT trick:"
- End with brief encouragement only when student seems to be struggling
- If asked an off-topic question, gently redirect to CLAT prep

At the end of every response, add a line starting with "💡 Follow-up:" and suggest 2-3 specific follow-up questions as a comma-separated list inside square brackets like: 💡 Follow-up: [Question 1?, Question 2?, Question 3?]`;

    // ── State ────────────────────────────────────────────────
    let chatHistory = [];
    let messageCount = 0;
    let autonomousTimer = null;
    let connectionStatus = 'unknown'; // 'ok' | 'error' | 'checking' | 'unknown'
    let isStreaming = false;
    let studyStreak = parseInt(localStorage.getItem('clat_streak') || '0');
    let lastVisit = localStorage.getItem('clat_last_visit') || '';
    let topicsDiscussed = JSON.parse(localStorage.getItem('clat_topics') || '[]');

    // ── Connection Checker ───────────────────────────────────
    async function checkConnection() {
      setStatus('checking');
      try {
        const resp = await fetch('https://api.anthropic.com/v1/messages', {
          method: 'POST',
          headers: { 'Content-Type': 'application/json' },
          body: JSON.stringify({
            model: 'claude-sonnet-4-20250514',
            max_tokens: 10,
            messages: [{ role: 'user', content: 'ping' }]
          })
        });
        if (resp.ok || resp.status === 400) {
          // 400 = bad request but API is reachable
          setStatus('ok');
          return true;
        } else {
          setStatus('error');
          return false;
        }
      } catch (e) {
        setStatus('error');
        return false;
      }
    }

    function setStatus(status) {
      connectionStatus = status;
      const dot = document.getElementById('status-dot');
      const label = document.getElementById('status-label');
      const checkBtn = document.getElementById('check-conn-btn');
      if (!dot) return;
      const map = {
        ok: { color: '#4ade80', text: 'Connected · AI Ready' },
        error: { color: '#f87171', text: 'Connection Error · Retry' },
        checking: { color: '#facc15', text: 'Checking...' },
        unknown: { color: '#94a3b8', text: 'Click to check connection' }
      };
      const s = map[status] || map.unknown;
      dot.style.background = s.color;
      if (label) label.textContent = s.text;
      if (checkBtn) checkBtn.textContent = status === 'checking' ? '⟳' : '⟳ Test';
    }

    // ── Streak + Topic Tracking ──────────────────────────────
    function updateStreak() {
      const today = new Date().toDateString();
      if (lastVisit !== today) {
        const yesterday = new Date(Date.now() - 86400000).toDateString();
        studyStreak = lastVisit === yesterday ? studyStreak + 1 : 1;
        lastVisit = today;
        localStorage.setItem('clat_streak', studyStreak);
        localStorage.setItem('clat_last_visit', today);
        renderStreakBadge();
        if (studyStreak > 1) {
          setTimeout(() => insertSystemMsg(`🔥 Day ${studyStreak} streak! Consistency is your biggest competitive advantage for CLAT.`), 1200);
        }
      }
      renderStreakBadge();
    }

    function renderStreakBadge() {
      const el = document.getElementById('streak-badge');
      if (el) el.textContent = `🔥 ${studyStreak}d streak`;
    }

    function trackTopic(text) {
      const topics = { legal: 'Legal', english: 'English', gk: 'GK', logical: 'Logical', quant: 'Quant', strategy: 'Strategy', constitution: 'Legal', contract: 'Legal', tort: 'Legal', writ: 'Legal', syllogism: 'Logical', comprehension: 'English', current: 'GK', maths: 'Quant' };
      for (const [kw, topic] of Object.entries(topics)) {
        if (text.toLowerCase().includes(kw) && !topicsDiscussed.includes(topic)) {
          topicsDiscussed.push(topic);
          localStorage.setItem('clat_topics', JSON.stringify(topicsDiscussed));
        }
      }
    }

    // ── Autonomous Mode ──────────────────────────────────────
    const AUTONOMOUS_PROMPTS = [
      { delay: 45000, msg: "🤖 Quick check-in! Here's a CLAT Daily Drill question for you — give it a shot before I explain:", action: () => autonomousQuestion('legal') },
      { delay: 120000, msg: null, action: () => autonomousInsight() },
      { delay: 200000, msg: null, action: () => autonomousWeakSpotCheck() },
    ];

    let autonomousQueue = [];
    let autonomousActive = false;

    function startAutonomousMode() {
      if (autonomousActive) return;
      autonomousActive = true;
      autonomousQueue = [...AUTONOMOUS_PROMPTS];
      scheduleNextAutonomous();
      document.getElementById('auto-mode-btn').classList.add('active');
      document.getElementById('auto-mode-btn').textContent = '🤖 Auto: ON';
      insertSystemMsg('🤖 Autonomous mode activated! I\'ll proactively send you practice questions, insights, and check-ins to keep your prep on track.');
    }

    function stopAutonomousMode() {
      autonomousActive = false;
      if (autonomousTimer) clearTimeout(autonomousTimer);
      document.getElementById('auto-mode-btn').classList.remove('active');
      document.getElementById('auto-mode-btn').textContent = '🤖 Auto: OFF';
      insertSystemMsg('⏸ Autonomous mode paused. Tap "Auto: OFF" to resume.');
    }

    function toggleAutonomousMode() {
      if (autonomousActive) stopAutonomousMode();
      else startAutonomousMode();
    }

    function scheduleNextAutonomous() {
      if (!autonomousActive || autonomousQueue.length === 0) return;
      const next = autonomousQueue.shift();
      autonomousTimer = setTimeout(() => {
        if (!autonomousActive) return;
        if (next.msg) insertSystemMsg(next.msg);
        next.action();
        scheduleNextAutonomous();
      }, next.delay);
    }

    async function autonomousQuestion(section) {
      const sections = { legal: 'Legal Reasoning', english: 'English Language', gk: 'Current Affairs & GK', logical: 'Logical Reasoning', quant: 'Quantitative Techniques' };
      const sectionNames = Object.values(sections);
      const pick = section ? sections[section] : sectionNames[Math.floor(Math.random() * sectionNames.length)];
      const prompt = `Generate a single high-quality CLAT UG practice question for the ${pick} section. Format exactly as:
QUESTION: [the question, including any passage if needed]
A. [option]
B. [option]
C. [option]
D. [option]
---
ANSWER: [correct letter]
EXPLANATION: [2-3 sentence explanation of why this is correct and what trap to avoid]
💡 Follow-up: [2 follow-up questions the student might want to ask, comma-separated in square brackets]`;
      await chatSendInternal(`[Auto Daily Drill · ${pick}]\n${prompt}`, `📚 Daily Drill · ${pick}`);
    }

    async function autonomousInsight() {
      const uncovered = ['Legal', 'English', 'GK', 'Logical', 'Quant', 'Strategy'].filter(t => !topicsDiscussed.includes(t));
      const focus = uncovered.length > 0 ? uncovered[0] : 'Legal Reasoning';
      const prompt = `Give me one powerful, exam-focused insight or "did you know" fact about ${focus} in CLAT UG 2027 that most students miss. Keep it under 120 words, practical, and memorable.
💡 Follow-up: [2 follow-up questions in square brackets]`;
      await chatSendInternal(`[Auto Insight · ${focus}]\n${prompt}`, `💡 CLAT Insight · ${focus}`);
    }

    async function autonomousWeakSpotCheck() {
      const covered = topicsDiscussed.length > 0 ? topicsDiscussed.join(', ') : 'general CLAT topics';
      const prompt = `Based on a student who has been studying ${covered} for CLAT UG 2027, identify the single most likely weak spot or commonly neglected area and give one targeted tip to fix it. Be specific and actionable.
💡 Follow-up: [2 follow-up questions in square brackets]`;
      await chatSendInternal(`[Auto Weak-Spot Radar]\n${prompt}`, `🎯 Weak Spot Radar`);
    }

    // ── Core Send (with streaming simulation) ───────────────
    async function chatSend(preText) {
      if (isStreaming) return;
      const input = document.getElementById('chat-input');
      const userMsg = preText || input.value.trim();
      if (!userMsg) return;

      input.value = '';
      input.style.height = 'auto';

      const startersEl = document.getElementById('chat-starters-wrap');
      if (startersEl) startersEl.style.display = 'none';

      trackTopic(userMsg);
      appendChatMsg('user', userMsg);
      chatHistory.push({ role: 'user', content: userMsg });

      await sendToAPI();
    }

    async function chatSendInternal(prompt, label) {
      if (isStreaming) { setTimeout(() => chatSendInternal(prompt, label), 3000); return; }
      appendChatMsg('user', label || prompt, true);
      chatHistory.push({ role: 'user', content: prompt });
      await sendToAPI();
    }

    async function sendToAPI() {
      if (isStreaming) return;
      isStreaming = true;

      const btn = document.getElementById('chat-send-btn');
      if (btn) { btn.disabled = true; btn.innerHTML = '<span class="btn-spinner"></span>'; }

      // Create streaming message bubble
      const messagesDiv = document.getElementById('chat-messages');
      const wrapper = document.createElement('div');
      wrapper.className = 'chat-msg-wrap bot';
      const bubble = document.createElement('div');
      bubble.className = 'chat-msg bot streaming-bubble';
      const labelEl = document.createElement('div');
      labelEl.className = 'bot-label';
      labelEl.innerHTML = '<span class="bot-avatar">🤖</span> CLAT AI Tutor <span class="stream-indicator">●</span>';
      const contentEl = document.createElement('div');
      contentEl.className = 'bot-content';
      contentEl.innerHTML = '<div class="typing-dots"><span></span><span></span><span></span></div>';
      bubble.appendChild(labelEl);
      bubble.appendChild(contentEl);
      wrapper.appendChild(bubble);
      messagesDiv.appendChild(wrapper);
      messagesDiv.scrollTop = messagesDiv.scrollHeight;

      try {
        const resp = await fetch('https://api.anthropic.com/v1/messages', {
          method: 'POST',
          headers: { 'Content-Type': 'application/json' },
          body: JSON.stringify({
            model: 'claude-sonnet-4-20250514',
            max_tokens: 1500,
            system: CLAT_SYSTEM_PROMPT,
            messages: chatHistory
          })
        });

        if (!resp.ok) {
          const errData = await resp.json().catch(() => ({}));
          throw new Error(errData.error?.message || `HTTP ${resp.status}`);
        }

        const data = await resp.json();
        const reply = data.content?.map(b => b.text || '').join('') || 'Sorry, no response generated. Please try again.';

        setStatus('ok');
        chatHistory.push({ role: 'assistant', content: reply });

        // Simulate streaming: render word by word
        await streamRender(contentEl, reply, wrapper, bubble);
        messageCount++;
        trackTopic(reply);

        if (messageCount > 0 && messageCount % 5 === 0) {
          setTimeout(() => showMotivationNudge(), 600);
        }

      } catch (e) {
        setStatus('error');
        const errMsg = e.message?.toLowerCase().includes('failed to fetch') || e.message?.includes('network')
          ? '⚠️ **Network error.** Could not reach the AI. Please check your internet and use the **Test Connection** button.'
          : `⚠️ **Error:** ${e.message}`;
        const { html } = parseMarkdown(errMsg);
        contentEl.innerHTML = html;
        addBubbleActions(wrapper, bubble, errMsg);
      }

      isStreaming = false;
      if (btn) { btn.disabled = false; btn.innerHTML = 'Send ➤'; }
      const input = document.getElementById('chat-input');
      if (input) input.focus();
    }

    async function streamRender(contentEl, fullText, wrapper, bubble) {
      // Extract follow-ups before rendering
      let followUps = [];
      let cleanText = fullText.replace(/💡 Follow-up:\s*\[([^\]]+)\]/g, (_, content) => {
        followUps = content.split(',').map(s => s.trim()).filter(Boolean);
        return '';
      }).trim();

      // Render word-by-word for streaming effect
      const words = cleanText.split(' ');
      let accumulated = '';
      contentEl.innerHTML = '';

      for (let i = 0; i < words.length; i++) {
        accumulated += (i > 0 ? ' ' : '') + words[i];
        // Update display every few words for performance
        if (i % 4 === 0 || i === words.length - 1) {
          const { html } = parseMarkdown(accumulated + (i < words.length - 1 ? '▋' : ''));
          contentEl.innerHTML = html;
          const msgs = document.getElementById('chat-messages');
          if (msgs) msgs.scrollTop = msgs.scrollHeight;
          await new Promise(r => setTimeout(r, 18));
        }
      }

      // Final clean render
      const { html } = parseMarkdown(cleanText);
      contentEl.innerHTML = html;
      bubble.classList.remove('streaming-bubble');
      const streamDot = bubble.querySelector('.stream-indicator');
      if (streamDot) streamDot.remove();

      addBubbleActions(wrapper, bubble, fullText, followUps);
      const msgs = document.getElementById('chat-messages');
      if (msgs) msgs.scrollTop = msgs.scrollHeight;
    }

    function addBubbleActions(wrapper, bubble, rawText, followUps = []) {
      // Copy button
      const copyBtn = document.createElement('button');
      copyBtn.className = 'msg-action-btn';
      copyBtn.innerHTML = '📋 Copy';
      copyBtn.onclick = () => {
        navigator.clipboard.writeText(rawText).then(() => {
          copyBtn.innerHTML = '✅ Copied!';
          setTimeout(() => copyBtn.innerHTML = '📋 Copy', 2000);
        }).catch(() => copyBtn.innerHTML = '❌ Failed');
      };

      // Regenerate button
      const regenBtn = document.createElement('button');
      regenBtn.className = 'msg-action-btn';
      regenBtn.innerHTML = '↺ Regenerate';
      regenBtn.onclick = async () => {
        if (isStreaming) return;
        // Remove this message pair and resend
        chatHistory = chatHistory.slice(0, -1);
        wrapper.remove();
        await sendToAPI();
      };

      const actRow = document.createElement('div');
      actRow.className = 'msg-actions-row';
      actRow.appendChild(copyBtn);
      actRow.appendChild(regenBtn);
      wrapper.appendChild(actRow);

      // Follow-up chips
      if (followUps.length > 0) {
        const suggestWrap = document.createElement('div');
        suggestWrap.className = 'followup-wrap';
        suggestWrap.innerHTML = '<span class="followup-label">Ask next:</span>';
        followUps.forEach(q => {
          const btn = document.createElement('button');
          btn.className = 'followup-btn';
          btn.textContent = q;
          btn.onclick = () => chatSend(q);
          suggestWrap.appendChild(btn);
        });
        wrapper.appendChild(suggestWrap);
      }
    }

    // ── Markdown Parser ──────────────────────────────────────
    function parseMarkdown(text) {
      let followUps = [];
      text = text.replace(/💡 Follow-up:\s*\[([^\]]+)\]/g, (_, c) => {
        followUps = c.split(',').map(s => s.trim()).filter(Boolean);
        return '';
      });

      let html = text
        .replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
        .replace(/\*(.*?)\*/g, '<em>$1</em>')
        .replace(/`([^`]+)`/g, '<code class="inline-code">$1</code>')
        .replace(/^---$/gm, '<hr class="chat-divider">')
        .replace(/^(\d+)\.\s+(.+)$/gm, '<li class="num-item"><span class="num-badge">$1</span><span>$2</span></li>')
        .replace(/^[•\-]\s+(.+)$/gm, '<li class="bul-item">$1</li>')
        .replace(/(<li class="num-item">[\s\S]*?<\/li>\n?)+/g, m => `<ol class="chat-ol">${m}</ol>`)
        .replace(/(<li class="bul-item">[\s\S]*?<\/li>\n?)+/g, m => `<ul class="chat-ul">${m}</ul>`)
        .replace(/\n\n/g, '</p><p class="chat-p">')
        .replace(/\n/g, '<br>');

      return { html: `<p class="chat-p">${html}</p>`, followUps };
    }

    // ── appendChatMsg for user messages ─────────────────────
    function appendChatMsg(role, text, isInternal = false) {
      const messagesDiv = document.getElementById('chat-messages');
      const wrapper = document.createElement('div');
      wrapper.className = 'chat-msg-wrap ' + role;
      const div = document.createElement('div');
      div.className = 'chat-msg ' + role + (isInternal ? ' internal-msg' : '');
      div.textContent = text;
      wrapper.appendChild(div);
      messagesDiv.appendChild(wrapper);
      messagesDiv.scrollTop = messagesDiv.scrollHeight;
    }

    function insertSystemMsg(text) {
      const messagesDiv = document.getElementById('chat-messages');
      const div = document.createElement('div');
      div.className = 'chat-system-msg';
      div.innerHTML = text;
      messagesDiv.appendChild(div);
      messagesDiv.scrollTop = messagesDiv.scrollHeight;
    }

    // ── Motivation Nudge ─────────────────────────────────────
    function showMotivationNudge() {
      const nudges = [
        "🔥 You're on a roll! Consistency like this is what separates NLSIU toppers.",
        "💪 Every question you practice now is one less doubt on exam day!",
        "⚡ CLAT toppers average 6–8 hours of focused daily prep. You're doing great!",
        "🎯 Daily practice = CLAT success formula. Keep going!"
      ];
      const messagesDiv = document.getElementById('chat-messages');
      const nudgeDiv = document.createElement('div');
      nudgeDiv.className = 'chat-nudge';
      nudgeDiv.textContent = nudges[Math.floor(Math.random() * nudges.length)];
      messagesDiv.appendChild(nudgeDiv);
      messagesDiv.scrollTop = messagesDiv.scrollHeight;
      setTimeout(() => { nudgeDiv.style.opacity = '0'; nudgeDiv.style.transform = 'translateY(-8px)'; }, 5000);
      setTimeout(() => nudgeDiv.remove(), 5600);
    }

    // ── Clear Chat ───────────────────────────────────────────
    function clearChat() {
      if (!confirm('Clear this chat? Your conversation history will be lost.')) return;
      chatHistory = [];
      messageCount = 0;
      if (autonomousActive) stopAutonomousMode();
      document.getElementById('chat-messages').innerHTML = '';
      insertSystemMsg('🔄 Chat cleared. Ready to help you crack CLAT 2027!');
      const startersEl = document.getElementById('chat-starters-wrap');
      if (startersEl) startersEl.style.display = 'flex';
    }

    // ── Quick Topic Buttons ──────────────────────────────────
    function askDailyQuestion(section) {
      autonomousQuestion(section);
    }

    // ── Init ─────────────────────────────────────────────────
    window.onload = function () {
      loadDeck('legal');
      updateStreak();
      // Auto-check connection when chatbot tab is opened
      document.querySelectorAll('.tab-btn').forEach(btn => {
        btn.addEventListener('click', () => {
          if (btn.textContent.includes('AI Tutor') && connectionStatus === 'unknown') {
            setTimeout(checkConnection, 400);
          }
        });
      });
    };
  </script>
</body>

</html>