Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
1548 lines (1422 loc) · 78.6 KB
/
Copy pathindex.html
File metadata and controls
1548 lines (1422 loc) · 78.6 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Answer Sheet — NIKHIL CHARY SRIRAMOJU</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Source+Serif+4:wght@400;600;700&family=Inter:wght@400;500;600;700&family=Caveat:wght@500;600;700&family=Kalam:wght@400;700&display=swap" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
<style>
:root{
--ink:#0f172a;
--slate:#1e293b;
--slate-2:#334155;
--canvas:#eef1f5;
--paper:#ffffff;
--rule-blue:#dbe3ee;
--margin-red:#dc2626;
--muted:#94a3b8;
--muted-2:#64748b;
--accent:#2563eb;
--accent-dark:#1d4ed8;
--generate:#16a34a;
--generate-dark:#15803d;
--hl-name:#fde68a;
--hl-name-ink:#78350f;
--hl-key:#bbf7d0;
--hl-key-ink:#14532d;
--hw-paper:#ffffff;
--hw-rule:#c7d6f5;
--hw-ink-1:#1d3a8a;
--hw-ink-2:#0f6e5c;
}
*{ box-sizing:border-box; margin:0; padding:0; }
body{
font-family:'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
background:var(--canvas);
height:100vh;
overflow:hidden;
}
.app{ display:flex; height:100vh; }
/* ---------- Sidebar ---------- */
.sidebar{
width:320px;
flex-shrink:0;
background:var(--slate);
color:#e2e8f0;
display:flex;
flex-direction:column;
padding:20px;
gap:18px;
overflow-y:auto;
}
.brand{ display:flex; flex-direction:column; gap:2px; }
.brand .mark{
width:34px; height:34px; border-radius:8px;
background:linear-gradient(135deg, var(--margin-red), var(--accent));
display:flex; align-items:center; justify-content:center;
font-family:'Source Serif 4', serif; font-weight:700; color:#fff; font-size:1.05rem;
margin-bottom:8px;
}
.brand h1{ font-size:1.05rem; font-weight:700; color:#fff; }
.brand p{ font-size:0.75rem; color:var(--muted); margin-top:2px; }
.credit-line{
font-size:0.72rem; font-weight:700; color:#cbd5e1; margin-top:6px;
text-transform:uppercase; letter-spacing:0.03em; line-height:1.4;
}
.credit-line span{
background:linear-gradient(135deg, #fbbf24, #f87171, #60a5fa);
-webkit-background-clip:text; background-clip:text; color:transparent;
font-weight:800; letter-spacing:0.04em;
}
.card{
background:#152033;
border:1px solid #2d3d54;
border-left:3px solid #2d3d54;
border-radius:10px;
padding:14px;
display:flex;
flex-direction:column;
gap:10px;
transition:transform .15s ease, border-color .15s ease;
}
.card:hover{ transform:translateY(-1px); }
.card-key{ border-left-color:#f59e0b; }
.card-generate{ border-left-color:#16a34a; }
.card-student{ border-left-color:#2563eb; }
.card-tools{ border-left-color:#7c3aed; }
.card-draft{ border-left-color:#0891b2; }
.card-submit{ border-left-color:#db2777; }
.card h2{
font-size:0.7rem; font-weight:700; text-transform:uppercase; letter-spacing:0.06em;
color:var(--muted); display:flex; align-items:center; gap:6px;
}
textarea#question-input, textarea.q-text{
width:100%; min-height:64px; resize:vertical;
background:var(--ink); border:1px solid var(--slate-2); color:#fff;
padding:9px 10px; border-radius:7px; font-size:0.85rem; font-family:inherit; outline:none;
line-height:1.4;
}
textarea#question-input:focus, textarea.q-text:focus{ border-color:var(--accent); }
.question-row{
border:1px solid #334155; border-radius:8px; padding:10px; margin-bottom:10px; background:#0f1c30;
}
.q-number-label{ font-weight:700; color:#e2e8f0; }
.q-remove-btn{
border:1px solid #7f1d1d; background:transparent; color:#fca5a5; font-size:0.72rem;
padding:3px 9px; border-radius:5px; cursor:pointer; font-family:inherit;
}
.q-remove-btn:hover{ background:#7f1d1d; color:#fff; }
.row{ display:flex; gap:8px; }
.row > *{ flex:1; }
select, .card input[type="text"]{
background:var(--ink); border:1px solid var(--slate-2); color:#fff;
padding:8px 10px; border-radius:7px; font-size:0.82rem; outline:none; font-family:inherit;
}
select:focus, .card input[type="text"]:focus{ border-color:var(--accent); }
.field-label{ font-size:0.68rem; color:var(--muted); display:block; margin-bottom:3px; }
.card > .row{ gap:8px; }
.card input[type="text"]{ width:100%; margin-bottom:8px; }
.btn{
border:none; border-radius:7px; font-weight:700; cursor:pointer;
font-size:0.85rem; padding:10px 14px;
transition:background .15s ease, opacity .15s ease, transform .12s ease, box-shadow .12s ease;
font-family:inherit;
}
.btn:hover:not(:disabled){ transform:translateY(-1px); box-shadow:0 3px 10px rgba(0,0,0,.18); }
.btn:active:not(:disabled){ transform:translateY(0); box-shadow:none; }
.btn:disabled{ background:#475569 !important; cursor:not-allowed; opacity:.7; }
.btn-generate{ background:var(--generate); color:#fff; width:100%; }
.btn-generate:hover:not(:disabled){ background:var(--generate-dark); }
.btn-generate.is-working{ animation:pulseGenerate 1.4s ease-in-out infinite; }
@keyframes pulseGenerate{
0%, 100%{ background:var(--generate); }
50%{ background:var(--generate-dark); }
}
.btn-ghost{
background:transparent; border:1px solid #2d3d54; color:#cbd5e1;
}
.btn-ghost:hover{ background:#1e2c42; }
.status{ font-size:0.72rem; color:var(--muted); line-height:1.4; min-height:14px; }
.status.error{ color:#fca5a5; }
.status.ok{ color:#86efac; }
.toggle-row{ display:flex; align-items:center; gap:8px; font-size:0.78rem; color:#cbd5e1; }
.toggle-row input{ accent-color:var(--generate); }
.sidebar-footer{ margin-top:auto; padding-top:10px; border-top:1px solid #2d3d54; }
.sidebar-footer p{ font-size:0.7rem; color:var(--muted); margin-bottom:6px; }
.sidebar-footer a{
display:block; font-size:0.75rem; color:#93c5fd; text-decoration:none; margin-bottom:4px;
}
.sidebar-footer a:hover{ text-decoration:underline; }
/* ---------- Main ---------- */
.main{ flex:1; display:flex; flex-direction:column; min-width:0; }
.topbar{
background:var(--ink); color:#fff; padding:10px 20px;
display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;
}
.topbar .view-tabs{ display:none; gap:6px; }
.tab-btn{
background:#1e293b; color:#cbd5e1; border:1px solid #334155; border-radius:6px;
padding:6px 12px; font-size:0.78rem; cursor:pointer; font-family:inherit;
}
.tab-btn.active{ background:var(--accent); color:#fff; border-color:var(--accent); }
.topbar-actions{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.btn-small{
background:#1e293b; color:#e2e8f0; border:1px solid #334155; border-radius:6px;
padding:7px 12px; font-size:0.78rem; cursor:pointer; font-family:inherit; font-weight:600;
}
.btn-small:hover{ background:#243244; }
.btn-export{ background:var(--accent); border-color:var(--accent); }
.btn-export:hover{ background:var(--accent-dark); }
.btn-chip{
background:#eef2ff; color:var(--accent-dark); border:1px solid #c7d2fe; border-radius:6px;
padding:4px 10px; font-size:0.72rem; cursor:pointer; font-family:inherit; font-weight:600;
}
.btn-chip:hover{ background:#e0e7ff; }
.container{ display:flex; flex:1; overflow:hidden; gap:14px; padding:14px; }
.panel{ flex:1; display:flex; flex-direction:column; min-width:0; }
.panel-title{
font-size:0.72rem; font-weight:700; color:var(--muted-2); margin-bottom:6px;
text-transform:uppercase; letter-spacing:0.06em;
}
textarea#markdown-input{
width:100%; height:100%; padding:16px; border:1px solid #cbd5e1; border-radius:10px;
font-family:"SFMono-Regular", Consolas, "Courier New", monospace; font-size:12.5px; line-height:1.55;
resize:none; outline:none; background:#fff;
}
textarea#markdown-input:focus{ border-color:var(--accent); }
/* Answer sheet preview */
#preview-wrap{
flex:1; border-radius:10px; overflow:hidden; border:1px solid #cbd5e1;
background:var(--paper); position:relative; box-shadow:0 1px 3px rgba(15,23,42,.06);
}
#preview{
width:100%; height:100%; overflow-y:auto;
padding:40px 44px;
position:relative;
line-height:1.85;
color:#1e293b;
font-family:'Source Serif 4', Georgia, serif;
background:#ffffff;
}
#preview.fade-in{ animation:previewFadeIn .35s ease; }
@keyframes previewFadeIn{
from{ opacity:.4; transform:translateY(4px); }
to{ opacity:1; transform:translateY(0); }
}
#preview h1, #preview h2, #preview h3{
font-family:'Source Serif 4', serif; margin-top:1.1em; margin-bottom:0.4em; color:var(--ink);
}
#preview h1{ font-size:1.35rem; border-bottom:2px solid var(--ink); padding-bottom:6px; }
#preview h2{ font-size:1.08rem; color:var(--accent-dark); }
.details-strip{
display:flex; flex-wrap:wrap; gap:6px 14px;
border:1px solid #cbd5e1; border-radius:8px;
background:#f8fafc; padding:10px 14px; margin-bottom:20px;
font-family:'Inter', sans-serif; font-size:0.78rem; color:#334155;
}
.details-strip .d-item{ white-space:nowrap; }
.details-strip .d-label{ font-weight:700; color:var(--ink); }
#preview p{ margin-bottom:0.9em; text-align:justify; font-size:0.96rem; }
#preview blockquote{
border-left:3px solid var(--accent); background:#f8fafc; padding:8px 14px;
margin:1em 0; font-size:0.9rem; color:#334155;
}
#preview table{ border-collapse:collapse; width:100%; margin:1.3em 0; font-size:0.88rem; font-family:'Inter',sans-serif; }
#preview th, #preview td{ border:1px solid #94a3b8; padding:8px 12px; text-align:left; }
#preview th{ background:#f1f5f9; font-weight:700; }
#preview pre{ background:#f8fafc; border:1px solid #e2e8f0; border-radius:6px; padding:12px; overflow-x:auto; margin-bottom:1.1em; font-family:"SFMono-Regular", Consolas, "Courier New", monospace; font-size:0.82rem; line-height:1.5; }
#preview pre:has(.mermaid){ background:transparent; border:none; padding:0; }
.mermaid{ display:flex; justify-content:center; margin:20px 0; }
.diagram-fallback{
background:#fef2f2; border:1px solid #fecaca; color:#991b1b; border-radius:8px;
padding:12px 14px; margin:16px 0; font-family:'Inter', sans-serif; font-size:0.85rem;
}
.diagram-fallback pre{
background:#fff; border:1px solid #fecaca; margin-top:8px; font-size:0.78rem; color:#334155;
}
mark.name-highlight{ background:var(--hl-name); color:var(--hl-name-ink); padding:0 2px; border-radius:3px; font-weight:600; }
mark.key-highlight{ background:var(--hl-key); color:var(--hl-key-ink); padding:0 2px; border-radius:3px; font-weight:600; }
#preview.hide-key-highlights mark.key-highlight{ background:none; color:inherit; font-weight:700; padding:0; }
/* ---------- Handwritten output mode ---------- */
.view-mode-row{ display:flex; gap:6px; }
.mode-btn{
border:1px solid #cbd5e1; background:#fff; color:#334155; padding:5px 12px; font-size:0.76rem;
border-radius:6px; cursor:pointer; font-family:inherit; font-weight:600;
transition:background .15s ease, transform .12s ease;
}
.mode-btn:hover{ transform:translateY(-1px); }
.mode-btn.active{
background:linear-gradient(135deg, var(--accent), #1e3a8a);
color:#fff; border-color:transparent;
}
#preview-wrap.handwritten-mode{ background:var(--hw-paper); }
#preview.handwritten-mode{
font-family:'Caveat', 'Segoe Script', cursive;
color:var(--hw-ink-1);
font-size:var(--hw-fsize, 1.32rem);
line-height:var(--hw-line, 2.15em);
background-color:var(--hw-paper);
background-image: repeating-linear-gradient(var(--hw-paper), var(--hw-paper) calc(var(--hw-line, 2.15em) - 1px), var(--hw-rule) calc(var(--hw-line, 2.15em) - 1px), var(--hw-rule) var(--hw-line, 2.15em));
background-position: 0 8px;
padding-left:64px;
padding-top:10px;
border-left:3px solid var(--margin-red);
margin-left:20px;
position:relative;
}
#preview.handwritten-mode h1, #preview.handwritten-mode h2, #preview.handwritten-mode h3{
font-family:'Caveat', cursive;
}
#preview.handwritten-mode h1{ font-size:1.95rem; color:#7c2d12; border-bottom-color:#7c2d12; }
#preview.handwritten-mode h2{ font-size:1.6rem; color:#0f6e5c; }
#preview.handwritten-mode h3{ font-size:1.4rem; color:#a21caf; }
#preview.handwritten-mode p{ text-align:left; font-size:1.28rem; }
#preview.handwritten-mode strong{ color:#9a3412; }
#preview.handwritten-mode em{ color:#0369a1; }
#preview.handwritten-mode table{ font-family:'Caveat', cursive; font-size:1.25rem; }
#preview.handwritten-mode th, #preview.handwritten-mode td{ border-color:#93a8d8; }
#preview.handwritten-mode th{ background:#fef3c7; color:#78350f; }
#preview.handwritten-mode tr:nth-child(even) td{ background:#f0fdf4; }
#preview.handwritten-mode pre{ font-family:'Caveat', cursive; font-size:1.15rem; background:#fdfdfd; border-color:var(--hw-rule); }
#preview.handwritten-mode blockquote{ background:#fff7ed; border-left-color:#ea580c; color:#7c2d12; }
#preview.handwritten-mode mark.name-highlight{
background:linear-gradient(180deg, transparent 55%, #fde68a 55%);
color:inherit; padding:0 2px; font-weight:700;
}
#preview.handwritten-mode mark.key-highlight{
background:linear-gradient(180deg, transparent 55%, #bbf7d0 55%);
text-decoration:underline wavy #16a34a; color:inherit; padding:0 2px;
}
#preview.handwritten-mode.hide-key-highlights mark.key-highlight{ background:none; text-decoration:none; font-weight:700; }
/* ---- Second handwriting "writer" — alternates in for later answers so the
page never looks like it ran out mid-way; feels like a friend filled the gaps ---- */
#preview.handwritten-mode .hw-writer-2{ font-family:'Kalam', cursive; color:var(--hw-ink-2); }
#preview.handwritten-mode .hw-writer-2 h1{ color:#9d174d; border-bottom-color:#9d174d; }
#preview.handwritten-mode .hw-writer-2 h2{ color:#1d4ed8; }
#preview.handwritten-mode .hw-writer-2 h3{ color:#b45309; }
#preview.handwritten-mode .hw-writer-2 strong{ color:#134e4a; }
#preview.handwritten-mode .hw-writer-2 em{ color:#7c2d12; }
#preview.handwritten-mode .hw-writer-2 table{ font-family:'Kalam', cursive; }
#preview.handwritten-mode .hw-writer-2 th{ background:#dbeafe; color:#1e3a8a; }
#preview.handwritten-mode .hw-writer-2 tr:nth-child(even) td{ background:#fdf2f8; }
#preview.handwritten-mode .hw-writer-2 pre{ font-family:'Kalam', cursive; }
#preview.handwritten-mode .hw-writer-2 blockquote{ background:#eff6ff; border-left-color:#1d4ed8; color:#1e3a8a; }
@media print{
#preview.handwritten-mode{ background-image: repeating-linear-gradient(#fff, #fff calc(2.15em - 1px), var(--hw-rule) calc(2.15em - 1px), var(--hw-rule) 2.15em); }
#preview-wrap.handwritten-mode{ background:#fff; }
}
.bottom-bar{ background:var(--ink); padding:10px 20px; display:flex; justify-content:center; }
.btn-print-bottom{
background:var(--accent); color:#fff; border:none; padding:10px 30px; font-size:0.92rem;
font-weight:700; border-radius:7px; cursor:pointer; font-family:inherit;
}
.btn-print-bottom:hover{ background:var(--accent-dark); }
footer{
background:#fff; border-top:1px solid #cbd5e1; padding:16px 20px 20px;
display:flex; flex-direction:column; align-items:center; gap:10px;
font-size:0.78rem; color:var(--muted-2); text-align:center;
}
footer .footer-brand{ font-weight:700; color:var(--ink); font-size:0.82rem; }
footer .footer-links{
display:flex; flex-direction:column; align-items:stretch; gap:6px;
width:100%; max-width:240px;
}
footer .footer-links a{
display:flex; align-items:center; justify-content:center; gap:6px;
padding:8px 14px; border-radius:20px; color:#fff; text-decoration:none;
font-weight:600; font-size:0.78rem; font-family:'Inter',sans-serif;
transition:opacity .15s ease, transform .15s ease;
}
footer .footer-links a:hover{ opacity:.87; transform:translateY(-1px); }
footer .footer-links a.f-email{ background:#dc2626; }
footer .footer-links a.f-call{ background:#16a34a; }
footer .footer-links a.f-github{ background:#0f172a; }
footer .footer-links a.f-linkedin{ background:#0a66c2; }
footer .footer-links a.f-instagram{ background:linear-gradient(135deg,#f58529,#dd2a7b,#8134af,#515bd4); }
footer .footer-links a.f-facebook{ background:#1877f2; }
/* ---------- Toast notifications ---------- */
.toast-stack{
position:fixed; bottom:20px; right:20px; z-index:9999;
display:flex; flex-direction:column; gap:8px; align-items:flex-end;
pointer-events:none;
}
.toast{
background:linear-gradient(135deg, var(--ink), #1e3a5f); color:#fff; padding:10px 16px 10px 12px;
border-radius:8px; border-left:4px solid var(--accent);
font-size:0.82rem; font-family:'Inter',sans-serif; box-shadow:0 4px 14px rgba(15,23,42,.25);
opacity:0; transform:translateY(8px); transition:opacity .25s ease, transform .25s ease;
max-width:280px;
}
.toast.show{ opacity:1; transform:translateY(0); }
.toast.ok{ background:linear-gradient(135deg, #15803d, #166534); border-left-color:#86efac; }
.toast.error{ background:linear-gradient(135deg, #b91c1c, #7f1d1d); border-left-color:#fca5a5; }
/* ---------- Sidebar collapse ---------- */
.sidebar{ position:relative; transition:width .18s ease, padding .18s ease; }
.sidebar.collapsed{ width:60px; padding:20px 10px; overflow:visible; }
.sidebar.collapsed .card, .sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .brand h1, .sidebar.collapsed .brand p, .sidebar.collapsed .credit-line{ display:none; }
.sidebar-collapse-btn{
position:absolute; top:14px; right:10px;
background:transparent; border:1px solid #2d3d54; color:#cbd5e1; border-radius:6px;
padding:4px 9px; cursor:pointer; font-size:0.8rem; font-family:inherit;
}
.sidebar.collapsed .sidebar-collapse-btn{ right:auto; left:50%; transform:translateX(-50%); top:20px; }
.sidebar-collapse-btn:hover{ background:#1e2c42; }
/* ---------- Dark preview (system mode, screen only) ---------- */
#preview-wrap.dark-preview{ background:#111827; }
#preview.dark-preview{ background:#111827; color:#e2e8f0; }
#preview.dark-preview h1, #preview.dark-preview h2{ color:#f1f5f9; border-color:#334155; }
#preview.dark-preview .details-strip{ background:#1e293b; border-color:#334155; color:#cbd5e1; }
#preview.dark-preview .details-strip .d-label{ color:#f1f5f9; }
#preview.dark-preview table{ color:#e2e8f0; }
#preview.dark-preview th{ background:#1e293b; }
#preview.dark-preview th, #preview.dark-preview td{ border-color:#334155; }
#preview.dark-preview blockquote{ background:#1e293b; color:#cbd5e1; }
#preview.dark-preview pre{ background:#1e293b; border-color:#334155; color:#e2e8f0; }
/* ---------- Page-continuity labels around each page-break ---------- */
.page-break-label{
font-family:'Inter',sans-serif; font-size:0.7rem; font-weight:600; color:var(--muted-2);
text-align:center; margin:2px 0;
}
/* ---------- Left-margin question badges (handwritten mode) ---------- */
#preview.handwritten-mode .hw-qbadge{
display:inline-block; font-family:'Inter',sans-serif; font-size:0.7rem; font-weight:700;
color:#fff; background:var(--margin-red); border-radius:4px; padding:3px 0; width:44px;
text-align:center; margin:0 0 8px -64px;
}
/* ---------- Handwriting size control ---------- */
.hw-size-row{ display:none; align-items:center; gap:6px; color:#cbd5e1; font-size:0.72rem; }
.hw-size-row input[type="range"]{ accent-color:var(--accent); width:80px; }
/* ---------- Responsive ---------- */
@media (max-width: 880px){
.app{ flex-direction:column; height:auto; overflow:auto; }
body{ overflow:auto; height:auto; }
.sidebar{ width:100%; max-height:none; }
.topbar .view-tabs{ display:flex; }
.container{ flex-direction:column; padding:12px; }
.panel{ min-height:60vh; }
.panel.hidden-mobile{ display:none; }
}
/* Avoid awkward mid-element page breaks in the exported PDF */
#preview table, #preview .mermaid, #preview pre, #preview blockquote, .details-strip{
page-break-inside: avoid;
break-inside: avoid;
}
#preview h1, #preview h2, #preview h3{
page-break-after: avoid;
break-after: avoid;
}
/* ---------- Print ---------- */
.print-pagenum{ display:none; }
@media print{
.sidebar, .topbar, .panel-title, textarea, .bottom-bar, footer,
.toast-stack, .sidebar-collapse-btn, .hw-size-row, .page-break-label{ display:none !important; }
body, .app, .main{ overflow:visible; height:auto; background:#fff; }
.container{ display:block; overflow:visible; padding:0; }
.panel{ min-height:0; }
#preview-wrap, #preview-wrap.dark-preview{ border:none; box-shadow:none; border-radius:0; }
#preview-wrap.dark-preview{ background:#fff !important; }
#preview{ overflow:visible; }
#preview.dark-preview{ background:#fff !important; color:#1e293b !important; }
.details-strip{ -webkit-print-color-adjust:exact; print-color-adjust:exact; }
@page{
margin:18mm 20mm 16mm 20mm;
/* Best-effort native page numbers — supported in some browsers, harmlessly ignored elsewhere */
@bottom-center{ content: "Page " counter(page) " of " counter(pages); font-family:'Inter', sans-serif; font-size:9px; color:#64748b; }
}
body{ counter-reset: page; }
/* Cross-browser fallback: a fixed element repeats on every printed page, and its counter
increments once per page — this works even where @page margin boxes above don't. */
.print-pagenum{
display:block; position:fixed; bottom:8mm; right:20mm; left:0; text-align:right;
font-family:'Inter', sans-serif; font-size:9px; color:#64748b;
}
.print-pagenum::after{ counter-increment: page; content: "Page " counter(page); }
.page-break{ page-break-before: always; break-before: page; }
}
.page-break{ display:block; height:1px; margin:26px 0; border-top:2px dashed #cbd5e1; }
</style>
</head>
<body>
<div class="print-pagenum"></div>
<div class="app">
<aside class="sidebar" id="sidebar">
<button class="sidebar-collapse-btn" id="sidebar-collapse-btn" type="button" title="Collapse sidebar">⟨⟨</button>
<div class="brand">
<div class="mark">Ñẞ</div>
<h1>Answer Sheet Studio</h1>
<p>JNTUH-style detailed answers, diagrams & export🫂</p>
<p class="credit-line">Built with human intelligence by <span>NIKHIL👑CHARY🌟SRIRAMOJU</span></p>
</div>
<div class="card card-key">
<h2>🔑Groq API💨Key</h2>
<p style="font-size:0.7rem; color:var(--muted); margin-top:-4px;">Stored only in your browser (localStorage) — never saved in the code or sent anywhere except Groq's API.</p>
<input id="groq-key-input" type="password" placeholder="Paste your Groq API key" autocomplete="off" />
<div class="row">
<button class="btn btn-ghost" id="save-key-btn" style="flex:1;">Save🫣key</button>
<button class="btn btn-ghost" id="clear-key-btn" style="flex:0 0 auto;">Clear😤</button>
</div>
<div class="status" id="key-status"></div>
<a href="https://console.groq.com/keys" target="_blank" rel="noopener" style="font-size:0.72rem; color:#93c5fd;">Get a free Groq API key🪂 →</a>
</div>
<div class="card card-generate">
<h2>✨Generate🦄answers</h2>
<p style="font-size:0.7rem; color:var(--muted); margin-top:-4px;">Add one or more questions — each gets its own numbered, full-length answer in one go.</p>
<div id="questions-list"></div>
<button class="btn btn-ghost" id="add-question-btn" type="button">+ Add😶🌫️another🥶question</button>
<div class="row" style="margin-top:10px;">
<button class="btn btn-generate" id="generate-btn" style="flex:1;">Generate All🔥Answers</button>
<button class="btn btn-ghost" id="cancel-btn" style="display:none; flex:0 0 auto;">Cancel❌</button>
</div>
<div class="status" id="generator-status"></div>
</div>
<template id="question-row-template">
<div class="question-row">
<div class="row" style="justify-content:space-between; align-items:center; margin-bottom:4px;">
<label class="field-label q-number-label">Question 1</label>
<button class="q-remove-btn" type="button" title="Remove this question">⚒️Remove</button>
</div>
<textarea class="q-text" placeholder="Type the exam question, e.g. Explain 1NF, 2NF, 3NF and BCNF with examples"></textarea>
<div class="row">
<select class="q-type">
<option value="auto" selected>Auto-detect type</option>
<option value="theory">Theory⛓️💥answer</option>
<option value="program">Programming💣answer</option>
</select>
</div>
<div class="row">
<select class="q-marks">
<option value="10">10 Marks</option>
<option value="16">16 Marks</option>
<option value="20" selected>20 Marks</option>
</select>
<select class="q-diagram">
<option value="auto" selected>Auto diagram</option>
<option value="flowchart">Flowchart</option>
<option value="sequence">Sequence</option>
<option value="er">ER🐎diagram</option>
</select>
</div>
<div class="status q-charcount" style="text-align:right;"></div>
</div>
</template>
<div class="card card-student">
<h2>🎓Student🐣Details</h2>
<p style="font-size:0.7rem; color:var(--muted); margin-top:-4px;">Shown on every answer sheet & highlighted wherever they appear</p>
<div class="row">
<div style="flex:1;">
<label class="field-label">Name🔞🕊️</label>
<input id="detail-name" type="text" value="NIKHIL CHARY♥️SRIRAMOJU" />
</div>
<div style="flex:1;">
<label class="field-label">Roll🦦No.</label>
<input id="detail-roll" type="text" placeholder="e.g. 23641A05K6" />
</div>
</div>
<div class="row">
<div style="flex:1;">
<label class="field-label">Class🕷️</label>
<input id="detail-class" type="text" placeholder="e.g. B.Tech😴 " />
</div>
<div style="flex:1;">
<label class="field-label">Year🌐</label>
<input id="detail-year" type="text" placeholder="e.g. FinalYear" />
</div>
</div>
<div class="row">
<div style="flex:1;">
<label class="field-label">Group</label>
<input id="detail-group" type="text" placeholder="e.g. Group🤢CSE" />
</div>
<div style="flex:1;">
<label class="field-label">Section</label>
<input id="detail-section" type="text" placeholder="e.g. Sec😳D" />
</div>
</div>
<div>
<label class="field-label">College🏢Name</label>
<input id="detail-college" type="text" placeholder="e.g. VAAGDEVI College of Engineering" />
</div>
<div>
<label class="field-label">Faculty💰Name</label>
<input id="detail-faculty" type="text" placeholder="e.g. Dr. ANANTHA👑CHARY SRIRAMOJU GARU" />
</div>
<div>
<label class="field-label">Faculty Email</label>
<input id="detail-faculty-email" type="email" placeholder="e.g. 23641a05k6@vaagdevi.edu.in" />
</div>
<div class="toggle-row">
<input type="checkbox" id="details-strip-toggle" checked />
<label for="details-strip-toggle">Show details strip on the sheet</label>
</div>
<div class="toggle-row">
<input type="checkbox" id="key-highlight-toggle" checked />
<label for="key-highlight-toggle">Highlight key points (==term==)</label>
</div>
</div>
<div class="card card-tools">
<h2>📄 Document💣tools</h2>
<button class="btn btn-ghost" id="copy-btn">Copy Markdown</button>
<button class="btn btn-ghost" id="download-btn">Download .md</button>
</div>
<div class="card card-draft">
<h2>💾Draft</h2>
<p style="font-size:0.7rem; color:var(--muted); margin-top:-4px;">Autosaves as you type, in this browser only. Handy if you accidentally close the tab.</p>
<div class="row">
<button class="btn btn-ghost" id="save-draft-btn" style="flex:1;">Save✅now</button>
<button class="btn btn-ghost" id="load-draft-btn" style="flex:1;">Load🥱saved</button>
</div>
<button class="btn btn-ghost" id="clear-draft-btn">Clear🧮saved♒draft</button>
<div class="status" id="draft-status"></div>
</div>
<div class="card card-submit">
<h2>📤Submit to📝Faculty</h2>
<p style="font-size:0.7rem; color:var(--muted); margin-top:-4px;">Shares the answer sheet straight to your faculty's email — no separate app needed on most phones.</p>
<button class="btn btn-generate" id="submit-faculty-btn" style="width:100%;">Send to🗯️Faculty</button>
<div class="status" id="submit-status"></div>
</div>
<div class="card" style="text-align:center;">
<h2 style="text-align:left;">🙏Yours Contribution💱Towards Ours⚒️Work</h2>
<p style="font-size:0.7rem; color:var(--muted); margin-top:-4px; text-align:left;">If this saved you time, consider supporting it.</p>
<div style="background:#fff; padding:10px; border-radius:10px; display:inline-block; margin:8px 0;">
<img id="upi-qr-img" alt="UPI QR code" width="180" height="180" style="display:block; border-radius:4px;" />
</div>
<div class="row" style="justify-content:center; align-items:center; gap:6px;">
<code id="upi-id-text" style="font-size:0.78rem; color:#e2e8f0; background:#0f1c30; padding:5px 8px; border-radius:5px;">anuasriramoju-2@okaxis</code>
<button class="btn-small" id="copy-upi-btn" type="button">Copy</button>
</div>
<p style="font-size:0.68rem; color:var(--muted); margin-top:6px;">Scan with any⚜️UPI App</p>
</div>
<div class="sidebar-footer">
<p>Built by NIKHIL👑CHARY🌈SRIRAMOJU</p>
<a href="mailto:sriramojunikhil66@gmail.com">✉ sriramojunikhil66@gmail.com</a>
<a href="tel:+916300556301">📞 +91 63005 56301</a>
<a href="https://github.com/Nikhil-creat" target="_blank" rel="noopener">🐙GitHub</a>
<a href="https://in.linkedin.com/in/nikhil-chary-sriramoju-95041b38a" target="_blank" rel="noopener">💼LinkedIn</a>
<a href="https://www.instagram.com/nikhil__sriramoju" target="_blank" rel="noopener">📷Instagram</a>
<a href="https://www.facebook.com/profile.php?id=100079201124141" target="_blank" rel="noopener">👤Facebook</a>
</div>
</aside>
<main class="main">
<div class="topbar">
<div class="view-tabs">
<button class="tab-btn active" data-view="edit">✏️Edit</button>
<button class="tab-btn" data-view="preview">👁Preview</button>
</div>
<div class="topbar-actions">
<div class="view-mode-row">
<button class="mode-btn active" id="mode-system-btn" type="button">🖨 System</button>
<button class="mode-btn" id="mode-handwritten-btn" type="button">✍️ Handwritten</button>
<button class="mode-btn active" id="second-writer-btn" type="button" style="display:none;" title="Alternates in a second handwriting style for later answers, so the sheet never looks like it ran out mid-way">👥 2 Writers</button>
<button class="mode-btn" id="dark-preview-btn" type="button" title="Dark preview (screen only, always prints white)">🌙 Dark</button>
</div>
<div class="hw-size-row" id="hw-size-row">
<span>🔡 Size</span>
<input type="range" id="hw-size-slider" min="0.85" max="1.3" step="0.05" value="1" />
</div>
<button class="btn-small" id="copy-btn-top" style="display:none;">Copy</button>
<button class="btn-small btn-export" onclick="safePrint()">Export to PDF / Print💥</button>
</div>
</div>
<div class="container">
<div class="panel" id="edit-panel">
<div class="panel-title" style="display:flex; align-items:center; justify-content:space-between;">
<span>Markdown🌪️Output</span>
<button class="btn-chip" id="insert-diagram-btn" type="button">➕insert Mermaid diagram</button>
</div>
<textarea id="markdown-input" placeholder="Paste or generate your assignment Markdown here..."></textarea>
</div>
<div class="panel" id="preview-panel">
<div class="panel-title" style="display:flex; align-items:center; justify-content:space-between;">
<span>Answer Sheet👁️🗨️Preview</span>
<span id="preview-stats" style="font-weight:600; color:var(--muted-2); text-transform:none; letter-spacing:normal;"></span>
</div>
<div id="preview-wrap"><div id="preview"></div></div>
</div>
</div>
<div class="bottom-bar">
<button class="btn-print-bottom" onclick="safePrint()">⬇ Export to🦥PDF</button>
</div>
<footer>
<span class="footer-brand">Answer Sheet Studio — for JNTUH B.Tech CSE</span>
<div class="footer-links">
<a class="f-email" href="mailto:sriramojunikhil66@gmail.com">✉Email</a>
<a class="f-call" href="tel:+916300556301">📞 Call</a>
<a class="f-github" href="https://github.com/Nikhil-creat" target="_blank" rel="noopener">🐙GitHub</a>
<a class="f-linkedin" href="https://in.linkedin.com/in/nikhil-chary-sriramoju-95041b38a" target="_blank" rel="noopener">💼LinkedIn</a>
<a class="f-instagram" href="https://www.instagram.com/nikhil__sriramoju" target="_blank" rel="noopener">📷Instagram</a>
<a class="f-facebook" href="https://www.facebook.com/profile.php?id=100079201124141" target="_blank" rel="noopener">👤Facebook</a>
</div>
</footer>
</main>
</div>
<div class="toast-stack" id="toast-stack"></div>
<script>
mermaid.initialize({ startOnLoad: false, theme: 'default' });
const input = document.getElementById('markdown-input');
const detailFields = {
name: document.getElementById('detail-name'),
roll: document.getElementById('detail-roll'),
class: document.getElementById('detail-class'),
year: document.getElementById('detail-year'),
group: document.getElementById('detail-group'),
section: document.getElementById('detail-section'),
college: document.getElementById('detail-college'),
faculty: document.getElementById('detail-faculty'),
};
const detailLabels = {
name: 'Name', roll: 'Roll No.', class: 'Class', year: 'Year',
group: 'Group', section: 'Section', college: 'College', faculty: 'Faculty'
};
const detailsStripToggle = document.getElementById('details-strip-toggle');
const keyHighlightToggle = document.getElementById('key-highlight-toggle');
const preview = document.getElementById('preview');
const previewWrapEl = document.getElementById('preview-wrap');
const modeSystemBtn = document.getElementById('mode-system-btn');
const modeHandwrittenBtn = document.getElementById('mode-handwritten-btn');
const secondWriterBtn = document.getElementById('second-writer-btn');
const darkPreviewBtn = document.getElementById('dark-preview-btn');
const hwSizeRow = document.getElementById('hw-size-row');
const hwSizeSlider = document.getElementById('hw-size-slider');
let useSecondWriterEnabled = true;
// ---- Toast notifications (small feedback for quick actions) ----
const toastStack = document.getElementById('toast-stack');
function showToast(message, type){
const toast = document.createElement('div');
toast.className = 'toast' + (type ? ' ' + type : '');
toast.textContent = message;
toastStack.appendChild(toast);
requestAnimationFrame(() => toast.classList.add('show'));
setTimeout(() => {
toast.classList.remove('show');
setTimeout(() => toast.remove(), 300);
}, 2600);
}
// ---- Sidebar collapse ----
const sidebarEl = document.getElementById('sidebar');
const sidebarCollapseBtn = document.getElementById('sidebar-collapse-btn');
sidebarCollapseBtn.addEventListener('click', () => {
const collapsed = sidebarEl.classList.toggle('collapsed');
sidebarCollapseBtn.textContent = collapsed ? '⟩⟩' : '⟨⟨';
});
// ---- Handwriting size slider ----
function setHandwritingScale(scale){
preview.style.setProperty('--hw-fsize', (1.32 * scale).toFixed(2) + 'rem');
preview.style.setProperty('--hw-line', (2.15 * scale).toFixed(2) + 'em');
}
hwSizeSlider.addEventListener('input', () => setHandwritingScale(parseFloat(hwSizeSlider.value)));
// ---- Dark preview (system mode only, screen-only — print always stays white) ----
darkPreviewBtn.addEventListener('click', () => {
const nowDark = !preview.classList.contains('dark-preview');
preview.classList.toggle('dark-preview', nowDark);
previewWrapEl.classList.toggle('dark-preview', nowDark);
darkPreviewBtn.classList.toggle('active', nowDark);
});
// Splits the rendered answers on their .page-break markers. For every group (answer) it adds:
// - a left-margin "Q<n>" badge in handwritten mode, like a real answer booklet
// - "...continued" labels across a page-break so nothing looks like it cuts off
// - the second handwriting style on every other answer, so if one runs short the
// next (in a visibly different hand) picks up and fills the sheet out
function applyPageLayout(){
preview.querySelectorAll(':scope > .hw-writer-2').forEach(wrapper => {
while (wrapper.firstChild) wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper);
wrapper.remove();
});
preview.querySelectorAll(':scope > .hw-qbadge, :scope > .page-break-label').forEach(el => el.remove());
const isHandwritten = preview.classList.contains('handwritten-mode');
const children = Array.from(preview.children);
let currentGroup = [];
const groups = [];
children.forEach((child) => {
if (child.classList.contains('page-break')) {
if (currentGroup.length) { groups.push(currentGroup); currentGroup = []; }
} else {
currentGroup.push(child);
}
});
if (currentGroup.length) groups.push(currentGroup);
groups.forEach((group, idx) => {
if (!group.length) return;
const anchor = group[0];
const parent = anchor.parentNode;
if (idx > 0) {
const topLabel = document.createElement('div');
topLabel.className = 'page-break-label';
topLabel.textContent = '↑ ...continued from previous page';
parent.insertBefore(topLabel, anchor);
}
if (isHandwritten) {
const badge = document.createElement('div');
badge.className = 'hw-qbadge';
badge.textContent = `Q${idx + 1}`;
parent.insertBefore(badge, anchor);
}
if (idx < groups.length - 1) {
const lastEl = group[group.length - 1];
const bottomLabel = document.createElement('div');
bottomLabel.className = 'page-break-label';
bottomLabel.textContent = 'continued on next page... ↓';
lastEl.parentNode.insertBefore(bottomLabel, lastEl.nextSibling);
}
if (isHandwritten && useSecondWriterEnabled && idx % 2 === 1) {
const wrapper = document.createElement('div');
wrapper.className = 'hw-writer-2';
group[0].parentNode.insertBefore(wrapper, group[0]);
group.forEach(el => wrapper.appendChild(el));
}
});
}
// ---- Live word count / estimated page count ----
const previewStatsEl = document.getElementById('preview-stats');
function updatePreviewStats(){
const text = preview.textContent.trim();
if (!text) { previewStatsEl.textContent = ''; return; }
const words = text.split(/\s+/).filter(Boolean).length;
const perPage = preview.classList.contains('handwritten-mode') ? 230 : 500;
const pages = Math.max(1, Math.ceil(words / perPage));
previewStatsEl.textContent = `~${words} words · ~${pages} page${pages > 1 ? 's' : ''}`;
}
function setOutputMode(mode){
const isHandwritten = mode === 'handwritten';
preview.classList.toggle('handwritten-mode', isHandwritten);
previewWrapEl.classList.toggle('handwritten-mode', isHandwritten);
modeSystemBtn.classList.toggle('active', !isHandwritten);
modeHandwrittenBtn.classList.toggle('active', isHandwritten);
secondWriterBtn.style.display = isHandwritten ? 'inline-block' : 'none';
hwSizeRow.style.display = isHandwritten ? 'flex' : 'none';
darkPreviewBtn.style.display = isHandwritten ? 'none' : 'inline-block';
if (isHandwritten) {
preview.classList.remove('dark-preview');
previewWrapEl.classList.remove('dark-preview');
darkPreviewBtn.classList.remove('active');
}
applyPageLayout();
updatePreviewStats();
}
modeSystemBtn.addEventListener('click', () => setOutputMode('system'));
modeHandwrittenBtn.addEventListener('click', () => setOutputMode('handwritten'));
secondWriterBtn.addEventListener('click', () => {
useSecondWriterEnabled = !useSecondWriterEnabled;
secondWriterBtn.classList.toggle('active', useSecondWriterEnabled);
applyPageLayout();
});
// ---- Draft autosave / load / clear (this browser only) ----
const DRAFT_KEY = 'answer-sheet-draft-v1';
const draftStatusEl = document.getElementById('draft-status');
function collectDraftState(){
return {
markdown: input.value,
details: Object.fromEntries(Object.entries(detailFields).map(([k, el]) => [k, el.value])),
detailsStripOn: detailsStripToggle.checked,
keyHighlightOn: keyHighlightToggle.checked,
savedAt: new Date().toISOString()
};
}
function saveDraft(silent){
try {
localStorage.setItem(DRAFT_KEY, JSON.stringify(collectDraftState()));
if (!silent) {
showToast('Draft saved.', 'ok');
draftStatusEl.textContent = 'Saved just now.';
draftStatusEl.className = 'status ok';
}
} catch (e) {
if (!silent) {
showToast('Could not save draft.', 'error');
draftStatusEl.textContent = 'Save failed — browser storage may be full or disabled.';
draftStatusEl.className = 'status error';
}
}
}
function loadDraft(){
let raw;
try { raw = localStorage.getItem(DRAFT_KEY); } catch (e) { raw = null; }
if (!raw) { showToast('No saved draft found.', 'error'); return; }
try {
const data = JSON.parse(raw);
input.value = data.markdown || '';
Object.entries(data.details || {}).forEach(([k, v]) => { if (detailFields[k]) detailFields[k].value = v; });
if (typeof data.detailsStripOn === 'boolean') detailsStripToggle.checked = data.detailsStripOn;
if (typeof data.keyHighlightOn === 'boolean') keyHighlightToggle.checked = data.keyHighlightOn;
renderPromise = renderDocument();
showToast('Draft restored.', 'ok');
} catch (e) {
showToast('Saved draft was unreadable.', 'error');
}
}
function clearDraft(){
try {
localStorage.removeItem(DRAFT_KEY);
showToast('Saved draft cleared.', 'ok');
draftStatusEl.textContent = '';
draftStatusEl.className = 'status';
} catch (e) {
showToast('Could not clear draft.', 'error');
}
}
document.getElementById('save-draft-btn').addEventListener('click', () => saveDraft(false));
document.getElementById('load-draft-btn').addEventListener('click', loadDraft);
document.getElementById('clear-draft-btn').addEventListener('click', clearDraft);
let autosaveTimer = null;
function scheduleAutosave(){
clearTimeout(autosaveTimer);
autosaveTimer = setTimeout(() => saveDraft(true), 1500);
}
(function checkExistingDraft(){
try {
if (localStorage.getItem(DRAFT_KEY)) {
draftStatusEl.textContent = 'A previously saved draft is available — tap "Load saved" to restore it.';
draftStatusEl.className = 'status';
}
} catch (e) { /* localStorage unavailable — autosave/draft buttons simply won't persist */ }
})();
// ---- Insert a starter Mermaid diagram at the cursor ----
document.getElementById('insert-diagram-btn').addEventListener('click', () => {
const snippet = '\n```mermaid\nflowchart TD\n A[Start] --> B[Step]\n B --> C[End]\n```\n';
const start = input.selectionStart ?? input.value.length;
const end = input.selectionEnd ?? input.value.length;
input.value = input.value.slice(0, start) + snippet + input.value.slice(end);
input.focus();
const newPos = start + snippet.length;
input.setSelectionRange(newPos, newPos);
renderPromise = renderDocument();
scheduleAutosave();
});
// ---- Keyboard shortcut: Ctrl/Cmd + Enter triggers Generate All Answers ----
document.addEventListener('keydown', (e) => {
if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') {
const btn = document.getElementById('generate-btn');
if (btn && !btn.disabled) {
e.preventDefault();
generateAnswer();
}
}
});
function getFilledDetails(){
return Object.entries(detailFields)
.map(([key, el]) => ({ key, label: detailLabels[key], value: el.value.trim() }))
.filter(d => d.value.length > 0);
}
const sampleAssignment = `\`\`\`text
================================================================================
ACADEMIC ASSIGNMENT SUBMISSION
================================================================================
INSTITUTION : Jawaharlal Nehru Technological University, Hyderabad (JNTUH)
DEPARTMENT : Department of Computer Science & Engineering
REGULATION : R18 / R22 Regulation - B.Tech CSE
--------------------------------------------------------------------------------
STUDENT NAME : NIKHIL CHARY SRIRAMOJU ROLL / REG NO : (Your Roll No.23641A05K6)
DEGREE / YEAR : B.Tech CSE / Final Year SEMESTER / SEC: (Semester / Sec)
SUBJECT CODE : (e.g. CS701PE) SUBJECT TITLE : (Subject Title as per JNTUH syllabus)
INSTRUCTOR : (Dr. ANANTHA CHARY SRIRAMOJU GARU) SUBMISSION DATE: October 28, 2026
================================================================================
\`\`\`
# Question 1: Database Normalization (16 Marks)
*As per JNTUH R18/R22 CSE syllabus — Database Management Systems unit on Normalization.*
Explain 1NF, 2NF, 3NF, and BCNF in detail. Provide dependency diagrams and a comparative matrix.
## 1. Executive Overview
Database normalization is a systematic approach of decomposing tables to eliminate data redundancy and undesirable characteristics like Insertion, Update, and Deletion Anomalies.
Submitted by NIKHIL CHARY SRIRAMOJU as part of the final year CSE coursework.
## 2. Shortcut Tricks to Memorize (Exam Recall)
> **Quick mnemonic — "A-P-T-B":** Atomic → Partial gone → Transitive gone → Boyce key only.
> Say it as a chant while revising: *"Atomic values, Partial dependency removed, Transitive dependency removed, Boyce-Codd super key."*
| Form | One-line trick | Ask yourself |
| :--- | :--- | :--- |
| **1NF** | "No repeating groups, no multi-value cells." | Is every cell a single, atomic value? |
| **2NF** | "1NF + no partial dependency on part of a composite key." | Does every non-key column depend on the **whole** key? |
| **3NF** | "2NF + no transitive dependency." | Does a non-key column depend on **another non-key** column instead of the key? |
| **BCNF** | "3NF, but every determinant must itself be a candidate key." | Is there any determinant that is **not** a candidate key? |
==Exam-answer shortcut: state the definition, draw the diagram, then map it to the matrix — examiners reward the diagram + matrix combo.==