-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKPOPMath.html
More file actions
1336 lines (1203 loc) · 51.8 KB
/
KPOPMath.html
File metadata and controls
1336 lines (1203 loc) · 51.8 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">
<title>K-Pop Math Trainer — Genesee Learning Lab</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="favicon.svg" type="image/svg+xml" />
<link rel="stylesheet" href="styles.css" />
<style>
:root {
color-scheme: light;
--bg: #07020f;
--panel: #1b0f2b;
--accent: #ff2b6d;
--accent-light: #ffa3f6;
--text: #fef6ff;
--muted: #cdbbf8;
--warning: #ffe066;
--success: #5cf2d6;
--spotlight: rgba(255, 119, 209, 0.35);
--aura: rgba(32, 190, 255, 0.26);
--hero-rumi: linear-gradient(140deg, rgba(255, 77, 143, 0.82), rgba(103, 70, 255, 0.78));
--hero-mira: linear-gradient(140deg, rgba(201, 94, 255, 0.82), rgba(38, 201, 255, 0.78));
--hero-zoey: linear-gradient(140deg, rgba(255, 166, 92, 0.82), rgba(255, 62, 124, 0.78));
}
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
background:
radial-gradient(circle at 10% 0%, rgba(255, 91, 145, 0.32), transparent 46%),
radial-gradient(circle at 85% 14%, rgba(75, 30, 255, 0.28), transparent 54%),
radial-gradient(circle at 16% 84%, rgba(0, 214, 255, 0.18), transparent 60%),
linear-gradient(110deg, rgba(14, 7, 32, 0.92), rgba(8, 3, 18, 0.95)),
var(--bg);
color: var(--text);
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
padding: 24px;
}
.game-shell {
width: min(1024px, 100%);
background: rgba(12, 9, 27, 0.93);
border: 2px solid rgba(255, 70, 158, 0.48);
border-radius: 20px;
padding: 28px clamp(18px, 4vw, 36px);
box-shadow: 0 22px 58px rgba(0, 0, 0, 0.66);
position: relative;
overflow: hidden;
}
.net-overlay {
position: absolute;
inset: 0;
background: conic-gradient(from 110deg, var(--spotlight) 0deg 78deg, transparent 78deg 182deg, var(--aura) 182deg 258deg, transparent 258deg 360deg);
mix-blend-mode: screen;
pointer-events: none;
z-index: 0;
}
.film-grain {
position: absolute;
inset: 0;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAFElEQVR42mP4/58BByBiYGAAAAAtAAOvIi6dAAAAAElFTkSuQmCC");
opacity: 0.12;
pointer-events: none;
z-index: 0;
}
.game-shell>*:not(.net-overlay):not(.film-grain) {
position: relative;
z-index: 1;
}
h1 {
margin-top: 0;
font-size: clamp(1.8rem, 2.8vw, 2.6rem);
letter-spacing: 0.08em;
text-transform: uppercase;
text-align: center;
margin-bottom: 10px;
}
.tagline {
text-align: center;
margin-bottom: 18px;
color: var(--muted);
font-size: 1rem;
}
.theme-toggle {
display: flex;
justify-content: center;
gap: 12px;
margin-bottom: 24px;
flex-wrap: wrap;
}
.theme-button {
padding: 10px 18px;
border-radius: 999px;
border: 1px solid rgba(255, 70, 158, 0.4);
background: transparent;
color: var(--text);
font-weight: 600;
letter-spacing: 0.08em;
text-transform: uppercase;
cursor: pointer;
transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.theme-button:hover {
transform: translateY(-1px);
}
.theme-button.is-active {
background: linear-gradient(135deg, var(--accent), var(--accent-light));
color: var(--panel);
border-color: transparent;
box-shadow: 0 10px 18px rgba(255, 70, 158, 0.25);
}
.squad-deck {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 14px;
margin-bottom: 28px;
}
.squad-card {
--cardActiveGradient: linear-gradient(140deg, rgba(255, 77, 143, 0.82), rgba(103, 70, 255, 0.78));
padding: 16px;
border-radius: 16px;
background: rgba(31, 18, 55, 0.78);
border: 1px solid rgba(255, 255, 255, 0.08);
position: relative;
overflow: hidden;
transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.squad-card::before {
content: "";
position: absolute;
inset: 0;
background: rgba(255, 255, 255, 0.04);
mix-blend-mode: overlay;
opacity: 0;
transition: opacity 0.2s ease;
}
.squad-card h2 {
margin: 0 0 6px;
font-size: 1.1rem;
letter-spacing: 0.06em;
}
.squad-card p {
margin: 0;
color: var(--muted);
font-size: 0.86rem;
line-height: 1.4;
}
.squad-card span {
display: inline-block;
margin-top: 8px;
font-size: 0.78rem;
letter-spacing: 0.08em;
text-transform: uppercase;
color: rgba(255, 255, 255, 0.78);
}
.squad-card.active {
border-color: rgba(255, 70, 158, 0.6);
box-shadow: 0 10px 24px rgba(255, 70, 158, 0.28);
transform: translateY(-2px);
background: var(--cardActiveGradient);
}
.squad-card.active::before {
opacity: 1;
}
.hud {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
gap: 12px;
margin-bottom: 24px;
}
.hud-card {
border: 1px solid rgba(255, 90, 127, 0.4);
border-radius: 14px;
padding: 16px;
background: rgba(29, 16, 52, 0.8);
display: flex;
flex-direction: column;
gap: 6px;
}
.hud-label {
font-size: 0.78rem;
color: var(--muted);
letter-spacing: 0.12em;
text-transform: uppercase;
}
.hud-value {
font-size: 1.4rem;
font-weight: bold;
}
.challenge-card {
background: rgba(17, 10, 39, 0.91);
border-radius: 18px;
padding: clamp(20px, 3vw, 32px);
border: 2px solid rgba(255, 174, 94, 0.32);
position: relative;
overflow: hidden;
margin-bottom: 28px;
}
.challenge-card::after {
content: "";
position: absolute;
inset: 0;
background: radial-gradient(circle at top right, rgba(255, 174, 94, 0.18), transparent 42%);
pointer-events: none;
}
.prompt-line {
display: flex;
align-items: baseline;
justify-content: center;
gap: clamp(16px, 3vw, 28px);
font-size: clamp(2.2rem, 4vw, 3rem);
font-weight: 700;
margin-bottom: 18px;
}
.scene-callout {
text-align: center;
font-size: 0.95rem;
color: rgba(255, 255, 255, 0.82);
margin-bottom: 12px;
letter-spacing: 0.04em;
}
.response-area {
display: flex;
justify-content: center;
gap: 10px;
flex-wrap: wrap;
}
.response-area input[type="number"] {
width: clamp(120px, 20vw, 180px);
padding: 12px 14px;
border-radius: 12px;
border: 2px solid rgba(255, 63, 129, 0.4);
background: rgba(11, 9, 28, 0.8);
color: var(--text);
font-size: 1.4rem;
text-align: center;
}
.response-area button {
padding: 12px 18px;
border-radius: 12px;
border: none;
font-size: 1rem;
font-weight: bold;
letter-spacing: 0.08em;
text-transform: uppercase;
cursor: pointer;
transition: transform 0.2s ease, box-shadow 0.2s ease;
background: linear-gradient(135deg, var(--accent), var(--accent-light));
color: var(--panel);
}
.response-area button:hover {
transform: translateY(-2px);
box-shadow: 0 10px 18px rgba(255, 63, 129, 0.35);
}
.response-area .ghost-button {
background: rgba(11, 9, 28, 0.8);
color: var(--text);
border: 2px solid rgba(255, 63, 129, 0.4);
}
.response-area .ghost-button:hover {
box-shadow: 0 10px 18px rgba(104, 255, 203, 0.25);
}
.feedback {
text-align: center;
font-size: 1.2rem;
min-height: 1.6em;
margin-top: 14px;
}
.feedback strong {
letter-spacing: 0.08em;
}
.progress-track {
margin-bottom: 28px;
}
.meter-shell {
width: 100%;
height: 16px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.08);
overflow: hidden;
border: 1px solid rgba(255, 63, 129, 0.25);
}
.meter-fill {
height: 100%;
background: linear-gradient(135deg, rgba(104, 255, 203, 0.9), rgba(0, 188, 255, 0.85));
width: 0;
transition: width 0.3s ease;
}
.progress-label {
margin-top: 8px;
font-size: 0.9rem;
color: var(--muted);
text-align: right;
}
.badge-wall {
border: 1px solid rgba(255, 70, 158, 0.4);
border-radius: 18px;
padding: clamp(16px, 3vw, 26px);
background: rgba(22, 16, 46, 0.88);
}
.badge-wall h2 {
margin: 0 0 10px;
letter-spacing: 0.08em;
text-transform: uppercase;
font-size: 1.1rem;
}
.badge-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
gap: 12px;
}
.badge-card {
text-align: center;
border-radius: 16px;
padding: 10px;
background: rgba(18, 13, 34, 0.84);
border: 1px dashed rgba(255, 174, 94, 0.32);
}
.badge-card img {
width: 96px;
height: 96px;
object-fit: contain;
}
.badge-card span {
display: block;
margin-top: 6px;
font-size: 0.86rem;
color: var(--muted);
}
.history-log {
margin-top: 26px;
background: rgba(12, 9, 29, 0.9);
border-radius: 14px;
padding: 16px;
border: 1px solid rgba(110, 63, 255, 0.28);
max-height: 220px;
overflow-y: auto;
}
.history-log h3 {
margin: 0 0 10px;
font-size: 1rem;
text-transform: uppercase;
letter-spacing: 0.1em;
}
.history-log ul {
list-style: none;
padding: 0;
margin: 0;
display: grid;
gap: 8px;
font-size: 0.92rem;
}
.history-log li {
padding: 8px 10px;
border-radius: 10px;
background: rgba(9, 6, 22, 0.85);
border: 1px solid rgba(255, 255, 255, 0.05);
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
@media (max-width: 640px) {
.prompt-line {
font-size: clamp(1.8rem, 8vw, 2.4rem);
}
.hud {
grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}
.squad-deck {
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
}
/* Nav override: stretch across full body despite body padding */
.site-nav {
width: calc(100% + 48px);
margin-left: -24px;
margin-right: -24px;
margin-top: -24px;
}
</style>
</head>
<body>
<a class="skip-link" href="#main-content">Skip to main content</a>
<!-- NAVIGATION -->
<nav class="site-nav" aria-label="Main navigation">
<div class="nav-inner">
<a href="index.html" class="nav-brand" aria-label="Genesee Learning Lab — Home">
<span class="nav-brand-icon" aria-hidden="true">GL</span>
Genesee Learning Lab
</a>
<button class="nav-toggle" aria-expanded="false" aria-controls="primary-nav-list" aria-label="Open navigation menu">☰</button>
<ul id="primary-nav-list" class="nav-links" role="list">
<li><a href="index.html">Home</a></li>
<li><a href="projects.html">Projects</a></li>
<li><a href="programs.html">Programs</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>
</nav>
<div class="page-breadcrumb" style="width: calc(100% + 48px); margin-left: -24px; margin-right: -24px;" aria-label="Breadcrumb">
<div class="page-breadcrumb__inner">
<a href="projects.html">← Student Tools</a>
</div>
</div>
<div id="main-content" tabindex="-1" style="width: 100%;">
<div class="game-shell" role="main">
<div class="net-overlay" aria-hidden="true"></div>
<div class="film-grain" aria-hidden="true"></div>
<h1 id="gameHeading">K-Pop Math Trainer</h1>
<p class="tagline" id="gameTagline">Rumi, Mira, and Zoey are counting on you to outsmart the Saja Boys before
opening night.</p>
<div class="theme-toggle" role="group" aria-label="Choose your squad look">
<button type="button" class="theme-button is-active" data-theme="huntrix">Huntrix</button>
<button type="button" class="theme-button" data-theme="sajaboys">Saja Boys</button>
</div>
<section class="squad-deck" id="squadDeck" aria-label="Team lineup"></section>
<section class="hud" aria-label="Status dashboard">
<article class="hud-card" aria-live="polite">
<span class="hud-label">Level</span>
<span class="hud-value" id="levelValue">1</span>
</article>
<article class="hud-card" aria-live="polite">
<span class="hud-label">Combo Streak</span>
<span class="hud-value" id="streakValue">0</span>
</article>
<article class="hud-card" aria-live="polite">
<span class="hud-label">Scenes Cleared</span>
<span class="hud-value" id="correctValue">0</span>
</article>
<article class="hud-card" aria-live="polite">
<span class="hud-label">Fan Energy</span>
<span class="hud-value" id="xpValue">0</span>
</article>
</section>
<section class="challenge-card" aria-label="Current challenge">
<p class="scene-callout" id="sceneTag" aria-live="polite">Huntrix preps the next scene.</p>
<div class="prompt-line" aria-live="polite">
<span id="leftOperand">0</span>
<span id="operator">+</span>
<span id="rightOperand">0</span>
<span>=</span>
<span>?</span>
</div>
<form class="response-area" id="responseForm">
<label for="playerAnswer" class="sr-only">Your answer</label>
<input id="playerAnswer" name="playerAnswer" type="number" autocomplete="off" inputmode="numeric"
required>
<button type="submit">Check</button>
<button type="button" id="skipButton" title="Skip this challenge">skip</button>
<button type="button" id="showAnswerButton" class="ghost-button" hidden>Show Answer</button>
</form>
<p class="feedback" id="feedback" aria-live="polite"></p>
</section>
<section class="progress-track" aria-label="Mastery progress">
<div class="meter-shell" role="meter" aria-valuemin="0" aria-valuemax="10" aria-valuenow="0"
aria-labelledby="progressLabel">
<div class="meter-fill" id="meterFill"></div>
</div>
<p class="progress-label" id="progressLabel">Next arena remix unlocks at 10 Fan Energy</p>
</section>
<section class="badge-wall" aria-label="Badge collection">
<h2>Badge Wall</h2>
<div class="badge-grid" id="badgeGrid"></div>
</section>
<section class="history-log" aria-label="Battle log">
<h3>Battle Log</h3>
<ul id="historyList"></ul>
</section>
</div>
<script>
"use strict";
const levels = [
{ id: 1, maxOperand: 10, operations: ["+"], xpGoal: 10, title: "Backstage Trainee" },
{ id: 2, maxOperand: 20, operations: ["+", "-"], xpGoal: 22, title: "Spotlight Slayer" },
{ id: 3, maxOperand: 35, operations: ["+", "-"], xpGoal: 36, title: "Neon Underworld" },
{ id: 4, maxOperand: 60, operations: ["+", "-"], xpGoal: 52, title: "Premiere Protector" }
];
const badgeBlueprints = [
{ id: "first-clear", threshold: 1, title: "Opening Night", subtitle: "First scene wrapped", hue: "#ff3a55" },
{ id: "streak-3", threshold: 3, title: "Triple Take", subtitle: "3 perfect scenes", hue: "#fed766" },
{ id: "streak-7", threshold: 7, title: "Director's Cut", subtitle: "7 perfect scenes", hue: "#6d9dff" },
{ id: "xp-25", threshold: 25, title: "Box Office Boom", subtitle: "25 Fan Energy", hue: "#6dffcb" },
{ id: "lvl-4", threshold: 4, title: "Red Carpet Legend", subtitle: "Reach Level 4", hue: "#b084ff" }
];
const themes = {
huntrix: {
id: "huntrix",
displayName: "Huntrix",
heading: "K-Pop Demon Hunters: Squad Training",
tagline: "Rumi, Mira, and Zoey are counting on you to outsmart the Saja Boys before opening night.",
squadName: "Huntrix",
villainName: "Saja Boys",
sceneIntro: "Huntrix preps the next scene.",
palette: {
"--bg": "#07020f",
"--panel": "#1b0f2b",
"--accent": "#ff2b6d",
"--accent-light": "#ffa3f6",
"--text": "#fef6ff",
"--muted": "#cdbbf8",
"--warning": "#ffe066",
"--success": "#5cf2d6",
"--spotlight": "rgba(255, 119, 209, 0.35)",
"--aura": "rgba(32, 190, 255, 0.26)"
},
heroLineup: [
{
id: "rumi",
name: "Rumi",
description: "Fearless leader and blade dancer who slices demon glamours with neon sabers.",
skills: "Leadership · Saber Forms",
highlight: "linear-gradient(140deg, rgba(255, 77, 143, 0.82), rgba(103, 70, 255, 0.78))",
intro: [
"Rumi twirls her soulblade, carving neon runes through the fog.",
"Rumi snaps, \"Keep the beat razor-sharp, Huntrix!\""
],
success: [
"Rumi cheers: \"That's how we headline over the Saja Boys!\"",
"Rumi grins, sabers humming: \"Your math just melted their glam.\""
],
miss: [
"Rumi grimaces: \"They slipped a glamour—reset the formation.\"",
"Rumi steadies everyone: \"Focus up, their illusions won't win.\""
],
reset: [
"Rumi calls cut: \"We block this beat again, no sweat.\"",
"Rumi signals the choreo cam to reframe the next strike."
]
},
{
id: "mira",
name: "Mira",
description: "Power vocalist weaving protective harmonies that shield fans from dark energy.",
skills: "Vocals · Harmony Ward",
highlight: "linear-gradient(140deg, rgba(201, 94, 255, 0.82), rgba(38, 201, 255, 0.78))",
intro: [
"Mira hums a protective harmony that shimmers violet across the stage.",
"Mira whispers, \"I'll drown their glam in pure vocals.\""
],
success: [
"Mira laughs: \"Our harmonies just stunned the demon crowd!\"",
"Mira beams, \"Saja Boys can't touch a perfect chord like that.\""
],
miss: [
"Mira sighs: \"They warped the pitch—let's retune.\"",
"Mira centers the team: \"Deep breath. We reclaim the stage.\""
],
reset: [
"Mira floats a calming note, resetting the choreography timing.",
"Mira nods: \"New take. This time, we out-sing their sorcery.\""
]
},
{
id: "zoey",
name: "Zoey",
description: "Tech-savvy DJ who hacks demon soundwaves with synthised light whips.",
skills: "DJ · Signal Hacking",
highlight: "linear-gradient(140deg, rgba(255, 166, 92, 0.82), rgba(255, 62, 124, 0.78))",
intro: [
"Zoey flicks her holo-decks, scanning demon waveforms in neon blue.",
"Zoey smirks, \"I've got their bassline mapped—let's spike it.\""
],
success: [
"Zoey shouts: \"Remix landed! They can't counter that math drop.\"",
"Zoey pumps a fist: \"Huntrix tech always shreds demon hype.\""
],
miss: [
"Zoey cringes: \"Ugh, they jammed the signal—recalibrating.\"",
"Zoey taps her visor: \"Glitch spotted. We'll overwrite it next take.\""
],
reset: [
"Zoey spins the decks down: \"Cut! I'll re-sequence the beat.\"",
"Zoey cues the lighting rig to reboot the scene."
]
}
],
pepTalks: {
correct: [
"Huntrix synergy ignites the arena!",
"Fans roar as the Saja Boys stumble!",
"Spotlight stays ours!"
],
incorrect: [
"The Saja Boys flash a distraction!",
"Demon pyros flare—hold formation!",
"Illusion strike! Reset the beat!"
],
skip: [
"Stage crew calls hold!",
"Lighting reset—take a breath.",
"Director signals a fresh setup."
]
}
},
sajaboys: {
id: "sajaboys",
displayName: "Saja Boys",
heading: "Saja Boys: Domination Drills",
tagline: "Jinu, Romance, and Mystery rehearse to siphon the Pride before Huntrix hits the stage.",
squadName: "Saja Boys",
villainName: "Huntrix",
sceneIntro: "Saja Boys conspire for the next ambush.",
palette: {
"--bg": "#04060f",
"--panel": "#10131f",
"--accent": "#ffc857",
"--accent-light": "#ffe29f",
"--text": "#f3f6ff",
"--muted": "#b7c8ff",
"--warning": "#ff9f5a",
"--success": "#57f5ff",
"--spotlight": "rgba(255, 200, 87, 0.32)",
"--aura": "rgba(64, 120, 255, 0.28)"
},
heroLineup: [
{
id: "jinu",
name: "Jinu",
description: "Charismatic leader blending velvet vocals with sinister glamours.",
skills: "Frontman · Soul Snare",
highlight: "linear-gradient(140deg, rgba(255, 200, 87, 0.88), rgba(255, 87, 120, 0.78))",
intro: [
"Jinu flashes a dangerous grin, summoning Derpy with a whistle.",
"Jinu murmurs, \"Keep the Pride under our spell.\""
],
success: [
"Jinu croons: \"Another heart beats for the Pride.\"",
"Jinu smirks: \"Huntrix can't outshine that perfect harmony.\""
],
miss: [
"Jinu's eyes flare: \"Their defenses are louder—tighten up.\"",
"Jinu mutters, \"Huntrix cracked the bridge; reset the charm.\""
],
reset: [
"Jinu waves the band offstage to reset the lighting sigil.",
"Jinu calls, \"Re-rack the spell. We don't miss twice.\""
]
},
{
id: "romance",
name: "Romance Saja",
description: "Flirt-fueled performer who siphons devotion with honeyed lyrics.",
skills: "Charm · Pulse Control",
highlight: "linear-gradient(140deg, rgba(255, 140, 187, 0.86), rgba(149, 94, 255, 0.78))",
intro: [
"Romance twirls his cane mic, scattering pink hex lights.",
"Romance coos, \"Let's make the crowd forget Huntrix ever existed.\""
],
success: [
"Romance laughs: \"Another encore, another stolen scream.\"",
"Romance winks: \"Even Celine would swoon for that math.\""
],
miss: [
"Romance pouts: \"Their fandom pushed back—pucker up and retry.\"",
"Romance hisses, \"Sample glitched. Smooth it over.\""
],
reset: [
"Romance sprinkles glitter wards over the stage markers.",
"Romance sighs, \"Fine, reset the vibe, but keep it lethal.\""
]
},
{
id: "mystery",
name: "Mystery Saja",
description: "Shadow strategist layering trap beats behind sly smiles.",
skills: "Producer · Rift Sequencer",
highlight: "linear-gradient(140deg, rgba(116, 205, 255, 0.86), rgba(64, 88, 255, 0.78))",
intro: [
"Mystery sketches sigils across his mixing gauntlet.",
"Mystery muses, \"Every equation is a trap door.\""
],
success: [
"Mystery nods: \"Equation locked; Huntrix loses tempo.\"",
"Mystery chuckles: \"Add it to the Pride's highlight reel.\""
],
miss: [
"Mystery frowns: \"Huntrix jammed the waveform; recalculating.\"",
"Mystery growls, \"Variables slipped—patch the loop.\""
],
reset: [
"Mystery collapses the hologram and restacks the beat wards.",
"Mystery taps the console: \"Version beta was weak. Iterating.\""
]
}
],
pepTalks: {
correct: [
"Stage smoke billows as Huntrix falters!",
"The Pride howls—another flawless strike!",
"Dokkaebi fireworks light the rafters!"
],
incorrect: [
"Huntrix pushes back with a counter-chorus!",
"Fans shake free of the trance—reinforce it!",
"The Honmoon flickers; recalibrate fast!"
],
skip: [
"Stage manager flashes the fox-sign to reset.",
"Derpy knocks over the amps—take five.",
"Sussie circles twice—start the beat again."
]
}
}
};
const state = {
levelIndex: 0,
currentProblem: null,
currentHero: null,
sceneNarration: "",
streak: 0,
correctAnswers: 0,
masteryXP: 0,
badges: new Set(),
history: [],
activeTheme: "huntrix",
lastMiss: null
};
let currentTheme = themes.huntrix;
let heroLineup = currentTheme.heroLineup;
let villainName = currentTheme.villainName;
let pepTalks = currentTheme.pepTalks;
const elements = {
leftOperand: document.getElementById("leftOperand"),
rightOperand: document.getElementById("rightOperand"),
operator: document.getElementById("operator"),
playerAnswer: document.getElementById("playerAnswer"),
responseForm: document.getElementById("responseForm"),
skipButton: document.getElementById("skipButton"),
feedback: document.getElementById("feedback"),
levelValue: document.getElementById("levelValue"),
streakValue: document.getElementById("streakValue"),
correctValue: document.getElementById("correctValue"),
xpValue: document.getElementById("xpValue"),
badgeGrid: document.getElementById("badgeGrid"),
historyList: document.getElementById("historyList"),
meterFill: document.getElementById("meterFill"),
progressLabel: document.getElementById("progressLabel"),
meterShell: document.querySelector(".meter-shell"),
sceneTag: document.getElementById("sceneTag"),
squadDeck: document.getElementById("squadDeck"),
heading: document.getElementById("gameHeading"),
tagline: document.getElementById("gameTagline"),
showAnswerButton: document.getElementById("showAnswerButton")
};
elements.themeButtons = Array.from(document.querySelectorAll(".theme-button"));
function randomItem(list) {
if (!Array.isArray(list) || list.length === 0) {
return null;
}
return list[Math.floor(Math.random() * list.length)];
}
function rndInRange(max) {
return Math.floor(Math.random() * (max + 1));
}
function applyPalette(palette) {
const rootStyle = document.documentElement.style;
Object.entries(palette).forEach(([name, value]) => {
rootStyle.setProperty(name, value);
});
}
function updateHeading(text) {
if (elements.heading) {
elements.heading.textContent = text;
}
}
function updateTagline(text) {
if (elements.tagline) {
elements.tagline.textContent = text;
}
}
function updateThemeButtons(activeId) {
elements.themeButtons.forEach(button => {
const isActive = button.dataset.theme === activeId;
button.classList.toggle("is-active", isActive);
button.setAttribute("aria-pressed", String(isActive));
});
}
function toggleShowAnswerButton(shouldShow) {
if (!elements.showAnswerButton) {
return;
}
elements.showAnswerButton.hidden = !shouldShow;
}
function renderSquadCards(lineup) {
if (!elements.squadDeck) {
return;
}
elements.squadDeck.innerHTML = "";
lineup.forEach(hero => {
const card = document.createElement("article");
card.className = "squad-card";
card.dataset.hero = hero.id;
if (hero.highlight) {
card.style.setProperty("--cardActiveGradient", hero.highlight);
}
card.innerHTML = `
<h2>${hero.name}</h2>
<p>${hero.description}</p>
<span>${hero.skills}</span>
`;
elements.squadDeck.appendChild(card);
});
elements.squadCards = Array.from(elements.squadDeck.querySelectorAll(".squad-card"));
}
function assignHero() {
if (!Array.isArray(heroLineup) || heroLineup.length === 0) {
state.currentHero = null;
state.sceneNarration = "";
highlightActiveHero();
updateSceneCallout();
return;
}
const previous = state.currentHero;
let nextHero = randomItem(heroLineup);
if (previous && heroLineup.length > 1) {
let guard = 0;
while (nextHero && previous.id === nextHero.id && guard < 5) {
nextHero = randomItem(heroLineup);
guard += 1;
}
}
state.currentHero = nextHero || null;
const linePool = nextHero?.intro?.length ? nextHero.intro : [currentTheme.sceneIntro];
state.sceneNarration = randomItem(linePool) || currentTheme.sceneIntro;
highlightActiveHero();
updateSceneCallout();
}
function updateSceneCallout() {
if (!elements.sceneTag) {
return;
}
const hero = state.currentHero;
if (!hero) {
elements.sceneTag.textContent = currentTheme.sceneIntro;
return;
}
const narration = state.sceneNarration || currentTheme.sceneIntro;
elements.sceneTag.innerHTML = `<strong>${hero.name}</strong> · ${narration}`;
}
function highlightActiveHero() {
if (!elements.squadCards) {
return;
}
elements.squadCards.forEach(card => {
const isActive = state.currentHero && card.dataset.hero === state.currentHero.id;
card.classList.toggle("active", Boolean(isActive));
});
}
function pickProblem() {
const profile = levels[state.levelIndex];
const operation = randomItem(profile.operations) || "+";
let left = rndInRange(profile.maxOperand);
let right = rndInRange(profile.maxOperand);
if (operation === "-" && left < right) {
[left, right] = [right, left];
}
state.currentProblem = { left, right, operation, answer: computeAnswer(left, right, operation) };
assignHero();
renderProblem();
}
function computeAnswer(left, right, operation) {
return operation === "+" ? left + right : left - right;
}
function renderProblem() {
const problem = state.currentProblem;
if (!problem) {
return;
}
const { left, right, operation } = problem;
elements.leftOperand.textContent = left;
elements.rightOperand.textContent = right;
elements.operator.textContent = operation;
elements.playerAnswer.value = "";
elements.playerAnswer.focus();
updateSceneCallout();
}
function awardXP(amount) {
state.masteryXP += amount;
elements.xpValue.textContent = state.masteryXP;
checkBadgeByXP();
updateProgressMeter();
maybeLevelUp();
}
function updateProgressMeter() {
const currentLevel = levels[state.levelIndex];
const previousGoal = state.levelIndex === 0 ? 0 : levels[state.levelIndex - 1].xpGoal;
const rangeStart = previousGoal;
const rangeEnd = currentLevel.xpGoal;
const totalSpan = rangeEnd - rangeStart;
const inLevelXP = Math.max(0, Math.min(state.masteryXP - rangeStart, totalSpan));
const ratio = totalSpan ? (inLevelXP / totalSpan) : 1;
elements.meterFill.style.width = `${Math.round(ratio * 100)}%`;
elements.meterShell.setAttribute("aria-valuemin", rangeStart.toString());
elements.meterShell.setAttribute("aria-valuemax", rangeEnd.toString());