File size: 19,986 Bytes
7b46bf4
 
 
 
 
b921798
7b46bf4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3cedbca
7b46bf4
3cedbca
 
7b46bf4
 
 
 
10c2d7a
 
3cedbca
 
 
 
 
 
7b46bf4
 
6ea7c9c
10c2d7a
6ea7c9c
10c2d7a
6ea7c9c
7b46bf4
 
10c2d7a
 
7b46bf4
3cedbca
 
f03556a
10c2d7a
 
7b46bf4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47c4845
7b46bf4
 
 
 
 
 
 
3cedbca
10c2d7a
 
 
47c4845
10c2d7a
 
 
 
47c4845
 
10c2d7a
 
 
 
 
 
 
 
 
 
6ea7c9c
 
 
 
 
 
 
 
3cedbca
7b46bf4
 
 
 
 
 
 
e110d3f
7b46bf4
3cedbca
7b46bf4
 
 
 
 
 
 
3cedbca
7b46bf4
 
 
 
 
3cedbca
 
d13a922
7b46bf4
10c2d7a
 
 
7b46bf4
10c2d7a
7b46bf4
 
47c4845
7b46bf4
d13a922
 
 
 
 
7b46bf4
 
d13a922
 
7b46bf4
 
d13a922
21d84ff
7b46bf4
 
 
47c4845
d13a922
 
 
7b46bf4
 
 
3cedbca
47c4845
 
3cedbca
47c4845
3cedbca
7b46bf4
 
 
10c2d7a
 
 
 
 
 
 
 
 
 
 
 
3cedbca
47c4845
7b46bf4
d70f053
7b46bf4
f03556a
7b46bf4
 
 
 
 
 
 
10c2d7a
7b46bf4
66011b1
 
 
7b46bf4
47c4845
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66011b1
 
 
 
 
 
 
35af7e8
4fa2456
66011b1
 
 
21d84ff
66011b1
 
 
 
47c4845
 
 
7b46bf4
 
4fa2456
7b46bf4
47c4845
7b46bf4
 
 
 
 
 
 
 
 
 
 
3cedbca
 
47c4845
10c2d7a
 
 
 
7b46bf4
 
 
47c4845
 
 
f03556a
 
 
6ea7c9c
f03556a
d13a922
d70f053
f03556a
 
6ea7c9c
47c4845
f03556a
d70f053
 
 
f03556a
d13a922
7b46bf4
d13a922
3cedbca
d13a922
3cedbca
d13a922
3cedbca
6ea7c9c
3cedbca
d13a922
 
 
 
3cedbca
 
 
7b46bf4
47c4845
7b46bf4
47c4845
7b46bf4
d13a922
3cedbca
 
 
 
 
d13a922
3cedbca
47c4845
7b46bf4
 
 
d13a922
 
 
 
 
 
 
47c4845
6ea7c9c
47c4845
d70f053
47c4845
d70f053
47c4845
 
d13a922
 
 
7b46bf4
 
 
 
d70f053
7b46bf4
d13a922
7b46bf4
 
 
d13a922
7b46bf4
 
 
 
47c4845
7b46bf4
3cedbca
7b46bf4
 
 
 
 
 
 
 
 
10c2d7a
7b46bf4
 
 
 
 
 
 
 
 
 
 
3cedbca
10c2d7a
3cedbca
47c4845
10c2d7a
47c4845
10c2d7a
 
d70f053
10c2d7a
 
 
 
 
 
 
47c4845
10c2d7a
 
47c4845
 
3cedbca
 
47c4845
10c2d7a
 
 
 
 
 
 
 
 
 
 
3cedbca
47c4845
7b46bf4
 
 
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
<!DOCTYPE html>
<html lang="it">
<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>Matteo Bergamelli | Innovation Lab Candidate</title>

    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;700&display=swap" rel="stylesheet">
    
    <script src="https://aframe.io/releases/1.4.2/aframe.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/mind-ar@1.2.2/dist/mindar-image.prod.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/mind-ar@1.2.2/dist/mindar-image-aframe.prod.js"></script>

    <style>
        :root { 
            --neon-green: #00ff41; 
            --dark-bg: #050505; 
            --error-red: #ff0055;
        }
        
        html, body { 
            margin: 0; 
            padding: 0;
            width: 100%; 
            height: 100%; 
            background-color: transparent !important;
            font-family: 'Fira Code', monospace; 
            overflow: hidden;
            position: fixed;
        }

        /* --- ENGINE GRAFICO (Camera e Canvas) --- */
        
        /* Regole generali per video webcam */
        video:not(#vid):not(#manual-video) {
            position: fixed !important;
            top: 0 !important; 
            left: 0 !important; 
            width: 100vw !important;
            height: 100vh !important;
            object-fit: cover !important;
            z-index: -2 !important;
        }

        /* Nascondiamo il video sorgente AR */
        #vid {
            position: absolute; top: 0; left: 0; opacity: 0; z-index: -100; pointer-events: none;
        }
        
        .a-canvas {
            position: fixed !important; top: 0 !important; left: 0 !important;
            width: 100vw !important; height: 100vh !important;
            z-index: -1 !important;
        }
        
        a-scene {
            position: fixed !important; top: 0 !important; left: 0 !important;
            width: 100vw !important; height: 100vh !important;
        }
        
        .scanlines {
            background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.2));
            background-size: 100% 4px;
            position: fixed; inset: 0; pointer-events: none; 
            z-index: 10;
            opacity: 0.4;
        }

        .a-enter-vr-button { display: none !important; }

        #custom-loader {
            position: fixed; inset: 0; z-index: 9999; 
            background: #000; 
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            transition: opacity 0.5s ease-out;
            padding: 20px;
        }

        .glitch-text { animation: glitch 2s infinite; }
        @keyframes glitch {
            0% { transform: translate(0); }
            20% { transform: translate(-2px, 2px); }
            40% { transform: translate(-2px, -2px); }
            60% { transform: translate(2px, 2px); }
            80% { transform: translate(2px, -2px); }
            100% { transform: translate(0); }
        }

        .loader-track {
            width: 100%; max-width: 280px; height: 6px;
            background: #111; margin-top: 20px;
            overflow: hidden; border-radius: 4px;
        }
        .loader-fill {
            height: 100%; background: var(--neon-green); width: 0%;
            transition: width 0.1s linear; 
            box-shadow: 0 0 10px var(--neon-green);
        }

        .safe-area-y {
            padding-top: env(safe-area-inset-top, 20px);
            padding-bottom: env(safe-area-inset-bottom, 20px);
        }

        /* FALLBACK PLAYER STYLE (HTML OVERLAY) */
        #fallback-player {
            display: none; /* Nascosto di default */
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background-color: #000; /* Copre la camera */
            z-index: 5000;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }
        
        #fallback-player video {
            width: 100%;
            max-width: 600px;
            border: 2px solid var(--neon-green);
            border-radius: 10px;
            box-shadow: 0 0 20px rgba(0, 255, 65, 0.2);
            margin-bottom: 20px;
        }

        .animate-fade-in {
            animation: fadeIn 0.5s ease-out forwards;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
    </style>
</head>
<body>

    <!-- 1. LOADER -->
    <div id="custom-loader">
        <div class="text-[#00ff41] text-5xl font-black tracking-tighter glitch-text mb-4">
            INNOVATING
        </div>
        <div class="text-white/50 text-xs font-mono uppercase tracking-[0.2em] mb-2" id="load-msg">Initializing AR Core...</div>
        <div class="loader-track"><div class="loader-fill" id="progress-bar"></div></div>
        <div id="loading-percent" class="text-[#00ff41] font-mono text-xl mt-2 font-bold">0%</div>
    </div>

    <!-- 2. FX -->
    <div class="scanlines"></div>

    <!-- 3. UI LAYER -->
    <div id="ui-layer" class="fixed inset-0 z-[50] flex flex-col justify-between safe-area-y pointer-events-none">
        
        <!-- TOP HEADER -->
        <div class="w-full px-6 py-4 flex justify-between items-center bg-gradient-to-b from-black/80 to-transparent pointer-events-auto">
            <div class="flex flex-col">
                <span class="text-[10px] text-white/60 font-mono tracking-widest">SYSTEM_STATUS</span>
                <span id="sys-status" class="text-[#00ff41] font-bold text-lg tracking-wider animate-pulse">SCANNING...</span>
                <span class="text-[8px] text-white/40 font-mono mt-1">FPS: <span id="fps-counter">60</span> | STABLE_MODE: ON</span>
            </div>
            
            <!-- BUTTON X (LINK INDEX) - FIX: Ora è un tag 'a' cliccabile -->
            <a href="./index.html" class="w-10 h-10 flex items-center justify-center border border-[#00ff41]/50 rounded-full bg-black/40 backdrop-blur-md hover:bg-[#00ff41]/20 transition-colors pointer-events-auto cursor-pointer">
                <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#00ff41" stroke-width="2"><path d="M18 6L6 18M6 6l12 12"/></svg>
            </a>
        </div>

        <!-- MIRINO QUADRATO -->
        <div id="aim-overlay" class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 flex flex-col items-center justify-center transition-opacity duration-300">
            <div class="relative w-[50vw] h-[50vw] max-w-[200px] max-h-[200px] border border-white/20 rounded-xl">
                <div class="absolute -top-1 -left-1 w-4 h-4 border-t-2 border-l-2 border-[#00ff41]"></div>
                <div class="absolute -top-1 -right-1 w-4 h-4 border-t-2 border-r-2 border-[#00ff41]"></div>
                <div class="absolute -bottom-1 -left-1 w-4 h-4 border-b-2 border-l-2 border-[#00ff41]"></div>
                <div class="absolute -bottom-1 -right-1 w-4 h-4 border-b-2 border-r-2 border-[#00ff41]"></div>
                
                <div class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-full flex items-center justify-center">
                    <div class="w-8 h-[1px] bg-[#00ff41]/50"></div>
                    <div class="h-8 w-[1px] bg-[#00ff41]/50 absolute"></div>
                </div>
            </div>
            <div class="mt-4 bg-black/60 backdrop-blur px-3 py-1 rounded border border-[#00ff41]/30">
                <p class="text-[#00ff41] text-[10px] font-bold tracking-widest uppercase">Inquadra Sticker Volpe</p>
            </div>
        </div>

        <!-- BOTTOM CONTROLS -->
        <div class="w-full px-6 pb-6 pointer-events-auto flex flex-col items-center bg-gradient-to-t from-black/90 to-transparent">
            
            <button id="audio-btn" class="w-full max-w-xs h-12 bg-[#00ff41]/10 border border-[#00ff41] text-[#00ff41] font-bold text-sm uppercase tracking-[0.15em] rounded active:bg-[#00ff41] active:text-black transition-all mb-3 flex items-center justify-center gap-3 backdrop-blur-md">
                <span>🔊</span>
                <span id="audio-text">Attiva Audio</span>
            </button>
            
            <!-- Pulsante Fallback (Nascosto inizialmente) -->
            <button id="fallback-btn" class="hidden w-full max-w-xs h-12 bg-[#ff0055]/10 border border-[#ff0055] text-[#ff0055] font-bold text-sm uppercase tracking-[0.15em] rounded active:bg-[#ff0055] active:text-white transition-all mb-2 flex items-center justify-center gap-2 backdrop-blur-md animate-fade-in">
                <span>⚠️</span>
                <span>NON TROVO MARKER</span>
            </button>
        </div>
    </div>

    <!-- 4. FALLBACK PLAYER OVERLAY (HTML Puro) -->
    <div id="fallback-player">
        <h2 class="text-[#00ff41] text-xl font-bold mb-4 tracking-widest">MANUAL LINK</h2>
        <!-- Video separato per il fallback manuale -->
        <video id="manual-video" controls playsinline webkit-playsinline>
            <source src="./img/video.mp4" type="video/mp4">
        </video>
        <button id="close-manual-btn" class="mt-4 px-8 py-3 bg-[#ff0055] text-white font-bold uppercase rounded tracking-widest hover:bg-[#d00045] transition-colors">
            TORNA ALLA SCANSIONE
        </button>
        <p class="text-white/50 text-xs mt-4 font-mono">Modalità visualizzazione manuale attivata.</p>
    </div>

    <!-- AR SCENE -->
    <a-scene 
        mindar-image="imageTargetSrc: img/targets.mind; filterMinCF:0.0001; filterBeta: 0.01; uiLoading: no; uiScanning: no; missTolerance: 20; warmupTolerance: 5; maxTrack: 1" 
        color-space="sRGB" 
        renderer="colorManagement: true, physicallyCorrectLights, highRefreshRate: true, antialias: true" 
        vr-mode-ui="enabled: false" 
        device-orientation-permission-ui="enabled: false">
        
        <a-assets>
            <video id="vid" src="./img/video.mp4" preload="auto" loop muted playsinline webkit-playsinline crossorigin="anonymous"></video>
        </a-assets>

        <a-camera position="0 0 0" look-controls="enabled: false"></a-camera>

        
        <!-- TARGET MINDAR (AR REALE) 16:9 -->
        <!-- 
        <a-entity id="example-target" mindar-image-target="targetIndex: 0">
            <a-entity id="ar-content-group">
                <a-entity id="myVid" 
                    geometry="primitive: plane; width: 1.6; height: 0.9" 
                    material="src: #vid; shader: flat; transparent: true; opacity: 1" 
                    position="0 0 0">
                </a-entity>
                <a-plane position="0 0.47 0" width="1.68" height="0.03" color="#00ff41" material="shader: flat">
                    <a-animation attribute="opacity" from="1" to="0.7" dur="100" direction="alternate" repeat="indefinite"></a-animation>
                </a-plane>
                <a-plane position="0 -0.47 0" width="1.68" height="0.03" color="#00ff41" material="shader: flat"></a-plane>
                <a-plane position="-0.83 0 0" width="0.03" height="0.96" color="#00ff41" material="shader: flat"></a-plane>
                <a-plane position="0.83 0 0" width="0.03" height="0.96" color="#00ff41" material="shader: flat">
                    <a-animation attribute="opacity" from="1" to="0.7" dur="150" direction="alternate" repeat="indefinite"></a-animation>
                </a-plane>
                
                <a-plane position="-0.77 0.41 0.01" width="0.15" height="0.03" color="white" material="shader: flat; opacity: 0.9"></a-plane>
                <a-plane position="0.77 -0.41 0.01" width="0.15" height="0.03" color="white" material="shader: flat; opacity: 0.9"></a-plane>
                
                <a-text value="INNOVATION_LAB_DEV" color="#00ff41" align="center" width="1.5" position="0 -0.6 0.01" 
                        font="https://cdn.aframe.io/fonts/Roboto-msdf.json">
                    <a-animation attribute="opacity" from="0.3" to="1" dur="800" direction="alternate" repeat="indefinite"></a-animation>
                </a-text>
            </a-entity>
        </a-entity>
        --> 
      
      <!-- TARGET MINDAR (AR REALE) 5:4 --> 
       <a-entity id="example-target" mindar-image-target="targetIndex: 0">
            <a-entity id="ar-content-group">
                <a-entity id="myVid" 
                    geometry="primitive: plane; width: 1.25; height: 1" 
                    material="src: #vid; shader: flat; transparent: true; opacity: 1" 
                    position="0 0 0">
                </a-entity>
                <a-text value="INNOVATION_LAB_DEV" color="#00ff41" align="center" width="1.5" position="0 -0.65 0.01" 
                        font="https://cdn.aframe.io/fonts/Roboto-msdf.json">
                    <a-animation attribute="opacity" from="0.3" to="1" dur="800" direction="alternate" repeat="indefinite"></a-animation>
                </a-text>
            </a-entity>
        </a-entity>
    </a-scene>

    <!-- LOGIC -->
    <script>
        const video = document.querySelector("#vid");
        const target = document.querySelector("#example-target");
        const statusText = document.querySelector("#sys-status");
        const aimOverlay = document.querySelector("#aim-overlay"); 
        const audioBtn = document.querySelector("#audio-btn");
        const audioText = document.querySelector("#audio-text");
        const loader = document.querySelector("#custom-loader");
        const loadingPercent = document.querySelector("#loading-percent");
        const progressBar = document.querySelector("#progress-bar");
        const scene = document.querySelector("a-scene");
        const fpsCounter = document.querySelector("#fps-counter");
        const fallbackBtn = document.querySelector("#fallback-btn");
        
        // Nuovi elementi Fallback HTML
        const fallbackPlayer = document.querySelector("#fallback-player");
        const manualVideo = document.querySelector("#manual-video");
        const closeManualBtn = document.querySelector("#close-manual-btn");

        let isAudioEnabled = false;
        let loadProgress = 0;
        let isManualMode = false;
        
        // Smoothing Variables
        let smoothPositionX = 0;
        let smoothPositionY = 0;
        let smoothPositionZ = 0;
        const SMOOTHING_FACTOR = 0.1; // Smooth originale

        // CUSTOM SMOOTHING LAYER
        const myVidEntity = document.querySelector("#myVid");
        
        setInterval(() => {
            // Applica smoothing solo alla parte AR Reale
            if(myVidEntity && target.object3D.visible && !isManualMode) {
                const currentPos = target.object3D.position;
                smoothPositionX += (currentPos.x - smoothPositionX) * SMOOTHING_FACTOR;
                smoothPositionY += (currentPos.y - smoothPositionY) * SMOOTHING_FACTOR;
                smoothPositionZ += (currentPos.z - smoothPositionZ) * SMOOTHING_FACTOR;
            }
        }, 16); 

        // Fake FPS
        setInterval(() => {
            const fakeFps = Math.floor(Math.random() * 5) + 55;
            fpsCounter.innerText = fakeFps;
        }, 1000);

        // Loading
        const nerdMessages = [
            "Calibrating sensors...",
            "Loading neural net...",
            "Stabilizing matrix...",
            "Syncing reality..."
        ];
        let msgIndex = 0;
        
        const loadInterval = setInterval(() => {
            loadProgress += 0.55; 
            if(loadProgress > 100) loadProgress = 100;
            loadingPercent.innerText = Math.floor(loadProgress) + "%";
            progressBar.style.width = loadProgress + "%";
            if(Math.floor(loadProgress) % 25 === 0 && msgIndex < nerdMessages.length) {
                document.querySelector('#load-msg').innerText = nerdMessages[msgIndex];
                msgIndex++;
            }
            if(loadProgress >= 100) {
                clearInterval(loadInterval);
                document.querySelector('#load-msg').innerText = "System Ready.";
            }
        }, 30);

        // AR PRONTA
        scene.addEventListener("arReady", () => {
            console.log("✅ AR SYSTEM ONLINE");
            const checkLoad = setInterval(() => {
                if(loadProgress >= 100) {
                    clearInterval(checkLoad);
                    setTimeout(() => {
                        loader.style.opacity = "0";
                        setTimeout(() => loader.style.display = "none", 500);
                        
                        // TIMER 10 SECONDI: Il bottone appare SEMPRE
                        setTimeout(() => {
                            if (!isManualMode) {
                                fallbackBtn.classList.remove('hidden');
                                fallbackBtn.style.display = 'flex';
                            }
                        }, 10000);
                    }, 500);
                }
            }, 100);
        });

        // TARGET FOUND
        target.addEventListener("targetFound", () => {
            if(isManualMode) return;
            video.play();
            statusText.innerText = "LOCKED";
            statusText.style.color = "#fff";
            statusText.classList.remove("animate-pulse");
            aimOverlay.style.opacity = "0";
            if(navigator.vibrate) navigator.vibrate(50);
        });

        // TARGET LOST
        target.addEventListener("targetLost", () => {
            if(isManualMode) return;
            video.pause();
            statusText.innerText = "SEARCHING...";
            statusText.style.color = "#00ff41";
            statusText.classList.add("animate-pulse");
            aimOverlay.style.opacity = "1";
        });

        // AUDIO TOGGLE
        audioBtn.addEventListener('click', () => {
            if (!isAudioEnabled) {
                video.muted = false;
                manualVideo.muted = false; // Sblocca anche l'audio manuale
                isAudioEnabled = true;
                audioText.innerText = "AUDIO ON";
                audioBtn.classList.add("bg-[#00ff41]", "text-black");
                audioBtn.classList.remove("bg-[#00ff41]/10", "text-[#00ff41]");
                if(navigator.vibrate) navigator.vibrate(50);
                setTimeout(() => {
                    audioBtn.style.opacity = "0";
                    audioBtn.style.pointerEvents = "none";
                }, 1500);
            }
        });

        // MODALITÀ MANUALE (OVERLAY HTML)
        fallbackBtn.addEventListener('click', () => {
            isManualMode = true;
            console.log("🛠 MANUAL HTML PLAYER OPENED");

            // Pausa AR
            video.pause();
            
            // Mostra Overlay HTML
            fallbackPlayer.style.display = 'flex';
            
            // Avvia Video Manuale
            manualVideo.currentTime = 0;
            manualVideo.play();
            if(isAudioEnabled) manualVideo.muted = false;

            // UI Updates
            statusText.innerText = "MANUAL_MODE";
            statusText.style.color = "#ff0055";
            if(navigator.vibrate) navigator.vibrate([50, 50, 50]);
        });

        // CHIUSURA MODALITÀ MANUALE
        closeManualBtn.addEventListener('click', () => {
            isManualMode = false;
            
            // Nascondi Overlay
            fallbackPlayer.style.display = 'none';
            manualVideo.pause();

            // Ripristina AR UI
            statusText.innerText = "SEARCHING...";
            statusText.style.color = "#00ff41";
            aimOverlay.style.opacity = "1";
        });

    </script>
</body>
</html>