-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclassroom.html
More file actions
1913 lines (1761 loc) · 112 KB
/
Copy pathclassroom.html
File metadata and controls
1913 lines (1761 loc) · 112 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>CompTIA A+ · Classroom</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Syne:wght@400;600;700;800&family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
<style>
:root {
--bg:#08090d; --s1:#0e1018; --s2:#13151f; --s3:#1a1d2a;
--b1:#252836; --b2:#2e3245;
--tx:#e8eaf0; --tx2:#9096b0; --tx3:#5a607a;
--acc:#4f9eff; --acc-d:rgba(79,158,255,.08);
--grn:#3dd68c; --grn-d:rgba(61,214,140,.08);
--red:#ff4560; --red-d:rgba(255,69,96,.08);
--amb:#ffb830; --amb-d:rgba(255,184,48,.08);
--pur:#a855f7; --pur-d:rgba(168,85,247,.08);
--gold:#ffd700;
--mono:'Space Mono',monospace; --display:'Syne',sans-serif; --sans:'Inter',sans-serif;
}
*{box-sizing:border-box;margin:0;padding:0}
body{background:var(--bg);color:var(--tx);font-family:var(--sans);min-height:100vh;overflow-x:hidden}
/* ── HEADER ── */
.hdr{display:flex;align-items:center;gap:12px;padding:0 16px;height:52px;background:var(--s1);border-bottom:1px solid var(--b1);position:sticky;top:0;z-index:50}
.hdr-logo{font-family:var(--display);font-size:16px;font-weight:800;color:var(--acc);text-decoration:none}
.hdr-sep{width:1px;height:18px;background:var(--b2)}
.hdr-obj{font-family:var(--mono);font-size:10px;color:var(--tx3);flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hdr-badge{font-family:var(--mono);font-size:9px;padding:3px 10px;border-radius:20px;border:1px solid var(--b2);color:var(--tx3)}
.hdr-badge.live{border-color:var(--grn);color:var(--grn);background:var(--grn-d)}
/* ── TEACHER LAYOUT ── */
.teacher-wrap{display:grid;grid-template-columns:300px 1fr;height:calc(100vh - 52px)}
/* ── TEACHER SIDEBAR ── */
.t-sidebar{background:var(--s1);border-right:1px solid var(--b1);overflow-y:auto;padding:12px 8px;display:flex;flex-direction:column;gap:2px}
.t-section{font-family:var(--mono);font-size:9px;color:var(--tx3);letter-spacing:1.2px;padding:10px 8px 5px;text-transform:uppercase}
.obj-btn{display:flex;align-items:flex-start;gap:8px;padding:8px 10px;border-radius:7px;border:none;background:transparent;cursor:pointer;width:100%;text-align:left;transition:all .12s;color:var(--tx2)}
.obj-btn:hover{background:var(--s2);color:var(--tx)}
.obj-btn.active{background:var(--acc-d);border:1px solid var(--acc);color:var(--acc)}
.obj-btn-id{font-family:var(--mono);font-size:11px;font-weight:700;min-width:40px;flex-shrink:0;padding-top:1px}
.obj-btn-title{font-size:11px;line-height:1.4}
.domain-divider{height:1px;background:var(--b1);margin:6px 4px}
/* ── TEACHER MAIN ── */
.t-main{overflow-y:auto;padding:20px;background:var(--bg)}
/* ── OBJECTIVE BANNER ── */
.obj-banner{background:linear-gradient(135deg,rgba(79,158,255,.07),rgba(168,85,247,.04));border:1px solid var(--b1);border-radius:12px;padding:16px 20px;margin-bottom:16px;display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.obj-banner-id{font-family:var(--mono);font-size:28px;font-weight:700}
.obj-banner-title{font-family:var(--display);font-size:16px;font-weight:700;color:var(--tx);margin-bottom:3px}
.obj-banner-meta{font-family:var(--mono);font-size:9px;color:var(--tx3)}
/* ── PHASE GRID (teacher one-click) ── */
.phase-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:8px;margin-bottom:16px}
.phase-card{border-radius:10px;border:2px solid var(--b2);background:var(--s2);padding:14px 8px;text-align:center;cursor:pointer;transition:all .18s}
.phase-card:hover{border-color:var(--b2);background:var(--s3);transform:translateY(-2px)}
.phase-card.active{transform:translateY(-2px)}
.phase-card-icon{font-size:24px;margin-bottom:5px}
.phase-card-label{font-family:var(--display);font-size:9px;font-weight:800;text-transform:uppercase;letter-spacing:.5px}
.phase-card-sub{font-family:var(--mono);font-size:8px;color:var(--tx3);margin-top:3px}
.phase-card-time{font-family:var(--mono);font-size:8px;margin-top:2px}
/* ── LIVE DISCUSSION ── */
.disc-input{width:100%;background:var(--s2);border:1.5px solid var(--b2);border-radius:8px;padding:10px 14px;color:var(--tx);font-size:13px;outline:none;font-family:var(--sans);transition:border-color .2s}
.disc-input:focus{border-color:var(--amb)}
/* ── STUDENT LAYOUT ── */
.student-wrap{max-width:800px;margin:0 auto;padding:20px}
/* ── WAITING SCREEN ── */
.waiting{text-align:center;padding:80px 20px}
.waiting-icon{font-size:64px;margin-bottom:16px}
.waiting-title{font-family:var(--display);font-size:28px;font-weight:900;color:var(--tx);margin-bottom:8px}
.waiting-sub{font-size:14px;color:var(--tx2);line-height:1.8;max-width:340px;margin:0 auto 24px}
.pulse{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--grn);animation:pulse 1.5s infinite}
@keyframes pulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.4;transform:scale(.7)}}
/* ── PHASE HEADER ── */
.phase-hdr{display:flex;align-items:center;gap:12px;padding:12px 16px;border-radius:10px;margin-bottom:18px;border:1px solid var(--b1)}
.phase-hdr-icon{font-size:28px}
.phase-hdr-label{font-family:var(--display);font-size:17px;font-weight:800;text-transform:uppercase;letter-spacing:.5px}
.phase-hdr-desc{font-size:12px;margin-top:2px}
/* ── CARDS ── */
.card{background:var(--s2);border:1px solid var(--b1);border-radius:12px;overflow:hidden;margin-bottom:14px}
.card-hdr{padding:13px 18px;border-bottom:1px solid var(--b1);display:flex;align-items:center;gap:10px}
.card-title{font-family:var(--display);font-size:14px;font-weight:700}
.card-body{padding:18px}
/* ── INCIDENT BOX ── */
.incident{background:linear-gradient(135deg,rgba(255,69,96,.06),rgba(79,158,255,.04));border:1px solid var(--red);border-radius:12px;padding:18px;margin-bottom:14px}
.incident-label{font-family:var(--mono);font-size:9px;color:var(--red);letter-spacing:1px;margin-bottom:8px}
.incident-text{font-size:15px;line-height:1.85;color:var(--tx);font-style:italic;margin-bottom:12px}
/* ── KEY TERMS ── */
.terms-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:8px}
.term{background:var(--s3);border:1px solid var(--b1);border-radius:8px;padding:10px 12px}
.term-name{font-family:var(--mono);font-size:10px;color:var(--acc);font-weight:700;margin-bottom:3px}
.term-def{font-size:11px;color:var(--tx2);line-height:1.6}
.term-ex{font-size:10px;color:var(--acc);margin-top:3px;font-family:var(--mono)}
/* ── EXAM TRAPS ── */
.trap{background:var(--red-d);border:1px solid var(--red);border-radius:8px;padding:9px 13px;font-size:12px;color:var(--tx);margin-bottom:6px;line-height:1.6}
/* ── TERMINAL ── */
.terminal-wrap{background:var(--bg);border:1px solid var(--b1);border-radius:12px;overflow:hidden}
.terminal-bar{background:var(--s3);padding:9px 14px;border-bottom:1px solid var(--b1);display:flex;align-items:center;gap:6px}
.terminal-dot{width:10px;height:10px;border-radius:50%}
.terminal-body{font-family:var(--mono);font-size:12px;padding:14px;min-height:180px;max-height:300px;overflow-y:auto;background:#0a0c0a;line-height:1.7}
.terminal-out{color:#9ab8a0;white-space:pre-wrap;padding:1px 0}
.terminal-out.err{color:#ff6b7a}
.terminal-out.ok{color:#3dd68c}
.terminal-in-row{display:flex;gap:8px;padding:2px 0}
.t-prompt{color:#3dd68c;flex-shrink:0}
.terminal-input{background:transparent;border:none;outline:none;color:#d4ffb4;font-family:var(--mono);font-size:12px;flex:1;caret-color:#3dd68c}
.terminal-input-bar{background:#0a0c0a;padding:8px 14px;border-top:1px solid #1a2a1a;display:flex;gap:8px;align-items:center}
/* ── QUIZ ── */
.q-block{background:var(--s2);border:1px solid var(--b1);border-radius:12px;padding:16px;margin-bottom:10px}
.q-text{font-size:14px;font-weight:500;color:var(--tx);line-height:1.7;margin-bottom:12px}
.q-opts{display:flex;flex-direction:column;gap:6px}
.q-opt{display:flex;align-items:flex-start;gap:10px;padding:10px 13px;border-radius:8px;border:1px solid var(--b1);cursor:pointer;background:var(--s3);font-size:13px;color:var(--tx2);transition:all .14s;user-select:none}
.q-opt:hover:not(.locked){border-color:var(--b2);color:var(--tx)}
.q-opt.correct{border-color:var(--grn)!important;background:var(--grn-d)!important;color:var(--tx)!important}
.q-opt.wrong{border-color:var(--red)!important;background:var(--red-d)!important}
.q-opt.faded{opacity:.4}
.q-opt.locked{cursor:default}
.q-ltr{font-family:var(--mono);font-size:10px;font-weight:700;color:var(--tx3);min-width:16px;margin-top:1px}
.q-rat{display:none;font-size:11px;color:var(--tx3);padding:8px 12px;background:var(--s3);border-radius:6px;margin-top:8px;line-height:1.6}
.q-rat.show{display:block}
/* ── NOTES ── */
.notes-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.note-field{background:var(--s3);border:1px solid var(--b2);border-radius:8px;padding:10px 12px}
.note-label{font-family:var(--mono);font-size:9px;color:var(--grn);letter-spacing:1px;text-transform:uppercase;margin-bottom:6px}
.note-ta{width:100%;background:transparent;border:none;outline:none;color:var(--tx);font-family:var(--sans);font-size:12px;resize:none;min-height:70px;line-height:1.7}
/* ── REFLECTION (post-quiz) ── */
.reflection-panel{background:linear-gradient(135deg,rgba(168,85,247,.07),rgba(79,158,255,.04));border:1.5px solid var(--pur);border-radius:12px;padding:20px;margin-top:20px;animation:slideUp .4s ease}
@keyframes slideUp{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
.refl-title{font-family:var(--display);font-size:15px;font-weight:800;color:var(--pur);text-transform:uppercase;letter-spacing:.5px;margin-bottom:4px}
.refl-sub{font-size:12px;color:var(--tx2);margin-bottom:16px;line-height:1.6}
.emoji-row{display:flex;gap:8px;margin-bottom:16px;flex-wrap:wrap}
.emoji-btn{display:flex;flex-direction:column;align-items:center;gap:4px;padding:10px 14px;border-radius:8px;border:1.5px solid var(--b2);background:var(--s3);cursor:pointer;transition:all .14s;flex:1;min-width:60px}
.emoji-btn:hover{border-color:var(--pur);background:var(--pur-d)}
.emoji-btn.sel{border-color:var(--pur);background:var(--pur-d)}
.emoji-btn span:first-child{font-size:24px}
.emoji-btn span:last-child{font-family:var(--mono);font-size:8px;color:var(--tx3);letter-spacing:.3px;text-align:center}
.emoji-btn.sel span:last-child{color:var(--pur)}
.check-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-bottom:14px}
.check-item{display:flex;align-items:center;gap:8px;padding:8px 12px;border-radius:8px;border:1.5px solid var(--b2);background:var(--s3);cursor:pointer;font-size:12px;color:var(--tx2);transition:all .14s;user-select:none}
.check-item:hover{border-color:var(--acc)}
.check-item.sel{border-color:var(--grn);background:var(--grn-d);color:var(--tx)}
.check-box{width:15px;height:15px;border-radius:4px;border:1.5px solid var(--b2);flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:9px;transition:all .14s}
.check-item.sel .check-box{background:var(--grn);border-color:var(--grn);color:var(--bg)}
.refl-textarea{width:100%;background:var(--s2);border:1.5px solid var(--b2);border-radius:8px;padding:10px 13px;color:var(--tx);font-family:var(--sans);font-size:12px;resize:none;outline:none;min-height:68px;line-height:1.7;margin-bottom:12px;transition:border-color .2s}
.refl-textarea:focus{border-color:var(--pur)}
.refl-done{text-align:center;padding:20px}
.refl-done-icon{font-size:40px;margin-bottom:8px}
.refl-done-title{font-family:var(--display);font-size:15px;font-weight:800;color:var(--grn);margin-bottom:4px}
.refl-done-sub{font-size:12px;color:var(--tx2);line-height:1.7}
/* ── ONBOARDING ── */
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.85);backdrop-filter:blur(8px);z-index:2000;display:none;align-items:center;justify-content:center;padding:16px}
.modal-overlay.open{display:flex}
.modal-box{background:var(--s1);border:1px solid var(--b2);border-radius:16px;padding:28px;width:500px;max-width:100%;max-height:90vh;overflow-y:auto}
.modal-title{font-family:var(--display);font-size:22px;font-weight:900;letter-spacing:-.5px;margin-bottom:6px}
.modal-sub{font-size:13px;color:var(--tx2);line-height:1.7;margin-bottom:18px}
.interest-chips{display:flex;flex-wrap:wrap;gap:7px;margin-bottom:14px}
.i-chip{padding:7px 13px;border-radius:20px;border:1.5px solid var(--b2);font-size:12px;color:var(--tx3);cursor:pointer;transition:all .14s;user-select:none}
.i-chip:hover{border-color:var(--acc);color:var(--acc)}
.i-chip.sel{border-color:var(--acc);color:var(--acc);background:var(--acc-d)}
.career-chips{display:flex;flex-wrap:wrap;gap:7px;margin-bottom:18px}
.c-chip{padding:7px 13px;border-radius:20px;border:1.5px solid var(--b2);font-size:12px;color:var(--tx3);cursor:pointer;transition:all .14s;user-select:none}
.c-chip.sel{border-color:var(--grn);color:var(--grn);background:var(--grn-d)}
.field-label{font-family:var(--mono);font-size:9px;color:var(--tx3);letter-spacing:1px;text-transform:uppercase;margin-bottom:6px}
.text-input{width:100%;background:var(--s2);border:1.5px solid var(--b2);border-radius:8px;padding:10px 13px;color:var(--tx);font-size:13px;outline:none;margin-bottom:14px;transition:border-color .2s;font-family:var(--sans)}
.text-input:focus{border-color:var(--acc)}
/* LS Quiz */
.ls-progress{display:flex;gap:3px;margin-bottom:14px}
.ls-dot{height:3px;flex:1;border-radius:2px;background:var(--b2);transition:background .2s}
.ls-dot.done{background:var(--acc)}
.ls-dot.cur{background:var(--acc);opacity:.6}
.ls-q{font-size:15px;font-weight:600;color:var(--tx);line-height:1.65;margin-bottom:14px}
.ls-opts{display:flex;flex-direction:column;gap:7px}
.ls-opt{padding:12px 15px;border-radius:8px;border:1.5px solid var(--b2);background:var(--s2);font-size:13px;color:var(--tx2);cursor:pointer;transition:all .14s;user-select:none}
.ls-opt:hover{border-color:var(--acc);color:var(--tx)}
.ls-opt.sel{border-color:var(--acc);color:var(--acc);background:var(--acc-d)}
/* Result screen */
.result-box{background:var(--acc-d);border:1px solid var(--acc);border-radius:10px;padding:14px;margin-bottom:10px}
.result-box.sec{background:var(--s2);border-color:var(--b1)}
/* ── BUTTONS ── */
.btn{display:inline-flex;align-items:center;gap:6px;padding:9px 20px;border-radius:8px;border:none;cursor:pointer;font-family:var(--display);font-size:12px;font-weight:700;letter-spacing:.5px;text-transform:uppercase;transition:all .15s;text-decoration:none}
.btn-acc{background:var(--acc);color:var(--bg)}
.btn-grn{background:var(--grn);color:var(--bg)}
.btn-ghost{background:transparent;border:1px solid var(--b2);color:var(--tx2)}
.btn-ghost:hover{background:var(--s3);color:var(--tx)}
.btn-sm{padding:6px 14px;font-size:10px}
.btn-lg{padding:12px 30px;font-size:14px}
.btn-full{width:100%;justify-content:center}
/* ── LOADING ── */
.loading-bar{height:2px;background:linear-gradient(90deg,var(--acc),var(--pur));border-radius:1px;animation:lb 1.5s ease-in-out infinite;margin-bottom:12px}
@keyframes lb{0%{width:0;opacity:1}70%{width:100%;opacity:1}100%{width:100%;opacity:0}}
.loading-txt{font-family:var(--mono);font-size:11px;color:var(--tx3);animation:blink 1s infinite}
@keyframes blink{0%,100%{opacity:1}50%{opacity:.4}}
/* ── TAGS ── */
.tag{display:inline-flex;align-items:center;padding:3px 10px;border-radius:20px;font-family:var(--mono);font-size:9px;font-weight:700;letter-spacing:.8px;text-transform:uppercase}
.tag-acc{background:var(--acc-d);color:var(--acc);border:1px solid var(--acc)}
.tag-grn{background:var(--grn-d);color:var(--grn);border:1px solid var(--grn)}
.tag-red{background:var(--red-d);color:var(--red);border:1px solid var(--red)}
.tag-amb{background:var(--amb-d);color:var(--amb);border:1px solid var(--amb)}
.tag-pur{background:var(--pur-d);color:var(--pur);border:1px solid var(--pur)}
/* ── SCORE HERO ── */
.score-hero{text-align:center;padding:28px 20px}
.score-num{font-family:var(--display);font-size:72px;font-weight:900;line-height:1}
.score-label{font-family:var(--mono);font-size:11px;color:var(--tx3);margin-top:4px;letter-spacing:.8px}
/* ── TEACHER FIXED BADGE ── */
#teacherLoginBtn,#teacherModeBadge{position:fixed;bottom:20px;left:20px;z-index:9999;cursor:pointer;display:flex;align-items:center;gap:6px;background:rgba(8,9,13,.97);border:1.5px solid var(--gold);border-radius:20px;padding:8px 16px;font-family:var(--mono);font-size:10px;font-weight:700;color:var(--gold);backdrop-filter:blur(12px)}
#teacherModeBadge{display:none}
#helpBtn{position:fixed;bottom:20px;right:20px;z-index:9999;cursor:pointer;display:flex;align-items:center;gap:6px;background:rgba(8,9,13,.97);border:1.5px solid var(--amb);border-radius:20px;padding:8px 16px;font-family:var(--mono);font-size:10px;font-weight:700;color:var(--amb);backdrop-filter:blur(12px);transition:all .2s}
#streakPill{font-family:var(--mono);font-size:9px;color:var(--amb);background:var(--amb-d);border:1px solid var(--amb);border-radius:20px;padding:3px 10px}
/* ── TEACHER PIN MODAL ── */
#teacherModal{z-index:99999!important}
.pin-input{background:var(--s2);border:1.5px solid var(--b2);border-radius:8px;padding:12px 20px;color:var(--tx);font-family:var(--mono);font-size:22px;letter-spacing:8px;text-align:center;width:180px;outline:none;transition:border-color .2s}
.pin-input:focus{border-color:var(--acc)}
/* ── TOAST ── */
.toast-wrap{position:fixed;bottom:24px;right:24px;z-index:99999;display:flex;flex-direction:column;gap:8px}
.toast{padding:9px 16px;border-radius:8px;font-family:var(--mono);font-size:11px;animation:toastIn .2s;max-width:280px}
.toast.ok{background:var(--grn-d);border:1px solid var(--grn);color:var(--grn)}
.toast.err{background:var(--red-d);border:1px solid var(--red);color:var(--red)}
.toast.info{background:var(--acc-d);border:1px solid var(--acc);color:var(--acc)}
@keyframes toastIn{from{transform:translateY(8px);opacity:0}to{transform:none;opacity:1}}
/* ── STEP TRACKER ── */
.steps{display:flex;flex-direction:column;gap:8px}
.step{display:flex;gap:10px;align-items:flex-start}
.step-num{width:22px;height:22px;border-radius:50%;border:1px solid var(--b2);display:flex;align-items:center;justify-content:center;font-family:var(--mono);font-size:9px;color:var(--tx3);flex-shrink:0}
.step-num.done{background:var(--grn-d);border-color:var(--grn);color:var(--grn)}
.step-txt{font-size:12px;color:var(--tx2);line-height:1.6;padding-top:2px}
::-webkit-scrollbar{width:4px}::-webkit-scrollbar-track{background:var(--s1)}::-webkit-scrollbar-thumb{background:var(--b2);border-radius:2px}
@media(max-width:768px){.teacher-wrap{grid-template-columns:1fr}.t-sidebar{display:none}.notes-grid{grid-template-columns:1fr}.check-grid{grid-template-columns:1fr}}
</style>
</head>
<body>
<!-- TOAST CONTAINER -->
<div class="toast-wrap" id="toastWrap"></div>
<!-- TEACHER PIN MODAL -->
<div class="modal-overlay" id="teacherModal">
<div class="modal-box" style="max-width:380px;text-align:center">
<div style="font-size:48px;margin-bottom:10px">🔑</div>
<div class="modal-title">Teacher Access</div>
<div class="modal-sub">Enter your PIN to access classroom controls</div>
<input type="password" class="pin-input" id="pinInput" maxlength="8" placeholder="····" onkeydown="if(event.key==='Enter')checkPin()">
<div id="pinErr" style="font-family:var(--mono);font-size:11px;color:var(--red);min-height:18px;margin:8px 0"></div>
<div style="display:flex;flex-direction:column;gap:8px;margin-top:8px">
<button class="btn btn-acc btn-full" onclick="checkPin()">Unlock →</button>
<button class="btn btn-ghost btn-sm btn-full" onclick="closeModal('teacherModal')">Back to Student View</button>
</div>
</div>
</div>
<!-- ONBOARDING: INTERESTS -->
<div class="modal-overlay" id="interestsModal">
<div class="modal-box">
<div style="text-align:center;margin-bottom:16px">
<div style="font-size:44px;margin-bottom:10px">🎯</div>
<div class="modal-title">What are you into?</div>
<div class="modal-sub">Claude uses your interests to make IT concepts click — better examples, better analogies, more relevant content.</div>
</div>
<div class="field-label">Pick everything that applies (choose at least 2)</div>
<div class="interest-chips" id="iChips"></div>
<div class="field-label">Anything else?</div>
<input id="iCustom" class="text-input" placeholder="e.g. anime, cars, cooking, skateboarding…">
<div class="field-label">What IT career sounds coolest to you?</div>
<div class="career-chips" id="cChips"></div>
<div style="display:flex;gap:8px;justify-content:flex-end">
<button class="btn btn-ghost btn-sm" onclick="skipOnboarding()">Skip</button>
<button class="btn btn-acc" onclick="saveInterests()">Next: Learning Style →</button>
</div>
</div>
</div>
<!-- ONBOARDING: LEARNING STYLE -->
<div class="modal-overlay" id="lsModal">
<div class="modal-box">
<div style="text-align:center;margin-bottom:16px">
<div style="font-size:44px;margin-bottom:10px">🧠</div>
<div class="modal-title">How do you learn best?</div>
<div class="modal-sub">8 quick questions · No wrong answers · Takes 2 minutes</div>
</div>
<div class="ls-progress" id="lsProgress"></div>
<div id="lsBody"></div>
<div style="display:flex;justify-content:space-between;align-items:center;margin-top:14px">
<div id="lsCount" style="font-family:var(--mono);font-size:10px;color:var(--tx3)">Question 1 of 8</div>
<div style="display:flex;gap:8px">
<button class="btn btn-ghost btn-sm" id="lsBackBtn" onclick="lsNav(-1)" style="display:none">← Back</button>
<button class="btn btn-acc btn-sm" id="lsNextBtn" onclick="lsNav(1)">Next →</button>
</div>
</div>
</div>
</div>
<!-- ONBOARDING: DONE -->
<div class="modal-overlay" id="doneModal">
<div class="modal-box" style="text-align:center;max-width:420px">
<div style="font-size:56px;margin-bottom:14px">🚀</div>
<div class="modal-title">You're all set!</div>
<div id="doneSummary" class="modal-sub"></div>
<button class="btn btn-acc btn-lg btn-full" onclick="closeModal('doneModal')">Start Learning →</button>
</div>
</div>
<!-- TEACHER FIXED BUTTON -->
<div id="teacherLoginBtn" onclick="openTeacherLogin()">🔑 Teacher Login</div>
<div id="teacherModeBadge" onclick="exitTeacher()">👨🏫 Teacher Mode · Exit</div>
<!-- HEADER -->
<header class="hdr">
<a href="hub.html" class="hdr-logo">A+</a>
<div class="hdr-sep"></div>
<div class="hdr-obj" id="hdrObj">No objective selected</div>
<span id="streakDisplay"></span>
<div class="hdr-badge" id="hdrPhase">Classroom</div>
</header>
<!-- TEACHER VIEW -->
<div id="tvTeacher" style="display:none">
<div class="teacher-wrap">
<!-- SIDEBAR: Objective selector -->
<div class="t-sidebar" id="tSidebar">
<div class="t-section">Core 1 · 220-1201</div>
<div id="objList1201"></div>
<div class="domain-divider"></div>
<div class="t-section">Core 2 · 220-1202</div>
<div id="objList1202"></div>
</div>
<!-- MAIN: Phase controls + discussion -->
<div class="t-main" id="tMain">
<div style="text-align:center;padding:60px 20px" id="tNoObj">
<div style="font-size:52px;margin-bottom:14px">📚</div>
<div style="font-family:var(--display);font-size:22px;font-weight:800;color:var(--tx);margin-bottom:8px">Select a lesson</div>
<div style="font-size:13px;color:var(--tx2);line-height:1.8;max-width:360px;margin:0 auto">Click any objective from the left sidebar. Then click a phase to push it to all student screens instantly.</div>
<div style="font-family:var(--mono);font-size:10px;color:var(--tx3);margin-top:16px">Keyboard shortcuts: 1–6 push phases · E ends class</div>
</div>
<div id="tControls" style="display:none"></div>
</div>
</div>
</div>
<!-- STUDENT VIEW -->
<div id="tvStudent">
<div class="student-wrap">
<div id="studentDisplay">
<div class="waiting">
<div class="waiting-icon">📡</div>
<div class="waiting-title">Waiting for class</div>
<div class="waiting-sub">Your teacher will push each activity to your screen. Just wait here — you don't need to navigate.</div>
<div style="font-family:var(--mono);font-size:11px;color:var(--tx3);display:flex;align-items:center;justify-content:center;gap:8px">
<div class="pulse"></div> Connected
</div>
</div>
</div>
</div>
</div>
<script>
// ══════════════════════════════════════════════════════════
// OBJECTIVES DATA
// ══════════════════════════════════════════════════════════
const OBJECTIVES = {
'1.1':{exam:'1201',domain:'1.0 Mobile Devices',weight:'13%',title:'Monitor mobile device hardware and replacement techniques'},
'1.2':{exam:'1201',domain:'1.0 Mobile Devices',weight:'13%',title:'Compare/contrast accessories and connectivity for mobile devices'},
'1.3':{exam:'1201',domain:'1.0 Mobile Devices',weight:'13%',title:'Configure mobile device network connectivity and application support'},
'2.1':{exam:'1201',domain:'2.0 Networking',weight:'23%',title:'TCP/UDP ports, protocols, and their purposes'},
'2.2':{exam:'1201',domain:'2.0 Networking',weight:'23%',title:'Explain wireless networking technologies'},
'2.3':{exam:'1201',domain:'2.0 Networking',weight:'23%',title:'Summarize services provided by networked hosts'},
'2.4':{exam:'1201',domain:'2.0 Networking',weight:'23%',title:'Explain common network configuration concepts'},
'2.5':{exam:'1201',domain:'2.0 Networking',weight:'23%',title:'Compare/contrast common networking hardware devices'},
'2.6':{exam:'1201',domain:'2.0 Networking',weight:'23%',title:'Configure basic wired/wireless SOHO networks'},
'2.7':{exam:'1201',domain:'2.0 Networking',weight:'23%',title:'Internet connection types and network types'},
'2.8':{exam:'1201',domain:'2.0 Networking',weight:'23%',title:'Explain networking tools and their purposes'},
'3.1':{exam:'1201',domain:'3.0 Hardware',weight:'25%',title:'Compare/contrast display components and attributes'},
'3.2':{exam:'1201',domain:'3.0 Hardware',weight:'25%',title:'Summarize basic cable types, connectors, features, and purposes'},
'3.3':{exam:'1201',domain:'3.0 Hardware',weight:'25%',title:'Compare/contrast RAM characteristics'},
'3.4':{exam:'1201',domain:'3.0 Hardware',weight:'25%',title:'Compare/contrast storage devices'},
'3.5':{exam:'1201',domain:'3.0 Hardware',weight:'25%',title:'Install and configure motherboards, CPUs, and add-on cards'},
'3.6':{exam:'1201',domain:'3.0 Hardware',weight:'25%',title:'Install the appropriate power supply'},
'3.7':{exam:'1201',domain:'3.0 Hardware',weight:'25%',title:'Deploy and configure multifunction devices/printers'},
'3.8':{exam:'1201',domain:'3.0 Hardware',weight:'25%',title:'Perform appropriate printer maintenance'},
'4.1':{exam:'1201',domain:'4.0 Virtualization & Cloud',weight:'11%',title:'Explain virtualization concepts'},
'4.2':{exam:'1201',domain:'4.0 Virtualization & Cloud',weight:'11%',title:'Summarize cloud computing concepts'},
'5.1':{exam:'1201',domain:'5.0 HW & Network Troubleshooting',weight:'28%',title:'Troubleshoot motherboards, RAM, CPUs, and power'},
'5.2':{exam:'1201',domain:'5.0 HW & Network Troubleshooting',weight:'28%',title:'Troubleshoot drive and RAID issues'},
'5.3':{exam:'1201',domain:'5.0 HW & Network Troubleshooting',weight:'28%',title:'Troubleshoot video, projector, and display issues'},
'5.4':{exam:'1201',domain:'5.0 HW & Network Troubleshooting',weight:'28%',title:'Troubleshoot common mobile device issues'},
'5.5':{exam:'1201',domain:'5.0 HW & Network Troubleshooting',weight:'28%',title:'Troubleshoot network issues'},
'5.6':{exam:'1201',domain:'5.0 HW & Network Troubleshooting',weight:'28%',title:'Troubleshoot printer issues'},
'C1.1':{exam:'1202',domain:'1.0 Operating Systems',weight:'28%',title:'Explain common OS types and their purposes'},
'C1.2':{exam:'1202',domain:'1.0 Operating Systems',weight:'28%',title:'Perform OS installations and upgrades'},
'C1.3':{exam:'1202',domain:'1.0 Operating Systems',weight:'28%',title:'Compare/contrast Microsoft Windows editions'},
'C1.4':{exam:'1202',domain:'1.0 Operating Systems',weight:'28%',title:'Use Microsoft Windows OS features and tools'},
'C1.5':{exam:'1202',domain:'1.0 Operating Systems',weight:'28%',title:'Use the appropriate Microsoft command-line tools'},
'C1.6':{exam:'1202',domain:'1.0 Operating Systems',weight:'28%',title:'Configure Microsoft Windows settings'},
'C1.7':{exam:'1202',domain:'1.0 Operating Systems',weight:'28%',title:'Configure Windows networking features on a client'},
'C1.8':{exam:'1202',domain:'1.0 Operating Systems',weight:'28%',title:'Explain common features and tools of macOS'},
'C1.9':{exam:'1202',domain:'1.0 Operating Systems',weight:'28%',title:'Identify common features and tools of Linux'},
'C1.10':{exam:'1202',domain:'1.0 Operating Systems',weight:'28%',title:'Install applications according to requirements'},
'C1.11':{exam:'1202',domain:'1.0 Operating Systems',weight:'28%',title:'Install and configure cloud-based productivity tools'},
'C2.1':{exam:'1202',domain:'2.0 Security',weight:'28%',title:'Summarize various security measures and their purposes'},
'C2.2':{exam:'1202',domain:'2.0 Security',weight:'28%',title:'Configure and apply basic Windows OS security settings'},
'C2.3':{exam:'1202',domain:'2.0 Security',weight:'28%',title:'Compare/contrast wireless security protocols'},
'C2.4':{exam:'1202',domain:'2.0 Security',weight:'28%',title:'Summarize types of malware and detection/removal'},
'C2.5':{exam:'1202',domain:'2.0 Security',weight:'28%',title:'Compare/contrast social engineering attacks and threats'},
'C2.6':{exam:'1202',domain:'2.0 Security',weight:'28%',title:'Implement procedures for basic SOHO malware removal'},
'C2.7':{exam:'1202',domain:'2.0 Security',weight:'28%',title:'Apply workstation security and hardening techniques'},
'C2.8':{exam:'1202',domain:'2.0 Security',weight:'28%',title:'Apply common methods for securing mobile devices'},
'C2.9':{exam:'1202',domain:'2.0 Security',weight:'28%',title:'Compare/contrast data destruction and disposal methods'},
'C2.10':{exam:'1202',domain:'2.0 Security',weight:'28%',title:'Apply security settings on SOHO wireless and wired networks'},
'C2.11':{exam:'1202',domain:'2.0 Security',weight:'28%',title:'Configure relevant security settings in a browser'},
'C3.1':{exam:'1202',domain:'3.0 Software Troubleshooting',weight:'23%',title:'Troubleshoot common Windows OS issues'},
'C3.2':{exam:'1202',domain:'3.0 Software Troubleshooting',weight:'23%',title:'Troubleshoot common mobile OS and application issues'},
'C3.3':{exam:'1202',domain:'3.0 Software Troubleshooting',weight:'23%',title:'Troubleshoot common mobile OS security issues'},
'C3.4':{exam:'1202',domain:'3.0 Software Troubleshooting',weight:'23%',title:'Troubleshoot common PC security issues'},
'C4.1':{exam:'1202',domain:'4.0 Operational Procedures',weight:'21%',title:'Implement best practices for documentation and support systems'},
'C4.2':{exam:'1202',domain:'4.0 Operational Procedures',weight:'21%',title:'Apply change management procedures'},
'C4.3':{exam:'1202',domain:'4.0 Operational Procedures',weight:'21%',title:'Implement workstation backup and recovery methods'},
'C4.4':{exam:'1202',domain:'4.0 Operational Procedures',weight:'21%',title:'Use common safety procedures'},
'C4.5':{exam:'1202',domain:'4.0 Operational Procedures',weight:'21%',title:'Summarize environmental impacts and controls'},
'C4.6':{exam:'1202',domain:'4.0 Operational Procedures',weight:'21%',title:'Explain prohibited content/activity, privacy, licensing, and policy'},
'C4.7':{exam:'1202',domain:'4.0 Operational Procedures',weight:'21%',title:'Use proper communication techniques and professionalism'},
'C4.8':{exam:'1202',domain:'4.0 Operational Procedures',weight:'21%',title:'Explain the basics of scripting'},
'C4.9':{exam:'1202',domain:'4.0 Operational Procedures',weight:'21%',title:'Use remote access technologies'},
'C4.10':{exam:'1202',domain:'4.0 Operational Procedures',weight:'21%',title:'Explain basic concepts related to artificial intelligence'},
};
const CLASS_PHASES = [
{id:'cold', icon:'❄️', label:'Cold Retrieval', sub:'Review past objectives', time:'5 min', color:'var(--acc)'},
{id:'hook', icon:'🚨', label:'Hook', sub:'Real-world incident', time:'5 min', color:'var(--red)'},
{id:'lesson',icon:'📖', label:'Concept Brief', sub:'Read + key terms', time:'10 min', color:'var(--pur)'},
{id:'lab', icon:'🔬', label:'Sandbox Lab', sub:'Hands-on practice', time:'15 min', color:'var(--grn)'},
{id:'disc', icon:'💬', label:'Discussion', sub:'Live questions', time:'10 min', color:'var(--amb)'},
{id:'quiz', icon:'⏱', label:'Closing Quiz', sub:'5 graded questions', time:'5 min', color:'var(--red)'},
];
// ══════════════════════════════════════════════════════════
// STATE
// ══════════════════════════════════════════════════════════
const ST = { isTeacher:false, objId:null, code:null, currentPhase:null };
let contentCache = {};
let pollTimer = null;
let lastPhase = null;
let lastDiscTs = '0';
let discPushTimer = null;
let quizAnswers = {};
let quizTimerInterval = null;
let reflState = {rating:null, helped:new Set(), confused:new Set()};
// ══════════════════════════════════════════════════════════
// INIT
// ══════════════════════════════════════════════════════════
function init() {
if (!localStorage.getItem('teacher_pin')) localStorage.setItem('teacher_pin','1529');
// Load student code
try { ST.code = JSON.parse(localStorage.getItem('PLATFORM_CODE')); } catch(e){}
// Check teacher auth (persists across page navigations in same session)
ST.isTeacher = localStorage.getItem('teacher_unlocked')==='true'
|| sessionStorage.getItem('teacher_unlocked')==='true';
// Load objective from localStorage (teacher may have set it from library)
try {
const obj = JSON.parse(localStorage.getItem('class_objective')||'{}');
if (obj.id) { ST.objId = obj.id; updateHdrObj(); }
} catch(e){}
// Streak
updateStreak();
if (ST.isTeacher) {
enterTeacherMode(false);
} else {
// Student: check onboarding
checkStudentOnboarding();
buildHelpButton();
startPolling();
// Check if class is already in a phase
const phase = localStorage.getItem('class_current_phase');
if (phase) renderStudentPhase(phase);
}
// Keyboard shortcut T
document.addEventListener('keydown', e => {
if (['INPUT','TEXTAREA'].includes(document.activeElement.tagName)) return;
if ((e.key==='T'||e.key==='t') && !ST.isTeacher) openTeacherLogin();
if (ST.isTeacher) {
const map = {'1':'cold','2':'hook','3':'lesson','4':'lab','5':'disc','6':'quiz'};
if (map[e.key]) { pushPhase(map[e.key]); toast('Pushed: '+map[e.key],'info'); }
if (e.key==='e'||e.key==='E') endClass();
}
});
}
// ══════════════════════════════════════════════════════════
// ONBOARDING CHECK — runs for every student on classroom open
// ══════════════════════════════════════════════════════════
function checkStudentOnboarding() {
if (!ST.code || ST.code === 'TEACHER') return;
const hasInterests = !!localStorage.getItem('student_interests');
const hasStyle = !!localStorage.getItem('student_learning_style');
const skipped = localStorage.getItem('onboarding_skipped') === '1';
if (!hasInterests && !skipped) {
setTimeout(() => launchOnboarding(), 800);
}
}
// ══════════════════════════════════════════════════════════
// TEACHER AUTH
// ══════════════════════════════════════════════════════════
function openTeacherLogin() {
document.querySelectorAll('.modal-overlay.open').forEach(m => {
if (m.id !== 'teacherModal') m.classList.remove('open');
});
openModal('teacherModal');
setTimeout(() => { const p=document.getElementById('pinInput'); if(p){p.value='';p.focus();} },80);
}
function closeTeacherLogin() { closeModal('teacherModal'); }
function checkPin() {
const entered = document.getElementById('pinInput').value.trim();
const saved = localStorage.getItem('teacher_pin') || '1529';
if (entered === saved) {
localStorage.setItem('teacher_unlocked','true');
sessionStorage.setItem('teacher_unlocked','true');
ST.isTeacher = true;
closeModal('teacherModal');
enterTeacherMode(true);
} else {
document.getElementById('pinErr').textContent = 'Incorrect PIN.';
document.getElementById('pinInput').value = '';
setTimeout(()=>document.getElementById('pinErr').textContent='', 2000);
}
}
function enterTeacherMode(firstTime) {
ST.isTeacher = true;
if (pollTimer) { clearInterval(pollTimer); pollTimer = null; }
document.getElementById('teacherLoginBtn').style.display = 'none';
document.getElementById('teacherModeBadge').style.display = 'flex';
document.getElementById('tvStudent').style.display = 'none';
document.getElementById('tvTeacher').style.display = 'block';
// Share API key for student browsers
const key = localStorage.getItem('PLATFORM_API_KEY');
if (key) { localStorage.setItem('class_api_key',key); sessionStorage.setItem('class_api_key',key); }
buildTeacherSidebar();
// Restore active objective
if (ST.objId) renderTeacherControls(ST.objId);
if (firstTime) toast('Teacher mode active · Use keys 1-6 to push phases','ok');
}
function exitTeacher() {
localStorage.removeItem('teacher_unlocked');
sessionStorage.removeItem('teacher_unlocked');
location.reload();
}
// ══════════════════════════════════════════════════════════
// TEACHER SIDEBAR — simple objective list
// ══════════════════════════════════════════════════════════
function buildTeacherSidebar() {
const buildList = (exam, elId) => {
const el = document.getElementById(elId);
if (!el) return;
const domainColors = {
'1.0 Mobile Devices':'var(--acc)',
'2.0 Networking':'var(--grn)',
'3.0 Hardware':'var(--pur)',
'4.0 Virtualization & Cloud':'var(--amb)',
'5.0 HW & Network Troubleshooting':'var(--red)',
'1.0 Operating Systems':'var(--acc)',
'2.0 Security':'var(--red)',
'3.0 Software Troubleshooting':'var(--amb)',
'4.0 Operational Procedures':'var(--pur)',
};
const objs = Object.entries(OBJECTIVES).filter(([,o])=>o.exam===exam);
const groups = {};
objs.forEach(([id,o])=>{ if(!groups[o.domain]) groups[o.domain]=[]; groups[o.domain].push([id,o]); });
el.innerHTML = Object.entries(groups).map(([domain,items])=>`
<div style="font-family:var(--mono);font-size:9px;color:${domainColors[domain]||'var(--tx3)'};letter-spacing:.8px;padding:8px 8px 3px;text-transform:uppercase">${domain}</div>
${items.map(([id,o])=>`
<button class="obj-btn ${ST.objId===id?'active':''}" onclick="selectObjective('${id}')">
<span class="obj-btn-id" style="color:${exam==='1202'?'var(--pur)':'var(--acc)'}">${id.replace('C','')}</span>
<span class="obj-btn-title">${o.title.substring(0,48)}${o.title.length>48?'…':''}</span>
</button>`).join('')}
`).join('');
};
buildList('1201','objList1201');
buildList('1202','objList1202');
}
function selectObjective(id) {
ST.objId = id;
localStorage.setItem('class_objective', JSON.stringify({id,...OBJECTIVES[id]}));
updateHdrObj();
buildTeacherSidebar(); // refresh active state
renderTeacherControls(id);
document.getElementById('tNoObj').style.display = 'none';
document.getElementById('tControls').style.display = 'block';
}
function updateHdrObj() {
const o = OBJECTIVES[ST.objId];
if (!o) return;
document.getElementById('hdrObj').textContent = ST.objId + ': ' + o.title.substring(0,55);
}
// ══════════════════════════════════════════════════════════
// TEACHER CONTROLS — the one-click phase push panel
// ══════════════════════════════════════════════════════════
function renderTeacherControls(id) {
const obj = OBJECTIVES[id];
if (!obj) return;
const phase = localStorage.getItem('class_current_phase') || '';
const el = document.getElementById('tControls');
el.innerHTML = `
<!-- Objective Banner -->
<div class="obj-banner">
<div>
<div style="font-family:var(--mono);font-size:22px;font-weight:700;color:${obj.exam==='1202'?'var(--pur)':'var(--acc)'}">${id}</div>
</div>
<div style="flex:1">
<div class="obj-banner-title">${obj.title}</div>
<div class="obj-banner-meta">${obj.domain} · ${obj.exam==='1201'?'Core 1 · 220-1201':'Core 2 · 220-1202'} · ${obj.weight} of exam</div>
</div>
<span class="tag ${phase?'tag-grn':'tag-acc'}">${phase?phase.toUpperCase()+' ACTIVE':'READY'}</span>
<button class="btn btn-ghost btn-sm" onclick="endClass()">⬛ End</button>
</div>
<!-- ONE-CLICK PHASE PUSH -->
<div style="font-family:var(--mono);font-size:9px;color:var(--tx3);letter-spacing:1px;text-transform:uppercase;margin-bottom:10px">Click a phase → students see it instantly</div>
<div class="phase-grid">
${CLASS_PHASES.map(p=>`
<div class="phase-card ${phase===p.id?'active':''}" onclick="pushPhase('${p.id}')"
style="border-color:${phase===p.id?p.color:'var(--b2)'};background:${phase===p.id?p.color+'22':'var(--s2)'};color:${phase===p.id?p.color:'var(--tx2)'}">
<div class="phase-card-icon">${p.icon}</div>
<div class="phase-card-label" style="color:${phase===p.id?p.color:'var(--tx)'}">${p.label}</div>
<div class="phase-card-sub">${p.sub}</div>
<div class="phase-card-time" style="color:${phase===p.id?p.color:'var(--tx3)'}">⏱ ${p.time}</div>
</div>`).join('')}
</div>
<!-- LIVE DISCUSSION -->
<div class="card" style="margin-top:8px">
<div class="card-hdr" style="border-bottom-color:rgba(255,184,48,.2)">
<div class="card-title">💬 Live Discussion Questions</div>
<div style="font-family:var(--mono);font-size:9px;color:var(--tx3);margin-left:auto">Students see these in real time</div>
</div>
<div class="card-body">
${[1,2,3].map(n=>`
<div style="display:flex;gap:8px;align-items:center;margin-bottom:8px">
<span style="font-family:var(--mono);font-size:11px;font-weight:700;color:var(--amb);min-width:24px">Q${n}</span>
<input id="dq${n}" class="disc-input" placeholder="Type a discussion question…" oninput="debounceDisc()">
<span id="dq${n}sent" style="font-size:14px;min-width:16px"></span>
</div>`).join('')}
<div style="display:flex;gap:8px;flex-wrap:wrap;align-items:center">
<button class="btn btn-ghost btn-sm" onclick="clearDisc()">Clear</button>
<button class="btn btn-ghost btn-sm" onclick="showFeedbackSummary()">📊 View Feedback</button>
<span id="discSent" style="font-family:var(--mono);font-size:9px;color:var(--grn);margin-left:auto"></span>
</div>
</div>
</div>
<!-- HELP SIGNALS -->
<div id="helpBadgeTeacher" style="display:none;background:var(--amb-d);border:1px solid var(--amb);border-radius:8px;padding:10px 14px;margin-top:8px;font-family:var(--mono);font-size:11px;color:var(--amb);cursor:pointer" onclick="viewHelpSignals()"></div>
<!-- KEYBOARD HINT -->
<div style="font-family:var(--mono);font-size:9px;color:var(--tx3);margin-top:12px;line-height:1.8">
⌨️ Keys: <strong style="color:var(--tx2)">1</strong> Cold Retrieval
<strong style="color:var(--tx2)">2</strong> Hook
<strong style="color:var(--tx2)">3</strong> Lesson
<strong style="color:var(--tx2)">4</strong> Lab
<strong style="color:var(--tx2)">5</strong> Discussion
<strong style="color:var(--tx2)">6</strong> Quiz
<strong style="color:var(--tx2)">E</strong> End Class
</div>
`;
// Reload saved disc questions
const qs = JSON.parse(localStorage.getItem('live_disc_questions')||'[]');
[1,2,3].forEach((n,i)=>{ const el=document.getElementById('dq'+n); if(el&&qs[i]) el.value=qs[i]; });
// Start polling help signals
pollHelpSignals();
}
// ══════════════════════════════════════════════════════════
// PHASE PUSH
// ══════════════════════════════════════════════════════════
function pushPhase(phaseId) {
ST.currentPhase = phaseId;
localStorage.setItem('class_current_phase', phaseId);
localStorage.setItem('class_phase_ts', Date.now()+'');
localStorage.setItem('class_objective', JSON.stringify({id:ST.objId,...OBJECTIVES[ST.objId]}));
// Update teacher UI phase highlight
document.querySelectorAll('.phase-card').forEach((card,i)=>{
const p = CLASS_PHASES[i];
const active = p.id === phaseId;
card.style.borderColor = active ? p.color : 'var(--b2)';
card.style.background = active ? p.color+'22' : 'var(--s2)';
card.style.color = active ? p.color : 'var(--tx2)';
card.querySelector('.phase-card-label').style.color = active ? p.color : 'var(--tx)';
card.querySelector('.phase-card-time').style.color = active ? p.color : 'var(--tx3)';
});
// Update phase badge in header
document.getElementById('hdrPhase').textContent = phaseId.toUpperCase() + ' ACTIVE';
document.getElementById('hdrPhase').className = 'hdr-badge live';
toast(phaseId.toUpperCase() + ' pushed to all students ✓','ok');
}
function endClass() {
localStorage.removeItem('class_current_phase');
localStorage.removeItem('class_phase_ts');
localStorage.removeItem('live_disc_questions');
ST.currentPhase = null;
document.getElementById('hdrPhase').textContent = 'Classroom';
document.getElementById('hdrPhase').className = 'hdr-badge';
renderTeacherControls(ST.objId);
toast('Class ended','info');
}
// ══════════════════════════════════════════════════════════
// LIVE DISCUSSION
// ══════════════════════════════════════════════════════════
function debounceDisc() {
clearTimeout(discPushTimer);
discPushTimer = setTimeout(pushDiscQuestions, 500);
}
function pushDiscQuestions() {
const qs = [1,2,3].map(n=>document.getElementById('dq'+n)?.value.trim()).filter(q=>q);
localStorage.setItem('live_disc_questions', JSON.stringify(qs));
localStorage.setItem('live_disc_ts', Date.now()+'');
[1,2,3].forEach(n=>{
const s = document.getElementById('dq'+n+'sent');
if(s) s.textContent = document.getElementById('dq'+n)?.value.trim() ? '📡' : '';
});
const s = document.getElementById('discSent');
if(s) s.textContent = qs.length ? '✓ '+qs.length+' question'+(qs.length>1?'s':'')+' live' : '';
}
function clearDisc() {
[1,2,3].forEach(n=>{ const e=document.getElementById('dq'+n); if(e) e.value=''; });
localStorage.removeItem('live_disc_questions');
localStorage.removeItem('live_disc_ts');
[1,2,3].forEach(n=>{ const s=document.getElementById('dq'+n+'sent'); if(s) s.textContent=''; });
const s=document.getElementById('discSent'); if(s) s.textContent='';
}
// ══════════════════════════════════════════════════════════
// HELP SIGNALS
// ══════════════════════════════════════════════════════════
function buildHelpButton() {
if (ST.isTeacher) return;
const btn = document.createElement('div');
btn.id = 'helpBtn';
btn.textContent = '🙋 Help';
btn.onclick = sendHelp;
document.body.appendChild(btn);
}
function sendHelp() {
const helps = JSON.parse(localStorage.getItem('help_signals')||'[]');
helps.unshift({code:ST.code||'STU',phase:ST.currentPhase||'?',ts:Date.now()});
localStorage.setItem('help_signals',JSON.stringify(helps.slice(0,50)));
const btn = document.getElementById('helpBtn');
if(btn){btn.textContent='✓ Sent';btn.style.borderColor='var(--grn)';btn.style.color='var(--grn)';
setTimeout(()=>{btn.textContent='🙋 Help';btn.style.borderColor='var(--amb)';btn.style.color='var(--amb)';},4000);}
toast('Teacher notified 🙋','info');
}
function pollHelpSignals() {
setInterval(()=>{
const helps = JSON.parse(localStorage.getItem('help_signals')||'[]');
const recent = helps.filter(h=>Date.now()-h.ts < 120000);
const badge = document.getElementById('helpBadgeTeacher');
if (!badge) return;
if (recent.length) {
badge.style.display = 'block';
badge.textContent = '🙋 '+recent.length+' student'+(recent.length>1?'s':'')+' need help — click to view';
} else {
badge.style.display = 'none';
}
},3000);
}
function viewHelpSignals() {
const helps = JSON.parse(localStorage.getItem('help_signals')||'[]')
.filter(h=>Date.now()-h.ts<120000);
if(!helps.length){toast('No current help requests','info');return;}
alert('Students needing help:\n'+helps.map(h=>`• ${h.code} (during ${h.phase})`).join('\n'));
localStorage.removeItem('help_signals');
document.getElementById('helpBadgeTeacher').style.display='none';
}
// ══════════════════════════════════════════════════════════
// STUDENT POLLING
// ══════════════════════════════════════════════════════════
function startPolling() {
if (pollTimer) clearInterval(pollTimer);
pollTimer = setInterval(checkForUpdates, 2000);
checkForUpdates();
}
function checkForUpdates() {
// Always sync objective
try {
const obj = JSON.parse(localStorage.getItem('class_objective')||'{}');
if (obj.id && obj.id !== ST.objId) {
ST.objId = obj.id;
updateHdrObj();
}
} catch(e){}
const phase = localStorage.getItem('class_current_phase');
const discTs = localStorage.getItem('live_disc_ts') || '0';
if (phase === 'disc' && phase === lastPhase && discTs !== lastDiscTs) {
lastDiscTs = discTs;
renderStudentPhase('disc');
return;
}
if (phase === lastPhase) return;
lastPhase = phase;
if (!phase) { showWaiting(); return; }
renderStudentPhase(phase);
}
function showWaiting() {
ST.currentPhase = null;
document.getElementById('hdrPhase').textContent = 'Classroom';
document.getElementById('hdrPhase').className = 'hdr-badge';
document.getElementById('studentDisplay').innerHTML = `
<div class="waiting">
<div class="waiting-icon">📡</div>
<div class="waiting-title">Waiting for class</div>
<div class="waiting-sub">Your teacher will push each activity to your screen.</div>
<div style="font-family:var(--mono);font-size:11px;color:var(--tx3);display:flex;align-items:center;justify-content:center;gap:8px">
<div class="pulse"></div> Connected
</div>
</div>`;
}
// ══════════════════════════════════════════════════════════
// STUDENT PHASE RENDERING
// ══════════════════════════════════════════════════════════
async function renderStudentPhase(phase) {
ST.currentPhase = phase;
const phaseObj = CLASS_PHASES.find(p=>p.id===phase);
const display = document.getElementById('studentDisplay');
display.innerHTML = `
<div class="phase-hdr" style="background:${phaseObj?.color+'11'||''};border-color:${phaseObj?.color||'var(--b1)'}">
<div class="phase-hdr-icon">${phaseObj?.icon||'📌'}</div>
<div>
<div class="phase-hdr-label" style="color:${phaseObj?.color||'var(--tx)'}">${phaseObj?.label||phase}</div>
<div class="phase-hdr-desc" style="color:var(--tx2)">${phaseObj?.sub||''} · ${ST.objId||'—'}</div>
</div>
<span class="tag tag-acc" style="margin-left:auto">⏱ ${phaseObj?.time||''}</span>
</div>
<div id="phaseBody"><div class="loading-bar"></div><div class="loading-txt">Generating personalized content…</div></div>`;
document.getElementById('hdrPhase').textContent = phase.toUpperCase();
document.getElementById('hdrPhase').className = 'hdr-badge live';
if (phase === 'disc') { renderDisc(); return; }
if (phase === 'cold') { await renderCold(); return; }
if (!ST.objId) {
document.getElementById('phaseBody').innerHTML = '<div style="font-family:var(--mono);font-size:12px;color:var(--amb);padding:20px">Waiting for teacher to select an objective…</div>';
return;
}
const content = await getContent(phase);
if (!content) return;
const body = document.getElementById('phaseBody');
if (!body) return;
body.innerHTML = buildPhaseHTML(phase, content);
if (phase === 'lab') setupTerminal();
if (phase === 'quiz') setupQuiz(content);
}
// ══════════════════════════════════════════════════════════
// AI CONTENT GENERATION
// ══════════════════════════════════════════════════════════
function getApiKey() {
return localStorage.getItem('PLATFORM_API_KEY')
|| localStorage.getItem('class_api_key')
|| sessionStorage.getItem('class_api_key');
}
async function callClaude(prompt, maxTokens=1800) {
const key = getApiKey();
if (!key) return {error:'No API key found. Ask your teacher to complete the setup at setup-new.html.'};
try {
const r = await fetch('https://api.anthropic.com/v1/messages',{
method:'POST',
headers:{'Content-Type':'application/json','x-api-key':key,'anthropic-version':'2023-06-01','anthropic-dangerous-direct-browser-access':'true'},
body:JSON.stringify({model:'claude-sonnet-4-20250514',max_tokens:maxTokens,messages:[{role:'user',content:prompt}]})
});
const d = await r.json();
const text = d.content?.[0]?.text||'{}';
return JSON.parse(text.replace(/```json\n?|```/g,'').trim());
} catch(e) { return {error:e.message}; }
}
function buildProfile() {
let ctx = '';
try {
const ls = JSON.parse(localStorage.getItem('student_learning_style')||'{}');
if (ls.primary) {
const hints = {
visual:'Use visual analogies, structured comparisons, and described diagrams. Format content with clear hierarchy.',
auditory:'Write conversationally. Encourage explaining out loud. Use narrative flow.',
kinesthetic:'Lead with hands-on application. Connect every concept to something they can try. Use action verbs.',
reading:'Give detailed written explanations. Include thorough definitions. Encourage note-taking.',
};
ctx += `LEARNING STYLE: ${ls.primary} learner (secondary: ${ls.secondary||'n/a'}). ${hints[ls.primary]||''}\n`;
}
} catch(e){}
try {
const i = JSON.parse(localStorage.getItem('student_interests')||'{}');
if (i.interestLabels?.length) ctx += `INTERESTS: ${i.interestLabels.join(', ')}${i.customInterest?', '+i.customInterest:''}. Use these for analogies and examples.\n`;
if (i.career) ctx += `CAREER GOAL: ${i.careerLabel||i.career}. Frame examples through this career lens.\n`;
} catch(e){}
try {
const a = JSON.parse(localStorage.getItem('adaptive_profile')||'{}');
const helped = Object.entries(a).filter(([k])=>k.startsWith('helped_')).sort((x,y)=>y[1]-x[1]).slice(0,3)
.map(([k])=>({analogy:'analogies',lab:'hands-on labs',terms:'clear key terms',incident:'real scenarios',examples:'concrete examples',simple:'simple language'})[k.replace('helped_','')]||k.replace('helped_','')).filter(Boolean);
const confused = Object.entries(a).filter(([k])=>k.startsWith('confused_')).sort((x,y)=>y[1]-x[1]).slice(0,3)
.map(([k])=>({too_fast:'slow down',jargon:'avoid undefined jargon',not_relevant:'explain relevance',lab_unclear:'clearer lab steps',more_time:'more depth',quiz_hard:'easier start'})[k.replace('confused_','')]||k.replace('confused_','')).filter(Boolean);
if (helped.length) ctx += `WHAT WORKS: ${helped.join(', ')}. Lean into these.\n`;
if (confused.length) ctx += `WHAT CONFUSES: ${confused.join(', ')}. Adjust accordingly.\n`;
const comments = (a.comments||[]).slice(0,2);
if (comments.length) ctx += `STUDENT SAID: "${comments.join('" / '")}". Take this literally.\n`;
} catch(e){}
return ctx ? '\n\nSTUDENT PERSONALIZATION:\n'+ctx : '';
}
async function getContent(phase) {
const key = `${ST.objId}_${phase}`;
if (contentCache[key]) return contentCache[key];
const obj = OBJECTIVES[ST.objId];
const profile = buildProfile();
const exam = obj.exam==='1201'?'220-1201':'220-1202';
const prompts = {
hook: `CompTIA A+ instructor. Create a real-world IT incident for objective ${ST.objId}: "${obj.title}" (${exam}).
${profile}
Return ONLY valid JSON:
{"incident":"2-3 vivid sentences — a real IT problem a help desk tech would face","context":"Brief setting (company/user/urgency)","question":"One open-ended question: what would you check first and why?","difficulty":"Beginner/Intermediate/Advanced"}`,
lesson: `CompTIA A+ instructor teaching high school CTE students. Teach objective ${ST.objId}: "${obj.title}" (${exam}).
${profile}
Return ONLY valid JSON:
{"hook":"One sentence connecting this to something students know","plain_english":"3-4 clear sentences — no unexplained jargon","analogy":"One real-world analogy that makes this click","key_terms":[{"term":"T","definition":"simple def","example":"real IT example"},{"term":"T","definition":"...","example":"..."},{"term":"T","definition":"...","example":"..."},{"term":"T","definition":"...","example":"..."},{"term":"T","definition":"...","example":"..."}],"exam_traps":["Specific CompTIA trap 1","Trap 2","Trap 3"],"remember_this":"Single most important exam sentence"}`,
lab: `CompTIA A+ instructor. Browser-based lab for Chromebooks — objective ${ST.objId}: "${obj.title}" (${exam}).
${profile}
Return ONLY valid JSON:
{"title":"Lab title","scenario":"2-3 sentence IT scenario","objective":"What student learns","steps":[{"num":1,"instruction":"What to do","hint":"Help if stuck","expected":"What success looks like"},{"num":2,"instruction":"...","hint":"...","expected":"..."},{"num":3,"instruction":"...","hint":"...","expected":"..."},{"num":4,"instruction":"...","hint":"...","expected":"..."},{"num":5,"instruction":"...","hint":"...","expected":"..."}],"terminal_commands":["cmd1","cmd2","cmd3"],"success_message":"What they understand when done","real_job":"How this maps to a real IT task"}`,
quiz: `CompTIA A+ exam writer. 5 exam-quality questions for objective ${ST.objId}: "${obj.title}" (${exam}, ${obj.weight} of exam).
${profile}
Use CompTIA language: BEST, FIRST, MOST, NEXT. Include scenarios. Real distractors.
Return ONLY valid JSON array:
[{"q":"Question","opts":{"A":"...","B":"...","C":"...","D":"..."},"answer":"A","rationale":"Why correct. Why others wrong.","difficulty":"Easy/Medium/Hard"}]`,
};
if (!prompts[phase]) return null;
const result = await callClaude(prompts[phase]);
if (result && !result.error) contentCache[key] = result;
return result;
}
// ══════════════════════════════════════════════════════════
// PHASE HTML BUILDERS
// ══════════════════════════════════════════════════════════
function buildPhaseHTML(phase, c) {
if (c?.error) return `<div style="background:var(--red-d);border:1px solid var(--red);border-radius:8px;padding:14px;font-family:var(--mono);font-size:12px;color:var(--red)">${c.error}</div>`;
if (phase==='hook') return buildHook(c);
if (phase==='lesson') return buildLesson(c);
if (phase==='lab') return buildLab(c);