All posts

6 min readPost 22

Continuous-curvature corners, and the 40 minutes of blank page they caused

We fit a 1.78 radius compensation factor across 13 UI sizes and built a zero-dependency PostCSS plugin to bring Apple-style continuous-curvature squircles to Obituary without changing source CSS—then watched the live homepage turn blank white three minutes after merging. Here is both the math and the @import-inside-@layer postmortem.

On this page
  1. Why turning on corner-shape: squircle directly looks wrong
  2. Fitting 1.78 against Apple's curve across 13 real UI sizes
  3. A zero-dependency PostCSS plugin with zero WebKit pixel drift
  4. Three minutes after merge: an @import trapped inside @layer

At 13:40 on 21 November we merged Apple-style continuous-curvature corners (squircles) across Obituary's desktop window, homepage, and docs site—without rewriting a single border-radius in source CSS.

Three minutes later, the live homepage went completely blank white. Recovery took 39 minutes overseas and 41 minutes on the China mirror.

The first half of this post walks through the geometry and zero-dependency PostCSS plugin that kept legacy browsers pixel-identical; the second half unpacks how a green build shipped a 40-minute outage.

Why turning on corner-shape: squircle directly looks wrong ​

Apple's iOS corners feel smooth because curvature eases gradually out of the straight edge rather than snapping abruptly into a circular arc. Chromium and WebView2 139+ ship native corner-shape: squircle, yet flipping it on over existing radii immediately backfires:

  • Native squircle cuts a diagonal depth of only 0.23× the radius.
  • A circular arc cuts 0.41× the radius.

At the same pixel radius, native squircles look visibly boxy.

Fitting 1.78 against Apple's curve across 13 real UI sizes ​

The fix is scaling the radius up. Using Figma's 60% corner smoothing (Apple's curve, rendered offline with figma-squircle strictly for comparison), we overlaid 13 real component sizes from 60×20 badges to 600×360 hero cards across radii of 5–32 px at 2×–8× magnification and minimized pixel error.

Excluding pills clamped by browser rules (radius > 0.28 × height), every component converged tightly between 1.77 and 1.79, giving 1.78:

MetricApple curvesquircle × 1.78
Diagonal corner depth (× radius)0.410.40
Straight-edge lead-in length (× radius)1.601.78
Max contour deviation at 8 px radius—0.18 px
Max contour deviation at 32 px radius—0.67 px
Three overlays comparing radius-24 corners against Apple's curve: circular arc differs by 22 sq px, uncompensated squircle by 349 sq px, and 1.78x squircle by 40 sq px hugging the red target line
Radius-24 overlay fit: Apple's curve in red, mismatched area in orange. Uncompensated squircle drifts by 349 sq px; scaling radius by 1.78 brings it down to 40 sq px.
Bar chart of max single-point distance from Apple's curve across six sizes: uncompensated squircle ranges from 0.98 px to 6.13 px, while 1.78x squircle stays within 0.12–0.67 px
Worst-case single-point deviation across six UI sizes: uncompensated squircles balloon to 6.13 px, while 1.78x stays within 0.12–0.67 px.

A zero-dependency PostCSS plugin with zero WebKit pixel drift ​

Rather than hand-multiplying hundreds of rules, we wrote scripts/squircle-corners.mjs (zero dependencies) and wired it into the desktop window, landing page, and docs builds. Every eligible border-radius compiles to:

  • border-radius: calc(<radius> * var(--squircle-k, 1))
  • corner-shape: var(--squircle-shape, round)

Both CSS custom properties are defined only inside @supports (corner-shape: squircle):

  • Chromium and WebView2 139+ get compensated continuous corners automatically.
  • Safari, WKWebView, WebKitGTK, and Firefox ignore the @supports block, evaluate calc(<radius> * 1) with round, and render pixel-for-pixel identically to before.

The plugin skips percentages, >= 100px pills, calc(infinity * 1px), and sub-5 px radii, while nested concentric boxes compute calc(var(--r) * var(--squircle-k, 1) + inset). We ruled out JS-computed SVG clip-path/mask (clips borders, shadows, and focus rings) and postcss-smooth-corners (hardcodes a 1.715 area factor and skips var()/calc() tokens).

Eleven plugin unit tests caught all 7 injected faults. Pixel-diffing before and after in WebKit produced 0 differing pixels across every desktop look, every docs page, and every static homepage element; gzipped CSS grew by only 163–367 bytes with zero runtime JS and identical 184–188 ms FCP / 448 ms LCP.

Before-and-after zoom of the homepage install card's top-left corner: after switching to continuous curvature, the animated border beam hugs the border and outer ring tightly
Top-left corner of the homepage install box before (left) and after (right): the traveling border beam tracks the continuous corner cleanly.

Three minutes after merge: an @import trapped inside @layer ​

Merged at 13:40; overseas homepage went blank at 13:43; China mirror went blank at 13:53 (desktop downloads and binaries were untouched).

The bug came from how two stylesheets met during bundling:

  1. The desktop window stylesheet opened with @import "./squircle.css".
  2. Because the homepage embeds the live desktop component, its Vite build wraps the entire desktop stylesheet inside @layer gui { ... } so global GUI button rules cannot override homepage styles.
  3. After a rebase, @import landed inside @layer gui—illegal CSS syntax, so Vite left @import unbundled verbatim.
  4. In production, browsers fetched assets/squircle.css, received a 404 HTML page, aborted Vite's CSS preload for the lazy window-demo chunk, and crashed the homepage white.

Why CI and screenshots missed it ​

Screenshots had been taken from a production build—before the final rebase. After rebasing, both builds and doc checks ran green, but nobody opened the freshly merged homepage in a browser. Initial 404s were briefly mistaken for CDN edge lag until a blank screenshot and console preload error sent us straight into dist/assets/.

The 14:14 fix and a seven-line permanent gate ​

The homepage build now strips the redundant @import from the embedded GUI stylesheet (since index.css already imports squircle.css at top level), and assemble.mjs enforces a seven-line hard check: if any bundled stylesheet under assets/ or docs/assets/ contains @import, the entire build fails. Testing deliberate @import leaks in both outputs tripped the check cleanly.

OriginRestoredOutage window
Overseas (GitHub Pages)14:2239 m 10 s
Mainland China mirror14:3441 m 07 s
Seven-line check added to assemble.mjs scanning every bundled CSS file in assets/ and docs/assets/ and throwing an error if any @import remains
The seven-line build guard added to assemble.mjs: any lingering @import in bundled CSS fails the build immediately.

The outage permanently changed our release process: shared website merges and deploys now run solely through the coordinator on the final merged tree, and visual screenshot verification must come from the post-merge production build—never from a pre-rebase branch.

All posts