-
-
Notifications
You must be signed in to change notification settings - Fork 662
Expand file tree
/
Copy pathindex.html
More file actions
1341 lines (1254 loc) · 70.7 KB
/
Copy pathindex.html
File metadata and controls
1341 lines (1254 loc) · 70.7 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>SERVER: Survival Protocol</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="src/locales/en.js"></script>
<script src="src/locales/zh.js"></script>
<script src="src/locales/pt-BR.js"></script>
<script src="src/locales/de.js"></script>
<script src="src/locales/fr.js"></script>
<script src="src/locales/ko.js"></script>
<script src="src/locales/ru.js"></script>
<script src="src/i18n.js"></script>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<!-- UI Overlay: Top Bar -->
<div class="absolute top-0 left-0 w-full h-full pointer-events-none">
<!-- Stats Panel (Top Left) -->
<div id="statsPanel" class="absolute top-4 left-4 glass-panel rounded-xl p-5 w-80 pointer-events-auto">
<div class="flex justify-between items-end mb-3 border-b border-gray-700 pb-2">
<h1 data-i18n="survival" class="text-2xl font-bold text-red-500 tracking-widest animate-pulse">
SURVIVAL
</h1>
<span class="text-xs text-gray-500 font-mono">v2.1</span>
</div>
<div class="space-y-2">
<div class="flex justify-between items-center">
<span data-i18n="budget" class="text-gray-400 text-sm">BUDGET</span>
<span id="money-display"
class="text-green-400 font-mono text-xl font-bold transition-colors duration-300">$500</span>
</div>
<div class="flex justify-between items-center text-xs">
<span data-i18n="upkeep_cost" class="text-gray-500">Upkeep Cost</span>
<span id="upkeep-display" class="text-red-400 font-mono">-$0.00/s</span>
</div>
<div class="flex justify-between items-center text-xs">
<span data-i18n="elapsed_time" class="text-gray-500">Elapsed Time</span>
<span id="elapsed-time" class="text-gray-400 font-mono">00:00</span>
</div>
<div class="flex justify-between items-center">
<span data-i18n="reputation" class="text-gray-400 text-sm">REPUTATION</span>
<div class="flex items-center gap-2">
<div class="w-24 h-3 bg-gray-800 rounded-full overflow-hidden relative">
<div id="rep-bar" class="h-full bg-yellow-500 transition-all duration-500" style="width: 100%"></div>
</div>
<span id="rep-display" class="text-yellow-400 font-mono text-sm w-10 text-right">100%</span>
</div>
</div>
<div class="flex justify-between items-center pt-1">
<span data-i18n="load_rps" class="text-gray-400 text-sm">LOAD (RPS)</span>
<span id="rps-display" class="text-blue-300 font-mono text-sm">0.0 req/s</span>
</div>
<div class="flex justify-between items-center text-xs" id="rps-milestone-row">
<span data-i18n="next_rps_surge" class="text-gray-500">Next RPS Surge</span>
<div class="flex items-center gap-2 font-mono">
<span id="rps-next" class="text-orange-400">×1.0</span>
<span data-i18n="in" class="text-gray-600">in</span>
<span id="rps-countdown" class="text-cyan-400">0:00</span>
</div>
</div>
<div class="flex justify-between items-center pt-1">
<span data-i18n="traffic" class="text-gray-400 text-sm">TRAFFIC</span>
<div class="flex gap-1 text-[10px] font-mono">
<span class="text-green-400" id="mix-static" data-i18n-title="traffic_static" title="Static GET">ST</span>
<span class="text-blue-400" id="mix-read" data-i18n-title="traffic_read" title="Read GET">RD</span>
<span class="text-orange-400" id="mix-write" data-i18n-title="traffic_write" title="Write POST">WR</span>
<span class="text-yellow-400" id="mix-upload" data-i18n-title="traffic_upload" title="Upload">UP</span>
<span class="text-cyan-400" id="mix-search" data-i18n-title="traffic_search" title="Search">SR</span>
<span class="text-red-400" id="mix-malicious" data-i18n-title="traffic_malicious" title="Malicious">⚠️</span>
</div>
</div>
<!-- Failures Table -->
<div id="failures-panel" class="mt-2 pt-2 border-t border-gray-700/50 hidden">
<div class="flex justify-between items-center mb-2">
<span data-i18n="failures" class="text-gray-500 text-xs uppercase">Failures</span>
<span id="failures-total" class="text-red-400 font-mono text-xs">0 <span data-i18n="total">total</span></span>
<button id="clear-all" class="text-gray-500 hover:text-white text-[10px] font-mono transition" title="Clear all failures" > Clear </button>
</div>
<table class="w-full text-[10px] font-mono">
<thead>
<tr class="text-gray-500">
<th data-i18n="type" class="text-left font-normal">Type</th>
<th data-i18n="count" class="text-right font-normal">Count</th>
<th data-i18n="rep_loss" class="text-right font-normal">Rep Loss</th>
</tr>
</thead>
<tbody id="failures-tbody">
<tr class="text-purple-400" id="fail-row-malicious">
<td data-i18n="fraud_leak">🛡️ Fraud Leak</td>
<td class="text-right" id="fail-malicious">0</td>
<td class="text-right text-red-400" id="fail-malicious-rep">
0
</td>
</tr>
<tr class="text-green-400" id="fail-row-static">
<td data-i18n="fail_static">ST Static</td>
<td class="text-right" id="fail-static">0</td>
<td class="text-right text-red-400" id="fail-static-rep">
0
</td>
</tr>
<tr class="text-blue-400" id="fail-row-read">
<td data-i18n="fail_read">RD Read</td>
<td class="text-right" id="fail-read">0</td>
<td class="text-right text-red-400" id="fail-read-rep">0</td>
</tr>
<tr class="text-orange-400" id="fail-row-write">
<td data-i18n="fail_write">WR Write</td>
<td class="text-right" id="fail-write">0</td>
<td class="text-right text-red-400" id="fail-write-rep">0</td>
</tr>
<tr class="text-yellow-400" id="fail-row-upload">
<td data-i18n="fail_upload">UP Upload</td>
<td class="text-right" id="fail-upload">0</td>
<td class="text-right text-red-400" id="fail-upload-rep">
0
</td>
</tr>
<tr class="text-cyan-400" id="fail-row-search">
<td data-i18n="fail_search">SR Search</td>
<td class="text-right" id="fail-search">0</td>
<td class="text-right text-red-400" id="fail-search-rep">
0
</td>
</tr>
</tbody>
</table>
</div>
<div class="flex justify-between items-center pt-3 border-t border-gray-700 mt-2">
<span data-i18n="total_score" class="text-gray-300 font-bold text-lg">TOTAL SCORE</span>
<span id="total-score-display" class="text-white font-mono text-2xl font-bold">0</span>
</div>
</div>
</div>
<div class="absolute top-4 right-4 flex flex-col gap-3 items-end pointer-events-none">
<!-- Score Details Panel (Top Right) -->
<div id="detailsPanel" class="glass-panel rounded-xl p-4 w-60 pointer-events-auto">
<h3 data-i18n="traffic_score_details" class="text-xs font-bold text-gray-400 uppercase tracking-wider mb-2 border-b border-gray-700 pb-1">
Traffic Score Details
</h3>
<div class="space-y-1 text-sm font-mono">
<div class="flex justify-between items-center">
<span data-i18n="storage_s3" class="text-gray-500">Storage (S3)</span>
<span id="score-storage" class="text-emerald-300">0</span>
</div>
<div class="flex justify-between items-center">
<span data-i18n="database_sql" class="text-gray-500">Database (SQL)</span>
<span id="score-database" class="text-red-300">0</span>
</div>
<div class="flex justify-between items-center pt-1 border-t border-gray-800">
<span data-i18n="attacks_blocked" class="text-purple-300 font-bold">ATTACKS BLOCKED</span>
<span id="score-malicious" class="text-purple-300">0</span>
</div>
</div>
</div>
<!-- Service Health Panel (Under Score Details) -->
<div id="healthPanel" class="glass-panel rounded-xl p-4 w-72 pointer-events-auto transition-all duration-300">
<div class="flex justify-between items-center mb-2 border-b border-gray-700 pb-1">
<h3 data-i18n="service_health" class="text-xs font-bold text-red-400 uppercase tracking-wider">
Service Health
</h3>
<div class="flex items-center gap-2">
<button id="auto-repair-toggle" onclick="toggleAutoRepair()"
class="px-2 py-0.5 rounded text-xs font-mono bg-gray-700 text-gray-400 hover:bg-gray-600 transition"
title="Auto-repair services (+10% upkeep)"
data-i18n="auto_repair"
data-i18n-title="auto_repair_hint">
Auto-Repair: OFF
</button>
<button onclick="togglePanel('health-panel-content', 'health-panel-icon')"
class="w-6 h-6 flex items-center justify-center bg-gray-800 hover:bg-gray-700 rounded border border-gray-600 text-gray-400 transition">
<span id="health-panel-icon" class="text-[10px]">▲</span>
</button>
</div>
</div>
<div id="health-panel-content">
<div id="service-health-list" class="text-sm font-mono mb-2">
<div data-i18n="all_services_healthy" class="text-green-400 text-xs">All services healthy</div>
</div>
<div id="repair-cost-table" class="text-xs border-t border-gray-700 pt-2 hidden">
<div class="grid grid-cols-3 gap-1 text-gray-500 mb-1">
<span data-i18n="service">Service</span>
<span data-i18n="repair" class="text-center">Repair</span>
<span data-i18n="auto_repair_min" class="text-right">Auto Repair/min</span>
</div>
<div id="repair-cost-rows" class="space-y-0.5"></div>
</div>
<div class="text-xs text-gray-500 mt-2 pt-2 border-t border-gray-700 space-y-1">
<div data-i18n="manual_repair_hint">🔧 Click damaged services to repair manually</div>
<div data-i18n="auto_repair_hint">⚡ Auto-Repair: Heals services at 10% of service cost/min</div>
</div>
</div>
</div>
<!-- Finances Panel (Under Service Health) -->
<div id="financesPanel" class="glass-panel rounded-xl p-4 w-72 pointer-events-auto transition-all duration-300">
<div class="flex justify-between items-center mb-2 border-b border-gray-700 pb-1">
<h3 data-i18n="finances" class="text-xs font-bold text-green-400 uppercase tracking-wider">
Finances
</h3>
<button onclick="togglePanel('finances-panel-content', 'finances-panel-icon')"
class="w-6 h-6 flex items-center justify-center bg-gray-800 hover:bg-gray-700 rounded border border-gray-600 text-gray-400 transition">
<span id="finances-panel-icon" class="text-[10px]">▲</span>
</button>
</div>
<div id="finances-panel-content">
<!-- Income Section -->
<div class="mb-3">
<div class="text-xs text-gray-500 mb-1 flex justify-between">
<span data-i18n="income_by_type">Income by Request Type</span>
<span id="income-total" class="text-green-400 font-bold">$0</span>
</div>
<div id="income-details" class="space-y-0.5 text-xs pl-2 border-l border-gray-700">
<!-- Dynamic rows will be inserted here -->
</div>
</div>
<!-- Expenses Section -->
<div class="mb-3">
<div class="text-xs text-gray-500 mb-1 flex justify-between">
<span data-i18n="expenses_breakdown">Expenses Breakdown</span>
<span id="expense-total" class="text-red-400 font-bold">$0</span>
</div>
<div id="expense-details" class="space-y-0.5 text-xs pl-2 border-l border-gray-700">
<!-- Dynamic rows will be inserted here -->
</div>
</div>
<!-- Net Profit -->
<div class="border-t border-gray-700 pt-2 mt-2">
<div class="grid grid-cols-2 gap-1 text-xs">
<span data-i18n="net_profit" class="text-gray-300 font-bold">Net Profit</span>
<span id="net-profit" class="text-right font-bold text-yellow-400">$0</span>
</div>
</div>
</div>
</div>
</div>
<!-- Active Event Indicator Bar -->
<div id="active-event-bar" class="fixed top-0 left-0 right-0 h-8 z-40 hidden">
<div class="h-full flex items-center justify-center gap-3 text-white font-bold text-sm event-active-bar">
<span id="active-event-icon">⚡</span>
<span data-i18n="event_active" id="active-event-text">EVENT ACTIVE</span>
<span id="active-event-timer" class="font-mono bg-black/30 px-2 rounded"></span>
</div>
<div id="active-event-progress" class="absolute bottom-0 left-0 h-1 bg-white/50 transition-all duration-100"
style="width: 100%"></div>
</div>
<!-- Intervention Warnings Container (Center Top) -->
<div id="intervention-warnings"
class="fixed top-20 left-1/2 transform -translate-x-1/2 z-50 pointer-events-none flex flex-col items-center">
</div>
<!-- Time Control Panel (Top Center) -->
<div
class="absolute top-4 left-1/2 transform -translate-x-1/2 glass-panel rounded-xl p-2 pointer-events-auto flex gap-2">
<!-- Language Switcher -->
<div class="flex items-center bg-gray-800 rounded-lg px-1 border border-gray-600 mr-1">
<select onchange="i18n.setLocale(this.value)" id="lang-select"
class="bg-transparent text-[10px] font-bold text-gray-400 hover:text-white transition-colors cursor-pointer outline-none py-1 px-1">
<option value="en" class="bg-gray-800 text-white">EN</option>
<option value="zh" class="bg-gray-800 text-white">ZH</option>
<option value="pt-BR" class="bg-gray-800 text-white">PT-BR</option>
<option value="de" class="bg-gray-800 text-white">DE</option>
<option value="fr" class="bg-gray-800 text-white">FR</option>
<option value="ko" class="bg-gray-800 text-white">KO</option>
<option value="ru" class="bg-gray-800 text-white">RU</option>
</select>
</div>
<button onclick="showSaveModal()" id="btn-save"
class="time-btn w-10 h-10 rounded-lg border border-gray-600 text-gray-400 hover:text-white hover:border-green-500 hover:text-green-400 flex items-center justify-center"
data-i18n-title="save_game"
title="Save Game">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M8 7H5a2 2 0 00-2 2v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4"></path>
</svg>
</button>
<button onclick="restartGame()" id="btn-restart"
class="time-btn w-10 h-10 rounded-lg border border-gray-600 text-gray-400 hover:text-white hover:border-red-500 hover:text-red-400 flex items-center justify-center mr-2"
data-i18n-title="restart_game"
title="Restart Game">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15">
</path>
</svg>
</button>
<div class="w-px bg-gray-700 mx-1"></div>
<button onclick="handleGameState(0)" id="btn-pause"
class="time-btn w-10 h-10 rounded-lg border border-gray-600 text-gray-400 hover:text-white hover:border-gray-400 flex items-center justify-center">
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24">
<path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z" />
</svg>
</button>
<button onclick="handleGameState(1)" id="btn-play"
class="time-btn active w-10 h-10 rounded-lg border border-gray-600 text-gray-400 hover:text-white hover:border-gray-400 flex items-center justify-center">
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24">
<path d="M8 5v14l11-7z" />
</svg>
</button>
<button onclick="handleGameState(3)" id="btn-fast"
class="time-btn w-10 h-10 rounded-lg border border-gray-600 text-gray-400 hover:text-white hover:border-gray-400 flex items-center justify-center relative">
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24">
<path d="M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z" />
</svg>
</button>
</div>
<!-- Sandbox Control Panel (Bottom Left - replaces objectives in sandbox mode) -->
<div id="sandboxPanel" class="hidden absolute bottom-24 left-4 glass-panel rounded-xl p-4 pointer-events-auto w-80">
<div class="flex justify-between items-center mb-3 border-b border-gray-700 pb-2">
<h3 data-i18n="sandbox" class="text-sm font-bold text-purple-400">SANDBOX</h3>
<button onclick="clearAllServices()"
class="text-xs text-red-400 hover:text-red-300 px-2 py-1 border border-red-900 rounded"
data-i18n="clear_all">
Clear All
</button>
</div>
<!-- BUDGET -->
<div class="mb-3">
<div data-i18n="budget" class="text-xs text-gray-400 mb-1">Budget ($)</div>
<div class="flex items-center gap-2">
<input type="range" id="budget-slider" min="0" max="10000" step="100" value="2000"
oninput="setSandboxBudget(this.value)" class="flex-1 h-2 bg-gray-700 rounded-lg accent-green-500" />
<input type="number" id="budget-input" value="2000" min="0" onchange="setSandboxBudget(this.value)"
class="w-20 px-2 py-1 bg-gray-800 border border-gray-600 rounded text-green-400 text-sm text-center font-mono" />
</div>
<div class="flex gap-2 mt-2">
<button onclick="resetBudget()"
class="flex-1 text-xs py-1.5 bg-gray-700 hover:bg-gray-600 text-gray-300 rounded"
data-i18n="reset_budget">
Reset $
</button>
<button onclick="toggleUpkeep()" id="upkeep-toggle"
class="flex-1 text-xs py-1.5 bg-green-900/50 text-gray-300 rounded border border-gray-600">
<span data-i18n="upkeep_toggle">Upkeep</span>: <span data-i18n="off">OFF</span>
</button>
</div>
</div>
<!-- RPS -->
<div class="mb-3">
<div data-i18n="traffic_rate" class="text-xs text-gray-400 mb-1">Traffic Rate (req/s)</div>
<div class="flex items-center gap-2">
<input type="range" id="rps-slider" min="0" max="50" step="0.5" value="1" oninput="setSandboxRPS(this.value)"
class="flex-1 h-2 bg-gray-700 rounded-lg accent-blue-500" />
<input type="number" id="rps-input" value="1" min="0" step="0.5" onchange="setSandboxRPS(this.value)"
class="w-20 px-2 py-1 bg-gray-800 border border-gray-600 rounded text-blue-400 text-sm text-center font-mono" />
</div>
</div>
<!-- TRAFFIC MIX -->
<div class="mb-3">
<div data-i18n="traffic_mix" class="text-xs text-gray-400 mb-1">Traffic Mix (%)</div>
<!-- STATIC -->
<div class="flex items-center gap-2 mb-1">
<span data-i18n="traffic_static" class="text-xs text-green-400 truncate max-w-[6rem]">STATIC</span>
<input type="range" id="static-slider" min="0" max="100" value="30"
oninput="setTrafficMix('STATIC',this.value)" class="flex-1 min-w-0 h-1.5 bg-gray-700 rounded-lg accent-green-500" />
<input type="number" id="static-input" value="30" min="0" max="100"
onchange="setTrafficMix('STATIC',this.value)"
class="w-14 flex-shrink-0 px-1 py-0.5 bg-gray-800 border border-gray-600 rounded text-green-400 text-xs text-center font-mono" />
</div>
<!-- READ -->
<div class="flex items-center gap-2 mb-1">
<span data-i18n="traffic_read" class="text-xs text-blue-400 truncate max-w-[6rem]">READ</span>
<input type="range" id="read-slider" min="0" max="100" value="20" oninput="setTrafficMix('READ',this.value)"
class="flex-1 min-w-0 h-1.5 bg-gray-700 rounded-lg accent-blue-500" />
<input type="number" id="read-input" value="20" min="0" max="100" onchange="setTrafficMix('READ',this.value)"
class="w-14 flex-shrink-0 px-1 py-0.5 bg-gray-800 border border-gray-600 rounded text-blue-400 text-xs text-center font-mono" />
</div>
<!-- WRITE -->
<div class="flex items-center gap-2 mb-1">
<span data-i18n="traffic_write" class="text-xs text-orange-400 truncate max-w-[6rem]">WRITE</span>
<input type="range" id="write-slider" min="0" max="100" value="15" oninput="setTrafficMix('WRITE',this.value)"
class="flex-1 min-w-0 h-1.5 bg-gray-700 rounded-lg accent-orange-500" />
<input type="number" id="write-input" value="15" min="0" max="100"
onchange="setTrafficMix('WRITE',this.value)"
class="w-14 flex-shrink-0 px-1 py-0.5 bg-gray-800 border border-gray-600 rounded text-orange-400 text-xs text-center font-mono" />
</div>
<!-- UPLOAD -->
<div class="flex items-center gap-2 mb-1">
<span data-i18n="traffic_upload" class="text-xs text-yellow-400 truncate max-w-[6rem]">UPLOAD</span>
<input type="range" id="upload-slider" min="0" max="100" value="5"
oninput="setTrafficMix('UPLOAD',this.value)"
class="flex-1 min-w-0 h-1.5 bg-gray-700 rounded-lg accent-yellow-500" />
<input type="number" id="upload-input" value="5" min="0" max="100"
onchange="setTrafficMix('UPLOAD',this.value)"
class="w-14 flex-shrink-0 px-1 py-0.5 bg-gray-800 border border-gray-600 rounded text-yellow-400 text-xs text-center font-mono" />
</div>
<!-- SEARCH -->
<div class="flex items-center gap-2 mb-1">
<span data-i18n="traffic_search" class="text-xs text-cyan-400 truncate max-w-[6rem]">SEARCH</span>
<input type="range" id="search-slider" min="0" max="100" value="10"
oninput="setTrafficMix('SEARCH',this.value)" class="flex-1 min-w-0 h-1.5 bg-gray-700 rounded-lg accent-cyan-500" />
<input type="number" id="search-input" value="10" min="0" max="100"
onchange="setTrafficMix('SEARCH',this.value)"
class="w-14 flex-shrink-0 px-1 py-0.5 bg-gray-800 border border-gray-600 rounded text-cyan-400 text-xs text-center font-mono" />
</div>
<!-- MALICIOUS -->
<div class="flex items-center gap-2">
<span data-i18n="traffic_attack" class="text-xs text-red-400 truncate max-w-[6rem]">ATTACK</span>
<input type="range" id="malicious-slider" min="0" max="100" value="20"
oninput="setTrafficMix('MALICIOUS',this.value)"
class="flex-1 min-w-0 h-1.5 bg-gray-700 rounded-lg accent-red-500" />
<input type="number" id="malicious-input" value="20" min="0" max="100"
onchange="setTrafficMix('MALICIOUS',this.value)"
class="w-14 flex-shrink-0 px-1 py-0.5 bg-gray-800 border border-gray-600 rounded text-red-400 text-xs text-center font-mono" />
</div>
</div>
<!-- BURST -->
<div class="border-t border-gray-700 pt-2">
<div class="flex items-center gap-2 mb-2">
<span data-i18n="burst_label" class="text-xs text-gray-400">Burst:</span>
<input type="number" id="burst-input" value="10" min="1" onchange="setBurstCount(this.value)"
class="w-16 px-2 py-1 bg-gray-800 border border-gray-600 rounded text-white text-xs text-center font-mono" />
</div>
<div class="flex gap-1 flex-wrap">
<button onclick="spawnBurst('STATIC')"
data-i18n="traffic_static"
class="flex-1 bg-green-900/50 hover:bg-green-800 text-green-400 text-xs py-1.5 rounded border border-green-700/50">
STATIC
</button>
<button onclick="spawnBurst('READ')"
data-i18n="traffic_read"
class="flex-1 bg-blue-900/50 hover:bg-blue-800 text-blue-400 text-xs py-1.5 rounded border border-blue-700/50">
READ
</button>
<button onclick="spawnBurst('WRITE')"
data-i18n="traffic_write"
class="flex-1 bg-orange-900/50 hover:bg-orange-800 text-orange-400 text-xs py-1.5 rounded border border-orange-700/50">
WRITE
</button>
</div>
<div class="flex gap-1 flex-wrap mt-1">
<button onclick="spawnBurst('UPLOAD')"
data-i18n="traffic_upload"
class="flex-1 bg-yellow-900/50 hover:bg-yellow-800 text-yellow-400 text-xs py-1.5 rounded border border-yellow-700/50">
UPLOAD
</button>
<button onclick="spawnBurst('SEARCH')"
data-i18n="traffic_search"
class="flex-1 bg-cyan-900/50 hover:bg-cyan-800 text-cyan-400 text-xs py-1.5 rounded border border-cyan-700/50">
SEARCH
</button>
<button onclick="spawnBurst('MALICIOUS')"
data-i18n="traffic_ddos"
class="flex-1 bg-red-900/50 hover:bg-red-800 text-red-400 text-xs py-1.5 rounded border border-red-700/50">
DDoS
</button>
</div>
</div>
</div>
<!-- Objective Panel (Bottom Left) -->
<div id="objectivesPanel" class="absolute bottom-24 left-4 glass-panel rounded-xl p-4 pointer-events-auto max-w-xs">
<div class="flex justify-between items-center mb-2">
<h3 data-i18n="current_objectives" class="text-xs font-bold text-gray-400 uppercase tracking-wider">
Current Objectives
</h3>
<span data-i18n="live"
class="text-[10px] bg-red-900/50 px-2 py-0.5 rounded text-red-400 border border-red-800 animate-pulse">LIVE</span>
</div>
<ul class="text-xs text-gray-300 space-y-2 font-mono">
<li class="flex items-center">
<span class="w-2 h-2 rounded-full bg-red-500 mr-2 animate-pulse"></span>
<span data-i18n="survive_endless">Survive Endless Traffic</span>
</li>
<li id="goal-storage" class="flex items-center">
<span class="w-2 h-2 rounded-full bg-green-500 mr-2"></span>
<span data-i18n="route_storage">Route STATIC/UPLOAD → Storage</span>
</li>
<li id="goal-db" class="flex items-center">
<span class="w-2 h-2 rounded-full bg-blue-500 mr-2"></span>
<span data-i18n="route_db">Route READ/WRITE/SEARCH → Database</span>
</li>
<li id="goal-waf" class="flex items-center">
<span class="w-2 h-2 rounded-full bg-purple-500 mr-2"></span>
<span data-i18n="block_malicious">Block MALICIOUS with Firewall</span>
</li>
</ul>
</div>
</div>
<!-- UI Overlay: Bottom Toolbar -->
<div class="absolute bottom-6 left-0 w-full z-10 pointer-events-none flex justify-center">
<div class="glass-panel rounded-2xl p-2 pointer-events-auto overflow-y-auto flex items-center gap-2 shadow-2xl">
<!-- Help Button -->
<button id="tool-help"
class="service-btn bg-gray-700 text-gray-200 p-2 rounded-lg w-16 h-16 flex flex-col items-center justify-center mr-2 border border-gray-600"
onclick="showFAQ()">
<div class="text-xl">?</div>
<span data-i18n="help" class="text-[9px] font-bold mt-1 uppercase">Help</span>
</button>
<!-- Mute Button -->
<button id="tool-mute"
class="service-btn bg-gray-700 text-gray-200 p-2 rounded-lg w-16 h-16 flex flex-col items-center justify-center border border-gray-600"
onclick="toggleMute()">
<div class="text-xl" id="mute-icon">🔊</div>
<span data-i18n="sound" class="text-[9px] font-bold mt-1 uppercase">Sound</span>
</button>
<!-- Tools -->
<div class="flex gap-1 pr-4 border-r border-gray-700">
<button id="tool-select"
class="service-btn active bg-gray-800 text-gray-200 p-2 rounded-lg w-16 h-16 flex flex-col items-center justify-center border border-transparent"
onclick="setTool('select')">
<svg class="w-6 h-6 mb-1" fill="none" stroke="currentColor" viewBox="0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M15 15l-2 5L9 9l11 4-5 2zm0 0l5 5M7.188 2.239l.777 2.897M5.136 7.965l-2.898-.777M13.95 4.05l-2.122 2.122m-5.657 5.656l-2.12 2.122">
</path>
</svg>
<span data-i18n="select" class="text-[10px] uppercase">Select</span>
</button>
<button id="tool-connect"
class="service-btn bg-gray-800 text-gray-200 p-2 rounded-lg w-16 h-16 flex flex-col items-center justify-center border border-transparent"
onclick="setTool('connect')">
<svg class="w-6 h-6 mb-1" fill="none" stroke="currentColor" viewBox="0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1">
</path>
</svg>
<span data-i18n="link" class="text-[10px] uppercase">Link</span>
</button>
<button id="tool-delete"
class="service-btn bg-red-900/30 text-red-200 p-2 rounded-lg w-16 h-16 flex flex-col items-center justify-center border border-transparent hover:bg-red-900/50"
onclick="setTool('delete')">
<svg class="w-6 h-6 mb-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16">
</path>
</svg>
<span data-i18n="demolish" class="text-[10px] uppercase">Demolish</span>
</button>
<button id="tool-unlink"
class="service-btn bg-orange-900/30 text-orange-200 p-2 rounded-lg w-16 h-16 flex flex-col items-center justify-center border border-transparent hover:bg-orange-900/50"
onclick="setTool('unlink')">
<svg class="w-6 h-6 mb-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"></path>
</svg>
<span data-i18n="unlink" class="text-[10px] uppercase">Unlink</span>
</button>
</div>
<!-- Shop -->
<div class="flex gap-2 pl-2">
<!-- WAF -->
<button id="tool-waf"
class="service-btn bg-gray-800 text-gray-200 p-2 rounded-lg w-16 h-16 flex flex-col items-center justify-center border border-transparent group relative overflow-hidden"
onclick="setTool('waf')">
<div class="absolute top-0 right-0 bg-green-900/80 text-green-400 text-[9px] px-1 rounded-bl font-mono">
$40
</div>
<div class="w-4 h-4 bg-purple-500 rounded-sm mb-1 shadow-[0_0_10px_rgba(168,85,247,0.6)]"></div>
<span data-i18n="fw" class="text-[10px] font-bold mt-1">FW</span>
</button>
<!-- API Gateway -->
<button id="tool-apigw"
class="service-btn bg-gray-800 text-gray-200 p-2 rounded-lg w-16 h-16 flex flex-col items-center justify-center border border-transparent group relative overflow-hidden"
onclick="setTool('apigw')">
<div class="absolute top-0 right-0 bg-green-900/80 text-green-400 text-[9px] px-1 rounded-bl font-mono">
$70
</div>
<div class="w-4 h-4 bg-fuchsia-400 rounded-sm mb-1 shadow-[0_0_10px_rgba(232,121,249,0.6)]" style="transform: rotate(45deg)"></div>
<span data-i18n="apigw_short" class="text-[10px] font-bold mt-1">API GW</span>
</button>
<!-- SQS -->
<button id="tool-sqs"
class="service-btn bg-gray-800 text-gray-200 p-2 rounded-lg w-16 h-16 flex flex-col items-center justify-center border border-transparent group relative overflow-hidden"
onclick="setTool('sqs')">
<div class="absolute top-0 right-0 bg-green-900/80 text-green-400 text-[9px] px-1 rounded-bl font-mono">
$45
</div>
<div class="w-5 h-3 bg-orange-500 rounded-sm mb-1 shadow-[0_0_10px_rgba(255,153,0,0.6)]"></div>
<span data-i18n="queue" class="text-[10px] font-bold mt-1">Queue</span>
</button>
<button id="tool-alb"
class="service-btn bg-gray-800 text-gray-200 p-2 rounded-lg w-16 h-16 flex flex-col items-center justify-center border border-transparent group relative overflow-hidden"
onclick="setTool('alb')">
<div class="absolute top-0 right-0 bg-green-900/80 text-green-400 text-[9px] px-1 rounded-bl font-mono">
$50
</div>
<div class="w-4 h-4 bg-blue-500 rounded-sm mb-1 shadow-[0_0_10px_rgba(59,130,246,0.6)]"></div>
<span data-i18n="lb" class="text-[10px] font-bold mt-1">LB</span>
</button>
<button id="tool-lambda"
class="service-btn bg-gray-800 text-gray-200 p-2 rounded-lg w-16 h-16 flex flex-col items-center justify-center border border-transparent group relative overflow-hidden"
onclick="setTool('lambda')">
<div class="absolute top-0 right-0 bg-green-900/80 text-green-400 text-[9px] px-1 rounded-bl font-mono">
$60
</div>
<div class="w-4 h-4 bg-orange-500 rounded-full mb-1 shadow-[0_0_10px_rgba(249,115,22,0.6)]"></div>
<span data-i18n="compute_short" class="text-[10px] font-bold mt-1">Compute</span>
</button>
<!-- Serverless Function -->
<button id="tool-serverless"
class="service-btn bg-gray-800 text-gray-200 p-2 rounded-lg w-16 h-16 flex flex-col items-center justify-center border border-transparent group relative overflow-hidden"
onclick="setTool('serverless')">
<div class="absolute top-0 right-0 bg-green-900/80 text-green-400 text-[9px] px-1 rounded-bl font-mono">
$45
</div>
<div class="w-0 h-0 border-l-[8px] border-l-transparent border-r-[8px] border-r-transparent border-b-[14px] border-b-amber-400 mb-1 shadow-[0_0_10px_rgba(251,191,36,0.6)]"></div>
<span data-i18n="serverless_short" class="text-[10px] font-bold mt-1">λ Func</span>
</button>
<button id="tool-db"
class="service-btn bg-gray-800 text-gray-200 p-2 rounded-lg w-16 h-16 flex flex-col items-center justify-center border border-transparent group relative overflow-hidden"
onclick="setTool('db')">
<div class="absolute top-0 right-0 bg-green-900/80 text-green-400 text-[9px] px-1 rounded-bl font-mono">
$150
</div>
<div
class="w-4 h-4 bg-red-600 rounded-sm mb-1 shadow-[0_0_10px_rgba(220,38,38,0.6)] border-b-2 border-red-800">
</div>
<span data-i18n="db_short" class="text-[10px] font-bold mt-1">SQL DB</span>
</button>
<!-- NoSQL DB -->
<button id="tool-nosql"
class="service-btn bg-gray-800 text-gray-200 p-2 rounded-lg w-16 h-16 flex flex-col items-center justify-center border border-transparent group relative overflow-hidden"
onclick="setTool('nosql')">
<div class="absolute top-0 right-0 bg-green-900/80 text-green-400 text-[9px] px-1 rounded-bl font-mono">
$80
</div>
<div
class="w-4 h-4 bg-violet-600 rounded-full mb-1 shadow-[0_0_10px_rgba(124,58,237,0.6)] border-b-2 border-violet-800">
</div>
<span data-i18n="nosql_short" class="text-[10px] font-bold mt-1">NoSQL</span>
</button>
<!-- Cache -->
<button id="tool-cache"
class="service-btn bg-gray-800 text-gray-200 p-2 rounded-lg w-16 h-16 flex flex-col items-center justify-center border border-transparent group relative overflow-hidden"
onclick="setTool('cache')">
<div class="absolute top-0 right-0 bg-green-900/80 text-green-400 text-[9px] px-1 rounded-bl font-mono">
$60
</div>
<div class="w-4 h-4 bg-red-600 rounded mb-1 shadow-[0_0_10px_rgba(220,56,45,0.6)]"></div>
<span data-i18n="cache_short" class="text-[10px] font-bold mt-1">Cache</span>
</button>
<!-- CDN -->
<button id="tool-cdn"
class="service-btn bg-gray-800 text-gray-200 p-2 rounded-lg w-16 h-16 flex flex-col items-center justify-center border border-transparent group relative overflow-hidden"
onclick="setTool('cdn')">
<div class="absolute top-0 right-0 bg-green-900/80 text-green-400 text-[9px] px-1 rounded-bl font-mono">
$60
</div>
<div
class="w-4 h-4 bg-green-400 rounded-full mb-1 shadow-[0_0_10px_rgba(74,222,128,0.6)] border border-white">
</div>
<span data-i18n="cdn_short" class="text-[10px] font-bold mt-1">CDN</span>
</button>
<!-- S3 -->
<button id="tool-s3"
class="service-btn bg-gray-800 text-gray-200 p-2 rounded-lg w-16 h-16 flex flex-col items-center justify-center border border-transparent group relative overflow-hidden"
onclick="setTool('s3')">
<div class="absolute top-0 right-0 bg-green-900/80 text-green-400 text-[9px] px-1 rounded-bl font-mono">
$25
</div>
<div class="w-4 h-4 bg-emerald-500 rounded-full mb-1 shadow-[0_0_10px_rgba(16,185,129,0.6)]"></div>
<span data-i18n="storage_short" class="text-[10px] font-bold mt-1">Storage</span>
</button>
<!-- Search Engine -->
<button id="tool-search"
class="service-btn bg-gray-800 text-gray-200 p-2 rounded-lg w-16 h-16 flex flex-col items-center justify-center border border-transparent group relative overflow-hidden"
onclick="setTool('search')">
<div class="absolute top-0 right-0 bg-green-900/80 text-green-400 text-[9px] px-1 rounded-bl font-mono">
$120
</div>
<div
class="w-4 h-4 bg-cyan-500 rounded-sm mb-1 shadow-[0_0_10px_rgba(6,182,212,0.6)]" style="transform: rotate(22deg)">
</div>
<span data-i18n="search_short" class="text-[10px] font-bold mt-1">Search</span>
</button>
<!-- Read Replica -->
<button id="tool-replica"
class="service-btn bg-gray-800 text-gray-200 p-2 rounded-lg w-16 h-16 flex flex-col items-center justify-center border border-transparent group relative overflow-hidden"
onclick="setTool('replica')">
<div class="absolute top-0 right-0 bg-green-900/80 text-green-400 text-[9px] px-1 rounded-bl font-mono">
$100
</div>
<div
class="w-4 h-4 bg-pink-400 rounded-sm mb-1 shadow-[0_0_10px_rgba(244,114,182,0.6)] border-b-2 border-pink-600">
</div>
<span data-i18n="replica_short" class="text-[10px] font-bold mt-1">Replica</span>
</button>
</div>
</div>
</div>
<!-- Hover Tooltip -->
<div id="tooltip" class="tooltip"></div>
<!-- Upgrade Indicator -->
<div id="upgrade-indicator"
class="hidden absolute z-30 pointer-events-auto cursor-pointer flex flex-col items-center transform -translate-x-1/2 -translate-y-full transition-transform hover:scale-110">
<div class="text-2xl animate-bounce">⬆️</div>
<div id="upgrade-cost"
class="bg-green-600 text-white text-xs px-2 py-1 rounded font-bold font-mono shadow-lg border border-green-400 mt-1">
$100
</div>
</div>
<!-- Game Canvas -->
<div id="canvas-container"></div>
<!-- End/Next Level Modal -->
<div id="modal"
class="hidden fixed inset-0 bg-black bg-opacity-90 z-50 flex items-center justify-center backdrop-blur-sm">
<div class="glass-panel p-8 rounded-2xl text-center max-w-md border border-gray-600">
<h2 id="modal-title" data-i18n="system_failure" class="text-4xl font-bold mb-4 text-white font-mono tracking-tighter">
SYSTEM FAILURE
</h2>
<div class="h-px w-full bg-gray-700 mb-6"></div>
<p id="modal-desc" data-i18n="infra_collapsed" class="text-gray-300 mb-8 text-sm leading-relaxed">
Infrastructure collapsed.
</p>
<div class="flex justify-center gap-4">
<button onclick="retryWithSameArchitecture()"
data-i18n="retry_same"
class="bg-green-600 hover:bg-green-500 text-white font-bold py-3 px-8 rounded-lg shadow-lg transform transition hover:scale-105 font-mono uppercase text-sm">
Retry Same Setup
</button>
<button onclick="restartGame()"
data-i18n="start_fresh"
class="bg-blue-600 hover:bg-blue-500 text-white font-bold py-3 px-8 rounded-lg shadow-lg transform transition hover:scale-105 font-mono uppercase text-sm">
Start Fresh
</button>
</div>
</div>
</div>
<!-- Main Menu Modal -->
<div id="main-menu-modal" class="absolute inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm">
<div
class="relative bg-gray-900/90 p-12 rounded-2xl border border-blue-500/30 shadow-2xl max-w-md w-full text-center">
<!-- Menu Mute Button -->
<button id="menu-mute-btn" onclick="toggleMute()"
class="absolute top-4 right-4 text-gray-400 hover:text-white transition p-2 rounded-full pulse-green">
<span id="menu-mute-icon" class="text-xl">🔇</span>
</button>
<h1
data-i18n="title"
class="text-6xl font-black text-transparent bg-clip-text bg-gradient-to-r from-blue-400 to-cyan-300 mb-2 tracking-tighter filter drop-shadow-[0_0_10px_rgba(59,130,246,0.5)]">
SERVER<br />SURVIVAL
</h1>
<div class="space-y-4">
<button id="resume-btn" onclick="resumeGame()"
data-i18n="resume_game"
class="hidden w-full bg-blue-600 hover:bg-blue-500 text-white font-bold py-4 px-8 rounded-lg shadow-lg transform transition hover:scale-105 font-mono uppercase text-lg border border-blue-400/50">
Resume Game
</button>
<button onclick="startGame()"
data-i18n="start_survival"
class="w-full bg-green-600 hover:bg-green-500 text-white font-bold py-4 px-8 rounded-lg shadow-lg transform transition hover:scale-105 font-mono uppercase text-lg border border-green-400/50">
Start Survival
</button>
<button onclick="openCampaignSelect()"
class="w-full bg-yellow-600 hover:bg-yellow-500 text-white font-bold py-4 px-8 rounded-lg shadow-lg transform transition hover:scale-105 font-mono uppercase text-lg border border-yellow-400/50 flex justify-between items-center">
<span data-i18n="campaign_mode">Campaign</span>
<span id="campaign-progress-label" class="text-xs opacity-75 font-normal">0/14 ★0</span>
</button>
<button onclick="startSandbox()"
data-i18n="sandbox_mode"
class="w-full bg-purple-600 hover:bg-purple-500 text-white font-bold py-4 px-8 rounded-lg shadow-lg transform transition hover:scale-105 font-mono uppercase text-lg border border-purple-400/50">
Sandbox Mode
</button>
<button onclick="document.getElementById('upload-file-input')?.click()" id="upload-btn"
data-i18n="upload_game"
class="w-full bg-blue-400 hover:bg-blue-300 text-black font-bold py-4 px-8 rounded-lg shadow-lg transform transition hover:scale-105 font-mono uppercase text-lg border border-cyan-400/50">
Upload Game
</button>
<button onclick="onClickContinueGame()" id="load-btn"
data-i18n="continue_game"
class="w-full bg-cyan-600 hover:bg-cyan-500 text-white font-bold py-4 px-8 rounded-lg shadow-lg transform transition hover:scale-105 font-mono uppercase text-lg border border-cyan-400/50">
Continue Game
</button>
<button onclick="showFAQ()"
data-i18n="manual_faq"
class="w-full bg-gray-800 hover:bg-gray-700 text-gray-300 font-bold py-3 px-8 rounded-lg border border-gray-600 transition hover:text-white font-mono uppercase">
Manual / FAQ
</button>
<input type="file" id="upload-file-input" accept=".json" class="hidden" onchange="onSaveGameFileUpload(event)" />
</div>
<div class="mt-8 text-xs text-gray-500 font-mono"></div>
</div>
</div>
<!-- Save Game Modal -->
<div id="save-modal" class="absolute inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm hidden">
<div
class="relative bg-gray-900/90 p-12 rounded-2xl border border-blue-500/30 shadow-2xl max-w-md w-full text-center">
<h1
data-i18n="save_title"
class="text-6xl font-black text-transparent bg-clip-text bg-gradient-to-r from-blue-400 to-cyan-300 mb-2 tracking-tighter filter drop-shadow-[0_0_10px_rgba(59,130,246,0.5)]">
Save Game
</h1>
<div class="space-y-4">
<button onclick="saveGameState('browser')"
data-i18n="save_browser"
class="w-full bg-green-600 hover:bg-green-500 text-white font-bold py-4 px-8 rounded-lg shadow-lg transform transition hover:scale-105 font-mono uppercase text-lg border border-green-400/50">
Save in Browser
</button>
<button onclick="saveGameState('file')" id="btn-download-save"
data-i18n="save_download"
class="w-full bg-purple-600 hover:bg-purple-500 text-white font-bold py-4 px-8 rounded-lg shadow-lg transform transition hover:scale-105 font-mono uppercase text-lg border border-purple-400/50">
Download Save File
</button>
<button onclick="closeSaveModal()"
data-i18n="cancel"
class="w-full bg-gray-800 hover:bg-gray-700 text-gray-300 font-bold py-3 px-8 rounded-lg border border-gray-600 transition hover:text-white font-mono uppercase">
Cancel
</button>
</div>
<div class="mt-8 text-xs text-gray-500 font-mono"></div>
</div>
</div>
<!-- Tutorial Modal (no backdrop - allows interaction with game) -->
<div id="tutorial-modal" class="fixed inset-0 z-[60] pointer-events-none hidden">
<!-- Tutorial popup -->
<div id="tutorial-popup"
class="absolute glass-panel rounded-xl p-6 max-w-xl pointer-events-auto border-2 border-cyan-500/50 shadow-[0_0_30px_rgba(6,182,212,0.3)]">
<div class="flex items-center gap-3 mb-4">
<div id="tutorial-icon"
class="w-12 h-12 rounded-lg flex items-center justify-center text-2xl bg-cyan-900/50 border border-cyan-500/30">
</div>
<div>
<h3 id="tutorial-title" class="text-lg font-bold text-white"></h3>
<div id="tutorial-step-container" class="text-xs text-gray-400">
Step <span id="tutorial-step-num">1</span> of
<span id="tutorial-total-steps">10</span>
</div>
</div>
</div>
<p id="tutorial-text" class="text-gray-300 text-sm leading-relaxed mb-4"></p>
<div id="tutorial-hint" class="bg-gray-800/50 rounded-lg p-3 mb-4 border border-gray-700 hidden">
<div class="flex items-start gap-2">
<span class="text-yellow-400">💡</span>
<p id="tutorial-hint-text" class="text-xs text-gray-400"></p>
</div>
</div>
<div class="flex justify-between items-center">
<button id="tutorial-skip" class="text-gray-500 hover:text-gray-300 text-sm transition"
data-i18n="skip_tutorial"
onclick="window.tutorial?.skip()">
Skip Tutorial
</button>
<div class="flex gap-2">
<button id="tutorial-next"
data-i18n="next"
class="bg-cyan-600 hover:bg-cyan-500 text-white font-bold py-2 px-6 rounded-lg transition hidden">
Next
</button>
</div>
</div>
<!-- Progress dots -->
<div id="tutorial-progress" class="flex justify-center gap-1.5 mt-4 pt-3 border-t border-gray-700"></div>
</div>
<!-- Highlight ring for elements -->
<div id="tutorial-highlight"
class="absolute pointer-events-none border-2 border-cyan-400 rounded-xl shadow-[0_0_20px_rgba(6,182,212,0.5)] hidden"
style="transition: all 0.3s ease"></div>
</div>
<!-- FAQ Modal -->
<div id="faq-modal" class="fixed inset-0 bg-black/95 flex items-center justify-center z-50 hidden">
<div class="glass-panel p-8 rounded-2xl max-w-4xl w-full max-h-[90vh] overflow-y-auto border border-gray-700">
<div class="flex justify-between items-center mb-6 border-b border-gray-700 pb-4">
<h2 data-i18n="operator_manual" class="text-2xl font-bold text-white">OPERATOR MANUAL</h2>
<button onclick="closeFAQ()" class="text-gray-400 hover:text-white">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
</button>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-8">
<!-- Traffic Types -->
<div>
<h3 data-i18n="traffic_types" class="text-lg font-bold text-blue-400 mb-4">TRAFFIC TYPES</h3>
<div class="space-y-3">
<div class="bg-gray-800/50 p-3 rounded border border-green-900/50">
<strong data-i18n="traffic_static_full" class="text-green-400">STATIC (GET)</strong>
<p data-i18n="traffic_static_desc" class="text-sm text-gray-400">
Images, CSS, JS. Route to
<span class="text-emerald-400">Storage</span>. 90% cache hit
rate.
</p>
</div>
<div class="bg-gray-800/50 p-3 rounded border border-blue-900/50">
<strong data-i18n="traffic_read_full" class="text-blue-400">READ (GET)</strong>
<p data-i18n="traffic_read_desc" class="text-sm text-gray-400">
API data fetch. Route to
<span class="text-red-400">SQL DB</span>. 40% cache hit rate.
</p>
</div>
<div class="bg-gray-800/50 p-3 rounded border border-orange-900/50">
<strong data-i18n="traffic_write_full" class="text-orange-400">WRITE (POST/PUT)</strong>
<p data-i18n="traffic_write_desc" class="text-sm text-gray-400">
Database writes. Route to
<span class="text-red-400">SQL DB</span>. Never cached.
</p>
</div>
<div class="bg-gray-800/50 p-3 rounded border border-yellow-900/50">
<strong data-i18n="traffic_upload_full" class="text-yellow-400">UPLOAD (POST)</strong>
<p data-i18n="traffic_upload_desc" class="text-sm text-gray-400">
File uploads. Route to
<span class="text-emerald-400">Storage</span>. Never cached.
Heavy processing.
</p>
</div>
<div class="bg-gray-800/50 p-3 rounded border border-cyan-900/50">
<strong data-i18n="traffic_search_full" class="text-cyan-400">SEARCH (GET)</strong>
<p data-i18n="traffic_search_desc" class="text-sm text-gray-400">
Complex queries. Route to
<span class="text-red-400">SQL DB</span>. 15% cache hit. Heavy
processing.
</p>
</div>
<div class="bg-gray-800/50 p-3 rounded border border-red-900/50">
<strong data-i18n="traffic_malicious" class="text-red-400">MALICIOUS</strong>
<p data-i18n="traffic_malicious_desc" class="text-sm text-gray-400">
DDoS & attacks. Block with
<span class="text-purple-400">Firewall</span>.
</p>
</div>
</div>
</div>
<!-- Services -->
<div>
<h3 data-i18n="services" class="text-lg font-bold text-blue-400 mb-4">SERVICES</h3>
<ul class="space-y-2 text-sm text-gray-300">
<li class="flex justify-between">
<span data-i18n="firewall" class="text-purple-400 font-bold">Firewall</span>
<span data-i18n="fw_desc_short">Blocks Fraud ($40)</span>
</li>
<li class="flex justify-between">
<span data-i18n="message_queue" class="text-orange-500 font-bold">Message Queue</span>
<span data-i18n="queue_desc_short">Buffers 200 requests ($35)</span>
</li>
<li class="flex justify-between">
<span data-i18n="load_balancer" class="text-blue-400 font-bold">Load Balancer</span>
<span data-i18n="lb_desc_short">Distributes Traffic ($50)</span>
</li>
<li class="flex justify-between">