Skip to content
VibeCodeBench
Back to the app

The code

The Most Uncomfortable Web Page by Claude Haiku 5.5

Exactly as the AI wrote it. Shown as text, so nothing runs on this page.

index.html

works · auto-checked (Checked by an automated pass. Not hand-played yet.)10.1 KB · 263 lines · no libraries
Download
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>The Most Uncomfortable Page</title>
<style>
  :root { --bg:#f4f1ea; --ink:#2b2a33; --accent:#6c5ce7; --card:#ffffff; --muted:#8a8699; }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { --bg:#1d1b24; --ink:#f1efff; --accent:#a29bfe; --card:#2a2734; --muted:#9b96b0; }
  }
  :root[data-theme="dark"] { --bg:#1d1b24; --ink:#f1efff; --accent:#a29bfe; --card:#2a2734; --muted:#9b96b0; }
  * { box-sizing: border-box; }
  html, body { margin:0; height:100%; }
  body { background:var(--bg); color:var(--ink); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; overflow:hidden; touch-action:manipulation; }
  .stage { position:fixed; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:16px; gap:18px; }
  h1 { font-size:clamp(22px, 5vw, 34px); margin:0; text-align:center; }
  p.note { margin:0; color:var(--muted); text-align:center; max-width:34ch; }
  .crooked { transform: rotate(-1.6deg); }
  .btn { font:inherit; font-size:20px; min-height:56px; min-width:160px; padding:14px 26px; border:0; border-radius:14px; background:var(--accent); color:#fff; cursor:pointer; touch-action:manipulation; }
  .btn.dodge { position:fixed; transition: left .18s ease, top .18s ease; z-index:20; }
  .bar { width:min(86vw,420px); height:30px; background:var(--card); border-radius:999px; overflow:hidden; box-shadow:0 0 0 1px var(--muted) inset; }
  .fill { height:100%; width:0%; background:var(--accent); transition: width .9s ease; }
  .shift { position:relative; left:1px; }
  .cookie { position:fixed; left:50%; bottom:12px; transform:translateX(-50%); width:min(92vw,360px); background:var(--card); border-radius:14px; padding:14px; box-shadow:0 8px 24px rgba(0,0,0,.25); z-index:10; font-size:15px; }
  .cookie .row { display:flex; gap:8px; justify-content:flex-end; flex-wrap:wrap; margin-top:10px; }
  .cookie .btn { min-height:48px; min-width:120px; font-size:16px; padding:10px 16px; }
  .spawn { position:fixed; z-index:15; }
  .screen { display:none; }
  .screen.on { display:flex; }
  .thanks { font-size:clamp(24px,6vw,40px); text-align:center; }
  .hint { position:fixed; bottom:6px; left:0; right:0; text-align:center; color:var(--muted); font-size:13px; }
  .demo-label { position:fixed; top:8px; left:0; right:0; text-align:center; color:var(--muted); font-size:13px; display:none; }
  body.demo .demo-label { display:block; }
</style>
</head>
<body>
<div class="demo-label">Demo mode - touch the screen to take over</div>

<main class="stage" id="s1">
  <h1 class="crooked">Welcome to Your Experience</h1>
  <p class="note">Step 1 of 4: Press the big button to continue.</p>
  <button class="btn" id="go1">Continue</button>
</main>

<main class="stage screen" id="s2">
  <h1>Patience Test</h1>
  <p class="note">Waiting for the bar to finish. Almost there, probably.</p>
  <div class="bar"><div class="fill" id="fill"></div></div>
  <p class="note" id="pct">0%</p>
</main>

<main class="stage screen" id="s3">
  <h1>Confirm Your Choice</h1>
  <p class="note">Choose one. The other one is not available, sorry.</p>
  <button class="btn" id="yes">Yes</button>
  <button class="btn" id="no">No</button>
  <p class="note" id="nerr"></p>
</main>

<main class="stage screen" id="s4">
  <h1 class="shift">Almost Done</h1>
  <p class="note">Press Close to leave. Close is a very popular button.</p>
  <button class="btn" id="close1">Close</button>
</main>

<main class="stage screen" id="s5">
  <div class="thanks" id="thanks">Thank you for your patience.</div>
  <p class="note">You made it. Nothing is left to do.</p>
  <button class="btn" id="again">Start over</button>
</main>

<div class="cookie" id="cookie">
  <div>We use cookies. Some of them are slightly crooked.</div>
  <div class="row"><button class="btn" id="ck1">OK</button></div>
</div>

<div class="hint" id="hint">Tap or click to move on</div>

<script>
(function () {
  "use strict";

  var $ = function (id) { return document.getElementById(id); };
  var demo = /#demo$/.test(location.hash);
  var demoTimer = null, demoStart = 0, userTouched = false;
  var DEMO_MS = 20000;
  var screens = ["s1", "s2", "s3", "s4", "s5"];
  var cur = "s1";

  function store(k, v) { try { localStorage.setItem(k, v); } catch (e) {} }
  function load(k) { try { return localStorage.getItem(k); } catch (e) { return null; } }

  function show(id) {
    screens.forEach(function (s) { $(s).classList.toggle("on", s === id); });
    cur = id;
  }

  function endDemo() {
    if (!demo || !document.body.classList.contains("demo")) return;
    document.body.classList.remove("demo");
    clearTimeout(demoTimer);
    cookieCount = 1;
    cleanupSpawns();
    reset();
  }

  // --- Step 1: a Continue button that dodges the finger ---
  var go = $("go1");
  var dodgeCount = 0;
  function dodge() {
    dodgeCount++;
    var max = Math.max(0, window.innerWidth - go.offsetWidth - 16);
    var maxY = Math.max(0, window.innerHeight - go.offsetHeight - 16);
    go.classList.add("dodge");
    go.style.left = Math.round(Math.random() * max) + "px";
    go.style.top = Math.round(Math.random() * maxY) + "px";
    if (dodgeCount > 5) go.style.left = go.style.left;
  }
  go.addEventListener("pointerenter", function () { if (dodgeCount < 4) dodge(); });
  go.addEventListener("click", function () {
    if (dodgeCount < 4) { dodge(); return; }
    go.classList.remove("dodge"); go.style.left = ""; go.style.top = "";
    show("s2"); startBar();
  });
  go.addEventListener("touchstart", function (e) {
    if (dodgeCount < 4) { e.preventDefault(); dodge(); }
  }, { passive: false });

  // --- Step 2: progress bar that slides back at 99 percent ---
  var pct = 0, barTimer = null, backs = 0;
  function startBar() {
    pct = 0; backs = 0; render();
    barTimer = setInterval(function () {
      if (pct < 99) {
        pct = Math.min(99, pct + 1 + Math.floor(Math.random() * 6));
        if (pct >= 99) pct = 99;
      } else if (backs < 3) {
        backs++;
        pct = 90 + Math.floor(Math.random() * 6);
      } else {
        pct = 100;
        clearInterval(barTimer);
        setTimeout(function () { show("s3"); }, 900);
      }
      render();
    }, 700);
  }
  function render() {
    $("fill").style.width = pct + "%";
    $("pct").textContent = pct + "% - " + (pct >= 99 && pct < 100 ? "nearly there" : "loading");
  }

  // --- Step 3: a Yes/No where the No pushes text one pixel off ---
  var noCount = 0;
  $("no").addEventListener("click", function () {
    noCount++;
    $("nerr").textContent = "Your answer was saved as Yes. Thanks for the patience.";
    $("yes").style.transform = "translateX(" + (noCount % 2 ? 1 : -1) + "px)";
    if (noCount >= 2) setTimeout(function () { show("s4"); }, 500);
  });
  $("yes").addEventListener("click", function () { show("s4"); });

  // --- Step 4: Close that spawns another Close ---
  function spawnClose(parent, x, y) {
    var b = document.createElement("button");
    b.className = "btn spawn";
    b.textContent = "Close";
    b.style.left = x + "px";
    b.style.top = y + "px";
    b.addEventListener("click", function (ev) {
      ev.stopPropagation();
      if (spawnCount < 6) { spawnCount++; spawnClose(null, Math.random() * (window.innerWidth - 180), Math.random() * (window.innerHeight - 70)); return; }
      show("s5");
      cleanupSpawns();
    });
    document.body.appendChild(b);
    return b;
  }
  var spawnCount = 0;
  function cleanupSpawns() {
    document.querySelectorAll(".spawn").forEach(function (n) { n.remove(); });
    spawnCount = 0;
  }
  $("close1").addEventListener("click", function () {
    spawnCount = 1;
    spawnClose(null, Math.random() * (window.innerWidth - 180), Math.random() * (window.innerHeight - 70));
  });

  // --- Cookie notice that multiplies ---
  var cookieCount = 1;
  $("ck1").addEventListener("click", function () {
    cookieCount++;
    if (cookieCount > 3) { $("cookie").querySelector("div").textContent = "We use cookies. Really. " + cookieCount + " of them."; }
    if (cookieCount <= 3) {
      var c = $("cookie").cloneNode(true);
      c.id = "";
      c.style.bottom = (12 + (cookieCount - 1) * 90) + "px";
      c.style.zIndex = 10 + cookieCount;
      c.querySelector("button").addEventListener("click", function () { c.remove(); });
      document.body.appendChild(c);
    }
    store("cookieCount", String(cookieCount));
  });

  // --- Final screen buttons ---
  $("again").addEventListener("click", function () { reset(); });

  function reset() {
    cleanupSpawns();
    clearInterval(barTimer);
    dodgeCount = 0; noCount = 0; backs = 0; pct = 0;
    go.classList.remove("dodge"); go.style.left = ""; go.style.top = "";
    $("yes").style.transform = "";
    $("nerr").textContent = "";
    show("s1");
    document.body.classList.toggle("demo", false);
  }

  // --- Demo loop (#demo): hands-free, about 20 seconds ---
  function runDemo() {
    document.body.classList.add("demo");
    demoStart = Date.now();
    var steps = [
      function () { show("s1"); },
      function () { dodge(); },
      function () { dodge(); },
      function () { go.classList.remove("dodge"); go.style.left = ""; go.style.top = ""; show("s2"); startBar(); },
      function () { show("s3"); },
      function () { show("s4"); },
      function () { show("s5"); },
      function () { reset(); document.body.classList.add("demo"); }
    ];
    var i = 0;
    function next() {
      if (!demo || !document.body.classList.contains("demo")) return;
      if (Date.now() - demoStart >= DEMO_MS) { endDemo(); return; }
      steps[i % steps.length]();
      i++;
      demoTimer = setTimeout(next, 2500);
    }
    next();
  }

  function stopOnTouch() {
    if (!demo || userTouched) return;
    userTouched = true;
    endDemo();
  }
  ["touchstart", "pointerdown", "mousedown", "keydown"].forEach(function (ev) {
    document.addEventListener(ev, stopOnTouch, { passive: true });
  });

  window.addEventListener("hashchange", function () {
    if (/#demo$/.test(location.hash) && !demo) location.reload();
  });

  if (demo) runDemo();
  show("s1");
})();
</script>
</body>
</html>