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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
<!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" />
  <title>Android Auto - Navigatore Italia</title>
  <script src="https://cdn.tailwindcss.com"></script>
  <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
  <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" rel="stylesheet" />
  <style>
    body, html {
      margin: 0;
      padding: 0;
      width: 100%;
      height: 100%;
      background: #000;
      color: white;
      font-family: 'Google Sans', 'Segoe UI', sans-serif;
      overflow: hidden;
    }

    #map {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 1;
    }

    /* Overlay per Android Auto */
    .android-auto-overlay {
      position: absolute;
      bottom: 0;
      left: 0;
      width: 100%;
      background: linear-gradient(to top, rgba(0,0,0,0.8), transparent 70%);
      height: 240px;
      z-index: 10;
      pointer-events: none;
    }

    /* Voice Assistant */
    .voice-assistant {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      background: rgba(33, 33, 33, 0.9);
      border-radius: 20px;
      padding: 20px;
      width: 90%;
      max-width: 320px;
      text-align: center;
      box-shadow: 0 4px 20px rgba(0,0,0,0.5);
      z-index: 50;
      backdrop-filter: blur(10px);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.3s ease;
    }

    .voice-assistant.active {
      opacity: 1;
      pointer-events: auto;
    }

    .voice-wave {
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 2px;
    }

    .wave-bar {
      width: 4px;
      background: #1DB954;
      height: 8px;
      border-radius: 2px;
      animation: pulse 1s infinite ease-in-out;
    }

    .wave-bar:nth-child(1) { animation-delay: 0s; height: 12px; }
    .wave-bar:nth-child(2) { animation-delay: 0.1s; height: 6px; }
    .wave-bar:nth-child(3) { animation-delay: 0.2s; height: 16px; }
    .wave-bar:nth-child(4) { animation-delay: 0.3s; height: 10px; }
    .wave-bar:nth-child(5) { animation-delay: 0.4s; height: 14px; }
    .wave-bar:nth-child(6) { animation-delay: 0.5s; height: 8px; }

    @keyframes pulse {
      0%, 100% { opacity: 0.5; transform: scaleY(1); }
      50% { opacity: 1; transform: scaleY(1.5); }
    }

    .voice-text {
      margin-top: 16px;
      font-size: 14px;
      color: #ccc;
    }

    /* Top Bar */
    .top-bar {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      padding: 16px;
      z-index: 10;
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      pointer-events: none;
    }

    .time {
      font-size: 18px;
      font-weight: 500;
      background: rgba(0,0,0,0.6);
      padding: 4px 12px;
      border-radius: 16px;
      pointer-events: auto;
    }

    .search-button {
      background: rgba(255,255,255,0.2);
      padding: 8px 16px;
      border-radius: 16px;
      font-size: 14px;
      display: flex;
      align-items: center;
      gap: 8px;
      pointer-events: auto;
    }

    /* Bottom Control */
    .bottom-control {
      position: absolute;
      bottom: 20px;
      left: 0;
      width: 100%;
      padding: 0 16px;
      z-index: 10;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .nav-button {
      background: #202124;
      width: 64px;
      height: 64px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 4px 12px rgba(0,0,0,0.3);
      color: white;
      font-size: 20px;
    }

    .mic-button {
      background: #1DB954;
      width: 72px;
      height: 72px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      color: white;
      font-size: 24px;
      box-shadow: 0 4px 16px rgba(29, 185, 84, 0.4);
    }

    /* Navigation UI */
    .navigation-ui {
      position: absolute;
      top: 0;
      right: 0;
      width: 100%;
      height: 100%;
      z-index: 20;
      display: none;
      flex-direction: column;
    }

    .nav-header {
      padding: 70px 20px 0 20px;
      background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
      text-align: center;
    }

    .nav-distance {
      font-size: 42px;
      font-weight: 300;
    }

    .nav-time {
      font-size: 16px;
      color: #aaa;
    }

    .next-instruction {
      padding: 16px 20px;
      background: rgba(32, 32, 32, 0.9);
      border-top: 1px solid #333;
      font-size: 18px;
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .turn-icon {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      background: #1DB954;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: bold;
      font-size: 14px;
    }

    .speed-display {
      position: absolute;
      right: 20px;
      top: 80px;
      font-size: 36px;
      font-weight: bold;
      color: #1DB954;
      z-index: 10;
    }

    .direction-arrow {
      position: absolute;
      top: 150px;
      left: 50%;
      transform: translateX(-50%);
      width: 40px;
      height: 40px;
      background: white;
      clip-path: polygon(50% 0%, 0% 100%, 50% 75%, 100% 100%);
      z-index: 10;
      opacity: 0;
      transition: opacity 0.3s;
    }

    .direction-arrow.show {
      opacity: 1;
    }
  </style>
</head>
<body class="relative">

  <!-- Mappa -->
  <div id="map"></div>

  <!-- Frecce direzionali (simulazione svolta) -->
  <div class="direction-arrow" id="direction-arrow"></div>

  <!-- Display velocità -->
  <div class="speed-display" id="speed">0</div>

  <!-- Top Bar -->
  <div class="top-bar">
    <div class="time" id="current-time">12:34</div>
    <button class="search-button" id="search-btn">
      <i class="fas fa-search"></i>
      <span>Cerca destinazione</span>
    </button>
  </div>

  <!-- Android Auto Overlay -->
  <div class="android-auto-overlay"></div>

  <!-- Bottom Control Bar -->
  <div class="bottom-control">
    <a href="#" class="nav-button"><i class="fas fa-apple-alt"></i></a>
    <div class="mic-button" id="voice-mic"><i class="fas fa-microphone"></i></div>
    <a href="#" class="nav-button"><i class="fas fa-compass"></i></a>
  </div>

  <!-- Voice Assistant Overlay -->
  <div class="voice-assistant" id="voice-assistant">
    <div class="voice-wave">
      <div class="wave-bar"></div>
      <div class="wave-bar"></div>
      <div class="wave-bar"></div>
      <div class="wave-bar"></div>
      <div class="wave-bar"></div>
      <div class="wave-bar"></div>
    </div>
    <div class="voice-text" id="voice-text">Ascolto…</div>
  </div>

  <!-- Schermo Navigazione Attiva -->
  <div class="navigation-ui" id="nav-ui">
    <div class="nav-header">
      <div class="nav-distance" id="nav-distance">4.2 km</div>
      <div class="nav-time" id="nav-time">6 min</div>
    </div>
    <div class="next-instruction">
      <div class="turn-icon">L</div>
      <span id="next-instruction-text">Svoltare a sinistra su Via Cavour</span>
    </div>
  </div>

  <script>
    // Aggiorna ora
    setInterval(() => {
      const now = new Date();
      document.getElementById('current-time').textContent = now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
    }, 1000);

    // Inizializza mappa
    const map = L.map('map', { zoomControl: false }).setView([41.9028, 12.4964], 14);
    L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
      attribution: '© OpenStreetMap contributors'
    }).addTo(map);

    // Posizione utente
    let userPos = [41.9028, 12.4964];
    let userMarker = L.marker(userPos, {
      icon: L.divIcon({
        html: '<i class="fas fa-car text-red-600" style="font-size:24px; transform:rotate(45deg);"></i>',
        iconSize: [32, 32],
        iconAnchor: [16, 16]
      })
    }).addTo(map);

    // Simulazione movimento
    setInterval(() => {
      userPos[0] += (Math.random() - 0.5) * 0.0002;
      userPos[1] += (Math.random() - 0.5) * 0.0002;
      userMarker.setLatLng(userPos);
    }, 2000);

    // Bottone Microfono
    const voiceAssistant = document.getElementById('voice-assistant');
    const voiceMic = document.getElementById('voice-mic');
    const voiceText = document.getElementById('voice-text');

    const commands = {
      "dove sono": "Sei a Roma, centro città.",
      "trova ristorante": "Cerco un ristorante nelle vicinanze…",
      "a casa": () => startNavigation("Casa, Via Garibaldi 45, Roma"),
      "a lavoro": () => startNavigation("Ufficio, Piazza del Popolo, Roma"),
      "inizia navigazione": () => startNavigation("Stazione Termini, Roma"),
      "navigatore": "Avvio il navigatore.",
      "silenzio": "Ok, silenzio attivo."
    };

    voiceMic.addEventListener('click', () => {
      voiceAssistant.classList.add('active');
      voiceText.textContent = "Ascolto…";
      setTimeout(() => {
        voiceText.textContent = "Riconoscimento vocale…";
        setTimeout(() => simulateVoiceCommand(), 1500);
      }, 1000);
    });

    function simulateVoiceCommand() {
      const possibleCommands = Object.keys(commands);
      const randomCommand = possibleCommands[Math.floor(Math.random() * possibleCommands.length)];
      voiceText.textContent = `Hai detto: "${randomCommand}"`;
      setTimeout(() => {
        const action = commands[randomCommand];
        if (typeof action === 'function') {
          action();
        } else {
          voiceText.textContent = action;
          setTimeout(() => voiceAssistant.classList.remove('active'), 2000);
        }
      }, 1500);
    }

    function startNavigation(destination) {
      voiceText.textContent = `Navigazione verso ${destination} avviata.`;
      document.getElementById('next-instruction-text').textContent = `Verso ${destination}`;
      document.getElementById('nav-ui').style.display = 'flex';

      // Mostra freccia direzionale
      setTimeout(() => {
        document.getElementById('direction-arrow').classList.add('show');
      }, 1000);

      // Altri messaggi simulati
      setTimeout(() => {
        document.getElementById('next-instruction-text').textContent = "Svoltare a destra tra 300 metri";
        document.getElementById('nav-distance').textContent = "3.1 km";
        document.getElementById('nav-time').textContent = "4 min";
      }, 5000);

      // Simula velocità
      setInterval(() => {
        const speeds = [0, 10, 20, 40, 60, 80];
        document.getElementById('speed').textContent = speeds[Math.floor(Math.random() * speeds.length)] + ' km/h';
      }, 3000);
    }

    // Pulsante cerca
    document.getElementById('search-btn').addEventListener('click', () => {
      startNavigation("Piazza Navona, Roma");
    });
  </script>

<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-qwensite.hf.space/logo.svg" alt="qwensite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-qwensite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >QwenSite</a> - 🧬 <a href="https://enzostvs-qwensite.hf.space?remix=condorhacker/navi" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>