-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimon.html
More file actions
1376 lines (1261 loc) · 54.4 KB
/
simon.html
File metadata and controls
1376 lines (1261 loc) · 54.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>Sequence Master</title>
<script src="sdk/mesa-sdk.js"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
color: #fff;
overflow-x: hidden;
padding: 1rem;
}
h1 {
font-size: clamp(1.3rem, 4vw, 2rem);
margin-bottom: 0.5rem;
text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}
.main-container {
display: flex;
flex-direction: column;
align-items: center;
gap: 1rem;
}
.game-section {
display: flex;
flex-direction: column;
align-items: center;
}
.score-display {
font-size: clamp(0.9rem, 2.5vw, 1.2rem);
margin-bottom: 0.75rem;
opacity: 0.9;
}
.game-board {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: clamp(6px, 1.5vw, 10px);
padding: clamp(6px, 1.5vw, 10px);
background: rgba(0, 0, 0, 0.3);
border-radius: 50%;
box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}
.color-btn {
width: clamp(70px, 20vmin, 120px);
height: clamp(70px, 20vmin, 120px);
border: none;
cursor: pointer;
transition: all 0.1s ease;
position: relative;
outline: none;
}
.color-btn:disabled {
cursor: not-allowed;
}
.color-btn::after {
content: attr(data-key);
position: absolute;
font-size: 0.9rem;
opacity: 0.8;
font-weight: bold;
color: rgba(255, 255, 255, 0.9);
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
/* Position key hints at inner corners (close to center) */
.btn-green::after {
bottom: 8px;
right: 8px;
}
.btn-red::after {
bottom: 8px;
left: 8px;
}
.btn-yellow::after {
top: 8px;
right: 8px;
}
.btn-blue::after {
top: 8px;
left: 8px;
}
/* Green - Top Left */
.btn-green {
background: #1b5e20;
border-radius: 100% 0 0 0;
box-shadow: inset -4px -4px 10px rgba(0, 0, 0, 0.3);
}
.btn-green:hover:not(:disabled), .btn-green.active {
background: #4caf50;
box-shadow: 0 0 30px #4caf50, inset -2px -2px 5px rgba(0, 0, 0, 0.2);
}
/* Red - Top Right */
.btn-red {
background: #b71c1c;
border-radius: 0 100% 0 0;
box-shadow: inset 4px -4px 10px rgba(0, 0, 0, 0.3);
}
.btn-red:hover:not(:disabled), .btn-red.active {
background: #f44336;
box-shadow: 0 0 30px #f44336, inset 2px -2px 5px rgba(0, 0, 0, 0.2);
}
/* Yellow - Bottom Left */
.btn-yellow {
background: #f57f17;
border-radius: 0 0 0 100%;
box-shadow: inset -4px 4px 10px rgba(0, 0, 0, 0.3);
}
.btn-yellow:hover:not(:disabled), .btn-yellow.active {
background: #ffeb3b;
box-shadow: 0 0 30px #ffeb3b, inset -2px 2px 5px rgba(0, 0, 0, 0.2);
}
/* Blue - Bottom Right */
.btn-blue {
background: #0d47a1;
border-radius: 0 0 100% 0;
box-shadow: inset 4px 4px 10px rgba(0, 0, 0, 0.3);
}
.btn-blue:hover:not(:disabled), .btn-blue.active {
background: #2196f3;
box-shadow: 0 0 30px #2196f3, inset 2px 2px 5px rgba(0, 0, 0, 0.2);
}
.controls {
margin-top: 0.75rem;
}
.start-btn {
padding: 10px 30px;
font-size: clamp(0.85rem, 2.5vw, 1rem);
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 25px;
cursor: pointer;
transition: transform 0.2s, box-shadow 0.2s;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 1px;
}
.start-btn:hover {
transform: scale(1.05);
box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
}
.start-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
transform: none;
}
.instructions {
font-size: 0.85rem;
opacity: 0.8;
text-align: center;
max-width: 220px;
line-height: 1.4;
padding: 1rem;
background: rgba(255, 255, 255, 0.05);
border-radius: 10px;
}
.instructions h3 {
font-size: 1rem;
margin-bottom: 0.5rem;
color: #ffd700;
}
.instructions p {
margin-bottom: 0.5rem;
}
.instructions .example {
font-size: 0.8rem;
opacity: 0.85;
font-style: italic;
}
.instructions .example span {
font-weight: bold;
font-style: normal;
}
.keyboard-hint {
margin-top: 0.75rem;
padding-top: 0.75rem;
border-top: 1px solid rgba(255, 255, 255, 0.1);
font-size: 0.75rem;
opacity: 0.6;
}
.keyboard-hint code {
background: rgba(255, 255, 255, 0.1);
padding: 2px 6px;
border-radius: 3px;
font-family: monospace;
}
/* Game Over Overlay */
.overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.95);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
opacity: 0;
visibility: hidden;
transition: opacity 0.3s, visibility 0.3s;
z-index: 100;
}
.overlay.visible {
opacity: 1;
visibility: visible;
}
.overlay h2 {
font-size: clamp(1.5rem, 6vw, 2.5rem);
color: #f44336;
margin-bottom: 0.5rem;
text-shadow: 0 0 30px rgba(244, 67, 54, 0.5);
}
.overlay .final-score {
font-size: clamp(1rem, 3vw, 1.5rem);
margin-bottom: 0.5rem;
}
.overlay .final-score span {
color: #4caf50;
font-weight: bold;
font-size: 1.2em;
}
.play-again-btn {
padding: 12px 40px;
font-size: clamp(0.9rem, 2.5vw, 1.1rem);
background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
color: white;
border: none;
border-radius: 25px;
cursor: pointer;
transition: transform 0.2s, box-shadow 0.2s;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 1px;
}
.play-again-btn:hover {
transform: scale(1.05);
box-shadow: 0 5px 20px rgba(76, 175, 80, 0.5);
}
/* Status indicator */
.status {
margin-top: 0.5rem;
font-size: clamp(0.75rem, 2vw, 0.9rem);
min-height: 1.3em;
color: #ffd700;
}
/* Desktop layout - side by side */
@media (min-width: 600px) {
.main-container {
flex-direction: row;
align-items: center;
gap: 2rem;
}
.instructions {
max-width: 260px;
text-align: left;
}
}
/* Larger desktop */
@media (min-width: 900px) {
.main-container {
gap: 3rem;
}
.instructions {
max-width: 300px;
}
.color-btn {
width: 130px;
height: 130px;
}
}
/* Small screens - hide keyboard hints and instructions */
@media (max-width: 600px) {
.color-btn::after {
display: none;
}
.instructions {
display: none;
}
}
/* Help button - mobile only */
.help-btn {
display: none;
}
@media (max-width: 600px) {
.help-btn {
display: flex;
position: fixed;
top: 12px;
right: 12px;
width: 36px;
height: 36px;
background: rgba(255, 255, 255, 0.15);
border: 2px solid rgba(255, 255, 255, 0.3);
border-radius: 50%;
color: #fff;
font-size: 1.2rem;
font-weight: bold;
align-items: center;
justify-content: center;
cursor: pointer;
z-index: 50;
}
.help-btn:active {
background: rgba(255, 255, 255, 0.25);
}
}
/* Help overlay */
.help-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.95);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
opacity: 0;
visibility: hidden;
transition: opacity 0.3s, visibility 0.3s;
z-index: 200;
padding: 1.5rem;
}
.help-overlay.visible {
opacity: 1;
visibility: visible;
}
.help-content {
text-align: center;
max-width: 300px;
}
.help-content h2 {
font-size: 1.5rem;
color: #ffd700;
margin-bottom: 1rem;
}
.help-content p {
font-size: 0.95rem;
line-height: 1.5;
margin-bottom: 0.75rem;
opacity: 0.9;
}
.help-close-btn {
margin-top: 1.5rem;
padding: 12px 40px;
font-size: 1rem;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 25px;
cursor: pointer;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 1px;
}
</style>
</head>
<body>
<button class="help-btn" id="helpBtn">?</button>
<h1 data-i18n="title">Sequence Master</h1>
<div class="main-container">
<div class="game-section">
<div class="score-display"><span data-i18n="score">Score</span>: <span id="score">0</span></div>
<div class="game-board">
<button class="color-btn btn-green" data-color="green" data-key="Q" disabled></button>
<button class="color-btn btn-red" data-color="red" data-key="W" disabled></button>
<button class="color-btn btn-yellow" data-color="yellow" data-key="A" disabled></button>
<button class="color-btn btn-blue" data-color="blue" data-key="S" disabled></button>
</div>
<div class="status" id="status"></div>
<div class="controls">
<button class="start-btn" id="startBtn" data-i18n="startGame">Start Game</button>
</div>
</div>
<div class="instructions">
<h3 data-i18n="howToPlay">How to Play</h3>
<p data-i18n="instruction">Each round, a new color lights up. Repeat the <strong>entire sequence</strong> from the beginning.</p>
<p class="example" data-i18n="example"><span>Example:</span> Round 3 shows Blue. You must press Green (round 1), Red (round 2), and Blue (this round).</p>
<div class="keyboard-hint">
<code>Q</code> <code>W</code> <code>A</code> <code>S</code> <span data-i18n="forColors">for colors</span><br>
<code>Space</code> <span data-i18n="toStart">to start</span>
</div>
</div>
</div>
<div class="overlay" id="gameOverlay">
<h2 data-i18n="gameOver">Game Over!</h2>
<p class="final-score"><span data-i18n="yourScore">Your score</span>: <span id="finalScore">0</span></p>
<button class="play-again-btn" id="playAgainBtn" data-i18n="playAgain">Play Again</button>
</div>
<div class="help-overlay" id="helpOverlay">
<div class="help-content">
<h2 data-i18n="howToPlay">How to Play</h2>
<p data-i18n="instruction">Each round, a new color lights up. Repeat the <strong>entire sequence</strong> from the beginning.</p>
<p class="example" data-i18n="example"><span>Example:</span> Round 3 shows Blue. You must press Green (round 1), Red (round 2), and Blue (this round).</p>
<button class="help-close-btn" id="helpCloseBtn" data-i18n="gotIt">Got it!</button>
</div>
</div>
<script>
// Translations for all PlayMesa supported languages
const TRANSLATIONS = {
en: {
title: 'Sequence Master',
score: 'Score',
howToPlay: 'How to Play',
instruction: 'Each round, a new color lights up. Repeat the <strong>entire sequence</strong> from the beginning.',
example: '<span>Example:</span> Round 3 shows Blue. You must press Green (round 1), Red (round 2), and Blue (this round).',
forColors: 'for colors',
toStart: 'to start',
startGame: 'Start Game',
gameOver: 'Game Over!',
yourScore: 'Your score',
playAgain: 'Play Again',
gotIt: 'Got it!',
watch: 'Watch...',
yourTurn: 'Your turn!',
correct: 'Correct!'
},
cs: {
title: 'Sequence Master',
score: 'Skóre',
howToPlay: 'Jak hrát',
instruction: 'Každé kolo se rozsvítí nová barva. Zopakuj <strong>celou sekvenci</strong> od začátku.',
example: '<span>Příklad:</span> Kolo 3 ukáže modrou. Musíš zmáčknout zelenou (kolo 1), červenou (kolo 2) a modrou (toto kolo).',
forColors: 'pro barvy',
toStart: 'pro start',
startGame: 'Spustit hru',
gameOver: 'Konec hry!',
yourScore: 'Tvé skóre',
playAgain: 'Hrát znovu',
gotIt: 'Rozumím!',
watch: 'Sleduj...',
yourTurn: 'Tvůj tah!',
correct: 'Správně!'
},
de: {
title: 'Sequence Master',
score: 'Punkte',
howToPlay: 'Spielanleitung',
instruction: 'Jede Runde leuchtet eine neue Farbe auf. Wiederhole die <strong>gesamte Sequenz</strong> von Anfang an.',
example: '<span>Beispiel:</span> Runde 3 zeigt Blau. Du musst Grün (Runde 1), Rot (Runde 2) und Blau (diese Runde) drücken.',
forColors: 'für Farben',
toStart: 'zum Starten',
startGame: 'Spiel starten',
gameOver: 'Spiel vorbei!',
yourScore: 'Deine Punkte',
playAgain: 'Nochmal spielen',
gotIt: 'Verstanden!',
watch: 'Schau zu...',
yourTurn: 'Du bist dran!',
correct: 'Richtig!'
},
es: {
title: 'Sequence Master',
score: 'Puntos',
howToPlay: 'Cómo jugar',
instruction: 'Cada ronda, un nuevo color se ilumina. Repite la <strong>secuencia completa</strong> desde el principio.',
example: '<span>Ejemplo:</span> La ronda 3 muestra Azul. Debes presionar Verde (ronda 1), Rojo (ronda 2) y Azul (esta ronda).',
forColors: 'para colores',
toStart: 'para iniciar',
startGame: 'Iniciar juego',
gameOver: '¡Fin del juego!',
yourScore: 'Tu puntuación',
playAgain: 'Jugar de nuevo',
gotIt: '¡Entendido!',
watch: 'Mira...',
yourTurn: '¡Tu turno!',
correct: '¡Correcto!'
},
it: {
title: 'Sequence Master',
score: 'Punteggio',
howToPlay: 'Come giocare',
instruction: 'Ogni round, un nuovo colore si illumina. Ripeti l\'<strong>intera sequenza</strong> dall\'inizio.',
example: '<span>Esempio:</span> Il round 3 mostra Blu. Devi premere Verde (round 1), Rosso (round 2) e Blu (questo round).',
forColors: 'per i colori',
toStart: 'per iniziare',
startGame: 'Inizia gioco',
gameOver: 'Fine partita!',
yourScore: 'Il tuo punteggio',
playAgain: 'Gioca ancora',
gotIt: 'Capito!',
watch: 'Guarda...',
yourTurn: 'Tocca a te!',
correct: 'Corretto!'
},
fr: {
title: 'Sequence Master',
score: 'Score',
howToPlay: 'Comment jouer',
instruction: 'À chaque tour, une nouvelle couleur s\'allume. Répétez la <strong>séquence entière</strong> depuis le début.',
example: '<span>Exemple:</span> Le tour 3 montre Bleu. Vous devez appuyer sur Vert (tour 1), Rouge (tour 2), et Bleu (ce tour).',
forColors: 'pour les couleurs',
toStart: 'pour commencer',
startGame: 'Commencer',
gameOver: 'Fin de partie!',
yourScore: 'Votre score',
playAgain: 'Rejouer',
gotIt: 'Compris!',
watch: 'Regardez...',
yourTurn: 'À vous!',
correct: 'Correct!'
},
pt: {
title: 'Sequence Master',
score: 'Pontuação',
howToPlay: 'Como jogar',
instruction: 'A cada rodada, uma nova cor acende. Repita a <strong>sequência inteira</strong> desde o início.',
example: '<span>Exemplo:</span> A rodada 3 mostra Azul. Você deve pressionar Verde (rodada 1), Vermelho (rodada 2) e Azul (esta rodada).',
forColors: 'para cores',
toStart: 'para iniciar',
startGame: 'Iniciar jogo',
gameOver: 'Fim de jogo!',
yourScore: 'Sua pontuação',
playAgain: 'Jogar novamente',
gotIt: 'Entendi!',
watch: 'Observe...',
yourTurn: 'Sua vez!',
correct: 'Correto!'
},
ru: {
title: 'Sequence Master',
score: 'Счёт',
howToPlay: 'Как играть',
instruction: 'Каждый раунд загорается новый цвет. Повторите <strong>всю последовательность</strong> сначала.',
example: '<span>Пример:</span> Раунд 3 показывает синий. Нажмите зелёный (раунд 1), красный (раунд 2) и синий (этот раунд).',
forColors: 'для цветов',
toStart: 'для старта',
startGame: 'Начать игру',
gameOver: 'Игра окончена!',
yourScore: 'Ваш счёт',
playAgain: 'Играть снова',
gotIt: 'Понятно!',
watch: 'Смотрите...',
yourTurn: 'Ваш ход!',
correct: 'Правильно!'
},
ja: {
title: 'Sequence Master',
score: 'スコア',
howToPlay: '遊び方',
instruction: '毎ラウンド、新しい色が光ります。<strong>全ての順序</strong>を最初から繰り返してください。',
example: '<span>例:</span> ラウンド3では青が表示されます。緑(ラウンド1)、赤(ラウンド2)、青(今回)の順に押してください。',
forColors: '色選択用',
toStart: '開始用',
startGame: 'ゲーム開始',
gameOver: 'ゲームオーバー!',
yourScore: 'あなたのスコア',
playAgain: 'もう一度',
gotIt: 'わかった!',
watch: '見て...',
yourTurn: 'あなたの番!',
correct: '正解!'
},
ko: {
title: 'Sequence Master',
score: '점수',
howToPlay: '게임 방법',
instruction: '매 라운드마다 새로운 색이 켜집니다. 처음부터 <strong>전체 순서</strong>를 반복하세요.',
example: '<span>예시:</span> 라운드 3에서 파란색이 나타납니다. 초록(라운드 1), 빨강(라운드 2), 파랑(이번 라운드)을 누르세요.',
forColors: '색상 선택',
toStart: '시작',
startGame: '게임 시작',
gameOver: '게임 오버!',
yourScore: '당신의 점수',
playAgain: '다시 하기',
gotIt: '알겠어요!',
watch: '보세요...',
yourTurn: '당신 차례!',
correct: '정답!'
},
zh: {
title: 'Sequence Master',
score: '分数',
howToPlay: '游戏规则',
instruction: '每轮会亮起一个新颜色。从头开始重复<strong>整个序列</strong>。',
example: '<span>示例:</span> 第3轮显示蓝色。你需要按绿色(第1轮)、红色(第2轮)和蓝色(本轮)。',
forColors: '选择颜色',
toStart: '开始',
startGame: '开始游戏',
gameOver: '游戏结束!',
yourScore: '你的分数',
playAgain: '再玩一次',
gotIt: '明白了!',
watch: '看...',
yourTurn: '轮到你了!',
correct: '正确!'
},
hi: {
title: 'Sequence Master',
score: 'स्कोर',
howToPlay: 'कैसे खेलें',
instruction: 'हर राउंड में एक नया रंग जलता है। शुरू से <strong>पूरा क्रम</strong> दोहराएं।',
example: '<span>उदाहरण:</span> राउंड 3 में नीला दिखता है। आपको हरा (राउंड 1), लाल (राउंड 2), और नीला (यह राउंड) दबाना होगा।',
forColors: 'रंगों के लिए',
toStart: 'शुरू करने के लिए',
startGame: 'खेल शुरू करें',
gameOver: 'खेल खत्म!',
yourScore: 'आपका स्कोर',
playAgain: 'फिर से खेलें',
gotIt: 'समझ गया!',
watch: 'देखो...',
yourTurn: 'आपकी बारी!',
correct: 'सही!'
},
ar: {
title: 'Sequence Master',
score: 'النقاط',
howToPlay: 'كيف تلعب',
instruction: 'كل جولة، يضيء لون جديد. كرر <strong>التسلسل بالكامل</strong> من البداية.',
example: '<span>مثال:</span> الجولة 3 تظهر الأزرق. يجب الضغط على الأخضر (جولة 1)، الأحمر (جولة 2)، والأزرق (هذه الجولة).',
forColors: 'للألوان',
toStart: 'للبدء',
startGame: 'ابدأ اللعبة',
gameOver: 'انتهت اللعبة!',
yourScore: 'نتيجتك',
playAgain: 'العب مجدداً',
gotIt: 'فهمت!',
watch: 'شاهد...',
yourTurn: 'دورك!',
correct: 'صحيح!'
},
nl: {
title: 'Sequence Master',
score: 'Score',
howToPlay: 'Hoe te spelen',
instruction: 'Elke ronde licht een nieuwe kleur op. Herhaal de <strong>hele reeks</strong> vanaf het begin.',
example: '<span>Voorbeeld:</span> Ronde 3 toont blauw. Je moet groen (ronde 1), rood (ronde 2) en blauw (deze ronde) indrukken.',
forColors: 'voor kleuren',
toStart: 'om te starten',
startGame: 'Start spel',
gameOver: 'Spel voorbij!',
yourScore: 'Jouw score',
playAgain: 'Opnieuw spelen',
gotIt: 'Begrepen!',
watch: 'Kijk...',
yourTurn: 'Jouw beurt!',
correct: 'Correct!'
},
pl: {
title: 'Sequence Master',
score: 'Wynik',
howToPlay: 'Jak grać',
instruction: 'Każda runda zapala się nowy kolor. Powtórz <strong>całą sekwencję</strong> od początku.',
example: '<span>Przykład:</span> Runda 3 pokazuje niebieski. Musisz nacisnąć zielony (runda 1), czerwony (runda 2) i niebieski (ta runda).',
forColors: 'dla kolorów',
toStart: 'aby rozpocząć',
startGame: 'Rozpocznij grę',
gameOver: 'Koniec gry!',
yourScore: 'Twój wynik',
playAgain: 'Zagraj ponownie',
gotIt: 'Rozumiem!',
watch: 'Patrz...',
yourTurn: 'Twoja kolej!',
correct: 'Dobrze!'
},
tr: {
title: 'Sequence Master',
score: 'Puan',
howToPlay: 'Nasıl oynanır',
instruction: 'Her turda yeni bir renk yanar. <strong>Tüm sırayı</strong> baştan tekrarlayın.',
example: '<span>Örnek:</span> Tur 3 maviyi gösterir. Yeşil (tur 1), kırmızı (tur 2) ve mavi (bu tur) basmalısınız.',
forColors: 'renkler için',
toStart: 'başlamak için',
startGame: 'Oyunu Başlat',
gameOver: 'Oyun Bitti!',
yourScore: 'Puanınız',
playAgain: 'Tekrar Oyna',
gotIt: 'Anladım!',
watch: 'İzle...',
yourTurn: 'Senin sıran!',
correct: 'Doğru!'
},
vi: {
title: 'Sequence Master',
score: 'Điểm',
howToPlay: 'Cách chơi',
instruction: 'Mỗi vòng, một màu mới sáng lên. Lặp lại <strong>toàn bộ chuỗi</strong> từ đầu.',
example: '<span>Ví dụ:</span> Vòng 3 hiện màu xanh dương. Bạn phải nhấn xanh lá (vòng 1), đỏ (vòng 2), và xanh dương (vòng này).',
forColors: 'cho màu sắc',
toStart: 'để bắt đầu',
startGame: 'Bắt đầu',
gameOver: 'Kết thúc!',
yourScore: 'Điểm của bạn',
playAgain: 'Chơi lại',
gotIt: 'Hiểu rồi!',
watch: 'Xem...',
yourTurn: 'Lượt bạn!',
correct: 'Đúng!'
},
th: {
title: 'Sequence Master',
score: 'คะแนน',
howToPlay: 'วิธีเล่น',
instruction: 'ทุกรอบจะมีสีใหม่สว่างขึ้น ทำซ้ำ<strong>ลำดับทั้งหมด</strong>ตั้งแต่ต้น',
example: '<span>ตัวอย่าง:</span> รอบ 3 แสดงสีน้ำเงิน คุณต้องกดเขียว (รอบ 1), แดง (รอบ 2), และน้ำเงิน (รอบนี้)',
forColors: 'สำหรับสี',
toStart: 'เพื่อเริ่ม',
startGame: 'เริ่มเกม',
gameOver: 'จบเกม!',
yourScore: 'คะแนนของคุณ',
playAgain: 'เล่นอีกครั้ง',
gotIt: 'เข้าใจแล้ว!',
watch: 'ดู...',
yourTurn: 'ตาคุณ!',
correct: 'ถูกต้อง!'
},
sv: {
title: 'Sequence Master',
score: 'Poäng',
howToPlay: 'Hur man spelar',
instruction: 'Varje omgång tänds en ny färg. Upprepa <strong>hela sekvensen</strong> från början.',
example: '<span>Exempel:</span> Omgång 3 visar blå. Du måste trycka grön (omgång 1), röd (omgång 2) och blå (denna omgång).',
forColors: 'för färger',
toStart: 'för att starta',
startGame: 'Starta spel',
gameOver: 'Spelet slut!',
yourScore: 'Din poäng',
playAgain: 'Spela igen',
gotIt: 'Förstått!',
watch: 'Titta...',
yourTurn: 'Din tur!',
correct: 'Rätt!'
},
el: {
title: 'Sequence Master',
score: 'Σκορ',
howToPlay: 'Πώς να παίξεις',
instruction: 'Κάθε γύρο, ένα νέο χρώμα ανάβει. Επανέλαβε <strong>ολόκληρη την ακολουθία</strong> από την αρχή.',
example: '<span>Παράδειγμα:</span> Ο γύρος 3 δείχνει μπλε. Πρέπει να πατήσεις πράσινο (γύρος 1), κόκκινο (γύρος 2) και μπλε (αυτός ο γύρος).',
forColors: 'για χρώματα',
toStart: 'για έναρξη',
startGame: 'Έναρξη',
gameOver: 'Τέλος παιχνιδιού!',
yourScore: 'Το σκορ σου',
playAgain: 'Παίξε ξανά',
gotIt: 'Κατάλαβα!',
watch: 'Κοίτα...',
yourTurn: 'Η σειρά σου!',
correct: 'Σωστά!'
},
hu: {
title: 'Sequence Master',
score: 'Pontszám',
howToPlay: 'Hogyan játssz',
instruction: 'Minden körben egy új szín világít fel. Ismételd meg a <strong>teljes sorozatot</strong> az elejétől.',
example: '<span>Példa:</span> A 3. kör kéket mutat. Nyomd meg a zöldet (1. kör), pirosat (2. kör) és kéket (ez a kör).',
forColors: 'színekhez',
toStart: 'indításhoz',
startGame: 'Játék indítása',
gameOver: 'Játék vége!',
yourScore: 'Pontszámod',
playAgain: 'Újra játszani',
gotIt: 'Értem!',
watch: 'Figyelj...',
yourTurn: 'Te jössz!',
correct: 'Helyes!'
},
ro: {
title: 'Sequence Master',
score: 'Scor',
howToPlay: 'Cum să joci',
instruction: 'În fiecare rundă, o culoare nouă se aprinde. Repetă <strong>întreaga secvență</strong> de la început.',
example: '<span>Exemplu:</span> Runda 3 arată albastru. Trebuie să apeși verde (runda 1), roșu (runda 2) și albastru (această rundă).',
forColors: 'pentru culori',
toStart: 'pentru a începe',
startGame: 'Începe jocul',
gameOver: 'Joc terminat!',
yourScore: 'Scorul tău',
playAgain: 'Joacă din nou',
gotIt: 'Am înțeles!',
watch: 'Privește...',
yourTurn: 'Rândul tău!',
correct: 'Corect!'
},
uk: {
title: 'Sequence Master',
score: 'Рахунок',
howToPlay: 'Як грати',
instruction: 'Кожен раунд засвічується новий колір. Повторіть <strong>всю послідовність</strong> спочатку.',
example: '<span>Приклад:</span> Раунд 3 показує синій. Натисніть зелений (раунд 1), червоний (раунд 2) і синій (цей раунд).',
forColors: 'для кольорів',
toStart: 'для старту',
startGame: 'Почати гру',
gameOver: 'Гру закінчено!',
yourScore: 'Ваш рахунок',
playAgain: 'Грати знову',
gotIt: 'Зрозуміло!',
watch: 'Дивіться...',
yourTurn: 'Ваш хід!',
correct: 'Правильно!'
},
id: {
title: 'Sequence Master',
score: 'Skor',
howToPlay: 'Cara bermain',
instruction: 'Setiap ronde, warna baru menyala. Ulangi <strong>seluruh urutan</strong> dari awal.',
example: '<span>Contoh:</span> Ronde 3 menampilkan biru. Tekan hijau (ronde 1), merah (ronde 2), dan biru (ronde ini).',
forColors: 'untuk warna',
toStart: 'untuk mulai',
startGame: 'Mulai Permainan',
gameOver: 'Permainan Selesai!',
yourScore: 'Skor Anda',
playAgain: 'Main Lagi',
gotIt: 'Mengerti!',
watch: 'Lihat...',
yourTurn: 'Giliran Anda!',
correct: 'Benar!'
},
ms: {
title: 'Sequence Master',
score: 'Skor',
howToPlay: 'Cara bermain',
instruction: 'Setiap pusingan, warna baru menyala. Ulang <strong>keseluruhan urutan</strong> dari awal.',
example: '<span>Contoh:</span> Pusingan 3 menunjukkan biru. Tekan hijau (pusingan 1), merah (pusingan 2), dan biru (pusingan ini).',
forColors: 'untuk warna',
toStart: 'untuk mula',
startGame: 'Mula Permainan',
gameOver: 'Permainan Tamat!',
yourScore: 'Skor anda',
playAgain: 'Main Lagi',
gotIt: 'Faham!',
watch: 'Lihat...',
yourTurn: 'Giliran anda!',
correct: 'Betul!'
},
tl: {
title: 'Sequence Master',
score: 'Iskor',
howToPlay: 'Paano laruin',
instruction: 'Bawat round, may bagong kulay na nagliliwanag. Ulitin ang <strong>buong pagkakasunod</strong> mula sa simula.',
example: '<span>Halimbawa:</span> Round 3 ay nagpapakita ng asul. Pindutin ang berde (round 1), pula (round 2), at asul (round na ito).',
forColors: 'para sa kulay',
toStart: 'para magsimula',
startGame: 'Simulan',
gameOver: 'Tapos na!',
yourScore: 'Ang iskor mo',
playAgain: 'Maglaro Ulit',
gotIt: 'Nakuha ko!',
watch: 'Panoorin...',
yourTurn: 'Ikaw na!',
correct: 'Tama!'
},
bn: {
title: 'Sequence Master',
score: 'স্কোর',
howToPlay: 'কিভাবে খেলবেন',
instruction: 'প্রতিটি রাউন্ডে একটি নতুন রং জ্বলে। শুরু থেকে <strong>পুরো ক্রমটি</strong> পুনরাবৃত্তি করুন।',
example: '<span>উদাহরণ:</span> রাউন্ড ৩ নীল দেখায়। আপনাকে সবুজ (রাউন্ড ১), লাল (রাউন্ড ২), এবং নীল (এই রাউন্ড) চাপতে হবে।',
forColors: 'রঙের জন্য',
toStart: 'শুরু করতে',
startGame: 'খেলা শুরু',
gameOver: 'খেলা শেষ!',
yourScore: 'আপনার স্কোর',
playAgain: 'আবার খেলুন',
gotIt: 'বুঝেছি!',
watch: 'দেখুন...',
yourTurn: 'আপনার পালা!',
correct: 'সঠিক!'
},
ta: {
title: 'Sequence Master',
score: 'மதிப்பெண்',
howToPlay: 'எப்படி விளையாடுவது',
instruction: 'ஒவ்வொரு சுற்றிலும் புதிய நிறம் ஒளிரும். தொடக்கத்திலிருந்து <strong>முழு வரிசையையும்</strong> மீண்டும் செய்யுங்கள்.',
example: '<span>உதாரணம்:</span> சுற்று 3 நீலத்தைக் காட்டுகிறது. நீங்கள் பச்சை (சுற்று 1), சிவப்பு (சுற்று 2), மற்றும் நீலம் (இந்த சுற்று) அழுத்த வேண்டும்.',
forColors: 'நிறங்களுக்கு',
toStart: 'தொடங்க',
startGame: 'விளையாட்டைத் தொடங்கு',
gameOver: 'விளையாட்டு முடிந்தது!',
yourScore: 'உங்கள் மதிப்பெண்',
playAgain: 'மீண்டும் விளையாடு',
gotIt: 'புரிந்தது!',
watch: 'பார்...',
yourTurn: 'உங்கள் முறை!',
correct: 'சரி!'
},
fa: {
title: 'Sequence Master',
score: 'امتیاز',
howToPlay: 'چگونه بازی کنیم',
instruction: 'هر دور، یک رنگ جدید روشن میشود. <strong>کل توالی</strong> را از ابتدا تکرار کنید.',
example: '<span>مثال:</span> دور ۳ آبی را نشان میدهد. باید سبز (دور ۱)، قرمز (دور ۲) و آبی (این دور) را فشار دهید.',
forColors: 'برای رنگها',
toStart: 'برای شروع',
startGame: 'شروع بازی',
gameOver: 'بازی تمام شد!',
yourScore: 'امتیاز شما',
playAgain: 'دوباره بازی کن',
gotIt: 'فهمیدم!',
watch: 'نگاه کن...',
yourTurn: 'نوبت شما!',
correct: 'درست!'
}
};
let currentLang = 'en';
// Get preferred language from Mesa SDK or browser
function getLanguage() {
if (window.Mesa && window.Mesa.user) {
const langs = window.Mesa.user.getLanguages();
for (const lang of langs) {
if (TRANSLATIONS[lang]) return lang;
}
}
// Fallback to browser language
const browserLang = navigator.language.split('-')[0];
if (TRANSLATIONS[browserLang]) return browserLang;
return 'en';
}
// Apply translations to all UI elements
function applyTranslations() {
currentLang = getLanguage();
const t = TRANSLATIONS[currentLang];
// Update all elements with data-i18n attribute
document.querySelectorAll('[data-i18n]').forEach(el => {
const key = el.getAttribute('data-i18n');
if (t[key]) {
el.innerHTML = t[key];
}
});
}
// Game constants
const COLORS = ['green', 'red', 'yellow', 'blue'];
const FREQUENCIES = {
green: 415, // G#4