-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
667 lines (614 loc) · 58.6 KB
/
Copy pathindex.html
File metadata and controls
667 lines (614 loc) · 58.6 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LowPoly64 - N64 Retro Editor</title>
<link rel="stylesheet" href="/src/styles/tailwind.generated.css">
<style>
@font-face {
font-family: 'Press Start 2P';
src: url('/src/assets/fonts/press-start-2p.woff2') format('woff2');
font-display: swap;
font-style: normal;
font-weight: 400;
}
:root { --tw-color-primary: #ffcc00; }
body { font-family: 'Press Start 2P', system-ui; margin: 0; }
#viewport { background: linear-gradient(#222222, #111111); }
.retro-button { transition: all 0.1s ease; }
.retro-button:active { transform: scale(0.95); }
.panel { box-shadow: 0 0 0 4px #ffcc00 inset; }
#canvas { display: block; width: 100%; height: 100%; }
.toggle-arrow { transition: transform 0.2s; }
#shortcuts-tooltip { pointer-events: none; }
#left-panel.panel-collapsed, #right-panel.panel-collapsed { display: none; }
#left-panel,
#anim-mode-panel,
#anim-mode-list {
scrollbar-gutter: stable;
scrollbar-width: thin;
scrollbar-color: #ffcc00 #09090b;
}
#left-panel::-webkit-scrollbar,
#anim-mode-panel::-webkit-scrollbar,
#anim-mode-list::-webkit-scrollbar { width: 9px; }
#left-panel::-webkit-scrollbar-track,
#anim-mode-panel::-webkit-scrollbar-track,
#anim-mode-list::-webkit-scrollbar-track {
background: #09090b;
border-left: 1px solid #3f3f46;
}
#left-panel::-webkit-scrollbar-thumb,
#anim-mode-panel::-webkit-scrollbar-thumb,
#anim-mode-list::-webkit-scrollbar-thumb {
background: #ffcc00;
border: 2px solid #09090b;
}
#left-panel::-webkit-scrollbar-button,
#anim-mode-panel::-webkit-scrollbar-button,
#anim-mode-list::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
@media (max-width: 900px) {
#left-panel { width: 14rem; }
#right-panel { width: 16rem; }
}
@media (max-width: 700px) {
#left-panel, #right-panel { width: 12rem; padding: 0.5rem; }
}
#help-icon:hover ~ #shortcuts-tooltip,
#help-icon:hover + #shortcuts-tooltip { display: flex !important; }
.texture-drop-zone { border: 2px dashed #ffcc00; transition: border-color 0.2s; }
.texture-drop-zone.border-white { border-color: white; }
</style>
</head>
<body class="bg-zinc-950 text-white h-screen overflow-hidden">
<div class="flex flex-col h-screen">
<!-- TOP BAR -->
<div class="h-12 bg-black border-b-4 border-[#ffcc00] flex items-center px-4 gap-3 text-xs uppercase tracking-widest shrink-0">
<div class="flex items-center gap-2 shrink-0">
<span class="text-[#ffcc00] text-lg">▲</span>
<h1 class="font-bold text-xl tracking-[4px]">LOWPOLY64</h1>
</div>
<div class="flex gap-2 ml-4">
<button onclick="toggleWireframe()" data-i18n="wire"
class="retro-button bg-zinc-900 hover:bg-[#ffcc00] hover:text-black px-4 py-1 border-2 border-[#ffcc00] text-[#ffcc00] text-xs">WIRE</button>
<button onclick="toggleFlatShading()" data-i18n="flat"
class="retro-button bg-zinc-900 hover:bg-[#ffcc00] hover:text-black px-4 py-1 border-2 border-[#ffcc00] text-[#ffcc00] text-xs">FLAT</button>
<button id="btn-bones" onclick="toggleBones()" data-i18n="bones"
class="retro-button bg-zinc-900 hover:bg-[#00ffff] hover:text-black px-4 py-1 border-2 border-[#00ffff] text-[#00ffff] text-xs">BONES</button>
<button id="btn-psx" onclick="togglePSXMode()" data-i18n="psxMode"
class="retro-button bg-zinc-900 hover:bg-[#ff00ff] hover:text-black px-4 py-1 border-2 border-[#ff00ff] text-[#ff00ff] text-xs">PSX</button>
<button onclick="resetScene()" data-i18n="reset"
class="retro-button bg-red-600 hover:bg-red-500 px-4 py-1 border-2 border-red-400 text-xs">RESET</button>
<button id="btn-export" onclick="exportGLB()" data-i18n="exportGlb"
class="retro-button bg-[#00ff88] hover:bg-[#00cc66] text-black px-5 py-1 border-2 border-[#00ff88] text-xs font-bold">EXPORT GLB</button>
</div>
<div class="flex gap-2 ml-2">
<button onclick="saveScene()" data-i18n="save"
class="retro-button bg-zinc-900 hover:bg-[#ffcc00] hover:text-black px-3 py-1 border-2 border-[#ffcc00] text-[#ffcc00] text-xs">SAVE</button>
<button onclick="loadScene()" data-i18n="load"
class="retro-button bg-zinc-900 hover:bg-[#ffcc00] hover:text-black px-3 py-1 border-2 border-[#ffcc00] text-[#ffcc00] text-xs">LOAD</button>
<a href="./help.html" target="_blank" rel="noopener" data-i18n="help"
class="retro-button bg-zinc-900 hover:bg-[#00ffff] hover:text-black px-3 py-1 border-2 border-[#00ffff] text-[#00ffff] text-xs no-underline">HELP</a>
<button onclick="openConfigModal()" class="retro-button bg-zinc-900 hover:bg-[#aa00ff] hover:text-white px-3 py-1 border-2 border-[#aa00ff] text-[#aa00ff] text-xs" title="Texture Generation Config">CONFIG</button>
<button id="lang-toggle" onclick="toggleLang()" class="retro-button bg-zinc-900 hover:bg-[#ffcc00] hover:text-black px-3 py-1 border-2 border-[#ffcc00] text-sm" title="Toggle language">EN 🇺🇸</button>
</div>
<div id="selected-indicator" class="ml-auto bg-zinc-900 px-3 py-1 text-xs border-2 border-[#ffcc00] flex items-center gap-2 shrink-0">
<span class="w-3 h-3 bg-[#ffcc00] animate-pulse inline-block"></span>
<span id="selected-name" data-i18n="noObject" class="font-mono">NO OBJECT</span>
</div>
</div>
<div id="main-workspace" class="flex flex-1 overflow-hidden min-h-0">
<!-- LEFT PANEL -->
<div id="left-panel" class="w-64 bg-zinc-900 border-r-4 border-[#ffcc00] p-4 flex flex-col panel overflow-y-auto shrink-0 min-h-0">
<!-- Primitives -->
<div class="mb-4">
<h2 data-i18n="primitives" class="text-[#ffcc00] text-xs mb-3 tracking-widest">PRIMITIVES</h2>
<div class="grid grid-cols-3 gap-2">
<button onclick="addPrimitive('cube')" class="retro-button bg-zinc-800 hover:bg-[#ffcc00] hover:text-black p-2 text-center text-[10px] flex flex-col items-center border border-zinc-700"><span class="text-xl mb-1">⬛</span><span data-i18n="cube">CUBE</span></button>
<button onclick="addPrimitive('sphere')" class="retro-button bg-zinc-800 hover:bg-[#ffcc00] hover:text-black p-2 text-center text-[10px] flex flex-col items-center border border-zinc-700"><span class="text-xl mb-1">⚪</span><span data-i18n="sphere">SPHERE</span></button>
<button onclick="addPrimitive('cylinder')" class="retro-button bg-zinc-800 hover:bg-[#ffcc00] hover:text-black p-2 text-center text-[10px] flex flex-col items-center border border-zinc-700"><span class="text-xl mb-1">▬</span><span data-i18n="cylinder">CYLINDER</span></button>
<button onclick="addPrimitive('cone')" class="retro-button bg-zinc-800 hover:bg-[#ffcc00] hover:text-black p-2 text-center text-[10px] flex flex-col items-center border border-zinc-700"><span class="text-xl mb-1">▲</span><span data-i18n="cone">CONE</span></button>
<button onclick="addPrimitive('plane')" class="retro-button bg-zinc-800 hover:bg-[#ffcc00] hover:text-black p-2 text-center text-[10px] flex flex-col items-center border border-zinc-700"><span class="text-xl mb-1">⬜</span><span data-i18n="plane">PLANE</span></button>
<button onclick="addPrimitive('capsule')" class="retro-button bg-zinc-800 hover:bg-[#ffcc00] hover:text-black p-2 text-center text-[10px] flex flex-col items-center border border-zinc-700"><span class="text-xl mb-1">◉</span><span data-i18n="capsule">CAPSULE</span></button>
<button onclick="addPrimitive('torus')" class="retro-button bg-zinc-800 hover:bg-[#ffcc00] hover:text-black p-2 text-center text-[10px] flex flex-col items-center border border-zinc-700"><span class="text-xl mb-1">◯</span><span data-i18n="torus">TORUS</span></button>
<button onclick="addPrimitive('wedge')" class="retro-button bg-zinc-800 hover:bg-[#ffcc00] hover:text-black p-2 text-center text-[10px] flex flex-col items-center border border-zinc-700"><span class="text-xl mb-1">◣</span><span data-i18n="wedge">WEDGE</span></button>
<button onclick="addPrimitive('pyramid')" class="retro-button bg-zinc-800 hover:bg-[#ffcc00] hover:text-black p-2 text-center text-[10px] flex flex-col items-center border border-zinc-700"><span class="text-xl mb-1">△</span><span data-i18n="pyramid">PYRAMID</span></button>
<button onclick="addPrimitive('taperedBox')" class="retro-button bg-zinc-800 hover:bg-[#ffcc00] hover:text-black p-2 text-center text-[10px] flex flex-col items-center border border-zinc-700"><span class="text-xl mb-1">◫</span><span data-i18n="taperedBox">TAPERED BOX</span></button>
<button onclick="addPrimitive('limbLoft')" class="retro-button bg-zinc-800 hover:bg-[#ffcc00] hover:text-black p-2 text-center text-[10px] flex flex-col items-center border border-zinc-700"><span class="text-xl mb-1">◯</span><span data-i18n="limbLoft">LIMB LOFT</span></button>
<button onclick="addPrimitive('lathe')" class="retro-button bg-zinc-800 hover:bg-[#ffcc00] hover:text-black p-2 text-center text-[10px] flex flex-col items-center border border-zinc-700"><span class="text-xl mb-1">◑</span><span data-i18n="lathe">LATHE</span></button>
</div>
</div>
<!-- Import / Export JSON buttons -->
<button onclick='openPngModelWorkbench()' data-i18n='pngFlatModel'
class='retro-button w-full bg-zinc-800 hover:bg-[#7cff00] hover:text-black px-4 py-2 text-xs border-2 border-[#7cff00] text-[#7cff00] mb-2 font-bold'>
PNG TO FLAT MODEL
</button>
<button onclick="openImportModal()" data-i18n="importObjectJson"
class="retro-button w-full bg-zinc-800 hover:bg-[#00ff88] hover:text-black px-4 py-2 text-xs border-2 border-[#00ff88] text-[#00ff88] mb-2 font-bold">
IMPORT OBJECT JSON
</button>
<button onclick="openSvgWorkbench()" data-i18n="svgWorkbench"
class="retro-button w-full bg-zinc-800 hover:bg-[#00d0ff] hover:text-black px-4 py-2 text-xs border-2 border-[#00d0ff] text-[#00d0ff] mb-2 font-bold">
SVG WORKBENCH
</button>
<button onclick="openAvatarForge()" data-i18n="avatarForge"
class="retro-button w-full bg-zinc-800 hover:bg-[#ff77aa] hover:text-black px-4 py-2 text-xs border-2 border-[#ff77aa] text-[#ff77aa] mb-2 font-bold">
AVATAR FORGE
</button>
<div class="flex gap-2 mb-4">
<button onclick="exportObjectJSON()" data-i18n="exportJson"
class="flex-1 retro-button bg-zinc-800 hover:bg-[#ff8800] hover:text-black px-3 py-2 text-xs border-2 border-[#ff8800] text-[#ff8800] font-bold">
EXPORT JSON
</button>
<button onclick="copyExportJSON()" data-i18n="copyBtn"
class="retro-button bg-zinc-800 hover:bg-[#ff8800] hover:text-black px-3 py-2 text-xs border-2 border-[#ff8800] text-[#ff8800] font-bold"
title="Copy to clipboard">
📋
</button>
</div>
<button onclick="exportAllTemplatesGLBZip()" data-i18n="exportTemplatesZip"
class="retro-button w-full bg-zinc-800 hover:bg-[#00d0ff] hover:text-black px-4 py-2 text-xs border-2 border-[#00d0ff] text-[#00d0ff] mb-4 font-bold">
EXPORT TEMPLATES ZIP
</button>
<!-- Template list (generated dynamically) -->
<div class="mb-2">
<h2 data-i18n="templates" class="text-[#ffcc00] text-xs mb-3 tracking-widest">TEMPLATES</h2>
<div id="template-list"></div>
</div>
<!-- Archetypes section -->
<div class="mt-4 pt-3 border-t-2 border-[#00ffcc]">
<div class="flex items-center justify-between mb-2">
<h2 data-i18n="archetypes" class="text-[#00ffcc] text-xs tracking-widest">ARQUETIPOS</h2>
<button onclick="openPromptModal()" class="retro-button bg-zinc-800 border border-[#ff00ff] text-[#ff00ff] px-2 py-1 text-[9px] hover:bg-[#ff00ff] hover:text-black" title="Generar prompt para LLM">PROMPT LLM</button>
</div>
<p data-i18n="archetypesHint" class="text-zinc-500 text-[9px] mb-2">Añade un personaje con rig y abre el panel de animaciones</p>
<div class="flex flex-col gap-1">
<button onclick="openArchetype('HUMANOID')" class="retro-button bg-zinc-800 hover:bg-[#00ffcc] hover:text-black px-3 py-2 text-left text-[10px] flex items-center gap-2 border border-[#00ffcc]/40">
<span class="text-[#00ffcc]">■</span><span data-i18n="archetypeHumanoid">HUMANOIDE</span>
</button>
<button onclick="openArchetype('BIRD')" class="retro-button bg-zinc-800 hover:bg-[#00ffcc] hover:text-black px-3 py-2 text-left text-[10px] flex items-center gap-2 border border-[#00ffcc]/40">
<span class="text-[#00ffcc]">■</span><span data-i18n="archetypeBird">AVE</span>
</button>
<button onclick="openArchetype('QUADRUPED')" class="retro-button bg-zinc-800 hover:bg-[#00ffcc] hover:text-black px-3 py-2 text-left text-[10px] flex items-center gap-2 border border-[#00ffcc]/40">
<span class="text-[#00ffcc]">■</span><span data-i18n="archetypeQuadruped">CUADRUPEDO</span>
</button>
<button onclick="openArchetype('PROP')" class="retro-button bg-zinc-800 hover:bg-[#00ffcc] hover:text-black px-3 py-2 text-left text-[10px] flex items-center gap-2 border border-[#00ffcc]/40">
<span class="text-[#00ffcc]">■</span><span data-i18n="archetypeProp">OBJETO</span>
</button>
<button onclick="openArchetype('CAR')" class="retro-button bg-zinc-800 hover:bg-[#00ffcc] hover:text-black px-3 py-2 text-left text-[10px] flex items-center gap-2 border border-[#00ffcc]/40">
<span class="text-[#00ffcc]">■</span><span data-i18n="archetypeCar">VEHÍCULO</span>
</button>
</div>
</div>
<div class="mt-4 pt-4 border-t border-zinc-700 text-[10px] text-zinc-400">
<span data-i18n="helpClickSelect">Click = select | Ctrl+Click = multi</span><br>
<span data-i18n="helpDblClick">Double-click = select group</span><br>
<span data-i18n="helpDragGizmo">Drag gizmo = transform</span>
</div>
</div>
<!-- LEFT PANEL TOGGLE -->
<button id="toggle-left" onclick="toggleLeftPanel()" class="w-5 bg-zinc-950 border-r-2 border-[#ffcc00] flex items-center justify-center cursor-pointer hover:bg-zinc-800 shrink-0 z-10" title="Toggle left panel">
<span id="toggle-left-icon" class="text-[#ffcc00] text-[10px]">◀</span>
</button>
<div id="anim-mode-preview-split" class="hidden flex flex-wrap flex-1 min-w-0">
<div id="anim-mode-model-stage" class="flex min-w-[16rem] min-h-0 basis-1/2 grow shrink border-r-2 border-[#00ff88]/40"></div>
<div id="anim-mode-rig-stage" class="hidden flex min-w-[16rem] min-h-0 basis-1/2 grow shrink bg-zinc-950 border-l-2 border-[#00ff88]/40"></div>
</div>
<!-- VIEWPORT -->
<div id="viewport" class="flex-1 relative min-w-0">
<canvas id="canvas"></canvas>
<div data-i18n="orbitInfo" class="absolute bottom-4 left-4 bg-black/70 text-[10px] px-3 py-1 font-mono border border-[#ffcc00]/30 rounded">
Orbit: click+drag | Zoom: wheel
</div>
<div id="snap-info" onclick="toggleSnap()"
class="absolute top-4 right-4 bg-black/70 text-xs px-3 py-1 cursor-pointer flex items-center gap-2 border border-[#ffcc00]/50 rounded">
<span id="snap-status" data-i18n="snapOff" class="text-[#ffcc00]">SNAP: OFF</span>
<span class="text-zinc-400">0.5u</span>
</div>
<!-- Selected object name overlay -->
<div id="selected-overlay" class="hidden absolute top-12 right-4 bg-black/70 text-xs px-3 py-1 font-mono border border-[#4488ff]/50 rounded text-[#4488ff] pointer-events-none"></div>
<!-- Collapsible object list -->
<div id="object-list-panel" class="absolute left-4 z-20" style="top: 88px; max-height: calc(100% - 120px);">
<button id="object-list-toggle" onclick="toggleObjectList()"
class="bg-black/70 border border-[#ffcc00]/50 rounded px-2 py-1 text-[10px] font-mono text-[#ffcc00] cursor-pointer hover:bg-black/90 flex items-center gap-1">
<span data-i18n="sceneObjects">OBJECTS</span>
<span id="object-list-count" class="text-zinc-400">(0)</span>
<span id="object-list-arrow" class="ml-1">▶</span>
</button>
<div id="object-list-content" class="hidden mt-1 bg-black/85 border border-[#ffcc00]/30 rounded overflow-y-auto font-mono text-[10px]" style="max-height: calc(100vh - 200px); min-width: 160px; max-width: 240px;">
</div>
</div>
<!-- Help icon + texture editor button -->
<div class="absolute top-4 left-4 flex flex-col gap-2">
<div class="relative">
<div id="help-icon" class="w-8 h-8 bg-black/70 border border-[#ffcc00]/50 rounded flex items-center justify-center cursor-help text-[#ffcc00] text-sm font-bold">?</div>
<div id="shortcuts-tooltip" class="hidden absolute top-0 left-10 bg-black/95 border-2 border-[#ffcc00] p-4 rounded text-[10px] font-mono whitespace-nowrap z-40 flex-col gap-1">
<div data-i18n="keyboardShortcuts" class="text-[#ffcc00] mb-2 text-xs">KEYBOARD SHORTCUTS</div>
<div><span class="text-[#ffcc00]">W</span> <span data-i18n="scMove">Move</span></div>
<div><span class="text-[#ffcc00]">E</span> <span data-i18n="scRotate">Rotate</span></div>
<div><span class="text-[#ffcc00]">R</span> <span data-i18n="scScale">Scale</span></div>
<div><span class="text-[#ffcc00]">Del</span> <span data-i18n="scDelete">Delete</span></div>
<div><span class="text-[#ffcc00]">Ctrl+Z</span> <span data-i18n="scUndo">Undo</span></div>
<div><span class="text-[#ffcc00]">Ctrl+Shift+Z</span> <span data-i18n="scRedo">Redo</span></div>
<div><span class="text-[#ffcc00]">Ctrl+D</span> <span data-i18n="scDuplicate">Duplicate</span></div>
<div><span class="text-[#ffcc00]">Ctrl+G</span> <span data-i18n="scGroup">Group</span></div>
<div><span class="text-[#ffcc00]">Ctrl+Shift+G</span> <span data-i18n="scUngroup">Ungroup</span></div>
<div><span class="text-[#ffcc00]">Space</span> <span data-i18n="scPlayPause">Play/Pause animation</span></div>
<div><span class="text-[#ffcc00]">Esc</span> <span data-i18n="scExitAnim">Exit animation mode</span></div>
<div><span class="text-[#ffcc00]">Ctrl+Click</span> <span data-i18n="scMultiSelect">Multi-selection</span></div>
<div><span class="text-[#ffcc00]">Dbl-click</span> <span data-i18n="scSelectGroup">Select group</span></div>
</div>
</div>
<div onclick="openTextureEditor()" class="w-8 h-8 bg-black/70 border border-[#00ffcc]/50 rounded flex items-center justify-center cursor-pointer text-[#00ffcc] text-sm font-bold hover:bg-[#00ffcc]/20" data-i18n="textureEditor" data-i18n-attr="title" title="TEXTURE EDITOR">T</div>
</div>
<!-- Quick color palette + picker -->
<div class="absolute bottom-4 right-4 flex gap-1 items-center bg-black/70 p-2 rounded border border-[#ffcc00]/30">
<div onclick="quickColor('#ffcc00')" class="w-6 h-6 bg-[#ffcc00] rounded cursor-pointer border-2 border-white/50"></div>
<div onclick="quickColor('#ff0000')" class="w-6 h-6 bg-[#ff0000] rounded cursor-pointer border-2 border-white/50"></div>
<div onclick="quickColor('#00ff00')" class="w-6 h-6 bg-[#00ff00] rounded cursor-pointer border-2 border-white/50"></div>
<div onclick="quickColor('#0088ff')" class="w-6 h-6 bg-[#0088ff] rounded cursor-pointer border-2 border-white/50"></div>
<div onclick="quickColor('#ff8800')" class="w-6 h-6 bg-[#ff8800] rounded cursor-pointer border-2 border-white/50"></div>
<div onclick="quickColor('#aa00ff')" class="w-6 h-6 bg-[#aa00ff] rounded cursor-pointer border-2 border-white/50"></div>
<div onclick="quickColor('#555555')" class="w-6 h-6 bg-[#555555] rounded cursor-pointer border-2 border-white/50"></div>
<div onclick="quickColor('#ffffff')" class="w-6 h-6 bg-[#ffffff] rounded cursor-pointer border-2 border-white/50"></div>
<div class="w-px h-6 bg-zinc-600 mx-1"></div>
<input id="palette-color-picker" type="color" value="#ffcc00" class="w-7 h-7 bg-transparent border-2 border-[#ffcc00] rounded cursor-pointer">
</div>
<!-- Animation Timeline (hidden by default) -->
<div id="animation-timeline" class="hidden bg-black/90 border-2 border-[#ffcc00] rounded px-4 py-3 flex items-center gap-3 text-[10px] font-mono w-full">
<select id="anim-select" onchange="onAnimSelectChange()" class="bg-zinc-800 border border-[#ffcc00] text-white text-[10px] px-2 py-1 max-w-[120px]"></select>
<button id="btn-play" onclick="playAnim()" data-i18n="play" class="retro-button bg-[#ffcc00] text-black px-3 py-1 font-bold">PLAY</button>
<button id="btn-stop" onclick="stopAnim()" data-i18n="stop" class="retro-button bg-zinc-800 border border-[#ffcc00] text-[#ffcc00] px-3 py-1">STOP</button>
<div class="flex items-center gap-2">
<div class="w-32 h-2 bg-zinc-800 border border-[#ffcc00]/50 rounded overflow-hidden">
<div id="anim-progress" class="h-full bg-[#ffcc00]" style="width: 0%"></div>
</div>
<span id="anim-time" class="text-[#ffcc00] min-w-[60px]">0.0 / 0.0</span>
</div>
</div>
</div>
<!-- RIGHT PANEL TOGGLE -->
<button id="toggle-right" onclick="toggleRightPanel()" class="w-5 bg-zinc-900 border-l border-zinc-700 flex items-center justify-center cursor-pointer hover:bg-zinc-800 shrink-0 z-10" title="Toggle right panel">
<span id="toggle-right-icon" class="text-[#ffcc00] text-[10px]">▶</span>
</button>
<!-- RIGHT PANEL: PROPERTIES / SCENE INFO -->
<div id="right-panel" class="w-72 bg-zinc-900 border-l-4 border-[#ffcc00] p-4 flex flex-col panel overflow-y-auto shrink-0 min-h-0">
<div id="anim-mode-rig-panel" class="hidden h-full w-full bg-black/90 border-2 border-[#00ff88] rounded overflow-hidden shrink-0 flex flex-col min-h-0">
<button onclick="animModeToggleSection('rig')" class="w-full flex items-center justify-between gap-3 px-3 py-2 bg-zinc-950/90 border-b border-[#00ff88]/30 text-left">
<span class="text-[#00ff88] text-[10px] tracking-widest">RIG PREVIEW</span>
<div class="flex items-center gap-3 shrink-0">
<span id="anim-mode-rig-status" class="text-zinc-500 text-[8px]">LIVE</span>
<span onclick="event.stopPropagation(); animModeToggleRigViewport()" class="retro-button bg-zinc-900 border border-[#00ff88] text-[#00ff88] px-2 py-1 text-[9px]">HIDE</span>
<span id="anim-mode-section-arrow-rig" class="text-[#00ff88] text-[10px] toggle-arrow">▼</span>
</div>
</button>
<div id="anim-mode-section-body-rig" class="flex-1 min-h-0 p-3 flex flex-col gap-3">
<div id="anim-mode-rig-viewport" class="relative flex-1 min-h-[16rem] bg-zinc-950 border border-[#00ff88]/40 overflow-hidden rounded">
<canvas id="anim-mode-rig-canvas" class="absolute inset-0 w-full h-full block"></canvas>
<div id="anim-mode-rig-empty" class="absolute inset-0 flex items-center justify-center text-zinc-600 text-[9px] text-center px-4 leading-relaxed pointer-events-none">
Select a humanoid group with a skeleton to preview its rig here.
</div>
</div>
<p id="anim-mode-rig-hint" class="text-zinc-500 text-[9px] leading-relaxed min-h-[1em]">Orbit and zoom here, click a rig point, then move it with the main viewport gizmo or tweak X/Y/Z below.</p>
</div>
</div>
<div id="anim-mode-tools-panel" class="hidden flex-1 min-h-0 overflow-y-auto flex flex-col gap-3 pr-1">
<div class="bg-black/90 border-2 border-[#ff77aa] rounded overflow-hidden shrink-0">
<button onclick="animModeToggleSection('reference')" class="w-full flex items-center justify-between gap-3 px-3 py-2 bg-zinc-950/90 border-b border-[#ff77aa]/30 text-left">
<span class="text-[#ff77aa] text-[10px] tracking-widest">REFERENCE VIDEO</span>
<span id="anim-mode-section-arrow-reference" class="text-[#ff77aa] text-[10px] toggle-arrow">▼</span>
</button>
<div id="anim-mode-section-body-reference" class="p-3"></div>
</div>
<div class="bg-black/90 border-2 border-[#ffcc00] rounded overflow-hidden shrink-0">
<button onclick="animModeToggleSection('pose')" class="w-full flex items-center justify-between gap-3 px-3 py-2 bg-zinc-950/90 border-b border-[#ffcc00]/30 text-left">
<span class="text-[#ffcc00] text-[10px] tracking-widest">POSE LIBRARY</span>
<span id="anim-mode-section-arrow-pose" class="text-[#ffcc00] text-[10px] toggle-arrow">▼</span>
</button>
<div id="anim-mode-section-body-pose" class="p-3"></div>
</div>
<div class="bg-black/90 border-2 border-[#00ff88] rounded overflow-hidden shrink-0">
<button onclick="animModeToggleSection('import')" class="w-full flex items-center justify-between gap-3 px-3 py-2 bg-zinc-950/90 border-b border-[#00ff88]/30 text-left">
<span class="text-[#00ff88] text-[10px] tracking-widest">IMPORT</span>
<span id="anim-mode-section-arrow-import" class="text-[#00ff88] text-[10px] toggle-arrow">▼</span>
</button>
<div id="anim-mode-section-body-import" class="p-3"></div>
</div>
<div class="bg-black/90 border-2 border-[#00d0ff] rounded overflow-hidden shrink-0">
<button onclick="animModeToggleSection('export')" class="w-full flex items-center justify-between gap-3 px-3 py-2 bg-zinc-950/90 border-b border-[#00d0ff]/30 text-left">
<span class="text-[#00d0ff] text-[10px] tracking-widest">EXPORT</span>
<span id="anim-mode-section-arrow-export" class="text-[#00d0ff] text-[10px] toggle-arrow">▼</span>
</button>
<div id="anim-mode-section-body-export" class="p-3"></div>
</div>
</div>
<!-- Scene info (shown when nothing selected) -->
<div id="scene-info-view">
<h2 data-i18n="sceneObjects" class="text-[#ffcc00] text-xs mb-4 tracking-widest">OBJECTS</h2>
<div id="scene-object-list" class="space-y-1 mb-4"></div>
<div class="pt-3 border-t border-zinc-700 space-y-2">
<label data-i18n="sceneJson" class="block text-zinc-400 mb-1 text-[10px]">SCENE JSON</label>
<div class="flex gap-2">
<button onclick="exportSceneJSON()" data-i18n="exportBtn" class="flex-1 text-[10px] bg-zinc-800 border border-[#ffcc00] py-1">EXPORT</button>
<button onclick="copySceneJSON()" data-i18n="copyBtn" class="text-[10px] bg-zinc-800 border border-[#ffcc00] py-1 px-2" title="Copy to clipboard">📋</button>
<label class="flex-1 text-[10px] bg-zinc-800 border border-[#ffcc00] py-1 text-center cursor-pointer">
<span data-i18n="importBtn">IMPORT</span>
<input type="file" accept=".json" class="hidden" onchange="importSceneJSON(event)">
</label>
</div>
</div>
</div>
<!-- Properties (shown when object selected) -->
<div id="properties-panel" class="hidden">
<h2 data-i18n="properties" class="text-[#ffcc00] text-xs mb-4 tracking-widest">PROPERTIES</h2>
<!-- Single selection fields -->
<div id="single-selection-fields" class="space-y-5 text-xs">
<div>
<label data-i18n="name" class="block text-zinc-400 mb-1">NAME</label>
<input id="prop-name" type="text"
class="w-full bg-zinc-800 border-2 border-[#ffcc00] px-3 py-2 font-mono text-white focus:outline-none"
oninput="updateName(this.value)">
</div>
<div class="grid grid-cols-3 gap-2">
<div><label class="block text-zinc-400 mb-1">POS X</label><input id="prop-posx" type="number" step="0.1" class="w-full bg-zinc-800 border-2 border-[#ffcc00] px-2 py-1 font-mono text-white focus:outline-none text-[10px]" oninput="updatePosition()"></div>
<div><label class="block text-zinc-400 mb-1">POS Y</label><input id="prop-posy" type="number" step="0.1" class="w-full bg-zinc-800 border-2 border-[#ffcc00] px-2 py-1 font-mono text-white focus:outline-none text-[10px]" oninput="updatePosition()"></div>
<div><label class="block text-zinc-400 mb-1">POS Z</label><input id="prop-posz" type="number" step="0.1" class="w-full bg-zinc-800 border-2 border-[#ffcc00] px-2 py-1 font-mono text-white focus:outline-none text-[10px]" oninput="updatePosition()"></div>
<div><label class="block text-zinc-400 mb-1">ROT X</label><input id="prop-rotx" type="number" step="1" class="w-full bg-zinc-800 border-2 border-[#ffcc00] px-2 py-1 font-mono text-white focus:outline-none text-[10px]" oninput="updateRotation()"></div>
<div><label class="block text-zinc-400 mb-1">ROT Y</label><input id="prop-roty" type="number" step="1" class="w-full bg-zinc-800 border-2 border-[#ffcc00] px-2 py-1 font-mono text-white focus:outline-none text-[10px]" oninput="updateRotation()"></div>
<div><label class="block text-zinc-400 mb-1">ROT Z</label><input id="prop-rotz" type="number" step="1" class="w-full bg-zinc-800 border-2 border-[#ffcc00] px-2 py-1 font-mono text-white focus:outline-none text-[10px]" oninput="updateRotation()"></div>
<div><label class="block text-zinc-400 mb-1">SCL X</label><input id="prop-scalex" type="number" step="0.1" class="w-full bg-zinc-800 border-2 border-[#ffcc00] px-2 py-1 font-mono text-white focus:outline-none text-[10px]" oninput="updateScale()"></div>
<div><label class="block text-zinc-400 mb-1">SCL Y</label><input id="prop-scaley" type="number" step="0.1" class="w-full bg-zinc-800 border-2 border-[#ffcc00] px-2 py-1 font-mono text-white focus:outline-none text-[10px]" oninput="updateScale()"></div>
<div><label class="block text-zinc-400 mb-1">SCL Z</label><input id="prop-scalez" type="number" step="0.1" class="w-full bg-zinc-800 border-2 border-[#ffcc00] px-2 py-1 font-mono text-white focus:outline-none text-[10px]" oninput="updateScale()"></div>
</div>
<div>
<label data-i18n="baseColor" class="block text-zinc-400 mb-1">BASE COLOR</label>
<div class="flex gap-3">
<input id="prop-color" type="color" value="#ffcc00" class="w-12 h-10 bg-transparent border-2 border-[#ffcc00] cursor-pointer" onchange="updateColor(this.value)">
<button onclick="randomRetroColor()" data-i18n="randomRetro" class="flex-1 bg-zinc-800 border-2 border-[#ffcc00] text-xs">RANDOM RETRO</button>
</div>
</div>
<div>
<label data-i18n="opacity" class="block text-zinc-400 mb-1">OPACITY</label>
<div class="flex gap-2 items-center">
<input id="prop-opacity" type="range" min="0" max="1" step="0.05" value="1" class="flex-1 accent-[#ffcc00]" oninput="updateOpacity(this.value)">
<span id="prop-opacity-value" class="text-[10px] text-[#ffcc00] min-w-[32px] text-right">1.00</span>
</div>
</div>
<div>
<label data-i18n="material" class="block text-zinc-400 mb-1">MATERIAL</label>
<select id="prop-material" onchange="updateMaterial()" class="w-full bg-zinc-800 border-2 border-[#ffcc00] px-3 py-2 text-white">
<option value="Basic" data-i18n="matBasic">Unlit (Basic)</option>
<option value="Lambert" selected data-i18n="matLambert">Lambert (N64)</option>
<option value="Phong" data-i18n="matPhong">Phong</option>
<option value="Standard" data-i18n="matStandard">Standard (PBR)</option>
</select>
</div>
<div id="face-mode-controls" class="hidden">
<label class="block text-zinc-400 mb-1">FACE MODE</label>
<select id="prop-face-mode" onchange="updateFaceMode(this.value)" class="w-full bg-zinc-800 border-2 border-[#ff77aa] px-3 py-2 text-white">
<option value="decal">DECAL</option>
<option value="hybrid">HYBRID</option>
<option value="geometry">GEOMETRY</option>
</select>
<p id="prop-face-mode-hint" class="text-zinc-500 text-[9px] leading-relaxed mt-2 min-h-[1em]">FACE_DECAL rendering mode.</p>
</div>
<!-- Texture section -->
<div>
<label data-i18n="texture" class="block text-zinc-400 mb-1">TEXTURE</label>
<div id="texture-drop-zone" class="texture-drop-zone rounded p-3 text-center cursor-pointer mb-2 relative">
<img id="texture-preview" class="hidden w-full h-16 object-cover rounded mb-2" alt="preview">
<p data-i18n="textureDrop" class="text-[10px] text-zinc-400">Drop image or click to load</p>
<input type="file" id="texture-upload" accept="image/*" class="absolute inset-0 opacity-0 cursor-pointer" onchange="handleTextureUpload(event)">
</div>
<div class="flex gap-2">
<button onclick="toggleTexture()" data-i18n="onOff" class="flex-1 text-[10px] bg-zinc-800 border border-[#ffcc00] py-1">ON/OFF</button>
<button onclick="togglePixelated()" data-i18n="pixel" class="flex-1 text-[10px] bg-zinc-800 border border-[#ffcc00] py-1">PIXEL</button>
</div>
</div>
<!-- UV Controls (hidden until texture loaded) -->
<div id="uv-controls" class="hidden">
<label data-i18n="uvMapping" class="block text-zinc-400 mb-1">UV MAPPING</label>
<div class="grid grid-cols-2 gap-2">
<div><label class="block text-zinc-500 text-[10px]">OFFSET X</label><input id="uv-offset-x" type="number" step="0.1" value="0" class="w-full bg-zinc-800 border border-[#ffcc00] px-2 py-1 font-mono text-white text-[10px]" oninput="updateUVOffset()"></div>
<div><label class="block text-zinc-500 text-[10px]">OFFSET Y</label><input id="uv-offset-y" type="number" step="0.1" value="0" class="w-full bg-zinc-800 border border-[#ffcc00] px-2 py-1 font-mono text-white text-[10px]" oninput="updateUVOffset()"></div>
<div><label class="block text-zinc-500 text-[10px]">REPEAT X</label><input id="uv-repeat-x" type="number" step="0.1" value="1" class="w-full bg-zinc-800 border border-[#ffcc00] px-2 py-1 font-mono text-white text-[10px]" oninput="updateUVRepeat()"></div>
<div><label class="block text-zinc-500 text-[10px]">REPEAT Y</label><input id="uv-repeat-y" type="number" step="0.1" value="1" class="w-full bg-zinc-800 border border-[#ffcc00] px-2 py-1 font-mono text-white text-[10px]" oninput="updateUVRepeat()"></div>
</div>
<div class="mt-2"><label data-i18n="rotation" class="block text-zinc-500 text-[10px]">ROTATION</label><input id="uv-rotation" type="number" step="5" value="0" class="w-full bg-zinc-800 border border-[#ffcc00] px-2 py-1 font-mono text-white text-[10px]" oninput="updateUVRotation()"></div>
</div>
<!-- Quick actions -->
<div class="flex gap-2 pt-3 border-t border-zinc-700">
<button onclick="duplicateSelected()" data-i18n="duplicate" class="flex-1 retro-button bg-[#ffcc00] text-black py-2 text-[10px]">DUPLICATE</button>
<button onclick="deleteSelected()" data-i18n="deleteBtn" class="flex-1 retro-button bg-red-500 text-white py-2 text-[10px]">DELETE</button>
</div>
<button onclick="centerCameraOnSelected()" data-i18n="centerCamera" class="w-full retro-button bg-zinc-800 border-2 border-[#ffcc00] py-2 text-[10px]">CENTER CAMERA</button>
<button id="btn-ungroup" onclick="ungroupSelected()" data-i18n="ungroupBtn" class="w-full retro-button bg-zinc-800 border-2 border-[#aa00ff] text-[#aa00ff] py-2 text-[10px] hidden">UNGROUP (Ctrl+Shift+G)</button>
<!-- Bone re-parenting controls -->
<div id="bone-controls" class="space-y-1 hidden">
<button id="btn-detach-bone" onclick="detachBone()" data-i18n="detachBone" class="w-full retro-button bg-zinc-800 border-2 border-[#00ffff] text-[#00ffff] py-2 text-[10px]">DETACH BONE</button>
<p data-i18n="shiftClickBone" class="text-[9px] text-zinc-500 leading-tight">SHIFT+CLICK on another bone to attach</p>
</div>
<button id="btn-anim-mode" onclick="enterAnimationMode()" data-i18n="animationMode" class="w-full retro-button bg-zinc-800 border-2 border-[#00ff88] text-[#00ff88] py-2 text-[10px] hidden">ANIMATION MODE</button>
<button id="btn-rig-panel" onclick="openRigPanel()" data-i18n="rigAnimations" class="w-full retro-button bg-zinc-800 border-2 border-[#00ffcc] text-[#00ffcc] py-2 text-[10px] hidden mt-1">RIG / ANIMATIONS</button>
<button id="btn-edit-avatar" onclick="openAvatarForge()" data-i18n="editAvatar" class="w-full retro-button bg-zinc-800 border-2 border-[#ff77aa] text-[#ff77aa] py-2 text-[10px] hidden mt-1">EDIT AVATAR</button>
<button id="btn-head-lab" onclick="openSvgHeadWorkbenchForSelection()" data-i18n="openHeadLab" class="w-full retro-button bg-zinc-800 border-2 border-[#ff8800] text-[#ffb454] py-2 text-[10px] hidden mt-1">HEAD LAB</button>
<button id="btn-edit-svg-source" onclick="openSvgWorkbenchForSelection()" data-i18n="editSvgSource" class="w-full retro-button bg-zinc-800 border-2 border-[#00d0ff] text-[#00d0ff] py-2 text-[10px] hidden mt-1">EDIT SVG SOURCE</button>
<!-- Object JSON export -->
<button id='btn-edit-png-model' onclick='openPngModelWorkbenchForSelection()' data-i18n='editPngFlatModel' class='w-full retro-button bg-zinc-800 border-2 border-[#7cff00] text-[#7cff00] py-2 text-[10px] hidden mt-1'>EDIT PNG MODEL</button>
<div id="btn-copy-json-group" class="flex gap-2 hidden">
<button onclick="copyObjectJSON()" data-i18n="copyJson" class="flex-1 retro-button bg-zinc-800 border-2 border-[#0088ff] text-[#0088ff] py-2 text-[10px]">COPY JSON</button>
<button onclick="downloadObjectJSON()" data-i18n="download" class="flex-1 retro-button bg-zinc-800 border-2 border-[#0088ff] text-[#0088ff] py-2 text-[10px]">DOWNLOAD</button>
</div>
</div>
<!-- Multi-selection fields -->
<div id="multi-selection-fields" class="space-y-4 text-xs hidden">
<p class="text-zinc-400 text-[10px]"><span data-i18n="multipleSelected">Multiple objects selected</span> (<span id="multi-count">0</span>)</p>
<p class="text-zinc-500 text-[10px]" data-i18n="multiTransformHint">Use W/E/R gizmo to move/rotate/scale all at once</p>
<button onclick="groupSelected()" data-i18n="groupBtn" class="w-full retro-button bg-[#ffcc00] text-black py-3 text-xs font-bold">GROUP (Ctrl+G)</button>
<button onclick="deleteSelected()" data-i18n="deleteAll" class="w-full retro-button bg-red-700 text-white py-2 text-xs">DELETE ALL SELECTED</button>
<div>
<label data-i18n="applyColorAll" class="block text-zinc-400 mb-1">APPLY COLOR TO ALL</label>
<div class="flex gap-2">
<input id="multi-color-picker" type="color" value="#ffcc00" class="w-12 h-10 bg-transparent border-2 border-[#ffcc00] cursor-pointer">
<button onclick="applyColorToAll()" data-i18n="apply" class="flex-1 bg-zinc-800 border-2 border-[#ffcc00] text-xs">APPLY</button>
</div>
</div>
<div>
<label data-i18n="opacity" class="block text-zinc-400 mb-1">OPACITY</label>
<div class="flex gap-2 items-center">
<input id="multi-opacity" type="range" min="0" max="1" step="0.05" value="1" class="flex-1 accent-[#ffcc00]" oninput="applyOpacityToAll(this.value)">
<span id="multi-opacity-value" class="text-[10px] text-[#ffcc00] min-w-[32px] text-right">1.00</span>
</div>
</div>
</div>
</div><!-- /properties-panel -->
</div><!-- /right-panel -->
<!-- ANIMATION MODE PANEL (right side, hidden by default) -->
<div id="anim-mode-panel" class="w-80 bg-zinc-900 border-r-4 border-[#00ff88] p-4 flex flex-col panel overflow-hidden shrink-0 hidden">
<div class="flex items-center justify-between mb-4">
<h2 data-i18n="animations" class="text-[#00ff88] text-xs tracking-widest">ANIMATIONS</h2>
<button onclick="exitAnimationMode()" data-i18n="back" class="retro-button bg-red-600 text-white px-3 py-1 text-[10px] font-bold">BACK</button>
</div>
<div id="anim-mode-obj-name" class="text-[#ffcc00] text-[10px] mb-3 font-bold"></div>
<div id="anim-mode-library-panel" class="bg-black/90 border-2 border-[#00ff88] rounded p-3 mb-3 space-y-2">
<div class="flex items-center justify-between gap-2">
<span data-i18n="standardClipLibrary" class="text-[#00ff88] text-[9px] tracking-widest">LIBRARY CLIP</span>
<span class="text-zinc-500 text-[9px]">HUMANOID_STANDARD</span>
</div>
<div class="flex items-center gap-2">
<select id="anim-mode-library-clip-select" class="flex-1 min-w-0 bg-zinc-800 border border-[#00ff88] text-white text-[10px] px-2 py-1"></select>
<button id="anim-mode-library-apply" onclick="animModeApplyLibraryClip()" data-i18n="apply" class="retro-button bg-[#00ff88] text-black px-3 py-1 text-[10px] font-bold border-2 border-[#00ff88] shrink-0">APPLY</button>
</div>
<p id="anim-mode-library-status" class="text-zinc-500 text-[9px] leading-relaxed min-h-[1em]"></p>
</div>
<!-- Animation list -->
<div id="anim-mode-list" class="space-y-2 mb-4 flex-1 overflow-y-auto min-h-0 pr-1">
<p data-i18n="noAnimations" class="text-zinc-500 text-[10px]">No animations. Import one.</p>
</div>
<div id="anim-mode-editor" class="bg-black/90 border-2 border-[#00d0ff] rounded p-4 flex flex-col gap-4">
<div class="flex flex-wrap items-start justify-between gap-4">
<div class="min-w-[18rem]">
<h3 class="text-[#00d0ff] text-[10px] tracking-widest">FRAME EDITOR</h3>
<p class="text-zinc-500 text-[9px] leading-relaxed">Click a rig point, move it with the main gizmo, or fine-tune the current frame here.</p>
</div>
<div class="flex items-center gap-2 flex-wrap justify-end">
<button onclick="animModeEditorPrevFrame()" class="retro-button bg-zinc-800 border border-[#00d0ff] text-[#00d0ff] px-3 py-1 text-[10px]">PREV FRAME</button>
<button onclick="animModeEditorNextFrame()" class="retro-button bg-zinc-800 border border-[#00d0ff] text-[#00d0ff] px-3 py-1 text-[10px]">NEXT FRAME</button>
<span id="anim-mode-editor-frame-label" class="text-zinc-500 text-[9px] text-right min-w-[9rem]">NO FRAME</span>
</div>
</div>
<input id="anim-mode-keyframe-slider" type="range" min="0" max="0" step="1" value="0" oninput="animModeEditorScrubFrame()" class="w-full accent-[#00d0ff]" />
<div class="flex flex-wrap items-end gap-3">
<label class="flex flex-col gap-1 min-w-[16rem] flex-[1.6]">
<span class="text-zinc-400 text-[9px] tracking-widest">POINT</span>
<select id="anim-mode-track-select" onchange="animModeEditorChangeTrack()" class="w-full bg-zinc-800 border border-[#00d0ff] text-white text-[10px] px-2 py-2">
<option value="">SELECT POINT</option>
</select>
</label>
<label class="flex flex-col gap-1 min-w-[6.5rem] flex-1">
<span class="text-zinc-400 text-[9px] tracking-widest">X</span>
<input id="anim-mode-keyframe-x" type="number" step="0.01" class="bg-zinc-800 border border-[#00d0ff] px-2 py-2 font-mono text-white text-[10px]" placeholder="X">
</label>
<label class="flex flex-col gap-1 min-w-[6.5rem] flex-1">
<span class="text-zinc-400 text-[9px] tracking-widest">Y</span>
<input id="anim-mode-keyframe-y" type="number" step="0.01" class="bg-zinc-800 border border-[#00d0ff] px-2 py-2 font-mono text-white text-[10px]" placeholder="Y">
</label>
<label class="flex flex-col gap-1 min-w-[6.5rem] flex-1">
<span class="text-zinc-400 text-[9px] tracking-widest">Z</span>
<input id="anim-mode-keyframe-z" type="number" step="0.01" class="bg-zinc-800 border border-[#00d0ff] px-2 py-2 font-mono text-white text-[10px]" placeholder="Z">
</label>
<button onclick="animModeEditorPreviewFrame()" class="retro-button bg-zinc-800 border border-[#ffcc00] text-[#ffcc00] px-4 py-2 text-[10px] min-w-[7rem]">PREVIEW</button>
<button onclick="animModeEditorApply()" class="retro-button bg-[#00d0ff] text-black px-4 py-2 text-[10px] font-bold border-2 border-[#00d0ff] min-w-[8rem]">SAVE FRAME</button>
</div>
<p id="anim-mode-editor-status" class="text-zinc-500 text-[9px] leading-relaxed min-h-[1em]">Select a clip and a point to edit this frame.</p>
</div>
<div id="anim-mode-reference-video" class="space-y-3">
<div class="flex items-center justify-between gap-2">
<span class="text-zinc-500 text-[9px] tracking-widest">LOCAL PLAYER</span>
<span id="anim-mode-reference-time" class="text-zinc-500 text-[9px]">0.00 / 0.00</span>
</div>
<div class="relative mb-2 bg-black border border-[#ff77aa]/40">
<video id="anim-mode-reference-player" class="w-full h-40 bg-black object-contain" playsinline preload="metadata"></video>
<div id="anim-mode-reference-empty" class="absolute inset-0 flex items-center justify-center text-zinc-600 text-[9px] text-center px-4 leading-relaxed pointer-events-none">
Load a local video here to review the motion at 0.25x or frame by frame.
</div>
</div>
<div class="grid grid-cols-2 gap-2 mb-2">
<label class="retro-button bg-zinc-800 border border-[#ff77aa] text-[#ff77aa] py-2 text-[10px] text-center cursor-pointer">
LOAD VIDEO
<input id="anim-mode-reference-input" type="file" accept="video/*" class="hidden" onchange="animModeLoadReferenceVideo(event)">
</label>
<button onclick="animModeClearReferenceVideo()" class="retro-button bg-zinc-800 border border-zinc-600 text-zinc-300 py-2 text-[10px]">CLEAR</button>
</div>
<div class="grid grid-cols-3 gap-2 mb-2">
<button onclick="animModeToggleReferenceVideoPlayback()" class="retro-button bg-zinc-800 border border-[#ff77aa] text-[#ff77aa] py-2 text-[10px]">PLAY / PAUSE</button>
<button onclick="animModeReferenceVideoPrevFrame()" class="retro-button bg-zinc-800 border border-[#ff77aa] text-[#ff77aa] py-2 text-[10px]">PREV FRAME</button>
<button onclick="animModeReferenceVideoNextFrame()" class="retro-button bg-zinc-800 border border-[#ff77aa] text-[#ff77aa] py-2 text-[10px]">NEXT FRAME</button>
</div>
<div class="flex items-center gap-2 mb-2">
<button data-reference-video-speed="0.25" onclick="animModeSetReferenceVideoSpeed(0.25)" class="retro-button bg-zinc-800 border border-[#ff77aa] text-[#ff77aa] px-2 py-1 text-[10px]">0.25x</button>
<button data-reference-video-speed="0.5" onclick="animModeSetReferenceVideoSpeed(0.5)" class="retro-button bg-zinc-800 border border-[#ff77aa] text-[#ff77aa] px-2 py-1 text-[10px]">0.5x</button>
<button data-reference-video-speed="1" onclick="animModeSetReferenceVideoSpeed(1)" class="retro-button bg-zinc-800 border border-[#ff77aa] text-[#ff77aa] px-2 py-1 text-[10px]">1x</button>
<label class="ml-auto flex items-center gap-1 text-zinc-400 text-[9px]">
STEP FPS
<input id="anim-mode-reference-fps" type="number" min="1" max="120" step="1" value="30" class="w-14 bg-zinc-800 border border-[#ff77aa] px-2 py-1 font-mono text-white text-[10px]">
</label>
</div>
<p id="anim-mode-reference-status" class="text-zinc-500 text-[9px] leading-relaxed min-h-[1em]">This player is local to animation mode and does not control the original tab.</p>
</div>
<div id="anim-mode-pose-library" class="space-y-3">
<div class="flex items-center justify-between gap-2">
<span class="text-zinc-500 text-[9px] tracking-widest">FAST POSER</span>
<span class="text-zinc-500 text-[9px]">POSES</span>
</div>
<input id="anim-mode-pose-name" type="text" class="w-full bg-zinc-800 border border-[#ffcc00] px-2 py-1 font-mono text-white text-[10px] mb-2" placeholder="POSE NAME">
<select id="anim-mode-pose-select" onchange="animModeSelectPose()" class="w-full bg-zinc-800 border border-[#ffcc00] text-white text-[10px] px-2 py-1 mb-2">
<option value="">NO SAVED POSES</option>
</select>
<div class="grid grid-cols-2 gap-2 mb-2">
<button onclick="animModeSavePoseToLibrary()" class="retro-button bg-zinc-800 border border-[#ffcc00] text-[#ffcc00] py-2 text-[10px]">SAVE POSE</button>
<button onclick="animModePreviewPose()" class="retro-button bg-zinc-800 border border-[#ffcc00] text-[#ffcc00] py-2 text-[10px]">PREVIEW</button>
</div>
<div class="grid grid-cols-2 gap-2 mb-2">
<button onclick="animModeApplyPoseToFrame()" class="retro-button bg-[#ffcc00] text-black py-2 text-[10px] font-bold border-2 border-[#ffcc00]">APPLY TO FRAME</button>
<button onclick="animModeDeletePose()" class="retro-button bg-zinc-800 border border-zinc-600 text-zinc-300 py-2 text-[10px]">DELETE</button>
</div>
<div class="grid grid-cols-2 gap-2 mb-2">
<button onclick="animModeExportPoseLibrary()" class="retro-button bg-zinc-800 border border-[#00d0ff] text-[#00d0ff] py-2 text-[10px]">EXPORT LIB</button>
<label class="retro-button bg-zinc-800 border border-[#00d0ff] text-[#00d0ff] py-2 text-[10px] text-center cursor-pointer">
IMPORT LIB
<input id="anim-mode-pose-import" type="file" accept=".json,application/json" class="hidden" onchange="animModeImportPoseLibrary(event)">
</label>
</div>
<p id="anim-mode-pose-status" class="text-zinc-500 text-[9px] leading-relaxed min-h-[1em]">Save reusable poses here and stamp them onto the current frame.</p>
</div>
<!-- Import animation inline -->
<div id="anim-mode-import-panel" class="space-y-3">
<button onclick="openMotionRipperModal()" class="w-full retro-button bg-zinc-800 border-2 border-[#00d0ff] text-[#00d0ff] py-2 text-[10px] font-bold mb-2">CAPTURE FROM YOUTUBE / VIDEO</button>
<textarea id="anim-mode-textarea" class="w-full h-28 bg-zinc-800 border-2 border-[#00ff88] p-2 font-mono text-white text-[10px] resize-none focus:outline-none mb-2" placeholder='{ "name": "idle", "duration": 2, ... }'></textarea>
<p id="anim-mode-import-error" class="text-red-400 text-[10px] mb-2 min-h-[1em]"></p>
<button onclick="animModeImportAnim()" data-i18n="importBtn" class="w-full retro-button bg-[#00ff88] text-black py-2 text-[10px] font-bold border-2 border-[#00ff88]">IMPORT</button>
</div>
<!-- Export from animation mode -->
<div id="anim-mode-export-panel" class="space-y-2">
<button onclick="exportGLB()" data-i18n="exportGlb" class="w-full retro-button bg-[#00ff88] text-black py-2 text-[10px] font-bold border-2 border-[#00ff88]">EXPORT GLB</button>
<div class="flex gap-2">
<button onclick="copyObjectJSON()" data-i18n="copyJson" class="flex-1 retro-button bg-zinc-800 border-2 border-[#0088ff] text-[#0088ff] py-2 text-[10px]">COPY JSON</button>
<button onclick="downloadObjectJSON()" data-i18n="download" class="flex-1 retro-button bg-zinc-800 border-2 border-[#0088ff] text-[#0088ff] py-2 text-[10px]">DOWNLOAD</button>
</div>
</div>
</div>
</div>
<div id="anim-mode-bottom-dock" class="hidden bg-zinc-950 border-t-4 border-[#00d0ff] px-4 py-3 shrink-0">
<div class="flex flex-col gap-3">
<div id="anim-mode-timeline-host" class="w-full"></div>
<div id="anim-mode-editor-host" class="w-full"></div>
</div>
</div>
</div>
<!-- Modals are injected by JS: animation-html.js, texture-html.js, svg-html.js, avatar-html.js -->
<div id="toast-container"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>