-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
846 lines (783 loc) · 82.9 KB
/
index.html
File metadata and controls
846 lines (783 loc) · 82.9 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LanguageLab — Language Practice</title>
<link href="https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Outfit:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
--ink: #1a1a2e;
--cream: #faf8f4;
--warm: #f5f0e8;
--red: #c0392b;
--gold: #d4a017;
--green: #27ae60;
--blue: #9a7300;
--muted: #7f8c8d;
--border: #ddd5c8;
--card: #ffffff;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Outfit', sans-serif; background: var(--cream); color: var(--ink); min-height: 100vh; }
.app-container { max-width: 900px; margin: 0 auto; padding: 20px; min-height: 100vh; }
.app-header { text-align: center; padding: 44px 0 24px; border-bottom: 3px solid var(--ink); margin-bottom: 32px; position: relative; }
.app-header::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 6px; background: linear-gradient(to bottom, #222 0% 33.33%, #c0392b 33.33% 66.66%, #c8a200 66.66% 100%); }
.app-header::after { content: ''; position: absolute; bottom: -6px; left: 0; right: 0; height: 1px; background: var(--ink); }
.app-title { font-family: 'DM Serif Display', serif; font-size: 2.8rem; letter-spacing: -0.02em; line-height: 1.1; }
.app-title span { color: var(--red); }
.app-subtitle { font-size: 0.95rem; color: var(--muted); margin-top: 6px; font-weight: 300; letter-spacing: 0.08em; text-transform: uppercase; }
.nav-bar { display: flex; margin-bottom: 32px; border: 2px solid var(--ink); overflow: hidden; }
.nav-btn { flex: 1; padding: 14px 12px; border: none; background: var(--card); font-family: 'Outfit', sans-serif; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.2s; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink); border-right: 1px solid var(--border); }
.nav-btn:last-child { border-right: none; }
.nav-btn:hover { background: var(--warm); }
.nav-btn.active { background: var(--ink); color: var(--cream); }
.card { background: var(--card); border: 2px solid var(--ink); padding: 28px; margin-bottom: 20px; }
.card-header { font-family: 'DM Serif Display', serif; font-size: 1.4rem; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.info-box { padding: 14px 18px; background: var(--warm); border-left: 4px solid var(--blue); font-size: 0.9rem; margin-bottom: 20px; line-height: 1.5; }
.info-box.error { border-left-color: var(--red); }
.drill-verb-display { text-align: center; padding: 24px; margin-bottom: 24px; background: var(--ink); color: var(--cream); }
.drill-verb { font-family: 'DM Serif Display', serif; font-size: 2.2rem; }
.drill-meaning { font-size: 0.9rem; opacity: 0.7; margin-top: 4px; }
.drill-tense { display: inline-block; margin-top: 8px; padding: 4px 16px; background: var(--red); color: white; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.drill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.drill-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--border); background: var(--warm); }
.drill-pronoun { font-weight: 600; min-width: 80px; font-size: 0.95rem; color: var(--blue); }
.drill-input { flex: 1; padding: 8px 12px; border: 2px solid var(--border); font-family: 'Outfit', sans-serif; font-size: 0.95rem; background: white; transition: border-color 0.2s; }
.drill-input:focus { outline: none; border-color: var(--blue); }
.drill-input.correct { border-color: var(--green); background: #e8f8f0; }
.drill-input.incorrect { border-color: var(--red); background: #fde8e6; }
.drill-answer { font-size: 0.85rem; margin-top: 4px; font-weight: 500; color: var(--red); }
.btn { padding: 12px 28px; border: 2px solid var(--ink); font-family: 'Outfit', sans-serif; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all 0.15s; text-transform: uppercase; letter-spacing: 0.06em; }
.btn-primary { background: var(--ink); color: var(--cream); }
.btn-primary:hover { background: var(--red); border-color: var(--red); }
.btn-secondary { background: var(--card); color: var(--ink); }
.btn-secondary:hover { background: var(--warm); }
.btn-group { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.score-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--warm); border: 1px solid var(--border); margin-bottom: 20px; font-size: 0.9rem; }
.score-num { font-weight: 700; font-size: 1.1rem; }
.score-num.good { color: var(--green); }
.score-num.ok { color: var(--gold); }
.score-num.poor { color: var(--red); }
.streak { display: inline-flex; align-items: center; gap: 4px; font-size: 0.85rem; font-weight: 600; color: var(--gold); }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.filter-chip { padding: 6px 16px; border: 1.5px solid var(--border); background: var(--card); font-family: 'Outfit', sans-serif; font-size: 0.82rem; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.filter-chip:hover { border-color: var(--ink); }
.filter-chip.active { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.tense-selector { display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 20px; border: 2px solid var(--ink); overflow: hidden; }
.tense-btn { flex: 1 1 auto; min-width: 100px; padding: 10px 8px; border: none; background: var(--card); font-family: 'Outfit', sans-serif; font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: all 0.2s; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: 0.03em; }
.tense-btn:hover { background: var(--warm); }
.tense-btn.active { background: var(--red); color: white; }
.voice-toggle { display: flex; margin-bottom: 16px; border: 1.5px solid var(--border); overflow: hidden; }
.voice-btn { flex: 1; padding: 8px 12px; border: none; background: var(--card); font-family: 'Outfit', sans-serif; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.2s; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.voice-btn:first-child { border-right: 1px solid var(--border); }
.voice-btn:hover { background: var(--warm); color: var(--ink); }
.voice-btn.active { background: var(--ink); color: var(--cream); }
.mode-toggle { display: flex; margin-bottom: 20px; border: 2px solid var(--ink); overflow: hidden; }
.mode-btn { flex: 1; padding: 12px; border: none; background: var(--card); font-family: 'Outfit', sans-serif; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.2s; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink); }
.mode-btn:first-child { border-right: 1px solid var(--border); }
.mode-btn:hover { background: var(--warm); }
.mode-btn.active { background: var(--blue); color: white; }
.random-item { padding: 14px 18px; border: 1px solid var(--border); background: var(--warm); margin-bottom: 10px; }
.random-prompt { font-size: 0.95rem; margin-bottom: 8px; line-height: 1.5; }
.random-prompt strong { color: var(--blue); }
.random-prompt .tense-tag { display: inline-block; padding: 2px 10px; background: var(--red); color: white; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-left: 6px; vertical-align: middle; }
.random-number { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: var(--ink); color: var(--cream); font-weight: 700; font-size: 0.85rem; margin-right: 10px; flex-shrink: 0; }
.flashcard-container { perspective: 1000px; margin: 20px 0; }
.flashcard { width: 100%; min-height: 220px; cursor: pointer; position: relative; transform-style: preserve-3d; transition: transform 0.5s ease; }
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard-face { position: absolute; inset: 0; backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; border: 2px solid var(--ink); }
.flashcard-front { background: var(--ink); color: var(--cream); }
.flashcard-back { background: var(--card); transform: rotateY(180deg); }
.flashcard-word { font-family: 'DM Serif Display', serif; font-size: 2rem; text-align: center; }
.flashcard-detail { font-size: 0.95rem; margin-top: 8px; opacity: 0.7; }
.flashcard-gender { display: inline-block; margin-top: 12px; padding: 4px 14px; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.gender-m { background: #222; color: white; }
.gender-f { background: var(--red); color: white; }
.gender-n { background: #c8a200; color: white; }
.flashcard-hint { font-size: 0.8rem; color: var(--muted); margin-top: 16px; }
.flashcard-progress { text-align: center; margin-bottom: 16px; font-size: 0.9rem; color: var(--muted); }
.flashcard-nav { display: flex; justify-content: center; gap: 12px; margin-top: 16px; }
.vocab-prompt-card { text-align: center; padding: 36px 24px 28px; margin: 16px 0; background: var(--ink); color: var(--cream); }
.vocab-prompt-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.12em; opacity: 0.6; margin-bottom: 14px; font-weight: 600; }
.vocab-prompt-word { font-family: 'DM Serif Display', serif; font-size: 2.4rem; line-height: 1.2; margin-bottom: 14px; }
.vocab-topic-tag { display: inline-block; margin-top: 10px; padding: 3px 12px; background: rgba(255,255,255,0.13); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; }
.vocab-input-area { display: flex; gap: 10px; margin: 16px 0 10px; }
.vocab-type-input { flex: 1; padding: 14px 16px; border: 2px solid var(--border); font-family: 'Outfit', sans-serif; font-size: 1.05rem; background: white; transition: border-color 0.2s; }
.vocab-type-input:focus { outline: none; border-color: var(--blue); }
.vocab-type-input.v-correct { border-color: var(--green); background: #e8f8f0; }
.vocab-type-input.v-incorrect { border-color: var(--red); background: #fde8e6; }
.vocab-feedback { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; }
.vocab-feedback.v-correct { background: #e8f8f0; border: 1px solid var(--green); color: #1e7d48; }
.vocab-feedback.v-incorrect { background: #fde8e6; border: 1px solid var(--red); color: var(--red); }
.vocab-correct-answer { font-weight: 400; color: var(--ink); font-size: 0.9rem; }
.vocab-progress { text-align: right; font-size: 0.82rem; color: var(--muted); margin-bottom: 14px; }
.worksheet-preview { border: 2px solid var(--ink); padding: 32px; background: white; font-size: 0.95rem; }
.ws-title { font-family: 'DM Serif Display', serif; font-size: 1.6rem; text-align: center; margin-bottom: 4px; }
.ws-subtitle { text-align: center; color: var(--muted); font-size: 0.85rem; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.ws-section { margin-bottom: 24px; }
.ws-section-title { font-weight: 700; font-size: 1rem; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--blue); }
.ws-question { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; line-height: 1.6; }
.ws-q-num { font-weight: 700; min-width: 24px; color: var(--muted); }
.ws-blank { display: inline-block; min-width: 140px; border-bottom: 1.5px solid var(--ink); margin: 0 4px; }
.ws-name-line { display: flex; justify-content: space-between; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px dashed var(--border); }
.ws-name-field { font-size: 0.85rem; color: var(--muted); }
.ws-answer-key { margin-top: 24px; padding-top: 16px; border-top: 2px dashed var(--border); font-size: 0.85rem; color: var(--muted); }
.ws-answer-key strong { display: block; margin-bottom: 6px; color: var(--ink); text-transform: uppercase; letter-spacing: 0.04em; }
.loading { text-align: center; padding: 60px 20px; }
.loading-spinner { display: inline-block; width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 16px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 0.95rem; color: var(--muted); }
.db-stats { font-size: 0.8rem; color: var(--muted); text-align: center; margin-top: -20px; margin-bottom: 24px; }
@media print { .no-print { display: none !important; } .worksheet-preview { border: none; padding: 20px 0; } body { background: white; } }
@media (max-width: 600px) { .app-title { font-size: 2rem; } .card { padding: 18px; } .nav-btn { font-size: 0.75rem; padding: 10px 6px; } .drill-verb { font-size: 1.6rem; } .drill-grid { grid-template-columns: 1fr; } .tense-btn { min-width: 80px; font-size: 0.72rem; padding: 8px 4px; } }
/* ── Cheatsheet ── */
.cs-section-label { font-family: 'DM Serif Display', serif; font-size: 1.4rem; color: var(--ink); margin-bottom: 4px; }
.cs-section-sub { color: var(--muted); font-size: 0.87rem; margin-bottom: 22px; }
.cs-divider { font-family: 'DM Serif Display', serif; font-size: 1.15rem; color: var(--ink); margin: 36px 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.tense-card { background: var(--card); border: 1.5px solid var(--border); border-radius: 8px; margin-bottom: 18px; overflow: hidden; }
.tense-card-header { display: flex; align-items: center; gap: 14px; padding: 13px 18px; border-bottom: 1.5px solid var(--border); background: var(--warm); }
.tense-flag { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; }
.flag-present { background: #222; } .flag-prät { background: var(--blue); } .flag-perfekt { background: var(--red); }
.flag-plusq { background: #7d2cac; } .flag-futI { background: var(--green); } .flag-futII { background: #2471a3; }
.flag-kII { background: var(--red); } .flag-kI { background: var(--muted); }
.tense-de { font-family: 'DM Serif Display', serif; font-size: 1.1rem; color: var(--ink); }
.tense-en { font-size: 0.78rem; color: var(--muted); }
.tense-body { display: grid; grid-template-columns: 1fr 1fr; }
.tense-col { padding: 14px 18px; border-right: 1.5px solid var(--border); }
.tense-col:last-child { border-right: none; }
.col-title { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 8px; }
.cs-formula { font-family: monospace; font-size: 0.9rem; background: var(--warm); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; margin-bottom: 10px; line-height: 1.55; }
.cs-formula .kw { color: var(--red); font-weight: 700; } .cs-formula .ex { color: var(--blue); }
.cs-example-de { font-weight: 600; font-size: 0.9rem; } .cs-example-en { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.usage-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.utag { font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 20px; border: 1.5px solid currentColor; }
.utag-spoken { color: var(--green); } .utag-written { color: #2471a3; } .utag-formal { color: var(--red); } .utag-common { color: var(--blue); } .utag-modal { color: #7d2cac; }
.passive-bar { background: var(--warm); border-top: 1.5px solid var(--border); padding: 9px 18px; display: flex; align-items: flex-start; gap: 10px; }
.passive-bar-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); white-space: nowrap; padding-top: 2px; }
.passive-formula { font-family: monospace; font-size: 0.83rem; color: var(--ink); }
.passive-formula .kw { color: var(--red); font-weight: 700; }
.cs-ref-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; border: 1.5px solid var(--border); border-radius: 8px; overflow: hidden; }
.cs-ref-table th { background: var(--ink); color: var(--cream); padding: 10px 14px; text-align: left; font-weight: 600; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; }
.cs-ref-table td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.cs-ref-table tr:last-child td { border-bottom: none; } .cs-ref-table tr:nth-child(even) td { background: var(--warm); }
.cs-ref-table td:first-child { font-weight: 600; } .mono { font-family: monospace; font-size: 0.84rem; }
.cs-note { background: #fffbe6; border: 1.5px solid var(--gold); border-radius: 8px; padding: 11px 15px; font-size: 0.84rem; color: #5a4a00; margin-top: 16px; }
.modal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 16px; margin-top: 4px; }
.modal-card { background: var(--card); border: 1.5px solid var(--border); border-radius: 8px; overflow: hidden; }
.modal-card-header { display: flex; align-items: baseline; gap: 10px; padding: 10px 14px; background: var(--warm); border-bottom: 1.5px solid var(--border); }
.modal-infinitive { font-family: 'DM Serif Display', serif; font-size: 1.05rem; color: var(--ink); }
.modal-meaning { font-size: 0.77rem; color: var(--muted); }
.modal-conj-table { width: 100%; border-collapse: collapse; font-size: 0.81rem; }
.modal-conj-table td { padding: 5px 14px; border-bottom: 1px solid var(--border); }
.modal-conj-table tr:last-child td { border-bottom: none; }
.modal-conj-table td:first-child { color: var(--muted); width: 46%; }
.modal-conj-table td:last-child { font-weight: 600; }
.modal-conj-table tr:nth-child(even) td { background: var(--warm); }
.modal-use-row { padding: 8px 14px; font-size: 0.8rem; border-top: 1.5px solid var(--border); background: var(--warm); }
.modal-use-row strong { color: var(--red); }
/* ── Spanish theme ── */
body.lang-es { --red:#c60b1e; --gold:#ffc400; --blue:#c8950a; }
body.lang-es .app-header::before { background: linear-gradient(to bottom, #c60b1e 0% 25%, #ffc400 25% 75%, #c60b1e 75% 100%); }
body.lang-es .gender-m { background:#1a6eb5; color:white; }
body.lang-es .gender-f { background:#c60b1e; color:white; }
/* ── Language switcher ── */
.lang-switcher { position:absolute; right:20px; top:50%; transform:translateY(-50%); display:flex; gap:6px; }
.lang-btn { padding:6px 10px; border:2px solid transparent; background:rgba(255,255,255,0.15); font-size:1.3rem; border-radius:6px; cursor:pointer; transition:all 0.15s; line-height:1; }
.lang-btn:hover { background:rgba(255,255,255,0.25); }
.lang-btn.active { border-color:var(--cream); background:rgba(255,255,255,0.2); }
@media (max-width: 600px) { .tense-body { grid-template-columns: 1fr; } .modal-grid { grid-template-columns: 1fr; } }
</style>
</head>
<body class="lang-de">
<div class="app-container">
<header class="app-header no-print">
<h1 class="app-title">Language<span>Lab</span></h1>
<p class="app-subtitle">Language Practice</p>
<div class="lang-switcher no-print">
<button class="lang-btn active" data-lang="de">🇩🇪</button>
<button class="lang-btn" data-lang="es">🇪🇸</button>
</div>
</header>
<nav class="nav-bar no-print" id="nav">
<button class="nav-btn active" data-page="conjugation">Conjugation</button>
<button class="nav-btn" data-page="vocab">Vocabulary</button>
<button class="nav-btn" data-page="worksheet">Worksheets</button>
<button class="nav-btn" data-page="cheatsheet">Cheatsheet</button>
</nav>
<main id="main-content">
<div class="loading"><div class="loading-spinner"></div><div class="loading-text">Loading language data...</div></div>
</main>
</div>
<script>
// ════════════════════════════════════════════════════════════════════
// DATA LOADING — all language content lives in /data/*.json
// To update verbs or vocab, edit those files, not this one.
// ════════════════════════════════════════════════════════════════════
const PRONOUNS=["ich","du","er/sie/es","wir","ihr","sie/Sie"];
const ALL_TENSES=["present","präteritum","perfekt","plusquamperfekt","futurI","futurII","konjunktivII","konjunktivI"];
const TENSE_LABELS={present:"Präsens","präteritum":"Präteritum",perfekt:"Perfekt",plusquamperfekt:"Plusquamperfekt",futurI:"Futur I",futurII:"Futur II",konjunktivII:"Konjunktiv II",konjunktivI:"Konjunktiv I"};
const ES_PRONOUNS=["yo","tú","él/ella","nosotros","vosotros","ellos/ellas"];
const ES_ALL_TENSES=["presente","indefinido","imperfecto","subjuntivoPres","perfecto","pluscuamperfecto","futuro","condicional"];
const ES_TENSE_LABELS={presente:"Presente",indefinido:"Indefinido",imperfecto:"Imperfecto",subjuntivoPres:"Subj. Presente",perfecto:"Pretérito Perfecto",pluscuamperfecto:"Pluscuamperfecto",futuro:"Futuro Simple",condicional:"Condicional"};
let VERBS=[],VOCAB=[],TOPICS=[];
let DE_VERBS=[],DE_VOCAB=[],DE_TOPICS=[],ES_VERBS=[],ES_VOCAB=[],ES_TOPICS=[];
let dataLoaded=false,loadError=null;
const WERDEN_PRESENT={ich:"werde",du:"wirst","er/sie/es":"wird",wir:"werden",ihr:"werdet","sie/Sie":"werden"};
const HABEN_PRÄT={ich:"hatte",du:"hattest","er/sie/es":"hatte",wir:"hatten",ihr:"hattet","sie/Sie":"hatten"};
const SEIN_PRÄT={ich:"war",du:"warst","er/sie/es":"war",wir:"waren",ihr:"wart","sie/Sie":"waren"};
const SEIN_PRES={ich:"bin",du:"bist","er/sie/es":"ist",wir:"sind",ihr:"seid","sie/Sie":"sind"};
const WERDEN_PRÄT={ich:"wurde",du:"wurdest","er/sie/es":"wurde",wir:"wurden",ihr:"wurdet","sie/Sie":"wurden"};
const WERDEN_KI={ich:"werde",du:"werdest","er/sie/es":"werde",wir:"werden",ihr:"werdet","sie/Sie":"werden"};
const WERDEN_KII={ich:"würde",du:"würdest","er/sie/es":"würde",wir:"würden",ihr:"würdet","sie/Sie":"würden"};
const HABER_PRES={yo:"he","tú":"has","él/ella":"ha",nosotros:"hemos",vosotros:"habéis","ellos/ellas":"han"};
const HABER_IMP={yo:"había","tú":"habías","él/ella":"había",nosotros:"habíamos",vosotros:"habíais","ellos/ellas":"habían"};
function getPassiveForms(pp,tense){const r={};PRONOUNS.forEach(p=>{switch(tense){case"present":r[p]=WERDEN_PRESENT[p]+" "+pp;break;case"präteritum":r[p]=WERDEN_PRÄT[p]+" "+pp;break;case"perfekt":r[p]=SEIN_PRES[p]+" "+pp+" worden";break;case"plusquamperfekt":r[p]=SEIN_PRÄT[p]+" "+pp+" worden";break;case"futurI":r[p]=WERDEN_PRESENT[p]+" "+pp+" werden";break;case"futurII":r[p]=WERDEN_PRESENT[p]+" "+pp+" worden sein";break;case"konjunktivII":r[p]=WERDEN_KII[p]+" "+pp+" werden";break;case"konjunktivI":r[p]=WERDEN_KI[p]+" "+pp;break;}});return r;}
function buildCompoundTenses(rawVerbs){
const seinV=rawVerbs.find(v=>v.infinitive==="sein");
const habenV=rawVerbs.find(v=>v.infinitive==="haben");
return rawVerbs.map(v=>{
const auxP=v.auxiliary==="sein"?SEIN_PRÄT:HABEN_PRÄT;
const pp=v.pastParticiple,inf=v.infinitive,auxInf=v.auxiliary;
const perfekt={},plusquamperfekt={},futurI={},futurII={};
PRONOUNS.forEach(p=>{
const auxPres=v.auxiliary==="sein"?seinV.present[p]:habenV.present[p];
perfekt[p]=auxPres+" "+pp;
plusquamperfekt[p]=auxP[p]+" "+pp;
futurI[p]=WERDEN_PRESENT[p]+" "+inf;
futurII[p]=WERDEN_PRESENT[p]+" "+pp+" "+auxInf;
});
return{...v,perfekt,plusquamperfekt,futurI,futurII};
});
}
function buildCompoundTensesES(rawVerbs){
return rawVerbs.map(v=>{
const pp=v.pastParticiple,perfecto={},pluscuamperfecto={};
ES_PRONOUNS.forEach(p=>{perfecto[p]=HABER_PRES[p]+" "+pp;pluscuamperfecto[p]=HABER_IMP[p]+" "+pp;});
return{...v,perfecto,pluscuamperfecto};
});
}
async function loadData(){
try{
const[vR,voR,evR,evoR]=await Promise.all([fetch("data/verbs.json"),fetch("data/vocab.json"),fetch("data/es/verbs.json"),fetch("data/es/vocab.json")]);
if(!vR.ok)throw new Error("Could not load verbs.json ("+vR.status+")");
if(!voR.ok)throw new Error("Could not load vocab.json ("+voR.status+")");
if(!evR.ok)throw new Error("Could not load es/verbs.json ("+evR.status+")");
if(!evoR.ok)throw new Error("Could not load es/vocab.json ("+evoR.status+")");
const vD=await vR.json(),voD=await voR.json(),evD=await evR.json(),evoD=await evoR.json();
DE_VERBS=buildCompoundTenses(vD.verbs);
DE_VOCAB=voD.vocab;
DE_TOPICS=[...new Set(DE_VOCAB.map(v=>v.topic))];
ES_VERBS=buildCompoundTensesES(evD.verbs);
ES_VOCAB=evoD.vocab;
ES_TOPICS=[...new Set(ES_VOCAB.map(v=>v.topic))];
VERBS=DE_VERBS; VOCAB=DE_VOCAB; TOPICS=DE_TOPICS;
dataLoaded=true;
console.log("LanguageLab loaded: DE "+DE_VERBS.length+" verbs / "+DE_VOCAB.length+" vocab; ES "+ES_VERBS.length+" verbs / "+ES_VOCAB.length+" vocab");
}catch(e){loadError=e.message;console.error("Data load error:",e);}
}
// ─── UTILITIES ───────────────────────────────────────────────────────
function shuffle(a){const b=[...a];for(let i=b.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));[b[i],b[j]]=[b[j],b[i]];}return b;}
function pick(a,n){return shuffle(a).slice(0,n);}
function randItem(a){return a[Math.floor(Math.random()*a.length)];}
function normRandom(typed,pronoun){let t=(typed||"").trim().toLowerCase();const pr=pronoun.toLowerCase();if(t.startsWith(pr+" "))t=t.slice(pr.length+1).trim();return t;}
// ─── APP STATE ───────────────────────────────────────────────────────
const S={
page:"conjugation",conjMode:"byTense",conjScore:{correct:0,total:0},conjStreak:0,
conjTense:"present",conjVerb:null,conjAnswers:{},conjChecked:false,
randomQuestions:[],randomAnswers:{},randomChecked:false,conjPassive:false,
vocabTopic:"All",vocabDirection:"de-en",vocabIncludePlurals:false,vocabQuiz:[],vocabQIdx:0,vocabTyped:"",vocabChecked:false,vocabLastCorrect:false,vocabScore:{correct:0,total:0},
wsType:"mixed",wsData:null,wsShowAnswers:false,lang:"de"
};
// ─── NAVIGATION ──────────────────────────────────────────────────────
document.getElementById("nav").addEventListener("click",e=>{
if(!e.target.matches(".nav-btn"))return;
S.page=e.target.dataset.page;
document.querySelectorAll(".nav-btn").forEach(b=>b.classList.toggle("active",b.dataset.page===S.page));
render();
});
document.querySelectorAll('.lang-btn').forEach(b=>b.addEventListener('click',()=>{
if(b.dataset.lang===S.lang)return;
S.lang=b.dataset.lang;
if(S.lang==="es"){VERBS=ES_VERBS;VOCAB=ES_VOCAB;TOPICS=ES_TOPICS;}
else{VERBS=DE_VERBS;VOCAB=DE_VOCAB;TOPICS=DE_TOPICS;}
S.conjVerb=null;S.conjAnswers={};S.conjChecked=false;S.randomQuestions=[];S.randomChecked=false;
S.vocabQuiz=[];S.vocabQIdx=0;S.vocabTyped="";S.vocabChecked=false;S.wsData=null;
document.body.className="lang-"+S.lang;
document.querySelectorAll('.lang-btn').forEach(btn=>btn.classList.toggle('active',btn.dataset.lang===S.lang));
render();
}));
// ─── CONJUGATION: BY-TENSE ──────────────────────────────────────────
function newVerb(){S.conjVerb=randItem(VERBS);S.conjAnswers={};S.conjChecked=false;}
function checkByTense(){
S.conjChecked=true;
const c=S.conjPassive?getPassiveForms(S.conjVerb.pastParticiple,S.conjTense):S.conjVerb[S.conjTense];
let all=true,n=0;
PRONOUNS.forEach(p=>{if((S.conjAnswers[p]||"").trim().toLowerCase()===c[p].toLowerCase())n++;else all=false;});
S.conjScore.correct+=n;S.conjScore.total+=6;
S.conjStreak=all?S.conjStreak+1:0;
renderConj();
}
function renderByTense(){
if(!S.conjVerb)newVerb();
const v=S.conjVerb,t=S.conjTense,passive=S.conjPassive;
const c=passive?getPassiveForms(v.pastParticiple,t):v[t];
const pct=S.conjScore.total>0?Math.round(S.conjScore.correct/S.conjScore.total*100):null;
let sc='';
if(pct!==null||S.conjStreak>1)sc=`<div class="score-bar no-print">${pct!==null?`<span>Accuracy: <span class="score-num ${pct>=80?'good':pct>=50?'ok':'poor'}">${pct}%</span></span>`:''} ${S.conjStreak>1?`<span class="streak">\uD83D\uDD25 ${S.conjStreak} in a row</span>`:''}</div>`;
const passivePlaceholder=passive?`e.g. ${c["er/sie/es"]}`:"...";
return`<div class="tense-selector no-print">${ALL_TENSES.map(tn=>`<button class="tense-btn ${t===tn?'active':''}" data-tense="${tn}">${TENSE_LABELS[tn]}</button>`).join('')}</div><div class="voice-toggle no-print"><button class="voice-btn ${!passive?'active':''}" data-voice="active">Aktiv</button><button class="voice-btn ${passive?'active':''}" data-voice="passive">Passiv (Vorgangspassiv)</button></div>${sc}<div class="drill-verb-display"><div class="drill-verb">${v.infinitive}</div><div class="drill-meaning">${v.meaning}${passive?` — <em style="opacity:0.7;font-size:0.85rem">Partizip II: ${v.pastParticiple}</em>`:''}</div><div class="drill-tense">${TENSE_LABELS[t]}${passive?' — Passiv':''}</div></div><div class="drill-grid">${PRONOUNS.map((p,i)=>{const a=S.conjAnswers[p]||'',ok=S.conjChecked&&a.trim().toLowerCase()===c[p].toLowerCase(),bad=S.conjChecked&&!ok;return`<div class="drill-item"><span class="drill-pronoun">${p}</span><div style="flex:1"><input class="drill-input ${S.conjChecked?(ok?'correct':'incorrect'):''}" data-pronoun="${p}" data-idx="${i}" value="${a}" ${S.conjChecked?'disabled':''} placeholder="${passivePlaceholder}" autocomplete="off" spellcheck="false">${bad?`<div class="drill-answer">\u2192 ${c[p]}</div>`:''}</div></div>`;}).join('')}</div><div class="btn-group no-print">${!S.conjChecked?`<button class="btn btn-primary" id="checkBtn">Check Answers</button><button class="btn btn-secondary" id="skipBtn">Skip</button>`:`<button class="btn btn-primary" id="nextBtn">Next Verb \u2192</button>`}</div>`;
}
function bindByTense(){
document.querySelectorAll('.tense-btn').forEach(b=>b.addEventListener('click',()=>{S.conjTense=b.dataset.tense;newVerb();renderConj();}));
document.querySelectorAll('.drill-input').forEach(inp=>{
inp.addEventListener('input',()=>{S.conjAnswers[inp.dataset.pronoun]=inp.value;});
inp.addEventListener('keydown',e=>{if(e.key==='Enter'){const i=parseInt(inp.dataset.idx);if(i<PRONOUNS.length-1)document.querySelector(`.drill-input[data-idx="${i+1}"]`)?.focus();else checkByTense();}});
});
document.getElementById('checkBtn')?.addEventListener('click',checkByTense);
document.getElementById('skipBtn')?.addEventListener('click',()=>{newVerb();renderConj();});
document.getElementById('nextBtn')?.addEventListener('click',()=>{newVerb();renderConj();});
document.querySelectorAll('.voice-btn').forEach(b=>b.addEventListener('click',()=>{S.conjPassive=b.dataset.voice==='passive';newVerb();renderConj();}));
if(!S.conjChecked)document.querySelector('.drill-input[data-idx="0"]')?.focus();
}
// ─── CONJUGATION: RANDOM ────────────────────────────────────────────
function genRandom(){
const qs=[];for(let i=0;i<10;i++){const v=randItem(VERBS),t=randItem(ALL_TENSES),p=randItem(PRONOUNS);qs.push({verb:v,tense:t,pronoun:p,answer:v[t][p]});}
S.randomQuestions=qs;S.randomAnswers={};S.randomChecked=false;
}
function checkRandom(){
S.randomChecked=true;let n=0;
S.randomQuestions.forEach((q,i)=>{if(normRandom(S.randomAnswers[i],q.pronoun)===q.answer.toLowerCase())n++;});
S.conjScore.correct+=n;S.conjScore.total+=10;
S.conjStreak=n===10?S.conjStreak+1:0;
renderConj();
}
function renderRandom(){
if(S.randomQuestions.length===0)genRandom();
const qs=S.randomQuestions,pct=S.conjScore.total>0?Math.round(S.conjScore.correct/S.conjScore.total*100):null;
let res='';
if(S.randomChecked){const c=qs.filter((q,i)=>normRandom(S.randomAnswers[i],q.pronoun)===q.answer.toLowerCase()).length;res=`<div class="score-bar"><span>This round: <span class="score-num ${c>=8?'good':c>=5?'ok':'poor'}">${c}/10</span></span>${pct!==null?`<span>Overall: <span class="score-num ${pct>=80?'good':pct>=50?'ok':'poor'}">${pct}%</span></span>`:''}</div>`;}
else if(pct!==null)res=`<div class="score-bar no-print"><span>Overall accuracy: <span class="score-num ${pct>=80?'good':pct>=50?'ok':'poor'}">${pct}%</span></span></div>`;
return`${res}<div class="info-box">10 random questions \u2014 any verb, any tense, any pronoun. Press <strong>Enter</strong> to move between fields.</div>${qs.map((q,i)=>{const a=S.randomAnswers[i]||'',ok=S.randomChecked&&normRandom(a,q.pronoun)===q.answer.toLowerCase(),bad=S.randomChecked&&!ok;return`<div class="random-item"><div class="random-prompt"><span class="random-number">${i+1}</span><strong>${q.verb.infinitive}</strong> (${q.verb.meaning})<span class="tense-tag">${TENSE_LABELS[q.tense]}</span></div><div class="drill-item" style="margin-top:8px"><span class="drill-pronoun">${q.pronoun}</span><div style="flex:1"><input class="drill-input ${S.randomChecked?(ok?'correct':'incorrect'):''}" data-ridx="${i}" value="${a}" ${S.randomChecked?'disabled':''} placeholder="conjugated form..." autocomplete="off" spellcheck="false">${bad?`<div class="drill-answer">\u2192 ${q.answer}</div>`:''}</div></div></div>`;}).join('')}<div class="btn-group no-print">${!S.randomChecked?`<button class="btn btn-primary" id="checkRandomBtn">Check All</button><button class="btn btn-secondary" id="regenBtn">New Questions</button>`:`<button class="btn btn-primary" id="nextRandomBtn">New Round \u2192</button>`}</div>`;
}
function bindRandom(){
document.querySelectorAll('.drill-input[data-ridx]').forEach(inp=>{
inp.addEventListener('input',()=>{S.randomAnswers[parseInt(inp.dataset.ridx)]=inp.value;});
inp.addEventListener('keydown',e=>{if(e.key==='Enter'){const i=parseInt(inp.dataset.ridx);if(i<9)document.querySelector(`.drill-input[data-ridx="${i+1}"]`)?.focus();else checkRandom();}});
});
document.getElementById('checkRandomBtn')?.addEventListener('click',checkRandom);
document.getElementById('regenBtn')?.addEventListener('click',()=>{genRandom();renderConj();});
document.getElementById('nextRandomBtn')?.addEventListener('click',()=>{genRandom();renderConj();});
if(!S.randomChecked)document.querySelector('.drill-input[data-ridx="0"]')?.focus();
}
// ─── CONJUGATION: MAIN ──────────────────────────────────────────────
function renderConj(){
const m=document.getElementById("main-content"),mode=S.conjMode;
const content=mode==="byTense"?renderByTense():renderRandom();
m.innerHTML=`<div class="card"><h2 class="card-header">Verb Conjugation Drill</h2><div class="mode-toggle no-print"><button class="mode-btn ${mode==='byTense'?'active':''}" data-mode="byTense">By Tense</button><button class="mode-btn ${mode==='random'?'active':''}" data-mode="random">Random Mix</button></div>${content}</div><div class="db-stats no-print">${VERBS.length} verbs loaded \u00b7 ${ALL_TENSES.length} tenses</div>`;
document.querySelectorAll('.mode-btn').forEach(b=>b.addEventListener('click',()=>{S.conjMode=b.dataset.mode;renderConj();}));
if(mode==="byTense")bindByTense();else bindRandom();
}
// ─── CONJUGATION: SPANISH ────────────────────────────────────────────
function newVerbES(){S.conjVerb=randItem(ES_VERBS);S.conjAnswers={};S.conjChecked=false;}
function checkByTenseES(){
S.conjChecked=true;
const c=S.conjVerb[S.conjTense];
let all=true,n=0;
ES_PRONOUNS.forEach(p=>{if((S.conjAnswers[p]||"").trim().toLowerCase()===c[p].toLowerCase())n++;else all=false;});
S.conjScore.correct+=n;S.conjScore.total+=6;
S.conjStreak=all?S.conjStreak+1:0;
renderConjES();
}
function renderByTenseES(){
if(!S.conjVerb||!S.conjVerb.presente)newVerbES();
const v=S.conjVerb,t=S.conjTense;
if(!v[t]){S.conjTense="presente";return renderByTenseES();}
const c=v[t];
const pct=S.conjScore.total>0?Math.round(S.conjScore.correct/S.conjScore.total*100):null;
let sc='';
if(pct!==null||S.conjStreak>1)sc=`<div class="score-bar no-print">${pct!==null?`<span>Accuracy: <span class="score-num ${pct>=80?'good':pct>=50?'ok':'poor'}">${pct}%</span></span>`:''} ${S.conjStreak>1?`<span class="streak">🔥 ${S.conjStreak} in a row</span>`:''}</div>`;
return`<div class="tense-selector no-print">${ES_ALL_TENSES.map(tn=>`<button class="tense-btn ${t===tn?'active':''}" data-tense="${tn}">${ES_TENSE_LABELS[tn]}</button>`).join('')}</div>${sc}<div class="drill-verb-display"><div class="drill-verb">${v.infinitive}</div><div class="drill-meaning">${v.meaning}</div><div class="drill-tense">${ES_TENSE_LABELS[t]}</div></div><div class="drill-grid">${ES_PRONOUNS.map((p,i)=>{const a=S.conjAnswers[p]||'',ok=S.conjChecked&&a.trim().toLowerCase()===c[p].toLowerCase(),bad=S.conjChecked&&!ok;return`<div class="drill-item"><span class="drill-pronoun">${p}</span><div style="flex:1"><input class="drill-input ${S.conjChecked?(ok?'correct':'incorrect'):''}" data-pronoun="${p}" data-idx="${i}" value="${a}" ${S.conjChecked?'disabled':''} placeholder="..." autocomplete="off" spellcheck="false">${bad?`<div class="drill-answer">→ ${c[p]}</div>`:''}</div></div>`;}).join('')}</div><div class="btn-group no-print">${!S.conjChecked?`<button class="btn btn-primary" id="checkBtn">Check Answers</button><button class="btn btn-secondary" id="skipBtn">Skip</button>`:`<button class="btn btn-primary" id="nextBtn">Next Verb →</button>`}</div>`;
}
function bindByTenseES(){
document.querySelectorAll('.tense-btn').forEach(b=>b.addEventListener('click',()=>{S.conjTense=b.dataset.tense;newVerbES();renderConjES();}));
document.querySelectorAll('.drill-input').forEach(inp=>{
inp.addEventListener('input',()=>{S.conjAnswers[inp.dataset.pronoun]=inp.value;});
inp.addEventListener('keydown',e=>{if(e.key==='Enter'){const i=parseInt(inp.dataset.idx);if(i<ES_PRONOUNS.length-1)document.querySelector(`.drill-input[data-idx="${i+1}"]`)?.focus();else checkByTenseES();}});
});
document.getElementById('checkBtn')?.addEventListener('click',checkByTenseES);
document.getElementById('skipBtn')?.addEventListener('click',()=>{newVerbES();renderConjES();});
document.getElementById('nextBtn')?.addEventListener('click',()=>{newVerbES();renderConjES();});
if(!S.conjChecked)document.querySelector('.drill-input[data-idx="0"]')?.focus();
}
function genRandomES(){
const qs=[];for(let i=0;i<10;i++){const v=randItem(ES_VERBS),t=randItem(ES_ALL_TENSES),p=randItem(ES_PRONOUNS);if(v[t]&&v[t][p])qs.push({verb:v,tense:t,pronoun:p,answer:v[t][p]});}
S.randomQuestions=qs;S.randomAnswers={};S.randomChecked=false;
}
function checkRandomES(){
S.randomChecked=true;let n=0;
S.randomQuestions.forEach((q,i)=>{if(normRandom(S.randomAnswers[i],q.pronoun)===q.answer.toLowerCase())n++;});
S.conjScore.correct+=n;S.conjScore.total+=S.randomQuestions.length;
S.conjStreak=n===S.randomQuestions.length?S.conjStreak+1:0;
renderConjES();
}
function renderRandomES(){
if(S.randomQuestions.length===0)genRandomES();
const qs=S.randomQuestions,pct=S.conjScore.total>0?Math.round(S.conjScore.correct/S.conjScore.total*100):null;
let res='';
if(S.randomChecked){const c=qs.filter((q,i)=>normRandom(S.randomAnswers[i],q.pronoun)===q.answer.toLowerCase()).length;res=`<div class="score-bar"><span>This round: <span class="score-num ${c>=8?'good':c>=5?'ok':'poor'}">${c}/${qs.length}</span></span>${pct!==null?`<span>Overall: <span class="score-num ${pct>=80?'good':pct>=50?'ok':'poor'}">${pct}%</span></span>`:''}</div>`;}
else if(pct!==null)res=`<div class="score-bar no-print"><span>Overall accuracy: <span class="score-num ${pct>=80?'good':pct>=50?'ok':'poor'}">${pct}%</span></span></div>`;
return`${res}<div class="info-box">10 random questions — any verb, any tense, any pronoun. Press <strong>Enter</strong> to move between fields.</div>${qs.map((q,i)=>{const a=S.randomAnswers[i]||'',ok=S.randomChecked&&normRandom(a,q.pronoun)===q.answer.toLowerCase(),bad=S.randomChecked&&!ok;return`<div class="random-item"><div class="random-prompt"><span class="random-number">${i+1}</span><strong>${q.verb.infinitive}</strong> (${q.verb.meaning})<span class="tense-tag">${ES_TENSE_LABELS[q.tense]}</span></div><div class="drill-item" style="margin-top:8px"><span class="drill-pronoun">${q.pronoun}</span><div style="flex:1"><input class="drill-input ${S.randomChecked?(ok?'correct':'incorrect'):''}" data-ridx="${i}" value="${a}" ${S.randomChecked?'disabled':''} placeholder="conjugated form..." autocomplete="off" spellcheck="false">${bad?`<div class="drill-answer">→ ${q.answer}</div>`:''}</div></div></div>`;}).join('')}<div class="btn-group no-print">${!S.randomChecked?`<button class="btn btn-primary" id="checkRandomBtn">Check All</button><button class="btn btn-secondary" id="regenBtn">New Questions</button>`:`<button class="btn btn-primary" id="nextRandomBtn">New Round →</button>`}</div>`;
}
function bindRandomES(){
document.querySelectorAll('.drill-input[data-ridx]').forEach(inp=>{
inp.addEventListener('input',()=>{S.randomAnswers[parseInt(inp.dataset.ridx)]=inp.value;});
inp.addEventListener('keydown',e=>{if(e.key==='Enter'){const i=parseInt(inp.dataset.ridx);if(i<S.randomQuestions.length-1)document.querySelector(`.drill-input[data-ridx="${i+1}"]`)?.focus();else checkRandomES();}});
});
document.getElementById('checkRandomBtn')?.addEventListener('click',checkRandomES);
document.getElementById('regenBtn')?.addEventListener('click',()=>{genRandomES();renderConjES();});
document.getElementById('nextRandomBtn')?.addEventListener('click',()=>{genRandomES();renderConjES();});
if(!S.randomChecked)document.querySelector('.drill-input[data-ridx="0"]')?.focus();
}
function renderConjES(){
const m=document.getElementById("main-content"),mode=S.conjMode;
if(!S.conjVerb||!S.conjVerb.presente){newVerbES();}
const content=mode==="byTense"?renderByTenseES():renderRandomES();
m.innerHTML=`<div class="card"><h2 class="card-header">Verb Conjugation Drill</h2><div class="mode-toggle no-print"><button class="mode-btn ${mode==='byTense'?'active':''}" data-mode="byTense">By Tense</button><button class="mode-btn ${mode==='random'?'active':''}" data-mode="random">Random Mix</button></div>${content}</div><div class="db-stats no-print">${ES_VERBS.length} verbs loaded · ${ES_ALL_TENSES.length} tenses</div>`;
document.querySelectorAll('.mode-btn').forEach(b=>b.addEventListener('click',()=>{S.conjMode=b.dataset.mode;renderConjES();}));
if(mode==="byTense")bindByTenseES();else bindRandomES();
}
// ─── VOCABULARY ──────────────────────────────────────────────────────
function buildVocabQuiz(){
const pool=S.vocabTopic==="All"?VOCAB:VOCAB.filter(v=>v.topic===S.vocabTopic);
const qs=[];
shuffle(pool).forEach(word=>{
const dir=S.vocabDirection==="mixed"?(Math.random()<0.5?"de-en":"en-de"):S.vocabDirection;
if(dir==="de-en"){
const ans=word.english.split(/\s*\/\s*/).map(s=>s.trim().toLowerCase()).filter(Boolean);
qs.push({type:"de-en",word,prompt:word.german,promptLabel:"Translate to English",answer:ans});
}else{
qs.push({type:"en-de",word,prompt:word.english,promptLabel:"Translate to German (with article)",answer:word.german.trim().toLowerCase()});
}
if(S.vocabIncludePlurals&&word.plural&&Math.random()<0.35){
qs.push({type:"plural",word,prompt:word.german,promptLabel:"What is the plural of:",answer:word.plural.trim().toLowerCase()});
}
});
S.vocabQuiz=qs;S.vocabQIdx=0;S.vocabTyped="";S.vocabChecked=false;S.vocabLastCorrect=false;S.vocabScore={correct:0,total:0};
}
function checkVocabAnswer(){
if(S.vocabChecked)return;
const q=S.vocabQuiz[S.vocabQIdx],typed=S.vocabTyped.trim().toLowerCase();
S.vocabLastCorrect=Array.isArray(q.answer)?q.answer.some(a=>typed===a):typed===q.answer;
S.vocabChecked=true;S.vocabScore.total++;
if(S.vocabLastCorrect)S.vocabScore.correct++;
renderVocab();
}
function renderVocab(){
if(!S.vocabQuiz.length)buildVocabQuiz();
const m=document.getElementById("main-content");
const gLabel={m:"der (m)",f:"die (f)",n:"das (n)"};
const topicBar=`<div class="filter-bar no-print"><button class="filter-chip ${S.vocabTopic==="All"?"active":""}" data-topic="All">All</button>${TOPICS.map(t=>`<button class="filter-chip ${S.vocabTopic===t?"active":""}" data-topic="${t}">${t}</button>`).join("")}</div>`;
const optBar=`<div class="filter-bar no-print"><button class="filter-chip ${S.vocabDirection==="de-en"?"active":""}" data-dir="de-en">DE \u2192 EN</button><button class="filter-chip ${S.vocabDirection==="en-de"?"active":""}" data-dir="en-de">EN \u2192 DE</button><button class="filter-chip ${S.vocabDirection==="mixed"?"active":""}" data-dir="mixed">Mixed</button><button class="filter-chip ${S.vocabIncludePlurals?"active":""}" id="pluralToggle">+ Plurals</button></div>`;
function bindFilters(){
document.querySelectorAll("[data-topic]").forEach(b=>b.addEventListener("click",()=>{S.vocabTopic=b.dataset.topic;buildVocabQuiz();renderVocab();}));
document.querySelectorAll("[data-dir]").forEach(b=>b.addEventListener("click",()=>{S.vocabDirection=b.dataset.dir;buildVocabQuiz();renderVocab();}));
document.getElementById("pluralToggle").addEventListener("click",()=>{S.vocabIncludePlurals=!S.vocabIncludePlurals;buildVocabQuiz();renderVocab();});
}
if(S.vocabQIdx>=S.vocabQuiz.length){
const p=S.vocabScore.total>0?Math.round(S.vocabScore.correct/S.vocabScore.total*100):100;
m.innerHTML=`<div class="card">${topicBar}${optBar}<div style="text-align:center;padding:40px 20px"><div style="font-size:3rem;margin-bottom:12px">${p>=80?"\uD83C\uDF89":p>=50?"\uD83D\uDC4D":"\uD83D\uDCDA"}</div><div style="font-family:'DM Serif Display',serif;font-size:1.6rem;margin-bottom:12px">Round complete!</div><p style="font-size:1.1rem;margin-bottom:8px">Score: <span class="score-num ${p>=80?"good":p>=50?"ok":"poor"}">${S.vocabScore.correct}/${S.vocabScore.total}</span> (${p}%)</p><div class="btn-group" style="justify-content:center;margin-top:24px"><button class="btn btn-primary" id="vocabRestart">Go Again</button></div></div></div><div class="db-stats no-print">${VOCAB.length} words \u00b7 ${TOPICS.length} topics</div>`;
bindFilters();document.getElementById("vocabRestart").addEventListener("click",()=>{buildVocabQuiz();renderVocab();});return;
}
const q=S.vocabQuiz[S.vocabQIdx],w=q.word;
const pct=S.vocabScore.total>0?Math.round(S.vocabScore.correct/S.vocabScore.total*100):null;
const showGender=q.type==="de-en"||q.type==="plural";
const gBadge=showGender?`<span class="flashcard-gender gender-${w.gender}" style="margin-top:10px">${gLabel[w.gender]}</span>`:"";
const displayAns=Array.isArray(q.answer)?q.answer.join(" / "):q.answer;
const placeholder=q.type==="de-en"?"Type the English translation…":q.type==="en-de"?"Type with article, e.g. die Wohnung…":"Type the plural form, e.g. die Wohnungen…";
const scoreRow=pct!==null?`<div class="score-bar no-print"><span>Score: <span class="score-num ${pct>=80?"good":pct>=50?"ok":"poor"}">${S.vocabScore.correct}/${S.vocabScore.total}</span></span><span class="vocab-progress">Question ${S.vocabQIdx+1} of ${S.vocabQuiz.length}</span></div>`:`<div class="vocab-progress">Question ${S.vocabQIdx+1} of ${S.vocabQuiz.length}</div>`;
const feedback=S.vocabChecked?`<div class="vocab-feedback ${S.vocabLastCorrect?"v-correct":"v-incorrect"}">${S.vocabLastCorrect?"\u2713 Correct!":"\u2717 Incorrect"}${!S.vocabLastCorrect?`<span class="vocab-correct-answer">\u2192 ${displayAns}</span>`:""}</div>`:"";
m.innerHTML=`<div class="card"><h2 class="card-header">Vocabulary Practice</h2>${topicBar}${optBar}${scoreRow}<div class="vocab-prompt-card"><div class="vocab-prompt-label">${q.promptLabel}</div><div class="vocab-prompt-word">${q.prompt}</div>${gBadge}<div class="vocab-topic-tag">${w.topic}</div></div><div class="vocab-input-area"><input class="vocab-type-input${S.vocabChecked?(S.vocabLastCorrect?" v-correct":" v-incorrect"):""}" id="vocabInput" type="text" placeholder="${placeholder}" value="${S.vocabTyped.replace(/"/g,""")}" autocomplete="off" spellcheck="false"${S.vocabChecked?" disabled":""}>${!S.vocabChecked?`<button class="btn btn-primary" id="vocabCheckBtn">Check</button>`:`<button class="btn btn-primary" id="vocabNextBtn">Next \u2192</button>`}</div>${feedback}</div><div class="db-stats no-print">${VOCAB.length} words loaded \u00b7 ${TOPICS.length} topics</div>`;
bindFilters();
const inp=document.getElementById("vocabInput");
if(inp){
inp.addEventListener("input",e=>{S.vocabTyped=e.target.value;});
inp.addEventListener("keydown",e=>{if(e.key==="Enter"){if(!S.vocabChecked)checkVocabAnswer();else{S.vocabTyped="";S.vocabChecked=false;S.vocabQIdx++;renderVocab();}}});
if(!S.vocabChecked)inp.focus();
}
document.getElementById("vocabCheckBtn")?.addEventListener("click",checkVocabAnswer);
document.getElementById("vocabNextBtn")?.addEventListener("click",()=>{S.vocabTyped="";S.vocabChecked=false;S.vocabQIdx++;renderVocab();});
}
// ─── VOCABULARY: SPANISH ─────────────────────────────────────────────
function buildVocabQuizES(){
const pool=S.vocabTopic==="All"?ES_VOCAB:ES_VOCAB.filter(v=>v.topic===S.vocabTopic);
const qs=[];
shuffle(pool).forEach(word=>{
const dir=S.vocabDirection==="mixed"?(Math.random()<0.5?"es-en":"en-es"):S.vocabDirection.replace("de-en","es-en").replace("en-de","en-es");
if(dir==="es-en"){
const ans=word.english.split(/\s*\/\s*/).map(s=>s.trim().toLowerCase()).filter(Boolean);
qs.push({type:"es-en",word,prompt:word.spanish,promptLabel:"Translate to English",answer:ans});
}else{
qs.push({type:"en-es",word,prompt:word.english,promptLabel:"Translate to Spanish (with article)",answer:word.spanish.trim().toLowerCase()});
}
});
S.vocabQuiz=qs;S.vocabQIdx=0;S.vocabTyped="";S.vocabChecked=false;S.vocabLastCorrect=false;S.vocabScore={correct:0,total:0};
}
function checkVocabAnswerES(){
if(S.vocabChecked)return;
const q=S.vocabQuiz[S.vocabQIdx],typed=S.vocabTyped.trim().toLowerCase();
S.vocabLastCorrect=Array.isArray(q.answer)?q.answer.some(a=>typed===a):typed===q.answer;
S.vocabChecked=true;S.vocabScore.total++;
if(S.vocabLastCorrect)S.vocabScore.correct++;
renderVocabES();
}
function renderVocabES(){
if(!S.vocabQuiz.length)buildVocabQuizES();
const m=document.getElementById("main-content");
const gLabel={m:"el (m)",f:"la (f)"};
const topicBar=`<div class="filter-bar no-print"><button class="filter-chip ${S.vocabTopic==="All"?"active":""}" data-topic="All">All</button>${ES_TOPICS.map(t=>`<button class="filter-chip ${S.vocabTopic===t?"active":""}" data-topic="${t}">${t}</button>`).join("")}</div>`;
const optBar=`<div class="filter-bar no-print"><button class="filter-chip ${S.vocabDirection==="de-en"||S.vocabDirection==="es-en"?"active":""}" data-dir="es-en">ES → EN</button><button class="filter-chip ${S.vocabDirection==="en-de"||S.vocabDirection==="en-es"?"active":""}" data-dir="en-es">EN → ES</button><button class="filter-chip ${S.vocabDirection==="mixed"?"active":""}" data-dir="mixed">Mixed</button></div>`;
function bindFiltersES(){
document.querySelectorAll("[data-topic]").forEach(b=>b.addEventListener("click",()=>{S.vocabTopic=b.dataset.topic;buildVocabQuizES();renderVocabES();}));
document.querySelectorAll("[data-dir]").forEach(b=>b.addEventListener("click",()=>{S.vocabDirection=b.dataset.dir;buildVocabQuizES();renderVocabES();}));
}
if(S.vocabQIdx>=S.vocabQuiz.length){
const p=S.vocabScore.total>0?Math.round(S.vocabScore.correct/S.vocabScore.total*100):100;
m.innerHTML=`<div class="card">${topicBar}${optBar}<div style="text-align:center;padding:40px 20px"><div style="font-size:3rem;margin-bottom:12px">${p>=80?"🎉":p>=50?"👍":"📚"}</div><div style="font-family:'DM Serif Display',serif;font-size:1.6rem;margin-bottom:12px">Round complete!</div><p style="font-size:1.1rem;margin-bottom:8px">Score: <span class="score-num ${p>=80?"good":p>=50?"ok":"poor"}">${S.vocabScore.correct}/${S.vocabScore.total}</span> (${p}%)</p><div class="btn-group" style="justify-content:center;margin-top:24px"><button class="btn btn-primary" id="vocabRestart">Go Again</button></div></div></div><div class="db-stats no-print">${ES_VOCAB.length} words · ${ES_TOPICS.length} topics</div>`;
bindFiltersES();document.getElementById("vocabRestart").addEventListener("click",()=>{buildVocabQuizES();renderVocabES();});return;
}
const q=S.vocabQuiz[S.vocabQIdx],w=q.word;
const pct=S.vocabScore.total>0?Math.round(S.vocabScore.correct/S.vocabScore.total*100):null;
const showGender=q.type==="es-en";
const gBadge=showGender&&gLabel[w.gender]?`<span class="flashcard-gender gender-${w.gender}" style="margin-top:10px">${gLabel[w.gender]}</span>`:"";
const displayAns=Array.isArray(q.answer)?q.answer.join(" / "):q.answer;
const placeholder=q.type==="es-en"?"Type the English translation…":"Type with article, e.g. la casa…";
const scoreRow=pct!==null?`<div class="score-bar no-print"><span>Score: <span class="score-num ${pct>=80?"good":pct>=50?"ok":"poor"}">${S.vocabScore.correct}/${S.vocabScore.total}</span></span><span class="vocab-progress">Question ${S.vocabQIdx+1} of ${S.vocabQuiz.length}</span></div>`:`<div class="vocab-progress">Question ${S.vocabQIdx+1} of ${S.vocabQuiz.length}</div>`;
const feedback=S.vocabChecked?`<div class="vocab-feedback ${S.vocabLastCorrect?"v-correct":"v-incorrect"}">${S.vocabLastCorrect?"✓ Correct!":"✗ Incorrect"}${!S.vocabLastCorrect?`<span class="vocab-correct-answer">→ ${displayAns}</span>`:""}</div>`:"";
m.innerHTML=`<div class="card"><h2 class="card-header">Vocabulary Practice</h2>${topicBar}${optBar}${scoreRow}<div class="vocab-prompt-card"><div class="vocab-prompt-label">${q.promptLabel}</div><div class="vocab-prompt-word">${q.prompt}</div>${gBadge}<div class="vocab-topic-tag">${w.topic}</div></div><div class="vocab-input-area"><input class="vocab-type-input${S.vocabChecked?(S.vocabLastCorrect?" v-correct":" v-incorrect"):""}" id="vocabInput" type="text" placeholder="${placeholder}" value="${S.vocabTyped.replace(/"/g,""")}" autocomplete="off" spellcheck="false"${S.vocabChecked?" disabled":""}>${!S.vocabChecked?`<button class="btn btn-primary" id="vocabCheckBtn">Check</button>`:`<button class="btn btn-primary" id="vocabNextBtn">Next →</button>`}</div>${feedback}</div><div class="db-stats no-print">${ES_VOCAB.length} words loaded · ${ES_TOPICS.length} topics</div>`;
bindFiltersES();
const inp=document.getElementById("vocabInput");
if(inp){
inp.addEventListener("input",e=>{S.vocabTyped=e.target.value;});
inp.addEventListener("keydown",e=>{if(e.key==="Enter"){if(!S.vocabChecked)checkVocabAnswerES();else{S.vocabTyped="";S.vocabChecked=false;S.vocabQIdx++;renderVocabES();}}});
if(!S.vocabChecked)inp.focus();
}
document.getElementById("vocabCheckBtn")?.addEventListener("click",checkVocabAnswerES);
document.getElementById("vocabNextBtn")?.addEventListener("click",()=>{S.vocabTyped="";S.vocabChecked=false;S.vocabQIdx++;renderVocabES();});
}
// ─── WORKSHEET ───────────────────────────────────────────────────────
function genWS(){
const ws={sections:[],answers:[]};S.wsShowAnswers=false;
if(S.wsType==="conjugation"||S.wsType==="mixed"){
const verbs=pick(VERBS,3),sec={title:"Section A — Verb Conjugation",questions:[]};let q=1;
verbs.forEach(v=>{const t=randItem(ALL_TENSES),ps=pick(PRONOUNS,3);ps.forEach(p=>{sec.questions.push({num:q,text:`Conjugate "${v.infinitive}" (${v.meaning}) in the ${TENSE_LABELS[t]} for <strong>${p}</strong>:`});ws.answers.push({num:q,answer:`${p} ${v[t][p]}`});q++;});});
ws.sections.push(sec);
}
if(S.wsType==="vocab"||S.wsType==="mixed"){
const words=pick(VOCAB,8),lB=S.wsType==="mixed"?"Section B":"Section A",lC=S.wsType==="mixed"?"Section C":"Section B";
const sB=ws.answers.length+1,secB={title:`${lB} — Vocabulary (German → English)`,questions:[]};
words.slice(0,4).forEach((w,i)=>{secB.questions.push({num:sB+i,text:`${w.german} = `});ws.answers.push({num:sB+i,answer:w.english});});
ws.sections.push(secB);
const sC=ws.answers.length+1,secC={title:`${lC} — Vocabulary (English → German)`,questions:[]};
words.slice(4).forEach((w,i)=>{secC.questions.push({num:sC+i,text:`${w.english} = `});ws.answers.push({num:sC+i,answer:w.german});});
ws.sections.push(secC);
}
S.wsData=ws;
}
function renderWS(){
if(!S.wsData)genWS();const ws=S.wsData,m=document.getElementById("main-content");
m.innerHTML=`<div class="card"><h2 class="card-header">Randomised Worksheets</h2><div class="filter-bar no-print"><button class="filter-chip ${S.wsType==='mixed'?'active':''}" data-wstype="mixed">Mixed</button><button class="filter-chip ${S.wsType==='conjugation'?'active':''}" data-wstype="conjugation">Conjugation only</button><button class="filter-chip ${S.wsType==='vocab'?'active':''}" data-wstype="vocab">Vocab only</button></div><div class="worksheet-preview"><div class="ws-title">German Practice Worksheet</div><div class="ws-subtitle">A-Level / Adult Beginners</div><div class="ws-name-line"><span class="ws-name-field">Name: _________________________</span><span class="ws-name-field">Date: ______________</span></div>${ws.sections.map(s=>`<div class="ws-section"><div class="ws-section-title">${s.title}</div>${s.questions.map(q=>`<div class="ws-question"><span class="ws-q-num">${q.num}.</span><span>${q.text}<span class="ws-blank"></span></span></div>`).join('')}</div>`).join('')}${S.wsShowAnswers?`<div class="ws-answer-key"><strong>Answer Key</strong>${ws.answers.map(a=>`<div>${a.num}. ${a.answer}</div>`).join('')}</div>`:''}</div><div class="btn-group no-print"><button class="btn btn-primary" id="wsGenerate">Generate New \u21BB</button><button class="btn btn-secondary" id="wsToggleAnswers">${S.wsShowAnswers?'Hide Answers':'Show Answers'}</button><button class="btn btn-secondary" id="wsPrint">Print Worksheet \uD83D\uDDA8</button></div></div>`;
document.querySelectorAll('[data-wstype]').forEach(b=>b.addEventListener('click',()=>{S.wsType=b.dataset.wstype;genWS();renderWS();}));
document.getElementById('wsGenerate').addEventListener('click',()=>{genWS();renderWS();});
document.getElementById('wsToggleAnswers').addEventListener('click',()=>{S.wsShowAnswers=!S.wsShowAnswers;renderWS();});
document.getElementById('wsPrint').addEventListener('click',()=>window.print());
}
// ─── WORKSHEET: SPANISH ──────────────────────────────────────────────
function genWSES(){
const ws={sections:[],answers:[]};S.wsShowAnswers=false;
if(S.wsType==="conjugation"||S.wsType==="mixed"){
const verbs=pick(ES_VERBS,3),sec={title:"Sección A — Conjugación Verbal",questions:[]};let q=1;
verbs.forEach(v=>{const t=randItem(ES_ALL_TENSES),ps=pick(ES_PRONOUNS,3);ps.forEach(p=>{if(v[t]&&v[t][p]){sec.questions.push({num:q,text:`Conjuga "${v.infinitive}" (${v.meaning}) en el ${ES_TENSE_LABELS[t]} para <strong>${p}</strong>:`});ws.answers.push({num:q,answer:`${p} ${v[t][p]}`});q++;}});});
ws.sections.push(sec);
}
if(S.wsType==="vocab"||S.wsType==="mixed"){
const words=pick(ES_VOCAB,8),lB=S.wsType==="mixed"?"Sección B":"Sección A",lC=S.wsType==="mixed"?"Sección C":"Sección B";
const sB=ws.answers.length+1,secB={title:`${lB} — Vocabulario (Español → Inglés)`,questions:[]};
words.slice(0,4).forEach((w,i)=>{secB.questions.push({num:sB+i,text:`${w.spanish} = `});ws.answers.push({num:sB+i,answer:w.english});});
ws.sections.push(secB);
const sC=ws.answers.length+1,secC={title:`${lC} — Vocabulario (Inglés → Español)`,questions:[]};
words.slice(4).forEach((w,i)=>{secC.questions.push({num:sC+i,text:`${w.english} = `});ws.answers.push({num:sC+i,answer:w.spanish});});
ws.sections.push(secC);
}
S.wsData=ws;
}
function renderWSES(){
if(!S.wsData)genWSES();const ws=S.wsData,m=document.getElementById("main-content");
m.innerHTML=`<div class="card"><h2 class="card-header">Randomised Worksheets</h2><div class="filter-bar no-print"><button class="filter-chip ${S.wsType==='mixed'?'active':''}" data-wstype="mixed">Mixed</button><button class="filter-chip ${S.wsType==='conjugation'?'active':''}" data-wstype="conjugation">Conjugation only</button><button class="filter-chip ${S.wsType==='vocab'?'active':''}" data-wstype="vocab">Vocab only</button></div><div class="worksheet-preview"><div class="ws-title">Spanish Practice Worksheet</div><div class="ws-subtitle">A-Level / Adult Beginners</div><div class="ws-name-line"><span class="ws-name-field">Name: _________________________</span><span class="ws-name-field">Date: ______________</span></div>${ws.sections.map(s=>`<div class="ws-section"><div class="ws-section-title">${s.title}</div>${s.questions.map(q=>`<div class="ws-question"><span class="ws-q-num">${q.num}.</span><span>${q.text}<span class="ws-blank"></span></span></div>`).join('')}</div>`).join('')}${S.wsShowAnswers?`<div class="ws-answer-key"><strong>Answer Key</strong>${ws.answers.map(a=>`<div>${a.num}. ${a.answer}</div>`).join('')}</div>`:''}</div><div class="btn-group no-print"><button class="btn btn-primary" id="wsGenerate">Generate New ↻</button><button class="btn btn-secondary" id="wsToggleAnswers">${S.wsShowAnswers?'Hide Answers':'Show Answers'}</button><button class="btn btn-secondary" id="wsPrint">Print Worksheet 🖨</button></div></div>`;
document.querySelectorAll('[data-wstype]').forEach(b=>b.addEventListener('click',()=>{S.wsType=b.dataset.wstype;genWSES();renderWSES();}));
document.getElementById('wsGenerate').addEventListener('click',()=>{genWSES();renderWSES();});
document.getElementById('wsToggleAnswers').addEventListener('click',()=>{S.wsShowAnswers=!S.wsShowAnswers;renderWSES();});
document.getElementById('wsPrint').addEventListener('click',()=>window.print());
}
// ─── CHEATSHEET: SPANISH ─────────────────────────────────────────────
function renderCheatsheetES(){
const m=document.getElementById("main-content");
const tc=(flagCls,de,en,formHtml,exDe,exEn,useHtml,tagsHtml,noteHtml)=>`<div class="tense-card"><div class="tense-card-header"><div class="tense-flag ${flagCls}"></div><div><div class="tense-de">${de}</div><div class="tense-en">${en}</div></div></div><div class="tense-body"><div class="tense-col"><div class="col-title">Formation</div><div class="cs-formula">${formHtml}</div><div class="col-title">Example</div><div class="cs-example-de">${exDe}</div><div class="cs-example-en">${exEn}</div></div><div class="tense-col"><div class="col-title">When to use</div>${useHtml}<div class="usage-tags">${tagsHtml}</div></div></div>${noteHtml?`<div class="passive-bar"><div class="passive-bar-label">Note</div><div class="passive-formula">${noteHtml}</div></div>`:''}</div>`;
const tag=(cls,label)=>`<span class="utag ${cls}">${label}</span>`;
const spoken=tag('utag-spoken','spoken'),written=tag('utag-written','written'),formal=tag('utag-formal','formal'),common=tag('utag-common','very common'),subj=tag('utag-modal','subjunctive');
const kw=s=>`<span class="kw">${s}</span>`,ex=s=>`<span class="ex">${s}</span>`;
const tenseCards=[
tc('flag-present','Presente','Present indicative',`-AR: <span class="kw">-o/-as/-a/-amos/-áis/-an</span><br>-ER: ${kw('-o/-es/-e/-emos/-éis/-en')}<br>-IR: ${kw('-o/-es/-e/-imos/-ís/-en')}<br>${ex('hablar → habl<b>o</b>, habl<b>as</b>, habl<b>a</b>…')}`,`Hablo español todos los días.`,`I speak Spanish every day.`,`Current/habitual actions, general truths, and near-future plans.`,spoken+written+common, ''),
tc('flag-prät','Indefinido','Simple past / preterite',`-AR: ${kw('-é/-aste/-ó/-amos/-asteis/-aron')}<br>-ER/-IR: ${kw('-í/-iste/-ió/-imos/-isteis/-ieron')}<br>${ex('fui, vine, hice, puse, dije…')} (many irregulars)`,`Ayer fui al mercado.`,`Yesterday I went to the market.`,`Completed actions with a defined endpoint. Often with <em>ayer, el lunes, en 2020</em>.`,spoken+written+common, `Contrast with Imperfecto: Indefinido = <span class="kw">completed</span>, Imperfecto = <span class="kw">ongoing/background</span>.`),
tc('flag-perfekt','Imperfecto','Imperfect',`-AR: ${kw('-aba/-abas/-aba/-ábamos/-abais/-aban')}<br>-ER/-IR: ${kw('-ía/-ías/-ía/-íamos/-íais/-ían')}<br>${ex('Only 3 irregulars: ser, ir, ver')}`,`Cuando era niño, vivía en Madrid.`,`When I was a child, I lived in Madrid.`,`Background description, habitual past actions, ongoing states. Often with <em>siempre, todos los días, de niño</em>.`,spoken+written+common, ''),
tc('flag-futII','Pretérito Perfecto','Present perfect',`${kw('haber')} (presente) + participio (-ado/-ido)<br>${ex('he, has, ha, hemos, habéis, han')}<br>${ex('hablado, comido, vivido — visto, hecho, dicho…')}`,`Esta semana he estudiado mucho.`,`This week I have studied a lot.`,`Recently completed actions, especially in Spain. Use with <em>hoy, esta semana, ya, todavía</em>.`,spoken+written, `Note: In Latin America, Indefinido is preferred over Perfecto for recent past too.`),
tc('flag-plusq','Pluscuamperfecto','Past perfect / pluperfect',`${kw('haber')} (imperfecto) + participio<br>${ex('había, habías, había, habíamos, habíais, habían')}`,`Ya había comido cuando llegué.`,`I had already eaten when I arrived.`,`A past action completed before another past action. Often with <em>ya, todavía no, cuando</em>.`,spoken+written, ''),
tc('flag-futI','Futuro Simple','Simple future',`Infinitive + ${kw('-é/-ás/-á/-emos/-éis/-án')}<br>${ex('hablar → hablaré, hablarás…')}<br>${ex('Irregulars: tendr-, vendr-, podr-, querr-, dir-, har-…')}`,`Mañana hablaré con el director.`,`Tomorrow I will speak with the director.`,`Future plans, predictions, and probability about the present (<em>Estará en casa</em> = He's probably at home).`,spoken+written, ''),
tc('flag-kII','Condicional','Conditional',`Infinitive + ${kw('-ía/-ías/-ía/-íamos/-íais/-ían')}<br>${ex('hablar → hablaría, hablarías…')}<br>${ex('Same irregular stems as Futuro')}`,`Si tuviera dinero, viajaría por el mundo.`,`If I had money, I would travel the world.`,`Hypotheticals, polite requests (<em>¿Podría ayudarme?</em>), and reported future (<em>Dijo que vendría</em>).`,spoken+written+formal, ''),
tc('flag-kI','Subjuntivo Presente','Present subjunctive',`Take yo-form of Presente, drop -o, add opposite endings:<br>-AR → ${kw('-e/-es/-e/-emos/-éis/-en')}<br>-ER/-IR → ${kw('-a/-as/-a/-amos/-áis/-an')}<br>${ex('hablar: hable, hables, hable…')}`,`Quiero que hables más despacio.`,`I want you to speak more slowly.`,`Doubt, emotion, influence, wishes, hypotheticals, and set phrases like <em>ojalá, es importante que, para que</em>.`,written+subj+formal, `Key trigger words: <span class="kw">querer que, esperar que, es necesario que, aunque, para que, cuando</span> (future sense)`)
].join('');
const hfVerb=(inf,en,rows,noteHtml)=>`<div class="modal-card"><div class="modal-card-header"><div class="modal-infinitive">${inf}</div><div class="modal-meaning">${en}</div></div><table class="modal-conj-table">${rows.map(r=>`<tr><td>${r[0]}</td><td>${r[1]}</td></tr>`).join('')}</table><div class="modal-use-row"><strong>Use:</strong> ${noteHtml}</div></div>`;
const hfCards=[
hfVerb('ser','to be (permanent)',[['yo','soy'],['tú','eres'],['él/ella','es'],['nosotros','somos'],['vosotros','sois'],['ellos/ellas','son']],`Identity, origin, material, time, passive voice. <em>Soy inglés. Es de Madrid.</em>`),
hfVerb('estar','to be (temporary)',[['yo','estoy'],['tú','estás'],['él/ella','está'],['nosotros','estamos'],['vosotros','estáis'],['ellos/ellas','están']],`State, location, emotion, progressive. <em>Estoy cansado. Está en casa.</em>`),
hfVerb('tener','to have',[['yo','tengo'],['tú','tienes'],['él/ella','tiene'],['nosotros','tenemos'],['vosotros','tenéis'],['ellos/ellas','tienen']],`Possession and idioms: <em>tener que</em> + inf. = have to; <em>tener … años</em> = to be … years old`),
hfVerb('poder','can / to be able to',[['yo','puedo'],['tú','puedes'],['él/ella','puede'],['nosotros','podemos'],['vosotros','podéis'],['ellos/ellas','pueden']],`Ability or possibility. <em>¿Puedes ayudarme?</em> (Can you help me?)`),
hfVerb('querer','to want',[['yo','quiero'],['tú','quieres'],['él/ella','quiere'],['nosotros','queremos'],['vosotros','queréis'],['ellos/ellas','quieren']],`Desire. Also <em>querer que</em> + subjunctive: <em>Quiero que estudies.</em>`),
hfVerb('deber','must / ought to',[['yo','debo'],['tú','debes'],['él/ella','debe'],['nosotros','debemos'],['vosotros','debéis'],['ellos/ellas','deben']],`Obligation. <em>Debes estudiar más.</em> Also <em>deber de</em> = probability`),
hfVerb('ir','to go',[['yo','voy'],['tú','vas'],['él/ella','va'],['nosotros','vamos'],['vosotros','vais'],['ellos/ellas','van']],`Movement + <strong>ir a</strong> + infinitive for near future: <em>Voy a estudiar.</em>`)
].join('');
m.innerHTML=`<div class="card"><h2 class="card-header">Tenses Cheatsheet</h2><div class="cs-section-label">Spanish Tenses</div><p class="cs-section-sub">A reference guide to all eight tenses — formation, examples, and when to use them.</p>${tenseCards}<div class="cs-divider">Quick Reference</div><table class="cs-ref-table"><thead><tr><th>Tense</th><th>Key formation</th><th>Key use</th><th>Signal words</th></tr></thead><tbody><tr><td>Presente</td><td class="mono">habl<b>o</b></td><td>habitual / now</td><td>ahora, siempre, todos los días</td></tr><tr><td>Indefinido</td><td class="mono">habl<b>é</b></td><td>completed past</td><td>ayer, el lunes, en 2020</td></tr><tr><td>Imperfecto</td><td class="mono">habl<b>aba</b></td><td>background / ongoing past</td><td>siempre, de niño, mientras</td></tr><tr><td>Pret. Perfecto</td><td class="mono"><b>he</b> hablado</td><td>recent past (Spain)</td><td>hoy, esta semana, ya</td></tr><tr><td>Pluscuamperfecto</td><td class="mono"><b>había</b> hablado</td><td>past-before-past</td><td>ya, todavía no, cuando</td></tr><tr><td>Futuro Simple</td><td class="mono">hablar<b>é</b></td><td>future / probability</td><td>mañana, pronto, el año que viene</td></tr><tr><td>Condicional</td><td class="mono">hablar<b>ía</b></td><td>conditional / polite</td><td>si…, me gustaría, ¿podría…?</td></tr><tr><td>Subj. Presente</td><td class="mono">habl<b>e</b></td><td>doubt / emotion / influence</td><td>quiero que, es importante que, ojalá</td></tr></tbody></table><div class="cs-note">💡 <strong>Indefinido vs. Imperfecto:</strong> Use Indefinido for a completed event (<em>Fui al cine</em>) and Imperfecto for background or repeated past (<em>Iba al cine cada semana</em>). They often appear together: <em>Leía cuando sonó el teléfono.</em></div><div class="cs-divider" style="margin-top:40px">Key Verbs & Structures</div><p class="cs-section-sub" style="margin-top:-8px">High-frequency verbs including the essential <em>ser</em> vs <em>estar</em> distinction.</p><div class="modal-grid">${hfCards}</div><div class="cs-note" style="margin-top:18px">💡 <strong>Ser vs. estar:</strong> Both mean "to be". <em>Ser</em> = permanent/inherent identity (nationality, profession, material). <em>Estar</em> = temporary state, location, emotion, progressive tense. <em>Es médico</em> (He is a doctor) vs. <em>Está enfermo</em> (He is ill/feeling sick).</div><div class="cs-note" style="margin-top:10px">💡 <strong>Por vs. para:</strong> <em>Por</em> = cause/exchange/duration/agent (<em>gracias por, por dos horas</em>). <em>Para</em> = purpose/destination/deadline (<em>para mañana, para ir a…</em>).</div></div>`;
}
// ─── CHEATSHEET ──────────────────────────────────────────────────────
function renderCheatsheet(){
const m=document.getElementById("main-content");
const tc=(flagCls,de,en,formHtml,exDe,exEn,useHtml,tagsHtml,passiveHtml)=>`
<div class="tense-card">
<div class="tense-card-header"><div class="tense-flag ${flagCls}"></div><div><div class="tense-de">${de}</div><div class="tense-en">${en}</div></div></div>
<div class="tense-body">
<div class="tense-col"><div class="col-title">Formation</div><div class="cs-formula">${formHtml}</div><div class="col-title">Example</div><div class="cs-example-de">${exDe}</div><div class="cs-example-en">${exEn}</div></div>
<div class="tense-col"><div class="col-title">When to use</div>${useHtml}<div class="usage-tags">${tagsHtml}</div></div>
</div>
<div class="passive-bar"><div class="passive-bar-label">Passiv</div><div class="passive-formula">${passiveHtml}</div></div>
</div>`;
const tag=(cls,label)=>`<span class="utag ${cls}">${label}</span>`;
const spoken=tag('utag-spoken','spoken'), written=tag('utag-written','written'), formal=tag('utag-formal','formal/literary'), common=tag('utag-common','very common'), modalTag=tag('utag-modal','modals always');
const kw=s=>`<span class="kw">${s}</span>`, ex=s=>`<span class="ex">${s}</span>`;
const tenseCards=[
tc('flag-present','Präsens','Present tense',
`verb stem + ${kw('-e / -st / -t / -en / -t / -en')}<br>${ex('lernen → lern<b>e</b>, lern<b>st</b>, lern<b>t</b>…')}`,
'Ich lerne jeden Tag Deutsch.','I learn German every day.',
'Current actions, habitual facts, scheduled future events, and general truths.',
spoken+written+common,
`${kw('werden')} (Präsens) + Partizip II → Das Buch ${kw('wird')} gelesen.`),
tc('flag-prät','Präteritum','Simple past / narrative past',
`<em>Regular:</em> stem + ${kw('-te / -test / -te / -ten / -tet / -ten')}<br><em>Irregular:</em> strong verb stem change<br>${ex('gehen → <b>ging</b>, kommen → <b>kam</b>')}`,
'Er arbeitete bis spät in die Nacht.','He worked until late into the night.',
'Narrative and written past (novels, news). Modals and <em>sein/haben</em> always prefer Präteritum over Perfekt in speech too.',
written+formal+modalTag,
`${kw('wurde(n)')} + Partizip II → Das Buch ${kw('wurde')} geschrieben.`),
tc('flag-perfekt','Perfekt','Present perfect / conversational past',
`${kw('haben')} / ${kw('sein')} (Präsens) + Partizip II<br>${ex('ge- + stem + -(e)t or irregular ge-…-en')}<br>Motion/change verbs take ${kw('sein')}`,
'Wir haben das Buch gelesen.','We have read / we read the book.',
'The default spoken past tense in everyday conversation. Use for completed actions in the past.',
spoken+common,
`${kw('sein')} (Präsens) + Partizip II + ${kw('worden')} → Es ${kw('ist')} gemacht ${kw('worden')}.`),
tc('flag-plusq','Plusquamperfekt','Past perfect / pluperfect',
`${kw('hatte(n)')} / ${kw('war(en)')} + Partizip II<br>${ex('hatten gegessen, waren gegangen')}`,
'Sie hatte schon gegessen, als er ankam.','She had already eaten when he arrived.',
'A past action that happened <em>before</em> another past action. Often paired with Präteritum to show sequence.',
spoken+written,
`${kw('war(en)')} + Partizip II + ${kw('worden')} → Es ${kw('war')} bereits gemacht ${kw('worden')}.`),
tc('flag-futI','Futur I','Future tense',
`${kw('werden')} (Präsens) + Infinitiv<br>${ex('ich werde, du wirst, er wird…')}`,
'Ich werde morgen kommen.','I will come tomorrow.',
'Future predictions, intentions, or promises. Also expresses <em>probability</em> about the present (<em>Er wird müde sein</em> — He\'s probably tired).',
spoken+written,
`${kw('werden')} (Präsens) + Partizip II + ${kw('werden')} → Es ${kw('wird')} gemacht ${kw('werden')}.`),
tc('flag-futII','Futur II','Future perfect',
`${kw('werden')} (Präsens) + Partizip II + ${kw('haben/sein')}<br>${ex('ich werde gegessen haben')}`,
'Bis Montag werde ich es fertig haben.','By Monday I will have finished it.',
'An action completed before a point in the future. Also expresses <em>probability about the past</em> (<em>Er wird es vergessen haben</em> — He\'s probably forgotten it).',
written+formal,
`${kw('werden')} + Partizip II + ${kw('worden sein')} → Es ${kw('wird')} gemacht ${kw('worden sein')}.`),
tc('flag-kII','Konjunktiv II','Subjunctive II — conditionals & politeness',
`<em>Common:</em> ${kw('würde')} + Infinitiv<br><em>Strong verbs (own forms):</em><br>${ex('wäre, hätte, käme, ginge, könnte…')}`,
'Wenn ich Zeit hätte, würde ich reisen.','If I had time, I would travel.',
'Hypotheticals and conditionals (<em>wenn…</em>), polite requests (<em>Könnten Sie…?</em>), wishes (<em>Ich wünschte…</em>), and unreal comparisons (<em>als ob…</em>).',
spoken+written+common,
`${kw('würde(n)')} + Partizip II + ${kw('werden')} → Es ${kw('würde')} gemacht ${kw('werden')}.`),
tc('flag-kI','Konjunktiv I','Subjunctive I — indirect speech',
`verb stem + ${kw('-e / -est / -e / -en / -et / -en')}<br>${ex('sagen → ich sage, er sage, sie sagen')}<br>${ex('sein → ich sei, du sei(e)st, er sei…')}`,
'Er sagte, er sei krank.','He said he was ill. (reported speech)',
'Reported / indirect speech in journalism and formal writing. When Konj. I = indicative form, use Konj. II instead to avoid ambiguity.',
written+formal,
`${kw('werde(n)')} (Konj. I) + Partizip II → Er sagte, es ${kw('werde')} gemacht.`)
].join('');
const modal=(inf,meaning,rows,useHtml)=>`
<div class="modal-card">
<div class="modal-card-header"><div class="modal-infinitive">${inf}</div><div class="modal-meaning">${meaning}</div></div>
<table class="modal-conj-table">${rows.map(r=>`<tr><td>${r[0]}</td><td>${r[1]}</td></tr>`).join('')}</table>
<div class="modal-use-row"><strong>Use:</strong> ${useHtml}</div>
</div>`;
const modalCards=[
modal('dürfen','may / to be allowed to',[['ich / er/sie/es','darf'],['du','darfst'],['wir / sie/Sie','dürfen'],['ihr','dürft'],['Präteritum ich','durfte'],['Konjunktiv II','dürfte']],
`permission — <em>Darf ich das Fenster öffnen?</em> (May I open the window?)`),
modal('können','can / to be able to',[['ich / er/sie/es','kann'],['du','kannst'],['wir / sie/Sie','können'],['ihr','könnt'],['Präteritum ich','konnte'],['Konjunktiv II','könnte']],
`ability or possibility — <em>Kannst du mir helfen?</em> (Can you help me?)`),
modal('mögen','to like / may (formal)',[['ich / er/sie/es','mag'],['du','magst'],['wir / sie/Sie','mögen'],['ihr','mögt'],['Präteritum ich','mochte'],['Konjunktiv II','möchte']],
`liking (<em>Ich mag Kaffee</em>) or polite wish — <em>Ich möchte bitte zahlen.</em> (I'd like to pay.)`),
modal('müssen','must / to have to',[['ich / er/sie/es','muss'],['du','musst'],['wir / sie/Sie','müssen'],['ihr','müsst'],['Präteritum ich','musste'],['Konjunktiv II','müsste']],
`necessity or obligation — <em>Ich muss jetzt gehen.</em> (I have to go now.)`),
modal('sollen','should / to be supposed to',[['ich / er/sie/es','soll'],['du','sollst'],['wir / sie/Sie','sollen'],['ihr','sollt'],['Präteritum ich','sollte'],['Konjunktiv II','sollte']],
`external obligation or instruction — <em>Du sollst nicht lügen.</em> (You shall not lie.)`),
modal('wollen','to want to',[['ich / er/sie/es','will'],['du','willst'],['wir / sie/Sie','wollen'],['ihr','wollt'],['Präteritum ich','wollte'],['Konjunktiv II','wollte']],
`desire or intention — <em>Ich will Deutsch lernen.</em> (I want to learn German.)`),
modal('werden','will / to become',[['ich','werde'],['du','wirst'],['er/sie/es','wird'],['wir / sie/Sie','werden'],['ihr','werdet'],['Konjunktiv II','würde']],
`future (+ Infinitiv), passive (+ Partizip II), or becoming — <em>Es wird kalt.</em> (It's getting cold.)`)
].join('');
m.innerHTML=`<div class="card">
<h2 class="card-header">Tenses Cheatsheet</h2>
<div class="cs-section-label">German Tenses</div>
<p class="cs-section-sub">A reference guide to all eight tenses — formation, examples, and when to use them.</p>
${tenseCards}
<div class="cs-divider">Quick Reference</div>
<table class="cs-ref-table">
<thead><tr><th>Tense</th><th>Active formula</th><th>Passive formula</th><th>Key signal words</th></tr></thead>
<tbody>
<tr><td>Präsens</td><td class="mono">lern<b>e</b></td><td class="mono"><b>wird</b> gemacht</td><td>jetzt, immer, täglich</td></tr>
<tr><td>Präteritum</td><td class="mono">lern<b>te</b> / kam</td><td class="mono"><b>wurde</b> gemacht</td><td>damals, früher, plötzlich</td></tr>
<tr><td>Perfekt</td><td class="mono"><b>hat</b> gelernt / <b>ist</b> gegangen</td><td class="mono"><b>ist</b> gemacht <b>worden</b></td><td>schon, bereits, gerade</td></tr>
<tr><td>Plusquamperfekt</td><td class="mono"><b>hatte</b> gelernt / <b>war</b> gegangen</td><td class="mono"><b>war</b> gemacht <b>worden</b></td><td>nachdem, bevor, schon</td></tr>
<tr><td>Futur I</td><td class="mono"><b>wird</b> lernen</td><td class="mono"><b>wird</b> gemacht <b>werden</b></td><td>morgen, bald, nächste Woche</td></tr>
<tr><td>Futur II</td><td class="mono"><b>wird</b> gelernt <b>haben</b></td><td class="mono"><b>wird</b> gemacht worden <b>sein</b></td><td>bis dann, bis Montag</td></tr>
<tr><td>Konjunktiv II</td><td class="mono"><b>würde</b> lernen / wäre / hätte</td><td class="mono"><b>würde</b> gemacht <b>werden</b></td><td>wenn, falls, ich wünschte</td></tr>
<tr><td>Konjunktiv I</td><td class="mono">er lern<b>e</b> / er <b>sei</b></td><td class="mono">es <b>werde</b> gemacht</td><td>er sagte, sie berichtete</td></tr>
</tbody>
</table>
<div class="cs-note">💡 <strong>Tip:</strong> When the Konjunktiv I form looks identical to the indicative (e.g. <em>sie lernen</em>), switch to Konjunktiv II (<em>sie lernten</em> or <em>würden lernen</em>) to make the reported-speech meaning clear.</div>
<div class="cs-divider" style="margin-top:40px">Modal Verbs</div>
<p class="cs-section-sub" style="margin-top:-8px">Six modals + <em>werden</em> — conjugation and core meanings. Modals always use Präteritum (not Perfekt) in speech.</p>
<div class="modal-grid">${modalCards}</div>
<div class="cs-note" style="margin-top:18px">💡 <strong>Double infinitive (Ersatzinfinitiv):</strong> In Perfekt/Plusquamperfekt with a dependent verb, both appear as infinitives — <em>Ich habe kommen <strong>müssen</strong></em> (not <em>gemusst</em>).</div>
<div class="cs-note" style="margin-top:10px">💡 <strong>nicht müssen vs. nicht dürfen:</strong> <em>Du musst nicht</em> = you don't have to. <em>Du darfst nicht</em> = you must not (prohibition). Commonly confused by English speakers.</div>
</div>`;
}
// ─── RENDER ──────────────────────────────────────────────────────────
function render(){
if(!dataLoaded){
if(loadError)document.getElementById("main-content").innerHTML=`<div class="card"><div class="info-box error"><strong>Error loading data:</strong> ${loadError}<br><br>Make sure your repository has a <code>data/</code> folder containing <code>verbs.json</code> and <code>vocab.json</code> for German, and <code>data/es/</code> with <code>verbs.json</code> and <code>vocab.json</code> for Spanish.</div></div>`;
return;
}
const es=S.lang==="es";
switch(S.page){
case"conjugation":es?renderConjES():renderConj();break;
case"vocab":es?renderVocabES():renderVocab();break;
case"worksheet":es?renderWSES():renderWS();break;
case"cheatsheet":es?renderCheatsheetES():renderCheatsheet();break;
}
}
document.body.className="lang-de";
loadData().then(()=>{if(dataLoaded){newVerb();genWS();}render();});
</script>
</body>
</html>