Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
2070 lines (1844 loc) · 61.8 KB
/
Copy pathindex.html
File metadata and controls
2070 lines (1844 loc) · 61.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">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
<title>Earth Station</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@600;700&display=swap" rel="stylesheet">
<!-- CrazyGames HTML5 SDK v2 — loads and initializes itself, no init() call needed -->
<style>
/* ============================================================
RESET & BASE
============================================================ */
* {
box-sizing: border-box;
margin: 0;
padding: 0;
-webkit-tap-highlight-color: transparent;
user-select: none;
-webkit-user-select: none;
}
:root {
--font-display: "Sora", -apple-system, BlinkMacSystemFont, sans-serif;
--font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
--font-mono: "JetBrains Mono", ui-monospace, monospace;
--c-cyan: #00dbe9;
--c-gold: #e9c400;
--c-violet: #a663cc;
--c-magenta: #f72585;
}
html, body {
height: 100%;
overflow: hidden;
overscroll-behavior: none;
background: radial-gradient(ellipse at top, #16213e 0%, #0d0d1f 55%, #08081a 100%);
font-family: var(--font-body);
color: #e2e0fb;
}
/* twinkling starfield backdrop, pure CSS, zero asset loading */
body::before,
body::after {
content: "";
position: fixed;
inset: 0;
pointer-events: none;
z-index: 0;
}
body::before {
background-image:
radial-gradient(1.5px 1.5px at 20% 30%, #fff 100%, transparent),
radial-gradient(1.5px 1.5px at 70% 60%, #fff 100%, transparent),
radial-gradient(1px 1px at 40% 80%, #fff 100%, transparent),
radial-gradient(1px 1px at 85% 15%, #fff 100%, transparent),
radial-gradient(1.5px 1.5px at 55% 45%, #fff 100%, transparent),
radial-gradient(1px 1px at 10% 65%, #fff 100%, transparent),
radial-gradient(1px 1px at 90% 85%, #fff 100%, transparent),
radial-gradient(1px 1px at 30% 10%, #fff 100%, transparent),
radial-gradient(1px 1px at 65% 92%, #fff 100%, transparent),
radial-gradient(1.5px 1.5px at 5% 45%, #fff 100%, transparent);
background-size: 100% 100%;
opacity: 0.5;
animation: twinkleA 5s ease-in-out infinite;
}
body::after {
background-image:
radial-gradient(1px 1px at 15% 50%, #a8e8ff 100%, transparent),
radial-gradient(1px 1px at 50% 25%, #d7cfff 100%, transparent),
radial-gradient(1px 1px at 78% 70%, #a8e8ff 100%, transparent),
radial-gradient(1.2px 1.2px at 92% 40%, #d7cfff 100%, transparent);
background-size: 100% 100%;
opacity: 0.35;
animation: twinkleB 7s ease-in-out infinite;
}
@keyframes twinkleA {
0%, 100% { opacity: 0.35; }
50% { opacity: 0.65; }
}
@keyframes twinkleB {
0%, 100% { opacity: 0.2; }
50% { opacity: 0.5; }
}
#app {
position: relative;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 6px;
padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right))
max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
overflow-y: auto;
z-index: 1;
touch-action: manipulation;
--board-max: min(570px, calc(100vh - 300px));
}
@supports (height: 100dvh) {
#app {
--board-max: min(570px, calc(100dvh - 300px));
}
}
/* ============================================================
TOP HEADER — fixed app bar: ★ planet-station title left,
coins + shop cart right. Sits above the board, not overlaid
on it, matching the reference "TopAppBar" layout.
============================================================ */
#topHeader {
width: 100%;
max-width: 520px;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: space-between;
gap: 6px;
padding: 4px 8px;
background: linear-gradient(180deg, rgba(24, 24, 46, 0.7), rgba(12, 12, 31, 0.65));
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border: 1px solid rgba(0, 219, 233, 0.2);
border-radius: 12px;
box-shadow: 0 0 12px rgba(0, 219, 233, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.header-brand {
display: flex;
align-items: center;
gap: 4px;
font-family: var(--font-display);
font-size: clamp(11px, 3vw, 14px);
font-weight: 700;
color: #00dbe9;
letter-spacing: 0.01em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.header-star {
color: #00dbe9;
text-shadow: 0 0 8px rgba(0, 219, 233, 0.7);
flex-shrink: 0;
font-size: 0.85em;
}
.header-right {
display: flex;
align-items: center;
gap: 6px;
flex-shrink: 0;
}
.coin-pill-header {
display: flex;
align-items: center;
gap: 5px;
background: linear-gradient(180deg, rgba(46, 40, 20, 0.6), rgba(26, 26, 45, 0.6));
border: 1px solid rgba(233, 196, 0, 0.35);
border-radius: 999px;
padding: 3px 9px 3px 4px;
color: #ffd93d;
font-family: var(--font-mono);
font-weight: 700;
font-size: clamp(10px, 2.6vw, 12px);
cursor: pointer;
touch-action: manipulation;
transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.coin-pill-header.pulse {
animation: coinPulse 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes coinPulse {
0% { transform: scale(1); }
40% { transform: scale(1.22); box-shadow: 0 0 18px rgba(233, 196, 0, 0.6); }
100% { transform: scale(1); }
}
.coin-dot {
display: inline-flex;
align-items: center;
justify-content: center;
width: 14px;
height: 14px;
border-radius: 50%;
background: radial-gradient(circle at 35% 30%, #fff3b0, #e9c400 60%, #a17d00 100%);
box-shadow: 0 0 5px rgba(233, 196, 0, 0.6);
font-size: 9px;
font-weight: 800;
color: #2b2100;
}
.cart-btn {
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: transparent;
border: none;
color: #b9cacb;
cursor: pointer;
touch-action: manipulation;
transition: background 0.15s ease, transform 0.15s ease, color 0.15s ease;
}
.cart-btn svg {
width: 15px;
height: 15px;
}
.cart-btn:active {
transform: scale(0.9);
background: rgba(0, 219, 233, 0.12);
color: #00dbe9;
}
/* ============================================================
STATS ROW — score chip left, level + progress chip right
============================================================ */
#statsRow {
width: 100%;
max-width: 520px;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: space-between;
gap: 6px;
padding: 0 2px;
}
.stat-chip {
background: rgba(26, 26, 45, 0.6);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border: 1px solid rgba(0, 219, 233, 0.14);
border-radius: 9px;
padding: 3px 9px;
display: flex;
align-items: center;
gap: 4px;
font-family: var(--font-mono);
font-size: clamp(10px, 2.6vw, 12px);
font-weight: 700;
color: #e2e0fb;
}
.score-chip {
color: #00dbe9;
}
.level-chip {
background: rgba(26, 26, 45, 0.6);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border: 1px solid rgba(0, 219, 233, 0.14);
border-radius: 9px;
padding: 3px 13px 4px;
min-width: 92px;
display: flex;
flex-direction: column;
align-items: center;
}
.level-chip-label {
font-size: 7px;
font-weight: 600;
letter-spacing: 0.1em;
color: #b9cacb;
}
.level-chip-value {
font-family: var(--font-mono);
font-size: clamp(12px, 3.2vw, 14px);
font-weight: 700;
color: #00dbe9;
white-space: nowrap;
}
.level-progress-track {
margin-top: 4px;
width: 100%;
min-width: 90px;
height: 4px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.1);
overflow: hidden;
}
.level-progress-fill {
height: 100%;
width: 0%;
border-radius: 999px;
background: #00dbe9;
box-shadow: 0 0 8px rgba(0, 219, 233, 0.7);
transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.coin-chip {
background: rgba(233, 196, 0, 0.12);
backdrop-filter: blur(6px);
-webkit-backdrop-filter: blur(6px);
border: 1px solid rgba(233, 196, 0, 0.35);
color: #e9c400;
font-weight: 800;
font-size: clamp(13px, 3.2vw, 16px);
padding: 7px 12px;
border-radius: 999px;
white-space: nowrap;
}
.coin-chip.big {
font-size: 22px;
padding: 8px 20px;
}
/* ============================================================
BOARD
============================================================ */
#boardWrap {
position: relative;
width: min(100%, var(--board-max));
aspect-ratio: 1 / 1;
margin: 0 auto;
flex-shrink: 0;
}
/* premium bezel: a slow-turning aurora halo sitting just behind the
board, visible only as a soft glow past the canvas' rounded corners */
#boardWrap::before {
content: "";
position: absolute;
inset: -3px;
border-radius: 26px;
background: conic-gradient(from 0deg, var(--c-cyan), var(--c-violet), var(--c-gold), var(--c-magenta), var(--c-cyan));
filter: blur(14px);
opacity: 0.35;
z-index: -1;
animation: bezelTurn 14s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
#boardWrap::before { animation: none; }
}
@keyframes bezelTurn {
to { transform: rotate(360deg); }
}
#boardCanvas {
width: 100%;
height: 100%;
display: block;
border-radius: 22px;
box-shadow:
0 14px 44px rgba(0, 0, 0, 0.55),
0 0 0 1px rgba(0, 219, 233, 0.25),
0 0 40px rgba(0, 219, 233, 0.22);
touch-action: none;
}
/* toast for "new tier reached" */
#toast {
position: absolute;
top: -8px;
left: 50%;
transform: translate(-50%, -90%) scale(0.9);
background: rgba(20, 10, 50, 0.92);
backdrop-filter: blur(6px);
-webkit-backdrop-filter: blur(6px);
border: 1px solid rgba(255, 255, 255, 0.2);
padding: 8px 18px;
border-radius: 999px;
font-weight: 700;
font-size: 14px;
white-space: nowrap;
opacity: 0;
pointer-events: none;
transition: opacity 0.25s ease, transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
z-index: 3;
}
#toast.show {
opacity: 1;
transform: translate(-50%, -130%) scale(1);
}
/* ============================================================
BOTTOM NAV — Undo / Shuffle / Audio. Undo & Audio are stacked
icon-over-label buttons; Shuffle sits in the middle as a
highlighted, "currently important" pill — same asymmetry as
the reference bottom nav.
============================================================ */
#controls {
width: 100%;
max-width: 520px;
display: flex;
align-items: center;
justify-content: space-around;
gap: 6px;
flex-shrink: 0;
padding: 5px 12px max(5px, env(safe-area-inset-bottom));
background: linear-gradient(180deg, rgba(28, 28, 48, 0.75), rgba(20, 20, 36, 0.75));
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
border: 1px solid rgba(0, 219, 233, 0.12);
border-radius: 14px;
box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.nav-btn {
background: transparent;
border: none;
display: flex;
flex-direction: column;
align-items: center;
gap: 2px;
color: #b9cacb;
font-weight: 600;
cursor: pointer;
touch-action: manipulation;
transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.15s ease;
}
.nav-btn:active {
transform: scale(0.9);
}
.nav-btn:disabled {
opacity: 0.35;
cursor: default;
}
.nav-btn-icon {
width: 28px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
border-radius: 9px;
background: rgba(26, 26, 45, 0.6);
border: 1px solid rgba(0, 219, 233, 0.14);
}
.nav-btn-label {
font-size: 8px;
}
/* Shuffle — the highlighted center pill */
.nav-btn-primary {
flex-direction: row;
gap: 5px;
padding: 5px 12px;
border-radius: 999px;
background: rgba(0, 219, 233, 0.18);
border: 1px solid rgba(0, 219, 233, 0.4);
box-shadow: 0 0 10px rgba(0, 219, 233, 0.3);
color: #00dbe9;
}
.nav-btn-primary .nav-btn-icon {
width: auto;
height: auto;
background: none;
border: none;
font-size: 11px;
}
.nav-btn-primary .nav-btn-label {
font-size: 10px;
font-weight: 700;
}
/* short viewports (small/older phones, landscape phones): trim
spacing and shrink the D-pad so nothing gets cut off below the fold */
@media (max-height: 720px) {
#app { gap: 4px; }
#dpad { transform: scale(0.85); margin: -5px 0; }
}
@media (max-height: 620px) {
#app { gap: 3px; }
#dpad { transform: scale(0.65); margin: -16px 0; }
#topHeader { padding: 3px 8px; }
.level-chip, #controls { padding-top: 2px; padding-bottom: 2px; }
}
/* ============================================================
D-PAD — on-screen arrow buttons for mobile play, alongside
swipe and keyboard controls (all three call the same move()).
============================================================ */
#dpad {
display: grid;
grid-template-columns: repeat(3, minmax(32px, 40px));
grid-template-rows: repeat(3, minmax(32px, 40px));
grid-template-areas:
". up ."
"left . right"
". down .";
gap: 5px;
flex-shrink: 0;
}
.dpad-btn {
background: rgba(26, 26, 45, 0.6);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border: 1px solid rgba(0, 219, 233, 0.22);
color: #00dbe9;
border-radius: 11px;
font-size: 13px;
font-weight: 700;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
touch-action: manipulation;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.12s ease, box-shadow 0.12s ease;
}
.dpad-btn:active {
transform: scale(0.88);
background: rgba(0, 219, 233, 0.22);
box-shadow: 0 0 20px rgba(0, 219, 233, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.dpad-up { grid-area: up; }
.dpad-down { grid-area: down; }
.dpad-left { grid-area: left; }
.dpad-right { grid-area: right; }
@media (hover: hover) and (pointer: fine) {
.dpad-btn:hover {
background: rgba(0, 219, 233, 0.14);
box-shadow: 0 4px 14px rgba(0, 219, 233, 0.3);
}
}
/* ============================================================
OVERLAYS
============================================================ */
.overlay {
position: fixed;
inset: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
gap: 14px;
background: rgba(8, 4, 24, 0.92);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
text-align: center;
padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
padding-top: max(15vh, 24px, env(safe-area-inset-top));
overflow-y: auto;
z-index: 20;
animation: overlayIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes overlayIn {
from { opacity: 0; transform: scale(0.96); }
to { opacity: 1; transform: scale(1); }
}
/* Menu is lighter than other overlays — the board stays visible behind it
so "Play" feels like entering gameplay, not leaving a separate screen. */
#menuScreen {
background: rgba(8, 4, 24, 0.55);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
justify-content: center;
}
.quick-guide {
display: flex;
flex-direction: column;
gap: 8px;
margin: 4px 0 6px;
}
.quick-guide-row {
display: flex;
align-items: center;
gap: 10px;
font-size: 14px;
color: #d7cfff;
background: rgba(0, 219, 233, 0.08);
border: 1px solid rgba(0, 219, 233, 0.16);
border-radius: 12px;
padding: 8px 16px;
}
.title {
font-family: var(--font-display);
font-size: clamp(28px, 7vw, 44px);
font-weight: 800;
letter-spacing: -0.01em;
background: linear-gradient(135deg, #a663cc, #4cc9f0, #f72585, #a663cc);
background-size: 250% auto;
-webkit-background-clip: text;
background-clip: text;
color: transparent;
text-shadow: 0 0 34px rgba(166, 99, 204, 0.45);
animation: titleShimmer 6s ease-in-out infinite;
}
@keyframes titleShimmer {
0%, 100% { background-position: 0% center; }
50% { background-position: 100% center; }
}
.subtitle {
font-size: clamp(13px, 3vw, 16px);
color: #d7cfff;
max-width: 320px;
line-height: 1.5;
}
.guide-list {
display: flex;
flex-direction: column;
gap: 10px;
max-width: 340px;
}
.guide-list p {
font-size: clamp(13px, 3vw, 15px);
color: #d7cfff;
line-height: 1.4;
text-align: left;
background: rgba(255, 255, 255, 0.06);
border-radius: 12px;
padding: 8px 12px;
}
.btn {
position: relative;
border: 1px solid rgba(255, 255, 255, 0.25);
border-radius: 999px;
padding: 16px 40px;
font-family: var(--font-display);
font-size: clamp(16px, 4vw, 22px);
font-weight: 700;
letter-spacing: 0.01em;
cursor: pointer;
color: #fff;
touch-action: manipulation;
transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease, filter 0.15s ease;
box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3), 0 8px 24px rgba(166, 99, 204, 0.25);
}
.btn:active {
transform: translateY(4px);
box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}
/* glossy top highlight layered above the color fill (background-image
layers paint top-to-bottom, so this sits safely behind the label text
instead of a ::before, which would otherwise paint over it) */
.btn-primary {
background-image:
linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 55%),
linear-gradient(135deg, #c185e8 0%, #7c5cf0 50%, #4361ee 100%);
}
.btn-secondary {
background-image:
linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 55%),
linear-gradient(135deg, #5bd8f5 0%, #4895ef 100%);
font-size: clamp(14px, 3.2vw, 18px);
padding: 12px 30px;
}
@media (hover: hover) and (pointer: fine) {
.btn:hover {
filter: brightness(1.1);
transform: translateY(-2px);
box-shadow: 0 8px 0 rgba(0, 0, 0, 0.3), 0 12px 28px rgba(166, 99, 204, 0.4);
}
.btn:hover:active {
transform: translateY(2px);
}
}
/* signature touch: a slow ambient glow breathing on the primary CTA only,
so the eye lands on "Play" without any competing motion elsewhere */
#startBtn {
animation: ctaBreathe 3.2s ease-in-out infinite;
}
@keyframes ctaBreathe {
0%, 100% { box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3), 0 8px 24px rgba(166, 99, 204, 0.25); }
50% { box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3), 0 10px 38px rgba(124, 92, 240, 0.55); }
}
@media (prefers-reduced-motion: reduce) {
#startBtn { animation: none; }
}
/* ============================================================
SHOP
============================================================ */
#shopItems {
width: 100%;
max-width: 420px;
display: flex;
flex-direction: column;
gap: 10px;
}
.shop-item {
display: flex;
align-items: center;
gap: 10px;
background: rgba(255, 255, 255, 0.06);
border: 1px solid rgba(255, 255, 255, 0.15);
border-radius: 14px;
padding: 10px 12px;
text-align: left;
transition: background 0.15s ease, border-color 0.15s ease;
}
.shop-item-icon {
font-size: 26px;
width: 40px;
text-align: center;
flex-shrink: 0;
}
.shop-item-info {
flex: 1;
min-width: 0;
}
.shop-item-name {
font-family: var(--font-display);
font-weight: 700;
font-size: 14px;
letter-spacing: 0.01em;
}
.shop-item-desc {
font-size: 11px;
color: #b8b0d9;
margin-top: 2px;
}
.shop-buy-btn {
border: none;
border-radius: 999px;
padding: 8px 14px;
font-size: 13px;
font-weight: 800;
color: #1a1246;
background: linear-gradient(135deg, #ffe680, #ffb84d);
cursor: pointer;
white-space: nowrap;
flex-shrink: 0;
transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease;
}
.shop-buy-btn:active:not(:disabled) {
transform: scale(0.92);
}
.shop-buy-btn:disabled {
opacity: 0.4;
cursor: default;
background: rgba(255, 255, 255, 0.15);
color: #fff;
}
@media (hover: hover) and (pointer: fine) {
.shop-item:hover {
background: rgba(255, 255, 255, 0.09);
border-color: rgba(255, 255, 255, 0.25);
}
.shop-buy-btn:not(:disabled):hover {
box-shadow: 0 4px 14px rgba(255, 184, 77, 0.45);
transform: translateY(-1px);
}
}
.hidden {
display: none !important;
}
</style>
</head>
<body>
<div id="app">
<header id="topHeader">
<div class="header-brand">
<span class="header-star">★</span>
<span id="stationTitle">Earth Station</span>
</div>
<div class="header-right">
<button id="shopBtn" class="coin-pill-header" aria-label="Shop">
<span class="coin-dot">$</span><span id="coinsVal">0</span>
</button>
<button id="shopBtnCart" class="cart-btn" aria-label="Open shop">
<svg viewBox="0 0 24 24" width="19" height="19" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="9" cy="21" r="1"></circle><circle cx="20" cy="21" r="1"></circle><path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"></path></svg>
</button>
<button id="vibeBtn" class="cart-btn" aria-label="Toggle vibration"><span class="vibe-icon">📳</span></button>
</div>
</header>
<div id="statsRow">
<div class="stat-chip score-chip">⭐ <span id="scoreVal">0</span></div>
<div class="level-chip">
<span class="level-chip-label">LEVEL</span>
<span class="level-chip-value"><span id="levelVal">1</span> / <span id="levelTotal">10</span></span>
<div class="level-progress-track"><div class="level-progress-fill" id="levelProgressFill"></div></div>
</div>
</div>
<div id="boardWrap">
<canvas id="boardCanvas" width="480" height="480"></canvas>
<div id="toast"></div>
<!-- ===== Main Menu (doubles as onboarding — one click straight into gameplay) ===== -->
<div id="menuScreen" class="overlay">
<h1 class="title">Earth Station</h1>
<div class="quick-guide">
<div class="quick-guide-row">👆 <span>Swipe or arrow keys</span></div>
<div class="quick-guide-row">🪐 <span>Match 2 planets to merge</span></div>
<div class="quick-guide-row">🌍 <span>Fill the board to clear a level</span></div>
</div>
<button id="startBtn" class="btn btn-primary">▶ Play</button>
</div>
<!-- ===== Game Over ===== -->
<div id="gameOverScreen" class="overlay hidden">
<h1 class="title">Game Over</h1>
<p class="subtitle">No more moves left.</p>
<p class="subtitle">Score: <strong id="finalScore">0</strong> · Best: <strong id="finalBest">0</strong></p>
<button id="restartBtn" class="btn btn-primary">↻ Play Again</button>
</div>
<!-- ===== Level Complete ===== -->
<div id="levelCompleteScreen" class="overlay hidden">
<h1 class="title" id="levelCompleteIcon">🌍 Level 1 Complete!</h1>
<p class="subtitle" id="levelCompleteSubtitle">Every cell reached 32 — Earth conquered!</p>
<div class="coin-chip big">+<span id="levelCompleteReward">25</span> 🪙</div>
<button id="nextLevelBtn" class="btn btn-primary">Next Level ▶</button>
</div>
<!-- ===== Win ===== -->
<div id="winScreen" class="overlay hidden">
<h1 class="title">🌀 Galaxy Master!</h1>
<p class="subtitle">You filled the whole board all the way to Wormhole (16384) across all 10 levels! Keep going for more score and coins, or start a fresh run.</p>
<button id="continueBtn" class="btn btn-primary">Keep Playing</button>
<button id="newAfterWinBtn" class="btn btn-secondary">↻ New Game</button>
</div>
<!-- ===== Shop ===== -->
<div id="shopScreen" class="overlay hidden">
<h1 class="title">🛒 Shop</h1>
<div class="coin-chip big">🪙 <span id="shopCoins">0</span></div>
<div id="shopItems"></div>
<button id="closeShopBtn" class="btn btn-secondary">Close</button>
</div>
</div>
<div id="dpad" aria-label="Move controls">
<button id="dpadUp" class="dpad-btn dpad-up" aria-label="Move up">▲</button>
<button id="dpadLeft" class="dpad-btn dpad-left" aria-label="Move left">◀</button>
<button id="dpadRight" class="dpad-btn dpad-right" aria-label="Move right">▶</button>
<button id="dpadDown" class="dpad-btn dpad-down" aria-label="Move down">▼</button>
</div>
<nav id="controls">
<button id="undoBtn" class="nav-btn">
<span class="nav-btn-icon">↩</span>
<span class="nav-btn-label">Undo <span id="undoCount">2</span></span>
</button>
<button id="shuffleBtn" class="nav-btn nav-btn-primary">
<span class="nav-btn-icon">🔀</span>
<span class="nav-btn-label">Shuffle <span id="shuffleCount">0</span></span>
</button>
<button id="soundBtn" class="nav-btn">
<span class="nav-btn-icon">🔊</span>
<span class="nav-btn-label">Audio</span>
</button>
</nav>
</div>
<script>
"use strict";
/* ============================================================
CONFIG
============================================================ */
const SIZE = 4;
const ANIM_MS = 130;
const POP_MS = 160;
const STORAGE_KEY = "cosmicMergeBest";
// Celestial tiers: each merge level has its own color + icon,
// which is the visual/thematic twist that sets this apart from
// a plain numbers-only merge grid.
const TIERS = [
{ value: 2, name: "Asteroid", icon: "🪨", c1: "#9aa3b2", c2: "#4a4e69" },
{ value: 4, name: "Moon", icon: "🌕", c1: "#fff2c2", c2: "#e0b94d" },
{ value: 8, name: "Mercury", icon: "🌑", c1: "#d7bfae", c2: "#8d7b74" },
{ value: 16, name: "Venus", icon: "🌟", c1: "#ffe08a", c2: "#ff9a3d" },
{ value: 32, name: "Earth", icon: "🌍", c1: "#6fd3ff", c2: "#1976d2" },
{ value: 64, name: "Mars", icon: "🔴", c1: "#ff8a65", c2: "#c1440e" },
{ value: 128, name: "Jupiter", icon: "🪐", c1: "#f7b267", c2: "#c9622d" },
{ value: 256, name: "Saturn", icon: "💫", c1: "#ffe680", c2: "#e8a53a" },
{ value: 512, name: "Uranus", icon: "💠", c1: "#8ef0ff", c2: "#3aa6b9" },
{ value: 1024, name: "Neptune", icon: "🔵", c1: "#5c7cfa", c2: "#3a0ca3" },
{ value: 2048, name: "Sun", icon: "☀️", c1: "#fff275", c2: "#ff8c42" },
{ value: 4096, name: "Black Hole",icon: "🕳️", c1: "#5a5a7a", c2: "#050014" },
{ value: 8192, name: "Nebula", icon: "🌌", c1: "#c599ff", c2: "#4d2d7d" },
{ value: 16384,name: "Wormhole", icon: "🌀", c1: "#ff9de2", c2: "#7d2d6b" }
];
function tierFor(value) {
return TIERS.find((t) => t.value === value) || TIERS[TIERS.length - 1];
}
// 10 levels, each with its own "cosmic cap": Level 1's cap is 32 (Earth),
// Level 2's is 64 (Mars), Level 3's is 128 (Jupiter) ... doubling each
// time up to Level 10's 16384 (Wormhole). Within a level, two tiles at
// that level's cap can't merge any further — they behave like a wall,
// the same way a blocker does. A level only completes once EVERY one of
// the 16 cells on the board holds that level's cap value.
const LEVEL_REWARDS = [25, 60, 110, 200, 350, 600, 1000, 1600, 2600, 4200];
const LEVELS = TIERS.slice(4, 14).map((t, i) => ({
level: i + 1,
target: t.value,
name: t.name,
icon: t.icon,
reward: LEVEL_REWARDS[i],
cellsRequired: i === 0 ? 12 : SIZE * SIZE
}));
// The active merge cap always tracks the current level. Once the final
// level is finished, the cap just stays at the last level's value.
function getCurrentCap() {
const lvl = LEVELS[currentLevelIndex] || LEVELS[LEVELS.length - 1];
return lvl.target;
}
const VECTORS = {
up: { r: -1, c: 0 },
down: { r: 1, c: 0 },
left: { r: 0, c: -1 },
right: { r: 0, c: 1 }
};
/* ============================================================
AUDIO (synthesized — no files to load, keeps the game light)
============================================================ */
let audioCtx = null;
let soundEnabled = true;
let vibrationEnabled = true;
function ensureAudio() {
if (!audioCtx) {
const Ctx = window.AudioContext || window.webkitAudioContext;
audioCtx = new Ctx();
}
if (audioCtx.state === "suspended") audioCtx.resume();
}
function playTone(freq, duration, type, volume) {
if (!soundEnabled) return;
ensureAudio();
const osc = audioCtx.createOscillator();
const gain = audioCtx.createGain();
osc.type = type;
osc.frequency.value = freq;
gain.gain.setValueAtTime(volume, audioCtx.currentTime);
gain.gain.exponentialRampToValueAtTime(0.001, audioCtx.currentTime + duration);