-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathleaderboard.html
More file actions
1853 lines (1699 loc) · 75.9 KB
/
Copy pathleaderboard.html
File metadata and controls
1853 lines (1699 loc) · 75.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
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" />
<title>Zoomies — Speedrun Leaderboard</title>
<meta name="description"
content="Zoomies — a first-person coin-collecting speedrun in a tiny bedroom. Can you beat the time?" />
<script>
// ── Pre-boot leaderboard fetch ───────────────────────────────────
// Kick off the /api/leaderboard request as early as the parser
// sees this <head> — BEFORE the inline <style> block, the SPA
// router script, the iframe creation, etc. all have a chance to
// push it back. loadLeaderboard() below consumes this in-flight
// promise via window.__lbBootFetch instead of starting a fresh
// fetch, so the round-trip overlaps with HTML parse + first paint
// instead of running serially after them. Saves ~50–300ms of
// user-perceived "skeleton → real rows" time on first load.
//
// This is best-effort; any failure here just falls through to the
// normal fetch path in __initLeaderboard().
(function () {
try {
var qs = new URLSearchParams(location.search);
var raw = String(qs.get('mode') || '').trim().toLowerCase();
var valid = ['normal', 'speed', 'allsecrets'];
var mode = valid.indexOf(raw) >= 0 ? raw : 'normal';
var url = mode === 'allsecrets'
? '/api/leaderboard?onlyAllSecrets=1'
: '/api/leaderboard?mode=' + encodeURIComponent(mode);
window.__lbBootFetch = {
mode: mode,
promise: fetch(url, { credentials: 'same-origin' }).then(function (r) {
return r.json().then(function (j) {
return { ok: r.ok, status: r.status, data: j };
});
}).catch(function () {
return { ok: false, status: 0, data: null };
})
};
} catch (_) { /* perf nicety, not load-bearing */ }
})();
</script>
<!-- Share the same stylesheet (and design tokens) the in-game UI uses -->
<link rel="stylesheet" href="./src/styles/main.css" />
<!-- Phosphor icon CSS is deferred via preload+onload so it never
render-blocks the board panel on first paint. The board doubles
as the loading indicator on direct-load (e.g. arriving from a
shared run link) and MUST appear with the first frame — a
third-party CDN stylesheet sitting in the critical path used to
delay that paint by hundreds of ms (sometimes seconds on a cold
cache). The <noscript> fallback keeps icons working when JS is
disabled, in which case render-blocking is acceptable. -->
<link rel="preload" as="style" href="https://unpkg.com/@phosphor-icons/web@2.1.1/src/regular/style.css"
onload="this.onload=null;this.rel='stylesheet'" />
<link rel="preload" as="style" href="https://unpkg.com/@phosphor-icons/web@2.1.1/src/fill/style.css"
onload="this.onload=null;this.rel='stylesheet'" />
<noscript>
<link rel="stylesheet" href="https://unpkg.com/@phosphor-icons/web@2.1.1/src/regular/style.css" />
<link rel="stylesheet" href="https://unpkg.com/@phosphor-icons/web@2.1.1/src/fill/style.css" />
</noscript>
<style>
/* Inherits the canonical liquid-glass design tokens from main.css
(--glass, --glass-specular, --glass-blur, --glass-border,
--glass-border-strong, --font-ui, --font-mono, --text). The few
page-local tokens below are the cyan/gold accents that the
in-game pause + finish-dialog leaderboards use as hardcoded hex,
so the share page reads as the same surface treatment. */
:root {
--muted: #a8c0d6;
--lb-accent: #9fe3ff;
/* matches #fpLeaderboardList .tm + finish-dialog accent */
--lb-gold: #ffd700;
/* matches --gold in main.css */
--lb-gold-edge: rgba(255, 216, 115, 0.46);
/* matches finish-dialog .own-current border */
}
* {
box-sizing: border-box;
}
/* main.css locks html/body { overflow: hidden; height: 100% } for the 3D
game; override here so the share page scrolls when content overflows.
!important is required because Vite's production build moves the
<link rel="stylesheet" href="./src/styles/main.css"> to the END of
<head> (after this inline <style>), so without !important the
lock would win on source order during direct-load. (SPA nav
"fixes" it accidentally because the router re-appends inline
<style> blocks to the head when swapping <main>, putting them
last again — but only after the first navigation.) */
html,
body {
height: auto !important;
overflow-x: hidden !important;
overflow-y: auto !important;
}
body {
margin: 0;
min-height: 100vh;
font-family: var(--font-ui);
color: var(--text);
font-weight: var(--weight-regular);
line-height: 1.45;
text-rendering: optimizeLegibility;
/* Visible only during the cold-load gap before #bgFrame becomes
opaque (and as a fallback if the iframe ever fails). Tuned to
the renderer's day clear color (#d4dce8 — see
src/modules/constants.js DAY_CLEAR) plus a hint of warm floor,
so the moment the scene snaps in feels like a soft fade-up
rather than a cut from black. */
background: linear-gradient(180deg, #d4dce8 0%, #c5b8a4 100%);
padding: 92px 18px 40px;
position: relative;
z-index: 0;
}
/* Live game scene rendered behind the page */
#bgFrame {
position: fixed;
inset: 0;
width: 100vw;
height: 100vh;
border: 0;
z-index: 0;
pointer-events: none;
filter: saturate(1.05);
opacity: 0;
}
#bgFrame.ready {
opacity: 1;
}
/* Same scrim the splash uses (#titleSplash bg) so the live room
scene shows through behind the glass card the way it does on /. */
#bgScrim {
position: fixed;
inset: 0;
z-index: 1;
pointer-events: none;
background:
radial-gradient(120% 80% at 50% 0%, rgba(8, 10, 16, 0.55) 0%, rgba(8, 10, 16, 0) 55%),
radial-gradient(120% 80% at 50% 100%, rgba(8, 10, 16, 0.6) 0%, rgba(8, 10, 16, 0) 55%);
backdrop-filter: blur(2px) saturate(1.1);
-webkit-backdrop-filter: blur(2px) saturate(1.1);
}
/* Iframe-promotion mode — set by promoteToPlay() in the router
below. Lets clicks land on the iframe canvas (so the user can
interact with char-select / play) and fades the scrim out so
it doesn't sit between them and the picker. Mirrors home.html. */
body.is-playing #bgFrame {
pointer-events: auto;
z-index: 2;
}
/* Lift iframe above #bgScrim during play so the scrim's
backdrop-filter no longer paints over the picker (which lives
inside the iframe). The picker's iframe-side body::before takes
over providing constant-strength bedroom blur during the
transition. */
@media (prefers-reduced-motion: reduce) {
#bgFrame {
display: none;
}
}
.page {
position: relative;
z-index: 2;
width: min(720px, 100%);
margin: 0 auto;
display: grid;
gap: 20px;
}
/* ── Leaderboard section ─────────────────────────────────────
Liquid-glass surface matching the in-game pause/finish boards. */
.board {
position: relative;
background-color: var(--glass);
background-image: var(--glass-specular);
border: 1px solid var(--glass-border);
/* 24px lines up cleanly with the inner mode-tab + row
* radii (10px / 9px) — the visual offset between outer and
* inner corners reads as concentric instead of competing. */
border-radius: 24px;
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.4),
inset 0 -1px 0 rgba(255, 255, 255, 0.06),
inset 0 0 32px 0 rgba(255, 255, 255, 0.03),
0 30px 80px rgba(0, 0, 0, 0.5),
0 1px 0 rgba(0, 0, 0, 0.5);
backdrop-filter: var(--glass-blur);
-webkit-backdrop-filter: var(--glass-blur);
overflow: hidden;
}
/* ── Boot-as-loading-indicator ────────────────────────────────
Mirrors home.html: the board is the focal element on /leader-
board, and (especially when the user lands here from a shared
run link in chat) it must paint instantly. main.css applies the
pageContentIn keyframe to every direct child of main.page,
which would have the board fading in from opacity:0 +
translateY(12px) + blur(8px) over 0.7s — that's the delay
we're killing. We override the animation entirely on first
load and use a CSS background-color transition (opaque dark →
glass) as the entrance instead, kicked by JS once the iframe
scene reports ready. For SPA-nav into /leaderboard, we keep the
shared content entrance animation so this page matches /about. */
main.page:not([data-spa="1"])>.board {
animation: none !important;
opacity: 1 !important;
transform: none !important;
filter: none !important;
transition:
background-color 0.65s cubic-bezier(0.32, 0.72, 0, 1),
border-color 0.5s ease-out;
}
/* Boot state — paint as glass from frame 1. The body fallback
gradient (light) sits behind the card before the iframe scene
loads, so the previous dark opaque fill (#0e2034) read as
jarring against the warm-gray fallback. The skeleton rows
below carry the loading affordance; the card itself stays on
the same liquid-glass surface as about.html / home.html
throughout boot. */
body.is-booting main.page>.board {
border-color: var(--glass-border);
}
/* While booting, the rows haven't loaded yet (the API fetch is
still in flight) AND the iframe scene isn't visible yet, so
the row container would otherwise be a transparent strip
between two opaque borders. Show a subtle skeleton shimmer
so the loading state is legible at a glance — the user knows
the page is alive and data is incoming, not that the board
is empty. The skeleton rows are removed (innerHTML overwrite)
the moment loadLeaderboard() returns. */
.row.row--skeleton {
grid-template-columns: 38px 1fr auto;
cursor: default;
}
/* Each skel is a softly-filled rounded pill. The shimmer lives on
* a separate ::after layer carrying a diagonal cyan-tinted beam
* that sweeps across; overflow:hidden clips it to the pill shape.
*
* IMPORTANT: display:block. The .skel is a <span>, which is inline
* by default and IGNORES width/height. Without this declaration
* the pills collapse to zero size and the rows render visibly
* empty — which is exactly what the previous shimmer was doing
* (silently animating an invisible box). */
.row--skeleton .skel {
display: block;
position: relative;
height: 12px;
border-radius: 6px;
/* Base fill is bright enough to read clearly against the glass
* card on top of the live 3D scene. Was 0.07 — invisible. */
background: rgba(225, 240, 255, 0.16);
overflow: hidden;
isolation: isolate;
/* Slow ambient breathe — keeps the pill alive between beam
* passes. Different period than the beam (2.6s vs 1.8s) so
* the two animations interfere rather than syncing, which
* reads as organic rather than mechanical. */
animation: skelBreathe 2.6s ease-in-out infinite;
}
.row--skeleton .skel::after {
content: '';
position: absolute;
/* Negative inset lets the beam's bright edges extend past the
* pill bounds before overflow:hidden clips them — the
* highlight reads as a broad light source rather than a
* gradient painted inside the box. */
inset: -2px;
/* Asymmetric specular gradient — broad halo with a hot core.
* Real light reflections have head/tail asymmetry; symmetric
* gradients read as "skeleton shimmer cliché". White-hot
* peak, cyan halo, cool trail.
*
* Wider envelope (8% → 92%) than before (25% → 78%) so the
* highlight reads as a soft volumetric pass rather than a
* thin sliver — at 78px-wide time pills the previous beam
* crossed too fast to register as light. The hot core stays
* narrow (4% wide) so the moment of peak brightness still
* has snap. 105deg angle gives the beam a touch more lean. */
background: linear-gradient(105deg,
transparent 8%,
rgba(173, 230, 255, 0.18) 28%,
rgba(220, 245, 255, 0.55) 44%,
rgba(255, 255, 255, 0.95) 50%,
rgba(220, 245, 255, 0.55) 56%,
rgba(173, 230, 255, 0.22) 72%,
transparent 92%);
/* Soft blur on the beam itself — Emil's "blur is magic". The
* gradient stops stay crisp at the source but render as a
* glow with diffuse edges. ~0.5px is the sweet spot: too
* little and the gradient looks pasted; too much and the
* highlight smears into mush. */
filter: blur(0.5px);
transform: translateX(-100%);
will-change: transform;
animation: skelShimmer 1.8s cubic-bezier(0.7, 0, 0.3, 1) infinite;
}
/* Stagger per row so the wave travels DOWN the board as one
* pulse rather than every row firing in lockstep. Each <li>
* carries style="--i:N" (1..25). 25ms × 24 = 600ms total
* cascade — has to be fast enough that every row gets a beam
* pass BEFORE the API responds (locally ~200ms; on cold cache
* 1-2s). Earlier 60ms per row meant rows 5-25 never lit up on
* a fast connection because data overwrote the skeleton before
* the wave reached them. */
.row--skeleton .skel::after {
animation-delay: calc((var(--i, 1) - 1) * 60ms);
}
/* Breathe stagger uses HALF the beam stagger so the ambient
* pulse rolls slower than the beam — the two waves crossing at
* different speeds is what makes it feel like a living surface
* instead of a loop. */
.row--skeleton .skel {
animation-delay: calc((var(--i, 1) - 1) * 30ms);
}
.row--skeleton .skel--rank {
width: 22px;
}
.row--skeleton .skel--name {
width: 60%;
max-width: 180px;
}
/* margin-left:auto right-aligns the time pill inside its grid
* cell. (justify-self:end was a no-op here — the grid item is
* .time, not the skel span inside it.) */
.row--skeleton .skel--time {
width: 78px;
margin-left: auto;
}
@keyframes skelShimmer {
0% {
transform: translateX(-100%);
}
/* Beam crosses by 60% of the cycle, then dwells off-screen for
* the remaining 40%. The pause is the rhythm — without it the
* loop feels relentless; with it, it breathes. */
60% {
transform: translateX(100%);
}
100% {
transform: translateX(100%);
}
}
/* Ambient breathe — the pill gently inhales between beam passes.
* Ranges +/- 0.04 alpha around the resting 0.16; perceptible but
* never demanding. This is the layer that keeps the loading
* state from feeling dead during the off-cycle dwell. */
@keyframes skelBreathe {
0%,
100% {
background-color: rgba(225, 240, 255, 0.14);
}
50% {
background-color: rgba(225, 240, 255, 0.22);
}
}
@media (prefers-reduced-motion: reduce) {
.row--skeleton .skel,
.row--skeleton .skel::after {
animation: none;
}
}
/* (.board__head removed — the static "Top times" label was
redundant with the active "Leaderboard" tab, and the meta
string only carried decorative copy. Connection errors now
surface through #empty instead.) */
/* Mode tabs — match the .lb-tabs/.lb-tab pattern in main.css used
on the pause-menu leaderboard, scaled up slightly for the
standalone share page. */
.modeTabs {
display: flex;
gap: 6px;
margin: 14px 14px 8px;
padding: 4px;
background: var(--glass-soft);
border: 1px solid var(--glass-stroke-soft, rgba(255, 255, 255, 0.08));
border-radius: 10px;
}
.modeTab {
flex: 1;
appearance: none;
background: transparent;
border: 0;
color: rgba(255, 255, 255, 0.72);
font: inherit;
font-size: 13px;
font-weight: 600;
letter-spacing: 0.02em;
padding: 8px 12px;
border-radius: 7px;
cursor: pointer;
transition: background 0.15s, color 0.15s;
}
.modeTab:hover {
color: rgba(255, 255, 255, 0.9);
}
.modeTab.active {
background: rgba(255, 255, 255, 0.12);
color: #fff;
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2) inset;
}
/* Parenthetical clarifier inside a mode tab label (e.g.
"100% (all secret coins)"). Reads as secondary at smaller sizes
and slightly de-emphasized so the primary label dominates. */
.modeTab__sub {
margin-left: 4px;
font-size: 11px;
font-weight: 500;
opacity: 0.72;
}
/* List rows — same surface + highlight pattern as #finishDialogList
and #fpLeaderboardList: subtle white-tint resting state, gold-
tinted background + left-edge gold bar for the player's row
(.row.hit). Padding is slightly larger here since this is a
standalone page rather than a side panel. */
.list {
list-style: none;
margin: 0;
padding: 6px 16px 16px 16px;
display: grid;
gap: 6px;
}
.row {
display: grid;
grid-template-columns: 38px 1fr auto auto auto;
gap: 10px;
align-items: center;
/* Lock rows to a clean 36px so skeleton rows and real rows match
exactly, and so the board height is a deterministic multiple
of (row + gap). Previously rows computed to 38.183px because
.catBadge / .secretBadge had font-size: 10.5px (× 1.35
line-height = 14.175px content) which pushed the row past
its 16px+2px chrome budget. Fixed height + padding kills the
dependency on child line-box rounding. align-items: center
vertically centers any child regardless of its own height. */
height: 36px;
padding: 0 11px;
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 9px;
background: rgba(255, 255, 255, 0.05);
font-size: 13px;
line-height: 1.35;
scroll-margin-top: 22px;
}
.rank {
color: var(--muted);
font-weight: 700;
font-variant-numeric: tabular-nums;
}
.name {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* Cat badge — tracks the global .catBadge in main.css (used inside
the in-game leaderboards). Slightly larger here for the
standalone page; same material, dot, and gold-row override. */
.catBadge {
display: inline-flex;
align-items: center;
gap: 5px;
/* Whole-pixel font-size; was 10.5 which produced subpixel
line-box heights that bled into the parent .row height. */
font-size: 11px;
font-weight: var(--weight-semibold);
letter-spacing: 0.02em;
padding: 2px 8px 2px 6px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.06);
border: 1px solid rgba(255, 255, 255, 0.1);
color: #cdd7e5;
white-space: nowrap;
}
.catBadge .catEmoji {
font-size: 13px;
line-height: 1;
filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.35));
}
.catBadge .catDot {
width: 8px;
height: 8px;
border-radius: 50%;
border: 1px solid rgba(0, 0, 0, 0.45);
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
flex-shrink: 0;
}
.row.hit .catBadge {
background: rgba(255, 216, 115, 0.1);
border-color: rgba(255, 216, 115, 0.3);
color: #ffeab2;
}
.secretBadge {
display: inline-flex;
align-items: center;
gap: 4px;
/* Whole-pixel font-size; was 10.5 — same reasoning as .catBadge. */
font-size: 11px;
font-weight: 800;
letter-spacing: 0.02em;
padding: 2px 8px;
border-radius: 999px;
background: rgba(255, 216, 115, 0.10);
border: 1px solid rgba(255, 216, 115, 0.32);
color: var(--lb-gold);
white-space: nowrap;
font-variant-numeric: tabular-nums;
}
.secretBadge i {
font-size: 12px;
line-height: 1;
}
.secretBadge.is-zero {
background: rgba(255, 255, 255, 0.03);
border-color: rgba(255, 255, 255, 0.08);
color: var(--muted);
opacity: 0.6;
}
.secretBadge.is-max {
background: rgba(255, 216, 115, 0.18);
border-color: rgba(255, 216, 115, 0.55);
box-shadow: 0 0 0 1px rgba(255, 216, 115, 0.18) inset;
}
.time {
font-family: var(--font-mono);
font-variant-numeric: tabular-nums;
color: var(--lb-accent);
font-weight: 800;
letter-spacing: 0.02em;
/* Nudge the mono digits down ~2px. The mono face's cap-height
sits higher in its em-box than the proportional body font,
so flex/grid centering visually skews top-heavy. */
padding-top: 2px;
}
.row.hit {
background: rgba(255, 216, 115, 0.16);
border-color: var(--lb-gold-edge);
box-shadow: 0 0 0 1px rgba(255, 216, 115, 0.15), inset 3px 0 0 rgba(255, 226, 140, 0.65);
}
.row.hit .time,
.row.hit .name {
color: var(--lb-gold);
}
/* Empty / error state — occupies the whole list area when the
* board has no rows. Two variants: data success but zero entries
* (no runs yet) and fetch failure (connection issue). Same
* layout, different icon and copy. We render both options as
* markup via innerHTML in JS — the icon + headline + sub combo
* reads as a small illustration rather than a status line. */
.empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 14px;
padding: 56px 24px 64px;
text-align: center;
color: var(--muted);
/* Subtle entrance — the empty state appears AFTER the skeleton
* cascade resolves, so a brief fade+rise softens the swap and
* tells the eye "this is the answer, not still loading". */
animation: emptyIn 0.45s cubic-bezier(0.32, 0.72, 0, 1) both;
}
.empty__icon {
position: relative;
width: 72px;
height: 72px;
display: flex;
align-items: center;
justify-content: center;
color: var(--lb-accent);
/* Soft cyan halo behind the glyph — tiny illustration trick.
* The drop-shadow filter renders a true circular glow that
* sits underneath the fill, no extra DOM node needed. */
filter:
drop-shadow(0 0 24px rgba(159, 227, 255, 0.35))
drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}
.empty__icon i {
font-size: 64px;
line-height: 1;
}
/* Error variant tints the icon warm-amber so the user reads
* "something went wrong" without us having to spell it out
* twice (icon + copy). */
.empty--error .empty__icon {
color: #ffb78a;
filter:
drop-shadow(0 0 24px rgba(255, 183, 138, 0.32))
drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}
.empty__headline {
margin: 0;
font-size: 16px;
font-weight: 700;
letter-spacing: 0.01em;
color: rgba(232, 244, 255, 0.92);
}
.empty__sub {
margin: 0;
font-size: 13px;
line-height: 1.5;
max-width: 32ch;
color: var(--muted);
}
.empty__sub a {
color: var(--lb-accent);
text-decoration: none;
border-bottom: 1px dashed rgba(159, 227, 255, 0.45);
transition: color 0.18s ease, border-color 0.18s ease;
}
.empty__sub a:hover {
color: #fff;
border-bottom-color: rgba(255, 255, 255, 0.7);
}
@keyframes emptyIn {
from {
opacity: 0;
transform: translateY(6px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@media (prefers-reduced-motion: reduce) {
.empty {
animation: none;
}
}
/* "Show more" button: lazy-loads the next page of leaderboard
* entries (default 50 per page, up to 1000 total). Sits below
* the rows list with breathing room so it never crowds the
* #1 entry above. Matches the cyan-accent palette and the
* liquid-glass surface treatment used on the modeTabs. */
.showMoreWrap {
display: flex;
justify-content: center;
padding: 18px 12px 8px;
}
.showMoreWrap[hidden] {
display: none;
}
.showMoreBtn {
appearance: none;
-webkit-appearance: none;
font: inherit;
font-size: 13px;
font-weight: 600;
letter-spacing: 0.02em;
color: var(--lb-accent);
background: var(--glass);
backdrop-filter: blur(var(--glass-blur, 12px));
-webkit-backdrop-filter: blur(var(--glass-blur, 12px));
border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.18));
border-radius: 999px;
padding: 10px 22px;
cursor: pointer;
min-height: 40px;
min-width: 140px;
transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.showMoreBtn:hover:not([disabled]) {
color: #fff;
background: rgba(159, 227, 255, 0.14);
border-color: rgba(159, 227, 255, 0.5);
}
.showMoreBtn:focus-visible {
outline: 2px solid var(--lb-accent);
outline-offset: 2px;
}
.showMoreBtn:active:not([disabled]) {
transform: translateY(1px);
}
.showMoreBtn[disabled] {
opacity: 0.6;
cursor: progress;
}
.footnote {
text-align: center;
font-size: 11px;
color: var(--muted);
letter-spacing: 0.04em;
opacity: 0.85;
}
.footnote a {
color: var(--lb-accent);
text-decoration: none;
}
.footnote a:hover {
text-decoration: underline;
}
@media (max-width: 640px) {
body {
padding: 78px 12px 32px;
}
.board {
border-radius: 26px;
}
.row {
grid-template-columns: 32px 1fr auto auto auto;
padding: 7px 9px;
gap: 6px;
}
.catBadge span:last-child {
display: none;
}
}
</style>
</head>
<body class="is-booting tabs-revealed">
<iframe id="bgFrame" src="/play?bg=1" title="" aria-hidden="true" tabindex="-1" referrerpolicy="same-origin"></iframe>
<div id="bgScrim" aria-hidden="true">
<div class="bg-grid"></div>
</div>
<nav class="site-tabs" aria-label="Primary">
<a class="site-tab" href="/" data-tab="home">
<i class="site-tab__icon site-tab__icon--regular ph ph-house"></i><i
class="site-tab__icon site-tab__icon--fill ph-fill ph-house"></i><span>Home</span>
</a>
<a class="site-tab" href="/leaderboard" data-tab="leaderboard">
<i class="site-tab__icon site-tab__icon--regular ph ph-trophy"></i><i
class="site-tab__icon site-tab__icon--fill ph-fill ph-trophy"></i><span>Leaderboard</span>
</a>
<a class="site-tab" href="/about" data-tab="about">
<i class="site-tab__icon site-tab__icon--regular ph ph-info"></i><i
class="site-tab__icon site-tab__icon--fill ph-fill ph-info"></i><span>About</span>
</a>
<a class="site-tab" href="/settings" data-tab="settings">
<i class="site-tab__icon site-tab__icon--regular ph ph-gear"></i><i
class="site-tab__icon site-tab__icon--fill ph-fill ph-gear"></i><span>Settings</span>
</a>
</nav>
<main class="page">
<section class="board">
<div id="modeTabs" class="modeTabs" role="tablist" aria-label="Leaderboard mode">
<button type="button" class="modeTab active" role="tab" aria-selected="true" data-lb-mode="normal">Normal · 20
coins</button>
<button type="button" class="modeTab" role="tab" aria-selected="false" data-lb-mode="speed">Speed · 32
coins</button>
<button type="button" class="modeTab" role="tab" aria-selected="false" data-lb-mode="allsecrets">100% <span
class="modeTab__sub">(all secret coins)</span></button>
</div>
<!-- Skeleton rows render with the first paint so the board is
never visibly empty while the /api/leaderboard fetch is in
flight. loadLeaderboard() overwrites this innerHTML the
moment data arrives (typically <200ms on a warm cache); on
a cold cache or slow network the shimmer keeps the page
feeling alive. aria-hidden so screen readers don't announce
placeholder rows; aria-live="polite" on #rows handles real
data once it lands.
25 rows matches the API cap (LB_MAX = 25 in server.js) so
the skeleton always reserves the full board height — no
layout jump when fewer real rows come back. style="--i:N"
drives the staggered shimmer delay (see .skel::after). -->
<ol id="rows" class="list" aria-live="polite">
<li class="row row--skeleton" style="--i:1" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:2" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:3" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:4" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:5" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:6" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:7" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:8" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:9" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:10" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:11" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:12" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:13" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:14" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:15" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:16" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:17" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:18" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:19" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:20" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:21" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:22" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:23" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:24" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
<li class="row row--skeleton" style="--i:25" aria-hidden="true">
<div class="rank"><span class="skel skel--rank"></span></div>
<div class="name"><span class="skel skel--name"></span></div>
<div class="time"><span class="skel skel--time"></span></div>
</li>
</ol>
<div id="empty" class="empty" style="display:none" hidden></div>
<div id="showMoreWrap" class="showMoreWrap" hidden>
<button id="showMoreBtn" class="showMoreBtn" type="button" aria-label="Load more leaderboard entries">
<span id="showMoreLabel">Show more</span>
</button>
</div>
</section>
<p class="footnote">Created by <a href="https://brandonmoore.design" target="_blank" rel="noopener">Brandon</a>.</p>
</main>
<script>
// One-shot: skip the live-scene iframe on touch / narrow devices to
// save battery. Runs only on the initial document load — once we
// start SPA-swapping <main> via the router, the iframe persists, so
// this never needs to re-run.
(function () {
const bgFrame = document.getElementById('bgFrame');
const _isCoarse = matchMedia('(pointer: coarse)').matches;
const _isNarrow = window.innerWidth < 720;
// Tabs are revealed via the body class set in the HTML itself
// (`tabs-revealed`) so they paint sharp on the very first
// frame. The leaderboard fetches its own data independently
// of the iframe, so the page is fully usable as soon as the
// data lands.
// End the boot/loading state. Removing .is-booting from <body>
// triggers the CSS transition on .board's background-color
// (opaque → glass). Same DOM element throughout — the morph is
// a pure CSS state change, not a swap. Skeleton rows stay until
// loadLeaderboard() overwrites them with the real data; that
// fetch runs concurrently with iframe boot.
let _bootEnded = false;
function endBoot() {
if (_bootEnded) return;
_bootEnded = true;
document.body.classList.remove('is-booting');
}
if (bgFrame && (_isCoarse || _isNarrow)) {
bgFrame.remove();
// No live scene to wait on — end boot immediately so the