Repository navigation
Expand file tree
/
Copy pathgrail.html
More file actions
1054 lines (991 loc) · 45.7 KB
/
Copy pathgrail.html
File metadata and controls
1054 lines (991 loc) · 45.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">
<title>RAPP Grail</title>
<meta name="description" content="A shareable permalink for any agent in the RAPP registry — card art, provenance, source, install command. Static, content-addressable.">
<meta property="og:title" content="RAPP Grail">
<meta property="og:description" content="Card art + agent.py source + cryptographic provenance, on a shareable static URL.">
<style>
:root {
--bg: #0d1117;
--surface: #161b22;
--surface2: #21262d;
--surface3: #2d333b;
--border: #30363d;
--border-hover: #484f58;
--text: #e6edf3;
--text-dim: #8b949e;
--text-muted: #656d76;
--accent: #58a6ff;
--accent2: #bc8cff;
--green: #3fb950;
--red: #f85149;
--amber: #d29922;
--mana-w: #f9e8c2;
--mana-u: #aae0fa;
--mana-b: #cbc2bf;
--mana-r: #f9aa8f;
--mana-g: #9bd3ae;
--mana-c: #ccc2c0;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
header {
background: var(--surface); border-bottom: 1px solid var(--border);
padding: 14px 32px; display: flex; align-items: center; justify-content: space-between;
position: sticky; top: 0; z-index: 50;
}
.logo {
display: flex; align-items: center; gap: 10px;
font-size: 1.15rem; font-weight: 700; text-decoration: none; color: var(--text);
}
.logo:hover { text-decoration: none; }
.logo-mark {
background: linear-gradient(135deg, var(--accent), var(--accent2));
color: #fff; width: 32px; height: 32px; border-radius: 8px;
display: flex; align-items: center; justify-content: center;
font-size: .85rem; font-weight: 800;
}
.header-right { display: flex; align-items: center; gap: 12px; }
.back-link {
background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim);
padding: 6px 14px; border-radius: 8px; font-size: .85rem; text-decoration: none;
}
.back-link:hover { border-color: var(--border-hover); color: var(--text); text-decoration: none; }
.container { max-width: 1180px; margin: 0 auto; padding: 32px 24px; }
/* Top split: card on left, metadata on right */
.top {
display: grid; grid-template-columns: 380px 1fr;
gap: 32px; align-items: start;
}
@media (max-width: 900px) {
.top { grid-template-columns: 1fr; }
}
/* ── Holo card frame (ported from store.html — MTG-style) ─────── */
.agent-card-wrap {
position: relative; width: 100%; max-width: 380px;
aspect-ratio: 5 / 7; perspective: 1200px;
--mx: 50%; --my: 50%; --px: 0.5; --py: 0.5; --angle: 0deg;
}
@keyframes holoShimmer {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
@keyframes holoRainbow {
0% { filter: hue-rotate(0deg); }
100% { filter: hue-rotate(360deg); }
}
@keyframes holoScanScroll { to { background-position-y: 200px; } }
@keyframes holoOrbitA {
0% { background-position: 0% 0%; }
25% { background-position: 100% 0%; }
50% { background-position: 100% 100%; }
75% { background-position: 0% 100%; }
100% { background-position: 0% 0%; }
}
@keyframes holoOrbitB {
0% { background-position: 100% 100%; }
25% { background-position: 0% 100%; }
50% { background-position: 0% 0%; }
75% { background-position: 100% 0%; }
100% { background-position: 100% 100%; }
}
@keyframes rarityPulse {
0%, 100% { box-shadow: 0 0 10px currentColor; transform: scale(1); }
50% { box-shadow: 0 0 18px currentColor, 0 0 30px currentColor; transform: scale(1.15); }
}
.agent-card-holo {
position: absolute; inset: 0; border-radius: 14px;
-webkit-backface-visibility: hidden; backface-visibility: hidden;
overflow: hidden; border: 3px solid #c9a84c;
background: linear-gradient(160deg, #2a2418 0%, #1a1510 40%, #1f1a12 100%);
display: flex; flex-direction: column; padding: 0;
box-shadow: 0 24px 60px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,215,0,.08);
}
.agent-card-holo::before {
content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
background: linear-gradient(125deg,
transparent 0%, rgba(255,0,128,.06) 15%, rgba(0,200,255,.08) 30%, transparent 40%,
rgba(255,215,0,.06) 55%, rgba(128,0,255,.07) 70%, transparent 80%,
rgba(0,255,128,.05) 90%, transparent 100%);
background-size: 300% 300%;
animation: holoShimmer 6s ease-in-out infinite;
mix-blend-mode: screen;
transition: background-position .1s ease;
}
.agent-card-holo .holo-shimmer-track {
position: absolute; inset: 0; z-index: 4; pointer-events: none;
background: radial-gradient(ellipse 60% 80% at var(--mx, 50%) var(--my, 50%),
rgba(255,255,255,.22) 0%, rgba(255,220,150,.10) 20%, rgba(0,200,255,.06) 40%, transparent 70%);
opacity: 0; transition: opacity .3s ease;
mix-blend-mode: screen;
}
.agent-card-wrap:hover .holo-shimmer-track { opacity: 1; }
.agent-card-holo .holo-prism {
position: absolute; inset: 0; z-index: 2; pointer-events: none;
background: linear-gradient(calc(var(--angle, 0deg) + 90deg),
rgba(255,0,80,.0) 0%, rgba(255,0,120,.10) 12%, rgba(255,165,0,.08) 22%,
rgba(255,255,0,.06) 32%, rgba(0,255,100,.08) 42%, rgba(0,180,255,.10) 52%,
rgba(100,0,255,.08) 62%, rgba(255,0,200,.06) 72%, rgba(255,0,80,.0) 82%);
opacity: 0; transition: opacity .3s ease;
mix-blend-mode: screen;
}
.agent-card-wrap:hover .holo-prism { opacity: 1; }
.holo-fresnel {
position: absolute; inset: 0; z-index: 2; pointer-events: none;
border-radius: inherit; opacity: 0; transition: opacity .3s;
background: radial-gradient(ellipse at var(--mx, 50%) var(--my, 50%),
transparent 30%, rgba(0,255,255,.1) 60%, rgba(255,0,255,.15) 100%);
mix-blend-mode: screen;
}
.agent-card-wrap:hover .holo-fresnel { opacity: 1; }
.holo-scanlines {
position: absolute; inset: 0; z-index: 3; pointer-events: none;
border-radius: inherit; opacity: 0; transition: opacity .3s;
background: repeating-linear-gradient(0deg,
transparent 0px, transparent 2px,
rgba(0,255,255,.025) 2px, rgba(0,255,255,.025) 4px);
animation: holoScanScroll 4s linear infinite;
mix-blend-mode: screen;
}
.agent-card-wrap:hover .holo-scanlines { opacity: 1; }
.holo-orbit-cyan, .holo-orbit-magenta {
position: absolute; inset: 0; z-index: 1; pointer-events: none;
border-radius: inherit; opacity: 0; transition: opacity .3s;
mix-blend-mode: screen; background-size: 200% 200%;
}
.agent-card-wrap:hover .holo-orbit-cyan,
.agent-card-wrap:hover .holo-orbit-magenta { opacity: 1; }
.holo-orbit-cyan {
background: radial-gradient(circle at 30% 30%, rgba(0,255,255,.1), transparent 50%);
animation: holoOrbitA 6s linear infinite;
}
.holo-orbit-magenta {
background: radial-gradient(circle at 70% 70%, rgba(255,0,255,.1), transparent 50%);
animation: holoOrbitB 6s linear infinite;
}
.agent-card-holo::after {
content: ''; position: absolute; inset: 0; z-index: 3; pointer-events: none;
background: repeating-linear-gradient(
calc(105deg + var(--angle, 0deg) * 0.3),
transparent 0px, rgba(255,255,255,.025) 1px, transparent 3px,
rgba(255,255,255,.015) 4px, transparent 6px);
mix-blend-mode: overlay;
}
.agent-card-holo:hover::before {
animation: none;
background: linear-gradient(calc(125deg + var(--angle, 0deg)),
transparent 0%, rgba(255,0,128,.14) 15%, rgba(0,200,255,.16) 30%, transparent 40%,
rgba(255,215,0,.14) 55%, rgba(128,0,255,.16) 70%, transparent 80%,
rgba(0,255,128,.12) 90%, transparent 100%);
background-size: 300% 300%;
background-position: var(--mx, 50%) var(--my, 50%);
}
.holo-header {
display: flex; justify-content: space-between; align-items: flex-start;
padding: 10px 14px 4px; position: relative; z-index: 5;
flex-shrink: 0; gap: 10px;
}
.holo-name {
font-size: 1rem; font-weight: 700; color: #f0e6d0;
text-shadow: 0 1px 3px rgba(0,0,0,.6);
line-height: 1.15; font-family: 'Cinzel', Georgia, serif;
}
.holo-title { font-size: .72rem; color: #c8a870; font-style: italic; margin-top: 2px; }
.holo-pips { display: flex; gap: 4px; }
.holo-pip {
width: 22px; height: 22px; border-radius: 50%; font-size: .7rem;
font-weight: 800; display: flex; align-items: center; justify-content: center;
border: 1.5px solid rgba(0,0,0,.5); text-shadow: 0 1px 2px rgba(0,0,0,.6);
box-shadow: 0 1px 4px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.2);
}
.holo-pip.W { background: #f9faf4; color: #333; }
.holo-pip.U { background: #0e68ab; color: #fff; }
.holo-pip.B { background: #150b00; color: #cbc2b6; border-color: #4a3f32; }
.holo-pip.R { background: #d3202a; color: #fff; }
.holo-pip.G { background: #00733e; color: #fff; }
.holo-pip.N, .holo-pip.C { background: #9e9e9e; color: #333; }
.holo-art {
margin: 0 12px; border: 2px solid #6a5a30;
border-radius: 4px;
overflow: hidden; display: flex; align-items: center; justify-content: center;
background: radial-gradient(ellipse at 50% 40%, rgba(40,35,20,.9) 0%, #0d0a06 70%);
position: relative; z-index: 5;
flex: 1 1 0; min-height: 0;
}
.holo-art::before {
content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
background: radial-gradient(ellipse at 50% 50%, rgba(201,168,76,.12) 0%, rgba(201,168,76,.04) 40%, transparent 70%);
}
.holo-art svg {
width: 92%; height: 92%; position: relative; z-index: 2;
transform: translate(
calc((0.5 - var(--px, 0.5)) * 6px),
calc((0.5 - var(--py, 0.5)) * 6px)
) scale(1.04);
transition: transform .1s ease-out;
}
.holo-art::after {
content: ''; position: absolute; inset: -10%; pointer-events: none; z-index: 3;
background: linear-gradient(calc(135deg + var(--angle, 0deg)),
rgba(255,100,200,.12) 0%, transparent 25%,
rgba(100,200,255,.15) 45%, transparent 55%,
rgba(255,200,50,.10) 75%, transparent 100%);
background-size: 200% 200%;
background-position: var(--mx, 50%) var(--my, 50%);
animation: holoRainbow 8s linear infinite;
mix-blend-mode: screen;
transition: background-position .1s ease-out;
}
.agent-card-wrap:hover .holo-art::after { animation: none; }
.holo-type {
font-size: .72rem; color: #c8b89a; padding: 4px 14px;
border-top: 1px solid #4d4332; border-bottom: 1px solid #4d4332;
background: rgba(50,40,25,.6);
position: relative; z-index: 5;
flex-shrink: 0;
}
.holo-text {
padding: 7px 12px; overflow: hidden;
font-size: .74rem; color: #d8c8a8; line-height: 1.4;
background: rgba(30,25,15,.4); margin: 0;
position: relative; z-index: 5;
flex-shrink: 0;
}
.holo-ability { margin-bottom: 4px; }
.holo-ability .kw { font-weight: 700; color: #ffd700; }
.holo-flavor {
font-style: italic; font-size: .65rem; color: #9a8e7a;
border-top: 1px solid #3d3322; padding-top: 4px; margin-top: 5px;
line-height: 1.35;
}
.holo-footer {
display: flex; justify-content: space-between; align-items: center;
padding: 5px 14px 7px; font-size: .7rem;
position: relative; z-index: 5;
white-space: nowrap; overflow: hidden;
flex-shrink: 0; margin-top: auto;
}
.holo-rarity { text-transform: uppercase; letter-spacing: .5px; font-weight: 700; color: #8b7332; overflow: hidden; text-overflow: ellipsis; }
.holo-rarity.mythic { color: #ff8c00; text-shadow: 0 0 10px rgba(255,140,0,.6), 0 0 20px rgba(255,140,0,.3); }
.holo-rarity.rare { color: #ffd700; text-shadow: 0 0 8px rgba(255,215,0,.5), 0 0 16px rgba(255,215,0,.2); }
.holo-rarity.uncommon, .holo-rarity.core { color: #c0c0c0; text-shadow: 0 0 4px rgba(192,192,192,.3); }
.holo-rarity.common, .holo-rarity.starter { color: #8899aa; }
.holo-stats {
font-weight: 800; font-size: 1.15rem; color: #f0e6d0;
text-shadow: 0 1px 3px rgba(0,0,0,.6);
background: rgba(40,35,20,.6); padding: 2px 10px; border-radius: 4px;
border: 1px solid rgba(201,168,76,.3);
}
.holo-artist { font-style: italic; color: #c9a84c; }
.holo-promo { color: #ffd700; font-weight: 700; font-size: .6rem; letter-spacing: .5px; }
.holo-rarity-gem {
position: absolute; top: 8px; right: -1px; z-index: 6;
width: 18px; height: 18px; border-radius: 50%;
border: 2px solid rgba(255,255,255,.4);
pointer-events: none;
}
.holo-rarity-gem.mythic {
background: radial-gradient(circle, #ffaa00, #ff6600);
box-shadow: 0 0 10px rgba(255,140,0,.8), 0 0 20px rgba(255,140,0,.4);
animation: rarityPulse 2s ease-in-out infinite;
}
.holo-rarity-gem.rare {
background: radial-gradient(circle, #ffe44d, #ffc800);
box-shadow: 0 0 8px rgba(255,215,0,.7), 0 0 16px rgba(255,215,0,.3);
animation: rarityPulse 2.5s ease-in-out infinite;
}
.holo-rarity-gem.uncommon, .holo-rarity-gem.core {
background: radial-gradient(circle, #e0e0e0, #a0a0a0);
box-shadow: 0 0 6px rgba(192,192,192,.5);
}
.holo-rarity-gem.common, .holo-rarity-gem.starter {
background: radial-gradient(circle, #8899aa, #667788);
box-shadow: 0 0 4px rgba(100,120,140,.3);
}
/* ── Metadata column ────────────────────────────────────────────── */
.meta h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 4px; }
.meta .subtitle { color: var(--text-dim); margin-bottom: 24px; font-size: .95rem; }
.meta .pub-pill {
display: inline-flex; align-items: center; gap: 8px;
background: var(--surface); border: 1px solid var(--border);
padding: 4px 12px; border-radius: 16px; font-size: .82rem;
color: var(--accent); font-weight: 600; margin-right: 8px; text-decoration: none;
}
.meta .pub-pill:hover { border-color: var(--accent); text-decoration: none; }
.meta .ver-pill {
display: inline-block; background: var(--surface);
border: 1px solid var(--border); padding: 4px 10px; border-radius: 16px;
font-size: .8rem; color: var(--text-dim); font-family: ui-monospace, monospace;
}
.section { margin-top: 28px; }
.section h2 { font-size: .95rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 10px; }
.install {
background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.install code { font-size: .85rem; color: var(--accent); user-select: all; word-break: break-all; }
.copy-btn {
background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim);
padding: 6px 12px; border-radius: 6px; font-size: .75rem; cursor: pointer;
font-weight: 600; white-space: nowrap;
}
.copy-btn:hover { border-color: var(--border-hover); color: var(--text); }
.copy-btn.copied { color: var(--green); border-color: rgba(63,185,80,.4); }
.provenance {
background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
padding: 14px 16px; font-size: .85rem;
}
.provenance .row { display: flex; gap: 12px; margin-bottom: 8px; }
.provenance .row:last-child { margin-bottom: 0; }
.provenance .label { color: var(--text-muted); min-width: 140px; flex-shrink: 0; }
.provenance .value { color: var(--text); font-family: ui-monospace, monospace; word-break: break-all; }
.provenance .value a { color: var(--accent); }
.provenance .hash { color: var(--text-dim); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
background: var(--surface2); border: 1px solid var(--border);
padding: 3px 9px; border-radius: 12px; font-size: .72rem; color: var(--text-dim);
}
.share-row { display: flex; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.share-btn {
background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
padding: 8px 14px; border-radius: 8px; font-size: .82rem; text-decoration: none;
display: inline-flex; align-items: center; gap: 6px;
}
.share-btn:hover { border-color: var(--border-hover); color: var(--text); text-decoration: none; }
/* ── Summon section (QR code) ───────────────────────────────── */
.summon-section {
margin-top: 40px; border-top: 1px solid var(--border); padding-top: 32px;
display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center;
}
@media (max-width: 720px) {
.summon-section { grid-template-columns: 1fr; text-align: center; }
}
.summon-qr {
background: #fff; border-radius: 16px; padding: 14px;
width: 280px; height: 280px;
box-shadow: 0 12px 40px rgba(0,0,0,.5), 0 0 0 1px var(--border);
display: flex; align-items: center; justify-content: center;
margin: 0 auto;
}
.summon-qr img { width: 100%; height: 100%; display: block; }
.summon-info h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 8px; color: var(--text); text-transform: none; letter-spacing: 0; }
.summon-info p { color: var(--text-dim); font-size: .95rem; margin-bottom: 14px; line-height: 1.55; }
.summon-link {
background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
padding: 10px 12px; display: flex; align-items: center; gap: 10px;
font-family: ui-monospace, SFMono-Regular, monospace; font-size: .78rem;
color: var(--accent); word-break: break-all; user-select: all;
}
.summon-link button {
flex-shrink: 0; background: var(--surface2); border: 1px solid var(--border);
color: var(--text-dim); padding: 5px 10px; border-radius: 6px;
font-size: .72rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.summon-link button:hover { color: var(--text); border-color: var(--border-hover); }
.summon-link button.copied { color: var(--green); border-color: rgba(63,185,80,.4); }
.summon-cta {
display: inline-flex; align-items: center; gap: 8px;
background: linear-gradient(135deg, var(--accent), var(--accent2));
color: #fff; padding: 10px 18px; border-radius: 8px; font-size: .9rem;
font-weight: 700; text-decoration: none; margin-top: 14px;
}
.summon-cta:hover { text-decoration: none; opacity: .92; }
.share-btn {
display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; margin-left: 10px;
background: var(--surface2); color: var(--text); border: 1px solid var(--border);
padding: 10px 18px; border-radius: 8px; font-size: .9rem; font-weight: 700;
cursor: pointer; font-family: inherit;
}
.share-btn:hover { border-color: var(--accent); color: var(--accent); }
/* ── Fullscreen card overlay (tap card → expand, tilt to shine) ── */
.fs-overlay {
position: fixed; inset: 0; z-index: 999;
background: radial-gradient(ellipse at 50% 50%, #0a0d14 0%, #000 80%);
display: none; align-items: center; justify-content: center;
-webkit-tap-highlight-color: transparent;
touch-action: none;
}
.fs-overlay.open { display: flex; }
.fs-overlay .agent-card-wrap {
width: min(86vw, calc(86vh * 5 / 7));
max-width: 540px; aspect-ratio: 5 / 7;
filter: drop-shadow(0 30px 80px rgba(0,0,0,.7));
}
.fs-close {
position: absolute; top: max(env(safe-area-inset-top), 14px); right: 14px;
background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.18);
width: 44px; height: 44px; border-radius: 50%;
display: flex; align-items: center; justify-content: center;
font-size: 1.4rem; line-height: 1; cursor: pointer; z-index: 10;
-webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.fs-tilt-prompt {
position: absolute; bottom: calc(max(env(safe-area-inset-bottom), 24px) + 76px); left: 50%;
transform: translateX(-50%);
background: rgba(0,0,0,.55); color: #f0e6d0; padding: 10px 18px;
border-radius: 999px; font-size: .82rem; border: 1px solid rgba(255,215,0,.3);
-webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
cursor: pointer; user-select: none;
}
.fs-hint {
position: absolute; top: max(env(safe-area-inset-top), 14px); left: 14px;
color: rgba(255,255,255,.55); font-size: .75rem; letter-spacing: .3px;
pointer-events: none;
}
/* Primary action on the fullscreen card — summon straight into vBrainstem */
.fs-actions {
position: absolute; left: 50%; transform: translateX(-50%); z-index: 12;
bottom: max(env(safe-area-inset-bottom), 20px);
display: flex; gap: 10px; align-items: center; max-width: calc(100vw - 28px);
}
.fs-summon-cta, .fs-share-cta {
display: inline-flex; align-items: center; justify-content: center; gap: 9px;
padding: 15px 24px; border-radius: 13px; border: none; cursor: pointer;
font-size: 1.02rem; font-weight: 800; text-decoration: none; white-space: nowrap;
font-family: inherit; -webkit-tap-highlight-color: transparent;
}
.fs-summon-cta {
background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
box-shadow: 0 12px 34px rgba(0,0,0,.55), 0 0 26px rgba(255,215,0,.28);
}
.fs-share-cta {
background: rgba(255,255,255,.10); color: #fff; border: 1px solid rgba(255,255,255,.22);
-webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.fs-summon-cta:active, .fs-share-cta:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) {
/* Desktop: card is clickable but doesn't auto-fullscreen */
.agent-card-wrap { cursor: zoom-in; }
}
.loading, .error {
text-align: center; padding: 80px 20px; color: var(--text-dim);
}
.error { color: var(--red); }
.error-detail { color: var(--text-muted); margin-top: 12px; font-size: .85rem; }
@media (max-width: 640px) {
header { padding: 12px 16px; }
.container { padding: 20px 16px; }
}
</style>
</head>
<body>
<header>
<a class="logo" href="index.html">
<div class="logo-mark">R</div>
<span>RAPP Grail</span>
</a>
<div class="header-right">
<a class="back-link" href="index.html">All cards</a>
</div>
</header>
<div class="container" id="root">
<div class="loading" id="initial-loading">Loading card…</div>
</div>
<script>
const REGISTRY_URL = 'registry.json';
const CARDS_URL = 'cards/holo_cards.json';
const RAW_BASE = 'https://raw.githubusercontent.com/kody-w/RAR';
// Standalone-export mode — when these are populated, the page skips its
// network fetches and renders from inlined data. The "Download Standalone"
// button on the live page produces a copy with these set.
window.__INLINED_AGENT__ = null;
window.__INLINED_CARD__ = null;
window.__INLINED_PY__ = null;
window.__INLINED_AT__ = null;
function esc(s) { const d = document.createElement('div'); d.textContent = String(s ?? ''); return d.innerHTML; }
function shortSha(s) { return s ? String(s).slice(0, 8) : '—'; }
function parseManaCost(cost) {
if (!cost) return [];
// {1}{G}{W}{R} → ['1', 'G', 'W', 'R']
const out = [];
const re = /\{([^}]+)\}/g;
let m;
while ((m = re.exec(cost))) out.push(m[1]);
return out;
}
const SUMMON_BASE = 'https://kody-w.github.io/vbrainstem/';
function summonUrl(name) {
return `${SUMMON_BASE}?agent=${encodeURIComponent(name)}`;
}
// Share the actual agent.py through the native share sheet (Mail / Messages /
// Teams / …). Falls back to sharing a link, then to copying the raw URL.
async function shareAgentPy(url, filename, title, btn) {
const label = btn ? btn.textContent : '';
const restore = () => { if (btn) setTimeout(() => { btn.textContent = label; }, 1600); };
try {
let file = null;
try {
const res = await fetch(url, { cache: 'no-store' });
if (res.ok) file = new File([await res.text()], filename, { type: 'text/x-python' });
} catch (e) { /* offline / CORS — fall back to link share */ }
// 1) Share the real .py file as an attachment (iOS/Android Web Share L2).
if (file && navigator.canShare && navigator.canShare({ files: [file] })) {
await navigator.share({ files: [file], title: filename, text: `${title} — RAPP single-file agent` });
return;
}
// 2) No file-share support — share a link + text.
if (navigator.share) {
await navigator.share({ title, text: `${title} — RAPP agent (agent.py): ${url}`, url });
return;
}
// 3) Desktop / no Web Share — copy the raw .py URL.
await navigator.clipboard.writeText(url);
if (btn) { btn.textContent = '✓ link copied'; restore(); }
} catch (e) {
if (e && e.name === 'AbortError') return; // user dismissed the sheet
try {
await navigator.clipboard.writeText(url);
if (btn) { btn.textContent = '✓ link copied'; restore(); }
} catch (_) {}
}
}
function qrSrc(data, size = 540) {
// Same QR provider store.html uses — no new dep.
return `https://api.qrserver.com/v1/create-qr-code/?size=${size}x${size}&margin=8&qzone=2&format=png&data=${encodeURIComponent(data)}`;
}
async function load() {
const root = document.getElementById('root');
const isInlined = !!window.__INLINED_AGENT__;
let key = decodeURIComponent(location.hash.slice(1)).trim();
if (!key && isInlined) {
key = window.__INLINED_AGENT__.name || '';
}
if (!key) {
root.innerHTML = `
<div class="error">
<h2>No agent specified</h2>
<div class="error-detail">Append <code>#@publisher/agent_name</code> to the URL.<br>
Example: <code>grail.html#@howardh/chief_of_staff_agent</code></div>
</div>`;
return;
}
let registry, cards, agent, card;
if (isInlined) {
// Standalone copy — registry + card data baked into this HTML file.
registry = { agents: [window.__INLINED_AGENT__] };
cards = window.__INLINED_CARD__
? { [window.__INLINED_AGENT__.name]: window.__INLINED_CARD__ }
: {};
} else {
try {
[registry, cards] = await Promise.all([
fetch(REGISTRY_URL + '?t=' + Date.now()).then(r => r.json()),
fetch(CARDS_URL + '?t=' + Date.now()).then(r => r.json()),
]);
} catch (e) {
root.innerHTML = `<div class="error"><h2>Failed to load registry</h2><div class="error-detail">${esc(e.message)}</div></div>`;
return;
}
}
// Try exact match, then dash/underscore variants
const variants = [key, key.replace(/_/g, '-'), key.replace(/-/g, '_')];
for (const v of variants) {
if (!agent) agent = (registry.agents || []).find(a => a.name === v) || (registry.swarms || []).find(a => a.name === v);
if (!card) card = cards[v];
}
if (!agent) {
root.innerHTML = `
<div class="error">
<h2>Agent not found in registry</h2>
<div class="error-detail">No entry for <code>${esc(key)}</code>.<br>
<a href="index.html">Browse all cards</a></div>
</div>`;
return;
}
if (!card) card = {};
const rarity = card.rarity || 'common';
// Mana pips: prefer mana_cost string ({3}{N}{R}), fall back to colors[]
const manaSyms = card.mana_cost ? parseManaCost(card.mana_cost) : (card.colors || []);
const manaPipsHtml = manaSyms.map(sym => {
const code = String(sym).toUpperCase();
const cls = 'WUBRGN'.includes(code) ? code : 'C';
return `<span class="holo-pip ${cls}">${esc(sym)}</span>`;
}).join('');
const abilitiesHtml = (card.abilities || []).slice(0, 3).map(a => {
const kw = a.keyword + (a.cost ? ` ${a.cost}` : '');
return `<div class="holo-ability"><span class="kw">${esc(kw)}:</span> ${esc(a.text || '')}</div>`;
}).join('');
const filePath = agent._file || '';
const firstSha = agent._first_commit_sha || '';
const latestSha = agent._latest_commit_sha || '';
const py_url_main = `${RAW_BASE}/main/${filePath}`;
const py_url_pinned = latestSha ? `${RAW_BASE}/${latestSha}/${filePath}` : py_url_main;
const avatar = card.avatar_svg
? card.avatar_svg
: `<svg viewBox="0 0 200 200"><rect width="200" height="200" fill="#0d0a06"/><text x="100" y="105" text-anchor="middle" fill="#c9a84c" font-size="14" font-family="monospace">${esc(agent.display_name || agent.name.split('/').pop())}</text></svg>`;
const publisher = (agent.name || '').split('/')[0];
const slug = (agent.name || '').split('/').slice(1).join('/');
const setCode = card.set_code || 'HOLO';
const rarityLabel = rarity.charAt(0).toUpperCase() + rarity.slice(1);
const power = card.power, toughness = card.toughness;
const ptHtml = (power != null && toughness != null)
? `<span class="holo-stats">${esc(power)}/${esc(toughness)}</span>` : '';
root.innerHTML = `
<div class="top">
<div class="agent-card-wrap" id="holo-wrap">
<div class="agent-card-holo">
<div class="holo-rarity-gem ${rarity}"></div>
<div class="holo-shimmer-track"></div>
<div class="holo-prism"></div>
<div class="holo-fresnel"></div>
<div class="holo-scanlines"></div>
<div class="holo-orbit-cyan"></div>
<div class="holo-orbit-magenta"></div>
<div class="holo-header">
<div style="min-width:0;flex:1;overflow:hidden">
<div class="holo-name">${esc(card.name || agent.display_name || slug)}</div>
${card.title ? `<div class="holo-title">${esc(card.title)}</div>` : ''}
</div>
<div class="holo-pips" style="flex-shrink:0">${manaPipsHtml}</div>
</div>
<div class="holo-art">${avatar}</div>
<div class="holo-type">${esc(card.type_line || 'Creature — Agent')}</div>
<div class="holo-text">
${abilitiesHtml || `<div class="holo-ability">${esc(agent.description || '')}</div>`}
${card.flavor_text ? `<div class="holo-flavor">${esc(card.flavor_text)}</div>` : ''}
</div>
<div class="holo-footer">
<span class="holo-rarity ${rarity}">${esc(setCode)}${card.promo ? ' <span class="holo-promo">★ Promo</span>' : ''} • ${esc(rarityLabel)}${card.artist ? ` • <span class="holo-artist">${esc(card.artist)}</span>` : ''}</span>
${ptHtml}
</div>
</div>
</div>
<div class="meta">
<h1>${esc(agent.display_name || slug)}</h1>
<p class="subtitle">${esc(agent.description || '')}</p>
<div>
<a class="pub-pill" href="index.html?publisher=${encodeURIComponent(publisher)}">${esc(publisher)}</a>
<span class="ver-pill">v${esc(agent.version || '0.0.0')}</span>
${agent.quality_tier ? `<span class="ver-pill" style="margin-left:6px">${esc(agent.quality_tier)}</span>` : ''}
</div>
<div class="section">
<h2>Install</h2>
<div class="install">
<code id="install-cmd">python rapp_sdk.py install ${esc(agent.name)}</code>
<button class="copy-btn" data-copy="install-cmd">copy</button>
</div>
</div>
<div class="section">
<h2>Provenance</h2>
<div class="provenance">
<div class="row">
<div class="label">Source file</div>
<div class="value"><a href="${py_url_main}" target="_blank">${esc(filePath || 'unknown')}</a></div>
</div>
<div class="row">
<div class="label">First commit</div>
<div class="value">
${firstSha ? `<a href="https://github.com/kody-w/RAR/commit/${firstSha}" target="_blank">${shortSha(firstSha)}</a>` : '<span class="hash">—</span>'}
${agent._added_at ? `<span class="hash"> · ${esc(agent._added_at)}</span>` : ''}
</div>
</div>
<div class="row">
<div class="label">Latest commit</div>
<div class="value">
${latestSha ? `<a href="https://github.com/kody-w/RAR/commit/${latestSha}" target="_blank">${shortSha(latestSha)}</a>` : '<span class="hash">—</span>'}
</div>
</div>
<div class="row">
<div class="label">Source sha256</div>
<div class="value hash">${esc(agent._sha256 || '—')}</div>
</div>
${agent._card_sha256 ? `
<div class="row">
<div class="label">Card sha256</div>
<div class="value hash">${esc(agent._card_sha256)}</div>
</div>` : ''}
<div class="row">
<div class="label">Pinned raw URL</div>
<div class="value"><a href="${py_url_pinned}" target="_blank">raw @ ${shortSha(latestSha)}</a></div>
</div>
</div>
</div>
${(agent.tags || []).length ? `
<div class="section">
<h2>Tags</h2>
<div class="tags">${(agent.tags || []).map(t => `<span class="tag">${esc(t)}</span>`).join('')}</div>
</div>` : ''}
<div class="share-row">
<a class="share-btn" href="javascript:void(0)" id="share-link">📋 Copy permalink</a>
<a class="share-btn" href="${py_url_main}" target="_blank">📄 Raw .py</a>
<a class="share-btn" href="https://github.com/kody-w/RAR/blob/main/${filePath}" target="_blank">🔗 GitHub</a>
${isInlined
? '<span class="share-btn" style="opacity:0.65;cursor:default" title="This file is a self-contained standalone Grail — the agent data is baked in. No network required to render this card.">✓ Standalone copy</span>'
: '<a class="share-btn" href="javascript:void(0)" id="export-grail" title="Download this card as a single self-contained .html file — works offline, contains the full agent.py, can be emailed or AirDropped">📥 Standalone .html</a>'}
</div>
</div>
</div>
<div class="summon-section">
<div class="summon-qr">
<img src="${qrSrc(summonUrl(agent.name))}" alt="QR — Summon ${esc(agent.display_name || slug)} on your Virtual Brainstem" loading="eager">
</div>
<div class="summon-info">
<h2>Summon to your Brainstem</h2>
<p>Scan with any phone camera — opens this agent in your Virtual Brainstem and enables it instantly. Tap the card to view it fullscreen with tilt-shine effects.</p>
<div class="summon-link">
<span id="summon-url">${esc(summonUrl(agent.name))}</span>
<button data-copy="summon-url">copy</button>
</div>
<a class="summon-cta" href="${summonUrl(agent.name)}">⚡ Use in vBrainstem →</a>
<button class="share-btn" data-share-url="${py_url_pinned}" data-share-file="${esc((filePath.split('/').pop()) || 'agent.py')}" data-share-title="${esc(agent.display_name || slug)}">📤 Share .py</button>
</div>
</div>
<div class="fs-overlay" id="fs-overlay" aria-hidden="true">
<div class="fs-hint">Tilt to shine</div>
<button class="fs-close" id="fs-close" aria-label="Close fullscreen">×</button>
<div class="agent-card-wrap" id="fs-wrap"></div>
<div class="fs-actions">
<a class="fs-summon-cta" href="${summonUrl(agent.name)}">⚡ Use in vBrainstem</a>
<button class="fs-share-cta" data-share-url="${py_url_pinned}" data-share-file="${esc((filePath.split('/').pop()) || 'agent.py')}" data-share-title="${esc(agent.display_name || slug)}">📤 Share</button>
</div>
<div class="fs-tilt-prompt" id="fs-tilt-prompt" style="display:none">Tap to enable motion</div>
</div>
`;
// Wire up all copy buttons (install command, summon URL, etc.)
document.querySelectorAll('button[data-copy]').forEach(btn => {
btn.onclick = () => {
const target = document.getElementById(btn.dataset.copy);
navigator.clipboard.writeText(target.textContent).then(() => {
const orig = btn.textContent;
btn.textContent = '✓ copied';
btn.classList.add('copied');
setTimeout(() => { btn.textContent = orig === '✓ copied' ? 'copy' : orig; btn.classList.remove('copied'); }, 1500);
});
};
});
// Wire share buttons — send the actual agent.py via the native share sheet.
document.querySelectorAll('[data-share-url]').forEach(btn => {
btn.addEventListener('click', () => shareAgentPy(btn.dataset.shareUrl, btn.dataset.shareFile || 'agent.py', btn.dataset.shareTitle || 'RAPP agent', btn));
});
// Cursor-tracked shimmer / prism / parallax on the holo card
const wrap = document.getElementById('holo-wrap');
const holo = wrap?.querySelector('.agent-card-holo');
if (wrap && holo) {
const onMove = (cx, cy) => {
const rect = wrap.getBoundingClientRect();
const x = (cx - rect.left) / rect.width;
const y = (cy - rect.top) / rect.height;
const angle = (Math.atan2(y - 0.5, x - 0.5) * 180 / Math.PI).toFixed(0);
const mxPct = (x * 100).toFixed(0) + '%';
const myPct = (y * 100).toFixed(0) + '%';
holo.style.setProperty('--mx', mxPct);
holo.style.setProperty('--my', myPct);
holo.style.setProperty('--px', x.toFixed(3));
holo.style.setProperty('--py', y.toFixed(3));
holo.style.setProperty('--angle', angle + 'deg');
const shimmer = holo.querySelector('.holo-shimmer-track');
if (shimmer) { shimmer.style.setProperty('--mx', mxPct); shimmer.style.setProperty('--my', myPct); }
};
wrap.addEventListener('mousemove', e => onMove(e.clientX, e.clientY));
wrap.addEventListener('touchmove', e => { const t = e.touches[0]; if (t) onMove(t.clientX, t.clientY); }, { passive: true });
}
document.getElementById('share-link').onclick = () => {
navigator.clipboard.writeText(location.href).then(() => {
const el = document.getElementById('share-link');
const orig = el.textContent;
el.textContent = '✓ copied';
setTimeout(() => { el.textContent = orig; }, 1500);
});
};
// ── Standalone export ────────────────────────────────────────────
// Fetch our own HTML source, inline the registry entry + card data +
// agent.py source as JS literals, trigger a Blob download. The result
// is a single .html file that renders the same card offline. The
// recipient just opens it in a browser — no network, no server, no SDK.
const exportBtn = document.getElementById('export-grail');
if (exportBtn) {
exportBtn.onclick = async () => {
const orig = exportBtn.textContent;
exportBtn.textContent = '⏳ Preparing…';
exportBtn.style.pointerEvents = 'none';
try {
// Fetch our own HTML source — same-origin on the live site.
const htmlResp = await fetch(location.pathname || 'grail.html');
if (!htmlResp.ok) throw new Error(`Failed to load page source (${htmlResp.status})`);
let html = await htmlResp.text();
// Optionally embed the agent.py source so the standalone is truly portable.
let pySource = null;
try {
const pyResp = await fetch(py_url_main);
if (pyResp.ok) pySource = await pyResp.text();
} catch (_) { /* non-fatal — card still renders without the .py */ }
// JSON-stringify everything (safe inside <script> blocks).
const sAgent = JSON.stringify(agent);
const sCard = JSON.stringify(card);
const sPy = pySource !== null ? JSON.stringify(pySource) : 'null';
const sAt = JSON.stringify(new Date().toISOString());
// Replace the null shims with the real data. The shims only appear
// once each at the top of the script block, so simple replace is safe.
html = html
.replace('window.__INLINED_AGENT__ = null;', `window.__INLINED_AGENT__ = ${sAgent};`)
.replace('window.__INLINED_CARD__ = null;', `window.__INLINED_CARD__ = ${sCard};`)
.replace('window.__INLINED_PY__ = null;', `window.__INLINED_PY__ = ${sPy};`)
.replace('window.__INLINED_AT__ = null;', `window.__INLINED_AT__ = ${sAt};`);
// Filename: @publisher_slug.grail.html (sanitized for filesystem safety).
const safeName = (agent.name || 'card').replace(/[^a-zA-Z0-9_-]/g, '_');
const filename = `${safeName}.grail.html`;
const blob = new Blob([html], { type: 'text/html;charset=utf-8' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
a.remove();
URL.revokeObjectURL(url);
exportBtn.textContent = '✓ Downloaded';
} catch (e) {
console.error('Standalone export failed:', e);
exportBtn.textContent = '✗ Failed — see console';
} finally {
setTimeout(() => {
exportBtn.textContent = orig;
exportBtn.style.pointerEvents = '';
}, 2200);
}
};
}
// Update document title + meta
document.title = `${agent.display_name || slug} — RAPP Grail`;
const ogTitle = document.querySelector('meta[property="og:title"]');
if (ogTitle) ogTitle.setAttribute('content', `${agent.display_name || slug} — RAPP Grail`);
// ── Fullscreen tilt-shine mode ─────────────────────────────────
// Tap the card → expand into the fixed overlay. Re-bind motion handlers
// to the cloned card. On phones, also wire DeviceOrientation for the
// "shine" effect — tilt to make the holo shift like a real foil.
const overlay = document.getElementById('fs-overlay');
const fsWrap = document.getElementById('fs-wrap');
const fsClose = document.getElementById('fs-close');
const tiltPrompt = document.getElementById('fs-tilt-prompt');
let orientHandler = null;
let lastTarget = { mx: 50, my: 50, px: 0.5, py: 0.5, angle: 0 };
let current = { ...lastTarget };
let rafId = null;
function applyVars(holo) {
holo.style.setProperty('--mx', current.mx.toFixed(0) + '%');
holo.style.setProperty('--my', current.my.toFixed(0) + '%');
holo.style.setProperty('--px', current.px.toFixed(3));
holo.style.setProperty('--py', current.py.toFixed(3));
holo.style.setProperty('--angle', current.angle.toFixed(0) + 'deg');
const shimmer = holo.querySelector('.holo-shimmer-track');
if (shimmer) {
shimmer.style.setProperty('--mx', current.mx.toFixed(0) + '%');
shimmer.style.setProperty('--my', current.my.toFixed(0) + '%');
}
}
function tickTowards(holo) {
// Lerp toward target — feels like liquid, not jitter
const k = 0.18;
current.mx += (lastTarget.mx - current.mx) * k;
current.my += (lastTarget.my - current.my) * k;
current.px += (lastTarget.px - current.px) * k;
current.py += (lastTarget.py - current.py) * k;
// angle wraps; lerp via shortest path
let d = lastTarget.angle - current.angle;
if (d > 180) d -= 360;
if (d < -180) d += 360;
current.angle += d * k;
applyVars(holo);
rafId = requestAnimationFrame(() => tickTowards(holo));
}
function setTargetFromXY(x, y) {
lastTarget.mx = x * 100;
lastTarget.my = y * 100;
lastTarget.px = x;
lastTarget.py = y;
lastTarget.angle = Math.atan2(y - 0.5, x - 0.5) * 180 / Math.PI;
}
function openFullscreen() {
// Clone the holo card markup so the inline card keeps its own state
fsWrap.innerHTML = document.querySelector('#holo-wrap .agent-card-holo').outerHTML;
overlay.classList.add('open');
overlay.setAttribute('aria-hidden', 'false');
document.body.style.overflow = 'hidden';
const holo = fsWrap.querySelector('.agent-card-holo');
current = { mx: 50, my: 50, px: 0.5, py: 0.5, angle: 0 };
lastTarget = { ...current };
applyVars(holo);
rafId = requestAnimationFrame(() => tickTowards(holo));
// Touch / mouse drag inside the overlay
const onPoint = (cx, cy) => {
const r = fsWrap.getBoundingClientRect();
const x = Math.max(0, Math.min(1, (cx - r.left) / r.width));
const y = Math.max(0, Math.min(1, (cy - r.top) / r.height));
setTargetFromXY(x, y);
};
const onTouch = e => { const t = e.touches[0]; if (t) { onPoint(t.clientX, t.clientY); e.preventDefault(); } };
const onMouse = e => onPoint(e.clientX, e.clientY);
overlay._handlers = {
touchmove: onTouch, mousemove: onMouse,
};
overlay.addEventListener('touchmove', onTouch, { passive: false });
overlay.addEventListener('mousemove', onMouse);
// DeviceOrientation: "shine" via phone tilt
const supportsOrient = 'DeviceOrientationEvent' in window;
const needsPermission = supportsOrient && typeof DeviceOrientationEvent.requestPermission === 'function';
const bindOrient = () => {
orientHandler = (e) => {
// gamma: left-right tilt (-90..90), beta: front-back (-180..180)
const g = (e.gamma || 0);
const b = (e.beta || 0);