@@ -370,54 +370,63 @@ function closeMatrix() {
370370window . startSelfDestruct = function ( ) {
371371 const btn = document . getElementById ( 'self-destruct-btn' ) ;
372372 const devPanel = document . getElementById ( 'dev-tools' ) ;
373- const timerDisplay = document . getElementById ( 'destruct-timer' ) ;
374- const progressBar = document . getElementById ( 'destruct-bar' ) ;
375- const statusText = document . getElementById ( 'destruct-text' ) ;
376373
377374 if ( destructInterval ) return ;
378375
379376 initAudio ( ) ;
380- document . body . appendChild ( devPanel ) ;
377+
378+ // Move to HTML tag so it ignores Body shakes and stays at top of screen
379+ document . documentElement . appendChild ( devPanel ) ;
381380 devPanel . setAttribute ( 'data-lock' , 'true' ) ;
381+ devPanel . classList . remove ( 'hidden' ) ;
382+
382383 btn . classList . add ( 'is-destructing' ) ;
383384
384385 let timeLeft = 10 ;
385386
386387 destructInterval = setInterval ( ( ) => {
387388 timeLeft -- ;
388389
390+ // RE-FETCH elements inside the panel to ensure they aren't null
391+ const timerDisplay = document . getElementById ( 'destruct-timer' ) ;
392+ const progressBar = document . getElementById ( 'destruct-bar' ) ;
393+ const statusText = document . getElementById ( 'destruct-text' ) ;
394+
395+ // Update the numerical text
389396 if ( timerDisplay ) {
390397 timerDisplay . innerText = `${ timeLeft } s` ;
391- timerDisplay . style . color = "#fff" ;
392398 }
393399
400+ // Update the progress bar logic
394401 if ( progressBar ) {
395402 const percent = ( ( 10 - timeLeft ) / 10 ) * 100 ;
396403 progressBar . style . width = `${ percent } %` ;
404+
405+ // Color Shift
397406 if ( timeLeft > 5 ) progressBar . style . backgroundColor = "#22c55e" ;
398407 else if ( timeLeft > 2 ) progressBar . style . backgroundColor = "#eab308" ;
399408 else progressBar . style . backgroundColor = "#ef4444" ;
400409 }
401410
411+ // Audio Pitch Increase
402412 if ( audioCtx ) {
403413 const osc = audioCtx . createOscillator ( ) ;
404414 const g = audioCtx . createGain ( ) ;
405415 osc . connect ( g ) ; g . connect ( audioCtx . destination ) ;
406- osc . frequency . setValueAtTime ( 300 + ( 10 - timeLeft ) * 50 , audioCtx . currentTime ) ;
416+ osc . frequency . setValueAtTime ( 300 + ( 10 - timeLeft ) * 60 , audioCtx . currentTime ) ;
407417 g . gain . setValueAtTime ( 0.1 , audioCtx . currentTime ) ;
408418 g . gain . exponentialRampToValueAtTime ( 0.001 , audioCtx . currentTime + 0.1 ) ;
409419 osc . start ( ) ; osc . stop ( audioCtx . currentTime + 0.1 ) ;
410420 }
411421
412422 if ( timeLeft <= 4 ) {
413423 document . body . classList . add ( 'glitch-shake' ) ;
414- if ( statusText ) statusText . innerText = "SYSTEM_FAILURE_IMMINENT " ;
424+ if ( statusText ) statusText . innerText = "CRITICAL_FAILURE " ;
415425 }
416426
417427 if ( timeLeft <= 0 ) {
418428 clearInterval ( destructInterval ) ;
419429 destructInterval = null ;
420- devPanel . setAttribute ( 'data-lock' , 'false' ) ;
421430 triggerSecretUnlock ( 'gravity' ) ;
422431 }
423432 } , 1000 ) ;
0 commit comments