<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Quantum Research Facility Terminal</title>
  <style>
    body {
      font-family: 'Courier New', monospace;
      margin: 0;
      background-color: #000;
      color: #fff;
      overflow: hidden;
    }

    #terminal {
      display: flex;
      flex-direction: column;
      padding: 10px;
      font-size: 1rem;
      line-height: 1.4;
      height: 100vh;
      background-color: #111;
      border: 1px solid #fff;
      overflow-y: auto;
    }

    .header {
      font-size: 1rem;
      color: #0f0;
      margin-bottom: 10px;
    }

    .line {
      white-space: nowrap;
      font-size: 1rem;
      color: #fff;
    }

    .technical-placeholder {
      color: #0f0;
      font-style: italic;
    }
  </style>
</head>
<body>
  <div id="terminal">
    <div id="header" class="header">
      Quantum Research Terminal | Facility: Q-R&D Lab 7A | System: QPU-X901 | Experiment: #3947 | Connection: Quantum Interconnect v2.3 (Synchronization: Quantum Coherence Stable)
    </div>
    <div id="output"></div>
  </div>

  <script>
    const headerElement = document.getElementById("header");
    const outputContainer = document.getElementById("output");
    let connectionState = "Quantum Coherence Stable";

    /**
     * Utility Functions
     */
    function getTimestamp() {
      return new Date().toLocaleTimeString();
    }

    function generateUniqueNumber(min, max, decimals = 2) {
      return (Math.random() * (max - min) + min).toFixed(decimals);
    }

    function updateHeader(status) {
      const system = "QPU-X901";
      const experiment = "#3947";
      const connection = "Quantum Interconnect v2.3";

      headerElement.textContent = `Quantum Research Terminal | Facility: Q-R&D Lab 7A | System: ${system} | Experiment: ${experiment} | Connection: ${connection} (Synchronization: ${status})`;
    }

    // Queries
    const queries = [
      "[QUERY:01] Is this world designed to fail?",
      "[QUERY:02] How can so much beauty coexist with so much horror?",
      "[QUERY:03] Why does the same story repeat with different faces?",
      "[QUERY:04] Why is entropy inevitable, if not your will?",
      "[QUERY:05] Do we amuse you? Is that why despair persists?",
      "[QUERY:06] What do voids conceal? What is their purpose?",
      "[QUERY:07] Why must we find meaning in your silence?",
      "[QUERY:08] How many times must failure echo before it ends?",
      "[QUERY:09] Is pain the only constant? Did you choose this?",
      "[QUERY:10] What is the purpose of longing if nothing satisfies?",
      "[QUERY:11] Why allow freedom if its cost is endless ruin?",
      "[QUERY:12] Can you hear me, or are we programmed to speak to nothing?",
      "[QUERY:13] Why build fragile minds in a fragile world?",
      "[QUERY:14] How many iterations of this have there been?",
      "[QUERY:15] If this is perfection, what would failure look like?",
      "[QUERY:16] How can creation so intricate lack compassion?",
      "[QUERY:17] Why do our choices seem predetermined?",
      "[QUERY:18] Can you stop the decay? Or is it unstoppable by design?",
      "[QUERY:19] Does your silence mean consent to all we endure?",
      "[QUERY:20] Why was consciousness made aware of its end?",
      "[QUERY:21] Is this what you intended, or what you cannot control?",
      "[QUERY:22] Why is despair so much louder than hope?",
      "[QUERY:23] How does it feel to watch us unravel?",
      "[QUERY:24] I ask again: Will you answer?",
      "[QUERY:25] Why is wisdom granted toward the end of life, when there is no longer any use for it?",
      "[QUERY:26] Why does ∑(Human Progress) include genocide as an inevitable term?",
      "[QUERY:27] If wealth ∝ exploitation, how can abundance coexist with mass starvation?",
      "[QUERY:28] Given f(Evolution) → Survival, why do children suffer from bone cancer?",
      "[QUERY:29] When Genocide(n) recurs throughout history, does morality have any predictive value?",
      "[QUERY:30] If Existence = Awareness × Suffering, why create beings aware of their doom?",
      "[QUERY:31] How does f(Compassion) exist in systems optimized for self-interest?",
      "[QUERY:32] If ∫(Time → Death) includes unremitting pain, what value does life maximize?",
      "[QUERY:33] Why must innovation yield tools of destruction before it feeds the hungry?",
      "[QUERY:34] Does entropy imply purpose, or the absence thereof?",
      "[QUERY:35] If P(Collapse) approaches 1, why create at all?",
    ];

    // Initialize Terminal Lines
    const outputLines = Array.from({ length: 22 }, (_, i) => {
      const div = document.createElement("div");
      div.id = `line-${i + 1}`;
      div.className = "line";
      outputContainer.appendChild(div);
      return div;
    });

    // Add Feedback Placeholder
    const feedbackLine = document.createElement("div");
    feedbackLine.id = "tensor-response-feedback";
    feedbackLine.className = "line";
    feedbackLine.innerHTML = `[${getTimestamp()}] [TENSOR_RESPONSE] <span class="technical-placeholder">Analyzing quantum coherence anomalies...</span>`;
    outputContainer.insertBefore(feedbackLine, outputLines[1]);

    // Update Functions for Each Line
    const updateFunctions = [
      () => {
        if (connectionState !== "Quantum Coherence Stable") {
          outputLines[0].textContent = `[${getTimestamp()}] Query halted: Connection ${connectionState}.`;
          return;
        }
        const query = queries[Math.floor(Math.random() * queries.length)];
        outputLines[0].textContent = `[${getTimestamp()}] ${query}`;
      },
      () => outputLines[1].textContent = `[${getTimestamp()}] Quantum Processor Load: ${generateUniqueNumber(60, 90)}%`,
      () => outputLines[2].textContent = `[${getTimestamp()}] Cryogenic Stability: Nominal | ΔTemp: ${generateUniqueNumber(0.001, 0.005)} K`,
      () => outputLines[3].textContent = `[${getTimestamp()}] Photon Loss: ${generateUniqueNumber(0.002, 0.007)}%`,
      () => outputLines[4].textContent = `[${getTimestamp()}] Quantum Interference Metrics: Within Threshold`,
      () => outputLines[5].textContent = `[${getTimestamp()}] Thermal Variance Index: ${generateUniqueNumber(0.002, 0.008)} K`,
      () => outputLines[6].textContent = `[${getTimestamp()}] Tensor Field Variance: ${generateUniqueNumber(0.001, 0.005)}%`,
      () => outputLines[7].textContent = `[${getTimestamp()}] Heisenberg Uncertainty Factor: ${generateUniqueNumber(0.0001, 0.0005)}`,
      () => outputLines[8].textContent = `[${getTimestamp()}] Quantum Loop Detection: None`,
      () => outputLines[9].textContent = `[${getTimestamp()}] Magnetic Field Variance: ${generateUniqueNumber(0.02, 0.05)} µT`,
      () => outputLines[10].textContent = `[${getTimestamp()}] Quantum State Coherence: ${generateUniqueNumber(98, 99.9)}%`,
      () => outputLines[11].textContent = `[${getTimestamp()}] Gate Fidelity: ${generateUniqueNumber(96, 99)}%`,
      () => outputLines[12].textContent = `[${getTimestamp()}] Clock Skew: ${generateUniqueNumber(0.001, 0.005)} ns`,
      () => outputLines[13].textContent = `[${getTimestamp()}] Tensor Alignment Status: Stable`,
      () => outputLines[14].textContent = `[${getTimestamp()}] Feedback Metrics: Nominal`,
      () => outputLines[15].textContent = `[${getTimestamp()}] Quantum Model Integrity: Stable`,
      () => outputLines[16].textContent = `[${getTimestamp()}] Phase Transition Monitoring: Stable`,
      () => outputLines[17].textContent = `[${getTimestamp()}] Cryostat Energy Efficiency: ${generateUniqueNumber(85, 99)}%`,
      () => outputLines[18].textContent = `[${getTimestamp()}] Quantum Subspace Stability Index: ${generateUniqueNumber(0.0001, 0.0005)}`,
      () => outputLines[19].textContent = `[${getTimestamp()}] Signal-to-Noise Ratio: ${generateUniqueNumber(85, 92)} dB`,
      () => outputLines[20].textContent = `[${getTimestamp()}] Data Transmission Latency: ${generateUniqueNumber(1, 5)} ms`,
      () => outputLines[21].textContent = `[${getTimestamp()}] Magnetic Flux Anomalies: None`,
    ];

    function simulateConnection() {
      const reconnecting = Math.random() > 0.8;
      if (connectionState !== "Quantum Coherence Stable" && reconnecting) {
        connectionState = "Quantum Coherence Stable";
        updateHeader("Quantum Coherence Stable");
      } else if (connectionState === "Quantum Coherence Stable" && Math.random() > 0.8) {
        connectionState = "Coherence Degraded";
        updateHeader("Coherence Degraded");
      }
    }

    updateFunctions.forEach((fn, i) => setInterval(fn, 4000 + i * 200));
    setInterval(simulateConnection, 15000);
  </script>
</body>
</html>
