Spaces:
Running

File size: 63,024 Bytes
3ed011e
 
 
 
 
 
c8d47af
3ed011e
 
 
 
 
 
 
 
9dc23b7
3ed011e
 
 
 
 
 
 
c8d47af
3ed011e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="color-scheme" content="dark">
<title>oops</title>
<style>
:root{--bg:#101411;--surface:#1b211d;--line:#3c493e;--ink:#f4f5e9;--dim:#b6c1b3;--lime:#d3ff63;--pink:#ff948e;--purple:#d0b8ff;--red:#f16361;font-family:Arial,Helvetica,sans-serif;color:var(--ink);background:var(--bg);font-synthesis:none}*{box-sizing:border-box}body{margin:0}button,input{font:inherit}button{cursor:pointer}button:disabled{cursor:default;opacity:.4}button:focus-visible,input:focus-visible,a:focus-visible{outline:3px solid var(--purple);outline-offset:4px}button{border:1px solid var(--line);background:var(--surface);color:var(--ink);border-radius:8px;padding:12px 18px;font-weight:700}button:hover:not(:disabled){background:#2a342b}button.primary{background:var(--lime);color:#17200d;border-color:var(--lime)}button.primary:hover:not(:disabled){background:#e2ff97}.quiet{background:transparent;font-weight:400}.small{font-size:13px;padding:8px 11px}.danger{color:var(--pink)}a{color:var(--lime)}[hidden]{display:none!important}.shell{max-width:1520px;margin:auto;padding:20px 32px 28px}header{display:flex;align-items:center;justify-content:flex-end;gap:16px;border-bottom:1px solid var(--line);padding-bottom:16px}.brand{font-size:15px;font-weight:800;letter-spacing:.06em;display:flex;align-items:center;gap:9px}.brand b{display:inline-grid;place-items:center;background:var(--lime);color:#131b0e;width:29px;height:29px;font-family:monospace;font-size:19px}.header-controls{display:flex;align-items:center;gap:10px}.volume{display:flex;align-items:center;gap:7px;color:var(--dim);font-size:13px}.volume input{width:78px;accent-color:var(--lime)}.label{font:700 12px/1.4 monospace;letter-spacing:.13em;text-transform:uppercase;color:var(--lime)}h1,h2,h3,p{margin:0}.welcome{padding:48px 0 24px;display:grid;grid-template-columns:1.15fr 1fr;gap:58px;align-items:center;min-height:calc(100vh - 140px)}h1{font-family:Impact,'Arial Narrow',Arial,sans-serif;font-size:clamp(64px,7vw,108px);font-weight:900;line-height:.95;letter-spacing:-.025em;text-transform:uppercase;margin:18px 0 20px}h1 span{color:var(--lime)}.intro{font-size:21px;line-height:1.45;color:var(--dim);max-width:520px}.tagline{display:inline-block;font-family:Georgia,serif;font-style:italic;color:var(--pink);font-size:29px;margin:20px 0}.start-panel{margin-top:32px;max-width:560px}.team-inputs{display:flex;flex-direction:column;gap:9px;margin:12px 0}.team-input-row{display:flex;gap:8px}.team-input-row input{background:var(--surface);border:1px solid var(--line);border-radius:6px;color:var(--ink);padding:13px 14px;flex:1;min-width:0}.team-input-row button{width:42px;padding:0}.start-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:18px}.start-actions .primary{padding:16px 28px;font-size:19px}.rules-mini{font-size:14px;line-height:1.65;color:var(--dim);margin-top:20px}.welcome-art{position:relative;transform:rotate(2deg)}.welcome-art img{display:block;width:100%;aspect-ratio:16/10;object-fit:cover;border:1px solid var(--line);border-radius:12px;filter:saturate(.75)}.sticker{position:absolute;right:-5px;bottom:-17px;transform:rotate(-6deg);background:var(--pink);color:#27110e;font-family:Impact,'Arial Narrow',sans-serif;font-size:clamp(29px,3vw,45px);padding:15px 22px;box-shadow:5px 7px 0 #050806}.caption-tape{position:absolute;top:-12px;left:24px;background:var(--lime);color:#18220e;padding:8px 14px;font:700 13px monospace;transform:rotate(-4deg)}.welcome-art .pitch{font-size:15px;color:var(--dim);margin:38px 10px 0;transform:rotate(-2deg);max-width:450px;line-height:1.6}.round-heading{padding:22px 0 18px;display:flex;align-items:end;justify-content:space-between;gap:20px}.round-heading h2{font-family:Impact,'Arial Narrow',Arial,sans-serif;font-size:clamp(30px,3.2vw,48px);letter-spacing:.01em;font-weight:900;margin-top:7px}.round-counter{font:700 14px monospace;color:var(--dim);white-space:nowrap}.game-grid{display:grid;grid-template-columns:minmax(0,1.85fr) minmax(330px,1fr);gap:26px;align-items:start}.stage{position:relative;aspect-ratio:16/9;background:#000;overflow:hidden;border-radius:10px;border:1px solid var(--line)}video{width:100%;height:100%;object-fit:contain;display:block}.media-badge{position:absolute;left:14px;top:14px;font:700 12px monospace;letter-spacing:.06em;background:rgba(14,18,15,.85);padding:7px 10px;border-radius:3px;pointer-events:none}.punchline{position:absolute;bottom:20px;left:20px;right:20px;text-align:center;background:var(--lime);color:#111b08;padding:16px 20px;font-family:Impact,'Arial Narrow',Arial,sans-serif;font-size:clamp(25px,3vw,44px);line-height:1.06;transform:rotate(-1deg);box-shadow:4px 5px 0 rgba(0,0,0,.65);animation:pop .25s ease-out}.punchline small{font:700 12px monospace;display:block;letter-spacing:.1em;margin-bottom:7px}.transport{display:flex;justify-content:space-between;gap:10px;align-items:center;padding-top:13px;flex-wrap:wrap}.transport-left{display:flex;gap:8px}.source-line{font-size:12px;color:var(--dim);line-height:1.5;margin:13px 2px}.task{font-size:18px;color:var(--dim);line-height:1.5;margin:16px 2px}.aside{min-width:0}.phase-title{font-size:25px;font-weight:800;line-height:1.15;margin:4px 0 12px}.phase-copy{font-size:16px;line-height:1.6;color:var(--dim)}.watching{padding:24px 0}.thinking-dot{display:inline-block;width:9px;height:9px;background:var(--lime);border-radius:50%;margin-right:8px;animation:blink 1.2s infinite}.countdown{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}.countdown span:first-child{font-size:13px;letter-spacing:.06em;color:var(--dim);text-transform:uppercase}.timer{font:800 34px monospace;color:var(--lime)}.timer.expired{color:var(--pink)}.options{display:flex;flex-direction:column;gap:7px;margin:10px 0 22px}.option{display:flex;align-items:center;gap:13px;padding:11px 13px;border:1px solid var(--line);border-radius:7px;min-height:49px;font-size:16px;line-height:1.3}.option b{color:var(--lime);font:800 21px monospace;min-width:18px}.option.correct{border-color:var(--lime);background:#25331a}.team-pick{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center;padding:9px 0;border-top:1px solid var(--line)}.team-pick-name{font-size:14px;font-weight:700;overflow-wrap:anywhere}.pick-buttons{display:flex;gap:5px;align-items:center}.pick-buttons button{padding:7px 10px;font-size:14px;min-width:30px}.pick-buttons button[aria-pressed=true]{background:var(--purple);border-color:var(--purple);color:#221536}.full-width{width:100%;font-size:17px;padding:15px}.score-strip{display:flex;gap:18px;margin-top:23px;border-top:1px solid var(--line);padding:17px 0 0;flex-wrap:wrap}.score-item{font-size:13px;color:var(--dim);display:flex;gap:10px;align-items:center}.score-item b{color:var(--ink);font:700 22px monospace}.answer-letter{font:900 62px monospace;color:var(--lime);line-height:1}.answer-text{font-size:24px;font-weight:800;margin:8px 0 15px;line-height:1.25}.round-points{margin:20px 0}.points-row{display:flex;justify-content:space-between;gap:12px;border-top:1px solid var(--line);padding:12px 0;font-size:15px}.points-row b{color:var(--lime);white-space:nowrap}.points-row .zero{color:var(--dim)}.reply-line{font-family:Georgia,serif;font-style:italic;font-size:20px;line-height:1.45;color:var(--pink)}.error{padding:14px;background:#4d2321;color:#fff0ea;border-radius:6px;margin:12px 0}.foot{display:flex;justify-content:space-between;align-items:center;padding-top:22px;gap:15px;color:var(--dim);font:12px monospace}.foot button{border:0;padding:4px;color:var(--dim)}.results{max-width:860px;margin:40px auto;text-align:center}.results h2{font-family:Impact,'Arial Narrow',sans-serif;font-size:clamp(44px,6vw,82px);margin:18px 0;color:var(--lime);line-height:1}.results p{font-size:19px;line-height:1.6;color:var(--dim)}.leaderboard{margin:35px 0;text-align:left}.leader-row{display:flex;align-items:center;justify-content:space-between;padding:20px 0;border-top:1px solid var(--line);font-size:23px;gap:20px}.leader-row strong{color:var(--lime);font:800 35px monospace}.final-joke{font-family:Georgia,serif;font-style:italic;font-size:25px!important;color:var(--pink)!important;margin:28px 0}.result-actions{display:flex;gap:12px;justify-content:center}dialog{background:#19211b;color:var(--ink);border:1px solid #75856d;border-radius:14px;max-width:780px;width:calc(100% - 36px);max-height:85vh;padding:28px}dialog::backdrop{background:rgba(0,0,0,.8)}dialog h2{font-size:28px;margin:0 0 18px}dialog p{font-size:15px;line-height:1.6;margin:12px 0;color:var(--dim)}dialog ul{padding-left:20px;font-size:14px;line-height:1.6}dialog li{margin:14px 0}.dialog-close{float:right}.wobble{animation:wobble .35s ease-out}.music-meter{display:inline-flex;align-items:center;gap:2px;height:13px;margin-right:6px}.music-meter i{display:block;width:3px;height:9px;background:var(--lime);animation:meter .65s ease-in-out infinite alternate}.music-meter i:nth-child(2){animation-delay:.2s}.music-meter i:nth-child(3){animation-delay:.4s}@keyframes meter{to{height:3px}}@keyframes pop{from{transform:scale(.9) rotate(-3deg);opacity:0}to{transform:scale(1) rotate(-1deg);opacity:1}}@keyframes blink{50%{opacity:.25}}@keyframes wobble{25%{transform:translateX(-4px)}75%{transform:translateX(3px)}}@media(min-width:1600px){.shell{padding-top:26px}.game-grid{gap:36px}.option{font-size:18px;min-height:57px}.phase-title{font-size:29px}}@media(max-width:1050px){.shell{padding:16px 20px}.welcome{gap:28px}.game-grid{grid-template-columns:minmax(0,1.4fr) minmax(300px,1fr);gap:18px}.option{font-size:14px;padding:9px}.team-pick{grid-template-columns:1fr}.round-heading h2{font-size:33px}.volume{display:none}}@media(max-width:760px){.shell{padding:14px}.brand{font-size:12px}.header-controls{gap:6px}.header-controls button{font-size:12px;padding:9px}.welcome{grid-template-columns:1fr;padding-top:26px;gap:24px;min-height:0}.welcome-art{max-width:520px;margin:15px 8px 30px}.welcome-art .pitch{display:none}h1{font-size:64px}.intro{font-size:18px}.game-grid{grid-template-columns:1fr}.round-heading{padding:17px 0 12px}.round-heading h2{font-size:32px}.task{font-size:15px;margin:10px 2px}.watching{padding:10px 0}.score-strip{margin-top:15px}.team-pick{grid-template-columns:minmax(0,1fr) auto}.foot{font-size:10px}.punchline{bottom:10px;left:10px;right:10px;padding:12px;font-size:27px}.punchline small{font-size:9px}.leader-row{font-size:18px}.volume{display:none}}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important}}
@media(min-width:761px) and (max-height:850px){.welcome{padding-top:28px;padding-bottom:12px}.welcome h1{font-size:80px;margin:12px 0 16px}.welcome .tagline{margin:14px 0;font-size:25px}.start-panel{margin-top:20px}.team-input-row input{padding:10px 13px}.start-actions{margin-top:12px}.start-actions .primary{padding:13px 24px}.rules-mini{margin-top:14px}.shell{padding-top:12px;padding-bottom:12px}header{padding-bottom:10px}.round-heading{padding:12px 0}.round-heading h2{font-size:34px}.stage{max-height:calc(100vh - 315px)}.phase-title{font-size:21px;margin:3px 0 8px}.countdown{margin-bottom:6px}.timer{font-size:28px}.options{gap:5px;margin:8px 0 14px}.option{font-size:14px;padding:7px 11px;min-height:38px}.team-pick{padding:6px 0}.full-width{padding:12px;font-size:16px}.task{font-size:16px;margin:10px 2px}.source-line{margin:8px 2px}.score-strip{margin-top:12px;padding-top:12px}.foot{padding-top:14px}.transport{padding-top:10px}.answer-text{font-size:22px}.round-points{margin:12px 0}.points-row{padding:9px 0}}
.result-actions{flex-wrap:wrap}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.media-badge:empty{display:none}
.skip{flex-shrink:0;border-color:var(--dim);white-space:nowrap}.round-heading>div{min-width:0}@media(max-width:760px){.skip{font-size:13px;padding:10px}.round-heading{gap:12px}}
.stage.creator-mark-left .media-badge{left:auto;right:14px}
.clip-loading{position:absolute;inset:0;display:grid;place-items:center;background:rgba(0,0,0,.45);font-weight:700;color:var(--ink)}
.welcome h1 {text-transform:none}
</style>
</head>
<body>
<div class="shell">
<header><div class="header-controls"><label class="volume">Music <input id="volume" type="range" min="0" max="100" value="48" aria-label="Music volume"></label><button id="sound" class="small quiet" aria-pressed="true">♫ Sound on</button><button id="fullscreen" class="small quiet">Full screen</button></div></header><p id="sound-warning" class="error" role="status" hidden></p>

<section id="welcome" class="welcome">
 <div><h1><span>oops</span></h1><p class="intro">Guess what goes wrong next.</p><div class="tagline">“It worked in sim”</div>
 <div class="start-panel"><label class="label" for="team-0">Teams</label><div class="team-inputs" id="team-inputs"></div><button id="add-team" class="small quiet">+ Add a team</button><div class="start-actions"><button id="start" class="primary">Play ♫</button><button id="rules-open" class="quiet">How to play</button></div><p class="rules-mini" id="welcome-rules"></p><p class="error" id="start-error" hidden role="alert"></p></div></div>
 <div class="welcome-art"><img id="hero-image" alt="A robot moments before a mishap"><div class="sticker">WHAT COULD GO WRONG?</div></div>
</section>

<section id="game" hidden>
 <div class="round-heading"><div><div class="label" id="round-label">Round 01</div><h2 id="round-title"></h2></div><button id="skip" class="skip quiet" type="button">Skip round →</button></div>
 <div class="game-grid"><div><div class="stage" id="stage"><video id="video" playsinline muted preload="auto" aria-label="Robot failure clip"></video><div id="clip-loading" class="clip-loading" hidden role="status">Loading clip…</div><div class="media-badge" id="media-badge">THE SETUP</div><div class="punchline" id="punchline" hidden></div></div><div class="transport"><div class="transport-left"><button id="play-pause" class="small">Pause clip</button><button id="replay-setup" class="small quiet" hidden>Watch again</button><button id="replay-fail" class="small quiet" hidden>Replay</button><button id="slowmo" class="small quiet" hidden>Slow-mo</button></div><span class="sr-only" id="media-status" role="status" aria-live="polite">Loading</span></div><p class="task" id="task"></p><p class="source-line" id="source-line"></p><div class="error" id="media-error" hidden role="alert"></div></div>
 <aside class="aside"><div id="watching" class="watching"><div class="phase-title"><span class="thinking-dot"></span>Watch closely…</div></div>
 <div id="predict" hidden><div class="countdown"><span>Make your pick</span><strong id="timer" class="timer">30</strong></div><div id="question" class="phase-title"></div><div class="options" id="options"></div><div id="team-picks"></div><button id="lock" class="primary full-width" disabled>Reveal</button></div>
 <div id="revealing" class="watching" hidden><div class="phase-title">Let’s see…</div></div>
 <div id="round-result" hidden><div class="answer-letter" id="answer-letter"></div><p class="answer-text" id="answer-text"></p><div class="round-points" id="round-points"></div><button id="next" class="primary full-width">Next clip</button></div>
 </aside></div><div class="score-strip" id="scores"></div>
</section>

<section id="results" class="results" hidden><div class="label">Final scores</div><h2 id="winner-title">You predicted the chaos</h2><p id="winner-copy"></p><div class="leaderboard" id="leaderboard"></div><div class="result-actions"><button id="restart" class="primary">Play again</button><button id="credits-end" class="quiet">Clips & credits</button></div></section>

<footer class="foot"><span id="foot-copy"></span><button id="credits-open" class="quiet">Clips & credits</button></footer>
</div>
<dialog id="rules"><button class="dialog-close quiet" data-close="rules">Close</button><h2>How to play</h2><p>Watch until the clip pauses, then give each team 30 seconds to pick A, B, C or D. The host enters the guesses and hits Reveal.</p><p>A correct guess earns <strong>2 points</strong>. Skip a round to move on without awarding points.</p><p>Highest score wins. Ties count as a shared win.</p></dialog>
<dialog id="credits"><button class="dialog-close quiet" data-close="credits">Close</button><h2>Clips & credits</h2><ul id="credit-list"></ul><p>Original game music and captions. Source audio is muted.</p></dialog>

<script id="round-data" type="application/json">[{"id":"invisible-dish","title":"Doing the dishes","task":"Pick up the plate. Wash it with the sponge.","question":"What gets washed?","options":["The counter.","Its own gripper.","An imaginary plate.","The whole plate rack."],"answerIndex":2,"answer":"An imaginary plate. The real one stays in the rack.","punchline":"The plate is still dirty. The air is spotless.","sourceTitle":"Universal Manipulation Interface","sourceUrl":"https://umi-gripper.github.io/","classification":"Autonomous ResNet baseline evaluation failure. Source speed unlabeled.","shortCredit":"UMI · policy evaluation","videoUrl":"https://umi-gripper.github.io/videos/comparison_dish_resnet.mp4","start":0.4,"pause":2.6,"end":11.2,"setup":{"bundle":"media/invisible-dish-setup.5ec37facefbc.clip.js","key":"5ec37facefbc7a94929a79502417983fb3e0441e0a3582004cef329d7814f69b"},"reveal":{"bundle":"media/invisible-dish-reveal.efee0915eef7.clip.js","key":"efee0915eef70575d2dff5eb5dd388c7af171a6a4fafa9420593859406a02c31"},"poster":"media/invisible-dish-poster.394628b02ff0.jpg"},{"id":"flying-pot","title":"Yes, chef","task":"Move the pot from the sink to the stove.","question":"What happens next?","options":["Drops the pot, then carries on empty-handed.","Puts the pot upside down on the burner.","Dunks the pot back into the sink.","Drags the pot sideways across the counter."],"answerIndex":0,"answer":"Drops the pot. Continues the delivery anyway.","punchline":"Soup of the day: floor.","sourceTitle":"REFLECT / RoboFail","sourceUrl":"https://robot-reflect.github.io/","classification":"Teleoperated failure demonstration for RoboFail, not an autonomous policy trial. Source at 4×; camera view cropped to remove outcome annotations.","shortCredit":"RoboFail · teleoperated failure demo","videoUrl":"https://robot-reflect.github.io/videos/boilWater4.mov","cropFilter":"crop=980:540:22:68","start":35,"pause":38.5,"end":43,"setup":{"bundle":"media/flying-pot-setup.57a53a8d6353.clip.js","key":"57a53a8d635342a0b0dd7bb874a4965923ef53f2830989e8608085a5383218b4"},"reveal":{"bundle":"media/flying-pot-reveal.3882d8c03ca6.clip.js","key":"3882d8c03ca67d12e1734e3a117420a4b15a598dd0e7c01a362d27638f55aae4"},"poster":"media/flying-pot-poster.c794f25aaa48.jpg"},{"id":"curb-step","title":"One small step","task":"Walk down from the pavement.","question":"How does it handle the step down?","options":["Hops down on all four feet.","Takes one step, then faceplants.","Stops at the edge and backs away.","Turns around and takes the long way."],"answerIndex":1,"answer":"One foot down. Then the rest of the robot.","punchline":"Please use the ramp.","sourceTitle":"Learning Vision-Guided Quadrupedal Locomotion End-to-End with Cross-Modal Transformers","sourceUrl":"https://vision-locomotion.github.io/","classification":"Real learned-policy evaluation failure. The research page attributes the fall to a large drop whose extent is not visible to the front camera. Source speed unlabeled.","shortCredit":"Vision-Guided Locomotion · policy evaluation","videoUrl":"https://blindsupp.github.io/visual-walking/resources/failure/failure_curb.mp4","start":0.1,"pause":2.7,"end":4.05,"setup":{"bundle":"media/curb-step-setup.a09f6d24f3db.clip.js","key":"a09f6d24f3db155a1a7287f4ef0352ccc4e943b4ac03760d26408982eb0822e9"},"reveal":{"bundle":"media/curb-step-reveal.09cf4c59ce47.clip.js","key":"09cf4c59ce47280b13378f9b867145c9a66ab3844caeff9c25d0798e8713bffb"},"poster":"media/curb-step-poster.f9c718583d6d.jpg"},{"id":"self-toss","title":"Go fetch","task":"Throw the tennis ball.","question":"What else gets thrown?","options":["The gripper releases the ball straight down.","The arm flings the ball into its own body.","The entire robot somersaults onto its back.","The robot tips sideways without letting go."],"answerIndex":2,"answer":"The ball flies. Then the robot tumbles onto its back.","punchline":"Not you. NOT YOU.","sourceTitle":"UMI on Legs: failure montage","sourceUrl":"https://umi-on-legs.github.io/","classification":"Whole-body manipulation research failure, cropped to the original montage's bottom-right panel. Exact controller state and source speed unlabeled.","shortCredit":"UMI on Legs · research failure","videoUrl":"https://umi-on-legs.github.io/static/videos/failures-small.mp4","cropFilter":"crop=iw/2:ih/2:iw/2:ih/2","start":16,"pause":18,"end":26.5,"setup":{"bundle":"media/self-toss-setup.611eec700ede.clip.js","key":"611eec700eded2292c6043632b3b51875a601d2919bc37118e9e8aabe6e5eb6a"},"reveal":{"bundle":"media/self-toss-reveal.e1000e2fbd17.clip.js","key":"e1000e2fbd17606e2bcaef4d46acd0a4ca7515f379b793c070290c35c569ab41"},"poster":"media/self-toss-poster.fe7075364478.jpg"},{"id":"digit-break","title":"One last bin","task":"Move the bin to the conveyor.","question":"How does this shift end?","options":["Carries the bin to the conveyor.","Drops the bin but stays upright.","Crumples onto the floor with the bin.","Turns to wave at the crowd."],"answerIndex":2,"answer":"Digit crumples onto the floor, taking the bin with it.","punchline":"Break time.","sourceTitle":"Agility Robotics: Digit at ProMat 2023","sourceUrl":"https://www.linkedin.com/posts/agilityrobotics_promat2023-activity-7050148324401692673-Ut8w","classification":"Manufacturer footage of a live bin-handling demonstration failure at ProMat 2023. The visible collapse does not establish its technical cause.","shortCredit":"Agility Robotics · ProMat demo","sourceExcerpt":true,"start":10.4,"pause":12.4,"end":15.5,"setup":{"bundle":"media/digit-break-setup.ef8c61b03fc0.clip.js","key":"ef8c61b03fc084db8dda3b0bdb5ad846b0ec377b212f902504e3a1c3da5f8abf"},"reveal":{"bundle":"media/digit-break-reveal.b4137ff4977a.clip.js","key":"b4137ff4977aff8476d55ed60ca8ad75e734cb51985df648b98b24da8d4d8ece"},"poster":"media/digit-break-poster.6354b0fee5e6.jpg"},{"id":"aidol-debut","title":"A grand entrance","task":"Walk onstage. Wave to the audience.","question":"How does the debut go?","options":["Keeps walking straight off the stage.","Sits down on the edge of the stage.","Freezes upright with one arm raised.","Faceplants as the staff rush in."],"answerIndex":3,"answer":"It pitches forward. The staff rush in to catch it.","punchline":"A standing ovation felt insensitive.","sourceTitle":"The National / Moscow News Agency: AIDOL debut","sourceUrl":"https://www.thenationalnews.com/video/JxNPpnEs/russian-robot-stumbles-on-debut-appearance/","classification":"Live stage demonstration failure. The National carries Moscow News Agency footage; both watermarks are retained. The precise technical cause is unconfirmed.","shortCredit":"The National / Moscow News Agency · AIDOL debut","sourceExcerpt":true,"start":21.2,"pause":23.7,"end":26.3,"setup":{"bundle":"media/aidol-debut-setup.0bcd9141f153.clip.js","key":"0bcd9141f1539155af18844f63ca774cc529d71ac67ba9e4294436e976176994"},"reveal":{"bundle":"media/aidol-debut-reveal.8d11dc85e96c.clip.js","key":"8d11dc85e96cdf215cbdd4bd07bedf73c81bba7ca81d3e815e62ea00fe1a5e85"},"poster":"media/aidol-debut-poster.e822c9fc42ba.jpg"},{"id":"controller-kick","title":"A quick demo","task":"The robot is practising kicks beside its handler.","question":"What happens next?","options":["The robot kicks its own foot into the desk.","The controller gets kicked out of the handler’s hand.","The handler trips over the robot’s leg.","The robot’s foot knocks over the chair."],"answerIndex":1,"answer":"The hand-held controller gets kicked across the room.","punchline":"So much for being in control.","sourceTitle":"IHA News: Robot Kicks Developer During China Demo","sourceUrl":"https://iha.news/robot-kicks-developer-during-china-demo/","classification":"Reported accidental contact during a motion demonstration. The visible strike knocks a controller from the handler’s hand; a body strike, robot model, autonomy, and technical cause are not established.","shortCredit":"IHA News · demo mishap","videoUrl":"https://iha.news/wp-content/uploads/2026/09/iha-auto-draft-2026-09-17_09-27-41_957713.mp4","start":0.5,"pause":1.3,"end":5.6,"setup":{"bundle":"media/controller-kick-setup.0074d3238dfe.clip.js","key":"0074d3238dfed75d47bbf3c292f4a6a5f682d47acbc930d7ba747f0fbd594189"},"reveal":{"bundle":"media/controller-kick-reveal.8ccd1acef793.clip.js","key":"8ccd1acef79368239efb5e9fc972a5f0a0e8e0c83afa4548fd1916184f952a54"},"poster":"media/controller-kick-poster.a7a0aea280ee.jpg"},{"id":"motion-copy","title":"Copy me","task":"The robot mirrors the operator’s movements.","question":"What happens next?","options":["It kicks him, then copies him doubling over.","It spins too far and falls flat on its face.","It knocks the camera over with a kick.","It grabs his arm and drags him sideways."],"answerIndex":0,"answer":"It kicks the operator, then copies him doubling over.","punchline":"Apparently that move was contagious.","sourceTitle":"zeonsunlight / 人工智障开发专业户","sourceUrl":"https://www.bilibili.com/video/BV1FNBDBiEM3/","classification":"Reported accidental contact during a motion-copying experiment. The precise control fault is unconfirmed. A short excerpt from the original creator’s video, with the watermark retained.","shortCredit":"zeonsunlight · motion-copying mishap","sourceExcerpt":true,"start":9,"pause":12.6,"end":16.6,"setup":{"bundle":"media/motion-copy-setup.5c14a8cea07c.clip.js","key":"5c14a8cea07ca622544addceb71938a28c0c678747e9d9a59a1e4b5675753535"},"reveal":{"bundle":"media/motion-copy-reveal.606cc33ea8da.clip.js","key":"606cc33ea8dab7b71357c4f27d0a81f0f0cd1242237ee04b2ba3ec92381961c9"},"poster":"media/motion-copy-poster.9fc9b2c50b31.jpg"},{"id":"atlas-cartwheel","title":"Stick the landing","task":"Atlas lines up a cartwheel.","question":"How does the landing go?","options":["It lands sitting up and waves.","It falls onto its shoulder, legs still pedalling.","It slides headfirst into the crash mat.","One hand snaps off mid-cartwheel."],"answerIndex":1,"answer":"Onto its shoulder. The legs keep going.","punchline":"Nailed the floor.","sourceTitle":"Boston Dynamics / RAI Institute: Atlas Airborne","sourceUrl":"https://bostondynamics.com/video/atlas-airborne-boston-dynamics-rai-institute/","classification":"Manufacturer-published research robot trial failure in the Atlas Airborne blooper reel. The source sequence is in slow motion; precise control cause unconfirmed.","shortCredit":"Boston Dynamics / RAI Institute · research blooper","videoUrl":"https://embed-ssl.wistia.com/deliveries/07f2a78a225005341f5268d65e32cb82e88c7668.bin","start":38.7,"pause":39.65,"end":44.2,"sourceExcerpt":true,"setup":{"bundle":"media/atlas-cartwheel-setup.24ace3e0a7f0.clip.js","key":"24ace3e0a7f00e0feeb2395f088f04d0fea66e5a7eae5edc56cb9cdb4bc3d426"},"reveal":{"bundle":"media/atlas-cartwheel-reveal.8349393c9e91.clip.js","key":"8349393c9e91ffc23886cab51224aa329397aa2a92e02419f0a6d6ba19b46598"},"poster":"media/atlas-cartwheel-poster.e4344c6e2a78.jpg"},{"id":"ted-trolley","title":"First day on the job","task":"Put the box on the shelf.","question":"How does the delivery go?","options":["Drops the box, pulls the trolley over, then falls too.","Shoves every box off the shelf but stays upright.","Turns around and marches away with the box.","Throws the box over the shelf."],"answerIndex":0,"answer":"The box goes down. The trolley goes down. Then the robot.","punchline":"Probation did not go well.","sourceTitle":"Boston Dynamics / Marc Raibert at TED2017","sourceUrl":"https://www.ted.com/talks/marc_raibert_meet_spot_the_robot_dog_that_can_run_hop_and_open_doors","classification":"Real Boston Dynamics Atlas manipulation-test outtake shown by founder Marc Raibert in his TED2017 talk. The precise control failure is not established.","shortCredit":"Boston Dynamics / TED · manipulation test","sourceExcerpt":true,"start":319.85,"pause":321.35,"end":332.6,"setup":{"bundle":"media/ted-trolley-setup.62f11ca01021.clip.js","key":"62f11ca0102199752c74b0c548fdbb476e3b4acb177dc10521b6b9058e10a712"},"reveal":{"bundle":"media/ted-trolley-reveal.482f4d548493.clip.js","key":"482f4d54849359b06a11fa03247c24f049a3f6877f42c23c8b441d6fd8407cb1"},"poster":"media/ted-trolley-poster.b77de8726149.jpg"},{"id":"derek-rig","title":"Just stand there","task":"The handler tries to steady the robot’s frame.","question":"What gets knocked over?","options":["The white frame holding the robot.","The handler.","The black stand beside the robot.","The table behind the robot."],"answerIndex":2,"answer":"The black stand goes down. The handler puts his hands on his head.","punchline":"Nobody touch anything else.","sourceTitle":"Cix Liv / REK: DeREK testing mishap","sourceUrl":"https://x.com/cixliv/status/1946648610940367008","classification":"Original creator footage of a robot testing mishap, published July 19, 2025. The suspended robot flails and knocks over the black stand next to it; it remains supported by the white frame. Precise technical cause is unconfirmed. Crop retains the REK watermark.","shortCredit":"Cix Liv / REK · testing mishap","videoUrl":"https://video.twimg.com/amplify_video/1946647066626699266/vid/avc1/1200x1000/qc4wG0RW2q2C0vgI.mp4","cropFilter":"crop=1000:670:200:330","start":6.2,"pause":8.5,"end":16.5,"sourceExcerpt":true,"setup":{"bundle":"media/derek-rig-setup.711ab43a8283.clip.js","key":"711ab43a8283ba1aa02d7f8928069147e19d2541465caf1389269fcdcf3eccb5"},"reveal":{"bundle":"media/derek-rig-reveal.23952e460999.clip.js","key":"23952e460999b7c7ec241f948ba639d00f0eab39a858b802f60759e3e0c8afd5"},"poster":"media/derek-rig-poster.d3d1d81206f8.jpg"},{"id":"lab-thrash","title":"Personal space","task":"Two handlers check a robot hanging from a stand.","question":"How does the test go?","options":["It drops straight to the floor.","It gives the seated handler a gentle wave.","It flails, drags the stand, and sends the handlers running.","It folds its arms and stays still."],"answerIndex":2,"answer":"It windmills its arms, drags the stand, and sends both handlers scrambling.","punchline":"Stand back. Further.","sourceTitle":"Jam Press / New York Post: humanoid test mishap","sourceUrl":"https://nypost.com/2025/05/05/tech/violent-humanoid-robot-snaps-attacks-factory-workers-video/","classification":"Reported factory or lab testing mishap, carried by New York Post with Jam Press credit. A suspended humanoid flails beside two handlers. Exact model, operating mode, date of filming, and technical cause are not independently established. No intentional attack is claimed. Source speed unlabeled.","shortCredit":"Jam Press / New York Post · test mishap","sourceExcerpt":true,"start":7.5,"pause":10.3,"end":21.7,"setup":{"bundle":"media/lab-thrash-setup.cdd9a3f2b5a1.clip.js","key":"cdd9a3f2b5a195e75ef02ec06195e4d3e7004b15bbba6498b53b0efe6526a10f"},"reveal":{"bundle":"media/lab-thrash-reveal.05a25f6d40ec.clip.js","key":"05a25f6d40ecf79764b5967ef5b5f69438f14d60ddd1af40fb6a483016ea864a"},"poster":"media/lab-thrash-poster.9f37f7f382a3.jpg"},{"id":"dinner-show","title":"Dinner and a show","task":"A robot dances beside a table at a hotpot restaurant.","question":"What does it add to dinner?","options":["It bows, then sits at the table.","It smacks the table and keeps dancing as an employee grabs it.","It pulls out a chair for a customer.","It trips over a chair and stays down."],"answerIndex":1,"answer":"It smacks the table, then keeps dancing while an employee tries to restrain it.","punchline":"The apron says “I’M GOOD.”","sourceTitle":"ABC News / @Meooow via Storyful: dancing robot in Cupertino","sourceUrl":"https://abcnews.com/video/131217687/","classification":"Restaurant dance demonstration mishap, not autonomous aggression. ABC7 reported that employees attributed it to accidentally selecting a high-energy routine. Source footage by @Meooow via Storyful, carried by ABC News; visible credits retained. Source speed unlabeled.","shortCredit":"@Meooow / Storyful / ABC News · restaurant demo","sourceExcerpt":true,"start":65.5,"pause":69.0,"end":78.3,"setup":{"bundle":"media/dinner-show-setup.963bfc5968ca.clip.js","key":"963bfc5968ca29a25e2f150f2a224111328fcf276131d5b824404a4575415d5a"},"reveal":{"bundle":"media/dinner-show-reveal.3f4fe7e05a26.clip.js","key":"3f4fe7e05a26f956031103511a4bcaffc0b12c7d8592e7c5fd3926b635e9cfd0"},"poster":"media/dinner-show-poster.8df578de0a90.jpg"}]</script>
<script>/* Original synthesized score. Render once, then loop on the audio thread. */
(function installGameAudio(global) {
  'use strict';

  const BPM = 116;
  const MODES = new Set(['idle', 'setup', 'think', 'reveal', 'results']);
  // Eight original bars. Events are [swung eighth-note position, MIDI, length].
  const MELODY = [
    [[0,76,3],[3,79,1],[4,84,1],[5,83,1],[6,81,2]],
    [[0,85,1],[1,88,1],[2,85,2],[4,83,1],[5,81,1],[6,79,2]],
    [[0,77,3],[3,81,1],[4,84,2],[6,81,1],[7,77,1]],
    [[0,74,1],[1,79,1],[2,83,2],[4,81,1],[5,79,1],[6,77,2]],
    [[0,76,1],[1,80,1],[2,83,2],[4,86,1],[5,83,1],[6,80,2]],
    [[0,84,3],[3,88,1],[4,81,1],[5,79,1],[6,76,2]],
    [[0,78,1],[1,81,1],[2,84,2],[4,86,1],[5,84,1],[6,81,2]],
    [[0,83,2],[2,81,1],[3,77,1],[4,74,2],[6,79,2]],
  ];
  const HARMONY = [
    {root:36,fifth:43,keys:[60,64,67,69]},
    {root:33,fifth:40,keys:[61,64,67,69]},
    {root:38,fifth:45,keys:[60,62,65,69]},
    {root:31,fifth:38,keys:[59,62,65,67]},
    {root:40,fifth:47,keys:[59,62,64,68]},
    {root:33,fifth:40,keys:[60,64,67,69]},
    {root:38,fifth:45,keys:[60,62,66,69]},
    {root:31,fifth:38,keys:[59,62,65,67]},
  ];
  const hz = midi => 440 * Math.pow(2, (midi - 69) / 12);
  const clamp = (value, low, high) => Math.max(low, Math.min(high, value));
  let context = null, master = null, musicBus = null, fxBus = null;
  let score = null, rendering = null, loop = null, loopStarted = 0;
  let volume = 0.48, muted = false, mode = 'idle', initialized = false, error = '';
  let duckUntil = 0, recovering = false;
  const effects = new Set();

  function ramp(parameter, target, seconds = 0.035) {
    const now = context.currentTime;
    if (typeof parameter.cancelAndHoldAtTime === 'function') parameter.cancelAndHoldAtTime(now);
    else {
      const current = parameter.value;
      parameter.cancelScheduledValues(now);
      parameter.setValueAtTime(current, now);
    }
    parameter.linearRampToValueAtTime(target, now + seconds);
  }

  function voice(ctx, bus, time, duration, peak, live = false) {
    const gain = ctx.createGain();
    gain.gain.setValueAtTime(0, time);
    gain.gain.linearRampToValueAtTime(peak, time + 0.008);
    gain.gain.exponentialRampToValueAtTime(Math.max(0.0001, peak * 0.12), time + duration * 0.68);
    gain.gain.exponentialRampToValueAtTime(0.0001, time + duration);
    gain.gain.setValueAtTime(0, time + duration + 0.015);
    gain.connect(bus);
    const part = {ctx, gain, nodes:[gain], sources:[], pending:0, live};
    if (live) effects.add(part);
    return part;
  }

  function register(part, source) {
    part.sources.push(source);
    if (!part.live) return;
    part.pending++;
    source.onended = () => {
      part.pending--;
      if (part.pending) return;
      part.nodes.forEach(node => { try { node.disconnect(); } catch (_) {} });
      effects.delete(part);
    };
  }

  function osc(part, type, frequency, time, duration, level = 1, detune = 0, destination = part.gain) {
    const source = part.ctx.createOscillator(), gain = part.ctx.createGain();
    source.type = type;
    source.frequency.setValueAtTime(frequency, time);
    source.detune.setValueAtTime(detune, time);
    gain.gain.value = level;
    source.connect(gain);
    gain.connect(destination);
    part.nodes.push(source, gain);
    register(part, source);
    source.start(time);
    source.stop(time + duration + 0.03);
    return source;
  }

  function piano(ctx, bus, midi, time, length, strength, live = false) {
    const duration = clamp(length, 0.14, 0.95), frequency = hz(midi);
    const part = voice(ctx, bus, time, duration, 0.12 * strength, live);
    osc(part, 'sine', frequency, time, duration, 0.47, -5);
    osc(part, 'triangle', frequency, time, duration, 0.33, 5);
    osc(part, 'sine', frequency * 2.005, time, duration * 0.5, 0.12);
    osc(part, 'sine', frequency * 3.01, time, duration * 0.27, 0.045);
  }

  function tuba(ctx, bus, midi, time, length, strength, bend = false, live = false) {
    const duration = Math.max(0.14, length), frequency = hz(midi);
    const part = voice(ctx, bus, time, duration, 0.13 * strength, live);
    const filter = ctx.createBiquadFilter();
    filter.type = 'lowpass';
    filter.frequency.setValueAtTime(bend ? 1500 : 580, time);
    filter.frequency.exponentialRampToValueAtTime(bend ? 370 : 320, time + duration);
    filter.Q.value = 0.55;
    filter.connect(part.gain);
    part.nodes.push(filter);
    const reed = osc(part, 'sawtooth', frequency, time, duration, 0.3, 0, filter);
    const body = osc(part, 'triangle', frequency, time, duration, 0.72, -2, filter);
    if (bend) {
      reed.frequency.exponentialRampToValueAtTime(frequency * 0.89, time + duration * 0.92);
      body.frequency.exponentialRampToValueAtTime(frequency * 0.89, time + duration * 0.92);
    }
  }

  function brush(ctx, bus, noise, time, offset, strength) {
    const part = voice(ctx, bus, time, 0.052, 0.055 * strength);
    const source = ctx.createBufferSource(), filter = ctx.createBiquadFilter();
    source.buffer = noise;
    filter.type = 'highpass';
    filter.frequency.value = 4800;
    source.connect(filter);
    filter.connect(part.gain);
    source.start(time, offset);
    source.stop(time + 0.06);
  }

  function tick(ctx, bus, time) {
    const part = voice(ctx, bus, time, 0.032, 0.039 * 0.65);
    const tone = osc(part, 'sine', 950, time, 0.032, 0.65);
    tone.frequency.exponentialRampToValueAtTime(430, time + 0.03);
    osc(part, 'sine', 1610, time, 0.018, 0.15);
  }

  function eighths(start, count) {
    let seconds = 0;
    for (let i = 0; i < count; i++) seconds += (60 / BPM) * ((start + i) % 2 ? 0.38 : 0.62);
    return seconds;
  }

  async function renderScore() {
    const Offline = global.OfflineAudioContext || global.webkitOfflineAudioContext;
    if (!Offline) throw Error('This browser cannot prepare the soundtrack.');
    const rate = 44100, beat = 60 / BPM;
    const ctx = new Offline(1, Math.ceil(32 * beat * rate), rate);
    const bus = ctx.createGain();
    bus.connect(ctx.destination);
    const noise = ctx.createBuffer(1, rate, rate), noiseData = noise.getChannelData(0);
    let seed = 78123;
    for (let i = 0; i < noiseData.length; i++) {
      seed = (1664525 * seed + 1013904223) >>> 0;
      noiseData[i] = seed / 2147483648 - 1;
    }
    for (let bar = 0; bar < 8; bar++) {
      const chord = HARMONY[bar];
      for (let eighth = 0; eighth < 8; eighth++) {
        const time = bar * 4 * beat + eighths(0, eighth);
        if (eighth === 0 || eighth === 4) tuba(ctx, bus, eighth === 0 ? chord.root : chord.fifth, time, beat * 0.58, 0.8);
        if (eighth === 2 || eighth === 6) {
          chord.keys.forEach((note, i) => piano(ctx, bus, note, time + i * 0.006, beat * 0.4, 0.28));
          tick(ctx, bus, time);
        }
        const event = MELODY[bar].find(item => item[0] === eighth);
        if (event) piano(ctx, bus, event[1], time, eighths(eighth, event[2]) * 0.86, 0.68);
        if (eighth % 2) brush(ctx, bus, noise, time, ((bar * 8 + eighth) * 0.073) % 0.8, 0.6);
      }
    }
    const rendered = await ctx.startRendering();
    const samples = rendered.getChannelData(0);
    let peak = 0, energy = 0;
    for (const sample of samples) { peak = Math.max(peak, Math.abs(sample)); energy += sample * sample; }
    const scale = Math.min(0.13 / Math.sqrt(energy / samples.length), 0.78 / peak);
    for (let i = 0; i < samples.length; i++) samples[i] *= scale;
    return rendered;
  }

  function prepareScore() {
    if (score) return Promise.resolve(score);
    if (!rendering) rendering = renderScore().then(buffer => { score = buffer; return buffer; }).finally(() => { rendering = null; });
    return rendering;
  }

  function startLoop() {
    if (loop || !score || !initialized || mode === 'idle' || context.state !== 'running') return;
    const source = context.createBufferSource();
    source.buffer = score;
    source.loop = true;
    source.connect(musicBus);
    source.onended = () => { source.disconnect(); if (loop === source) loop = null; };
    musicBus.gain.cancelScheduledValues(context.currentTime);
    musicBus.gain.setValueAtTime(0, context.currentTime);
    musicBus.gain.linearRampToValueAtTime(1, context.currentTime + 0.04);
    duckUntil = 0;
    loopStarted = context.currentTime;
    loop = source;
    source.start();
  }

  function createContext() {
    const Audio = global.AudioContext || global.webkitAudioContext;
    if (!Audio) throw Error('Web Audio is unavailable in this browser.');
    context = new Audio({latencyHint:'interactive'});
    master = context.createGain();
    musicBus = context.createGain();
    fxBus = context.createGain();
    const limiter = context.createDynamicsCompressor();
    limiter.threshold.value = -9;
    limiter.knee.value = 10;
    limiter.ratio.value = 12;
    limiter.attack.value = 0.003;
    limiter.release.value = 0.18;
    master.gain.value = muted ? 0 : volume;
    fxBus.gain.value = 1.7;
    musicBus.connect(master);
    fxBus.connect(master);
    master.connect(limiter);
    limiter.connect(context.destination);
    context.onstatechange = () => {
      if (context.state === 'running') { error = ''; startLoop(); }
      // Mobile interruptions can end without another visibility event.
      else if (['interrupted','suspended'].includes(context.state) && initialized && mode !== 'idle') recover();
    };
  }

  async function waitForResume(promise) {
    let timeout;
    try {
      await Promise.race([promise, new Promise((_, reject) => {
        timeout = global.setTimeout(() => reject(Error('Click Sound on to resume the music.')), 1800);
      })]);
    } finally { global.clearTimeout(timeout); }
  }

  async function init() {
    try {
      if (!context || context.state === 'closed') { loop = null; initialized = false; createContext(); }
      // Call resume before awaiting rendering so the user gesture unlocks Safari.
      const resumed = context.resume();
      const unlock = context.createBufferSource();
      unlock.buffer = context.createBuffer(1, 1, context.sampleRate);
      unlock.connect(context.destination);
      unlock.onended = () => unlock.disconnect();
      unlock.start();
      await Promise.all([waitForResume(resumed), prepareScore()]);
      if (context.state !== 'running') throw Error('Click Sound on to resume the music.');
      initialized = true;
      error = '';
      startLoop();
    } catch (failure) { error = failure && failure.message ? failure.message : String(failure); }
    return status();
  }

  async function recover() {
    if (recovering || !initialized || mode === 'idle' || !context || context.state === 'closed' || global.document.hidden) return;
    recovering = true;
    try { await waitForResume(context.resume()); if (context.state === 'running') { error = ''; startLoop(); } }
    catch (failure) { error = failure.message || String(failure); }
    finally { recovering = false; }
  }

  function setMode(nextMode) {
    if (!MODES.has(nextMode)) throw TypeError('Unknown audio mode: ' + nextMode);
    if (nextMode === 'idle') return stop();
    // Game phases share one uninterrupted score, including pauses and results.
    mode = nextMode;
    startLoop();
    return status();
  }

  function setVolume(value) {
    if (!Number.isFinite(Number(value))) throw TypeError('Volume must be a number.');
    volume = clamp(Number(value), 0, 1);
    if (master) ramp(master.gain, muted ? 0 : volume);
    return status();
  }

  function mute(value = true) {
    muted = Boolean(value);
    if (master) ramp(master.gain, muted ? 0 : volume);
    return status();
  }

  function duckFor(seconds) {
    const now = context.currentTime;
    duckUntil = Math.max(duckUntil, now + seconds);
    ramp(musicBus.gain, 0.45);
    musicBus.gain.setValueAtTime(0.45, duckUntil);
    musicBus.gain.linearRampToValueAtTime(1, duckUntil + 0.25);
  }

  function sting(kind) {
    if (!['fail','correct','wrong'].includes(kind)) throw TypeError('Unknown sting: ' + kind);
    if (!initialized || !context || context.state !== 'running') return false;
    const time = context.currentTime + 0.025;
    if (kind === 'fail') {
      duckFor(1.75);
      [62,58,55,43].forEach((note, i) => tuba(context, fxBus, note, time + i * 0.28, i === 3 ? 0.88 : 0.3, i === 3 ? 0.95 : 0.76, true, true));
    } else if (kind === 'correct') {
      duckFor(0.65);
      [76,79,84,88].forEach((note, i) => piano(context, fxBus, note, time + i * 0.085, 0.35, 0.72, true));
    } else {
      duckFor(0.55);
      tuba(context, fxBus, 55, time, 0.19, 0.68, true, true);
      tuba(context, fxBus, 50, time + 0.2, 0.32, 0.75, true, true);
    }
    return true;
  }

  function stop() {
    mode = 'idle';
    if (!context) return status();
    const source = loop;
    loop = null;
    ramp(musicBus.gain, 0, 0.025);
    if (source) { try { source.stop(context.currentTime + 0.03); } catch (_) {} }
    for (const part of effects) {
      ramp(part.gain.gain, 0, 0.025);
      part.sources.forEach(source => { try { source.stop(context.currentTime + 0.03); } catch (_) {} });
    }
    return status();
  }

  function status() {
    const playing = Boolean(initialized && context && context.state === 'running' && mode !== 'idle' && loop);
    return {
      supported:Boolean(global.AudioContext || global.webkitAudioContext), initialized,
      state:context ? context.state : 'uninitialized', mode, volume, muted, playing,
      audible:playing && !muted && volume > 0, bpm:BPM, error,
      loopDuration:score ? score.duration : 0,
      loopPosition:playing ? (context.currentTime - loopStarted) % score.duration : 0,
    };
  }

  global.document.addEventListener('visibilitychange', () => { if (!global.document.hidden) recover(); });
  global.GameAudio = Object.freeze({init, setMode, setVolume, mute, sting, stop, status});
})(window);
</script>
<script>(function (global) {
  'use strict';
  const clips = new Map();

  function decode(data) {
    const raw = atob(data), bytes = new Uint8Array(raw.length);
    for (let i = 0; i < raw.length; i++) bytes[i] = raw.charCodeAt(i);
    return URL.createObjectURL(new Blob([bytes], {type: 'video/mp4'}));
  }

  // Classic scripts retain the host's normal authentication inside its sandbox.
  // Each immutable payload is downloaded completely before a local video is made.
  global.__hwmClipReady = (key, data) => {
    const entry = clips.get(key);
    if (!entry || entry.done) return;
    try {
      entry.url = decode(data);
      entry.finish();
      entry.resolve(entry.url);
    } catch (_) {
      entry.fail(new Error('This clip could not load.'));
    }
  };

  function load(segment) {
    const key = typeof segment === 'string' ? segment : segment.key;
    if (clips.has(key)) return clips.get(key).promise;
    if (typeof segment === 'string') {
      const url = decode(segment);
      const entry = {url, promise: Promise.resolve(url)};
      clips.set(key, entry);
      return entry.promise;
    }
    const entry = {};
    entry.promise = new Promise((resolve, reject) => {
      let script, timer, attempt = 0;
      entry.resolve = resolve;
      entry.finish = () => { entry.done = true; clearTimeout(timer); if (script) script.remove(); };
      entry.fail = error => { if (entry.done) return; entry.finish(); clips.delete(key); reject(error); };
      const request = () => {
        script = document.createElement('script');
        script.async = true;
        script.src = segment.bundle;
        script.onload = () => { if (!entry.url) entry.fail(new Error('This clip could not load.')); };
        script.onerror = () => {
          if (entry.done) return;
          script.remove();
          if (attempt++ === 0) request();
          else entry.fail(new Error('This clip could not load. Check your connection.'));
        };
        document.head.append(script);
      };
      entry.start = () => {
        timer = setTimeout(() => entry.fail(new Error('This clip is taking too long to load.')), 90000);
        request();
      };
    });
    clips.set(key, entry);
    entry.start();
    return entry.promise;
  }
  global.ClipStore = Object.freeze({
    load,
    warm(segment) { try { load(segment).catch(() => {}); } catch (_) {} }
  });
})(window);
</script>
<script>
'use strict';
const ROUNDS=JSON.parse(document.getElementById('round-data').textContent);
const $=id=>document.getElementById(id),letters=['A','B','C','D'];
let teams=[],roundIndex=0,phase='welcome',guesses=[],awards=[],scored=false,replaying=false,muted=false,countdownTimer=null,seconds=30,currentURL=null,loadToken=0,cancelLoad=null,activePart='setup',activeRate=1,clipFailed=false,clipLoading=false;
const video=$('video');video.muted=true;
const safeStore={get(k){try{return localStorage.getItem(k)}catch{return null}},set(k,v){try{localStorage.setItem(k,v)}catch{}}};
function show(id,visible){$(id).hidden=!visible}
function text(id,value){$(id).textContent=value}
function el(tag,cls,content){const n=document.createElement(tag);if(cls)n.className=cls;if(content!==undefined)n.textContent=content;return n}
function inputTeam(name){const box=el('div','team-input-row');const input=el('input');input.value=name;input.maxLength=24;input.placeholder='Team name';input.setAttribute('aria-label','Team name');const btn=el('button','quiet danger','×');btn.type='button';btn.setAttribute('aria-label','Remove team');btn.onclick=()=>{if($('team-inputs').children.length>1)box.remove();syncTeamInputs()};box.append(input,btn);$('team-inputs').append(box);syncTeamInputs()}
function syncTeamInputs(){const rows=[...$('team-inputs').children];rows.forEach((r,i)=>{r.querySelector('input').id='team-'+i;r.querySelector('button').disabled=rows.length===1});$('add-team').disabled=rows.length>=6}
['Team 1','Team 2','Team 3'].forEach(inputTeam);
$('add-team').onclick=()=>{if($('team-inputs').children.length<6)inputTeam('Team '+($('team-inputs').children.length+1))};
$('welcome-rules').textContent=ROUNDS.length+' rounds · 2 points per correct guess';
$('hero-image').src=ROUNDS[0].poster;
function initCredits(){ROUNDS.forEach((r,i)=>{const li=el('li');const a=el('a',null,r.sourceTitle);a.href=r.sourceUrl;a.target='_blank';a.rel='noopener';li.append(el('strong',null,(i+1)+'. '+r.title+' '),a,document.createTextNode('. '+r.classification+' Excerpt '+r.start+'–'+r.end+'s.'));$('credit-list').append(li)})}
initCredits();
function setPhase(p){phase=p;show('watching',p==='setup'||p==='loading');show('predict',p==='predict');show('revealing',p==='reveal');show('round-result',p==='result');show('play-pause',p==='setup'||p==='reveal');show('replay-setup',p==='predict');show('replay-fail',p==='result');show('slowmo',p==='result');show('punchline',p==='result');if(p!=='predict')clearInterval(countdownTimer);}
function scores(){const box=$('scores');box.replaceChildren();teams.forEach(t=>{const item=el('div','score-item');item.append(el('span',null,t.name),el('b',null,String(t.score)));box.append(item)})}
function makeChoices(){const r=ROUNDS[roundIndex];$('options').replaceChildren();r.options.forEach((s,i)=>{const item=el('div','option');item.append(el('b',null,letters[i]),el('span',null,s));$('options').append(item)});renderPicks()}
function renderPicks(){const box=$('team-picks');box.replaceChildren();teams.forEach((t,i)=>{const row=el('div','team-pick');row.append(el('span','team-pick-name',t.name));const group=el('div','pick-buttons');group.setAttribute('role','group');group.setAttribute('aria-label',t.name+' prediction');letters.forEach((a,j)=>{const b=el('button',null,a);b.setAttribute('aria-label',t.name+': answer '+a);b.setAttribute('aria-pressed',String(guesses[i]===j));b.onclick=()=>{if(phase!=='predict')return;guesses[i]=j;renderPicks()};group.append(b)});row.append(group);box.append(row)});$('lock').disabled=guesses.some(x=>x===null)}
function beginPrediction(){setPhase('predict');text('media-badge','PREDICT THE FAILURE');text('media-status','Choose your answers');seconds=30;text('timer',seconds);$('timer').classList.remove('expired');const deadline=performance.now()+30000;clearInterval(countdownTimer);countdownTimer=setInterval(()=>{seconds=Math.max(0,Math.ceil((deadline-performance.now())/1000));text('timer',String(seconds).padStart(2,'0'));if(seconds===0){clearInterval(countdownTimer);$('timer').classList.add('expired');text('media-status','Time to reveal')}},100);renderPicks();const index=roundIndex;ClipStore.load(ROUNDS[index].reveal).then(()=>{if(roundIndex===index&&ROUNDS[index+1])ClipStore.warm(ROUNDS[index+1].setup)}).catch(()=>{})}
function loadingClip(value){clipLoading=value;show('clip-loading',value);$('play-pause').disabled=value;if(value)text('media-status','Loading clip')}
function stopClip(clear=true){loadToken++;if(cancelLoad)cancelLoad();video.pause();loadingClip(false);if(clear){video.removeAttribute('src');video.load();currentURL=null}}
async function loadClip(part,rate=1){
 stopClip(false);activePart=part;activeRate=rate;clipFailed=false;const token=loadToken;
 loadingClip(true);show('media-error',false);
 let cancel;
 const cancelled=new Promise(resolve=>{cancel=()=>resolve(null);cancelLoad=cancel});
 const url=await Promise.race([ClipStore.load(ROUNDS[roundIndex][part]),cancelled]);
 if(token!==loadToken||!url)return false;
 if(cancelLoad===cancel)cancelLoad=null;
 const loaded=new Promise((resolve,reject)=>{
  let timeout;
  const clean=()=>{clearTimeout(timeout);for(const event of ['loadeddata','canplay','seeked'])video.removeEventListener(event,ok);video.removeEventListener('error',bad);if(cancelLoad===cancelReady)cancelLoad=null};
  const ok=()=>{if(video.readyState<2)return;clean();resolve(true)};
  const bad=()=>{clean();reject(Error('The clip could not play.'))};
  const cancelReady=()=>{clean();resolve(false)};
  cancelLoad=cancelReady;timeout=setTimeout(()=>{clean();reject(Error('The clip could not play.'))},15000);
  for(const event of ['loadeddata','canplay','seeked'])video.addEventListener(event,ok);video.addEventListener('error',bad,{once:true});
  if(currentURL!==url){currentURL=url;video.src=url;video.muted=true;video.load()}
  else{video.currentTime=0;ok()}
 });
 if(!await loaded||token!==loadToken)return false;
 video.playbackRate=rate;loadingClip(false);return true;
}
function mediaError(error){clipFailed=true;loadingClip(false);video.pause();text('media-error',error.message+' Try again or skip this round.');show('media-error',true);text('media-status','Playback paused');text('play-pause','Try playback');show('play-pause',true)}
async function playSegment(part,rate=1){const pending=loadClip(part,rate),token=loadToken;try{if(!await pending||token!==loadToken)return;await video.play();if(token!==loadToken)return;text('play-pause','Pause clip');if(part==='setup')ClipStore.warm(ROUNDS[roundIndex].reveal)}catch(e){if(token===loadToken)mediaError(e)}}

async function startRound(){const r=ROUNDS[roundIndex];video.poster=r.poster;$('stage').classList.toggle('creator-mark-left',['motion-copy','aidol-debut'].includes(r.id));guesses=teams.map(()=>null);awards=[];scored=false;replaying=false;text('round-label','ROUND '+(roundIndex+1)+' OF '+ROUNDS.length);text('round-title',r.title);text('task',r.task);text('source-line',r.shortCredit);text('question',r.question);text('media-badge','THE SETUP');text('media-status','Watch closely');makeChoices();scores();setPhase('setup');await playSegment('setup',r.setupRate||1)}
async function start(){show('start-error',false);const names=[...$('team-inputs').querySelectorAll('input')].map(x=>x.value.trim());if(names.some(n=>!n)){text('start-error','Give each team a name.');show('start-error',true);return}teams=names.map(name=>({name,score:0}));$('start').disabled=true;try{const audioState=await GameAudio.init();GameAudio.mute(muted);GameAudio.setVolume(Number($('volume').value)/100);GameAudio.setMode('setup');soundLabel();if(audioState.error||audioState.state!=='running')throw Error(audioState.error||'Audio paused');show('sound-warning',false)}catch(e){text('sound-warning','Music is paused. Click Play music to resume.');show('sound-warning',true)}roundIndex=0;show('welcome',false);show('results',false);show('game',true);text('foot-copy','SPACE: PAUSE    M: MUSIC    F: FULL SCREEN');$('start').disabled=false;await startRound()}
$('start').onclick=start;
$('lock').onclick=async()=>{if(phase!=='predict'||guesses.some(x=>x===null))return;setPhase('reveal');text('media-badge','REVEAL');text('media-status','Predictions locked');await playSegment('reveal',ROUNDS[roundIndex].revealRate||1)};
function revealResult(){const r=ROUNDS[roundIndex];if(!scored){awards=teams.map((t,i)=>{const pts=guesses[i]===r.answerIndex?2:0;t.score+=pts;return pts});scored=true}setPhase('result');text('answer-letter',letters[r.answerIndex]);text('answer-text',r.answer);$('punchline').replaceChildren(el('span',null,r.punchline));$('round-points').replaceChildren();teams.forEach((t,i)=>{const row=el('div','points-row');row.append(el('span',null,t.name),el('b',awards[i]?'':'zero',awards[i]?'+'+awards[i]+' points':'0 points'));$('round-points').append(row)});text('next',roundIndex===ROUNDS.length-1?'See scores':'Next clip');text('media-badge','');text('media-status','Round complete');scores();GameAudio.sting('fail');$('stage').classList.remove('wobble');void $('stage').offsetWidth;$('stage').classList.add('wobble');}
video.addEventListener('ended',()=>{if(clipLoading||!video.ended)return;if(phase==='setup')beginPrediction();else if(phase==='reveal'){revealResult();replaying=false}});
$('play-pause').onclick=async()=>{if(clipLoading)return;const token=loadToken;try{if(clipFailed){await playSegment(activePart,activeRate);return}if(video.paused){await video.play();if(token!==loadToken)return;text('play-pause','Pause clip')}else{video.pause();text('play-pause','Continue clip')}}catch(e){if(token===loadToken)mediaError(e)}};
video.addEventListener('error',()=>{if(!clipLoading&&['setup','reveal'].includes(phase))mediaError(Error('The clip could not play.'))});
$('replay-setup').onclick=async()=>{setPhase('setup');text('media-badge','THE SETUP');await playSegment('setup',ROUNDS[roundIndex].setupRate||1)};
async function replayFailure(slow){replaying=true;setPhase('reveal');text('media-badge',slow?'SLOW-MO':'REPLAY');text('media-status',slow?'Half speed':'Playing again');await playSegment('reveal',(ROUNDS[roundIndex].revealRate||1)*(slow?0.5:1))}
$('replay-fail').onclick=()=>replayFailure(false);$('slowmo').onclick=()=>replayFailure(true);
async function advanceRound(){if(!['setup','loading','predict','reveal','result'].includes(phase))return;setPhase('transition');stopClip();show('media-error',false);if(roundIndex<ROUNDS.length-1){roundIndex++;await startRound()}else finish()}
$('skip').onclick=advanceRound;
$('next').onclick=()=>{if(phase==='result')advanceRound()};
function finish(){clearInterval(countdownTimer);phase='finished';stopClip();show('game',false);show('results',true);const rank=[...teams].sort((a,b)=>b.score-a.score),top=rank[0].score,winners=rank.filter(t=>t.score===top).map(t=>t.name);text('winner-title',winners.length===1?winners[0]+' wins!':'It’s a tie!');text('winner-copy',winners.length===1?top+' points':winners.join(' & ')+' · '+top+' points each');$('leaderboard').replaceChildren();rank.forEach((t,i)=>{const row=el('div','leader-row');row.append(el('span',null,(i+1)+'. '+t.name),el('strong',null,t.score+' pts'));$('leaderboard').append(row)});text('foot-copy','')}
$('restart').onclick=()=>{phase='welcome';show('results',false);show('game',false);show('welcome',true);text('foot-copy','')};
function soundLabel(){const playing=!muted&&GameAudio.status().playing;$('sound').setAttribute('aria-pressed',String(playing));text('sound',muted?'♫ Sound off':playing?'♫ Sound on':'♫ Play music')}
async function toggleSound(){muted=!muted&&GameAudio.status().playing;GameAudio.mute(muted);soundLabel();safeStore.set('hwm-muted',String(muted));show('sound-warning',false);if(!muted){const a=await GameAudio.init();if(muted)return;GameAudio.setMode('setup');soundLabel();show('sound-warning',!!a.error||a.state!=='running');text('sound-warning',a.error||'Music is paused. Click Play music to resume.')}}
$('sound').onclick=toggleSound;$('volume').oninput=()=>{GameAudio.setVolume(Number($('volume').value)/100);safeStore.set('hwm-volume',$('volume').value)};
muted=safeStore.get('hwm-muted')==='true';GameAudio.mute(muted);soundLabel();const savedVol=safeStore.get('hwm-volume');if(savedVol!==null){$('volume').value=String(Math.min(100,Math.max(0,Number(savedVol)||0)));GameAudio.setVolume(Number($('volume').value)/100)}
async function fullscreen(){try{if(document.fullscreenElement)await document.exitFullscreen();else await document.documentElement.requestFullscreen()}catch{}}
$('fullscreen').onclick=fullscreen;$('rules-open').onclick=()=>$('rules').showModal();$('credits-open').onclick=()=>$('credits').showModal();$('credits-end').onclick=()=>$('credits').showModal();document.querySelectorAll('[data-close]').forEach(b=>b.onclick=()=>$(b.dataset.close).close());
document.addEventListener('keydown',e=>{if(/INPUT|TEXTAREA|SELECT|BUTTON/.test(e.target.tagName)||document.querySelector('dialog[open]'))return;if(e.code==='Space'&&(phase==='setup'||phase==='reveal')){e.preventDefault();$('play-pause').click()}if(e.key.toLowerCase()==='m')toggleSound();if(e.key.toLowerCase()==='f')fullscreen()});
let resumeMusicOnPageShow=false;
window.addEventListener('pagehide',()=>{resumeMusicOnPageShow=GameAudio.status().mode!=='idle';GameAudio.stop()});
window.addEventListener('pageshow',()=>{if(resumeMusicOnPageShow){GameAudio.setMode('setup');GameAudio.init().then(soundLabel);resumeMusicOnPageShow=false}});
window.HWM={state:()=>({phase,roundIndex,teams:teams.map(t=>({...t})),guesses:[...guesses],scored,video:{time:video.currentTime,duration:video.duration,paused:video.paused,ready:video.readyState,loading:clipLoading},audio:GameAudio.status()}),roundCount:ROUNDS.length};
</script>
</body></html>