multimodalart HF Staff commited on
Commit
5c46262
·
verified ·
1 Parent(s): 2b620af

Citrus theme UI; xlarge sessions with fused INT8 dequant, compiled DiT blocks, GPU KV archive, FP8 decoder

Browse files
Files changed (4) hide show
  1. app.py +12 -24
  2. assets/citrus.css +461 -0
  3. index.html +384 -432
  4. speedups.py +115 -0
app.py CHANGED
@@ -26,7 +26,6 @@ from typing import Any, Dict, List, Optional
26
 
27
  import cv2
28
  import numpy as np
29
- import torch.nn.functional as F
30
  from fastapi import HTTPException, Request
31
  from fastapi.responses import FileResponse, HTMLResponse, JSONResponse, Response
32
  from gradio import Server
@@ -41,10 +40,10 @@ from omegaconf import OmegaConf # noqa: E402
41
  MODEL_REPO = "tencent/Hy-Nomas"
42
  FPS = 24
43
  HEIGHT, WIDTH = 480, 832
44
- GPU_SIZE = os.environ.get("NOMAS_GPU_SIZE", "large")
45
  MAX_SESSIONS = int(os.environ.get("NOMAS_MAX_SESSIONS", "4"))
46
- SESSION_CHOICES = {"quick": 90, "standard": 150, "long": 240}
47
- LEASE_MARGIN = 20
48
  TURN_SECONDS = (3, 4, 5, 6)
49
  JPEG_QUALITY = 88
50
  RETAIN_SECONDS = 1800
@@ -53,25 +52,7 @@ PE_API_URL = os.environ.get("PE_API_URL", "https://router.huggingface.co/v1/chat
53
  DIT_PATH = hf_hub_download(
54
  MODEL_REPO, "DiT/distilled_int8/diffusion_pytorch_model_ema_0_995_int8.safetensors"
55
  )
56
- VAE_PATH = hf_hub_download(
57
- MODEL_REPO, "VAE/PixelUMM_FT_FP8/diffusion_pytorch_model_fp8.safetensors"
58
- )
59
-
60
- import hymm.models.vae.pixelumm_decoder.cutlass_fp8 as _cfp8 # noqa: E402
61
-
62
-
63
- def _fp8_dequant_forward(self, x):
64
- w = self.fp8_weight
65
- s = self.fp8_scale
66
- n, k = w.shape
67
- wb = (
68
- w.to(torch.bfloat16).view(n // 128, 128, k // 128, 128)
69
- * s.to(torch.bfloat16)[:, None, :, None]
70
- ).view(n, k)
71
- return F.linear(x.to(torch.bfloat16), wb)
72
-
73
-
74
- _cfp8.CutlassFP8Linear.forward = _fp8_dequant_forward
75
 
76
  import torch.nn.attention.flex_attention as _fa # noqa: E402
77
  import hymm.models.vae.pixelumm_decoder.autoencoder as _pae # noqa: E402
@@ -132,7 +113,8 @@ with initialize_config_dir(config_dir=str(ROOT / "configs"), version_base="1.3")
132
  "model.vae.stable_prefix_streaming=true",
133
  "parallelism.text_encoder_cpu_offload=false",
134
  "parallelism.dit_cpu_offload=false",
135
- "inference.torch_compile=false",
 
136
  "inference.save_latents=false",
137
  "inference.seg_ar_segment_vae_decode=true",
138
  f"inference.video_size=[{HEIGHT},{WIDTH}]",
@@ -153,7 +135,13 @@ from hymm.utils.video_output import video_to_uint8_numpy # noqa: E402
153
  resolve_w8_bf16_checkpoint(INF, CFG.dit_weight)
154
  torch.set_grad_enabled(False)
155
 
 
 
 
 
 
156
  pipe = CPTCausalInferencePipeline(args=CFG, device=torch.device("cpu"), dit_model_path=CFG.dit_weight)
 
157
  pipe.transformer.to("cuda")
158
  pipe.text_encoder.to("cuda")
159
  pipe.text_encoder.device = torch.device("cuda")
 
26
 
27
  import cv2
28
  import numpy as np
 
29
  from fastapi import HTTPException, Request
30
  from fastapi.responses import FileResponse, HTMLResponse, JSONResponse, Response
31
  from gradio import Server
 
40
  MODEL_REPO = "tencent/Hy-Nomas"
41
  FPS = 24
42
  HEIGHT, WIDTH = 480, 832
43
+ GPU_SIZE = os.environ.get("NOMAS_GPU_SIZE", "xlarge")
44
  MAX_SESSIONS = int(os.environ.get("NOMAS_MAX_SESSIONS", "4"))
45
+ SESSION_CHOICES = {"quick": 60, "standard": 90, "long": 150}
46
+ LEASE_MARGIN = 30
47
  TURN_SECONDS = (3, 4, 5, 6)
48
  JPEG_QUALITY = 88
49
  RETAIN_SECONDS = 1800
 
52
  DIT_PATH = hf_hub_download(
53
  MODEL_REPO, "DiT/distilled_int8/diffusion_pytorch_model_ema_0_995_int8.safetensors"
54
  )
55
+ VAE_PATH = hf_hub_download(MODEL_REPO, "VAE/PixelUMM_FT/diffusion_pytorch_model.safetensors")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
  import torch.nn.attention.flex_attention as _fa # noqa: E402
58
  import hymm.models.vae.pixelumm_decoder.autoencoder as _pae # noqa: E402
 
113
  "model.vae.stable_prefix_streaming=true",
114
  "parallelism.text_encoder_cpu_offload=false",
115
  "parallelism.dit_cpu_offload=false",
116
+ "inference.torch_compile=true",
117
+ "model.vae.cutlass_fp8=false",
118
  "inference.save_latents=false",
119
  "inference.seg_ar_segment_vae_decode=true",
120
  f"inference.video_size=[{HEIGHT},{WIDTH}]",
 
135
  resolve_w8_bf16_checkpoint(INF, CFG.dit_weight)
136
  torch.set_grad_enabled(False)
137
 
138
+ import speedups # noqa: E402
139
+
140
+ speedups.fuse_int8_dequant()
141
+ speedups.keep_kv_archive_on_gpu()
142
+
143
  pipe = CPTCausalInferencePipeline(args=CFG, device=torch.device("cpu"), dit_model_path=CFG.dit_weight)
144
+ logger.info(f"PixelUMM FP8 rowwise linears: {speedups.quantize_decoder_fp8(pipe.vae.decoder)}")
145
  pipe.transformer.to("cuda")
146
  pipe.text_encoder.to("cuda")
147
  pipe.text_encoder.device = torch.device("cuda")
assets/citrus.css ADDED
@@ -0,0 +1,461 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* gr.themes.Citrus() resolved variables (gradio 6) */
2
+ :root {
3
+ --name: citrus;
4
+ --custom-css: ;
5
+ --primary-50: #fffbeb;
6
+ --primary-100: #fef3c7;
7
+ --primary-200: #fde68a;
8
+ --primary-300: #fcd34d;
9
+ --primary-400: #fbbf24;
10
+ --primary-500: #f59e0b;
11
+ --primary-600: #d97706;
12
+ --primary-700: #b45309;
13
+ --primary-800: #92400e;
14
+ --primary-900: #78350f;
15
+ --primary-950: #6c370f;
16
+ --secondary-50: #fffbeb;
17
+ --secondary-100: #fef3c7;
18
+ --secondary-200: #fde68a;
19
+ --secondary-300: #fcd34d;
20
+ --secondary-400: #fbbf24;
21
+ --secondary-500: #f59e0b;
22
+ --secondary-600: #d97706;
23
+ --secondary-700: #b45309;
24
+ --secondary-800: #92400e;
25
+ --secondary-900: #78350f;
26
+ --secondary-950: #6c370f;
27
+ --neutral-50: #fafaf9;
28
+ --neutral-100: #f5f5f4;
29
+ --neutral-200: #e7e5e4;
30
+ --neutral-300: #d6d3d1;
31
+ --neutral-400: #a8a29e;
32
+ --neutral-500: #78716c;
33
+ --neutral-600: #57534e;
34
+ --neutral-700: #44403c;
35
+ --neutral-800: #292524;
36
+ --neutral-900: #1c1917;
37
+ --neutral-950: #0f0e0d;
38
+ --spacing-xxs: 2px;
39
+ --spacing-xs: 4px;
40
+ --spacing-sm: 6px;
41
+ --spacing-md: 8px;
42
+ --spacing-lg: 10px;
43
+ --spacing-xl: 14px;
44
+ --spacing-xxl: 28px;
45
+ --radius-xxs: 1px;
46
+ --radius-xs: 2px;
47
+ --radius-sm: 4px;
48
+ --radius-md: 6px;
49
+ --radius-lg: 8px;
50
+ --radius-xl: 12px;
51
+ --radius-xxl: 22px;
52
+ --text-xxs: 9px;
53
+ --text-xs: 10px;
54
+ --text-sm: 12px;
55
+ --text-md: 14px;
56
+ --text-lg: 16px;
57
+ --text-xl: 22px;
58
+ --text-xxl: 26px;
59
+ --font: 'Ubuntu', ui-sans-serif, system-ui, sans-serif;
60
+ --font-mono: 'Roboto Mono', ui-monospace, Consolas, monospace;
61
+ --body-background-fill: var(--background-fill-primary);
62
+ --body-text-color: var(--neutral-800);
63
+ --body-text-size: var(--text-md);
64
+ --body-text-weight: 400;
65
+ --embed-radius: var(--radius-sm);
66
+ --color-accent: var(--primary-500);
67
+ --color-accent-soft: var(--primary-50);
68
+ --background-fill-primary: var(--neutral-50);
69
+ --background-fill-secondary: var(--neutral-50);
70
+ --border-color-accent: var(--primary-300);
71
+ --border-color-primary: var(--neutral-200);
72
+ --link-text-color: var(--secondary-600);
73
+ --link-text-color-active: var(--secondary-600);
74
+ --link-text-color-hover: var(--secondary-700);
75
+ --link-text-color-visited: var(--secondary-500);
76
+ --body-text-color-subdued: var(--neutral-400);
77
+ --accordion-text-color: var(--body-text-color);
78
+ --table-text-color: var(--body-text-color);
79
+ --shadow-drop: rgba(0,0,0,0.05) 0px 1px 2px 0px;
80
+ --shadow-drop-lg: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
81
+ --shadow-inset: rgba(0,0,0,0.05) 0px 2px 4px 0px inset;
82
+ --shadow-spread: 3px;
83
+ --block-background-fill: var(--neutral-100);
84
+ --block-border-color: var(--neutral-300);
85
+ --block-border-width: 1px;
86
+ --block-info-text-color: var(--body-text-color-subdued);
87
+ --block-info-text-size: var(--text-sm);
88
+ --block-info-text-weight: 400;
89
+ --block-label-background-fill: var(--background-fill-primary);
90
+ --block-label-border-color: var(--border-color-primary);
91
+ --block-label-border-width: 1px;
92
+ --block-label-shadow: none;
93
+ --block-label-text-color: var(--neutral-500);
94
+ --block-label-margin: 0;
95
+ --block-label-padding: var(--spacing-sm) var(--spacing-lg);
96
+ --block-label-radius: calc(var(--radius-sm) - 1px) 0 calc(var(--radius-sm) - 1px) 0;
97
+ --block-label-right-radius: 0 calc(var(--radius-sm) - 1px) 0 calc(var(--radius-sm) - 1px);
98
+ --block-label-text-size: var(--text-sm);
99
+ --block-label-text-weight: 400;
100
+ --block-padding: var(--spacing-xl) calc(var(--spacing-xl) + 2px);
101
+ --block-radius: var(--radius-sm);
102
+ --block-shadow: 0px 3px 0px 0px var(--neutral-300);;
103
+ --block-title-background-fill: none;
104
+ --block-title-border-color: none;
105
+ --block-title-border-width: 0px;
106
+ --block-title-text-color: var(--neutral-500);
107
+ --block-title-padding: 0;
108
+ --block-title-radius: none;
109
+ --block-title-text-size: var(--text-md);
110
+ --block-title-text-weight: 400;
111
+ --container-radius: var(--radius-sm);
112
+ --form-gap-width: 0px;
113
+ --layout-gap: var(--spacing-xxl);
114
+ --panel-background-fill: var(--background-fill-secondary);
115
+ --panel-border-color: var(--border-color-primary);
116
+ --panel-border-width: 1px;
117
+ --section-header-text-size: var(--text-md);
118
+ --section-header-text-weight: 400;
119
+ --border-color-accent-subdued: var(--border-color-accent);
120
+ --code-background-fill: var(--neutral-100);
121
+ --chatbot-text-size: var(--text-lg);
122
+ --checkbox-background-color: var(--background-fill-primary);
123
+ --checkbox-background-color-focus: var(--checkbox-background-color);
124
+ --checkbox-background-color-hover: var(--checkbox-background-color);
125
+ --checkbox-background-color-selected: var(--color-accent);
126
+ --checkbox-border-color: var(--neutral-300);
127
+ --checkbox-border-color-focus: var(--color-accent);
128
+ --checkbox-border-color-hover: var(--neutral-300);
129
+ --checkbox-border-color-selected: var(--color-accent);
130
+ --checkbox-border-radius: var(--radius-sm);
131
+ --checkbox-border-width: var(--input-border-width);
132
+ --checkbox-label-background-fill: var(--neutral-200);
133
+ --checkbox-label-background-fill-hover: var(--checkbox-label-background-fill);
134
+ --checkbox-label-background-fill-selected: var(--primary-400);
135
+ --checkbox-label-border-color: var(--border-color-primary);
136
+ --checkbox-label-border-color-hover: var(--checkbox-label-border-color);
137
+ --checkbox-label-border-color-selected: var(--primary-300);
138
+ --checkbox-label-border-width: 2px;
139
+ --checkbox-label-gap: var(--spacing-lg);
140
+ --checkbox-label-padding: var(--spacing-md) calc(2 * var(--spacing-md));
141
+ --checkbox-label-shadow: none;
142
+ --checkbox-label-shadow-hover: var(--checkbox-label-shadow);
143
+ --checkbox-label-shadow-active: var(--checkbox-label-shadow);
144
+ --checkbox-label-text-size: var(--text-md);
145
+ --checkbox-label-text-weight: 400;
146
+ --checkbox-check: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
147
+ --radio-circle: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e");
148
+ --checkbox-shadow: none;
149
+ --checkbox-label-text-color: var(--body-text-color);
150
+ --checkbox-label-text-color-selected: var(--checkbox-label-text-color);
151
+ --error-background-fill: #fef2f2;
152
+ --error-border-color: #b91c1c;
153
+ --error-border-width: 1px;
154
+ --error-text-color: #b91c1c;
155
+ --error-icon-color: #b91c1c;
156
+ --input-background-fill: var(--neutral-50);
157
+ --input-background-fill-focus: var(--primary-50);
158
+ --input-background-fill-hover: var(--input-background-fill);
159
+ --input-border-color: var(--border-color-primary);
160
+ --input-border-color-focus: var(--secondary-300);
161
+ --input-border-color-hover: var(--input-border-color);
162
+ --input-border-width: 1px;
163
+ --input-padding: var(--spacing-xl);
164
+ --input-placeholder-color: var(--neutral-400);
165
+ --input-radius: var(--radius-sm);
166
+ --input-shadow: 0px -1px 0px 0px var(--neutral-300);;
167
+ --input-shadow-focus: 0px -1px 0px 0px var(--primary-300);;
168
+ --input-text-size: var(--text-md);
169
+ --input-text-weight: 400;
170
+ --loader-color: var(--color-accent);
171
+ --prose-text-size: var(--text-md);
172
+ --prose-text-weight: 400;
173
+ --prose-header-text-weight: 600;
174
+ --slider-color: var(--primary-400);
175
+ --stat-background-fill: var(--primary-300);
176
+ --table-border-color: var(--neutral-300);
177
+ --table-even-background-fill: white;
178
+ --table-odd-background-fill: var(--neutral-50);
179
+ --table-radius: var(--radius-sm);
180
+ --table-row-focus: var(--color-accent-soft);
181
+ --button-border-width: 0px;
182
+ --button-cancel-background-fill: #ef4444;
183
+ --button-cancel-background-fill-hover: #dc2626;
184
+ --button-cancel-border-color: var(--button-secondary-border-color);
185
+ --button-cancel-border-color-hover: var(--button-secondary-border-color-hover);
186
+ --button-cancel-text-color: white;
187
+ --button-cancel-text-color-hover: white;
188
+ --button-cancel-shadow: 0px 3px 0px 0px rgb(248 113 113);
189
+ --button-cancel-shadow-hover: 0px 5px 0px 0px rgb(248 113 113);
190
+ --button-cancel-shadow-active: 0px 2px 0px 0px rgb(248 113 113);
191
+ --button-transform-hover: translateY(-2px);;
192
+ --button-transform-active: translateY(1px);;
193
+ --button-transition: all 0.1s;;
194
+ --button-large-padding: var(--spacing-lg) calc(2 * var(--spacing-lg));
195
+ --button-large-radius: var(--radius-md);
196
+ --button-large-text-size: var(--text-lg);
197
+ --button-large-text-weight: 600;
198
+ --button-primary-background-fill: var(--primary-500);
199
+ --button-primary-background-fill-hover: var(--button-primary-background-fill);
200
+ --button-primary-border-color: var(--primary-500);
201
+ --button-primary-border-color-hover: var(--primary-500);
202
+ --button-primary-text-color: var(--button-secondary-text-color);
203
+ --button-primary-text-color-hover: var(--button-primary-text-color);
204
+ --button-primary-shadow: 0px 3px 0px 0px var(--primary-400);;
205
+ --button-primary-shadow-hover: 0px 5px 0px 0px var(--primary-400);;
206
+ --button-primary-shadow-active: 0px 2px 0px 0px var(--primary-400);;
207
+ --button-secondary-background-fill: var(--primary-400);
208
+ --button-secondary-background-fill-hover: var(--button-secondary-background-fill);
209
+ --button-secondary-border-color: var(--neutral-200);
210
+ --button-secondary-border-color-hover: var(--neutral-200);
211
+ --button-secondary-text-color: black;
212
+ --button-secondary-text-color-hover: var(--button-secondary-text-color);
213
+ --button-secondary-shadow: 0px 3px 0px 0px var(--primary-300);;
214
+ --button-secondary-shadow-hover: 0px 5px 0px 0px var(--primary-300);;
215
+ --button-secondary-shadow-active: 0px 2px 0px 0px var(--primary-300);;
216
+ --button-small-padding: var(--spacing-sm) calc(1.5 * var(--spacing-sm));
217
+ --button-small-radius: var(--radius-md);
218
+ --button-small-text-size: var(--text-sm);
219
+ --button-small-text-weight: 400;
220
+ --button-medium-padding: var(--spacing-md) calc(2 * var(--spacing-md));
221
+ --button-medium-radius: var(--radius-md);
222
+ --button-medium-text-size: var(--text-md);
223
+ --button-medium-text-weight: 600;
224
+ }
225
+
226
+ :root.dark, :root .dark {
227
+ --body-background-fill: var(--background-fill-primary);
228
+ --body-text-color: var(--neutral-100);
229
+ --color-accent-soft: var(--neutral-700);
230
+ --background-fill-primary: var(--neutral-950);
231
+ --background-fill-secondary: var(--neutral-900);
232
+ --border-color-accent: var(--neutral-600);
233
+ --border-color-primary: var(--neutral-700);
234
+ --link-text-color-active: var(--secondary-500);
235
+ --link-text-color: var(--secondary-500);
236
+ --link-text-color-hover: var(--secondary-400);
237
+ --link-text-color-visited: var(--secondary-600);
238
+ --body-text-color-subdued: var(--neutral-400);
239
+ --accordion-text-color: var(--body-text-color);
240
+ --table-text-color: var(--body-text-color);
241
+ --shadow-spread: 1px;
242
+ --block-background-fill: var(--neutral-800);
243
+ --block-border-color: var(--border-color-primary);
244
+ --block_border_width: None;
245
+ --block-info-text-color: var(--body-text-color-subdued);
246
+ --block-label-background-fill: var(--background-fill-secondary);
247
+ --block-label-border-color: var(--border-color-primary);
248
+ --block_label_border_width: None;
249
+ --block-label-text-color: var(--neutral-200);
250
+ --block-shadow: 0px 3px 0px 0px var(--neutral-700);;
251
+ --block_title_background_fill: None;
252
+ --block_title_border_color: None;
253
+ --block_title_border_width: None;
254
+ --block-title-text-color: var(--neutral-200);
255
+ --panel-background-fill: var(--background-fill-secondary);
256
+ --panel-border-color: var(--border-color-primary);
257
+ --panel_border_width: None;
258
+ --border-color-accent-subdued: var(--border-color-accent);
259
+ --code-background-fill: var(--neutral-800);
260
+ --checkbox-background-color: var(--neutral-400);
261
+ --checkbox-background-color-focus: var(--checkbox-background-color);
262
+ --checkbox-background-color-hover: var(--checkbox-background-color);
263
+ --checkbox-background-color-selected: var(--primary-600);
264
+ --checkbox-border-color: var(--neutral-700);
265
+ --checkbox-border-color-focus: var(--color-accent);
266
+ --checkbox-border-color-hover: var(--neutral-600);
267
+ --checkbox-border-color-selected: var(--color-accent);
268
+ --checkbox-border-width: var(--input-border-width);
269
+ --checkbox-label-background-fill: var(--neutral-700);
270
+ --checkbox-label-background-fill-hover: var(--checkbox-label-background-fill);
271
+ --checkbox-label-background-fill-selected: var(--primary-500);
272
+ --checkbox-label-border-color: var(--border-color-primary);
273
+ --checkbox-label-border-color-hover: var(--checkbox-label-border-color);
274
+ --checkbox-label-border-color-selected: var(--primary-600);
275
+ --checkbox-label-border-width: 2px;
276
+ --checkbox_label_shadow: None;
277
+ --checkbox_label_shadow_hover: None;
278
+ --checkbox_label_shadow_active: None;
279
+ --checkbox-label-text-color: var(--body-text-color);
280
+ --checkbox-label-text-color-selected: var(--button-primary-text-color);
281
+ --error-background-fill: var(--background-fill-primary);
282
+ --error-border-color: #ef4444;
283
+ --error_border_width: None;
284
+ --error-text-color: #fef2f2;
285
+ --error-icon-color: #ef4444;
286
+ --input-background-fill: var(--neutral-900);
287
+ --input-background-fill-focus: none;
288
+ --input-background-fill-hover: var(--input-background-fill);
289
+ --input-border-color: var(--border-color-primary);
290
+ --input-border-color-focus: var(--neutral-700);
291
+ --input-border-color-hover: var(--input-border-color);
292
+ --input_border_width: None;
293
+ --input-placeholder-color: var(--neutral-500);
294
+ --input-shadow: 0px -1px 0px 0px var(--neutral-700);;
295
+ --input-shadow-focus: 0px -1px 0px 0px var(--primary-600);;
296
+ --loader_color: None;
297
+ --slider-color: var(--primary-500);
298
+ --stat-background-fill: var(--primary-500);
299
+ --table-border-color: var(--neutral-700);
300
+ --table-even-background-fill: var(--neutral-950);
301
+ --table-odd-background-fill: var(--neutral-900);
302
+ --table-row-focus: var(--color-accent-soft);
303
+ --button_border_width: None;
304
+ --button-cancel-background-fill: #b91c1c;
305
+ --button-cancel-background-fill-hover: #991b1b;
306
+ --button-cancel-border-color: var(--button-secondary-border-color);
307
+ --button-cancel-border-color-hover: var(--button-secondary-border-color-hover);
308
+ --button-cancel-text-color: white;
309
+ --button-cancel-text-color-hover: white;
310
+ --button-cancel-shadow: 0px 3px 0px 0px rgb(220 38 38);
311
+ --button-cancel-shadow-hover: 0px 5px 0px 0px rgb(220 38 38);
312
+ --button-cancel-shadow-active: 0px 2px 0px 0px rgb(220 38 38);
313
+ --button-primary-background-fill: var(--primary-600);
314
+ --button-primary-background-fill-hover: var(--button-primary-background-fill);
315
+ --button-primary-border-color: var(--primary-600);
316
+ --button-primary-border-color-hover: var(--primary-500);
317
+ --button-primary-text-color: var(--button-secondary-text-color);
318
+ --button-primary-text-color-hover: var(--button-primary-text-color);
319
+ --button-primary-shadow: 0px 3px 0px 0px var(--primary-700);;
320
+ --button-primary-shadow-hover: 0px 5px 0px 0px var(--primary-700);;
321
+ --button-primary-shadow-active: 0px 2px 0px 0px var(--primary-700);;
322
+ --button-secondary-background-fill: var(--primary-500);
323
+ --button-secondary-background-fill-hover: var(--button-secondary-background-fill);
324
+ --button-secondary-border-color: var(--neutral-600);
325
+ --button-secondary-border-color-hover: var(--neutral-500);
326
+ --button-secondary-text-color: var(--neutral-900);
327
+ --button-secondary-text-color-hover: var(--button-secondary-text-color);
328
+ --button-secondary-shadow: 0px 3px 0px 0px var(--primary-600);;
329
+ --button-secondary-shadow-hover: 0px 5px 0px 0px var(--primary-600);;
330
+ --button-secondary-shadow-active: 0px 2px 0px 0px var(--primary-600);;
331
+ --name: citrus;
332
+ --custom-css: ;
333
+ --primary-50: #fffbeb;
334
+ --primary-100: #fef3c7;
335
+ --primary-200: #fde68a;
336
+ --primary-300: #fcd34d;
337
+ --primary-400: #fbbf24;
338
+ --primary-500: #f59e0b;
339
+ --primary-600: #d97706;
340
+ --primary-700: #b45309;
341
+ --primary-800: #92400e;
342
+ --primary-900: #78350f;
343
+ --primary-950: #6c370f;
344
+ --secondary-50: #fffbeb;
345
+ --secondary-100: #fef3c7;
346
+ --secondary-200: #fde68a;
347
+ --secondary-300: #fcd34d;
348
+ --secondary-400: #fbbf24;
349
+ --secondary-500: #f59e0b;
350
+ --secondary-600: #d97706;
351
+ --secondary-700: #b45309;
352
+ --secondary-800: #92400e;
353
+ --secondary-900: #78350f;
354
+ --secondary-950: #6c370f;
355
+ --neutral-50: #fafaf9;
356
+ --neutral-100: #f5f5f4;
357
+ --neutral-200: #e7e5e4;
358
+ --neutral-300: #d6d3d1;
359
+ --neutral-400: #a8a29e;
360
+ --neutral-500: #78716c;
361
+ --neutral-600: #57534e;
362
+ --neutral-700: #44403c;
363
+ --neutral-800: #292524;
364
+ --neutral-900: #1c1917;
365
+ --neutral-950: #0f0e0d;
366
+ --spacing-xxs: 2px;
367
+ --spacing-xs: 4px;
368
+ --spacing-sm: 6px;
369
+ --spacing-md: 8px;
370
+ --spacing-lg: 10px;
371
+ --spacing-xl: 14px;
372
+ --spacing-xxl: 28px;
373
+ --radius-xxs: 1px;
374
+ --radius-xs: 2px;
375
+ --radius-sm: 4px;
376
+ --radius-md: 6px;
377
+ --radius-lg: 8px;
378
+ --radius-xl: 12px;
379
+ --radius-xxl: 22px;
380
+ --text-xxs: 9px;
381
+ --text-xs: 10px;
382
+ --text-sm: 12px;
383
+ --text-md: 14px;
384
+ --text-lg: 16px;
385
+ --text-xl: 22px;
386
+ --text-xxl: 26px;
387
+ --font: 'Ubuntu', ui-sans-serif, system-ui, sans-serif;
388
+ --font-mono: 'Roboto Mono', ui-monospace, Consolas, monospace;
389
+ --body-text-size: var(--text-md);
390
+ --body-text-weight: 400;
391
+ --embed-radius: var(--radius-sm);
392
+ --color-accent: var(--primary-500);
393
+ --shadow-drop: rgba(0,0,0,0.05) 0px 1px 2px 0px;
394
+ --shadow-drop-lg: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
395
+ --shadow-inset: rgba(0,0,0,0.05) 0px 2px 4px 0px inset;
396
+ --block-border-width: 1px;
397
+ --block-info-text-size: var(--text-sm);
398
+ --block-info-text-weight: 400;
399
+ --block-label-border-width: 1px;
400
+ --block-label-shadow: none;
401
+ --block-label-margin: 0;
402
+ --block-label-padding: var(--spacing-sm) var(--spacing-lg);
403
+ --block-label-radius: calc(var(--radius-sm) - 1px) 0 calc(var(--radius-sm) - 1px) 0;
404
+ --block-label-right-radius: 0 calc(var(--radius-sm) - 1px) 0 calc(var(--radius-sm) - 1px);
405
+ --block-label-text-size: var(--text-sm);
406
+ --block-label-text-weight: 400;
407
+ --block-padding: var(--spacing-xl) calc(var(--spacing-xl) + 2px);
408
+ --block-radius: var(--radius-sm);
409
+ --block-title-background-fill: none;
410
+ --block-title-border-color: none;
411
+ --block-title-border-width: 0px;
412
+ --block-title-padding: 0;
413
+ --block-title-radius: none;
414
+ --block-title-text-size: var(--text-md);
415
+ --block-title-text-weight: 400;
416
+ --container-radius: var(--radius-sm);
417
+ --form-gap-width: 0px;
418
+ --layout-gap: var(--spacing-xxl);
419
+ --panel-border-width: 1px;
420
+ --section-header-text-size: var(--text-md);
421
+ --section-header-text-weight: 400;
422
+ --chatbot-text-size: var(--text-lg);
423
+ --checkbox-border-radius: var(--radius-sm);
424
+ --checkbox-label-gap: var(--spacing-lg);
425
+ --checkbox-label-padding: var(--spacing-md) calc(2 * var(--spacing-md));
426
+ --checkbox-label-shadow: none;
427
+ --checkbox-label-shadow-hover: var(--checkbox-label-shadow);
428
+ --checkbox-label-shadow-active: var(--checkbox-label-shadow);
429
+ --checkbox-label-text-size: var(--text-md);
430
+ --checkbox-label-text-weight: 400;
431
+ --checkbox-check: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
432
+ --radio-circle: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e");
433
+ --checkbox-shadow: none;
434
+ --error-border-width: 1px;
435
+ --input-border-width: 1px;
436
+ --input-padding: var(--spacing-xl);
437
+ --input-radius: var(--radius-sm);
438
+ --input-text-size: var(--text-md);
439
+ --input-text-weight: 400;
440
+ --loader-color: var(--color-accent);
441
+ --prose-text-size: var(--text-md);
442
+ --prose-text-weight: 400;
443
+ --prose-header-text-weight: 600;
444
+ --table-radius: var(--radius-sm);
445
+ --button-border-width: 0px;
446
+ --button-transform-hover: translateY(-2px);;
447
+ --button-transform-active: translateY(1px);;
448
+ --button-transition: all 0.1s;;
449
+ --button-large-padding: var(--spacing-lg) calc(2 * var(--spacing-lg));
450
+ --button-large-radius: var(--radius-md);
451
+ --button-large-text-size: var(--text-lg);
452
+ --button-large-text-weight: 600;
453
+ --button-small-padding: var(--spacing-sm) calc(1.5 * var(--spacing-sm));
454
+ --button-small-radius: var(--radius-md);
455
+ --button-small-text-size: var(--text-sm);
456
+ --button-small-text-weight: 400;
457
+ --button-medium-padding: var(--spacing-md) calc(2 * var(--spacing-md));
458
+ --button-medium-radius: var(--radius-md);
459
+ --button-medium-text-size: var(--text-md);
460
+ --button-medium-text-weight: 600;
461
+ }
index.html CHANGED
@@ -5,531 +5,484 @@
5
  <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
6
  <title>Hy-Nomas Live</title>
7
  <meta name="description" content="Step into a world that keeps writing itself. Live, steerable world generation with Tencent Hy-Nomas.">
 
 
 
 
 
 
 
8
  <link rel="preconnect" href="https://fonts.googleapis.com">
9
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10
- <link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter+Tight:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
 
11
  <style>
12
- :root {
13
- --bg: #07080b;
14
- --bg-2: #0c0e13;
15
- --panel: rgba(20, 23, 31, 0.72);
16
- --panel-solid: #12151c;
17
- --line: rgba(255, 255, 255, 0.08);
18
- --line-2: rgba(255, 255, 255, 0.14);
19
- --text: #eef0f4;
20
- --muted: #9aa1b0;
21
- --faint: #626a7a;
22
- --mint: #8bf0c5;
23
- --mint-ink: #052a1d;
24
- --lav: #b9a2ff;
25
- --amber: #ffc978;
26
- --rose: #ff8f9c;
27
- --radius: 16px;
28
- --radius-sm: 10px;
29
- --ease: cubic-bezier(.2, .8, .2, 1);
30
- --display: "Instrument Serif", Georgia, serif;
31
- --ui: "Inter Tight", system-ui, -apple-system, Segoe UI, sans-serif;
32
- --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
33
- }
34
  * { box-sizing: border-box; }
35
- html, body { margin: 0; height: 100%; }
36
  body {
37
- background: var(--bg);
38
- color: var(--text);
39
- font: 15px/1.5 var(--ui);
 
 
40
  -webkit-font-smoothing: antialiased;
41
- overflow-x: hidden;
42
- }
43
- body::before {
44
- content: "";
45
- position: fixed; inset: -20%;
46
- background:
47
- radial-gradient(40% 35% at 18% 12%, rgba(139, 240, 197, 0.10), transparent 70%),
48
- radial-gradient(38% 30% at 85% 8%, rgba(185, 162, 255, 0.12), transparent 70%),
49
- radial-gradient(50% 40% at 50% 110%, rgba(255, 201, 120, 0.06), transparent 70%);
50
- pointer-events: none; z-index: 0;
51
- animation: drift 28s ease-in-out infinite alternate;
52
- }
53
- body::after {
54
- content: "";
55
- position: fixed; inset: 0;
56
- background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.5'/></svg>");
57
- opacity: .045; mix-blend-mode: overlay; pointer-events: none; z-index: 1;
58
  }
59
- @keyframes drift { to { transform: translate3d(3%, -2%, 0) scale(1.05); } }
60
- button, input, textarea, select { font: inherit; color: inherit; }
61
  button { cursor: pointer; }
62
- a { color: inherit; }
63
  .hidden { display: none !important; }
64
- #app { position: relative; z-index: 2; min-height: 100%; display: flex; flex-direction: column; }
65
-
66
- .topbar {
67
- display: flex; align-items: center; gap: 16px;
68
- padding: 14px clamp(16px, 3vw, 32px);
69
- border-bottom: 1px solid var(--line);
70
- backdrop-filter: blur(12px);
71
- background: rgba(7, 8, 11, 0.55);
72
- position: sticky; top: 0; z-index: 20;
73
- }
74
- .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; text-decoration: none; }
75
- .brand-mark {
76
- width: 26px; height: 26px; border-radius: 8px;
77
- background: conic-gradient(from 210deg, var(--mint), var(--lav), var(--amber), var(--mint));
78
- box-shadow: 0 0 24px rgba(139, 240, 197, .35);
79
  position: relative;
80
- }
81
- .brand-mark::after { content: ""; position: absolute; inset: 6px; border-radius: 4px; background: var(--bg); }
82
- .brand small { color: var(--muted); font-weight: 500; margin-left: 2px; }
83
- .topbar nav { margin-left: auto; display: flex; gap: 4px; align-items: center; }
84
- .topbar nav a {
85
- color: var(--muted); text-decoration: none; font-size: 13px; padding: 6px 10px; border-radius: 8px;
86
- }
87
- .topbar nav a:hover { color: var(--text); background: var(--line); }
88
- .pill {
89
- display: inline-flex; align-items: center; gap: 8px;
90
- font-size: 12px; color: var(--muted);
91
- border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px;
92
- white-space: nowrap;
93
- }
94
- .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
95
- .dot.ok { background: var(--mint); box-shadow: 0 0 10px var(--mint); }
96
- .dot.warn { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
97
- .dot.bad { background: var(--rose); }
98
-
99
- /* Lobby */
100
- #lobby { width: 100%; max-width: 1280px; margin: 0 auto; padding: clamp(24px, 5vw, 56px) clamp(16px, 3vw, 32px) 64px; }
101
- .hero { max-width: 760px; margin-bottom: clamp(28px, 4vw, 44px); }
102
- .eyebrow { font: 500 12px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--mint); margin-bottom: 18px; display: flex; gap: 10px; align-items: center; }
103
- .eyebrow::before { content: ""; width: 22px; height: 1px; background: currentColor; }
104
- .hero h1 {
105
- font: 400 clamp(44px, 7vw, 84px)/0.98 var(--display);
106
- letter-spacing: -0.02em; margin: 0 0 18px;
107
- }
108
- .hero h1 em { font-style: italic; background: linear-gradient(100deg, var(--mint), var(--lav) 60%, var(--amber)); -webkit-background-clip: text; background-clip: text; color: transparent; }
109
- .hero p { color: var(--muted); font-size: clamp(15px, 1.6vw, 18px); max-width: 600px; margin: 0; }
110
 
111
- .lobby-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 24px; align-items: start; }
112
- @media (max-width: 960px) { .lobby-grid { grid-template-columns: 1fr; } }
113
- .section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 14px; }
114
- .section-title h2 { font: 500 13px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0; }
115
- .section-title span { font-size: 12px; color: var(--faint); }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
- .worlds { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  .world {
119
- position: relative; text-align: left; padding: 0; border: 1px solid var(--line);
120
- border-radius: var(--radius); overflow: hidden; background: var(--panel-solid);
121
- aspect-ratio: 832 / 560; display: flex; flex-direction: column; justify-content: flex-end;
122
- transition: transform .35s var(--ease), border-color .2s, box-shadow .35s var(--ease);
123
- isolation: isolate;
124
- }
125
- .world:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: 0 18px 50px -20px rgba(0,0,0,.8); }
126
- .world.selected { border-color: var(--mint); box-shadow: 0 0 0 1px var(--mint), 0 18px 60px -24px rgba(139,240,197,.45); }
127
- .world .poster { position: absolute; inset: 0; z-index: -2; background-size: cover; background-position: center; transition: transform .8s var(--ease); }
128
- .world:hover .poster { transform: scale(1.05); }
129
- .world::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, transparent 30%, rgba(5,6,9,.92) 100%); }
130
- .world .meta { padding: 12px 14px; }
131
- .world .name { font: 400 22px/1.1 var(--display); }
132
- .world .tag { font: 500 10.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
133
-
134
- .composer {
135
- background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
136
- padding: 20px; backdrop-filter: blur(16px); position: sticky; top: 84px;
137
- box-shadow: 0 30px 80px -40px rgba(0,0,0,.9);
138
- }
139
- .composer h3 { font: 400 28px/1.05 var(--display); margin: 0 0 4px; }
140
- .composer .sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
141
- .field { display: block; margin-bottom: 14px; }
142
- .field > span { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
143
- .field textarea, .field input[type="text"], .field input[type="number"] {
144
- width: 100%; resize: vertical; min-height: 44px;
145
- background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: var(--radius-sm);
146
- padding: 10px 12px; outline: none; transition: border-color .2s, box-shadow .2s;
147
- }
148
- .field textarea:focus, .field input:focus { border-color: rgba(139,240,197,.6); box-shadow: 0 0 0 3px rgba(139,240,197,.12); }
149
- .seg { display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: 4px; padding: 4px; background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 12px; }
150
- .seg button {
151
- border: 0; background: transparent; padding: 8px 6px; border-radius: 8px; font-size: 12.5px; color: var(--muted);
152
- transition: background .2s, color .2s; display: flex; flex-direction: column; align-items: center; gap: 2px;
153
- }
154
- .seg button small { font-size: 10.5px; color: var(--faint); }
155
- .seg button[aria-pressed="true"] { background: rgba(255,255,255,.09); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
156
- .seg button[aria-pressed="true"] small { color: var(--muted); }
157
- details.adv { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; }
158
- details.adv summary { cursor: pointer; font-size: 12.5px; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 6px; }
159
- details.adv summary::-webkit-details-marker { display: none; }
160
- details.adv summary::before { content: "+"; font-family: var(--mono); width: 14px; }
161
- details.adv[open] summary::before { content: "–"; }
162
- details.adv .adv-body { padding-top: 14px; }
163
- .row { display: flex; gap: 8px; align-items: center; }
164
- .cta {
165
- width: 100%; margin-top: 8px; padding: 14px 18px; border: 0; border-radius: 12px;
166
- background: linear-gradient(100deg, var(--mint), #c6f7df 50%, var(--lav));
167
- color: var(--mint-ink); font-weight: 650; font-size: 15px; letter-spacing: -0.01em;
168
- display: flex; align-items: center; justify-content: center; gap: 10px;
169
- transition: transform .2s var(--ease), box-shadow .3s, filter .2s;
170
- box-shadow: 0 10px 40px -12px rgba(139,240,197,.55);
171
- }
172
- .cta:hover { transform: translateY(-1px); filter: brightness(1.05); }
173
- .cta:disabled { filter: grayscale(.6) brightness(.7); cursor: not-allowed; transform: none; }
174
- .ghost {
175
- border: 1px solid var(--line); background: rgba(255,255,255,.03); border-radius: 10px; padding: 8px 12px; font-size: 13px; color: var(--text);
176
- display: inline-flex; align-items: center; gap: 8px; transition: background .2s, border-color .2s;
177
- }
178
- .ghost:hover { background: rgba(255,255,255,.07); border-color: var(--line-2); }
179
- .ghost:disabled { opacity: .45; cursor: not-allowed; }
180
- .ghost.icon { padding: 8px; }
181
- .fineprint { color: var(--faint); font-size: 12px; margin-top: 12px; line-height: 1.5; }
182
- .fineprint a { color: var(--muted); }
183
- .lobby-foot { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; color: var(--muted); font-size: 13px; }
184
- .lobby-foot b { color: var(--text); font-weight: 600; display: block; margin-bottom: 4px; }
185
-
186
- /* Stage */
187
- #stage { flex: 1; display: flex; flex-direction: column; min-height: 0; }
188
- .stage-wrap { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 0; min-height: 0; }
189
  @media (max-width: 1100px) { .stage-wrap { grid-template-columns: 1fr; } }
190
- .theater { padding: clamp(12px, 2vw, 24px); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
191
- .stage-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
192
- .stage-head .title { font: 400 26px/1.1 var(--display); margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
193
- .chip { font: 500 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); }
194
- .clock { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
195
- .clock svg { width: 34px; height: 34px; transform: rotate(-90deg); }
196
- .clock .track { stroke: var(--line-2); }
197
- .clock .bar { stroke: var(--mint); stroke-linecap: round; transition: stroke-dashoffset .9s linear, stroke .3s; }
198
- .clock.low .bar { stroke: var(--amber); }
199
- .clock b { color: var(--text); font: 500 15px/1 var(--mono); display: block; }
200
-
201
- .viewport { position: relative; width: 100%; max-width: calc((100vh - 330px) * 832 / 480); margin: 0 auto; min-width: min(100%, 520px); }
 
202
  @media (max-width: 760px) { .viewport { max-width: 100%; min-width: 0; } }
203
- #ambient {
204
- position: absolute; inset: -6% -4%; width: 108%; height: 112%;
205
- filter: blur(48px) saturate(1.4); opacity: .55; z-index: 0; pointer-events: none;
206
- transition: opacity 1s;
207
- }
208
- .screen {
209
- position: relative; z-index: 1; aspect-ratio: 832 / 480; border-radius: 18px; overflow: hidden;
210
- background: #000; box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 40px 100px -40px rgba(0,0,0,1);
211
- touch-action: none;
212
- }
213
  #screen { width: 100%; height: 100%; display: block; transform-origin: 50% 50%; }
214
  .screen.breathing #screen { animation: breathe 7s ease-in-out infinite alternate; }
215
- @keyframes breathe { from { transform: scale(1); } to { transform: scale(1.035); } }
216
  .screen.steer { cursor: grab; }
217
  .screen.steer:active { cursor: grabbing; }
218
  .ov { position: absolute; z-index: 3; }
219
  .badge-live {
220
- top: 14px; left: 14px; display: flex; gap: 8px; align-items: center;
221
- font: 600 11px/1 var(--mono); letter-spacing: .1em; padding: 7px 10px; border-radius: 8px;
222
- background: rgba(0,0,0,.55); backdrop-filter: blur(8px); border: 1px solid var(--line);
223
  }
224
- .badge-live .dot { background: var(--rose); box-shadow: 0 0 10px var(--rose); animation: pulse 1.6s infinite; }
225
- .badge-live.replay .dot { background: var(--muted); box-shadow: none; animation: none; }
226
- .badge-live button { border: 0; background: rgba(255,255,255,.12); border-radius: 6px; padding: 4px 7px; font: 600 10px/1 var(--mono); letter-spacing: .06em; }
227
- @keyframes pulse { 50% { opacity: .35; } }
228
  .turn-pill {
229
- left: 14px; right: 14px; bottom: 14px; display: flex; align-items: center; gap: 12px;
230
- padding: 10px 14px; border-radius: 12px; background: rgba(6,7,10,.72); backdrop-filter: blur(10px);
231
- border: 1px solid var(--line); font-size: 13px; transition: opacity .3s, transform .3s var(--ease);
232
- }
233
- .turn-pill.off { opacity: 0; transform: translateY(8px); pointer-events: none; }
234
- .turn-pill .lbl { min-width: 0; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
235
- .turn-pill .lbl b { font-weight: 600; }
236
- .turn-pill .lbl span { color: var(--muted); }
237
- .meter { width: 140px; height: 4px; border-radius: 4px; background: var(--line-2); overflow: hidden; flex: none; }
238
- .meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--mint), var(--lav)); border-radius: inherit; transition: width .4s linear; }
 
239
  .meter.indet i { width: 35%; animation: indet 1.3s ease-in-out infinite; }
240
  @keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
241
- .spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--mint); animation: spin .8s linear infinite; flex: none; }
242
  @keyframes spin { to { transform: rotate(360deg); } }
243
 
244
- .forming {
245
- inset: 0; display: grid; place-items: center; text-align: center; padding: 24px;
246
- background:
247
- radial-gradient(60% 60% at 30% 40%, rgba(139,240,197,.18), transparent 60%),
248
- radial-gradient(50% 60% at 70% 60%, rgba(185,162,255,.22), transparent 60%),
249
- #05060a;
250
- background-size: 160% 160%; animation: nebula 12s ease-in-out infinite alternate;
251
- transition: opacity .8s;
252
- }
253
  .forming.fade { opacity: 0; pointer-events: none; }
254
- @keyframes nebula { to { background-position: 100% 100%; } }
255
  .forming .inner { max-width: 520px; }
256
- .forming h4 { font: 400 clamp(26px, 3.5vw, 40px)/1.05 var(--display); margin: 0 0 18px; }
257
- .steps { list-style: none; margin: 0 auto; padding: 0; text-align: left; display: inline-flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
258
- .steps li { display: flex; gap: 10px; align-items: center; color: var(--faint); transition: color .3s; }
259
- .steps li .ico { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; font-size: 10px; flex: none; }
260
- .steps li.active { color: var(--text); }
261
- .steps li.active .ico { border-color: var(--line-2); border-top-color: var(--mint); animation: spin .9s linear infinite; }
262
- .steps li.done { color: var(--muted); }
263
- .steps li.done .ico { background: var(--mint); border-color: var(--mint); color: var(--mint-ink); }
264
- .forming .scene { margin-top: 18px; color: var(--muted); font-size: 13px; font-style: italic; max-height: 4.5em; overflow: hidden; }
265
-
266
- .keyhud { right: 14px; top: 14px; display: grid; grid-template-columns: repeat(3, 26px); gap: 4px; opacity: 0; transition: opacity .3s; }
267
  .keyhud.show { opacity: 1; }
268
- .keyhud kbd {
269
- height: 26px; border-radius: 6px; display: grid; place-items: center; font: 600 11px/1 var(--mono);
270
- background: rgba(0,0,0,.5); border: 1px solid var(--line-2); color: var(--muted); backdrop-filter: blur(6px);
271
- transition: background .1s, color .1s, transform .1s;
272
- }
273
- .keyhud kbd.on { background: var(--mint); color: var(--mint-ink); border-color: var(--mint); transform: translateY(1px); }
274
  .keyhud .gap { visibility: hidden; }
275
 
276
- .ended {
277
- inset: 0; display: grid; place-items: center; background: rgba(4,5,8,.78); backdrop-filter: blur(6px); text-align: center; padding: 24px;
278
- }
279
- .ended h4 { font: 400 clamp(28px, 4vw, 44px)/1 var(--display); margin: 0 0 10px; }
280
- .ended p { color: var(--muted); margin: 0 auto 20px; max-width: 460px; }
281
- .ended .row { justify-content: center; flex-wrap: wrap; }
282
- .cta.inline { width: auto; margin: 0; padding: 11px 18px; font-size: 14px; }
283
-
284
- .transport { display: flex; align-items: center; gap: 12px; }
285
- .transport .tc { font: 500 12px/1 var(--mono); color: var(--muted); min-width: 92px; text-align: right; }
286
- .timeline { flex: 1; position: relative; height: 40px; display: flex; gap: 3px; align-items: stretch; cursor: pointer; padding: 0; user-select: none; }
287
- .seg-turn {
288
- position: relative; border-radius: 6px; overflow: hidden; background: rgba(255,255,255,.06);
289
- border: 1px solid var(--line); min-width: 6px; flex: 1 1 0; transition: flex-grow .5s var(--ease), background .3s;
290
- }
291
- .seg-turn .fill { position: absolute; inset: 0; background-size: auto 100%; background-repeat: repeat-x; opacity: .55; }
292
- .seg-turn .cap { position: absolute; left: 6px; right: 6px; bottom: 4px; font-size: 10.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 6px #000; }
293
- .seg-turn.k-move { border-color: rgba(185,162,255,.35); }
294
- .seg-turn.k-say { border-color: rgba(139,240,197,.3); }
295
- .seg-turn.pending { background: repeating-linear-gradient(-45deg, rgba(255,255,255,.04) 0 6px, rgba(255,255,255,.08) 6px 12px); background-size: 34px 34px; animation: stripes 1s linear infinite; flex: 0 0 64px; }
296
- .seg-turn.failed { background: rgba(255,143,156,.12); border-color: rgba(255,143,156,.35); flex: 0 0 64px; }
297
  @keyframes stripes { to { background-position: 34px 0; } }
298
- .playhead { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); border-radius: 2px; box-shadow: 0 0 10px rgba(255,255,255,.6); pointer-events: none; z-index: 2; left: 0; }
299
-
300
- .dock { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 12px; backdrop-filter: blur(16px); }
301
- .dock-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
302
- .tabs { display: inline-flex; padding: 3px; border-radius: 10px; background: rgba(0,0,0,.35); border: 1px solid var(--line); }
303
- .tabs button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
304
- .tabs button[aria-selected="true"] { background: rgba(255,255,255,.1); color: var(--text); }
305
- .dock-top .spacer { flex: 1; }
306
- .say { display: flex; gap: 8px; }
307
- .say input {
308
- flex: 1; min-width: 0; background: rgba(0,0,0,.4); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; outline: none; font-size: 15px;
309
- }
310
- .say input:focus { border-color: rgba(139,240,197,.6); box-shadow: 0 0 0 3px rgba(139,240,197,.12); }
311
- .send { border: 0; border-radius: 12px; padding: 0 18px; background: var(--mint); color: var(--mint-ink); font-weight: 650; display: flex; align-items: center; gap: 8px; }
312
- .send:disabled { opacity: .45; cursor: not-allowed; }
313
- .chips { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
314
- .chips::-webkit-scrollbar { display: none; }
315
- .chips button { flex: none; border: 1px solid var(--line); background: rgba(255,255,255,.03); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; color: var(--muted); transition: all .2s; }
316
- .chips button:hover { color: var(--text); border-color: var(--line-2); background: rgba(255,255,255,.07); }
317
- .move { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; }
318
  @media (max-width: 640px) { .move { grid-template-columns: 1fr; } }
319
- .minimap { width: 110px; height: 110px; border-radius: 12px; background: rgba(0,0,0,.4); border: 1px solid var(--line); }
320
- .move-info { min-width: 0; }
321
- .move-info .hint { color: var(--muted); font-size: 13px; }
322
- .move-info .hint kbd { font: 600 11px/1 var(--mono); padding: 3px 5px; border-radius: 4px; border: 1px solid var(--line-2); background: rgba(255,255,255,.05); color: var(--text); }
323
- .recbar { margin-top: 10px; height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; position: relative; }
324
- .recbar i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--lav), var(--rose)); border-radius: inherit; }
325
- .recstate { margin-top: 8px; font: 500 12px/1 var(--mono); color: var(--faint); display: flex; gap: 10px; align-items: center; }
326
- .recstate.rec { color: var(--rose); }
327
- .recstate.rec::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--rose); animation: pulse 1s infinite; }
328
  .pad { display: grid; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(2, 40px); gap: 6px; }
329
- .pad button { border: 1px solid var(--line-2); background: rgba(255,255,255,.04); border-radius: 8px; font: 600 12px/1 var(--mono); color: var(--muted); touch-action: none; }
330
- .pad button.on { background: var(--lav); color: #1b1235; border-color: var(--lav); }
331
  .pad .gap { visibility: hidden; }
332
- .toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); cursor: pointer; user-select: none; }
333
- .toggle input { accent-color: var(--mint); }
334
-
335
- .notes { border-left: 1px solid var(--line); background: rgba(9,10,14,.5); display: flex; flex-direction: column; min-height: 0; max-height: calc(100vh - 57px); position: sticky; top: 57px; }
336
- @media (max-width: 1100px) { .notes { border-left: 0; border-top: 1px solid var(--line); max-height: none; position: static; } }
337
- .notes header { padding: 18px 18px 10px; display: flex; align-items: baseline; justify-content: space-between; }
338
- .notes header h3 { margin: 0; font: 400 24px/1 var(--display); }
339
- .notes header span { font-size: 12px; color: var(--faint); }
340
- .notes ol { list-style: none; margin: 0; padding: 0 12px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
341
- .note { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: rgba(255,255,255,.02); cursor: pointer; transition: border-color .2s, background .2s; }
342
- .note:hover { border-color: var(--line-2); }
343
- .note.current { border-color: rgba(139,240,197,.45); background: rgba(139,240,197,.05); }
344
- .note .h { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
345
- .note .h .n { font: 600 11px/1 var(--mono); color: var(--text); }
346
- .note .h .st { margin-left: auto; font: 500 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
347
- .note .you { font-weight: 550; font-size: 14px; margin-bottom: 6px; }
348
- .note .dir { color: var(--muted); font-size: 12.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
349
  .note.open .dir { -webkit-line-clamp: unset; }
350
- .note .act { color: var(--faint); font-size: 12px; margin-top: 6px; }
351
- .note .tm { color: var(--faint); font: 500 10.5px/1 var(--mono); margin-top: 8px; }
352
- .st-ready { color: var(--mint); }
353
- .st-failed { color: var(--rose); }
354
- .st-busy { color: var(--amber); }
 
 
355
 
356
  .toast {
357
- position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; z-index: 50;
358
- background: #1a1e28; border: 1px solid var(--line-2); padding: 10px 16px; border-radius: 12px; font-size: 13.5px;
359
- box-shadow: 0 20px 50px -20px #000; transition: all .35s var(--ease); max-width: calc(100vw - 32px);
360
- }
361
- .toast.show { opacity: 1; transform: translate(-50%, 0); }
362
- .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
363
- @media (prefers-reduced-motion: reduce) {
364
- *, *::before, *::after { animation: none !important; transition: none !important; }
365
  }
 
 
366
  </style>
367
  </head>
368
  <body>
369
  <div id="app">
370
- <header class="topbar">
371
- <a class="brand" href="#" id="home-link"><span class="brand-mark"></span>Hy-Nomas <small>Live</small></a>
372
  <nav>
373
  <a href="https://huggingface.co/tencent/Hy-Nomas" target="_blank" rel="noopener">Model</a>
374
  <a href="https://github.com/Tencent-Hunyuan/Hy-Nomas" target="_blank" rel="noopener">Code</a>
375
- <span class="pill" id="slots"><span class="dot"></span><span>Checking GPUs…</span></span>
376
  </nav>
377
- </header>
378
 
379
- <main id="lobby">
380
- <section class="hero">
381
- <div class="eyebrow">Interactive world model · Tencent Hunyuan</div>
382
- <h1>Step into a world that <em>keeps writing itself.</em></h1>
383
- <p>Describe a protagonist and a place. Hy-Nomas renders the opening shot, then keeps the same world going turn by turn. Tell it what happens next, or take the camera and steer.</p>
384
  </section>
385
 
386
  <section class="lobby-grid">
387
- <div>
388
- <div class="section-title"><h2>Start from a world</h2><span>or write your own →</span></div>
389
  <div class="worlds" id="worlds"></div>
390
  </div>
391
 
392
- <form class="composer" id="composer" autocomplete="off">
393
- <h3>Dream your own</h3>
394
- <p class="sub">Two sentences are enough. A director model expands them into a full shot.</p>
395
- <label class="field"><span>Protagonist <button type="button" class="ghost icon" id="dice" title="Surprise me" style="padding:2px 8px;font-size:12px">🎲 Surprise me</button></span>
396
- <textarea id="subject" rows="2" placeholder="A small orange fox with a fluffy white-tipped tail" required></textarea></label>
397
- <label class="field"><span>World</span>
398
- <textarea id="environment" rows="3" placeholder="A luminous night forest with mossy stone paths and drifting blue fireflies" required></textarea></label>
399
- <div class="field"><span>Camera</span>
400
- <div class="seg" id="perspective" style="--n:3">
401
- <button type="button" data-v="third-person follow" aria-pressed="true">Follow<small>behind the subject</small></button>
402
- <button type="button" data-v="first-person" aria-pressed="false">First person<small>through their eyes</small></button>
403
- <button type="button" data-v="third-person observer" aria-pressed="false">Observer<small>watching from afar</small></button>
404
  </div>
405
  </div>
406
- <details class="adv">
407
- <summary>Session settings</summary>
408
- <div class="adv-body">
409
- <div class="field"><span>GPU session <em id="len-note" style="font-style:normal;color:var(--faint)"></em></span>
410
- <div class="seg" id="length" style="--n:3">
411
- <button type="button" data-v="quick" aria-pressed="false">Quick<small>1.5 min</small></button>
412
- <button type="button" data-v="standard" aria-pressed="true">Standard<small>2.5 min</small></button>
413
- <button type="button" data-v="long" aria-pressed="false">Long<small>4 min</small></button>
414
  </div>
415
  </div>
416
- <div class="field"><span>Turn length</span>
417
- <div class="seg" id="turnlen" style="--n:4">
418
  <button type="button" data-v="3" aria-pressed="false">3s</button>
419
  <button type="button" data-v="4" aria-pressed="true">4s</button>
420
  <button type="button" data-v="5" aria-pressed="false">5s</button>
421
  <button type="button" data-v="6" aria-pressed="false">6s</button>
422
  </div>
423
  </div>
424
- <div class="field"><span>Render quality</span>
425
- <div class="seg" id="steps" style="--n:3">
426
- <button type="button" data-v="4" aria-pressed="false">Fast<small>4 steps</small></button>
427
- <button type="button" data-v="6" aria-pressed="false">Balanced<small>6 steps</small></button>
428
- <button type="button" data-v="8" aria-pressed="true">Best<small>8 steps</small></button>
429
  </div>
430
  </div>
431
- <label class="field"><span>Seed <em style="font-style:normal;color:var(--faint)">blank = random</em></span><input type="number" id="seed" min="0" placeholder="random"></label>
432
  </div>
433
  </details>
434
- <button class="cta" id="enter" type="submit">Enter world <span aria-hidden="true">→</span></button>
435
  <p class="fineprint">A live world holds a ZeroGPU for the whole session and uses your Hugging Face GPU quota. <a href="https://huggingface.co/login" target="_blank" rel="noopener">Log in</a> or go PRO for longer sessions.</p>
436
  </form>
437
  </section>
438
 
439
- <section class="lobby-foot">
440
- <div><b>Say</b>Type what happens next: weather, new characters, actions, a change of style. The world keeps its memory.</div>
441
- <div><b>Move</b>Hold <span style="font-family:var(--mono)">W A S D</span> and the arrow keys (or drag) while the world plays. Your path steers the next shot.</div>
442
- <div><b>Rewind</b>Undo any turn you don't like and try a different direction. Download the whole journey as an MP4.</div>
443
  </section>
444
  </main>
445
 
446
- <main id="stage" class="hidden">
447
  <div class="stage-wrap">
448
  <div class="theater">
449
  <div class="stage-head">
450
- <button class="ghost" id="leave" title="Leave this world">← Worlds</button>
451
- <h2 class="title" id="world-title">World</h2>
452
  <span class="chip" id="world-persp">Follow</span>
453
  <div class="clock" id="clock" title="GPU time left in this session">
454
- <svg viewBox="0 0 36 36"><circle class="track" cx="18" cy="18" r="15" fill="none" stroke-width="3"/><circle class="bar" id="clock-bar" cx="18" cy="18" r="15" fill="none" stroke-width="3" stroke-dasharray="94.25" stroke-dashoffset="0"/></svg>
455
  <div><b id="clock-text">--:--</b>GPU time left</div>
456
  </div>
457
  </div>
458
 
459
- <div class="viewport" id="viewport">
460
- <canvas id="ambient" width="104" height="60"></canvas>
461
- <div class="screen" id="screenbox">
462
- <canvas id="screen" width="832" height="480"></canvas>
463
- <div class="ov badge-live hidden" id="live"><span class="dot"></span><span id="live-text">LIVE</span><button id="golive" class="hidden">JUMP TO LIVE</button></div>
464
- <div class="ov keyhud" id="keyhud">
465
- <kbd class="gap"></kbd><kbd data-k="KeyW">W</kbd><kbd class="gap"></kbd>
466
- <kbd data-k="KeyA">A</kbd><kbd data-k="KeyS">S</kbd><kbd data-k="KeyD">D</kbd>
467
- <kbd class="gap"></kbd><kbd data-k="ArrowUp">↑</kbd><kbd class="gap"></kbd>
468
- <kbd data-k="ArrowLeft">←</kbd><kbd data-k="ArrowDown">↓</kbd><kbd data-k="ArrowRight">→</kbd>
469
- </div>
470
- <div class="ov forming" id="forming">
471
- <div class="inner">
472
- <h4 id="forming-title">Opening a world</h4>
473
- <ol class="steps" id="steps-list">
474
- <li data-s="gpu"><span class="ico"></span><span id="gpu-step">Reserving a GPU</span></li>
475
- <li data-s="direct"><span class="ico"></span>Directing the opening shot</li>
476
- <li data-s="render"><span class="ico"></span><span id="render-step">Rendering the first seconds</span></li>
477
- </ol>
478
- <div class="scene" id="forming-scene"></div>
479
  </div>
480
- </div>
481
- <div class="ov turn-pill off" id="pill">
482
- <span class="spinner"></span>
483
- <span class="lbl" id="pill-text"></span>
484
- <span class="meter" id="pill-meter"><i></i></span>
485
- </div>
486
- <div class="ov ended hidden" id="ended">
487
- <div>
488
- <h4 id="ended-title">Session complete</h4>
489
- <p id="ended-text">Your GPU time for this world is up. Download the journey or open a new world.</p>
490
- <div class="row">
491
- <a class="cta inline" id="ended-dl" href="#" download>Download MP4</a>
492
- <button class="ghost" id="ended-new">New world</button>
493
- <button class="ghost" id="ended-watch">Watch replay</button>
 
 
 
 
 
 
 
 
 
 
 
494
  </div>
495
  </div>
496
  </div>
497
  </div>
 
 
 
 
 
498
  </div>
499
 
500
- <div class="transport">
501
- <button class="ghost icon" id="play" title="Play / pause (space)" aria-label="Play or pause">❚❚</button>
502
- <div class="timeline" id="timeline" role="slider" aria-label="Timeline" tabindex="0"><div class="playhead" id="playhead"></div></div>
503
- <span class="tc" id="tc">0:00 / 0:00</span>
504
- </div>
505
-
506
- <div class="dock" id="dock">
507
- <div class="dock-top">
508
- <div class="tabs" role="tablist">
509
- <button role="tab" id="tab-say" aria-selected="true">💬 Say</button>
510
- <button role="tab" id="tab-move" aria-selected="false">🎮 Move</button>
511
- </div>
512
  <span class="spacer"></span>
513
- <button class="ghost" id="undo" title="Remove the last turn and try again">↶ Undo turn</button>
514
- <a class="ghost" id="download" href="#" download title="Download the whole journey">⤓ MP4</a>
 
 
515
  </div>
516
  <div id="pane-say">
517
  <form class="say" id="say-form" autocomplete="off">
518
- <input id="say" maxlength="400" placeholder="What happens next? e.g. “snow begins to fall”" aria-label="What happens next">
519
- <button class="send" id="say-send" type="submit">Send <span aria-hidden="true">↵</span></button>
520
  </form>
521
- <div class="chips" id="chips"></div>
522
  </div>
523
  <div id="pane-move" class="hidden">
524
  <div class="move">
525
  <canvas class="minimap" id="minimap" width="220" height="220"></canvas>
526
  <div class="move-info">
527
- <div class="hint">Hold <kbd>W</kbd><kbd>A</kbd><kbd>S</kbd><kbd>D</kbd> to move, <kbd>←</kbd><kbd>→</kbd><kbd>↑</kbd><kbd>↓</kbd> or drag the view to look. Recording starts on your first move and lasts one turn.</div>
528
  <div class="recbar"><i id="recbar"></i></div>
529
  <div class="recstate" id="recstate">Ready to record</div>
530
- <div class="row" style="margin-top:10px;flex-wrap:wrap">
531
- <button class="send" id="move-send" disabled style="padding:9px 14px">Send move</button>
532
- <button class="ghost" id="move-clear">Reset</button>
533
  <label class="toggle"><input type="checkbox" id="autosend" checked> Send when recording ends</label>
534
  </div>
535
  </div>
@@ -542,8 +495,8 @@ details.adv .adv-body { padding-top: 14px; }
542
  </div>
543
  </div>
544
 
545
- <aside class="notes" aria-label="Director's notes">
546
- <header><h3>Director's notes</h3><span id="notes-count">0 turns</span></header>
547
  <ol id="notes"></ol>
548
  </aside>
549
  </div>
@@ -693,7 +646,7 @@ bindSeg("steps", "steps");
693
 
694
  function posterStyle(w) {
695
  const [a, b, c] = w.colors;
696
- return `background-image:url('assets/${w.id}.jpg?v=1'), radial-gradient(80% 70% at 70% 30%, ${c}55, transparent 60%), linear-gradient(135deg, ${a}, ${b})`;
697
  }
698
  function renderWorlds() {
699
  els.worlds.innerHTML = "";
@@ -747,7 +700,7 @@ const S = {
747
  turns: [], frames: [], bitmaps: new Map(), decoding: new Set(),
748
  pos: 0, playing: true, followLive: true, lastDrawn: -1,
749
  remaining: 0, remainingAt: 0, total: 0, ready: false, ended: false,
750
- genStartedAt: 0, ratio: 4.5, mode: "say", firstFrames: false,
751
  };
752
 
753
  function resetStage() {
@@ -1127,7 +1080,7 @@ function renderNotes() {
1127
  li.className = "note";
1128
  const busy = ["waiting", "directing", "queued", "generating"].includes(t.status);
1129
  const st = t.status === "ready" ? "st-ready" : t.status === "failed" ? "st-failed" : "st-busy";
1130
- const label = { waiting: "waiting", directing: "directing", queued: "up next", generating: "rendering", ready: "on screen", failed: "failed" }[t.status] || t.status;
1131
  li.innerHTML = `<div class="h"><span class="n"></span><span class="k"></span><span class="st ${st}">${label}</span></div><div class="you"></div><div class="dir"></div><div class="act"></div><div class="tm"></div>`;
1132
  li.querySelector(".n").textContent = t.id === 0 ? "OPENING" : `TURN ${t.id}`;
1133
  li.querySelector(".k").textContent = t.kind === "move" ? "🎮 camera" : t.kind === "say" ? "💬 you said" : "🌍 world";
@@ -1293,10 +1246,11 @@ async function sendMove() {
1293
  els.moveSend.addEventListener("click", sendMove);
1294
  els.moveClear.addEventListener("click", resetRecording);
1295
 
 
1296
  function drawMinimap() {
1297
  const W = els.minimap.width, H = els.minimap.height;
1298
  mctx.clearRect(0, 0, W, H);
1299
- mctx.strokeStyle = "rgba(255,255,255,.06)"; mctx.lineWidth = 1;
1300
  for (let g = 0; g <= W; g += 22) { mctx.beginPath(); mctx.moveTo(g, 0); mctx.lineTo(g, H); mctx.stroke(); mctx.beginPath(); mctx.moveTo(0, g); mctx.lineTo(W, g); mctx.stroke(); }
1301
  const pts = REC.frames.map((f) => [f.position.x, f.position.z]);
1302
  const cur = [REC.pos[0], REC.pos[2]];
@@ -1307,18 +1261,16 @@ function drawMinimap() {
1307
  const cx = (minx + maxx) / 2, cz = (minz + maxz) / 2;
1308
  const tx = (x) => W / 2 + (x - cx) / span * W, tz = (z) => H / 2 + (z - cz) / span * H;
1309
  if (pts.length > 1) {
1310
- const grad = mctx.createLinearGradient(tx(pts[0][0]), tz(pts[0][1]), tx(cur[0]), tz(cur[1]));
1311
- grad.addColorStop(0, "#b9a2ff"); grad.addColorStop(1, "#ff8f9c");
1312
- mctx.strokeStyle = grad; mctx.lineWidth = 4; mctx.lineCap = "round"; mctx.lineJoin = "round";
1313
  mctx.beginPath(); mctx.moveTo(tx(pts[0][0]), tz(pts[0][1]));
1314
  for (const p of pts) mctx.lineTo(tx(p[0]), tz(p[1]));
1315
  mctx.stroke();
1316
  }
1317
  const x = tx(cur[0]), z = tz(cur[1]);
1318
  const a = -REC.yaw - Math.PI / 2;
1319
- mctx.fillStyle = "rgba(139,240,197,.18)";
1320
  mctx.beginPath(); mctx.moveTo(x, z); mctx.arc(x, z, 46, a - 0.5, a + 0.5); mctx.closePath(); mctx.fill();
1321
- mctx.fillStyle = "#8bf0c5";
1322
  mctx.beginPath(); mctx.arc(x, z, 6, 0, Math.PI * 2); mctx.fill();
1323
  }
1324
 
 
5
  <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
6
  <title>Hy-Nomas Live</title>
7
  <meta name="description" content="Step into a world that keeps writing itself. Live, steerable world generation with Tencent Hy-Nomas.">
8
+ <script>
9
+ (() => {
10
+ const q = new URLSearchParams(location.search).get("__theme");
11
+ const dark = q === "dark" || (q !== "light" && matchMedia("(prefers-color-scheme: dark)").matches);
12
+ if (dark) document.documentElement.classList.add("dark");
13
+ })();
14
+ </script>
15
  <link rel="preconnect" href="https://fonts.googleapis.com">
16
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
17
+ <link href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;500;700&family=Roboto+Mono:wght@400;500&display=swap" rel="stylesheet">
18
+ <link rel="stylesheet" href="assets/citrus.css?v=1">
19
  <style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  * { box-sizing: border-box; }
21
+ html, body { margin: 0; }
22
  body {
23
+ background: var(--body-background-fill);
24
+ color: var(--body-text-color);
25
+ font-family: var(--font);
26
+ font-size: var(--text-md);
27
+ line-height: var(--line-md);
28
  -webkit-font-smoothing: antialiased;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  }
30
+ button, input, textarea { font: inherit; color: inherit; }
 
31
  button { cursor: pointer; }
32
+ a { color: var(--link-text-color); }
33
  .hidden { display: none !important; }
34
+ .mono { font-family: var(--font-mono); }
35
+
36
+ .wrap { max-width: 1280px; margin: 0 auto; padding: var(--spacing-xxl) var(--spacing-xxl) 48px; }
37
+ @media (max-width: 640px) { .wrap { padding: var(--spacing-xl) 16px 40px; } }
38
+
39
+ .block {
 
 
 
 
 
 
 
 
 
40
  position: relative;
41
+ background: var(--block-background-fill);
42
+ border: var(--block-border-width) solid var(--block-border-color);
43
+ border-radius: var(--block-radius);
44
+ box-shadow: var(--block-shadow);
45
+ padding: var(--block-padding);
46
+ }
47
+ .block-label {
48
+ display: inline-flex; align-items: center; gap: var(--spacing-sm);
49
+ font-size: var(--block-label-text-size); color: var(--block-label-text-color);
50
+ background: var(--block-label-background-fill);
51
+ border: var(--block-label-border-width) solid var(--block-label-border-color);
52
+ border-radius: var(--block-label-radius);
53
+ padding: var(--block-label-padding);
54
+ position: absolute; top: 0; left: 0; z-index: 4; line-height: 1.2;
55
+ }
56
+ .block.labeled { padding-top: calc(var(--block-padding-y, 14px) + 26px); }
57
+ .label-text { display: block; font-size: var(--block-label-text-size); color: var(--block-title-text-color); margin-bottom: var(--spacing-md); }
58
+ .info { color: var(--block-info-text-color); font-size: var(--text-sm); }
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
+ .btn {
61
+ display: inline-flex; align-items: center; justify-content: center; gap: var(--spacing-md);
62
+ border: var(--button-border-width) solid transparent;
63
+ border-radius: var(--button-large-radius);
64
+ padding: var(--button-large-padding);
65
+ font-size: var(--button-large-text-size); font-weight: var(--button-large-text-weight);
66
+ transition: var(--button-transition); text-decoration: none; white-space: nowrap; line-height: 1.2;
67
+ }
68
+ .btn.sm { border-radius: var(--button-small-radius); padding: var(--button-small-padding); font-size: var(--button-small-text-size); font-weight: var(--button-small-text-weight); }
69
+ .btn:hover:not(:disabled) { transform: var(--button-transform-hover); }
70
+ .btn:active:not(:disabled) { transform: var(--button-transform-active); }
71
+ .btn:disabled { opacity: .5; cursor: not-allowed; }
72
+ .primary { background: var(--button-primary-background-fill); color: var(--button-primary-text-color); box-shadow: var(--button-primary-shadow); }
73
+ .primary:hover:not(:disabled) { background: var(--button-primary-background-fill-hover); box-shadow: var(--button-primary-shadow-hover); }
74
+ .primary:active:not(:disabled) { box-shadow: var(--button-primary-shadow-active); }
75
+ .secondary { background: var(--button-secondary-background-fill); color: var(--button-secondary-text-color); box-shadow: var(--button-secondary-shadow); }
76
+ .secondary:hover:not(:disabled) { background: var(--button-secondary-background-fill-hover); box-shadow: var(--button-secondary-shadow-hover); }
77
+ .secondary:active:not(:disabled) { box-shadow: var(--button-secondary-shadow-active); }
78
+ .neutral { background: var(--checkbox-label-background-fill); color: var(--body-text-color); box-shadow: 0 3px 0 0 var(--block-border-color); }
79
+ .neutral:hover:not(:disabled) { box-shadow: 0 5px 0 0 var(--block-border-color); }
80
+ .stop { background: var(--button-cancel-background-fill); color: var(--button-cancel-text-color); box-shadow: var(--button-cancel-shadow); }
81
+
82
+ .input, textarea.input {
83
+ width: 100%; display: block;
84
+ background: var(--input-background-fill);
85
+ border: var(--input-border-width) solid var(--input-border-color);
86
+ border-radius: var(--input-radius);
87
+ box-shadow: var(--input-shadow);
88
+ padding: var(--input-padding);
89
+ font-size: var(--input-text-size);
90
+ outline: none; resize: vertical;
91
+ }
92
+ .input:focus { background: var(--input-background-fill-focus); box-shadow: var(--input-shadow-focus); border-color: var(--input-border-color-focus); }
93
+ .input::placeholder { color: var(--input-placeholder-color); }
94
+
95
+ .radio { display: flex; flex-wrap: wrap; gap: var(--checkbox-label-gap); }
96
+ .radio button {
97
+ display: inline-flex; align-items: center; gap: var(--spacing-md);
98
+ background: var(--checkbox-label-background-fill);
99
+ border: var(--checkbox-label-border-width) solid var(--checkbox-label-border-color);
100
+ border-radius: var(--checkbox-border-radius, var(--radius-sm));
101
+ padding: var(--checkbox-label-padding);
102
+ font-size: var(--checkbox-label-text-size); color: var(--checkbox-label-text-color);
103
+ box-shadow: var(--checkbox-label-shadow); transition: background .1s;
104
+ }
105
+ .radio button::before {
106
+ content: ""; width: 14px; height: 14px; border-radius: 50%; flex: none;
107
+ border: 1px solid var(--checkbox-border-color); background: var(--checkbox-background-color);
108
+ }
109
+ .radio button[aria-pressed="true"] {
110
+ background: var(--checkbox-label-background-fill-selected);
111
+ border-color: var(--checkbox-label-border-color-selected);
112
+ color: var(--checkbox-label-text-color-selected);
113
+ }
114
+ .radio button[aria-pressed="true"]::before {
115
+ background: var(--checkbox-background-color-selected, var(--color-accent));
116
+ border-color: var(--checkbox-border-color-selected, var(--color-accent));
117
+ box-shadow: inset 0 0 0 3px var(--checkbox-label-background-fill-selected);
118
+ }
119
+ .radio button small { color: inherit; opacity: .7; }
120
 
121
+ details.accordion { margin-top: var(--spacing-lg); }
122
+ details.accordion > summary {
123
+ list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
124
+ font-size: var(--text-md); color: var(--body-text-color); padding: var(--spacing-sm) 0;
125
+ }
126
+ details.accordion > summary::-webkit-details-marker { display: none; }
127
+ details.accordion > summary::after { content: "▼"; font-size: 10px; color: var(--body-text-color-subdued); transform: rotate(90deg); transition: transform .15s; }
128
+ details.accordion[open] > summary::after { transform: rotate(0deg); }
129
+ details.accordion .acc-body { padding-top: var(--spacing-lg); display: grid; gap: var(--spacing-xl); }
130
+
131
+ .topbar { border-bottom: 1px solid var(--border-color-primary); background: var(--background-fill-primary); position: sticky; top: 0; z-index: 30; }
132
+ .topbar .in { max-width: 1280px; margin: 0 auto; padding: var(--spacing-lg) var(--spacing-xxl); display: flex; gap: var(--spacing-lg); align-items: center; }
133
+ @media (max-width: 640px) { .topbar .in { padding: var(--spacing-lg) 16px; } }
134
+ .brand { display: flex; align-items: center; gap: var(--spacing-md); font-weight: 700; text-decoration: none; color: var(--body-text-color); font-size: var(--text-lg); }
135
+ .brand .logo { width: 22px; height: 22px; border-radius: var(--radius-sm); background: var(--color-accent); box-shadow: 0 2px 0 0 var(--primary-700); display: grid; place-items: center; color: var(--button-primary-text-color); font-size: 13px; }
136
+ .brand small { font-weight: 400; color: var(--body-text-color-subdued); }
137
+ .topbar nav { margin-left: auto; display: flex; gap: var(--spacing-md); align-items: center; }
138
+ .topbar nav a { color: var(--body-text-color-subdued); text-decoration: none; font-size: var(--text-sm); padding: 4px 8px; border-radius: var(--radius-sm); }
139
+ .topbar nav a:hover { color: var(--body-text-color); background: var(--block-background-fill); }
140
+ .status { display: inline-flex; align-items: center; gap: var(--spacing-sm); font-size: var(--text-sm); color: var(--body-text-color-subdued); border: 1px solid var(--border-color-primary); border-radius: var(--radius-sm); padding: 3px 8px; background: var(--block-background-fill); white-space: nowrap; }
141
+ .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--neutral-400); flex: none; }
142
+ .dot.ok { background: #22c55e; }
143
+ .dot.warn { background: var(--color-accent); }
144
+ .dot.live { background: #ef4444; animation: pulse 1.4s infinite; }
145
+ @keyframes pulse { 50% { opacity: .35; } }
146
+
147
+ .prose h1 { font-size: 2rem; font-weight: var(--prose-header-text-weight); margin: 0 0 var(--spacing-md); letter-spacing: -0.01em; }
148
+ .prose p { margin: 0; color: var(--body-text-color-subdued); max-width: 760px; font-size: var(--text-lg); }
149
+ .prose .links { margin-top: var(--spacing-lg); display: flex; gap: var(--spacing-lg); flex-wrap: wrap; font-size: var(--text-md); }
150
+
151
+ .lobby-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: var(--layout-gap); align-items: start; margin-top: var(--layout-gap); }
152
+ @media (max-width: 960px) { .lobby-grid { grid-template-columns: 1fr; } }
153
+ .worlds { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--spacing-lg); }
154
  .world {
155
+ text-align: left; padding: 0; background: var(--background-fill-primary);
156
+ border: 1px solid var(--border-color-primary); border-radius: var(--radius-sm); overflow: hidden;
157
+ transition: border-color .1s, transform .1s, box-shadow .1s; display: flex; flex-direction: column;
158
+ }
159
+ .world:hover { border-color: var(--color-accent); transform: translateY(-2px); box-shadow: 0 3px 0 0 var(--primary-300); }
160
+ .world.selected { border-color: var(--color-accent); box-shadow: 0 0 0 2px var(--color-accent); }
161
+ .world .poster { aspect-ratio: 832 / 480; background-size: cover; background-position: center; background-color: var(--neutral-200); }
162
+ .world .meta { padding: var(--spacing-md) var(--spacing-lg); }
163
+ .world .name { font-weight: 500; font-size: var(--text-md); }
164
+ .world .tag { font-size: var(--text-sm); color: var(--body-text-color-subdued); }
165
+ .composer { display: grid; gap: var(--spacing-xl); position: sticky; top: 72px; }
166
+ .composer .row-between { display: flex; justify-content: space-between; align-items: center; }
167
+ .fineprint { color: var(--body-text-color-subdued); font-size: var(--text-sm); margin: 0; }
168
+ .how { margin-top: var(--layout-gap); display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--spacing-lg); }
169
+ .how .block b { display: block; margin-bottom: 4px; }
170
+ .how .block { color: var(--body-text-color-subdued); font-size: var(--text-sm); }
171
+ .how .block b { color: var(--body-text-color); font-size: var(--text-md); }
172
+ kbd { font-family: var(--font-mono); font-size: 11px; padding: 1px 5px; border-radius: var(--radius-sm); border: 1px solid var(--border-color-primary); background: var(--background-fill-primary); box-shadow: 0 1px 0 0 var(--block-border-color); }
173
+
174
+ .stage-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--layout-gap); align-items: start; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  @media (max-width: 1100px) { .stage-wrap { grid-template-columns: 1fr; } }
176
+ .theater { display: grid; gap: var(--spacing-xl); min-width: 0; }
177
+ .stage-head { display: flex; align-items: center; gap: var(--spacing-lg); flex-wrap: wrap; }
178
+ .stage-head h2 { margin: 0; font-size: var(--text-xxl); font-weight: var(--prose-header-text-weight); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
179
+ .chip { font-size: var(--text-sm); padding: 2px 8px; border-radius: var(--radius-sm); background: var(--color-accent-soft); color: var(--body-text-color); border: 1px solid var(--border-color-primary); }
180
+ .clock { margin-left: auto; display: flex; align-items: center; gap: var(--spacing-md); font-size: var(--text-sm); color: var(--body-text-color-subdued); }
181
+ .clock svg { width: 30px; height: 30px; transform: rotate(-90deg); }
182
+ .clock .track { stroke: var(--border-color-primary); }
183
+ .clock .bar { stroke: var(--color-accent); stroke-linecap: round; transition: stroke-dashoffset .9s linear; }
184
+ .clock.low .bar { stroke: #ef4444; }
185
+ .clock b { color: var(--body-text-color); font-family: var(--font-mono); font-weight: 500; display: block; font-size: var(--text-lg); }
186
+
187
+ .player { padding: 0; overflow: hidden; }
188
+ .viewport { position: relative; width: 100%; max-width: calc((100vh - 300px) * 832 / 480); min-width: min(100%, 480px); margin: 0 auto; }
189
  @media (max-width: 760px) { .viewport { max-width: 100%; min-width: 0; } }
190
+ #ambient { display: none; }
191
+ .screen { position: relative; aspect-ratio: 832 / 480; background: #000; overflow: hidden; touch-action: none; }
 
 
 
 
 
 
 
 
192
  #screen { width: 100%; height: 100%; display: block; transform-origin: 50% 50%; }
193
  .screen.breathing #screen { animation: breathe 7s ease-in-out infinite alternate; }
194
+ @keyframes breathe { from { transform: scale(1); } to { transform: scale(1.03); } }
195
  .screen.steer { cursor: grab; }
196
  .screen.steer:active { cursor: grabbing; }
197
  .ov { position: absolute; z-index: 3; }
198
  .badge-live {
199
+ top: 8px; left: 8px; display: flex; gap: var(--spacing-sm); align-items: center;
200
+ font-size: var(--text-sm); padding: 3px 8px; border-radius: var(--radius-sm);
201
+ background: rgba(15, 14, 13, .72); color: #fff;
202
  }
203
+ .badge-live .dot { background: #ef4444; animation: pulse 1.4s infinite; }
204
+ .badge-live.replay .dot { background: var(--neutral-400); animation: none; }
205
+ .badge-live button { border: 0; border-radius: var(--radius-sm); padding: 2px 6px; font-size: 11px; background: var(--color-accent); color: #000; }
 
206
  .turn-pill {
207
+ left: 8px; right: 8px; bottom: 8px; display: flex; align-items: center; gap: var(--spacing-lg);
208
+ padding: var(--spacing-md) var(--spacing-lg); border-radius: var(--radius-sm);
209
+ background: rgba(15, 14, 13, .78); color: #fff; font-size: var(--text-sm);
210
+ transition: opacity .25s, transform .25s;
211
+ }
212
+ .turn-pill.off { opacity: 0; transform: translateY(6px); pointer-events: none; }
213
+ .turn-pill .lbl { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
214
+ .turn-pill .lbl b { font-weight: 500; }
215
+ .turn-pill .lbl span { opacity: .75; }
216
+ .meter { width: 140px; height: 6px; border-radius: var(--radius-sm); background: rgba(255,255,255,.18); overflow: hidden; flex: none; }
217
+ .meter i { display: block; height: 100%; width: 0; background: var(--color-accent); transition: width .4s linear; }
218
  .meter.indet i { width: 35%; animation: indet 1.3s ease-in-out infinite; }
219
  @keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
220
+ .spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); border-top-color: var(--color-accent); animation: spin .8s linear infinite; flex: none; }
221
  @keyframes spin { to { transform: rotate(360deg); } }
222
 
223
+ .forming { inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; background: var(--neutral-900); color: var(--neutral-100); transition: opacity .6s; }
 
 
 
 
 
 
 
 
224
  .forming.fade { opacity: 0; pointer-events: none; }
 
225
  .forming .inner { max-width: 520px; }
226
+ .forming h4 { font-size: var(--text-xxl); font-weight: var(--prose-header-text-weight); margin: 0 0 var(--spacing-xl); }
227
+ .steps { list-style: none; margin: 0 auto; padding: 0; text-align: left; display: inline-flex; flex-direction: column; gap: var(--spacing-lg); font-size: var(--text-md); }
228
+ .steps li { display: flex; gap: var(--spacing-lg); align-items: center; color: var(--neutral-500); }
229
+ .steps li .ico { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; display: grid; place-items: center; font-size: 10px; flex: none; }
230
+ .steps li.active { color: var(--neutral-100); }
231
+ .steps li.active .ico { border-color: var(--neutral-600); border-top-color: var(--color-accent); animation: spin .9s linear infinite; }
232
+ .steps li.done { color: var(--neutral-300); }
233
+ .steps li.done .ico { background: var(--color-accent); border-color: var(--color-accent); }
234
+ .forming .scene { margin-top: var(--spacing-xl); color: var(--neutral-400); font-size: var(--text-sm); font-style: italic; max-height: 4.5em; overflow: hidden; }
235
+
236
+ .keyhud { right: 8px; top: 8px; display: grid; grid-template-columns: repeat(3, 26px); gap: 4px; opacity: 0; transition: opacity .25s; }
237
  .keyhud.show { opacity: 1; }
238
+ .keyhud kbd { height: 26px; display: grid; place-items: center; background: rgba(15,14,13,.72); color: #ddd; border-color: rgba(255,255,255,.2); box-shadow: none; }
239
+ .keyhud kbd.on { background: var(--color-accent); color: #000; border-color: var(--color-accent); }
 
 
 
 
240
  .keyhud .gap { visibility: hidden; }
241
 
242
+ .ended { inset: 0; display: grid; place-items: center; background: rgba(15, 14, 13, .85); color: #fff; text-align: center; padding: 24px; }
243
+ .ended h4 { font-size: var(--text-xxl); font-weight: var(--prose-header-text-weight); margin: 0 0 var(--spacing-md); }
244
+ .ended p { color: var(--neutral-300); margin: 0 auto var(--spacing-xl); max-width: 460px; }
245
+ .ended .row { display: flex; gap: var(--spacing-lg); justify-content: center; flex-wrap: wrap; }
246
+
247
+ .transport { display: flex; align-items: center; gap: var(--spacing-lg); padding: var(--spacing-lg); border-top: 1px solid var(--block-border-color); background: var(--block-background-fill); }
248
+ .transport .tc { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--body-text-color-subdued); min-width: 92px; text-align: right; }
249
+ .timeline { flex: 1; position: relative; height: 34px; display: flex; gap: 3px; cursor: pointer; user-select: none; }
250
+ .seg-turn { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: var(--background-fill-primary); border: 1px solid var(--border-color-primary); min-width: 6px; flex: 1 1 0; transition: flex-grow .4s; }
251
+ .seg-turn .fill { position: absolute; inset: 0; background-size: auto 100%; background-repeat: repeat-x; opacity: .6; }
252
+ .seg-turn .cap { position: absolute; left: 5px; right: 5px; bottom: 3px; font-size: 11px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px #000; }
253
+ .seg-turn.k-move { border-color: var(--primary-300); }
254
+ .seg-turn.pending { flex: 0 0 64px; background: repeating-linear-gradient(-45deg, var(--primary-100) 0 6px, var(--primary-200) 6px 12px); background-size: 34px 34px; animation: stripes 1s linear infinite; border-color: var(--primary-300); }
255
+ .dark .seg-turn.pending { background: repeating-linear-gradient(-45deg, var(--neutral-800) 0 6px, var(--neutral-700) 6px 12px); background-size: 34px 34px; }
256
+ .seg-turn.pending .cap { color: var(--body-text-color); text-shadow: none; }
257
+ .seg-turn.failed { flex: 0 0 64px; background: var(--error-background-fill); border-color: var(--error-border-color); }
258
+ .seg-turn.failed .cap { color: var(--error-text-color); text-shadow: none; }
 
 
 
 
259
  @keyframes stripes { to { background-position: 34px 0; } }
260
+ .playhead { position: absolute; top: -3px; bottom: -3px; width: 3px; background: var(--color-accent); border-radius: 2px; pointer-events: none; z-index: 2; left: 0; box-shadow: 0 0 0 1px var(--background-fill-primary); }
261
+
262
+ .tabs { display: flex; gap: var(--spacing-sm); border-bottom: 1px solid var(--border-color-primary); margin: calc(-1 * var(--spacing-xl)) calc(-1 * var(--spacing-xl) - 2px) var(--spacing-xl); padding: 0 var(--spacing-lg); align-items: flex-end; }
263
+ .tabs [role="tab"] { border: 0; background: none; padding: var(--spacing-lg) var(--spacing-xl); color: var(--body-text-color-subdued); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: var(--text-md); }
264
+ .tabs [role="tab"][aria-selected="true"] { color: var(--body-text-color); border-bottom-color: var(--color-accent); }
265
+ .tabs .spacer { flex: 1; }
266
+ .tabs .tools { display: flex; gap: var(--spacing-md); padding: var(--spacing-sm) 0 var(--spacing-md); }
267
+ .say { display: flex; gap: var(--spacing-md); }
268
+ .say .input { flex: 1; min-width: 0; }
269
+ .examples { margin-top: var(--spacing-xl); }
270
+ .examples .label-text { margin-bottom: var(--spacing-sm); }
271
+ .chips { display: flex; flex-wrap: wrap; gap: var(--spacing-md); }
272
+ .chips button { background: var(--background-fill-primary); border: 1px solid var(--border-color-primary); border-radius: var(--radius-sm); padding: var(--spacing-sm) var(--spacing-lg); font-size: var(--text-sm); color: var(--body-text-color); transition: background .1s, border-color .1s; }
273
+ .chips button:hover { background: var(--color-accent-soft); border-color: var(--color-accent); }
274
+ .move { display: grid; grid-template-columns: auto 1fr auto; gap: var(--spacing-xl); align-items: center; }
 
 
 
 
 
275
  @media (max-width: 640px) { .move { grid-template-columns: 1fr; } }
276
+ .minimap { width: 110px; height: 110px; border-radius: var(--radius-sm); background: var(--background-fill-primary); border: 1px solid var(--border-color-primary); }
277
+ .move-info { min-width: 0; display: grid; gap: var(--spacing-md); }
278
+ .recbar { height: 8px; border-radius: var(--radius-sm); background: var(--background-fill-primary); border: 1px solid var(--border-color-primary); overflow: hidden; position: relative; }
279
+ .recbar i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--color-accent); }
280
+ .recstate { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--body-text-color-subdued); display: flex; gap: var(--spacing-md); align-items: center; }
281
+ .recstate.rec { color: #dc2626; }
282
+ .recstate.rec::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; animation: pulse 1s infinite; }
283
+ .row { display: flex; gap: var(--spacing-md); align-items: center; flex-wrap: wrap; }
 
284
  .pad { display: grid; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(2, 40px); gap: 6px; }
285
+ .pad button { border: 1px solid var(--border-color-primary); background: var(--checkbox-label-background-fill); border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: var(--text-sm); box-shadow: 0 3px 0 0 var(--block-border-color); touch-action: none; }
286
+ .pad button.on { background: var(--color-accent); color: #000; box-shadow: 0 1px 0 0 var(--primary-600); transform: translateY(2px); }
287
  .pad .gap { visibility: hidden; }
288
+ .toggle { display: inline-flex; align-items: center; gap: var(--spacing-sm); font-size: var(--text-sm); color: var(--body-text-color); cursor: pointer; user-select: none; }
289
+ .toggle input { accent-color: var(--color-accent); width: 16px; height: 16px; }
290
+
291
+ .notes { position: sticky; top: 72px; max-height: calc(100vh - 96px); display: flex; flex-direction: column; padding: 0; }
292
+ @media (max-width: 1100px) { .notes { position: static; max-height: none; } }
293
+ .notes header { padding: var(--spacing-xl); padding-top: calc(var(--spacing-xl) + 22px); display: flex; justify-content: flex-end; }
294
+ .notes header span { font-size: var(--text-sm); color: var(--body-text-color-subdued); }
295
+ .notes ol { list-style: none; margin: 0; padding: 40px var(--spacing-lg) var(--spacing-lg); overflow-y: auto; display: grid; gap: var(--spacing-md); }
296
+ .note { background: var(--background-fill-primary); border: 1px solid var(--border-color-primary); border-radius: var(--radius-sm); padding: var(--spacing-lg); cursor: pointer; }
297
+ .note:hover { border-color: var(--color-accent); }
298
+ .note .h { display: flex; gap: var(--spacing-md); align-items: center; font-size: var(--text-sm); color: var(--body-text-color-subdued); margin-bottom: 4px; }
299
+ .note .h .n { font-family: var(--font-mono); color: var(--body-text-color); }
300
+ .note .h .st { margin-left: auto; font-size: 11px; padding: 1px 6px; border-radius: var(--radius-sm); background: var(--checkbox-label-background-fill); color: var(--body-text-color); }
301
+ .note .you { font-weight: 500; margin-bottom: 4px; }
302
+ .note .dir { color: var(--body-text-color-subdued); font-size: var(--text-sm); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
 
 
303
  .note.open .dir { -webkit-line-clamp: unset; }
304
+ .note .act { color: var(--body-text-color-subdued); font-size: var(--text-sm); margin-top: 4px; }
305
+ .note .tm { color: var(--body-text-color-subdued); font-family: var(--font-mono); font-size: 11px; margin-top: var(--spacing-md); }
306
+ .st-ready { background: #dcfce7 !important; color: #166534 !important; }
307
+ .dark .st-ready { background: #14532d !important; color: #bbf7d0 !important; }
308
+ .st-busy { background: var(--primary-100) !important; color: var(--primary-800) !important; }
309
+ .dark .st-busy { background: var(--primary-800) !important; color: var(--primary-100) !important; }
310
+ .st-failed { background: var(--error-background-fill) !important; color: var(--error-text-color) !important; }
311
 
312
  .toast {
313
+ position: fixed; right: 16px; bottom: 16px; transform: translateY(16px); opacity: 0; z-index: 60;
314
+ background: var(--background-fill-primary); border: 1px solid var(--border-color-primary); border-left: 4px solid var(--color-accent);
315
+ padding: var(--spacing-lg) var(--spacing-xl); border-radius: var(--radius-sm); box-shadow: var(--shadow-drop-lg);
316
+ transition: all .25s; max-width: min(420px, calc(100vw - 32px)); font-size: var(--text-md);
 
 
 
 
317
  }
318
+ .toast.show { opacity: 1; transform: translateY(0); }
319
+ @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
320
  </style>
321
  </head>
322
  <body>
323
  <div id="app">
324
+ <header class="topbar"><div class="in">
325
+ <a class="brand" href="#" id="home-link"><span class="logo">◆</span>Hy-Nomas <small>Live</small></a>
326
  <nav>
327
  <a href="https://huggingface.co/tencent/Hy-Nomas" target="_blank" rel="noopener">Model</a>
328
  <a href="https://github.com/Tencent-Hunyuan/Hy-Nomas" target="_blank" rel="noopener">Code</a>
329
+ <span class="status" id="slots"><span class="dot"></span><span>Checking GPUs…</span></span>
330
  </nav>
331
+ </div></header>
332
 
333
+ <main id="lobby" class="wrap">
334
+ <section class="prose">
335
+ <h1>Hy-Nomas Live: step into a generated world</h1>
336
+ <p>Describe a protagonist and a place. Tencent's Hy-Nomas renders the opening shot, then keeps the same world going turn by turn. Tell it what happens next, or take the camera and steer.</p>
337
+ <div class="links"><a href="https://huggingface.co/tencent/Hy-Nomas" target="_blank" rel="noopener">Model card</a><a href="https://github.com/Tencent-Hunyuan/Hy-Nomas" target="_blank" rel="noopener">GitHub</a><a href="https://huggingface.co/datasets/tencent/Hy-Nomas-Bench" target="_blank" rel="noopener">Hy-Nomas-Bench</a></div>
338
  </section>
339
 
340
  <section class="lobby-grid">
341
+ <div class="block labeled">
342
+ <span class="block-label">🖼 Examples · pick a world</span>
343
  <div class="worlds" id="worlds"></div>
344
  </div>
345
 
346
+ <form class="block composer" id="composer" autocomplete="off">
347
+ <label><span class="label-text row-between" style="display:flex">Protagonist <button type="button" class="btn sm neutral" id="dice" title="Surprise me">🎲 Surprise me</button></span>
348
+ <textarea class="input" id="subject" rows="2" placeholder="A small orange fox with a fluffy white-tipped tail" required></textarea></label>
349
+ <label><span class="label-text">World</span>
350
+ <textarea class="input" id="environment" rows="3" placeholder="A luminous night forest with mossy stone paths and drifting blue fireflies" required></textarea></label>
351
+ <div><span class="label-text">Camera</span>
352
+ <div class="radio" id="perspective">
353
+ <button type="button" data-v="third-person follow" aria-pressed="true">Follow</button>
354
+ <button type="button" data-v="first-person" aria-pressed="false">First person</button>
355
+ <button type="button" data-v="third-person observer" aria-pressed="false">Observer</button>
 
 
356
  </div>
357
  </div>
358
+ <details class="accordion">
359
+ <summary>Advanced settings</summary>
360
+ <div class="acc-body">
361
+ <div><span class="label-text">GPU session</span>
362
+ <div class="radio" id="length">
363
+ <button type="button" data-v="quick" aria-pressed="false">Quick <small>1 min</small></button>
364
+ <button type="button" data-v="standard" aria-pressed="true">Standard <small>1.5 min</small></button>
365
+ <button type="button" data-v="long" aria-pressed="false">Long <small>2.5 min</small></button>
366
  </div>
367
  </div>
368
+ <div><span class="label-text">Turn length</span>
369
+ <div class="radio" id="turnlen">
370
  <button type="button" data-v="3" aria-pressed="false">3s</button>
371
  <button type="button" data-v="4" aria-pressed="true">4s</button>
372
  <button type="button" data-v="5" aria-pressed="false">5s</button>
373
  <button type="button" data-v="6" aria-pressed="false">6s</button>
374
  </div>
375
  </div>
376
+ <div><span class="label-text">Denoising steps</span>
377
+ <div class="radio" id="steps">
378
+ <button type="button" data-v="4" aria-pressed="false">4 <small>fast</small></button>
379
+ <button type="button" data-v="6" aria-pressed="false">6</button>
380
+ <button type="button" data-v="8" aria-pressed="true">8 <small>best</small></button>
381
  </div>
382
  </div>
383
+ <label><span class="label-text">Seed <span class="info">(blank = random)</span></span><input class="input" type="number" id="seed" min="0" placeholder="random"></label>
384
  </div>
385
  </details>
386
+ <button class="btn primary" id="enter" type="submit">Enter world</button>
387
  <p class="fineprint">A live world holds a ZeroGPU for the whole session and uses your Hugging Face GPU quota. <a href="https://huggingface.co/login" target="_blank" rel="noopener">Log in</a> or go PRO for longer sessions.</p>
388
  </form>
389
  </section>
390
 
391
+ <section class="how">
392
+ <div class="block"><b>💬 Say</b>Type what happens next: weather, new characters, actions, a change of style. The world keeps its memory.</div>
393
+ <div class="block"><b>🎮 Move</b>Hold <kbd>W</kbd> <kbd>A</kbd> <kbd>S</kbd> <kbd>D</kbd> and the arrow keys (or drag) while the world plays. Your path steers the next shot.</div>
394
+ <div class="block"><b>↶ Rewind</b>Undo any turn you don't like and try a different direction. Download the whole journey as an MP4.</div>
395
  </section>
396
  </main>
397
 
398
+ <main id="stage" class="wrap hidden">
399
  <div class="stage-wrap">
400
  <div class="theater">
401
  <div class="stage-head">
402
+ <button class="btn sm neutral" id="leave" title="Leave this world">← Worlds</button>
403
+ <h2 id="world-title">World</h2>
404
  <span class="chip" id="world-persp">Follow</span>
405
  <div class="clock" id="clock" title="GPU time left in this session">
406
+ <svg viewBox="0 0 36 36"><circle class="track" cx="18" cy="18" r="15" fill="none" stroke-width="4"/><circle class="bar" id="clock-bar" cx="18" cy="18" r="15" fill="none" stroke-width="4" stroke-dasharray="94.25" stroke-dashoffset="0"/></svg>
407
  <div><b id="clock-text">--:--</b>GPU time left</div>
408
  </div>
409
  </div>
410
 
411
+ <div class="block player">
412
+ <div class="viewport" id="viewport">
413
+ <canvas id="ambient" width="104" height="60"></canvas>
414
+ <div class="screen" id="screenbox">
415
+ <canvas id="screen" width="832" height="480"></canvas>
416
+ <div class="ov badge-live hidden" id="live"><span class="dot"></span><span id="live-text">LIVE</span><button id="golive" class="hidden">Jump to live</button></div>
417
+ <div class="ov keyhud" id="keyhud">
418
+ <kbd class="gap"></kbd><kbd data-k="KeyW">W</kbd><kbd class="gap"></kbd>
419
+ <kbd data-k="KeyA">A</kbd><kbd data-k="KeyS">S</kbd><kbd data-k="KeyD">D</kbd>
420
+ <kbd class="gap"></kbd><kbd data-k="ArrowUp">↑</kbd><kbd class="gap"></kbd>
421
+ <kbd data-k="ArrowLeft">←</kbd><kbd data-k="ArrowDown">↓</kbd><kbd data-k="ArrowRight">→</kbd>
 
 
 
 
 
 
 
 
 
422
  </div>
423
+ <div class="ov forming" id="forming">
424
+ <div class="inner">
425
+ <h4 id="forming-title">Opening a world</h4>
426
+ <ol class="steps" id="steps-list">
427
+ <li data-s="gpu"><span class="ico"></span><span id="gpu-step">Reserving a GPU</span></li>
428
+ <li data-s="direct"><span class="ico"></span>Directing the opening shot</li>
429
+ <li data-s="render"><span class="ico"></span><span id="render-step">Rendering the first seconds</span></li>
430
+ </ol>
431
+ <div class="scene" id="forming-scene"></div>
432
+ </div>
433
+ </div>
434
+ <div class="ov turn-pill off" id="pill">
435
+ <span class="spinner"></span>
436
+ <span class="lbl" id="pill-text"></span>
437
+ <span class="meter" id="pill-meter"><i></i></span>
438
+ </div>
439
+ <div class="ov ended hidden" id="ended">
440
+ <div>
441
+ <h4 id="ended-title">Session complete</h4>
442
+ <p id="ended-text">Your GPU time for this world is up. Download the journey or open a new world.</p>
443
+ <div class="row">
444
+ <a class="btn primary" id="ended-dl" href="#" download>Download MP4</a>
445
+ <button class="btn neutral" id="ended-new">New world</button>
446
+ <button class="btn neutral" id="ended-watch">Watch replay</button>
447
+ </div>
448
  </div>
449
  </div>
450
  </div>
451
  </div>
452
+ <div class="transport">
453
+ <button class="btn sm neutral" id="play" title="Play / pause (space)" aria-label="Play or pause">❚❚</button>
454
+ <div class="timeline" id="timeline" role="slider" aria-label="Timeline" tabindex="0"><div class="playhead" id="playhead"></div></div>
455
+ <span class="tc" id="tc">0:00 / 0:00</span>
456
+ </div>
457
  </div>
458
 
459
+ <div class="block" id="dock">
460
+ <div class="tabs" role="tablist">
461
+ <button role="tab" id="tab-say" aria-selected="true">💬 Say</button>
462
+ <button role="tab" id="tab-move" aria-selected="false">🎮 Move</button>
 
 
 
 
 
 
 
 
463
  <span class="spacer"></span>
464
+ <div class="tools">
465
+ <button class="btn sm neutral" id="undo" title="Remove the last turn and try again">↶ Undo turn</button>
466
+ <a class="btn sm secondary" id="download" href="#" download title="Download the whole journey">⤓ MP4</a>
467
+ </div>
468
  </div>
469
  <div id="pane-say">
470
  <form class="say" id="say-form" autocomplete="off">
471
+ <input class="input" id="say" maxlength="400" placeholder="What happens next? e.g. “snow begins to fall”" aria-label="What happens next">
472
+ <button class="btn primary" id="say-send" type="submit">Send</button>
473
  </form>
474
+ <div class="examples"><span class="label-text">Examples</span><div class="chips" id="chips"></div></div>
475
  </div>
476
  <div id="pane-move" class="hidden">
477
  <div class="move">
478
  <canvas class="minimap" id="minimap" width="220" height="220"></canvas>
479
  <div class="move-info">
480
+ <div class="info">Hold <kbd>W</kbd><kbd>A</kbd><kbd>S</kbd><kbd>D</kbd> to move, <kbd>←</kbd><kbd>→</kbd><kbd>↑</kbd><kbd>↓</kbd> or drag the video to look. Recording starts on your first move and lasts one turn.</div>
481
  <div class="recbar"><i id="recbar"></i></div>
482
  <div class="recstate" id="recstate">Ready to record</div>
483
+ <div class="row">
484
+ <button class="btn sm primary" id="move-send" disabled>Send move</button>
485
+ <button class="btn sm neutral" id="move-clear">Reset</button>
486
  <label class="toggle"><input type="checkbox" id="autosend" checked> Send when recording ends</label>
487
  </div>
488
  </div>
 
495
  </div>
496
  </div>
497
 
498
+ <aside class="block notes labeled" aria-label="Director's notes">
499
+ <span class="block-label">🎬 Director's notes · <span id="notes-count">0 shots</span></span>
500
  <ol id="notes"></ol>
501
  </aside>
502
  </div>
 
646
 
647
  function posterStyle(w) {
648
  const [a, b, c] = w.colors;
649
+ return `background-image:url('assets/${w.id}.jpg?v=1'), linear-gradient(135deg, ${a}, ${b})`;
650
  }
651
  function renderWorlds() {
652
  els.worlds.innerHTML = "";
 
700
  turns: [], frames: [], bitmaps: new Map(), decoding: new Set(),
701
  pos: 0, playing: true, followLive: true, lastDrawn: -1,
702
  remaining: 0, remainingAt: 0, total: 0, ready: false, ended: false,
703
+ genStartedAt: 0, ratio: 2.6, mode: "say", firstFrames: false,
704
  };
705
 
706
  function resetStage() {
 
1080
  li.className = "note";
1081
  const busy = ["waiting", "directing", "queued", "generating"].includes(t.status);
1082
  const st = t.status === "ready" ? "st-ready" : t.status === "failed" ? "st-failed" : "st-busy";
1083
+ const label = { waiting: "waiting", directing: "directing", queued: "up next", generating: "rendering", ready: "ready", failed: "failed" }[t.status] || t.status;
1084
  li.innerHTML = `<div class="h"><span class="n"></span><span class="k"></span><span class="st ${st}">${label}</span></div><div class="you"></div><div class="dir"></div><div class="act"></div><div class="tm"></div>`;
1085
  li.querySelector(".n").textContent = t.id === 0 ? "OPENING" : `TURN ${t.id}`;
1086
  li.querySelector(".k").textContent = t.kind === "move" ? "🎮 camera" : t.kind === "say" ? "💬 you said" : "🌍 world";
 
1246
  els.moveSend.addEventListener("click", sendMove);
1247
  els.moveClear.addEventListener("click", resetRecording);
1248
 
1249
+ function css(name) { return getComputedStyle(document.documentElement).getPropertyValue(name).trim() || "#f59e0b"; }
1250
  function drawMinimap() {
1251
  const W = els.minimap.width, H = els.minimap.height;
1252
  mctx.clearRect(0, 0, W, H);
1253
+ mctx.strokeStyle = css("--border-color-primary"); mctx.lineWidth = 1;
1254
  for (let g = 0; g <= W; g += 22) { mctx.beginPath(); mctx.moveTo(g, 0); mctx.lineTo(g, H); mctx.stroke(); mctx.beginPath(); mctx.moveTo(0, g); mctx.lineTo(W, g); mctx.stroke(); }
1255
  const pts = REC.frames.map((f) => [f.position.x, f.position.z]);
1256
  const cur = [REC.pos[0], REC.pos[2]];
 
1261
  const cx = (minx + maxx) / 2, cz = (minz + maxz) / 2;
1262
  const tx = (x) => W / 2 + (x - cx) / span * W, tz = (z) => H / 2 + (z - cz) / span * H;
1263
  if (pts.length > 1) {
1264
+ mctx.strokeStyle = css("--color-accent"); mctx.lineWidth = 4; mctx.lineCap = "round"; mctx.lineJoin = "round";
 
 
1265
  mctx.beginPath(); mctx.moveTo(tx(pts[0][0]), tz(pts[0][1]));
1266
  for (const p of pts) mctx.lineTo(tx(p[0]), tz(p[1]));
1267
  mctx.stroke();
1268
  }
1269
  const x = tx(cur[0]), z = tz(cur[1]);
1270
  const a = -REC.yaw - Math.PI / 2;
1271
+ mctx.fillStyle = css("--primary-200");
1272
  mctx.beginPath(); mctx.moveTo(x, z); mctx.arc(x, z, 46, a - 0.5, a + 0.5); mctx.closePath(); mctx.fill();
1273
+ mctx.fillStyle = css("--primary-600");
1274
  mctx.beginPath(); mctx.arc(x, z, 6, 0, Math.PI * 2); mctx.fill();
1275
  }
1276
 
speedups.py ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import inspect
2
+ import textwrap
3
+
4
+ import torch
5
+ import torch.nn as nn
6
+
7
+ E4M3 = torch.float8_e4m3fn
8
+ E4M3_MAX = torch.finfo(E4M3).max
9
+
10
+
11
+ def fuse_int8_dequant():
12
+ from hymm.models.dit.modules import int8_stored_bf16_linear as w8
13
+
14
+ def dequant(weight_q, weight_scale, in_features: int):
15
+ scales = weight_scale.repeat_interleave(w8.GROUP_SIZE, dim=1)
16
+ return (weight_q.float() * scales[:, :in_features]).to(torch.bfloat16)
17
+
18
+ fused = torch.compile(dequant, dynamic=False, fullgraph=True)
19
+
20
+ def dequant_weight(self):
21
+ return fused(self.weight_q, self.weight_scale, self.in_features)
22
+
23
+ w8.Int8StoredBF16Linear.dequant_weight = dequant_weight
24
+
25
+
26
+ def keep_kv_archive_on_gpu():
27
+ import hymm.models.dit.modules.uniform_history_cache as uhc
28
+
29
+ edits = {
30
+ "commit_uniform_history": [
31
+ (
32
+ "segment[key].to(device='cpu', copy=True, non_blocking=False)",
33
+ "segment[key].to(device=current_k.device, copy=True, non_blocking=False)",
34
+ ),
35
+ (
36
+ "device='cpu', dtype=torch.bool, copy=True, non_blocking=False,",
37
+ "device=current_k.device, dtype=torch.bool, copy=True, non_blocking=False,",
38
+ ),
39
+ ],
40
+ "_rebuild_history": [
41
+ (
42
+ "packed[key].append(getattr(old, key).index_select(1, indices))",
43
+ "packed[key].append(getattr(old, key).index_select(1, indices.to(getattr(old, key).device)))",
44
+ ),
45
+ (
46
+ "packed_mask.append(old.mask.index_select(1, indices))",
47
+ "packed_mask.append(old.mask.index_select(1, indices.to(old.mask.device)))",
48
+ ),
49
+ ],
50
+ "prepare_history_rollback": [
51
+ (
52
+ "or record.mask.dtype != torch.bool or record.mask.device.type != 'cpu'):",
53
+ "or record.mask.dtype != torch.bool):",
54
+ ),
55
+ (
56
+ "or tensor.dtype != cache[key].dtype or tensor.device.type != 'cpu'):",
57
+ "or tensor.dtype != cache[key].dtype):",
58
+ ),
59
+ ],
60
+ }
61
+ for name, pairs in edits.items():
62
+ src = textwrap.dedent(inspect.getsource(getattr(uhc, name)))
63
+ for old, new in pairs:
64
+ if old not in src:
65
+ raise RuntimeError(f"history cache source changed: {name}")
66
+ src = src.replace(old, new)
67
+ scope = {}
68
+ exec(compile(src, f"<gpu_kv_archive:{name}>", "exec"), uhc.__dict__, scope)
69
+ setattr(uhc, name, scope[name])
70
+
71
+
72
+ def _quant_rows(x):
73
+ amax = x.abs().amax(dim=-1, keepdim=True).float().clamp(min=1e-12)
74
+ scale = amax / E4M3_MAX
75
+ return (x.float() / scale).clamp(-E4M3_MAX, E4M3_MAX).to(E4M3), scale
76
+
77
+
78
+ _quant_rows_compiled = torch.compile(_quant_rows, dynamic=True)
79
+
80
+
81
+ class FP8RowwiseLinear(nn.Module):
82
+ def __init__(self, linear: nn.Linear):
83
+ super().__init__()
84
+ self.in_features = linear.in_features
85
+ self.out_features = linear.out_features
86
+ q, s = _quant_rows(linear.weight.data)
87
+ self.register_buffer("weight_q", q.contiguous())
88
+ self.register_buffer("weight_scale", s.contiguous())
89
+ self.bias = linear.bias
90
+
91
+ def forward(self, x):
92
+ shape = x.shape
93
+ xq, sx = _quant_rows_compiled(x.reshape(-1, shape[-1]))
94
+ bias = None if self.bias is None else self.bias.to(torch.bfloat16)
95
+ y = torch._scaled_mm(
96
+ xq, self.weight_q.t(), scale_a=sx, scale_b=self.weight_scale.t(),
97
+ out_dtype=torch.bfloat16, bias=bias,
98
+ )
99
+ return y.reshape(*shape[:-1], self.out_features)
100
+
101
+
102
+ def quantize_decoder_fp8(decoder: nn.Module) -> int:
103
+ count = 0
104
+ for parent in list(decoder.modules()):
105
+ for name, child in list(parent.named_children()):
106
+ if (
107
+ isinstance(child, nn.Linear)
108
+ and child is not getattr(decoder, "embed", None)
109
+ and child.in_features >= 1024
110
+ and child.in_features % 16 == 0
111
+ and child.out_features % 16 == 0
112
+ ):
113
+ setattr(parent, name, FP8RowwiseLinear(child))
114
+ count += 1
115
+ return count