import React, { useState, useEffect, useRef } from 'react'; import { Mic, MicOff, Ghost, Skull, ShieldAlert, VolumeX } from 'lucide-react'; const App = () => { const [gameState, setGameState] = useState('start'); // start, playing, jumpscare, consequence const [noiseLevel, setNoiseLevel] = useState(0); const [suspicion, setSuspicion] = useState(0); const [isListening, setIsListening] = useState(false); const audioContext = useRef(null); const analyser = useRef(null); const dataArray = useRef(null); const startMic = async () => { try { const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); audioContext.current = new (window.AudioContext || window.webkitAudioContext)(); analyser.current = audioContext.current.createAnalyser(); const source = audioContext.current.createMediaStreamSource(stream); source.connect(analyser.current); analyser.current.fftSize = 256; dataArray.current = new Uint8Array(analyser.current.frequencyBinCount); setIsListening(true); setGameState('playing'); gameLoop(); } catch (err) { console.error("Mic error:", err); } }; const gameLoop = () => { if (!analyser.current) return; analyser.current.getByteFrequencyData(dataArray.current); const average = dataArray.current.reduce((a, b) => a + b) / dataArray.current.length; setNoiseLevel(average); if (average > 50) { setSuspicion(prev => { const next = prev + 1.5; if (next >= 100) triggerEnding(); return next; }); } else { setSuspicion(prev => Math.max(0, prev - 0.2)); } if (gameState === 'playing') requestAnimationFrame(gameLoop); }; const triggerEnding = () => { setGameState('jumpscare'); setTimeout(() => { setGameState('consequence'); }, 1500); }; return (
{gameState === 'start' && (

SILENCE OR SEIZURE

Your sibling is playing a horror game. You are the "watcher." If your real-life mic detects a scream... the door opens.

)} {gameState === 'playing' && (
{/* Game Simulation */}
40 ? 'scale-110 blur-sm' : ''}`}>
{/* Suspicion / Door Progress */}
{/* HUD */}
Mic Active

Detection Risk

70 ? 'text-red-600' : 'text-zinc-400'}`}> {Math.round(suspicion)}%

)} {gameState === 'jumpscare' && (

! ! !

)} {gameState === 'consequence' && (

The Aftermath

"The door didn't just creak. It slammed against the wall."

"She didn't ask what we were doing. She already knew."

"The yelling lasted for two hours. The phone was gone for a month."

Discipline Protocol: Finalized.

)}
); }; export default App;