diff --git a/apps/cloud/src/pages.ts b/apps/cloud/src/pages.ts
index bd6cbd2..ae12fd3 100644
--- a/apps/cloud/src/pages.ts
+++ b/apps/cloud/src/pages.ts
@@ -1,5 +1,6 @@
// The pages the Worker itself serves on public URLs: small, self-contained
-// HTML with inline CSS and no external assets.
+// HTML with inline CSS and no external assets, in Localify's look: neutral
+// greys, Geist when the visitor has it, a near-black button, light and dark.
/** Where the password form posts, on every protected host. */
export const ACCESS_PATH = "/__localify/access";
@@ -11,25 +12,53 @@ export const ABUSE_EMAIL = "abuse@localify.dev";
export const RETRY_AFTER_SECONDS = 60;
const STYLE = `
-:root{color-scheme:light dark;--bg:#f6f6f4;--card:#fff;--text:#1b1b18;--muted:#5d5d57;--line:#d8d8d2;--accent:#1f5eff;--error:#b42318}
-@media (prefers-color-scheme:dark){:root{--bg:#121211;--card:#1c1c1a;--text:#ededea;--muted:#a3a39c;--line:#383834;--accent:#7a9dff;--error:#ff8a80}}
+:root{color-scheme:light dark;--bg:#fafafa;--card:#fff;--text:#171717;--muted:#737373;--line:#e5e5e5;--soft:#f5f5f5;--button:#171717;--button-text:#fafafa;--ring:#3b82f6;--error:#dc2626;--shadow:0 1px 0 rgba(13,13,13,.03),0 24px 48px -24px rgba(13,13,13,.14)}
+@media (prefers-color-scheme:dark){:root{--bg:#0a0a0a;--card:#171717;--text:#fafafa;--muted:#a3a3a3;--line:#262626;--soft:#1f1f1f;--button:#fafafa;--button-text:#171717;--error:#f87171;--shadow:0 1px 0 rgba(0,0,0,.4),0 24px 48px -24px rgba(0,0,0,.6)}}
*{box-sizing:border-box}
-body{margin:0;min-height:100vh;display:grid;place-items:center;padding:16px;background:var(--bg);color:var(--text);font:16px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif}
-main{width:100%;max-width:380px;background:var(--card);border:1px solid var(--line);border-radius:12px;padding:28px}
-h1{font-size:1.25rem;margin:0 0 8px}
-p{margin:0 0 16px;color:var(--muted)}
-.host{color:var(--text);font-weight:600;word-break:break-all}
-label{display:block;font-weight:600;margin-bottom:6px}
-input{width:100%;font:inherit;padding:10px 12px;border:1px solid var(--line);border-radius:8px;background:var(--bg);color:var(--text)}
-input:focus-visible,button:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
-button{margin-top:16px;width:100%;font:inherit;font-weight:600;padding:10px 12px;border:0;border-radius:8px;background:var(--accent);color:#fff;cursor:pointer}
-.error{color:var(--error);margin:12px 0 0}
-a{color:var(--accent)}
-a:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
-footer{margin-top:20px;font-size:.85rem;color:var(--muted)}
+html{-webkit-text-size-adjust:100%}
+body{margin:0;min-height:100vh;min-height:100dvh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;padding:32px 16px;background:var(--bg);color:var(--text);font:15px/1.6 "Geist Variable","Geist",ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;-webkit-font-smoothing:antialiased}
+.brand{display:flex;align-items:center;gap:8px;font-weight:600;font-size:15px;letter-spacing:-.01em;color:var(--text)}
+.brand svg{width:20px;height:20px}
+main{width:100%;max-width:400px;background:var(--card);border:1px solid var(--line);border-radius:20px;padding:28px;box-shadow:var(--shadow)}
+.title{position:relative;display:flex;align-items:center;gap:6px}
+h1{margin:0;font-size:20px;line-height:1.3;font-weight:600;letter-spacing:-.025em}
+p{margin:12px 0 0;color:var(--muted)}
+strong{color:var(--text);font-weight:600}
+.host{margin:2px 0 0;color:var(--muted);font:13px/1.5 ui-monospace,"Geist Mono",SFMono-Regular,Menlo,monospace;word-break:break-all}
+.help summary{display:grid;place-items:center;width:22px;height:22px;border-radius:50%;color:var(--muted);cursor:pointer;list-style:none}
+.help summary::-webkit-details-marker{display:none}
+.help summary svg{width:16px;height:16px}
+.help summary:hover,.help[open] summary{color:var(--text)}
+.tip{position:absolute;left:0;right:0;top:calc(100% + 10px);z-index:1;padding:12px 14px;border:1px solid var(--line);border-radius:12px;background:var(--card);box-shadow:var(--shadow);font-size:13px;line-height:1.55}
+.tip p{margin:0}
+.tip p+p{margin-top:6px}
+form{margin-top:20px}
+.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
+input{width:100%;font:inherit;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:var(--card);color:var(--text)}
+input::placeholder{color:var(--muted)}
+input[aria-invalid="true"]{border-color:var(--error)}
+button{display:block;margin-top:12px;width:100%;font:inherit;font-weight:500;padding:10px 14px;border:0;border-radius:10px;background:var(--button);color:var(--button-text);cursor:pointer;transition:opacity .15s}
+button:hover{opacity:.88}
+input:focus-visible,button:focus-visible,a:focus-visible,summary:focus-visible{outline:2px solid var(--ring);outline-offset:2px}
+.error{color:var(--error);margin:8px 0 0;font-size:14px}
+a{color:var(--text);text-decoration:underline;text-decoration-color:var(--line);text-decoration-thickness:1.5px;text-underline-offset:4px}
+a:hover{text-decoration-color:currentColor}
+footer{font-size:13px;color:var(--muted)}
footer a{color:inherit}
+.signing{display:none;align-items:center;gap:12px;color:var(--muted)}
+.spinner{flex:none;width:18px;height:18px;border:2px solid var(--line);border-top-color:var(--text);border-radius:50%;animation:spin .7s linear infinite}
+@keyframes spin{to{transform:rotate(360deg)}}
+@media (prefers-reduced-motion:reduce){.spinner{animation:none}}
+[data-signing-in] main>:not(.signing){display:none}
+[data-signing-in] .signing{display:flex}
`;
+/** The Localify mark, drawn inline: the pages load nothing else. */
+const LOGO = ``;
+
+/** A question mark in a circle: the explanation of a page sits behind it. */
+const HELP_ICON = ``;
+
/** Every page refuses to be framed, except the framed warning (see `framedWarningPage`). */
function csp(frameAncestors = "'none'"): string {
return `default-src 'none'; style-src 'unsafe-inline'; form-action 'self'; frame-ancestors ${frameAncestors}; base-uri 'none'`;
@@ -48,28 +77,28 @@ const SECURITY_HEADERS: Record = {
/**
* Signs in with the password a shared link carries after `#`. The fragment
* never reaches a server, so it is read here, then cleared from the address
- * bar and history before the form posts it.
+ * bar and history before the form posts it. It runs in ``, so the page
+ * shows "Signing in" from its first paint instead of the form. A page brought
+ * back from the history cache shows the form again.
*/
const SUBMIT_LINK_PASSWORD = `const hash = location.hash.slice(1);
if (hash) {
history.replaceState(null, "", location.pathname + location.search);
- try {
- const form = document.forms[0];
- form.password.value = decodeURIComponent(hash);
- form.submit();
- } catch {}
-}`;
-
-/**
- * The same for a browser that has not acknowledged the warning: it fills the
- * password in, and the visitor's `Continue` posts it with the acknowledgement.
- */
-const FILL_LINK_PASSWORD = `const hash = location.hash.slice(1);
-if (hash) {
- history.replaceState(null, "", location.pathname + location.search);
- try {
- document.forms[0].password.value = decodeURIComponent(hash);
- } catch {}
+ const root = document.documentElement;
+ root.dataset.signingIn = "";
+ addEventListener("pageshow", (event) => {
+ if (event.persisted) delete root.dataset.signingIn;
+ });
+ addEventListener("DOMContentLoaded", () => {
+ try {
+ const form = document.forms[0];
+ form.password.value = decodeURIComponent(hash);
+ form.from.value = "link";
+ form.submit();
+ } catch {
+ delete root.dataset.signingIn;
+ }
+ });
}`;
function page(
@@ -91,23 +120,47 @@ function page(
${escapeHtml(title)}
-
+${nonce ? `\n` : ""}
+${LOGO}Localify
${body}
-
-${nonce ? `\n` : ""}
+
+