File size: 28,994 Bytes
de96292
 
 
 
 
0c33739
de96292
 
 
0c33739
 
 
de96292
 
 
 
 
 
 
 
 
 
 
0c33739
 
de96292
 
 
 
0c33739
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
de96292
 
 
0c33739
de96292
0c33739
 
 
de96292
0c33739
de96292
 
0c33739
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
de96292
 
 
0c33739
 
de96292
 
0c33739
 
 
 
de96292
 
 
0c33739
 
 
 
 
 
 
 
 
 
de96292
 
0c33739
 
 
 
 
 
 
 
de96292
 
0c33739
 
 
 
 
 
 
de96292
 
 
 
0c33739
 
 
 
 
 
 
 
 
 
 
 
 
 
de96292
 
0c33739
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
de96292
0c33739
 
 
 
 
 
 
 
 
 
 
 
 
de96292
0c33739
 
 
 
de96292
 
 
0c33739
 
 
 
 
de96292
0c33739
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
de96292
 
 
0c33739
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
de96292
 
 
 
0c33739
 
 
de96292
 
 
 
 
0c33739
de96292
 
 
 
 
 
 
 
 
 
 
0c33739
de96292
 
 
 
 
 
 
 
 
 
 
0c33739
de96292
 
 
 
 
 
 
 
 
 
 
 
 
 
0c33739
 
 
 
 
 
 
 
 
 
de96292
0c33739
 
de96292
0c33739
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
de96292
 
 
0c33739
de96292
0c33739
 
 
 
 
 
de96292
0c33739
 
 
 
 
 
 
 
 
 
de96292
0c33739
 
 
de96292
 
 
 
 
 
 
0c33739
de96292
 
0c33739
de96292
 
0c33739
 
de96292
 
0c33739
 
 
 
 
de96292
 
0c33739
de96292
0c33739
 
 
 
 
 
 
 
 
de96292
 
 
 
 
0c33739
 
 
 
 
 
 
 
 
 
 
 
de96292
 
 
 
 
 
 
 
0c33739
de96292
0c33739
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
de96292
 
 
 
0c33739
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
de96292
 
0c33739
 
 
 
 
 
 
de96292
0c33739
 
 
 
 
 
 
de96292
 
 
0c33739
 
 
 
 
 
 
 
 
 
 
 
de96292
0c33739
 
 
 
 
 
 
 
 
 
de96292
 
0c33739
 
 
 
de96292
 
0c33739
 
 
 
 
 
 
 
 
 
 
de96292
 
 
0c33739
de96292
0c33739
 
 
de96292
 
 
 
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
<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Simulateur de Camion - Vues Réelles</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        @keyframes roadMove {
            from { background-position: 0 0; }
            to { background-position: 0 100px; }
        }
        .road {
            background: repeating-linear-gradient(
                0deg,
                #4a5568,
                #4a5568 20px,
                #2d3748 20px,
                #2d3748 40px
            );
            animation: roadMove 0.5s linear infinite;
        }
        .dashboard-glow {
            box-shadow: 0 0 15px rgba(59, 130, 246, 0.7);
        }
        .pedal:active {
            transform: translateY(5px);
        }
        .mirror-view {
            transform: perspective(300px) rotateY(20deg);
        }
        .mirror-view.right {
            transform: perspective(300px) rotateY(-20deg);
        }
        .truck-body {
            background: linear-gradient(to bottom, #1a202c, #2d3748);
        }
        .view-switch-btn.active {
            background-color: #3b82f6;
            color: white;
        }
        .steering-wheel {
            transition: transform 0.2s ease;
        }
        .tachometer-needle {
            transform-origin: bottom center;
            transition: transform 0.3s ease;
        }
        .windshield {
            background: rgba(0, 100, 200, 0.1);
            backdrop-filter: blur(2px);
        }
        .real-view {
            background-size: cover;
            background-position: center;
            transition: background-image 1s ease;
        }
        .mirror-image {
            transform: scaleX(-1);
            opacity: 0.8;
        }
    </style>
</head>
<body class="bg-gray-900 text-gray-100 min-h-screen">
    <div class="container mx-auto px-4 py-8">
        <header class="text-center mb-8">
            <h1 class="text-4xl md:text-5xl font-bold bg-gradient-to-r from-yellow-500 to-red-600 bg-clip-text text-transparent mb-2">
                Simulateur de Camion Pro
            </h1>
            <p class="text-lg text-gray-400">Expérience de conduite réaliste avec vues multiples</p>
        </header>

        <!-- View Selector -->
        <div class="flex flex-wrap gap-2 mb-4 justify-center">
            <button class="view-switch-btn active px-4 py-2 rounded-lg bg-gray-800 hover:bg-gray-700" data-view="cabin">
                <i class="fas fa-truck-cab mr-2"></i> Vue Cabine
            </button>
            <button class="view-switch-btn px-4 py-2 rounded-lg bg-gray-800 hover:bg-gray-700" data-view="exterior">
                <i class="fas fa-truck mr-2"></i> Vue Extérieure
            </button>
            <button class="view-switch-btn px-4 py-2 rounded-lg bg-gray-800 hover:bg-gray-700" data-view="dashboard">
                <i class="fas fa-tachometer-alt mr-2"></i> Tableau de bord
            </button>
            <button class="view-switch-btn px-4 py-2 rounded-lg bg-gray-800 hover:bg-gray-700" data-view="top">
                <i class="fas fa-map mr-2"></i> Vue du dessus
            </button>
        </div>

        <!-- Main Simulation Area -->
        <div class="relative bg-gray-800 rounded-xl overflow-hidden mb-6" style="height: 500px;">
            <!-- Cabin View (Default) -->
            <div id="cabin-view" class="h-full flex flex-col">
                <!-- Dashboard -->
                <div class="dashboard-glow bg-gray-900 p-4 rounded-t-lg">
                    <div class="flex justify-between items-center mb-2">
                        <div class="text-center">
                            <div class="text-2xl font-mono font-bold text-yellow-500 speedometer">0</div>
                            <div class="text-xs text-gray-400">km/h</div>
                        </div>
                        <div class="text-center">
                            <div class="text-xl font-mono font-bold rpm-meter">0</div>
                            <div class="text-xs text-gray-400">RPM</div>
                        </div>
                        <div class="text-center">
                            <div class="text-lg font-mono font-bold gear-display">N</div>
                            <div class="text-xs text-gray-400">Vitesse</div>
                        </div>
                    </div>
                    
                    <div class="h-2 bg-gray-800 rounded-full mb-2">
                        <div class="h-full bg-gradient-to-r from-red-500 via-yellow-500 to-green-500 rounded-full rpm-bar" style="width: 0%"></div>
                    </div>
                    
                    <div class="flex justify-between text-xs text-gray-400">
                        <div>Fuel: <span class="text-white">85%</span></div>
                        <div>Distance: <span class="text-white">0 km</span></div>
                        <div>Time: <span class="text-white">12:45</span></div>
                    </div>
                </div>
                
                <!-- Road View -->
                <div class="real-view flex-1 relative overflow-hidden" id="road-view" style="background-image: url('https://images.unsplash.com/photo-1544620347-c4fd4a3d5957?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80')">
                    <!-- Mirrors -->
                    <div class="absolute left-0 top-1/4 w-24 h-16 bg-black bg-opacity-50 border border-gray-700 rounded mirror-view overflow-hidden">
                        <img src="https://images.unsplash.com/photo-1509316785289-025f5b846b35?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80" class="mirror-image w-full h-full object-cover">
                        <div class="absolute bottom-0 left-0 right-0 h-4 bg-yellow-500"></div>
                    </div>
                    <div class="absolute right-0 top-1/4 w-24 h-16 bg-black bg-opacity-50 border border-gray-700 rounded mirror-view right overflow-hidden">
                        <img src="https://images.unsplash.com/photo-1509316785289-025f5b846b35?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80" class="w-full h-full object-cover">
                        <div class="absolute bottom-0 left-0 right-0 h-4 bg-yellow-500"></div>
                    </div>
                    
                    <!-- Windshield -->
                    <div class="windshield absolute inset-0 border-t-4 border-gray-600 border-opacity-50"></div>
                    
                    <!-- Steering wheel -->
                    <div class="absolute left-1/2 bottom-20 transform -translate-x-1/2 steering-wheel">
                        <div class="w-24 h-24 rounded-full border-4 border-yellow-600 flex items-center justify-center">
                            <div class="w-4 h-4 rounded-full bg-yellow-500"></div>
                        </div>
                    </div>
                    
                    <!-- Pedals -->
                    <div class="absolute left-1/4 bottom-20 flex gap-8">
                        <div class="pedal w-12 h-16 bg-gray-800 rounded-t-lg border-t-4 border-red-600 flex items-end justify-center pb-2 cursor-pointer">
                            <i class="fas fa-arrow-down text-gray-400"></i>
                        </div>
                        <div class="pedal w-12 h-16 bg-gray-800 rounded-t-lg border-t-4 border-green-600 flex items-end justify-center pb-2 cursor-pointer">
                            <i class="fas fa-arrow-up text-gray-400"></i>
                        </div>
                    </div>
                </div>
                
                <!-- Truck Seat -->
                <div class="truck-seat h-16 rounded-b-lg flex items-center justify-between px-4 bg-gray-700">
                    <div class="flex gap-2">
                        <button class="w-8 h-8 rounded-full bg-gray-800 flex items-center justify-center hover:bg-gray-700">
                            <i class="fas fa-lightbulb text-yellow-400"></i>
                        </button>
                        <button class="w-8 h-8 rounded-full bg-gray-800 flex items-center justify-center hover:bg-gray-700">
                            <i class="fas fa-bolt text-blue-400"></i>
                        </button>
                    </div>
                    <div class="text-xs text-gray-400">
                        <span class="text-yellow-500">Scania R500</span> • 500 CV
                    </div>
                </div>
            </div>
            
            <!-- Exterior View -->
            <div id="exterior-view" class="hidden h-full relative">
                <div class="real-view absolute inset-0" id="exterior-scene" style="background-image: url('https://images.unsplash.com/photo-1509316785289-025f5b846b35?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80')">
                    <!-- Truck -->
                    <div class="absolute bottom-1/4 left-1/2 transform -translate-x-1/2">
                        <img src="https://images.unsplash.com/photo-1601362840469-37e0e9d2392f?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80" class="w-64 h-auto">
                    </div>
                    
                    <!-- Road -->
                    <div class="absolute bottom-0 left-0 right-0 h-1/4 road"></div>
                </div>
            </div>
            
            <!-- Dashboard View -->
            <div id="dashboard-view" class="hidden h-full bg-gray-900 p-8 flex flex-col items-center justify-center">
                <div class="w-full max-w-md bg-gray-800 rounded-xl p-6">
                    <!-- Speedometer -->
                    <div class="relative w-48 h-48 mx-auto mb-8">
                        <div class="absolute inset-0 rounded-full border-4 border-gray-700"></div>
                        <div class="absolute inset-4 rounded-full border-4 border-gray-600"></div>
                        
                        <!-- Speed markings -->
                        <div class="absolute top-0 left-1/2 transform -translate-x-1/2 text-xs text-gray-400">0</div>
                        <div class="absolute top-1/4 right-1/4 transform translate-x-2 text-xs text-gray-400">30</div>
                        <div class="absolute top-1/2 right-0 transform translate-y-1 text-xs text-gray-400">60</div>
                        <div class="absolute bottom-1/4 right-1/4 transform translate-x-2 text-xs text-gray-400">90</div>
                        <div class="absolute bottom-0 left-1/2 transform -translate-x-1/2 text-xs text-gray-400">120</div>
                        <div class="absolute bottom-1/4 left-1/4 transform -translate-x-2 text-xs text-gray-400">150</div>
                        
                        <!-- Needle -->
                        <div class="tachometer-needle absolute bottom-1/2 left-1/2 w-1 h-20 bg-red-500 transform -translate-x-1/2 rotate-0 origin-bottom" style="transform: rotate(-90deg);"></div>
                        
                        <!-- Center -->
                        <div class="absolute top-1/2 left-1/2 w-8 h-8 bg-gray-700 rounded-full transform -translate-x-1/2 -translate-y-1/2"></div>
                        
                        <!-- Speed display -->
                        <div class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-center">
                            <div class="text-3xl font-bold text-yellow-500 speedometer">0</div>
                            <div class="text-xs text-gray-400">km/h</div>
                        </div>
                    </div>
                    
                    <!-- Gauges -->
                    <div class="grid grid-cols-3 gap-4">
                        <div class="bg-gray-700 p-2 rounded text-center">
                            <div class="text-sm text-gray-400">RPM</div>
                            <div class="text-xl font-mono rpm-meter">0</div>
                        </div>
                        <div class="bg-gray-700 p-2 rounded text-center">
                            <div class="text-sm text-gray-400">Vitesse</div>
                            <div class="text-xl font-mono gear-display">N</div>
                        </div>
                        <div class="bg-gray-700 p-2 rounded text-center">
                            <div class="text-sm text-gray-400">Fuel</div>
                            <div class="text-xl font-mono">85%</div>
                        </div>
                    </div>
                    
                    <!-- Indicators -->
                    <div class="mt-6 grid grid-cols-4 gap-2">
                        <div class="p-2 rounded bg-gray-700 text-center">
                            <i class="fas fa-lightbulb text-yellow-400"></i>
                        </div>
                        <div class="p-2 rounded bg-gray-700 text-center">
                            <i class="fas fa-bolt text-blue-400"></i>
                        </div>
                        <div class="p-2 rounded bg-gray-700 text-center">
                            <i class="fas fa-oil-can text-red-400"></i>
                        </div>
                        <div class="p-2 rounded bg-gray-700 text-center">
                            <i class="fas fa-temperature-high text-orange-400"></i>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- Top View -->
            <div id="top-view" class="hidden h-full bg-gray-900 p-8">
                <div class="real-view relative w-full h-full" id="map-view" style="background-image: url('https://maps.googleapis.com/maps/api/staticmap?center=48.8566,2.3522&zoom=12&size=800x500&maptype=roadmap&key=YOUR_API_KEY')">
                    <!-- Truck indicator -->
                    <div class="absolute top-1/2 left-1/2 w-8 h-8 bg-red-500 rounded-full transform -translate-x-1/2 -translate-y-1/2 flex items-center justify-center">
                        <i class="fas fa-truck text-white text-xs"></i>
                    </div>
                    
                    <!-- Position indicator -->
                    <div class="absolute bottom-4 left-1/2 transform -translate-x-1/2 bg-gray-800 p-2 rounded-lg text-center">
                        <div class="text-sm text-gray-400">Position</div>
                        <div class="text-lg font-bold">0 km</div>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- Controls -->
        <div class="bg-gray-800 rounded-xl p-6 mb-8">
            <h2 class="text-xl font-bold mb-4 border-b border-gray-700 pb-2">Contrôles</h2>
            
            <div class="grid grid-cols-2 md:grid-cols-4 gap-4">
                <div class="bg-gray-700 p-4 rounded-lg text-center">
                    <div class="text-2xl mb-2"><i class="fas fa-arrow-up"></i></div>
                    <div class="text-sm">Accélérer</div>
                </div>
                <div class="bg-gray-700 p-4 rounded-lg text-center">
                    <div class="text-2xl mb-2"><i class="fas fa-arrow-down"></i></div>
                    <div class="text-sm">Freiner</div>
                </div>
                <div class="bg-gray-700 p-4 rounded-lg text-center">
                    <div class="text-2xl mb-2"><i class="fas fa-arrows-alt-h"></i></div>
                    <div class="text-sm">Direction</div>
                </div>
                <div class="bg-gray-700 p-4 rounded-lg text-center">
                    <div class="text-2xl mb-2"><i class="fas fa-exchange-alt"></i></div>
                    <div class="text-sm">Changer vitesse</div>
                </div>
            </div>
        </div>
        
        <!-- Stats -->
        <div class="bg-gray-800 rounded-xl p-6">
            <h2 class="text-xl font-bold mb-4 border-b border-gray-700 pb-2">Statistiques</h2>
            
            <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                <div class="bg-gray-700 p-4 rounded-lg">
                    <div class="flex justify-between items-start">
                        <div>
                            <h3 class="text-sm font-medium text-gray-400">Distance</h3>
                            <p class="text-2xl font-bold">0 <span class="text-sm font-normal text-gray-400">km</span></p>
                        </div>
                        <div class="p-2 bg-gray-800 rounded-full">
                            <i class="fas fa-road text-yellow-500"></i>
                        </div>
                    </div>
                </div>
                
                <div class="bg-gray-700 p-4 rounded-lg">
                    <div class="flex justify-between items-start">
                        <div>
                            <h3 class="text-sm font-medium text-gray-400">Temps</h3>
                            <p class="text-2xl font-bold">00:00 <span class="text-sm font-normal text-gray-400">hh:mm</span></p>
                        </div>
                        <div class="p-2 bg-gray-800 rounded-full">
                            <i class="fas fa-clock text-blue-500"></i>
                        </div>
                    </div>
                </div>
                
                <div class="bg-gray-700 p-4 rounded-lg">
                    <div class="flex justify-between items-start">
                        <div>
                            <h3 class="text-sm font-medium text-gray-400">Consommation</h3>
                            <p class="text-2xl font-bold">0 <span class="text-sm font-normal text-gray-400">L/100km</span></p>
                        </div>
                        <div class="p-2 bg-gray-800 rounded-full">
                            <i class="fas fa-gas-pump text-red-500"></i>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // Elements
            const viewButtons = document.querySelectorAll('.view-switch-btn');
            const views = {
                cabin: document.getElementById('cabin-view'),
                exterior: document.getElementById('exterior-view'),
                dashboard: document.getElementById('dashboard-view'),
                top: document.getElementById('top-view')
            };
            
            const speedometer = document.querySelectorAll('.speedometer');
            const rpmMeter = document.querySelectorAll('.rpm-meter');
            const rpmBar = document.querySelector('.rpm-bar');
            const gearDisplay = document.querySelectorAll('.gear-display');
            const tachometerNeedle = document.querySelector('.tachometer-needle');
            const steeringWheel = document.querySelector('.steering-wheel');
            const roadView = document.getElementById('road-view');
            const exteriorScene = document.getElementById('exterior-scene');
            const mapView = document.getElementById('map-view');
            
            // Landscape images (replace with your own)
            const landscapes = [
                'https://images.unsplash.com/photo-1544620347-c4fd4a3d5957?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80',
                'https://images.unsplash.com/photo-1509316785289-025f5b846b35?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80',
                'https://images.unsplash.com/photo-1516731415730-72748ec87094?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80',
                'https://images.unsplash.com/photo-1518098268026-4e89f1a2cd8e?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80'
            ];
            
            // Truck images
            const trucks = [
                'https://images.unsplash.com/photo-1601362840469-37e0e9d2392f?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80',
                'https://images.unsplash.com/photo-1605559421013-3120af7fe89a?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80',
                'https://images.unsplash.com/photo-1605559421013-3120af7fe89a?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80'
            ];
            
            // Simulation state
            let currentSpeed = 0;
            let currentRPM = 800;
            let currentGear = 'N';
            let isAccelerating = false;
            let isBraking = false;
            let steeringAngle = 0;
            let distance = 0;
            let currentLandscape = 0;
            let currentTruck = 0;
            
            // Switch views
            viewButtons.forEach(button => {
                button.addEventListener('click', function() {
                    const view = this.getAttribute('data-view');
                    
                    // Hide all views
                    Object.values(views).forEach(v => v.classList.add('hidden'));
                    
                    // Show selected view
                    views[view].classList.remove('hidden');
                    
                    // Update active button
                    viewButtons.forEach(btn => btn.classList.remove('active'));
                    this.classList.add('active');
                });
            });
            
            // Keyboard controls
            document.addEventListener('keydown', function(e) {
                switch(e.key) {
                    case 'ArrowUp':
                        isAccelerating = true;
                        break;
                    case 'ArrowDown':
                        isBraking = true;
                        break;
                    case 'ArrowLeft':
                        steeringAngle = -30;
                        steeringWheel.style.transform = `rotate(${steeringAngle}deg)`;
                        break;
                    case 'ArrowRight':
                        steeringAngle = 30;
                        steeringWheel.style.transform = `rotate(${steeringAngle}deg)`;
                        break;
                    case ' ':
                        shiftGearUp();
                        break;
                    case 'Shift':
                        shiftGearDown();
                        break;
                    case 'l':
                        // Change landscape
                        currentLandscape = (currentLandscape + 1) % landscapes.length;
                        roadView.style.backgroundImage = `url('${landscapes[currentLandscape]}')`;
                        break;
                    case 't':
                        // Change truck
                        currentTruck = (currentTruck + 1) % trucks.length;
                        exteriorScene.style.backgroundImage = `url('${trucks[currentTruck]}')`;
                        break;
                }
            });
            
            document.addEventListener('keyup', function(e) {
                switch(e.key) {
                    case 'ArrowUp':
                        isAccelerating = false;
                        break;
                    case 'ArrowDown':
                        isBraking = false;
                        break;
                    case 'ArrowLeft':
                    case 'ArrowRight':
                        steeringAngle = 0;
                        steeringWheel.style.transform = `rotate(${steeringAngle}deg)`;
                        break;
                }
            });
            
            // Pedal mouse controls
            const pedals = document.querySelectorAll('.pedal');
            pedals.forEach(pedal => {
                pedal.addEventListener('mousedown', function() {
                    if (this.querySelector('.fa-arrow-up')) {
                        isAccelerating = true;
                    } else {
                        isBraking = true;
                    }
                });
                
                pedal.addEventListener('mouseup', function() {
                    if (this.querySelector('.fa-arrow-up')) {
                        isAccelerating = false;
                    } else {
                        isBraking = false;
                    }
                });
                
                pedal.addEventListener('mouseleave', function() {
                    if (this.querySelector('.fa-arrow-up')) {
                        isAccelerating = false;
                    } else {
                        isBraking = false;
                    }
                });
            });
            
            // Gear shifting
            function shiftGearUp() {
                if (currentGear === 'N') {
                    currentGear = '1';
                } else if (currentGear !== '12') {
                    currentGear = (parseInt(currentGear) + 1).toString();
                    currentRPM = Math.max(800, currentRPM - 500);
                }
                updateDashboard();
            }
            
            function shiftGearDown() {
                if (currentGear !== 'N' && currentGear !== '1') {
                    currentGear = (parseInt(currentGear) - 1).toString();
                    currentRPM = Math.min(3000, currentRPM + 500);
                }
                updateDashboard();
            }
            
            // Update dashboard
            function updateDashboard() {
                // Update all speedometers
                speedometer.forEach(el => el.textContent = Math.round(currentSpeed));
                
                // Update all RPM meters
                rpmMeter.forEach(el => el.textContent = currentRPM);
                
                // Update RPM bar
                rpmBar.style.width = (currentRPM / 30) + '%';
                
                // Update all gear displays
                gearDisplay.forEach(el => el.textContent = currentGear);
                
                // Update tachometer needle (-90deg to 90deg for 0-3000 RPM)
                const needleRotation = -90 + (currentRPM / 3000 * 180);
                tachometerNeedle.style.transform = `rotate(${needleRotation}deg)`;
            }
            
            // Simulation loop
            function simulate() {
                // Acceleration
                if (isAccelerating && currentSpeed < 150) {
                    currentSpeed += 0.5;
                    currentRPM = Math.min(3000, currentRPM + 5);
                    distance += 0.001;
                    
                    // Auto shift up at high RPM
                    if (currentRPM > 2800 && currentGear !== '12') {
                        shiftGearUp();
                    }
                }
                
                // Braking
                if (isBraking && currentSpeed > 0) {
                    currentSpeed = Math.max(0, currentSpeed - 1);
                    currentRPM = Math.max(800, currentRPM - 10);
                    
                    // Auto shift down at low speed
                    if (currentSpeed < 10 && currentGear !== 'N') {
                        currentGear = 'N';
                        updateDashboard();
                    }
                }
                
                // Engine braking when not accelerating
                if (!isAccelerating && currentSpeed > 0) {
                    currentSpeed = Math.max(0, currentSpeed - 0.1);
                    currentRPM = Math.max(800, currentRPM - 2);
                }
                
                // Keep RPM at idle when stopped
                if (currentSpeed <= 0) {
                    currentSpeed = 0;
                    currentRPM = 800;
                }
                
                // Change landscape after certain distance
                if (distance > 5) {
                    distance = 0;
                    currentLandscape = (currentLandscape + 1) % landscapes.length;
                    roadView.style.backgroundImage = `url('${landscapes[currentLandscape]}')`;
                }
                
                updateDashboard();
                requestAnimationFrame(simulate);
            }
            
            // Start simulation
            simulate();
        });
    </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-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=docto41/simulateur-de-camion" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>