* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: #0a0a0a; }
body {
  background: #0a0a0a;
  color: #eee;
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  overflow-x: hidden;
}

/* the living plate stays fixed; scrolling changes the developing bath */
#field {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh; height: 100dvh;
  display: block; z-index: 0;
  touch-action: pan-y;
}

/* scroll range */
.spacer { height: 620vh; pointer-events: none; }

/* crisp UI overlay — sharp + stable, sits over the dithered plate */
#ui {
  position: fixed; inset: 0; z-index: 5; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
#tag {
  position: absolute; top: 35vh; left: 0; right: 0; margin: 0;
  padding: 0 20px;
  font-size: clamp(11px, 1.7vw, 20px); letter-spacing: 0.14em; text-transform: uppercase;
  color: #fff; mix-blend-mode: difference;
}
#cta {
  position: absolute; top: 57vh; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
#dl {
  pointer-events: auto; text-decoration: none; cursor: pointer;
  font-size: clamp(15px, 2.2vw, 26px); font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase;
  padding: 0.62em 1.15em; border: 3px solid #efeadd;
  background: #0a0a0a; color: #efeadd;   /* recoloured per-bath from JS */
  transition: transform .05s steps(2);
}
#dl:hover { transform: translateY(-2px); }
#dl:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
#hint {
  margin: 0; font-size: clamp(10px, 1.3vw, 14px); letter-spacing: 0.16em; text-transform: uppercase;
  color: #fff; mix-blend-mode: difference; opacity: 0.9;
}

/* live darkroom readout — difference blend keeps it legible over any palette */
#readout {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4;
  display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap;
  padding: 11px 18px calc(11px + env(safe-area-inset-bottom));
  font-size: 12px; letter-spacing: 0.11em; text-transform: uppercase;
  color: #fff; mix-blend-mode: difference; pointer-events: none;
}
#readout .rk { opacity: 0.55; margin-left: 6px; }
#readout .grow { flex: 1; }
#readout .rlink { color: #fff; text-decoration: underline; text-underline-offset: 3px; pointer-events: auto; }

/* accessible content, present but visually offscreen (canvas is the presentation) */
.a11y {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* fallback plate (shown only when WebGL2 is unavailable) */
.fallback { display: none; }
body.no-gl #field, body.no-gl #readout, body.no-gl #dl, body.no-gl .spacer { display: none; }
body.no-gl { overflow-y: auto; }
body.no-gl .fallback {
  display: grid; place-items: center; min-height: 100vh; gap: 0; position: relative;
}
body.no-gl .fallback img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  image-rendering: pixelated; opacity: 0.85;
}
body.no-gl .fb-body {
  position: relative; text-align: center; background: rgba(10,10,10,0.72);
  border: 2px solid #efeadd; padding: 30px 34px; color: #efeadd; max-width: 90vw;
}
body.no-gl .fb-mark { font-weight: 800; font-size: clamp(28px, 8vw, 60px); letter-spacing: 0.08em; margin: 0 0 8px; }
body.no-gl .fb-body a {
  display: inline-block; margin-top: 18px; color: #0a0a0a; background: #efeadd;
  padding: 12px 18px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; text-decoration: none;
  border: 2px solid #efeadd;
}
