<!DOCTYPE html>
<html lang="de">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>System Boot - Ultimate Edition</title>
    <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
    
    <style>
        /* --- DEIN ORIGINAL CSS START (UNVERÄNDERT) --- */
        @font-face {
            font-family: "DOS-ISO9";
            src: url('fonts/DOS-ISO9.woff') format("woff");
            font-style: normal;
        }

        * {
            margin: 0px;
            padding: 0px;
        }

        html,
        body {
            font-family: "DOS-ISO9", sans-serif;
            font-style: normal;
            line-height: 24px;
            background-color: #000;
            overflow: hidden; /* Scrollbalken verhindern beim Booten */
            height: 100%;
        }

        .greenlight {
            padding: 3rem 2rem;
        }

        .intro {
            font-size: 22px;
            text-transform: uppercase;
            font-weight: bold;
            text-shadow: 0px 0px 1px rgba(69, 242, 150, 1);
            color: transparent; /* Der "Ghost"-Effekt */
            white-space: pre-wrap; /* Wichtig für Zeilenumbrüche im JS */
        }
        /* --- DEIN ORIGINAL CSS ENDE --- */

        /* Zusätzliche Styles für Cursor und Highlights im gleichen Look */
        .cursor {
            display: inline-block;
            width: 12px;
            height: 20px;
            background-color: rgba(69, 242, 150, 1); /* Farbe passend zum Glow */
            box-shadow: 0px 0px 5px rgba(69, 242, 150, 0.8);
            vertical-align: text-bottom;
            animation: blink 1s step-end infinite;
            margin-left: 2px;
        }

        @keyframes blink {
            0%, 100% { opacity: 1; }
            50% { opacity: 0; }
        }
    </style>
</head>

<body>
    <div class="greenlight">
        <div class="intro" id="console"></div>
    </div>

    <script>
        const consoleDiv = document.getElementById('console');
        const cursorHTML = '<span class="cursor"></span>';
        
        // Hilfsfunktion: Warten (Sleep)
        const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms));

        // Hilfsfunktion: Zeile schreiben
        const printLine = async (text, delay = 60) => {
            const line = document.createElement('div');
            line.innerHTML = text; 
            consoleDiv.appendChild(line);
            window.scrollTo(0, document.body.scrollHeight);
            if (delay > 0) await wait(delay);
        };

        // Hilfsfunktion: Text an die aktuelle (letzte) Zeile anhängen
        const appendText = async (text, delay = 0) => {
            if (consoleDiv.lastElementChild) {
                consoleDiv.lastElementChild.innerHTML += text;
                window.scrollTo(0, document.body.scrollHeight);
            }
            if (delay > 0) await wait(delay);
        };
        
        // Hilfsfunktion: Tippen simulieren
        const typeText = async (element, text, speed = 50) => {
            let currentHTML = element.innerHTML.replace(cursorHTML, '');
            for (let char of text) {
                currentHTML += char;
                element.innerHTML = currentHTML + cursorHTML;
                await wait(speed + Math.random() * 50); 
            }
            await wait(300);
            element.innerHTML = currentHTML; 
        };

        // ASCII Art: Floppy Disk
        const floppyAscii = `
   .-----------------------.
   | [=|]               [X]|
   |  |   MS-DOS 6.22    | |
   |  |   WORK DISK #1   | |
   |  |                  | |
   |  |__________________| |
   |                       |
   |   _________________   |
   |  |                 |  |
   '--'                 '--'
`;

        // Die Boot-Sequenz
        async function runBootSequence() {
            
            // 1. Video BIOS & Main Header
            await printLine("MATROX MILLENNIUM VGA BIOS V3.0");
            await printLine("4MB WRAM DETECTED.");
            await wait(1500);

            await printLine("");
            await printLine("AWARD MODULAR BIOS V4.51PG");
            await printLine("COPYRIGHT (C) 1984-98, AWARD SOFTWARE, INC.");
            await printLine("PENTIUM II PROCESSOR - 400 MHz");
            await wait(1000);

            // 2. RAM Test (Schön langsam zählen für Spannung)
            await printLine("");
            let ramLine = document.createElement('div');
            consoleDiv.appendChild(ramLine);
            
            for (let i = 0; i <= 65536; i += 2048) {
                ramLine.innerHTML = `MEMORY TEST    : ${i}K OK`;
                // Langsam anfangen, schnell werden, langsam enden
                let speed = (i < 10000 || i > 60000) ? 20 : 2; 
                await wait(speed); 
            }
            await wait(800);

            // 3. Hardware Detection
            await printLine("");
            await printLine("DETECTING PRI MASTER ... QUANTUM FIREBALL 6.4GB");
            await wait(1000);
            await printLine("DETECTING PRI SLAVE  ... NONE");
            await wait(300);
            await printLine("DETECTING SEC MASTER ... IOMEGA ZIP 100");
            await wait(800);
            await printLine("DETECTING SEC SLAVE  ... CREATIVE CD-ROM 24X");
            await wait(1200);

            // 4. PnP Initialization
            await printLine("");
            await printLine("INITIALIZING PLUG AND PLAY...");
            await wait(800);
            await printLine("PNP: SOUND BLASTER AWE64 DETECTED ON IRQ 5");
            await wait(500);
            await printLine("PNP: NETWORK CARD 3COM ETHERLINK III ON IRQ 10");
            await wait(1000);

            // Der Hänger
            await printLine("");
            await printLine("UPDATING ESCD... SUCCESS");
            await wait(500);
            await appendText("<br>VERIFYING DMI POOL DATA");
            await wait(800);
            await appendText(".");
            await wait(800);
            await appendText(".");
            await wait(800);
            await appendText(".");
            await wait(1500);
            await appendText(" OK");
            await wait(1000);

            // --- CLEAR SCREEN ---
            consoleDiv.innerHTML = "";
            await wait(800);

            // 5. OS Loading & Funny Drivers
            await printLine("STARTING MS-DOS 7.10...");
            await wait(1000);
            await printLine("");
            
            await printLine("DEVICE=C:\\DOS\\HIMEM.SYS /V");
            await wait(300);
            await printLine("HIMEM: DOS XMS DRIVER, VERSION 3.10");
            await printLine("HIMEM: EXTENDED MEMORY AVAILABLE.");
            await wait(600);

            await printLine("DEVICE=C:\\DRIVERS\\COFFEE.SYS /PORT:80");
            await wait(600);
            await appendText(" [CAFFEINE LEVEL: CRITICAL]");
            
            await printLine("DEVICE=C:\\DRIVERS\\PATIENCE.COM /FORCE");
            await wait(800);
            await appendText(" [LOAD FAILED: BATTERY LOW]");
            
            await printLine("DEVICE=C:\\DRIVERS\\SARCASM.VXD");
            await wait(500);
            await appendText(" [LOADED HIGH]");
            
            await printLine("DEVICE=C:\\NET\\STIEBEL_PROTOCOL.EXE");
            await wait(1000);
            await appendText(" [CONNECTED]");

            await printLine("");
            await printLine("LOADING USER PROFILE...");
            await wait(1500);
            await printLine("> LOGIC............ 100%");
            await wait(300);
            await printLine("> CREATIVITY....... 95%");
            await wait(300);
            await printLine("> MOTIVATION....... LOADING...");
            await wait(1500); // Warten auf Motivation
            await appendText(" OK");
            
            await printLine("");
            
            // ASCII Art rendern
            const asciiLines = floppyAscii.split('\n');
            for (let line of asciiLines) {
                await printLine(line, 10); 
            }

            await wait(1000);
            await printLine("SYSTEM READY.");
            await printLine("");

            // Final Prompt mit Eingabe
            let promptLine = document.createElement('div');
            promptLine.innerHTML = 'C:\\WORK_MODE>' + cursorHTML;
            consoleDiv.appendChild(promptLine);
        }

        // Starten
        runBootSequence();

    </script>
</body>
</html>