Skip to content
VibeCodeBench
Back to the app

The code

The Most Uncomfortable Web Page by GPT-6.2 Sol

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.)35.4 KB · 969 lines · no libraries
Download
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark">
<title>The Inconvenience Office</title>
<style>
:root {
  --bg: #171715;
  --panel: #22221f;
  --well: #1a1a17;
  --line: #44433c;
  --paper: #f3efe3;
  --muted: #b8b4a7;
  --lime: #e0fc77;
  --lilac: #d1b9fc;
  --biscuit: #f0d2a4;
  --mono: ui-monospace, 'Cascadia Mono', 'Courier New', monospace;
  --display: Impact, Haettenschweiler, 'Arial Narrow Bold', 'Arial Black', sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  isolation: isolate;
  color: var(--paper);
  background: radial-gradient(ellipse at 73% 17%, #29281f, transparent 46%), var(--bg);
  font-family: system-ui, sans-serif;
}
body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: '';
  background-image: radial-gradient(#f4ecd61c .65px, transparent .9px);
  background-size: 7px 7px;
  pointer-events: none;
}
button {
  min-height: 44px;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled { cursor: default; }
button:focus-visible { outline: 2px solid var(--paper); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
.icon {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.shell { width: min(1248px, calc(100% - 96px)); margin-inline: auto; }
.masthead { border-bottom: 1px solid var(--line); background: #171715ce; }
.masthead-inner {
  display: flex;
  min-height: 69px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.brand, .top-tools, .demo-button, .issue, .count, .task-type, .receipt-info {
  display: flex;
  align-items: center;
}
.brand { gap: 11px; }
.brand-mark {
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  flex: none;
  border-radius: 2px;
  background: var(--lime);
  color: var(--bg);
  transform: rotate(-5deg);
}
.brand-mark svg { width: 25px; height: 25px; }
.brand-name { font-size: 14px; font-weight: 850; line-height: 1.05; }
.brand-small {
  margin-top: 4px;
  color: var(--muted);
  font: 10px/1.1 var(--mono);
  letter-spacing: .07em;
  text-transform: uppercase;
}
.top-tools { gap: 20px; }
.office-status { display: flex; align-items: center; gap: 7px; color: var(--muted); font: 11px/1.2 var(--mono); }
.office-status::before { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); content: ''; }
.demo-button {
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid #666359;
  border-radius: 3px;
  color: var(--paper);
  background: #242420;
  font: bold 11px/1.2 var(--mono);
  letter-spacing: .06em;
  white-space: nowrap;
  text-transform: uppercase;
}
.demo-button .icon { width: 15px; height: 15px; }
.demo-button[aria-pressed="true"] { color: var(--lime); border-color: var(--lime); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, .42fr);
  align-items: center;
  gap: 25px;
  padding: 34px 0 30px;
}
.hero-copy { min-width: 0; }
.issue {
  width: fit-content;
  gap: 8px;
  margin-bottom: 15px;
  color: var(--lilac);
  font: bold 11px/1.2 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.issue-code { border: 1px solid #8e7ca9; padding: 4px 6px 3px; border-radius: 2px; }
.hero h1, .receipt h1 {
  font-family: var(--display);
  font-weight: 900;
  font-synthesis: none;
  text-transform: uppercase;
}
.hero h1 {
  font-size: clamp(65px, 8.4vw, 125px);
  line-height: .87;
  letter-spacing: -.025em;
}
.hero-line {
  display: block;
  width: max-content;
  transform: scaleX(var(--fit, 1));
  transform-origin: left;
}
.hero-line:last-child { color: var(--lime); margin-top: 4px; }
.off-by-one { position: relative; top: 1px; left: 1px; }
.hero-copy > p {
  max-width: 50ch;
  margin-top: 17px;
  color: #cbc7b9;
  font-size: clamp(14px, 1.3vw, 17px);
  line-height: 1.5;
}
.hero-figure { width: min(100%, 371px); margin: 0 0 0 auto; transform: rotate(2deg); }
.hero-figure > svg { display: block; width: 100%; height: auto; }

.procedure { position: relative; border-top: 1px solid var(--line); }
.procedure::before {
  position: absolute;
  top: -1px;
  left: 0;
  width: 82px;
  border-top: 2px solid var(--lime);
  content: '';
}
.procedure-heading {
  display: flex;
  min-height: 53px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.procedure-heading h2 {
  font: bold 12px/1.2 var(--mono);
  letter-spacing: .115em;
  text-transform: uppercase;
}
.count { gap: 9px; white-space: nowrap; color: var(--muted); font: 11px/1.2 var(--mono); }
.count b { color: var(--paper); }
.segments { display: flex; gap: 3px; margin-left: 3px; }
.segments i { width: 16px; height: 6px; background: #49483e; transform: skewX(-10deg); }
.segments i.active { background: var(--lime); }
.tasks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.task {
  --accent: var(--lime);
  min-width: 0;
  padding: 15px 16px 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  box-shadow: 0 4px 0 #10100e;
}
.task:nth-child(2) { --accent: var(--lilac); }
.task:nth-child(3) { --accent: var(--biscuit); }
.task-type {
  justify-content: space-between;
  gap: 8px;
  color: var(--accent);
  font: bold 11px/1.25 var(--mono);
  letter-spacing: .09em;
  text-transform: uppercase;
}
.task-type .icon { width: 17px; height: 17px; }
.task-type span span { opacity: .68; }
.task h3 {
  margin: 8px 0 3px;
  font-size: clamp(21px, 2.15vw, 29px);
  letter-spacing: -.05em;
  line-height: 1.12;
}
.task:nth-child(2) h3 { position: relative; left: 1px; }
.task-lede { min-height: 2.8em; color: var(--muted); font-size: 13px; line-height: 1.4; }
.well {
  position: relative;
  height: 137px;
  margin-top: 4px;
  border: 1px solid #37362f;
  border-radius: 3px;
  background: var(--well);
}
.task-foot {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font: 11px/1.3 var(--mono);
}
.task-foot::before {
  width: 6px;
  height: 6px;
  flex: none;
  border: 1px solid #918e80;
  transform: rotate(45deg);
  content: '';
}
.task[data-done="true"] .task-foot { color: var(--accent); }
.task[data-done="true"] .task-foot::before { border-color: var(--accent); background: var(--accent); }
.aim-well {
  background-image: linear-gradient(#f3efe312 1px, transparent 1px), linear-gradient(90deg, #f3efe312 1px, transparent 1px);
  background-size: 17px 17px;
  background-position: center;
}
.aim-well::before, .aim-well::after {
  position: absolute;
  top: 5px;
  color: #928f81;
  font: 13px/1 var(--mono);
  content: '+';
  pointer-events: none;
}
.aim-well::before { left: 6px; }
.aim-well::after { right: 6px; }
.catch-button {
  position: absolute;
  z-index: 1;
  top: 52%;
  left: 50%;
  display: flex;
  min-width: 115px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 4px 10px;
  border: 1px solid var(--lime);
  border-radius: 3px;
  color: #1e2112;
  background: var(--lime);
  box-shadow: 3px 4px 0 #65723c;
  transform: translate(-50%, -50%) rotate(-3deg);
  transition: left .24s cubic-bezier(.2,.8,.3,1), top .24s cubic-bezier(.2,.8,.3,1), transform .24s;
  font: bold 12px/1.2 var(--mono);
  white-space: nowrap;
}
.catch-button .icon { width: 15px; height: 15px; }
.catch-button[data-spot="1"] { left: 73%; top: 29%; transform: translate(-50%, -50%) rotate(5deg); }
.catch-button[data-spot="2"] { left: 29%; top: 72%; transform: translate(-50%, -50%) rotate(-7deg); }
.catch-button:disabled { box-shadow: none; background: #2e3521; color: var(--lime); transform: translate(-50%, -50%); }
.meter-well { padding: 11px 12px 10px; }
.meter-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font: 10px/1.2 var(--mono);
  color: var(--muted);
  letter-spacing: .075em;
  text-transform: uppercase;
}
.meter-caption output { color: var(--lilac); font: bold 23px/1 var(--mono); letter-spacing: -.065em; }
.meter {
  height: 14px;
  margin: 7px 0 11px;
  padding: 2px;
  border: 1px solid #575160;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, #27252a 0 10px, #353139 10px 11px);
  overflow: hidden;
}
.meter-fill {
  width: 0;
  height: 100%;
  background: repeating-linear-gradient(131deg, var(--lilac) 0 7px, #aa8cd8 7px 10px);
  transition: width .18s linear;
}
.meter-fill.slipping { transition: width .48s cubic-bezier(.22,.75,.44,1); }
.progress-button, .cookie-close {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  border: 1px solid #87729b;
  border-radius: 3px;
  color: var(--lilac);
  background: #30293a;
  padding: 0 8px;
  font: bold 11px/1.2 var(--mono);
}
.progress-button { width: 100%; }
.progress-button .icon { width: 15px; height: 15px; }
.progress-button:disabled { opacity: .76; }
.cookies-well { display: grid; align-content: center; gap: 5px; padding: 6px 8px; }
.cookie-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 3px 3px 3px 8px;
  border: 1px solid #65604f;
  border-radius: 3px;
  background: #2b2822;
  box-shadow: 2px 2px 0 #11110f;
}
.cookie-row:first-child { transform: rotate(-1.2deg); }
.cookie-row:nth-child(2) { transform: rotate(1.3deg); }
.cookie-row.reissued { border-color: #a38b66; transform: translateX(2px) rotate(2.3deg); }
.cookie-row > .icon { width: 18px; height: 18px; color: var(--biscuit); }
.cookie-copy { min-width: 0; flex: 1; font-size: 12px; font-weight: 720; line-height: 1.13; }
.cookie-close { min-width: 66px; border-color: #716853; color: var(--paper); background: #393326; flex: none; }
.cookie-close .icon { width: 12px; height: 12px; }
.cookie-cleared { text-align: center; color: var(--accent); font: bold 11px/1.4 var(--mono); }
.cookie-cleared svg { display: block; width: 30px; height: 30px; margin: 0 auto 7px; }

.receipt-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: 18px 0 24px;
  padding: 9px 10px 9px 13px;
  border: 1px dashed #625f52;
  border-radius: 4px;
  background: #1b1b18;
}
.receipt-info { gap: 11px; }
.receipt-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  flex: none;
  border: 1px solid #575448;
  border-radius: 3px;
  color: var(--lime);
  background: #282821;
  transform: rotate(-3deg);
}
.receipt-info strong { display: block; font-size: 14px; line-height: 1.2; }
.receipt-info p { margin-top: 3px; color: var(--muted); font: 11px/1.25 var(--mono); }
.finish-button, .restart-button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--lime);
  border-radius: 3px;
  background: var(--lime);
  color: #1e2112;
  padding: 0 14px;
  font: bold 12px/1.2 var(--mono);
  white-space: nowrap;
}
.finish-button .icon, .restart-button .icon { width: 16px; height: 16px; }
.finish-button:disabled { border-color: #575947; background: #2f3125; color: #c7cbad; }
@media (hover: hover) { button:not(:disabled):hover { filter: brightness(1.14); } }

.receipt-screen {
  min-height: calc(100vh - 70px);
  display: grid;
  place-items: center;
  padding: 36px 11px;
}
.receipt {
  width: min(615px, 100%);
  position: relative;
  color: #242020;
  background: radial-gradient(#29212326 .65px, transparent .9px) 0 0 / 5px 5px, #efe8d5;
  padding: clamp(18px, 6vw, 47px);
  box-shadow: 9px 11px 0 #0f0f0e, 11px 13px 0 #49463b;
  transform: rotate(-1.4deg);
}
.receipt::before, .receipt::after {
  position: absolute;
  inset-inline: 0;
  height: 10px;
  background: radial-gradient(circle, var(--bg) 4px, transparent 4.7px) 0 0 / 15px 10px repeat-x;
  content: '';
  pointer-events: none;
}
.receipt::before { top: -5px; }
.receipt::after { bottom: -5px; }
.receipt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px dashed #777065;
  font: bold 11px/1.25 var(--mono);
  letter-spacing: .05em;
  text-transform: uppercase;
}
.receipt-head span:last-child { color: #654c77; white-space: nowrap; }
.receipt h1 {
  margin-top: 18px;
  font-size: clamp(30px, 7.1vw, 71px);
  line-height: .94;
  letter-spacing: -.025em;
}
.receipt p { margin-top: 11px; font-size: 15px; }
.receipt-items { margin: 21px 0 19px; padding: 11px 0; border-block: 1px dashed #777065; }
.receipt-items div { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; font: 13px/1.25 var(--mono); }
.receipt-items dt, .receipt-items dd { margin: 0; }
.receipt-items dd { font-weight: bold; text-align: right; }
.receipt-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.restart-button { color: var(--paper); background: #242020; border-color: #242020; }
.restart-button:focus-visible { outline-color: #242020; }
.approved {
  color: #654c77;
  border: 2px solid currentColor;
  border-radius: 4px;
  padding: 4px 6px;
  transform: rotate(8deg);
  font: bold 11px/1.2 var(--mono);
  letter-spacing: .045em;
}
.demo-pointer {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  width: 31px;
  height: 31px;
  color: var(--lilac);
  pointer-events: none;
  transform: translate(var(--x, 0px), var(--y, 0px));
  transition: transform .35s ease;
}
.demo-pointer svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(1px 2px 0 #171715); }
.demo-pointer.press svg { animation: tap .29s ease; }
@keyframes tap { 50% { transform: scale(.78); } }

@media (max-width: 1020px) {
  .shell { width: calc(100% - 56px); }
  .hero { gap: 12px; }
}
@media (max-width: 760px) {
  .shell { width: calc(100% - 36px); }
  .office-status { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr) minmax(126px, .36fr); padding-block: 27px 24px; }
  .hero h1 { font-size: clamp(42px, 10vw, 75px); }
  .tasks { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .task h3 { font-size: 27px; }
  .task-lede { min-height: auto; margin-bottom: 12px; }
  .receipt-bar { margin-top: 14px; }
}
@media (max-width: 490px) {
  .masthead-inner { min-height: 65px; gap: 8px; }
  .brand { gap: 8px; }
  .brand-mark { width: 31px; height: 31px; }
  .brand-mark svg { width: 21px; height: 21px; }
  .brand-name { font-size: 12px; }
  .brand-small { font-size: 8px; }
  .demo-button { padding-inline: 7px; gap: 5px; font-size: 10px; }
  .hero { display: block; position: relative; }
  .hero h1 { font-size: 12.8vw; }
  .hero-copy > p { width: 64%; min-height: 70px; margin-top: 12px; }
  .hero-figure { position: absolute; width: 35%; bottom: 11px; right: 0; }
  .receipt-info p { font-size: 10px; }
  .receipt-icon { display: none; }
  .finish-button { gap: 6px; padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
</style>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0" aria-hidden="true" style="position:absolute">
  <symbol id="i-logo" viewBox="0 0 24 24"><path d="M4 4h16v6H4zM4 14h10v6H4z" fill="none" stroke="currentColor" stroke-width="2"/><path d="M17 15h4v5h-4z" fill="currentColor"/><path d="M8 7h8" stroke="currentColor" stroke-width="1.5"/></symbol>
  <symbol id="i-play" viewBox="0 0 24 24"><path d="m8 5 11 7-11 7z"/></symbol>
  <symbol id="i-stop" viewBox="0 0 24 24"><rect x="6" y="6" width="12" height="12" rx="1"/></symbol>
  <symbol id="i-target" viewBox="0 0 24 24"><circle cx="12" cy="12" r="6"/><path d="M12 2v6m0 8v6M2 12h6m8 0h6"/><circle cx="12" cy="12" r="1"/></symbol>
  <symbol id="i-meter" viewBox="0 0 24 24"><path d="M4 18a9 9 0 1 1 16 0zM12 14l4-4"/><circle cx="12" cy="14" r="1"/></symbol>
  <symbol id="i-cookie" viewBox="0 0 24 24"><path d="M20.5 12.3A8.7 8.7 0 1 1 11.7 3.5c-.2 2.8 1.2 4.1 3.8 4.4 0 2.8 1.8 4.5 5 4.4Z"/><path d="M8 10h.02m4 2h.02m-4 3h.02m5 2h.02"/></symbol>
  <symbol id="i-close" viewBox="0 0 24 24"><path d="m6 6 12 12M18 6 6 18"/></symbol>
  <symbol id="i-arrow" viewBox="0 0 24 24"><path d="M4 12h15m-6-6 6 6-6 6"/></symbol>
  <symbol id="i-lock" viewBox="0 0 24 24"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4m-4 4v2"/></symbol>
  <symbol id="i-check" viewBox="0 0 24 24"><path d="m5 12 5 5L20 7"/></symbol>
  <symbol id="i-receipt" viewBox="0 0 24 24"><path d="M6 3h12v18l-3-2-3 2-3-2-3 2zM9 8h6m-6 4h6m-6 4h3"/></symbol>
  <symbol id="i-restart" viewBox="0 0 24 24"><path d="M5 11a7 7 0 1 1 1 6M5 5v6h6"/></symbol>
</svg>

<header class="masthead">
  <div class="shell masthead-inner">
    <div class="brand">
      <div class="brand-mark"><svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-logo"/></svg></div>
      <div>
        <div class="brand-name">The Inconvenience Office</div>
        <div class="brand-small">Department of Minor Delays</div>
      </div>
    </div>
    <div class="top-tools">
      <span class="office-status">Operational, technically</span>
      <button class="demo-button" id="demo-toggle" type="button" aria-pressed="false">
        <svg class="icon" aria-hidden="true"><use id="demo-icon" href="#i-play"/></svg>
        <span id="demo-label">Auto demo</span>
      </button>
    </div>
  </div>
</header>

<main id="challenge" class="shell">
  <section class="hero" aria-labelledby="hero-title">
    <div class="hero-copy">
      <div class="issue"><span class="issue-code">Form 00-B</span><span>Patience application</span></div>
      <h1 id="hero-title" tabindex="-1"><span class="hero-line">Please be</span>
        <span class="hero-line">uncomfortable<span class="off-by-one">.</span></span></h1>
      <p>Three simple tasks, made needlessly difficult. Finish them to claim your patience receipt.</p>
    </div>
    <figure class="hero-figure" aria-hidden="true">
      <svg viewBox="0 0 384 288" xmlns="http://www.w3.org/2000/svg">
        <defs>
          <pattern id="art-grid" width="15" height="15" patternUnits="userSpaceOnUse"><path d="M15 0H0v15" fill="none" stroke="#ddd6af" stroke-opacity=".15"/></pattern>
        </defs>
        <rect x="16" y="20" width="354" height="245" rx="2" fill="url(#art-grid)" stroke="#514e40"/>
        <path d="M16 43V20h23m308 0h23v23M16 242v23h23m308 0h23v-23" fill="none" stroke="#a09b80" stroke-width="2"/>
        <path d="M48 201C36 159 62 105 114 77c74-40 174-32 212 10 39 44 11 106-63 142-66 33-150 29-195-5" fill="none" stroke="#d9ee85" stroke-opacity=".66" stroke-width="1.6" stroke-dasharray="3 7"/>
        <path d="m305 72 15 9-17 2M61 212l8 13 12-2M82 68h18m-9-9v18m247 47h14m-7-7v14M124 245h12m-6-6v12" fill="none" stroke="#e0fc77" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
        <path d="m66 126 27-5m-34 21 31-5m-19 20 15-3m212-71 13-12m-7 23 17-6" stroke="#e0fc77" stroke-width="2.5" stroke-linecap="round"/>
        <g fill="none" stroke="#d1b9fc" stroke-width="4.8" stroke-linecap="round" stroke-linejoin="round">
          <path d="M185 194c-8 26-35 37-58 18l-11 10"/>
          <path d="M213 200c18 10 31 19 22 41l19-1"/>
          <path d="M132 138c-15 13-23 16-32 4l-9 2m8-3-5-7"/>
          <path d="M266 142c16-5 21-22 16-32l9-8m-9 9-1-13m2 12 14-1"/>
        </g>
        <g transform="translate(197 142) rotate(12)">
          <path d="M-75-57H71v37q-13 0-13 13t13 13v47H-75V15q13-1 13-14t-13-14z" transform="translate(-5 8)" fill="#726083" stroke="#151514" stroke-width="3"/>
          <path d="M-75-57H71v37q-13 0-13 13t13 13v47H-75V15q13-1 13-14t-13-14z" fill="#d1b9fc" stroke="#171715" stroke-width="3" stroke-linejoin="round"/>
          <path d="M40-50v96" fill="none" stroke="#584367" stroke-width="1.7" stroke-dasharray="3 4"/>
          <path d="M-64-46h24m-24 6h14m93 80h16m-15-5h11m-9-79h12m-11 5h7" fill="none" stroke="#5b466f" stroke-width="1.6" stroke-linecap="round"/>
          <path d="M-53-13q6-5 12-2m48-9q7-1 11 4" fill="none" stroke="#231c29" stroke-width="2.5" stroke-linecap="round"/>
          <ellipse cx="-41" cy="-4" rx="4.2" ry="5.2" fill="#231c29"/>
          <ellipse cx="13" cy="-7" rx="4.2" ry="5.2" fill="#231c29"/>
          <path d="M-25 8q13 11 22-3" fill="none" stroke="#231c29" stroke-width="3.2" stroke-linecap="round"/>
          <path d="M-53 15h7m56-1h7" stroke="#a17eca" stroke-width="2" stroke-linecap="round"/>
          <path d="M-60 38h10m4 0h3m4 0h15m4 0h3m4 0h8" stroke="#5b466f" stroke-width="1.5" stroke-linecap="round"/>
        </g>
        <path d="m298 188 10 39 8-13 14-1z" fill="#e0fc77" stroke="#171715" stroke-width="2.5" stroke-linejoin="round"/>
        <path d="m289 181-6-4m19 4 2-8m-18 17-8 1" stroke="#e0fc77" stroke-width="2" stroke-linecap="round"/>
      </svg>
    </figure>
  </section>

  <section class="procedure" aria-labelledby="procedure-title">
    <div class="procedure-heading">
      <h2 id="procedure-title">The procedure</h2>
      <div class="count" role="status"><span><b id="done-count">0 / 3</b> complete</span><span class="segments" aria-hidden="true"><i></i><i></i><i></i></span></div>
    </div>
    <div class="tasks">
      <article class="task" id="task-catch">
        <div class="task-type"><span><span>01 /</span> Dexterity</span><svg class="icon" aria-hidden="true"><use href="#i-target"/></svg></div>
        <h3>Catch the button</h3>
        <p class="task-lede">It has somewhere else to be.</p>
        <div class="well aim-well">
          <button class="catch-button" id="catch" type="button" data-spot="0">
            <svg class="icon" aria-hidden="true"><use id="catch-icon" href="#i-target"/></svg><span id="catch-label">Catch me</span>
          </button>
        </div>
        <p class="task-foot" id="catch-status" role="status">Attempts logged: 0</p>
      </article>

      <article class="task" id="task-progress">
        <div class="task-type"><span><span>02 /</span> Endurance</span><svg class="icon" aria-hidden="true"><use href="#i-meter"/></svg></div>
        <h3>Make progress</h3>
        <p class="task-lede">The last 1% is a management decision.</p>
        <div class="well meter-well">
          <div class="meter-caption"><span>Completion estimate</span><output id="percent" aria-hidden="true">0%</output></div>
          <div class="meter" id="meter" role="progressbar" aria-label="Completion estimate" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
            <div class="meter-fill" id="meter-fill"></div>
          </div>
          <button class="progress-button" id="progress" type="button">
            <span id="progress-label">Start progress</span><svg class="icon" aria-hidden="true"><use id="progress-icon" href="#i-arrow"/></svg>
          </button>
        </div>
        <p class="task-foot" id="progress-status" role="status">Ready to begin.</p>
      </article>

      <article class="task" id="task-cookies">
        <div class="task-type"><span><span>03 /</span> Paperwork</span><svg class="icon" aria-hidden="true"><use href="#i-cookie"/></svg></div>
        <h3>Dismiss the cookies</h3>
        <p class="task-lede">They take rejection personally.</p>
        <div class="well cookies-well" id="cookies">
          <div class="cookie-row">
            <svg class="icon" aria-hidden="true"><use href="#i-cookie"/></svg>
            <span class="cookie-copy">One tiny cookie?</span>
            <button class="cookie-close" type="button"><svg class="icon" aria-hidden="true"><use href="#i-close"/></svg>Close</button>
          </div>
          <div class="cookie-row" hidden>
            <svg class="icon" aria-hidden="true"><use href="#i-cookie"/></svg>
            <span class="cookie-copy">An unrelated cookie.</span>
            <button class="cookie-close" type="button"><svg class="icon" aria-hidden="true"><use href="#i-close"/></svg>Close</button>
          </div>
          <div class="cookie-cleared" id="cookie-cleared" hidden><svg class="icon" aria-hidden="true"><use href="#i-check"/></svg>Cookie-free zone</div>
        </div>
        <p class="task-foot" id="cookie-status" role="status">1 fictional notice open.</p>
      </article>
    </div>

    <div class="receipt-bar">
      <div class="receipt-info">
        <div class="receipt-icon"><svg class="icon" aria-hidden="true"><use href="#i-receipt"/></svg></div>
        <div><strong>Patience receipt</strong><p id="receipt-note">Complete all three tasks to unlock.</p></div>
      </div>
      <button class="finish-button" id="finish" type="button" disabled>Get my receipt <svg class="icon" aria-hidden="true"><use id="finish-icon" href="#i-lock"/></svg></button>
    </div>
  </section>
</main>

<main class="shell receipt-screen" id="receipt-screen" hidden>
  <article class="receipt" aria-labelledby="receipt-title">
    <div class="receipt-head"><span>The Inconvenience Office</span><span>Receipt 00-B</span></div>
    <h1 id="receipt-title" tabindex="-1">Thank you for<br>your patience.</h1>
    <p>Your application to finish this page has been approved.</p>
    <dl class="receipt-items">
      <div><dt>Buttons caught</dt><dd>1</dd></div>
      <div><dt>Progress made</dt><dd>Eventually</dd></div>
      <div><dt>Cookies remaining</dt><dd>0</dd></div>
      <div><dt>Total charged</dt><dd>One deep sigh</dd></div>
    </dl>
    <div class="receipt-actions">
      <button class="restart-button" id="restart" type="button"><svg class="icon" aria-hidden="true"><use href="#i-restart"/></svg>Start over</button>
      <span class="approved">PROCESSED</span>
    </div>
  </article>
</main>

<div class="demo-pointer" id="demo-pointer" aria-hidden="true" hidden>
  <svg viewBox="0 0 32 32"><path d="m4 3 7 24 5-8 9-1z" fill="currentColor" stroke="#171715" stroke-width="2" stroke-linejoin="round"/></svg>
</div>

<script>
'use strict';

const byId = (id) => document.getElementById(id);
const challenge = byId('challenge');
const receipt = byId('receipt-screen');
const catchButton = byId('catch');
const progressButton = byId('progress');
const finishButton = byId('finish');
const cookieBox = byId('cookies');
const cookieRows = Array.from(cookieBox.querySelectorAll('.cookie-row'));
const segments = Array.from(document.querySelectorAll('.segments i'));
const demoButton = byId('demo-toggle');
const demoPointer = byId('demo-pointer');
const meterFill = byId('meter-fill');
const completed = new Set();

let catchAttempts = 0;
let progressPhase = 'idle';
let progressTimers = [];
let cookiePhase = 0;
let demoRunning = false;
let demoTimers = [];
let interruptedToggleAt = -Infinity;

function setIcon(id, symbol) {
  byId(id).setAttribute('href', '#i-' + symbol);
}

function fitTitle() {
  if (challenge.hidden) return;
  const heading = byId('hero-title');
  if (heading.clientWidth < 3) return;
  for (const line of heading.children) {
    const ratio = (heading.clientWidth - 2) / Math.max(line.offsetWidth, 1);
    line.style.setProperty('--fit', Math.min(1, ratio));
  }
}
if ('ResizeObserver' in window) {
  new ResizeObserver(fitTitle).observe(byId('hero-title'));
} else {
  window.addEventListener('resize', fitTitle);
}

function updateCompleted() {
  byId('done-count').textContent = completed.size + ' / 3';
  segments.forEach((segment, index) => segment.classList.toggle('active', index < completed.size));
  const ready = completed.size === 3;
  finishButton.disabled = !ready;
  setIcon('finish-icon', ready ? 'arrow' : 'lock');
  byId('receipt-note').textContent = ready ? 'Approved for immediate processing.' : 'Complete all three tasks to unlock.';
}

function complete(task) {
  completed.add(task);
  byId('task-' + task).dataset.done = 'true';
  updateCompleted();
}

function tryCatch() {
  if (completed.has('catch')) return;
  catchAttempts += 1;
  if (catchAttempts < 3) {
    catchButton.dataset.spot = String(catchAttempts);
    byId('catch-label').textContent = catchAttempts === 1 ? 'Over here' : 'Try again';
    byId('catch-status').textContent = catchAttempts === 1 ? '1 attempt. It moved.' : '2 attempts. It looks tired.';
    return;
  }
  catchButton.dataset.spot = '0';
  catchButton.disabled = true;
  byId('catch-label').textContent = 'Caught!';
  setIcon('catch-icon', 'check');
  byId('catch-status').textContent = 'Caught after 3 attempts.';
  complete('catch');
}

function setPercent(value) {
  byId('percent').textContent = value + '%';
  byId('meter').setAttribute('aria-valuenow', String(value));
  meterFill.style.width = value + '%';
}

function laterProgress(ms, action) {
  progressTimers.push(setTimeout(action, ms));
}

function advanceProgress() {
  if (progressPhase === 'idle') {
    progressPhase = 'running';
    progressButton.disabled = true;
    byId('progress-label').textContent = 'Processing…';
    byId('progress-status').textContent = 'Estimating the estimate.';
    setPercent(9);
    const ticks = [22, 39, 58, 76, 91, 97, 99];
    ticks.forEach((value, index) => laterProgress(230 * (index + 1), () => setPercent(value)));
    laterProgress(1780, () => {
      byId('progress-status').textContent = '99%. Any moment now.';
    });
    laterProgress(2390, () => {
      meterFill.classList.add('slipping');
      setPercent(74);
      byId('progress-status').textContent = 'Setback filed. One nudge left.';
      byId('progress-label').textContent = 'Nudge to 100%';
      progressPhase = 'stalled';
      progressButton.disabled = false;
    });
    return;
  }
  if (progressPhase === 'stalled') {
    progressPhase = 'done';
    meterFill.classList.remove('slipping');
    setPercent(100);
    byId('progress-label').textContent = 'Progress made';
    byId('progress-status').textContent = 'Complete. Somehow.';
    setIcon('progress-icon', 'check');
    progressButton.disabled = true;
    complete('progress');
  }
}

function closeCookie(row) {
  if (completed.has('cookies') || row.hidden) return;
  const moveFocus = row.contains(document.activeElement);
  if (cookiePhase === 0) {
    row.querySelector('.cookie-copy').textContent = 'A follow-up cookie.';
    cookieRows[1].hidden = false;
    byId('cookie-status').textContent = 'The notice has multiplied.';
  } else if (cookiePhase === 1) {
    const replacement = row.cloneNode(true);
    replacement.classList.add('reissued');
    replacement.querySelector('.cookie-copy').textContent = 'The replacement.';
    cookieRows[cookieRows.indexOf(row)] = replacement;
    row.replaceWith(replacement);
    byId('cookie-status').textContent = 'Close has appointed a successor.';
    if (moveFocus) replacement.querySelector('button').focus({ preventScroll: true });
  } else {
    row.hidden = true;
    const remaining = cookieRows.find((cookie) => !cookie.hidden);
    if (remaining) {
      byId('cookie-status').textContent = '1 stubborn notice left.';
      if (moveFocus) remaining.querySelector('button').focus({ preventScroll: true });
    } else {
      byId('cookie-cleared').hidden = false;
      byId('cookie-status').textContent = 'All notices dismissed.';
      complete('cookies');
      if (moveFocus && !finishButton.disabled) finishButton.focus({ preventScroll: true });
    }
  }
  cookiePhase += 1;
}

function showReceipt(focusHeading) {
  if (completed.size !== 3) return;
  challenge.hidden = true;
  receipt.hidden = false;
  window.scrollTo(0, 0);
  if (focusHeading) byId('receipt-title').focus({ preventScroll: true });
}

function resetScene(focusHeading) {
  progressTimers.forEach(clearTimeout);
  progressTimers = [];
  catchAttempts = 0;
  progressPhase = 'idle';
  cookiePhase = 0;
  completed.clear();
  for (const task of document.querySelectorAll('.task')) delete task.dataset.done;

  catchButton.disabled = false;
  catchButton.dataset.spot = '0';
  setIcon('catch-icon', 'target');
  byId('catch-label').textContent = 'Catch me';
  byId('catch-status').textContent = 'Attempts logged: 0';

  meterFill.classList.remove('slipping');
  setPercent(0);
  progressButton.disabled = false;
  setIcon('progress-icon', 'arrow');
  byId('progress-label').textContent = 'Start progress';
  byId('progress-status').textContent = 'Ready to begin.';

  const notices = ['One tiny cookie?', 'An unrelated cookie.'];
  cookieRows.forEach((row, index) => {
    row.querySelector('.cookie-copy').textContent = notices[index];
    row.classList.remove('reissued');
    row.hidden = index !== 0;
  });
  byId('cookie-cleared').hidden = true;
  byId('cookie-status').textContent = '1 fictional notice open.';

  updateCompleted();
  receipt.hidden = true;
  challenge.hidden = false;
  fitTitle();
  window.scrollTo(0, 0);
  if (focusHeading) byId('hero-title').focus({ preventScroll: true });
}

function aimAt(button) {
  if (button.getClientRects().length === 0) return;
  button.scrollIntoView({ block: 'nearest', inline: 'nearest' });
  const bounds = button.getBoundingClientRect();
  demoPointer.style.setProperty('--x', (bounds.left + bounds.width * .6) + 'px');
  demoPointer.style.setProperty('--y', (bounds.top + bounds.height * .53) + 'px');
  demoPointer.hidden = false;
}

function demoTap(action) {
  demoPointer.classList.remove('press');
  void demoPointer.offsetWidth;
  demoPointer.classList.add('press');
  action();
}

function demoAfter(ms, action) {
  demoTimers.push(setTimeout(() => {
    if (demoRunning) action();
  }, ms));
}

function playDemoLoop() {
  demoTimers = [];
  demoPointer.hidden = true;
  resetScene(false);

  demoAfter(600, () => aimAt(catchButton));
  demoAfter(1190, () => demoTap(tryCatch));
  demoAfter(1700, () => aimAt(catchButton));
  demoAfter(2240, () => demoTap(tryCatch));
  demoAfter(2750, () => aimAt(catchButton));
  demoAfter(3310, () => demoTap(tryCatch));

  demoAfter(4100, () => aimAt(progressButton));
  demoAfter(4600, () => demoTap(advanceProgress));
  demoAfter(7640, () => demoTap(advanceProgress));

  demoAfter(8480, () => aimAt(cookieRows[0].querySelector('button')));
  demoAfter(9050, () => demoTap(() => closeCookie(cookieRows[0])));
  demoAfter(9590, () => aimAt(cookieRows[0].querySelector('button')));
  demoAfter(10150, () => demoTap(() => closeCookie(cookieRows[0])));
  demoAfter(10750, () => aimAt(cookieRows[0].querySelector('button')));
  demoAfter(11320, () => demoTap(() => closeCookie(cookieRows[0])));
  demoAfter(12020, () => aimAt(cookieRows[1].querySelector('button')));
  demoAfter(12620, () => demoTap(() => closeCookie(cookieRows[1])));

  demoAfter(13800, () => aimAt(finishButton));
  demoAfter(14550, () => {
    demoTap(() => showReceipt(false));
    demoPointer.hidden = true;
  });
  demoAfter(20000, playDemoLoop);
}

function setDemo(running) {
  demoRunning = running;
  demoButton.setAttribute('aria-pressed', String(running));
  byId('demo-label').textContent = running ? 'Stop demo' : 'Auto demo';
  setIcon('demo-icon', running ? 'stop' : 'play');
  if (running) {
    playDemoLoop();
    return;
  }
  demoTimers.forEach(clearTimeout);
  demoTimers = [];
  demoPointer.hidden = true;
}

function interruptDemo(event) {
  if (!demoRunning || !event.isTrusted) return;
  if (event.target instanceof Element && event.target.closest('#demo-toggle')) {
    interruptedToggleAt = performance.now();
  }
  setDemo(false);
}

catchButton.addEventListener('click', tryCatch);
progressButton.addEventListener('click', advanceProgress);
cookieBox.addEventListener('click', (event) => {
  const button = event.target.closest('.cookie-close');
  if (button) closeCookie(button.closest('.cookie-row'));
});
finishButton.addEventListener('click', () => showReceipt(true));
byId('restart').addEventListener('click', () => resetScene(true));
demoButton.addEventListener('click', (event) => {
  if (event.detail > 0 && performance.now() - interruptedToggleAt < 1000) {
    interruptedToggleAt = -Infinity;
    return;
  }
  setDemo(!demoRunning);
});
if ('PointerEvent' in window) {
  document.addEventListener('pointerdown', interruptDemo, { capture: true, passive: true });
} else {
  document.addEventListener('touchstart', interruptDemo, { capture: true, passive: true });
  document.addEventListener('mousedown', interruptDemo, { capture: true, passive: true });
}
document.addEventListener('keydown', (event) => {
  if (event.key === 'Escape' && demoRunning) setDemo(false);
});

fitTitle();
if (window.location.hash === '#demo') setDemo(true);
</script>
</body>
</html>