Warp drive button
The starfield behind joinstarlight.com, with the charge-and-jump to hyperspace that plays when you sign up.
Build a React 19 + TypeScript component called WarpStarfield: a realistic, animated starfield on a canvas with a "Click to warp" button that charges the stars into a jump to hyperspace. Constraints - One .tsx file, "use client", imports from react only. Put all CSS in a template string rendered as <style href="ui-warp-starfield" precedence="ui">, with every class prefixed "ws-". - The component fills its parent (position: relative; width/height 100%; overflow: hidden; background #0a0a0f). Size the canvas with a ResizeObserver on the root, never the window. Cap devicePixelRatio at 1.5. - Font: var(--font-google-sans-flex, "Google Sans Flex"), system-ui, sans-serif. Stars - Count = clamp(width × height × 950 / (1920 × 1080), 120, 1600). Each star has x, y in [−w/2, w/2] × [−h/2, h/2], z in (0, 1000], and its previous z. Project with sx = x / z × cx + vanishingX (same for y). Move z toward 0 by speed × 16 per frame; respawn at z = 1000 when z ≤ 0 or the star leaves the frame by 60px. - Colour by stellar temperature, weighted: blue 155,176,255 (5%), blue-white 190,207,255 (9%), 228,234,255 (13%), white (28%), warm white 255,248,240 (18%), sun-like 255,240,214 (14%), orange 255,220,178 (9%), deep orange 255,198,158 (4%). - Magnitude: 2% of stars get 0.85–1, the rest Math.random()³. Core radius = (0.38 + nearness × 1.5) × (0.45 + mag × 1.05); alpha = (0.18 + nearness × 0.72) × (0.32 + mag × 0.78) × twinkle. - Draw with globalCompositeOperation "lighter": a pre-rendered radial glow sprite per colour (128px, stops 0.85 / 0.45 / 0.14 / 0.03 / 0 at 0 / 6% / 16% / 40% / 100%) at radius core × (2.6 + mag × 3.6), then a crisp arc for the core, a white-hot centre on stars brighter than 0.5, and a four-point diffraction spike sprite on stars brighter than 0.82. - Twinkle: two sines summed (0.62 and 0.38 weights) with random frequencies 0.003–0.009 and 1.8–3.1× that, depth (0.14 + (1 − mag) × 0.66) × random 0.4–1, so faint stars wink and bright ones hold. Bright stars (mag > 0.55) also flash red/green/blue out of phase. - A faint nebula haze: four large radial gradients in muted blue and violet at 5% alpha, drawn once to an offscreen canvas and painted at 50% opacity with slight parallax. - The vanishing point leans toward the pointer (±2.5% of the frame), eased at 0.03 per frame, recentring as speed rises. Add a constant slow drift downward. Warp - One speed value eases toward a target each frame (factor 0.11, 0.24 during the jump). Idle 0.015. On click, target 0.85, then winds up quadratically toward 2.2 over 1300ms. At 1300ms it jumps: target 6.5. - As speed rises, twinkle fades out (gate = 1 − speed / 0.51), colours shift toward 205,226,255 by up to 85%, streaks appear from the previous projected position to the current one, and spikes stretch. - On the jump, fade a black overlay to opaque over 480ms (cubic-bezier(0.45, 0, 0.4, 1)). At 620ms reset the field to rest with fresh stars, then fade the overlay out over 900ms. Button - Centred pill, 60px tall, 56px side padding, #121213 fill, white 18px medium text. A 2px border made by padding a wrapper filled with linear-gradient(90deg, hsl(217 91% 60%), hsl(230 70% 55%), hsl(199 89% 48%), hsl(213 94% 68%), hsl(224 76% 48%)) at background-size 200%, animated from 0% to 200% every 2s. Behind it, the same gradient blurred 6px; on hover the button scales 1.05 and the glow grows to −8px / 10px blur. The button itself doesn't change while the field charges. - A single click (or Enter/Space) starts the charge and commits to the jump; there's no cancel, and further clicks are ignored (aria-disabled) until the field is back at rest. Give it an aria-label that says it jumps to hyperspace. Be a good guest - Pause the loop with an IntersectionObserver when off screen and on visibilitychange; clear timers and listeners on unmount. - prefers-reduced-motion: draw one still frame, no twinkle, no rainbow animation; the click skips the charge and only plays the fade.
"use client";
/**
* WarpStarfield — the starfield behind joinstarlight.com, with its jump to hyperspace.
*
* From Starlight (joinstarlight.com), where it runs full-screen behind the landing page and every "Sign up"
* button charges it, then jumps through it into checkout. Here it fills its parent, and the jump lands
* back where it started.
*
* How it works
* - A 2D canvas draws ~1 star per 2,200px² in 3D: each star has x/y/z and is projected toward a vanishing
* point; when it passes the camera it respawns at the back.
* - Stars look real rather than gamey: colours follow stellar temperatures (mostly white and warm white,
* a few blue and orange), brightness follows a steep power law (many faint, a few bright), every star is a
* crisp core plus a soft pre-rendered glow, and twinkle is two summed oscillators, so it never ticks like a
* metronome. Bright stars flash colour (chromatic scintillation) and get diffraction spikes.
* - Clicking the button charges the field, as Starlight's sign-up links do: speed eases from idle toward warp
* and keeps winding up for 1.3 s, streaks appear, twinkle fades and light shifts blue. Then it jumps: a
* hyperspace burst, a fade to black, then the field drops out of warp at rest. Once clicked, it's committed.
* - The vanishing point leans slightly toward the pointer. The loop pauses off screen and in hidden tabs.
* - With reduced motion the stars hold still and the jump is only the fade.
*
* Usage
* <div style={{ height: 520 }}>
* <WarpStarfield />
* </div>
*
* Requirements: React 19 (for the hoisted <style>), no other dependencies. Set in Google Sans Flex when the
* page provides `--font-google-sans-flex`, else the system sans.
*/
import { useEffect, useRef, useState } from "react";
type WarpStarfieldProps = {
/** Button label. */
label?: string;
/** How long the field charges after the click before it jumps, in ms. */
chargeMs?: number;
};
// ── Motion ──────────────────────────────────────────────────────────────────────────────────────
const BASE_SPEED = 0.015; // idle cruise
const WARP_SPEED = 0.85; // the moment the button goes down
const PRE_JUMP_SPEED = 2.2; // what the charge winds up to
const HYPER_SPEED = 6.5; // the burst when the jump commits
const MAX_DEPTH = 1000;
const FADE_IN_MS = 480; // the fade to black after the jump
const BLACKOUT_AT_MS = 620; // when the field resets, safely under the black
const FADE_OUT_MS = 900; // dropping out of warp
const STAR_DENSITY = 950 / (1920 * 1080);
const MAX_STARS = 1600;
// ── Colour ──────────────────────────────────────────────────────────────────────────────────────
type Rgb = readonly [number, number, number];
// Stellar colour temperatures, weighted toward white and warm white like the real night sky.
const STAR_COLORS: { rgb: Rgb; str: string; weight: number }[] = [
{ rgb: [155, 176, 255], str: "155,176,255", weight: 0.05 }, // O/B blue
{ rgb: [190, 207, 255], str: "190,207,255", weight: 0.09 }, // A blue-white
{ rgb: [228, 234, 255], str: "228,234,255", weight: 0.13 }, // late A / early F
{ rgb: [255, 255, 255], str: "255,255,255", weight: 0.28 }, // white
{ rgb: [255, 248, 240], str: "255,248,240", weight: 0.18 }, // F warm white
{ rgb: [255, 240, 214], str: "255,240,214", weight: 0.14 }, // G, sun-like
{ rgb: [255, 220, 178], str: "255,220,178", weight: 0.09 }, // K orange
{ rgb: [255, 198, 158], str: "255,198,158", weight: 0.04 }, // M deep orange
];
const STAR_CDF = (() => {
let acc = 0;
return STAR_COLORS.map((c) => (acc += c.weight));
})();
function pickColor() {
const r = Math.random() * STAR_CDF[STAR_CDF.length - 1];
return STAR_COLORS[STAR_CDF.findIndex((edge) => r <= edge)] ?? STAR_COLORS[STAR_COLORS.length - 1];
}
// Light bends toward blue in the direction of travel at warp.
const DOPPLER: Rgb = [205, 226, 255];
type Star = {
x: number;
y: number;
z: number;
pz: number; // previous z, for the streak
rgb: Rgb;
sprite: HTMLCanvasElement;
mag: number; // 0–1 brightness
twAmp: number; // twinkle depth: faint stars wink, bright ones hold steady
f1: number;
f2: number;
ph1: number;
ph2: number;
chroma: number; // colour flashing, bright stars only
cf: number;
cph: number;
};
/** The soft halo around a star, one per colour. The sharp core is drawn separately so stars stay crisp. */
function makeGlowSprite(color: string) {
const size = 128;
const c = document.createElement("canvas");
c.width = c.height = size;
const g = c.getContext("2d")!;
const r = size / 2;
const grad = g.createRadialGradient(r, r, 0, r, r, r);
grad.addColorStop(0, `rgba(${color},0.85)`);
grad.addColorStop(0.06, `rgba(${color},0.45)`);
grad.addColorStop(0.16, `rgba(${color},0.14)`);
grad.addColorStop(0.4, `rgba(${color},0.03)`);
grad.addColorStop(1, `rgba(${color},0)`);
g.fillStyle = grad;
g.fillRect(0, 0, size, size);
return c;
}
/** A soft four-point diffraction spike for the brightest stars. */
function makeSpikeSprite() {
const size = 128;
const c = document.createElement("canvas");
c.width = c.height = size;
const g = c.getContext("2d")!;
const mid = size / 2;
for (const horizontal of [true, false]) {
const grad = horizontal ? g.createLinearGradient(0, mid, size, mid) : g.createLinearGradient(mid, 0, mid, size);
grad.addColorStop(0, "rgba(255,255,255,0)");
grad.addColorStop(0.4, "rgba(255,255,255,0.5)");
grad.addColorStop(0.5, "rgba(255,255,255,1)");
grad.addColorStop(0.6, "rgba(255,255,255,0.5)");
grad.addColorStop(1, "rgba(255,255,255,0)");
g.fillStyle = grad;
if (horizontal) g.fillRect(0, mid - 0.6, size, 1.2);
else g.fillRect(mid - 0.6, 0, 1.2, size);
}
return c;
}
type Phase = "idle" | "charging" | "jumping" | "arriving";
/** What the button tells the draw loop, read every frame. */
type Drive = { active: boolean; startedAt: number; jumping: boolean; reset: boolean };
export default function WarpStarfield({ label = "Click to warp", chargeMs = 1300 }: WarpStarfieldProps) {
const rootRef = useRef<HTMLDivElement>(null);
const canvasRef = useRef<HTMLCanvasElement>(null);
const drive = useRef<Drive>({ active: false, startedAt: 0, jumping: false, reset: false });
const timers = useRef<ReturnType<typeof setTimeout>[]>([]);
const [phase, setPhase] = useState<Phase>("idle");
const phaseRef = useRef<Phase>("idle");
const go = (next: Phase) => {
phaseRef.current = next;
setPhase(next);
};
// ── The field ─────────────────────────────────────────────────────────────────────────────────
useEffect(() => {
const root = rootRef.current;
const canvas = canvasRef.current;
const ctx = canvas?.getContext("2d", { alpha: true });
if (!root || !canvas || !ctx) return;
const still = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
let w = 0;
let h = 0;
let raf = 0;
let onScreen = true;
let speed = BASE_SPEED;
// Idle drift plus a gentle lean toward the pointer.
let driftX = 0;
let driftY = 0;
let lookX = 0;
let lookY = 0;
let targetLookX = 0;
let targetLookY = 0;
const stars: Star[] = [];
const glow = new Map(STAR_COLORS.map((c) => [c.str, makeGlowSprite(c.str)]));
const spike = makeSpikeSprite();
let nebula: HTMLCanvasElement | null = null;
// A barely-there deep-space haze, for depth.
const buildNebula = () => {
const c = document.createElement("canvas");
c.width = Math.max(2, Math.ceil(w));
c.height = Math.max(2, Math.ceil(h));
const g = c.getContext("2d")!;
g.globalCompositeOperation = "lighter";
const diag = Math.hypot(w, h);
for (const [x, y, r, col] of [
[0.22, 0.32, 0.55, "46,64,120"],
[0.78, 0.6, 0.6, "74,48,116"],
[0.55, 0.18, 0.45, "30,72,96"],
[0.4, 0.82, 0.5, "58,44,104"],
] as const) {
const grad = g.createRadialGradient(x * w, y * h, 0, x * w, y * h, r * diag * 0.5);
grad.addColorStop(0, `rgba(${col},0.05)`);
grad.addColorStop(0.5, `rgba(${col},0.018)`);
grad.addColorStop(1, `rgba(${col},0)`);
g.fillStyle = grad;
g.fillRect(0, 0, w, h);
}
nebula = c;
};
const resetStar = (s: Star) => {
s.x = (Math.random() - 0.5) * w;
s.y = (Math.random() - 0.5) * h;
s.z = MAX_DEPTH;
s.pz = MAX_DEPTH;
// Overwhelmingly faint, with ~2% bright anchors so the sky always has a few prominent points.
const mag = Math.random() < 0.02 ? 0.85 + Math.random() * 0.15 : Math.pow(Math.random(), 3);
s.mag = mag;
const col = pickColor();
s.rgb = col.rgb;
s.sprite = glow.get(col.str)!;
s.twAmp = (0.14 + (1 - mag) * 0.66) * (0.4 + Math.random() * 0.6);
s.f1 = 0.003 + Math.random() * 0.006;
s.f2 = s.f1 * (1.8 + Math.random() * 1.3);
s.ph1 = Math.random() * Math.PI * 2;
s.ph2 = Math.random() * Math.PI * 2;
s.chroma = mag > 0.55 ? (mag - 0.55) * 95 * (0.5 + Math.random() * 0.5) : 0;
s.cf = 0.0018 + Math.random() * 0.004;
s.cph = Math.random() * Math.PI * 2;
};
const populate = () => {
const count = Math.min(MAX_STARS, Math.max(120, Math.floor(w * h * STAR_DENSITY)));
stars.length = 0;
for (let i = 0; i < count; i++) {
const s = {} as Star;
resetStar(s);
s.z = s.pz = Math.random() * MAX_DEPTH;
stars.push(s);
}
};
const resize = () => {
const r = root.getBoundingClientRect();
if (r.width === 0 || r.height === 0) return;
// 1.5 is indistinguishable for 1–2px stars and halves the fill cost.
const dpr = Math.min(window.devicePixelRatio || 1, 1.5);
w = r.width;
h = r.height;
canvas.width = Math.floor(w * dpr);
canvas.height = Math.floor(h * dpr);
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
buildNebula();
populate();
if (still) draw(performance.now());
};
const draw = (now: number) => {
const d = drive.current;
if (d.reset) {
// Dropping out of warp: a fresh, resting field under the black.
d.reset = false;
speed = BASE_SPEED;
populate();
}
ctx.clearRect(0, 0, w, h);
lookX += (targetLookX - lookX) * 0.03;
lookY += (targetLookY - lookY) * 0.03;
driftX += (lookX * 0.16 - driftX) * 0.03;
driftY += (0.1 + lookY * 0.11 - driftY) * 0.03;
if (nebula) {
ctx.globalAlpha = 0.5;
ctx.drawImage(nebula, driftX * 24 - 24, driftY * 24 - 24, w + 48, h + 48);
ctx.globalAlpha = 1;
}
// Idle → warp on click, winding up across the charge, then the hyperspace burst on the jump.
let target = BASE_SPEED;
let ease = 0.11;
if (d.jumping) {
target = HYPER_SPEED;
ease = 0.24;
} else if (d.active) {
const charge = Math.min(1, (now - d.startedAt) / chargeMs);
target = WARP_SPEED + (PRE_JUMP_SPEED - WARP_SPEED) * charge * charge;
}
if (!still) speed += (target - speed) * ease;
const step = still ? 0 : speed * 16;
// Twinkle fades as motion takes over; the blue shift rises with speed.
const twinkle = still ? 0 : Math.max(0, 1 - speed / (WARP_SPEED * 0.6));
const doppler = Math.min(1, speed / PRE_JUMP_SPEED) * 0.85;
const cx = w / 2;
const cy = h / 2;
const vx = cx + lookX * w * 0.025 * twinkle;
const vy = cy + lookY * h * 0.025 * twinkle;
ctx.globalCompositeOperation = "lighter"; // light adds, like photons
ctx.lineCap = "round";
for (const s of stars) {
s.pz = s.z;
s.z -= step;
if (!still) {
s.x += driftX * (1 - s.z / MAX_DEPTH) * 2;
s.y += driftY * (1 - s.z / MAX_DEPTH) * 2;
}
if (s.z <= 0) {
resetStar(s);
continue;
}
const sx = (s.x / s.z) * cx + vx;
const sy = (s.y / s.z) * cy + vy;
const px = (s.x / s.pz) * cx + vx;
const py = (s.y / s.pz) * cy + vy;
if (sx < -60 || sx > w + 60 || sy < -60 || sy > h + 60) {
resetStar(s);
continue;
}
const t = 1 - s.z / MAX_DEPTH; // 0 far, 1 near
let tw = 1;
if (twinkle > 0) {
const flick = Math.sin(now * s.f1 + s.ph1) * 0.62 + Math.sin(now * s.f2 + s.ph2) * 0.38;
tw = Math.max(0.04, 1 + flick * s.twAmp * twinkle);
}
const coreR = (0.38 + t * 1.5) * (0.45 + s.mag * 1.05);
const alpha = Math.min(1, (0.18 + t * 0.72) * (0.32 + s.mag * 0.78) * tw);
let r = s.rgb[0] + (DOPPLER[0] - s.rgb[0]) * doppler;
let g = s.rgb[1] + (DOPPLER[1] - s.rgb[1]) * doppler;
let b = s.rgb[2] + (DOPPLER[2] - s.rgb[2]) * doppler;
if (s.chroma > 0 && twinkle > 0) {
const cf = s.chroma * twinkle;
r += Math.sin(now * s.cf + s.cph) * cf;
g += Math.sin(now * s.cf * 1.3 + s.cph + 2.1) * cf * 0.55;
b += Math.sin(now * s.cf + s.cph + Math.PI) * cf;
}
const col = `${Math.max(0, Math.min(255, r | 0))},${Math.max(0, Math.min(255, g | 0))},${Math.max(0, Math.min(255, b | 0))}`;
// Motion streak, only once the field is moving.
const streak = Math.hypot(sx - px, sy - py);
if (streak > 1) {
ctx.strokeStyle = `rgba(${col},${alpha * 0.55})`;
ctx.lineWidth = Math.max(0.5, coreR * 1.15);
ctx.beginPath();
ctx.moveTo(px, py);
ctx.lineTo(sx, sy);
ctx.stroke();
}
const bloom = coreR * (2.6 + s.mag * 3.6);
ctx.globalAlpha = Math.min(1, alpha * (0.4 + s.mag * 0.45));
ctx.drawImage(s.sprite, sx - bloom, sy - bloom, bloom * 2, bloom * 2);
ctx.globalAlpha = alpha;
ctx.fillStyle = `rgb(${col})`;
ctx.beginPath();
ctx.arc(sx, sy, coreR, 0, Math.PI * 2);
ctx.fill();
if (s.mag > 0.5) {
// A white-hot centre on bright stars, colour left in the halo.
ctx.globalAlpha = alpha * (s.mag - 0.5) * 1.6;
ctx.fillStyle = "#fff";
ctx.beginPath();
ctx.arc(sx, sy, coreR * 0.55, 0, Math.PI * 2);
ctx.fill();
}
if (s.mag > 0.82) {
const len = coreR * (7 + s.mag * 12) * (1 + doppler * 1.6);
ctx.globalAlpha = alpha * 0.4 * s.mag;
ctx.drawImage(spike, sx - len, sy - len, len * 2, len * 2);
}
ctx.globalAlpha = 1;
}
ctx.globalCompositeOperation = "source-over";
};
const loop = (now: number) => {
draw(now);
raf = requestAnimationFrame(loop);
};
const run = () => {
if (!raf && !still && onScreen && document.visibilityState === "visible") raf = requestAnimationFrame(loop);
};
const stop = () => {
cancelAnimationFrame(raf);
raf = 0;
};
const onPointerMove = (e: PointerEvent) => {
if (still) return;
const r = root.getBoundingClientRect();
targetLookX = ((e.clientX - r.left) / r.width) * 2 - 1;
targetLookY = ((e.clientY - r.top) / r.height) * 2 - 1;
};
const onPointerLeave = () => {
targetLookX = 0;
targetLookY = 0;
};
const onVisibility = () => (document.visibilityState === "visible" ? run() : stop());
resize();
const ro = new ResizeObserver(resize);
ro.observe(root);
const io = new IntersectionObserver(([entry]) => {
onScreen = entry.isIntersecting;
if (onScreen) run();
else stop();
});
io.observe(root);
root.addEventListener("pointermove", onPointerMove, { passive: true });
root.addEventListener("pointerleave", onPointerLeave);
document.addEventListener("visibilitychange", onVisibility);
run();
return () => {
stop();
ro.disconnect();
io.disconnect();
root.removeEventListener("pointermove", onPointerMove);
root.removeEventListener("pointerleave", onPointerLeave);
document.removeEventListener("visibilitychange", onVisibility);
};
}, [chargeMs]);
// ── The button ────────────────────────────────────────────────────────────────────────────────
const later = (ms: number, fn: () => void) => {
timers.current.push(setTimeout(fn, ms));
};
useEffect(() => () => timers.current.forEach(clearTimeout), []);
const jump = () => {
const d = drive.current;
d.jumping = true;
d.active = true;
go("jumping");
later(BLACKOUT_AT_MS, () => {
d.jumping = false;
d.active = false;
d.reset = true;
go("arriving");
later(FADE_OUT_MS, () => go("idle"));
});
};
const start = () => {
if (phaseRef.current !== "idle") return;
timers.current.forEach(clearTimeout);
timers.current = [];
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
jump(); // no charge, just the fade
return;
}
drive.current.active = true;
drive.current.startedAt = performance.now();
go("charging");
later(chargeMs, jump);
};
return (
<div ref={rootRef} className="ws" data-phase={phase}>
<style href="ui-warp-starfield" precedence="ui">
{css}
</style>
<canvas ref={canvasRef} className="ws-canvas" aria-hidden="true" />
<div className="ws-center">
<div className="ws-btn">
<span className="ws-glow" aria-hidden="true" />
<span className="ws-ring">
<button
type="button"
className="ws-press"
aria-label={`${label}: jump to hyperspace`}
aria-disabled={phase !== "idle"}
onClick={start}
>
{label}
</button>
</span>
</div>
</div>
<div className="ws-blackout" aria-hidden="true" />
</div>
);
}
const css = `
.ws {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
isolation: isolate;
background: #0a0a0f;
color: #f0f0f5;
font-family: var(--font-google-sans-flex, "Google Sans Flex"), system-ui, -apple-system, "Segoe UI", sans-serif;
-webkit-user-select: none;
user-select: none;
-webkit-tap-highlight-color: transparent;
}
.ws-canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
}
.ws-center {
position: absolute;
inset: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 18px;
padding: 24px;
pointer-events: none;
}
.ws-btn {
position: relative;
pointer-events: auto;
}
/* The rainbow: one gradient, twice as wide as the button, sliding along forever. */
.ws-ring,
.ws-glow {
background: linear-gradient(90deg, hsl(217 91% 60%), hsl(230 70% 55%), hsl(199 89% 48%), hsl(213 94% 68%), hsl(224 76% 48%));
background-size: 200%;
animation: ws-rainbow 2s linear infinite;
}
.ws-ring {
position: relative;
z-index: 1;
display: block;
padding: 2px;
border-radius: 999px;
transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ws-btn:hover .ws-ring { transform: scale(1.05); }
/* The glow behind it swells on hover, and more at the jump. */
.ws-glow {
position: absolute;
inset: -2px;
border-radius: 999px;
filter: blur(6px);
transform: translateZ(0);
will-change: filter;
transition: inset 0.3s ease, filter 0.3s ease, opacity 0.3s ease;
}
.ws-btn:hover .ws-glow { inset: -8px; filter: blur(10px); }
.ws[data-phase="jumping"] .ws-glow { inset: -24px; filter: blur(22px); }
.ws-press {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
height: 60px;
padding: 0 56px;
border: 0;
border-radius: 999px;
background: #121213;
color: #fff;
font: inherit;
font-size: 18px;
font-weight: 500;
white-space: nowrap;
cursor: pointer;
outline: none;
}
.ws-press[aria-disabled="true"] { cursor: default; }
.ws-press:focus-visible { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7); }
/* The jump: a clean fade to black, opaque before the field resets, then dropping out of warp. */
.ws-blackout {
position: absolute;
inset: 0;
z-index: 3;
background: #000;
opacity: 0;
pointer-events: none;
transition: opacity ${FADE_OUT_MS}ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
.ws[data-phase="jumping"] .ws-blackout {
opacity: 1;
pointer-events: auto;
transition: opacity ${FADE_IN_MS}ms cubic-bezier(0.45, 0, 0.4, 1);
}
@keyframes ws-rainbow {
from { background-position: 0%; }
to { background-position: 200%; }
}
@media (max-width: 480px) {
.ws-press { height: 52px; padding: 0 36px; font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
.ws-ring, .ws-glow { animation: none; }
.ws-ring, .ws-glow { transition: none !important; }
.ws-btn:hover .ws-ring { transform: none; }
}
`;






