cipher/public/index.html
maverick c48f9f4006 Encrypted group chats + major UI redesign
Groups (E2E via pairwise fan-out — sender encrypts each message separately to
every member with existing Signal sessions; server holds only name+membership):
- migration 0003: groups + group_members; routes/groups.js (create/list/get/add/leave)
- client: unified DM+group chat model, group create modal w/ member chips,
  fan-out deliver, groupId payload routing on receive, lazy group fetch,
  sender names in group bubbles, group info + leave

UI overhaul — glassmorphism redesign:
- animated aurora backdrop, blurred glass panels, violet→cyan gradient brand
- color-hashed gradient avatars (per name), group avatars
- message bubbles with rise animation + tails, gradient outgoing bubbles
- polished auth card w/ gradient border, pill actions, modal pop-in, toast styling
- responsive: full-width thread on mobile with back button

Verified live: 3-user group message fans out and both members decrypt.
SW cache v4->v5.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 13:16:16 +10:00

232 lines
15 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<meta name="theme-color" content="#0a0a14" />
<title>Cipher — encrypted messaging</title>
<link rel="manifest" href="/manifest.webmanifest" />
<link rel="icon" href="/icons/icon.svg" type="image/svg+xml" />
<link rel="apple-touch-icon" href="/icons/icon.svg" />
<style>
:root {
--bg: #0a0a14;
--bg-2: #0d0d1a;
--glass: rgba(28, 28, 48, 0.55);
--glass-2: rgba(40, 40, 66, 0.5);
--stroke: rgba(255, 255, 255, 0.08);
--stroke-2: rgba(255, 255, 255, 0.14);
--text: #eef0f8;
--muted: #9aa0c0;
--accent: #7c5cff; /* violet */
--accent-2: #22d3ee; /* cyan */
--accent-grad: linear-gradient(135deg, #7c5cff, #22d3ee);
--out-grad: linear-gradient(135deg, #6d4bff, #3b2ea8);
--danger: #ff6b81;
--radius: 18px;
--shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
color: var(--text); height: 100dvh; overflow: hidden; background: var(--bg);
-webkit-font-smoothing: antialiased;
}
/* animated aurora backdrop */
body::before {
content: ""; position: fixed; inset: -20%; z-index: -2;
background:
radial-gradient(40% 40% at 20% 25%, rgba(124, 92, 255, 0.28), transparent 60%),
radial-gradient(45% 45% at 82% 20%, rgba(34, 211, 238, 0.20), transparent 60%),
radial-gradient(50% 50% at 60% 90%, rgba(236, 72, 153, 0.16), transparent 60%);
filter: blur(30px); animation: drift 22s ease-in-out infinite alternate;
}
body::after { content: ""; position: fixed; inset: 0; z-index: -1; background: radial-gradient(120% 120% at 50% 0%, transparent 40%, rgba(0,0,0,0.55)); }
@keyframes drift {
0% { transform: translate(0,0) scale(1); }
100% { transform: translate(-4%, 3%) scale(1.12); }
}
#app { height: 100dvh; }
::selection { background: rgba(124,92,255,.4); }
/* scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }
button { cursor: pointer; font: inherit; border: none; color: inherit; transition: transform .12s ease, background .2s ease, box-shadow .2s ease, opacity .2s; }
button:active { transform: scale(.96); }
button:disabled { opacity: .55; cursor: default; }
input, textarea { font: inherit; }
/* ---------- auth ---------- */
.auth-card {
max-width: 380px; margin: 10vh auto 0; padding: 34px 28px;
background: var(--glass); backdrop-filter: blur(24px) saturate(140%); -webkit-backdrop-filter: blur(24px) saturate(140%);
border: 1px solid var(--stroke); border-radius: 26px; box-shadow: var(--shadow);
display: flex; flex-direction: column; gap: 13px; position: relative; overflow: hidden;
animation: pop .4s cubic-bezier(.2,.9,.3,1.2);
}
.auth-card::before {
content: ""; position: absolute; inset: 0; padding: 1px; border-radius: 26px;
background: linear-gradient(135deg, rgba(124,92,255,.6), rgba(34,211,238,.5), transparent 60%);
-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
-webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.auth-card h1 {
margin: 4px 0 0; text-align: center; font-size: 34px; letter-spacing: .5px; font-weight: 800;
background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { margin: 0 0 6px; text-align: center; color: var(--muted); font-size: 13px; }
.auth-card input {
padding: 13px 15px; border-radius: 13px; border: 1px solid var(--stroke); background: rgba(0,0,0,.25); color: var(--text); font-size: 15px; transition: border .2s, box-shadow .2s;
}
.auth-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,92,255,.22); }
.auth-err, .modal-err { color: var(--danger); font-size: 13px; min-height: 16px; text-align: center; }
.auth-divider { text-align: center; color: var(--muted); font-size: 11px; margin-top: 6px; text-transform: uppercase; letter-spacing: 2px; opacity: .7; }
.link-btn { background: transparent; color: var(--accent-2); padding: 5px; font-size: 14px; font-weight: 500; }
.link-btn:hover { text-decoration: underline; }
button.primary {
padding: 13px 16px; border-radius: 13px; background: var(--accent-grad); color: #fff; font-weight: 700;
box-shadow: 0 8px 24px rgba(124,92,255,.35);
}
button.primary:hover { box-shadow: 0 10px 30px rgba(124,92,255,.5); transform: translateY(-1px); }
button.ghost {
padding: 13px 16px; border-radius: 13px; background: rgba(255,255,255,.05); color: var(--text); border: 1px solid var(--stroke);
}
button.ghost:hover { background: rgba(255,255,255,.1); }
/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 350px 1fr; height: 100dvh; padding: 14px; gap: 14px; }
.sidebar, .main {
background: var(--glass); backdrop-filter: blur(22px) saturate(140%); -webkit-backdrop-filter: blur(22px) saturate(140%);
border: 1px solid var(--stroke); border-radius: 24px; overflow: hidden; box-shadow: var(--shadow);
}
.sidebar { display: flex; flex-direction: column; min-height: 0; }
.side-header { display: flex; gap: 12px; align-items: center; padding: 16px 18px; cursor: pointer; border-bottom: 1px solid var(--stroke); transition: background .2s; }
.side-header:hover { background: rgba(255,255,255,.04); }
.side-id { min-width: 0; }
.me { font-weight: 700; display: flex; align-items: center; gap: 5px; }
.caret { color: var(--muted); font-size: 11px; }
.handle { color: var(--muted); font-size: 12.5px; }
.side-actions { display: flex; gap: 10px; padding: 12px 14px; }
.pill {
flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
padding: 10px; border-radius: 13px; background: rgba(255,255,255,.05); border: 1px solid var(--stroke); color: var(--text); font-weight: 600; font-size: 14px;
}
.pill:hover { background: rgba(124,92,255,.16); border-color: rgba(124,92,255,.5); }
.pill span { font-size: 16px; line-height: 1; }
.chat-list { overflow-y: auto; flex: 1; padding: 6px; }
.list-empty { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 14px; }
.chat-item { display: flex; gap: 13px; padding: 11px 12px; cursor: pointer; align-items: center; border-radius: 15px; transition: background .18s; }
.chat-item:hover { background: rgba(255,255,255,.05); }
.chat-item.active { background: rgba(124,92,255,.18); box-shadow: inset 0 0 0 1px rgba(124,92,255,.4); }
.chat-meta { min-width: 0; }
.chat-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
width: 46px; height: 46px; border-radius: 15px; flex: none; display: grid; place-items: center;
font-weight: 800; color: #fff; font-size: 18px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), 0 4px 14px rgba(0,0,0,.3); position: relative;
}
.avatar.sm { width: 34px; height: 34px; border-radius: 11px; font-size: 14px; }
.avatar.group .group-glyph { font-size: 20px; }
/* ---------- main pane ---------- */
.main { display: flex; flex-direction: column; min-height: 0; }
.empty { margin: auto; text-align: center; padding: 30px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-badge { width: 76px; height: 76px; border-radius: 24px; display: grid; place-items: center; font-size: 34px; background: var(--accent-grad); box-shadow: 0 12px 40px rgba(124,92,255,.4); animation: float 4s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.empty-title { font-weight: 700; font-size: 17px; }
.empty-sub { color: var(--muted); font-size: 14px; max-width: 280px; }
.chat-head { display: flex; gap: 13px; align-items: center; padding: 13px 18px; border-bottom: 1px solid var(--stroke); background: rgba(255,255,255,.02); }
.chat-head-meta { flex: 1; min-width: 0; }
.back-btn { display: none; background: transparent; color: var(--text); font-size: 26px; line-height: 1; padding: 0 4px; }
.head-action { background: rgba(255,255,255,.06); color: var(--text); width: 38px; height: 38px; border-radius: 12px; font-size: 17px; }
.head-action:hover { background: rgba(255,255,255,.12); }
.thread { flex: 1; overflow-y: auto; padding: 22px 22px 8px; display: flex; flex-direction: column; gap: 4px; }
.bubble {
max-width: 66%; padding: 9px 13px 7px; border-radius: 18px; font-size: 14.5px; line-height: 1.4; position: relative; word-wrap: break-word;
animation: rise .22s ease; box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.bubble.in { background: var(--glass-2); border: 1px solid var(--stroke); align-self: flex-start; border-bottom-left-radius: 5px; }
.bubble.out { background: var(--out-grad); align-self: flex-end; border-bottom-right-radius: 5px; box-shadow: 0 4px 16px rgba(109,75,255,.3); }
.bubble .sender { font-size: 12.5px; font-weight: 700; margin-bottom: 2px; }
.bubble .time { font-size: 10.5px; color: rgba(255,255,255,.55); text-align: right; margin-top: 3px; }
.media-img { max-width: 260px; border-radius: 12px; display: block; }
.media-file { color: var(--text); text-decoration: none; font-weight: 500; }
.composer { display: flex; gap: 10px; padding: 14px 16px; align-items: center; border-top: 1px solid var(--stroke); background: rgba(255,255,255,.02); }
.composer-input { flex: 1; padding: 12px 16px; border-radius: 22px; border: 1px solid var(--stroke); background: rgba(0,0,0,.28); color: var(--text); font-size: 15px; transition: border .2s, box-shadow .2s; }
.composer-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,92,255,.2); }
.attach { cursor: pointer; font-size: 20px; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.06); user-select: none; flex: none; transition: background .2s; }
.attach:hover { background: rgba(255,255,255,.12); }
.send { width: 46px; height: 46px; border-radius: 50%; background: var(--accent-grad); color: #fff; font-size: 17px; flex: none; box-shadow: 0 6px 18px rgba(124,92,255,.4); display: grid; place-items: center; }
.send:hover { transform: translateY(-1px) scale(1.03); }
/* ---------- modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(6,6,14,.66); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
background: var(--glass); backdrop-filter: blur(26px) saturate(150%); -webkit-backdrop-filter: blur(26px) saturate(150%);
border: 1px solid var(--stroke-2); border-radius: 22px; padding: 24px; width: 100%; max-width: 380px;
display: flex; flex-direction: column; gap: 13px; box-shadow: var(--shadow); max-height: 84vh; overflow-y: auto;
animation: pop .28s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }
.modal-title { margin: 0; font-size: 19px; font-weight: 700; }
.modal-input { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--stroke); background: rgba(0,0,0,.28); color: var(--text); font-size: 15px; }
.modal-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,92,255,.2); }
textarea.modal-input { resize: vertical; font-family: inherit; }
.modal-note { color: var(--muted); font-size: 13px; line-height: 1.45; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.modal-actions button { padding: 10px 18px; }
.code-box { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 18px; letter-spacing: 1px; background: rgba(0,0,0,.35); padding: 15px; border-radius: 12px; text-align: center; word-break: break-all; user-select: all; border: 1px dashed var(--stroke-2); }
.code-box.small { font-size: 12px; letter-spacing: 0; }
.qr { display: block; width: 224px; height: 224px; margin: 4px auto; border-radius: 14px; background: #fff; padding: 8px; }
.qr-video { width: 100%; max-width: 280px; border-radius: 14px; display: block; margin: 8px auto; background: #000; }
/* account menu + group rows */
.acct-row, .acct-action { text-align: left; background: rgba(255,255,255,.05); color: var(--text); padding: 12px 14px; border-radius: 13px; border: 1px solid var(--stroke); font-weight: 500; }
.acct-row:hover, .acct-action:hover { background: rgba(255,255,255,.1); }
.acct-row.active { outline: 1px solid var(--accent); background: rgba(124,92,255,.16); }
.acct-action { color: var(--accent-2); text-align: center; }
.acct-action.danger { color: var(--danger); }
.member-row { display: flex; gap: 12px; align-items: center; padding: 4px 0; }
/* group creation chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: rgba(124,92,255,.2); border: 1px solid rgba(124,92,255,.4); color: var(--text); padding: 5px 10px; border-radius: 20px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.chip-x { cursor: pointer; font-weight: 700; opacity: .8; }
.chip-x:hover { opacity: 1; }
/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 12px 20px; border-radius: 14px; font-size: 14px; box-shadow: var(--shadow); max-width: 90vw; backdrop-filter: blur(20px); border: 1px solid var(--stroke-2); animation: rise .25s ease; }
.toast.error { background: rgba(80, 24, 36, .8); color: #ffc2cc; }
.toast.info { background: rgba(30, 40, 66, .8); color: var(--text); }
/* ---------- responsive ---------- */
@media (max-width: 760px) {
.shell { grid-template-columns: 1fr; padding: 8px; gap: 8px; }
.shell.chat-open .sidebar { display: none; }
.shell:not(.chat-open) .main { display: none; }
.back-btn { display: block; }
.bubble { max-width: 82%; }
}
</style>
</head>
<body>
<div id="app"></div>
<script type="module" src="/js/app.js"></script>
</body>
</html>