{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"ray-marched-liquid-chrome-word-on-a-mirror-floor-with-a-mercury-bead-that-chases-the-pointer","type":"registry:block","title":"Ray-Marched Liquid Chrome Word on a Mirror Floor with a Mercury Bead That Chases the Pointer","description":"WebGL text effect: type a word and it is ray-marched as poured chrome on a mirror floor and a mercury bead chases the pointer. Free React and HTML code.","dependencies":["framer-motion"],"files":[{"path":"components/we-inc/ray-marched-liquid-chrome-word-on-a-mirror-floor-with-a-mercury-bead-that-chases-the-pointer.tsx","type":"registry:component","content":"import { useEffect, useRef, useState } from \"react\";\nimport type { PointerEvent as ReactPointerEvent } from \"react\";\nimport { useReducedMotion } from \"framer-motion\";\n\n// The words the piece plays through by itself until a visitor types one.\nconst WORDS = [\"LIQUID\", \"CHROME\", \"MOLTEN\"];\nconst MAX_LETTERS = 8;\n// Interface type only. The chrome word never touches a font: see GLYPHS.\nconst FACE = '\"Inter Tight\", \"Inter\", system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif';\n/*\n * The typeface, drawn here so every device makes the same letters. Each glyph is the centre\n * line of a round-ended stroke: [advance width, SVG path]. The box is 74 units tall (0 is the\n * top of the centre line, 74 the bottom) and the stroke is STEM units thick, so a capital is\n * 74 + STEM = 100 units high.\n */\nconst STEM = 26;\nconst GAP = 9;\nconst O = \"M37 0A37 37 0 1 0 37 74A37 37 0 1 0 37 0\";\nconst GLYPHS: Record<string, [number, string]> = {\n  A: [62, \"M0 74L31 0L62 74M13 50L49 50\"],\n  B: [50, \"M0 0L0 74M0 0L28 0A18 18 0 0 1 28 36L0 36M28 36L31 36A19 19 0 0 1 31 74L0 74\"],\n  C: [64, \"M63 10.7A37 37 0 1 0 63 63.3\"],\n  D: [56, \"M0 0L0 74L19 74A37 37 0 0 0 19 0Z\"],\n  E: [44, \"M44 0L0 0L0 74L44 74M0 37L38 37\"],\n  F: [44, \"M44 0L0 0L0 74M0 37L36 37\"],\n  G: [74, \"M63 10.7A37 37 0 1 0 74 37L42 37\"],\n  H: [54, \"M0 0L0 74M54 0L54 74M0 37L54 37\"],\n  I: [0, \"M0 0L0 74\"],\n  J: [40, \"M40 0L40 54A20 20 0 0 1 0 54\"],\n  K: [52, \"M0 0L0 74M50 0L0 44M18 30L52 74\"],\n  L: [42, \"M0 0L0 74L42 74\"],\n  M: [72, \"M0 74L0 0L36 52L72 0L72 74\"],\n  N: [56, \"M0 74L0 0L56 74L56 0\"],\n  O: [74, O],\n  P: [48, \"M0 74L0 0L27 0A20 20 0 0 1 27 40L0 40\"],\n  Q: [74, O + \"M58 58L75 79\"],\n  R: [50, \"M0 74L0 0L27 0A20 20 0 0 1 27 40L0 40M24 40L50 74\"],\n  S: [46, \"M44 12C40 2 32 0 24 0C10 0 3 9 3 19C3 30 12 34 24 37C36 40 45 44 45 55C45 65 38 74 24 74C14 74 5 70 1 60\"],\n  T: [54, \"M0 0L54 0M27 0L27 74\"],\n  U: [54, \"M0 0L0 47A27 27 0 0 0 54 47L54 0\"],\n  V: [60, \"M0 0L30 74L60 0\"],\n  W: [88, \"M0 0L22 74L44 14L66 74L88 0\"],\n  X: [54, \"M0 0L54 74M54 0L0 74\"],\n  Y: [58, \"M0 0L29 38L58 0M29 38L29 74\"],\n  Z: [50, \"M0 0L50 0L0 74L50 74\"],\n  \"0\": [50, \"M25 0A25 37 0 1 0 25 74A25 37 0 1 0 25 0\"],\n  \"1\": [22, \"M0 14L22 0L22 74\"],\n  \"2\": [48, \"M2 18A22 20 0 1 1 40 34L0 74L48 74\"],\n  \"3\": [46, \"M3 9C10 2 16 0 24 0C36 0 44 8 44 18C44 30 34 37 20 37C36 37 46 44 46 55C46 66 37 74 24 74C14 74 6 71 0 63\"],\n  \"4\": [54, \"M40 74L40 0L0 52L54 52\"],\n  \"5\": [46, \"M42 0L6 0L3 32C10 27 16 26 23 26C37 26 46 36 46 50C46 64 37 74 23 74C13 74 5 70 0 62\"],\n  \"6\": [48, \"M38 2C16 2 0 22 0 50A24 24 0 1 0 48 50A24 24 0 1 0 0 50\"],\n  \"7\": [48, \"M0 0L48 0L18 74\"],\n  \"8\": [46, \"M23 0A17 17.5 0 1 0 23 35A17 17.5 0 1 0 23 0M23 35A23 19.5 0 1 0 23 74A23 19.5 0 1 0 23 35\"],\n  \"9\": [48, \"M10 72C32 72 48 52 48 24A24 24 0 1 0 0 24A24 24 0 1 0 48 24\"],\n  \"&\": [60, \"M58 74L14 22C8 14 12 0 24 0C36 0 40 14 32 22L10 42C0 52 4 74 24 74C40 74 52 60 56 40\"],\n  \"!\": [0, \"M0 0L0 44M0 73L0 74\"],\n  \"?\": [40, \"M0 14C2 4 10 0 20 0C32 0 40 8 40 18C40 34 20 32 20 50M20 73L20 74\"],\n  \"+\": [44, \"M0 37L44 37M22 15L22 59\"],\n  \"-\": [30, \"M0 40L30 40\"],\n};\n/* Lay a word out: where each centre line starts, and the full inked width, in glyph units. */\nfunction setWord(word: string) {\n  const out: { x: number; d: string }[] = [];\n  let x = STEM / 2;\n  for (const ch of word) {\n    const g = GLYPHS[ch];\n    if (!g) continue;\n    out.push({ x, d: g[1] });\n    x += g[0] + STEM + GAP;\n  }\n  return { glyphs: out, width: Math.max(STEM, x - STEM / 2 - GAP) };\n}\n// How fat the letters are blown. 1 gives round tubes, 1.5 is swollen.\nconst INFLATE = 1.45;\n// Where the camera stands, in radians round the word. 0 is square on.\nconst YAW = 0.24;\n// Seconds a word takes to melt into the next one.\nconst MELT = 1.15;\n\n// The glyph field: 4 units wide, 1 unit tall, baseline 0.2 up from the bottom edge.\nconst TW = 2048;\nconst TH = 512;\nconst BASE = 0.2;\nconst CAP = 0.6;\n\nconst clean = (s: string) => s.toUpperCase().replace(/[^A-Z0-9&!?+\\-]/g, \"\").slice(0, MAX_LETTERS);\n\n/* One dimensional squared distance transform (Felzenszwalb and Huttenlocher). */\nfunction edt1d(f: Float32Array, n: number, d: Float32Array, v: Int32Array, z: Float32Array) {\n  let k = 0;\n  v[0] = 0;\n  z[0] = -1e20;\n  z[1] = 1e20;\n  for (let q = 1; q < n; q++) {\n    let s = 0;\n    for (;;) {\n      const p = v[k];\n      s = (f[q] + q * q - (f[p] + p * p)) / (2 * q - 2 * p);\n      if (s <= z[k] && k > 0) k--;\n      else break;\n    }\n    k++;\n    v[k] = q;\n    z[k] = s;\n    z[k + 1] = 1e20;\n  }\n  k = 0;\n  for (let q = 0; q < n; q++) {\n    while (z[k + 1] < q) k++;\n    const p = v[k];\n    d[q] = (q - p) * (q - p) + f[p];\n  }\n}\n\n/* Relax the membrane equation (laplacian h = -1, h = 0 outside the ink) in place. */\nfunction relax(h: Float32Array, ink: Uint8Array, w: number, hgt: number, cell: number, omega: number, rounds: number) {\n  const c2 = cell * cell;\n  for (let it = 0; it < rounds; it++) {\n    for (let y = 1; y < hgt - 1; y++) {\n      const row = y * w;\n      for (let x = 1; x < w - 1; x++) {\n        const i = row + x;\n        if (ink[i]) h[i] += omega * ((h[i - 1] + h[i + 1] + h[i - w] + h[i + w] + c2) * 0.25 - h[i]);\n      }\n    }\n  }\n}\n\nfunction shrinkInk(src: Uint8Array, w: number, hgt: number) {\n  const W = w >> 1;\n  const H = hgt >> 1;\n  const out = new Uint8Array(W * H);\n  for (let y = 0; y < H; y++)\n    for (let x = 0; x < W; x++) {\n      const i = y * 2 * w + x * 2;\n      out[y * W + x] = src[i] + src[i + 1] + src[i + w] + src[i + w + 1] >= 2 ? 1 : 0;\n    }\n  return out;\n}\n\nfunction grow(src: Float32Array, W: number, H: number, ink: Uint8Array) {\n  const w = W * 2;\n  const h = H * 2;\n  const out = new Float32Array(w * h);\n  for (let y = 0; y < h; y++) {\n    const fy = Math.min(H - 1.001, Math.max(0, (y - 0.5) / 2));\n    const y0 = fy | 0;\n    const ty = fy - y0;\n    for (let x = 0; x < w; x++) {\n      const i = y * w + x;\n      if (!ink[i]) continue;\n      const fx = Math.min(W - 1.001, Math.max(0, (x - 0.5) / 2));\n      const x0 = fx | 0;\n      const tx = fx - x0;\n      const a = y0 * W + x0;\n      out[i] = (src[a] * (1 - tx) + src[a + 1] * tx) * (1 - ty) + (src[a + W] * (1 - tx) + src[a + W + 1] * tx) * ty;\n    }\n  }\n  return out;\n}\n\n/*\n * Bake a word into a field the shader can ray-march.\n * Red holds an inflation height h: inside the ink it is the shape of a soap film blown up\n * through the letter outline, so sqrt(2h) is a round, seamless cushion. Outside it falls\n * away with distance. Green and blue hold the slope of h, so one texture read gives the\n * shader both the surface and the way to it.\n */\nfunction bake(word: string, scratch: HTMLCanvasElement): { data: Float32Array; half: number } {\n  scratch.width = TW;\n  scratch.height = TH;\n  const c = scratch.getContext(\"2d\", { willReadFrequently: true })!;\n  c.clearRect(0, 0, TW, TH);\n  const data = new Float32Array(TW * TH * 4);\n  const set = setWord(word);\n  const unit = Math.min((CAP * TH) / (74 + STEM), (TW - 230) / set.width);\n  const width = set.width * unit;\n  const left = TW / 2 - width / 2;\n  const top = TH * (1 - BASE) - (74 + STEM / 2) * unit;\n  c.strokeStyle = \"#fff\";\n  c.lineWidth = STEM;\n  c.lineCap = \"round\";\n  c.lineJoin = \"round\";\n  for (const g of set.glyphs) {\n    c.setTransform(unit, 0, 0, unit, left + g.x * unit, top);\n    c.stroke(new Path2D(g.d));\n  }\n  c.setTransform(1, 0, 0, 1, 0, 0);\n  const px = c.getImageData(0, 0, TW, TH).data;\n\n  // Ink mask, stored bottom row first so +y is up.\n  const ink0 = new Uint8Array(TW * TH);\n  for (let y = 0; y < TH; y++) {\n    const src = (TH - 1 - y) * TW * 4 + 3;\n    for (let x = 0; x < TW; x++) ink0[y * TW + x] = px[src + x * 4] > 127 ? 1 : 0;\n  }\n  for (let x = 0; x < TW; x++) ink0[x] = ink0[(TH - 1) * TW + x] = 0;\n  const ink1 = shrinkInk(ink0, TW, TH);\n  const ink2 = shrinkInk(ink1, TW >> 1, TH >> 1);\n  const cell = 1 / TH;\n\n  // Coarse to fine: the slow, wide part of the answer is found on the small grid.\n  let h2 = new Float32Array((TW >> 2) * (TH >> 2));\n  relax(h2, ink2, TW >> 2, TH >> 2, cell * 4, 1.86, 110);\n  let h1 = grow(h2, TW >> 2, TH >> 2, ink1);\n  relax(h1, ink1, TW >> 1, TH >> 1, cell * 2, 1.5, 22);\n  const h0 = grow(h1, TW >> 1, TH >> 1, ink0);\n  relax(h0, ink0, TW, TH, cell, 1.25, 7);\n  h2 = h1 = new Float32Array(0);\n\n  // Distance to the ink, at half size, for everything outside the letters.\n  const W1 = TW >> 1;\n  const H1 = TH >> 1;\n  const far = new Float32Array(W1 * H1);\n  for (let i = 0; i < far.length; i++) far[i] = ink1[i] ? 0 : 1e12;\n  const n = Math.max(W1, H1);\n  const f = new Float32Array(n);\n  const d = new Float32Array(n);\n  const v = new Int32Array(n);\n  const z = new Float32Array(n + 1);\n  for (let x = 0; x < W1; x++) {\n    for (let y = 0; y < H1; y++) f[y] = far[y * W1 + x];\n    edt1d(f, H1, d, v, z);\n    for (let y = 0; y < H1; y++) far[y * W1 + x] = d[y];\n  }\n  for (let y = 0; y < H1; y++) {\n    for (let x = 0; x < W1; x++) f[x] = far[y * W1 + x];\n    edt1d(f, W1, d, v, z);\n    for (let x = 0; x < W1; x++) far[y * W1 + x] = Math.sqrt(d[x]) * cell * 2;\n  }\n  const field = new Float32Array(TW * TH);\n  const reach = 0.18;\n  const lean = 0.075;\n  for (let y = 0; y < TH; y++)\n    for (let x = 0; x < TW; x++) {\n      const i = y * TW + x;\n      if (ink0[i]) {\n        field[i] = h0[i];\n        continue;\n      }\n      const fx = Math.min(W1 - 1.001, Math.max(0, (x - 0.5) / 2));\n      const fy = Math.min(H1 - 1.001, Math.max(0, (y - 0.5) / 2));\n      const x0 = fx | 0;\n      const y0 = fy | 0;\n      const tx = fx - x0;\n      const ty = fy - y0;\n      const a = y0 * W1 + x0;\n      const dist = Math.min(reach, (far[a] * (1 - tx) + far[a + 1] * tx) * (1 - ty) + (far[a + W1] * (1 - tx) + far[a + W1 + 1] * tx) * ty);\n      field[i] = -(dist * dist * 0.5 + lean * dist);\n    }\n  // Two light box blurs take the stair steps off the outline.\n  const tmp = new Float32Array(TW * TH);\n  for (let pass = 0; pass < 2; pass++) {\n    for (let y = 0; y < TH; y++) {\n      const r = y * TW;\n      for (let x = 2; x < TW - 2; x++) tmp[r + x] = (field[r + x - 2] + field[r + x - 1] + field[r + x] + field[r + x + 1] + field[r + x + 2]) * 0.2;\n    }\n    for (let y = 2; y < TH - 2; y++) {\n      const r = y * TW;\n      for (let x = 2; x < TW - 2; x++) field[r + x] = (tmp[r + x - 2 * TW] + tmp[r + x - TW] + tmp[r + x] + tmp[r + x + TW] + tmp[r + x + 2 * TW]) * 0.2;\n    }\n  }\n  const inv = 0.5 / cell;\n  for (let y = 1; y < TH - 1; y++)\n    for (let x = 1; x < TW - 1; x++) {\n      const i = y * TW + x;\n      const o = i * 4;\n      data[o] = field[i];\n      data[o + 1] = (field[i + 1] - field[i - 1]) * inv;\n      data[o + 2] = (field[i + TW] - field[i - TW]) * inv;\n    }\n  const edge = -(reach * reach * 0.5 + lean * reach);\n  for (let x = 0; x < TW; x++) data[x * 4] = data[((TH - 1) * TW + x) * 4] = edge;\n  for (let y = 0; y < TH; y++) data[y * TW * 4] = data[(y * TW + TW - 1) * 4] = edge;\n  return { data, half: Math.max(0.3, (width / TW) * 2) };\n}\n\nconst VERT = `#version 300 es\nin vec2 p;\nvoid main(){ gl_Position = vec4(p, 0.0, 1.0); }`;\n\nconst FRAG = `#version 300 es\nprecision highp float;\nout vec4 outColor;\nuniform sampler2D uA, uB;\nuniform vec2 uRes;\nuniform float uT, uMix, uSwell, uK, uHW, uFl;\nuniform vec3 uRo, uRt, uUp, uFw;\nuniform vec4 uHead, uTail, uRip, uPush;\n\nconst float FLOOR = 0.016;\nconst float BASE = ${BASE.toFixed(2)};\nconst vec2 TS = vec2(${TW}.0, ${TH}.0);\nconst float WALL = 2.7;\nconst vec3 CHROME = vec3(0.90, 0.92, 0.96);\n\nfloat hash(vec2 p){ p = fract(p * vec2(123.34, 456.21)); p += dot(p, p + 45.32); return fract(p.x * p.y); }\nfloat noise(vec2 p){\n  vec2 i = floor(p), f = fract(p); f = f * f * (3.0 - 2.0 * f);\n  return mix(mix(hash(i), hash(i + vec2(1, 0)), f.x), mix(hash(i + vec2(0, 1)), hash(i + vec2(1, 1)), f.x), f.y);\n}\nfloat fbm(vec2 p){ float a = 0.5, s = 0.0; for (int i = 0; i < 4; i++){ s += a * noise(p); p = p * 2.03 + 7.1; a *= 0.5; } return s; }\n\n/* Smooth (cubic B-spline) read of the glyph field in four taps. */\nvec4 bic(sampler2D s, vec2 uv){\n  vec2 x = uv * TS - 0.5, f = fract(x); x -= f;\n  vec2 f2 = f * f, f3 = f2 * f;\n  vec2 w0 = (1.0 - f) * (1.0 - f) * (1.0 - f) / 6.0;\n  vec2 w1 = (3.0 * f3 - 6.0 * f2 + 4.0) / 6.0;\n  vec2 w3 = f3 / 6.0;\n  vec2 w2 = 1.0 - w0 - w1 - w3;\n  vec2 g0 = w0 + w1, g1 = w2 + w3;\n  vec2 a = (x + w1 / g0 - 0.5) / TS, b = (x + w3 / g1 + 1.5) / TS;\n  return (texture(s, a) * g0.x + texture(s, vec2(b.x, a.y)) * g1.x) * g0.y + (texture(s, vec2(a.x, b.y)) * g0.x + texture(s, b) * g1.x) * g1.y;\n}\nvec4 glyph(vec2 q, bool hq){\n  vec2 uv = vec2(q.x * 0.25 + 0.5, q.y + BASE);\n  vec4 a = hq ? bic(uA, uv) : texture(uA, uv);\n  if (uMix > 0.001){ vec4 b = hq ? bic(uB, uv) : texture(uB, uv); a = mix(a, b, uMix); }\n  return a;\n}\nfloat letters(vec3 p, bool hq){\n  vec2 q = p.xy, dd = q - uPush.xy;\n  q -= uPush.zw * exp(-dot(dd, dd) * 5.0);\n  vec4 f = glyph(q, hq);\n  float k = uK * (1.0 + 0.05 * sin(q.x * 2.3 + uT * 1.1));\n  if (uRip.w > 0.001){ float l = length(q - uRip.xy); k *= 1.0 + uRip.w * sin(24.0 * l - 15.0 * uRip.z) * exp(-2.0 * l); }\n  float G = 2.0 * k * (f.x + uSwell) - p.z * p.z;\n  vec3 g = vec3(2.0 * k * f.yz, 2.0 * p.z);\n  return -G / max(length(g), 2.0 * sqrt(max(-G, 1e-5)));\n}\nfloat bead(vec3 p){\n  vec3 pa = p - uHead.xyz, ba = uTail.xyz - uHead.xyz;\n  float h = clamp(dot(pa, ba) / max(dot(ba, ba), 1e-5), 0.0, 1.0);\n  return length(pa - ba * h) - mix(uHead.w, uTail.w, h);\n}\nfloat smin(float a, float b, float k){ float h = max(k - abs(a - b), 0.0) / k; return min(a, b) - h * h * h * k / 6.0; }\nfloat map(vec3 p, bool hq){ return smin(letters(p, hq), bead(p), 0.11); }\n\nvec3 normalAt(vec3 p, bool hq){\n  float e = hq ? 0.0022 : 0.004;\n  const vec2 k = vec2(1, -1);\n  return normalize(k.xyy * map(p + k.xyy * e, hq) + k.yyx * map(p + k.yyx * e, hq) + k.yxy * map(p + k.yxy * e, hq) + k.xxx * map(p + k.xxx * e, hq));\n}\n\nbool slab(vec3 ro, vec3 rd, out float t0, out float t1){\n  vec3 c = vec3(0.0, 0.42, 0.0), b = vec3(uHW + 0.34, 0.46, 0.3);\n  vec3 m = 1.0 / rd, n = m * (ro - c), k = abs(m) * b;\n  vec3 a = -n - k, z = -n + k;\n  t0 = max(max(a.x, a.y), a.z); t1 = min(min(z.x, z.y), z.z);\n  return t1 > max(t0, 0.0);\n}\n/* Sphere trace inside the word's box. cov is how much of the pixel the surface covers. */\nfloat march(vec3 ro, vec3 rd, int steps, float px, out float cov){\n  cov = 0.0;\n  float t0, t1;\n  if (!slab(ro, rd, t0, t1)) return -1.0;\n  float t = max(t0, 0.0), best = 1e9, bt = t;\n  for (int i = 0; i < steps; i++){\n    float d = map(ro + rd * t, false);\n    if (d < 0.0005 + 0.0004 * t){ cov = 1.0; return t; }\n    float m = d / (px * (t + 0.3) + 1e-6);\n    if (m < best){ best = m; bt = t; }\n    t += d * 0.9;\n    if (t > t1) break;\n  }\n  if (best < 1.0){ cov = 1.0 - best; return bt; }\n  return -1.0;\n}\n\nfloat card(vec3 rd, vec3 c, vec2 s, float e){\n  float a = dot(rd, c);\n  if (a <= 0.0) return 0.0;\n  vec3 u = normalize(cross(vec3(0.0, 1.0, 0.001), c)), v = cross(c, u);\n  vec2 q = vec2(dot(rd, u), dot(rd, v)) / a;\n  vec2 m = smoothstep(s, s - e, abs(q));\n  return m.x * m.y * (0.72 + 0.28 * exp(-dot(q / s, q / s) * 1.4));\n}\n/* The painted back wall: a low ember sun on near-black plum paper. */\nvec3 wall(vec3 P){\n  vec2 d = P.xy - vec2(0.0, 0.5);\n  float r = length(d);\n  float disc = smoothstep(1.36, 1.02, r);\n  float halo = exp(-pow(r / 1.75, 2.0) * 3.0);\n  vec3 c = mix(vec3(0.42, 0.035, 0.03), vec3(0.82, 0.2, 0.035), smoothstep(1.3, 0.2, r));\n  c = mix(c, vec3(1.0, 0.42, 0.09), smoothstep(0.85, 0.0, length(d - vec2(0.0, -0.45))) * 0.85);\n  vec3 col = c * disc + vec3(0.3, 0.015, 0.05) * halo * (1.0 - disc) * 0.5;\n  col += vec3(0.012, 0.005, 0.016);\n  col *= 0.96 + 0.08 * noise(P.xy * 70.0);\n  return col;\n}\n/* Everything that is not the word or the floor: wall, softboxes, strip lights. */\nvec3 dome(vec3 ro, vec3 rd){\n  vec3 col = vec3(0.005, 0.005, 0.009);\n  if (rd.z < -0.02){\n    vec3 P = ro + rd * ((-WALL - ro.z) / rd.z);\n    col += wall(P) * smoothstep(-0.02, -0.22, rd.z);\n  }\n  // key softbox overhead\n  col += vec3(1.0, 0.98, 0.95) * 6.5 * card(rd, normalize(vec3(0.06, 0.88, 0.46)), vec2(1.0, 0.3), 0.08);\n  // the camera side of the room is one long sweep of white paper, bright on the left and\n  // falling away to the right, with a black flag standing in it. This is what gives every\n  // stroke a broad silver body and one clean dark band.\n  float az = atan(rd.x, rd.z);\n  float sweep = smoothstep(2.0, 1.45, abs(az)) * smoothstep(-0.2, 0.05, rd.y) * mix(1.0, 0.5, smoothstep(0.15, 0.8, rd.y));\n  float body = mix(2.1, 0.42, smoothstep(-1.5, 1.0, az));\n  body *= 1.0 - 0.9 * smoothstep(0.5, 0.6, az) * smoothstep(1.02, 0.9, az);\n  col += vec3(0.9, 0.94, 1.0) * body * sweep;\n  // soft amber wash right and two wide rim glows behind the word, all out of frame\n  col += vec3(1.0, 0.5, 0.2) * 2.6 * card(rd, normalize(vec3(0.96, 0.3, 0.1)), vec2(0.3, 0.75), 0.2);\n  col += vec3(0.5, 0.74, 1.0) * 1.6 * card(rd, normalize(vec3(0.85, 0.3, -0.55)), vec2(0.22, 0.6), 0.16);\n  col += vec3(1.0, 0.5, 0.28) * 1.3 * card(rd, normalize(vec3(-0.88, 0.34, -0.5)), vec2(0.2, 0.6), 0.16);\n  // one small bare lamp for glints\n  col += vec3(1.0, 0.96, 0.9) * 12.0 * card(rd, normalize(vec3(0.5, 0.5, 0.72)), vec2(0.05, 0.05), 0.02);\n  return col;\n}\nvec3 floorGlow(vec3 p){\n  vec2 q = (p.xz - vec2(0.0, 0.15)) * vec2(0.4, 0.7);\n  vec3 lit = vec3(0.03, 0.022, 0.024) * exp(-dot(q, q));\n  lit += vec3(0.3, 0.07, 0.03) * exp(-(p.z + WALL) * 0.9) * exp(-p.x * p.x * 0.22);\n  return lit;\n}\n/* Cheap floor, for what the chrome sees of it. */\nvec3 floorLite(vec3 p, vec3 rd){\n  vec3 r = reflect(rd, vec3(0.0, 1.0, 0.0));\n  float F = 0.05 + 0.95 * pow(1.0 - clamp(-rd.y, 0.0, 1.0), 5.0);\n  float near = clamp(letters(p + vec3(0.0, 0.03, 0.0), false) / 0.22, 0.0, 1.0);\n  return (floorGlow(p) + F * dome(p, r)) * mix(0.22, 1.0, near);\n}\nvec3 sky(vec3 p, vec3 r){\n  if (r.y < -0.0005){ vec3 f = p + r * ((FLOOR - p.y) / r.y); if (f.z > -WALL) return floorLite(f, r); }\n  return dome(p, r);\n}\nvec3 chrome(vec3 p, vec3 rd, vec3 n, bool first, float px){\n  vec3 r = reflect(rd, n);\n  float ndv = clamp(dot(n, -rd), 0.0, 1.0);\n  vec3 e = sky(p, r);\n  if (first){\n    // one more bounce, so letters show in each other\n    vec3 o = p + n * 0.02;\n    float cov, t = march(o, r, 40, 0.0, cov);\n    float tf = r.y < 0.0 ? (FLOOR - p.y) / r.y : 1e9;\n    if (cov > 0.5 && t < tf){\n      vec3 q = o + r * t, m = normalAt(q, false);\n      e = mix(e, sky(q, reflect(r, m)) * CHROME * 0.9, smoothstep(0.05, 0.16, t) * smoothstep(1.2, 0.5, t) * smoothstep(0.2, 0.5, ndv));\n    }\n  }\n  float ao = clamp(map(p + n * 0.06, false) / 0.06, 0.0, 1.0);\n  vec3 F = mix(CHROME, vec3(1.0), pow(1.0 - ndv, 5.0));\n  return e * F * mix(0.5, 1.0, ao);\n}\nfloat shadow(vec3 p, vec3 l){\n  float t0, t1;\n  if (!slab(p, l, t0, t1)) return 1.0;\n  float t = max(t0, 0.02), s = 1.0;\n  for (int i = 0; i < 18; i++){\n    float d = map(p + l * t, false);\n    s = min(s, 7.0 * d / t);\n    t += clamp(d, 0.012, 0.12);\n    if (s < 0.01 || t > t1) break;\n  }\n  return clamp(s, 0.0, 1.0);\n}\nvec3 floorFull(vec3 p, vec3 rd, float px){\n  float grain = fbm(p.xz * vec2(2.6, 5.5));\n  float wav = fbm(p.xz * 1.7 + 3.0);\n  vec3 n = normalize(vec3((wav - 0.5) * 0.03, 1.0, (fbm(p.xz * 1.7 - 9.0) - 0.5) * 0.03));\n  vec3 r = reflect(rd, n);\n  float F = 0.055 + 0.945 * pow(1.0 - clamp(dot(n, -rd), 0.0, 1.0), 5.0);\n  vec3 refl = dome(p, r);\n  float cov, t = march(p + vec3(0.0, 0.003, 0.0), r, 44, px * 2.0, cov);\n  if (t > 0.0){\n    vec3 q = p + r * t;\n    vec3 c = chrome(q, r, normalAt(q, false), false, px);\n    refl = mix(refl, c, cov * mix(0.8, 0.04, smoothstep(0.0, 0.6, q.y)));\n  }\n  refl *= mix(0.7, 0.95, smoothstep(0.25, 0.7, grain));\n  float sh = shadow(p + vec3(0.0, 0.004, 0.0), normalize(vec3(-0.22, 0.8, 0.52)));\n  float near = clamp(map(p + vec3(0.0, 0.02, 0.0), false) / 0.1, 0.0, 1.0);\n  vec3 diff = floorGlow(p) * mix(0.25, 1.0, sh) * (0.85 + 0.3 * grain);\n  vec3 col = (diff + F * refl) * mix(0.3, 1.0, near);\n  float fog = smoothstep(-0.9, -WALL, p.z);\n  return mix(col, wall(vec3(p.x, 0.02, -WALL)), fog * fog * 0.92);\n}\nvec3 aces(vec3 x){ return clamp((x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14), 0.0, 1.0); }\n\nvoid main(){\n  vec2 uv = (gl_FragCoord.xy * 2.0 - uRes) / uRes.y;\n  vec3 rd = normalize(uv.x * uRt + uv.y * uUp + uFl * uFw);\n  float px = 2.0 / (uRes.y * uFl);\n  float tf = rd.y < 0.0 ? (FLOOR - uRo.y) / rd.y : 1e9;\n  float cov, t = march(uRo, rd, 84, px, cov);\n  bool hit = t > 0.0 && t < tf;\n  vec3 col = vec3(0.0);\n  if (!hit || cov < 0.999){\n    vec3 fp = uRo + rd * tf;\n    col = tf < 1e8 && fp.z > -WALL ? floorFull(fp, rd, px) : dome(uRo, rd);\n  }\n  if (hit){\n    vec3 p = uRo + rd * t;\n    col = mix(col, chrome(p, rd, normalAt(p, true), true, px), cov);\n  }\n  col = aces(col * 1.08);\n  col = pow(col, vec3(1.0 / 2.2));\n  vec2 v = gl_FragCoord.xy / uRes - 0.5;\n  col *= 1.0 - dot(v, v) * 0.75;\n  col += (hash(gl_FragCoord.xy + fract(uT) * 91.7) - 0.5) * 0.028;\n  outColor = vec4(col, 1.0);\n}`;\n\nexport default function LiquidChromeWord() {\n  const reduce = useReducedMotion();\n  const stage = useRef<HTMLDivElement>(null);\n  const canvas = useRef<HTMLCanvasElement>(null);\n  const [typed, setTyped] = useState(WORDS[0]);\n  const [live, setLive] = useState(false);\n  const word = clean(typed) || WORDS[0];\n  const api = useRef<{ set: (w: string) => void; strike: (x?: number, y?: number) => void } | null>(null);\n  const pointer = useRef({ x: 0, y: 0, at: -1e9, down: false, inside: false });\n  const hands = useRef(false); // true once a visitor has typed, which stops the self-playing words\n  const typedRef = useRef(typed);\n  typedRef.current = typed;\n\n  useEffect(() => {\n    const cv = canvas.current;\n    const el = stage.current;\n    if (!cv || !el) return;\n    const gl = cv.getContext(\"webgl2\", { antialias: false, alpha: false, powerPreference: \"high-performance\" });\n    if (!gl) return; // no WebGL 2: the still composition underneath stays\n    const sh = (type: number, src: string) => {\n      const s = gl.createShader(type)!;\n      gl.shaderSource(s, src);\n      gl.compileShader(s);\n      return s;\n    };\n    const prog = gl.createProgram()!;\n    gl.attachShader(prog, sh(gl.VERTEX_SHADER, VERT));\n    gl.attachShader(prog, sh(gl.FRAGMENT_SHADER, FRAG));\n    gl.linkProgram(prog);\n    if (!gl.getProgramParameter(prog, gl.LINK_STATUS)) return;\n    gl.useProgram(prog);\n    const quad = gl.createBuffer();\n    gl.bindBuffer(gl.ARRAY_BUFFER, quad);\n    gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 3, -1, -1, 3]), gl.STATIC_DRAW);\n    const loc = gl.getAttribLocation(prog, \"p\");\n    gl.enableVertexAttribArray(loc);\n    gl.vertexAttribPointer(loc, 2, gl.FLOAT, false, 0, 0);\n    const U = (n: string) => gl.getUniformLocation(prog, n);\n    const u = { res: U(\"uRes\"), t: U(\"uT\"), mix: U(\"uMix\"), swell: U(\"uSwell\"), k: U(\"uK\"), hw: U(\"uHW\"), fl: U(\"uFl\"), ro: U(\"uRo\"), rt: U(\"uRt\"), up: U(\"uUp\"), fw: U(\"uFw\"), head: U(\"uHead\"), tail: U(\"uTail\"), rip: U(\"uRip\"), push: U(\"uPush\") };\n    const tex = [0, 1].map((i) => {\n      const t = gl.createTexture();\n      gl.activeTexture(gl.TEXTURE0 + i);\n      gl.bindTexture(gl.TEXTURE_2D, t);\n      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n      return t;\n    });\n    const scratch = document.createElement(\"canvas\");\n    let slotA = 0; // which texture unit holds the word on show\n    let halfA = 1.4;\n    let halfB = 1.4;\n    let melt = -1; // seconds into a melt, or -1\n    let ready = false;\n    const upload = (unit: number, w: string) => {\n      const b = bake(w, scratch);\n      gl.activeTexture(gl.TEXTURE0 + unit);\n      gl.bindTexture(gl.TEXTURE_2D, tex[unit]);\n      gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA16F, TW, TH, 0, gl.RGBA, gl.FLOAT, b.data);\n      return b.half;\n    };\n\n    // Springs. Positions are in the word's own units: x across, y up from the floor, z toward the camera.\n    const s = {\n      hx: 0.9, hy: 0.48, hz: 0.07, hvx: 0, hvy: 0,\n      tx: 0.9, ty: 0.48, tvx: 0, tvy: 0,\n      px: 0, py: 0,\n      yaw: YAW, pitch: 0.13, dist: 5, half: 1.4,\n      j: 0, jv: 0,\n      ripX: 0, ripY: 0.3, ripAt: -10,\n    };\n    // Always drawn at 1.5 times the layout size: on an ordinary screen that is supersampling, which is what keeps rims clean.\n    let scale = 1.5;\n    let w = 0;\n    let h = 0;\n    const VT = Math.tan((30 * Math.PI) / 360);\n    const fit = (half: number) => Math.max((half * 2 + 0.86) / (2 * VT * (w / Math.max(h, 1))), 1.34 / (2 * VT));\n    const layout = () => {\n      const r = el.getBoundingClientRect();\n      w = r.width;\n      h = r.height;\n      cv.width = Math.max(2, Math.round(w * scale));\n      cv.height = Math.max(2, Math.round(h * scale));\n      gl.viewport(0, 0, cv.width, cv.height);\n    };\n    const cam = { ro: [0, 0, 5], rt: [1, 0, 0], up: [0, 1, 0], fw: [0, 0, -1] };\n    const aim = () => {\n      const ta = [0.19, 0.17, 0];\n      const cp = Math.cos(s.pitch);\n      const ro = [ta[0] + s.dist * Math.sin(s.yaw) * cp, ta[1] + s.dist * Math.sin(s.pitch), ta[2] + s.dist * Math.cos(s.yaw) * cp];\n      const f = [ta[0] - ro[0], ta[1] - ro[1], ta[2] - ro[2]];\n      const fl = Math.hypot(f[0], f[1], f[2]);\n      const fw = [f[0] / fl, f[1] / fl, f[2] / fl];\n      const rl = Math.hypot(fw[2], fw[0]);\n      const rt = [-fw[2] / rl, 0, fw[0] / rl];\n      const up = [rt[1] * fw[2] - rt[2] * fw[1], rt[2] * fw[0] - rt[0] * fw[2], rt[0] * fw[1] - rt[1] * fw[0]];\n      cam.ro = ro;\n      cam.rt = rt;\n      cam.up = up;\n      cam.fw = fw;\n    };\n    // Where a pointer position lands on the upright plane the word stands in.\n    const toWord = (cx: number, cy: number) => {\n      const ux = ((cx / w) * 2 - 1) * (w / h);\n      const uy = 1 - (cy / h) * 2;\n      const f = 1 / VT;\n      const d = [ux * cam.rt[0] + uy * cam.up[0] + f * cam.fw[0], ux * cam.rt[1] + uy * cam.up[1] + f * cam.fw[1], ux * cam.rt[2] + uy * cam.up[2] + f * cam.fw[2]];\n      const t = -cam.ro[2] / d[2];\n      return [cam.ro[0] + d[0] * t, cam.ro[1] + d[1] * t];\n    };\n\n    let clock = 0;\n    const draw = () => {\n      aim();\n      const m = melt < 0 ? 0 : Math.min(1, melt / MELT);\n      const e = m < 0.5 ? 4 * m * m * m : 1 - Math.pow(-2 * m + 2, 3) / 2;\n      gl.uniform1i(U(\"uA\"), slotA);\n      gl.uniform1i(U(\"uB\"), 1 - slotA);\n      gl.uniform2f(u.res, cv.width, cv.height);\n      gl.uniform1f(u.t, clock);\n      gl.uniform1f(u.mix, e);\n      gl.uniform1f(u.swell, Math.sin(Math.PI * e) * 0.0032);\n      gl.uniform1f(u.k, INFLATE * (1 + s.j));\n      gl.uniform1f(u.hw, Math.max(halfA, halfB) + 0.1);\n      gl.uniform1f(u.fl, 1 / VT);\n      gl.uniform3fv(u.ro, cam.ro);\n      gl.uniform3fv(u.rt, cam.rt);\n      gl.uniform3fv(u.up, cam.up);\n      gl.uniform3fv(u.fw, cam.fw);\n      const sp = Math.hypot(s.hvx, s.hvy);\n      gl.uniform4f(u.head, s.hx, s.hy, s.hz, 0.082 / (1 + sp * 0.05));\n      gl.uniform4f(u.tail, s.tx, s.ty, s.hz - 0.01, 0.05);\n      const age = clock - s.ripAt;\n      gl.uniform4f(u.rip, s.ripX, s.ripY, age, age < 3 ? 0.55 * Math.exp(-2.3 * age) : 0);\n      gl.uniform4f(u.push, s.hx, s.hy, s.px, s.py);\n      gl.drawArrays(gl.TRIANGLES, 0, 3);\n    };\n\n    let raf = 0;\n    let last = 0;\n    let visible = true;\n    let slow = 0;\n    let nextAuto = 4.4;\n    let auto = 0;\n    const step = (dt: number) => {\n      clock += dt;\n      const p = pointer.current;\n      const idle = !p.inside || performance.now() - p.at > 2600;\n      const reachX = s.half + 0.25;\n      let gx: number;\n      let gy: number;\n      if (idle) {\n        // left alone, the bead rolls home and sits on the floor after the last letter, as a full stop\n        gx = s.half + 0.2;\n        gy = 0.1;\n      } else {\n        const q = toWord(p.x, p.y);\n        gx = Math.max(-reachX, Math.min(reachX, q[0]));\n        gy = Math.max(0.1, Math.min(0.76, q[1]));\n      }\n      const hk = idle ? 26 : 120;\n      const hc = idle ? 9 : 13;\n      s.hvx += ((gx - s.hx) * hk - s.hvx * hc) * dt;\n      s.hvy += ((gy - s.hy) * hk - s.hvy * hc) * dt;\n      s.hx += s.hvx * dt;\n      s.hy += s.hvy * dt;\n      s.tvx += ((s.hx - s.tx) * 70 - s.tvx * 10) * dt;\n      s.tvy += ((s.hy - s.ty) * 70 - s.tvy * 10) * dt;\n      s.tx += s.tvx * dt;\n      s.ty += s.tvy * dt;\n      const pl = Math.min(1, 0.075 / Math.max(1e-4, Math.hypot(s.hvx, s.hvy) * 0.03));\n      s.px += (s.hvx * 0.03 * pl - s.px) * Math.min(1, dt * 9);\n      s.py += (s.hvy * 0.03 * pl - s.py) * Math.min(1, dt * 9);\n      s.jv += (-s.j * 240 - s.jv * 7.5) * dt;\n      s.j += s.jv * dt;\n      const yawTo = idle ? YAW + Math.sin(clock * 0.23) * 0.07 : YAW * 0.5 + ((p.x / w) * 2 - 1) * -0.2;\n      const pitchTo = idle ? 0.13 + Math.sin(clock * 0.31) * 0.012 : 0.13 + ((p.y / h) * 2 - 1) * 0.045;\n      s.yaw += (yawTo - s.yaw) * Math.min(1, dt * 2.6);\n      s.pitch += (pitchTo - s.pitch) * Math.min(1, dt * 2.6);\n      if (melt >= 0) {\n        melt += dt;\n        const k = Math.min(1, melt / MELT);\n        s.half = halfA + (halfB - halfA) * k;\n        if (melt >= MELT) {\n          slotA = 1 - slotA;\n          halfA = halfB;\n          melt = -1;\n          s.jv += 2.6; // the new word lands fat, then settles\n        }\n      }\n      s.dist += (fit(s.half) - s.dist) * Math.min(1, dt * 3.2);\n      if (!hands.current && clock > nextAuto && melt < 0) {\n        auto = (auto + 1) % WORDS.length;\n        nextAuto = clock + 5.4;\n        setTyped(WORDS[auto]);\n      }\n    };\n    const frame = (now: number) => {\n      raf = 0;\n      if (!ready || !visible || document.hidden) return;\n      const raw = last ? (now - last) / 1000 : 1 / 60;\n      last = now;\n      // Too slow on this machine: drop the drawing size a notch and stretch it instead.\n      if (raw > 0.026 && raw < 0.25) slow++;\n      else slow = Math.max(0, slow - 1);\n      if (slow > 24 && scale > 0.55) {\n        scale *= 0.84;\n        slow = 0;\n        layout();\n      }\n      const dt = Math.min(raw, 1 / 30);\n      step(dt * 0.5);\n      step(dt * 0.5);\n      draw();\n      raf = requestAnimationFrame(frame);\n    };\n    const wake = () => {\n      if (reduce) {\n        if (ready) draw();\n        return;\n      }\n      last = 0;\n      if (!raf) raf = requestAnimationFrame(frame);\n    };\n\n    api.current = {\n      set: (next: string) => {\n        if (!ready) return;\n        if (melt >= 0) {\n          slotA = 1 - slotA;\n          halfA = halfB;\n          melt = -1;\n        }\n        if (reduce) {\n          halfA = halfB = s.half = upload(slotA, next);\n          s.dist = fit(s.half);\n          draw();\n          return;\n        }\n        halfB = upload(1 - slotA, next);\n        melt = 0;\n      },\n      strike: (cx?: number, cy?: number) => {\n        if (reduce || !ready) return;\n        const q = cx === undefined || cy === undefined ? [s.hx, s.hy] : toWord(cx, cy);\n        s.ripX = q[0];\n        s.ripY = q[1];\n        s.ripAt = clock;\n        s.jv += 1.9;\n      },\n    };\n\n    const start = () => {\n      layout();\n      halfA = halfB = s.half = upload(0, clean(typedRef.current) || WORDS[0]);\n      upload(1, clean(typedRef.current) || WORDS[0]);\n      s.dist = fit(s.half);\n      s.hx = s.tx = s.half + 0.2;\n      s.hy = s.ty = 0.1;\n      ready = true;\n      setLive(true);\n      wake();\n    };\n    start();\n\n    const ro = new ResizeObserver(() => {\n      layout();\n      if (ready) {\n        if (reduce) {\n          s.dist = fit(s.half);\n          draw();\n        } else wake();\n      }\n    });\n    ro.observe(el);\n    const io = new IntersectionObserver(([entry]) => {\n      visible = entry.isIntersecting;\n      wake();\n    });\n    io.observe(el);\n    document.addEventListener(\"visibilitychange\", wake);\n    return () => {\n      api.current = null;\n      cancelAnimationFrame(raf);\n      ro.disconnect();\n      io.disconnect();\n      document.removeEventListener(\"visibilitychange\", wake);\n      gl.getExtension(\"WEBGL_lose_context\")?.loseContext();\n    };\n  }, [reduce]);\n\n  // Re-bake a moment after the word changes, so fast typing melts once and not per key.\n  const shown = useRef(word);\n  useEffect(() => {\n    if (shown.current === word) return;\n    const id = window.setTimeout(() => {\n      shown.current = word;\n      api.current?.set(word);\n    }, hands.current ? 160 : 0);\n    return () => window.clearTimeout(id);\n  }, [word]);\n\n  function track(e: ReactPointerEvent<HTMLDivElement>) {\n    const r = e.currentTarget.getBoundingClientRect();\n    const p = pointer.current;\n    p.x = e.clientX - r.left;\n    p.y = e.clientY - r.top;\n    p.at = performance.now();\n    p.inside = e.type !== \"pointerleave\";\n    if (e.type === \"pointerdown\") api.current?.strike(p.x, p.y);\n  }\n\n  // The still: the same word, typeface and set, drawn as layered SVG strokes.\n  const set = setWord(word);\n  const vbW = set.width + 46;\n  const layer = (stroke: string, widthPx: number, dx: number, dy: number, opacity = 1, cls = \"\") => (\n    <g fill=\"none\" stroke={stroke} strokeWidth={widthPx} strokeLinecap=\"round\" strokeLinejoin=\"round\" opacity={opacity} transform={`translate(${dx} ${dy})`} className={cls} filter={opacity < 1 ? \"url(#rmlc-edge)\" : undefined}>\n      {set.glyphs.map((g, n) => (\n        <path key={n} d={g.d} transform={`translate(${g.x} ${STEM / 2})`} />\n      ))}\n    </g>\n  );\n  const metal = (\n    <>\n      {layer(\"#131019\", STEM, 0, 0)}\n      {layer(\"url(#rmlc-body)\", STEM - 3, -1, -0.8)}\n      {layer(\"#ff8a40\", 2.2, 9.4, 1.2, 0.5)}\n      {layer(\"#0c0d14\", 3.2, 5.4, 1.6, 0.8)}\n      {layer(\"url(#rmlc-light)\", 7.5, -4.8, -2.6, 0.97, \"rmlc-glint\")}\n      <circle cx={set.width + 26} cy={87} r={13} fill=\"url(#rmlc-bead)\" />\n    </>\n  );\n\n  return (\n    <section className=\"relative isolate h-[560px] w-full overflow-hidden bg-[#0b070d] sm:h-[720px]\">\n      <style>{`\n        @keyframes ray-marched-liquid-chrome-word-glint { from { translate: -0.6px -0.4px; opacity: 0.86; } to { translate: 1.4px 0.6px; opacity: 1; } }\n        .rmlc-glint { animation: ray-marched-liquid-chrome-word-glint 2.8s ease-in-out infinite alternate; }\n        @media (prefers-reduced-motion: reduce) { .rmlc-glint { animation: none; } }\n      `}</style>\n      {/* The real word. Assistive technology and search read this; everything drawn is decoration for it. */}\n      <h2 className=\"sr-only\">{word}</h2>\n\n      {/* The still. It shows first, and stays if WebGL 2 is missing. */}\n      <div aria-hidden=\"true\" className={`absolute inset-0 transition-opacity duration-700 ${live ? \"opacity-0\" : \"opacity-100\"}`}>\n        <div className=\"absolute inset-0\" style={{ background: \"radial-gradient(circle at 56% 40%, #e98a2f 0%, #d9611f 14%, #b5301c 27%, #6d1420 36%, rgba(60,10,32,0.5) 44%, rgba(22,10,28,0.9) 60%, #120a18 100%)\" }} />\n        <div className=\"absolute inset-x-0 bottom-0 top-[59%]\" style={{ background: \"linear-gradient(180deg, rgba(120,44,20,0.85) 0%, rgba(52,20,18,0.92) 18%, #170c10 55%, #0b070d 100%)\" }} />\n        <div className=\"absolute inset-x-0 bottom-0 top-[59%]\" style={{ background: \"radial-gradient(60% 120% at 56% 0%, rgba(240,120,40,0.6) 0%, rgba(190,50,30,0.32) 40%, rgba(0,0,0,0) 72%)\" }} />\n        <svg viewBox={`-23 -6 ${vbW} 212`} className=\"absolute left-1/2 top-[59%] w-[88%] max-w-[1080px] -translate-x-1/2 overflow-visible\" style={{ transform: \"translate(-50%, -50%)\" }}>\n          <defs>\n            <linearGradient id=\"rmlc-body\" gradientUnits=\"userSpaceOnUse\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"100\">\n              <stop offset=\"0\" stopColor=\"#f6f8fc\" />\n              <stop offset=\"0.5\" stopColor=\"#c9d0dc\" />\n              <stop offset=\"0.8\" stopColor=\"#7e8696\" />\n              <stop offset=\"1\" stopColor=\"#5a3a34\" />\n            </linearGradient>\n            <linearGradient id=\"rmlc-light\" gradientUnits=\"userSpaceOnUse\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"100\">\n              <stop offset=\"0\" stopColor=\"#ffffff\" />\n              <stop offset=\"1\" stopColor=\"#e6ebf3\" />\n            </linearGradient>\n            <radialGradient id=\"rmlc-bead\" cx=\"0.36\" cy=\"0.32\" r=\"0.75\">\n              <stop offset=\"0\" stopColor=\"#ffffff\" />\n              <stop offset=\"0.3\" stopColor=\"#c5ccd8\" />\n              <stop offset=\"0.62\" stopColor=\"#15151d\" />\n              <stop offset=\"0.86\" stopColor=\"#3a1c18\" />\n              <stop offset=\"1\" stopColor=\"#ff9a52\" />\n            </radialGradient>\n            <linearGradient id=\"rmlc-fade\" gradientUnits=\"userSpaceOnUse\" x1=\"0\" y1=\"100\" x2=\"0\" y2=\"200\">\n              <stop offset=\"0\" stopColor=\"#fff\" stopOpacity=\"0.62\" />\n              <stop offset=\"0.75\" stopColor=\"#fff\" stopOpacity=\"0\" />\n            </linearGradient>\n            <mask id=\"rmlc-mask\" maskUnits=\"userSpaceOnUse\" x=\"-40\" y=\"100\" width={vbW + 80} height=\"110\">\n              <rect x=\"-40\" y=\"100\" width={vbW + 80} height=\"110\" fill=\"url(#rmlc-fade)\" />\n            </mask>\n            <filter id=\"rmlc-edge\" x=\"-5%\" y=\"-5%\" width=\"110%\" height=\"110%\">\n              <feGaussianBlur stdDeviation=\"0.55\" />\n            </filter>\n            <filter id=\"rmlc-soft\" x=\"-5%\" y=\"-5%\" width=\"110%\" height=\"110%\">\n              <feGaussianBlur stdDeviation=\"0.5 1.3\" />\n            </filter>\n          </defs>\n          <ellipse cx={vbW / 2 - 23} cy=\"100\" rx={vbW / 2} ry=\"5\" fill=\"#000\" opacity=\"0.5\" filter=\"url(#rmlc-soft)\" />\n          <g mask=\"url(#rmlc-mask)\">\n            <g transform=\"translate(0 200) scale(1 -1)\" filter=\"url(#rmlc-soft)\">\n              {metal}\n            </g>\n          </g>\n          {metal}\n        </svg>\n      </div>\n\n      <div ref={stage} onPointerMove={track} onPointerDown={track} onPointerLeave={track} className=\"absolute inset-0 touch-pan-y\">\n        <canvas ref={canvas} aria-hidden=\"true\" className={`absolute inset-0 h-full w-full transition-opacity duration-700 ${live ? \"opacity-100\" : \"opacity-0\"}`} />\n      </div>\n\n      <form\n        className=\"absolute inset-x-0 bottom-5 flex flex-col items-center gap-3 px-5 sm:bottom-8\"\n        onSubmit={(e) => {\n          e.preventDefault();\n          api.current?.strike();\n        }}\n      >\n        <div className=\"flex h-[52px] items-center rounded-full border border-white/[0.14] bg-[#0d080c]/60 pl-6 pr-1.5 shadow-[inset_0_1px_0_rgba(255,255,255,0.12),0_18px_40px_-18px_rgba(0,0,0,0.9)] backdrop-blur-xl transition-colors focus-within:border-white/40\">\n          <label htmlFor=\"rmlc-word\" className=\"whitespace-nowrap text-[10px] font-medium uppercase tracking-[0.28em] text-white/50\" style={{ fontFamily: FACE }}>\n            Set a word\n          </label>\n          <span aria-hidden=\"true\" className=\"mx-4 h-5 w-px bg-white/15\" />\n          <input\n            id=\"rmlc-word\"\n            type=\"text\"\n            value={typed}\n            maxLength={MAX_LETTERS}\n            autoComplete=\"off\"\n            autoCapitalize=\"characters\"\n            spellCheck={false}\n            onFocus={() => (hands.current = true)}\n            onChange={(e) => {\n              hands.current = true;\n              setTyped(clean(e.target.value));\n            }}\n            className=\"w-[10ch] min-w-0 bg-transparent text-[18px] font-semibold uppercase tracking-[0.24em] text-white caret-[#ff8a4c] outline-none placeholder:text-white/30 sm:w-[12ch]\"\n            style={{ fontFamily: FACE }}\n            placeholder={WORDS[0]}\n          />\n          <button\n            type=\"submit\"\n            aria-label=\"Strike the letters\"\n            className=\"grid h-10 w-10 shrink-0 place-items-center rounded-full bg-white text-[#0b070d] shadow-[inset_0_-2px_0_rgba(0,0,0,0.12)] transition-transform hover:scale-105 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#ff8a4c] focus-visible:ring-offset-2 focus-visible:ring-offset-black active:scale-90\"\n          >\n            <svg aria-hidden=\"true\" viewBox=\"0 0 20 20\" className=\"h-[18px] w-[18px]\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n              <path d=\"M15 5v4a3 3 0 0 1-3 3H5\" />\n              <path d=\"M8 9l-3 3 3 3\" />\n            </svg>\n          </button>\n        </div>\n        {!reduce && (\n          <p className=\"pointer-events-none hidden text-[10px] font-medium uppercase tracking-[0.28em] text-white/40 sm:block\" style={{ fontFamily: FACE }}>\n            Drag the full stop through it <span className=\"mx-1 text-white/20\">/</span> click to strike\n          </p>\n        )}\n      </form>\n    </section>\n  );\n}\n"}]}
