add same look and feel as fló,fo
This commit is contained in:
+228
-109
@@ -3,26 +3,61 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, viewport-fit=cover" />
|
||||
<title>Support Chat</title>
|
||||
<title>Support Chat — FLÓ</title>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var stored = localStorage.getItem('poc-theme');
|
||||
var theme = stored || (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'tokyo' : 'light');
|
||||
document.documentElement.setAttribute('data-theme', theme);
|
||||
})();
|
||||
</script>
|
||||
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&display=swap" rel="stylesheet">
|
||||
<script src="https://unpkg.com/htmx.org@1.9.12"></script>
|
||||
|
||||
<style>
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
:root {
|
||||
--bg: #111318;
|
||||
--surface: #191c22;
|
||||
--surface-soft: #20242c;
|
||||
--border: #2b303a;
|
||||
--accent: #8f9cff;
|
||||
--accent-dim: #737fd3;
|
||||
:root,
|
||||
[data-theme="light"] {
|
||||
--bg: #f4f1ec;
|
||||
--bg-panel: rgba(255, 253, 250, 0.72);
|
||||
--nav-bg: rgba(244, 241, 236, 0.6);
|
||||
--ink: #1a1d22;
|
||||
--ink-muted: #595f68;
|
||||
--ink-dim: #9299a2;
|
||||
--accent: #2c5a7a;
|
||||
--border: rgba(26, 29, 34, 0.1);
|
||||
--danger: #a03030;
|
||||
--danger-soft: rgba(160, 48, 48, 0.08);
|
||||
--danger-text: #a03030;
|
||||
--user-bubble: #2c5a7a;
|
||||
--user-bubble-ink: #f4f1ec;
|
||||
--peer-bubble: rgba(26, 29, 34, 0.06);
|
||||
--peer-bubble-ink: #1a1d22;
|
||||
--input-bg: rgba(26, 29, 34, 0.04);
|
||||
}
|
||||
|
||||
[data-theme="tokyo"] {
|
||||
--bg: #07070d;
|
||||
--bg-panel: rgba(15, 16, 28, 0.72);
|
||||
--nav-bg: rgba(7, 7, 13, 0.65);
|
||||
--ink: #e8f4ff;
|
||||
--ink-muted: #a3b3cc;
|
||||
--ink-dim: #7886a0;
|
||||
--accent: #64dcff;
|
||||
--border: rgba(100, 220, 255, 0.12);
|
||||
--danger: #d93d3d;
|
||||
--danger-soft: rgba(217, 61, 61, 0.16);
|
||||
--danger-text: #ffd1d1;
|
||||
--text: #eceff4;
|
||||
--muted: #9aa3b2;
|
||||
--user: #8f9cff;
|
||||
--supporter: #2b303a;
|
||||
--radius: 12px;
|
||||
--user-bubble: #64dcff;
|
||||
--user-bubble-ink: #07070d;
|
||||
--peer-bubble: rgba(100, 220, 255, 0.08);
|
||||
--peer-bubble-ink: #e8f4ff;
|
||||
--input-bg: rgba(100, 220, 255, 0.04);
|
||||
}
|
||||
|
||||
html, body {
|
||||
@@ -35,16 +70,29 @@
|
||||
|
||||
body {
|
||||
background: var(--bg);
|
||||
color: var(--ink);
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 0.92rem;
|
||||
font-weight: 300;
|
||||
line-height: 1.65;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
color: var(--text);
|
||||
padding: 4.4rem 1rem max(1rem, env(safe-area-inset-bottom));
|
||||
transition: background 0.3s ease, color 0.3s ease;
|
||||
}
|
||||
|
||||
button, input { font: inherit; }
|
||||
|
||||
a {
|
||||
color: var(--accent);
|
||||
text-decoration: none;
|
||||
border-bottom: 1px solid transparent;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
a:hover { border-bottom-color: var(--accent); }
|
||||
|
||||
/* ---- Timer ---- */
|
||||
.page-timer {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -55,81 +103,101 @@
|
||||
transform: translateX(-50%);
|
||||
color: var(--danger-text);
|
||||
border: 1px solid var(--danger);
|
||||
border-radius: 999px;
|
||||
padding: 0.38rem 0.8rem;
|
||||
font-size: 0.82rem;
|
||||
font-weight: 800;
|
||||
border-radius: 2px;
|
||||
padding: 0.3rem 0.7rem;
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.08em;
|
||||
background: var(--danger-soft);
|
||||
box-shadow: 0 0 0 1px rgba(217, 61, 61, 0.08), 0 8px 24px rgba(217, 61, 61, 0.08);
|
||||
z-index: 10;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ---- Start form ---- */
|
||||
#start-form {
|
||||
background: var(--surface);
|
||||
background: var(--bg-panel);
|
||||
backdrop-filter: blur(14px);
|
||||
-webkit-backdrop-filter: blur(14px);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 20px;
|
||||
padding: 2rem;
|
||||
width: min(360px, 100%);
|
||||
border-radius: 3px;
|
||||
padding: 3rem 3.5rem;
|
||||
width: min(400px, 100%);
|
||||
text-align: left;
|
||||
box-shadow: 0 18px 55px rgba(0, 0, 0, 0.22);
|
||||
box-shadow: 0 8px 30px rgba(26, 29, 34, 0.06);
|
||||
animation: panel-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
|
||||
opacity: 0;
|
||||
transform: translateY(10px);
|
||||
transition: background 0.3s ease, border-color 0.3s ease;
|
||||
}
|
||||
|
||||
#start-form h1 {
|
||||
font-size: 1.35rem;
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-weight: 700;
|
||||
margin-bottom: 0.45rem;
|
||||
font-size: 1.5rem;
|
||||
letter-spacing: -0.02em;
|
||||
margin-bottom: 0.6rem;
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
[data-theme="tokyo"] #start-form h1 {
|
||||
text-shadow: 0 0 10px rgba(100, 220, 255, 0.3);
|
||||
}
|
||||
|
||||
#start-form p {
|
||||
font-size: 0.9rem;
|
||||
color: var(--muted);
|
||||
margin-bottom: 1.35rem;
|
||||
line-height: 1.55;
|
||||
font-size: 0.85rem;
|
||||
color: var(--ink-muted);
|
||||
margin-bottom: 2rem;
|
||||
line-height: 1.75;
|
||||
}
|
||||
|
||||
#start-form input[type="text"] {
|
||||
width: 100%;
|
||||
padding: 0.72rem 0.95rem;
|
||||
background: var(--bg);
|
||||
padding: 0.65rem 0.85rem;
|
||||
background: var(--input-bg);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
color: var(--text);
|
||||
font-size: 16px;
|
||||
border-radius: 3px;
|
||||
color: var(--ink);
|
||||
font-size: 0.88rem;
|
||||
line-height: 1.25;
|
||||
margin-bottom: 1rem;
|
||||
outline: none;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
#start-form input[type="text"]:focus { border-color: var(--accent); }
|
||||
#start-form input[type="text"]::placeholder { color: var(--ink-dim); }
|
||||
|
||||
#start-form button {
|
||||
width: 100%;
|
||||
padding: 0.72rem;
|
||||
padding: 0.65rem;
|
||||
background: var(--accent);
|
||||
color: #111318;
|
||||
color: var(--bg);
|
||||
border: none;
|
||||
border-radius: var(--radius);
|
||||
font-size: 0.95rem;
|
||||
border-radius: 3px;
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 0.82rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s;
|
||||
transition: opacity 0.2s;
|
||||
}
|
||||
#start-form button:hover { opacity: 0.85; }
|
||||
|
||||
#start-form button:hover { background: var(--accent-dim); }
|
||||
|
||||
/* ---- Chat container ---- */
|
||||
#chat-container {
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
width: min(390px, 100%);
|
||||
width: min(420px, 100%);
|
||||
height: min(620px, calc(var(--app-height, 100dvh) - 5.4rem));
|
||||
background: var(--surface);
|
||||
background: var(--bg-panel);
|
||||
backdrop-filter: blur(14px);
|
||||
-webkit-backdrop-filter: blur(14px);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 20px;
|
||||
border-radius: 3px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 18px 55px rgba(0, 0, 0, 0.22);
|
||||
box-shadow: 0 8px 30px rgba(26, 29, 34, 0.06);
|
||||
transition: background 0.3s ease, border-color 0.3s ease;
|
||||
}
|
||||
|
||||
#chat-header {
|
||||
@@ -139,18 +207,20 @@
|
||||
padding: 0.9rem 1rem;
|
||||
border-bottom: 1px solid var(--border);
|
||||
font-weight: 700;
|
||||
font-size: 0.95rem;
|
||||
font-size: 0.88rem;
|
||||
min-height: 52px;
|
||||
}
|
||||
|
||||
.chat-session-id {
|
||||
margin-left: auto;
|
||||
font-size: 0.72rem;
|
||||
color: var(--muted);
|
||||
font-size: 0.68rem;
|
||||
color: var(--ink-dim);
|
||||
font-weight: 400;
|
||||
white-space: nowrap;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
/* ---- Messages ---- */
|
||||
#messages {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
@@ -162,9 +232,9 @@
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
#messages::-webkit-scrollbar { width: 4px; }
|
||||
#messages::-webkit-scrollbar { width: 3px; }
|
||||
#messages::-webkit-scrollbar-track { background: transparent; }
|
||||
#messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
|
||||
#messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
|
||||
|
||||
.msg-wrap { display: flex; }
|
||||
.msg-user-wrap { justify-content: flex-end; }
|
||||
@@ -172,43 +242,44 @@
|
||||
|
||||
.msg-user, .msg-supporter {
|
||||
max-width: 78%;
|
||||
padding: 0.58rem 0.85rem;
|
||||
border-radius: 16px;
|
||||
font-size: 0.88rem;
|
||||
line-height: 1.48;
|
||||
padding: 0.55rem 0.8rem;
|
||||
border-radius: 12px;
|
||||
font-size: 0.85rem;
|
||||
line-height: 1.55;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.msg-user {
|
||||
background: var(--user);
|
||||
color: #111318;
|
||||
border-bottom-right-radius: 4px;
|
||||
background: var(--user-bubble);
|
||||
color: var(--user-bubble-ink);
|
||||
border-bottom-right-radius: 3px;
|
||||
}
|
||||
|
||||
.msg-supporter {
|
||||
background: var(--supporter);
|
||||
color: var(--text);
|
||||
border-bottom-left-radius: 4px;
|
||||
background: var(--peer-bubble);
|
||||
color: var(--peer-bubble-ink);
|
||||
border-bottom-left-radius: 3px;
|
||||
}
|
||||
|
||||
.msg-label {
|
||||
display: block;
|
||||
font-size: 0.68rem;
|
||||
font-weight: 600;
|
||||
font-size: 0.62rem;
|
||||
font-weight: 500;
|
||||
opacity: 0.7;
|
||||
margin-bottom: 2px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
letter-spacing: 0.12em;
|
||||
}
|
||||
|
||||
.msg-text { margin: 0; }
|
||||
|
||||
.msg-time {
|
||||
display: block;
|
||||
font-size: 0.66rem;
|
||||
opacity: 0.55;
|
||||
font-size: 0.6rem;
|
||||
opacity: 0.5;
|
||||
margin-top: 4px;
|
||||
text-align: right;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
.msg-system-wrap {
|
||||
@@ -218,20 +289,21 @@
|
||||
}
|
||||
|
||||
.msg-system-text {
|
||||
font-size: 0.75rem;
|
||||
color: var(--muted);
|
||||
background: var(--bg);
|
||||
font-size: 0.7rem;
|
||||
color: var(--ink-dim);
|
||||
background: var(--input-bg);
|
||||
padding: 0.25rem 0.75rem;
|
||||
border-radius: 20px;
|
||||
border-radius: 2px;
|
||||
text-align: center;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
/* ---- Typing bubble ---- */
|
||||
.typing-bubble {
|
||||
display: none;
|
||||
padding: 0 0.9rem 0.55rem;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.typing-bubble.visible { display: flex; }
|
||||
|
||||
.typing-bubble-inner {
|
||||
@@ -240,40 +312,28 @@
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
min-width: 48px;
|
||||
padding: 0.58rem 0.78rem;
|
||||
background: var(--supporter);
|
||||
border-radius: 16px;
|
||||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
|
||||
.typing-bubble-inner::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 7px;
|
||||
bottom: -4px;
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
background: var(--supporter);
|
||||
transform: rotate(45deg);
|
||||
border-radius: 2px;
|
||||
padding: 0.55rem 0.75rem;
|
||||
background: var(--peer-bubble);
|
||||
border-radius: 12px;
|
||||
border-bottom-left-radius: 3px;
|
||||
}
|
||||
|
||||
.typing-dot {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
border-radius: 50%;
|
||||
background: var(--muted);
|
||||
background: var(--ink-dim);
|
||||
animation: typing-bounce 1.1s infinite ease-in-out;
|
||||
}
|
||||
|
||||
.typing-dot:nth-child(2) { animation-delay: 0.16s; }
|
||||
.typing-dot:nth-child(3) { animation-delay: 0.32s; }
|
||||
|
||||
@keyframes typing-bounce {
|
||||
0%, 75%, 100% { transform: translateY(0); opacity: 0.45; }
|
||||
35% { transform: translateY(-5px); opacity: 1; }
|
||||
35% { transform: translateY(-4px); opacity: 1; }
|
||||
}
|
||||
|
||||
/* ---- Chat input ---- */
|
||||
#chat-form {
|
||||
display: flex;
|
||||
gap: 0.45rem;
|
||||
@@ -285,44 +345,80 @@
|
||||
#chat-form input[type="text"] {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding: 0.58rem 0.85rem;
|
||||
background: var(--bg);
|
||||
padding: 0.55rem 0.8rem;
|
||||
background: var(--input-bg);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
color: var(--text);
|
||||
font-size: 16px;
|
||||
border-radius: 3px;
|
||||
color: var(--ink);
|
||||
font-size: 0.85rem;
|
||||
line-height: 1.25;
|
||||
outline: none;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
#chat-form input[type="text"]:focus { border-color: var(--accent); }
|
||||
#chat-form input[type="text"]::placeholder { color: var(--ink-dim); }
|
||||
|
||||
#chat-form button {
|
||||
padding: 0.58rem 1rem;
|
||||
padding: 0.55rem 0.9rem;
|
||||
background: var(--accent);
|
||||
color: #111318;
|
||||
color: var(--bg);
|
||||
border: none;
|
||||
border-radius: var(--radius);
|
||||
border-radius: 3px;
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-weight: 700;
|
||||
font-size: 0.88rem;
|
||||
font-size: 0.78rem;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s;
|
||||
transition: opacity 0.2s;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#chat-form button:hover { opacity: 0.85; }
|
||||
|
||||
#chat-form button:hover { background: var(--accent-dim); }
|
||||
/* ---- Theme toggle ---- */
|
||||
.theme-toggle {
|
||||
position: fixed;
|
||||
bottom: 1.5rem;
|
||||
right: 1.5rem;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid var(--border);
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
z-index: 30;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
.theme-toggle:hover { transform: scale(1.08); }
|
||||
[data-theme="light"] .theme-toggle {
|
||||
background: linear-gradient(135deg, #07070d 0%, #64dcff 100%);
|
||||
border-color: rgba(26, 29, 34, 0.2);
|
||||
}
|
||||
[data-theme="tokyo"] .theme-toggle {
|
||||
background: #f4f1ec;
|
||||
border-color: rgba(100, 220, 255, 0.4);
|
||||
box-shadow:
|
||||
0 0 10px rgba(100, 220, 255, 0.5),
|
||||
0 0 25px rgba(100, 220, 255, 0.3);
|
||||
}
|
||||
|
||||
@keyframes panel-in {
|
||||
0% { opacity: 0; transform: translateY(10px); }
|
||||
100% { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
@media (max-width: 520px) {
|
||||
body { align-items: stretch; padding: 4.2rem 0.75rem max(0.75rem, env(safe-area-inset-bottom)); }
|
||||
.page-timer { top: 0.75rem; width: calc(100% - 1.5rem); text-align: center; justify-content: center; }
|
||||
#start-form { align-self: center; padding: 1.45rem; border-radius: 18px; }
|
||||
#chat-container { width: 100%; height: calc(var(--app-height, 100dvh) - 5rem); max-height: none; border-radius: 18px; }
|
||||
#start-form { align-self: center; padding: 2rem 1.5rem; }
|
||||
#chat-container { width: 100%; height: calc(var(--app-height, 100dvh) - 5rem); max-height: none; }
|
||||
.chat-session-id { display: none; }
|
||||
.msg-user, .msg-supporter { max-width: 86%; }
|
||||
#messages { padding: 0.8rem; }
|
||||
#chat-form { gap: 0.4rem; }
|
||||
#chat-form button { padding-inline: 0.85rem; }
|
||||
#chat-form button { padding-inline: 0.75rem; }
|
||||
.theme-toggle { width: 20px; height: 20px; bottom: 1rem; right: 0.9rem; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
@@ -342,6 +438,8 @@
|
||||
|
||||
<div id="chat-container"></div>
|
||||
|
||||
<button class="theme-toggle" id="theme-toggle" aria-label="Toggle theme"></button>
|
||||
|
||||
<script>
|
||||
let ws = null;
|
||||
let userTypingActive = false;
|
||||
@@ -458,6 +556,27 @@
|
||||
ws.onerror = () => console.warn('WebSocket error; polling will continue.');
|
||||
}
|
||||
});
|
||||
|
||||
// Theme toggle
|
||||
(() => {
|
||||
function currentSystemTheme() {
|
||||
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'tokyo' : 'light';
|
||||
}
|
||||
const btn = document.getElementById('theme-toggle');
|
||||
if (btn) {
|
||||
btn.addEventListener('click', () => {
|
||||
const current = document.documentElement.getAttribute('data-theme') || 'light';
|
||||
const next = current === 'light' ? 'tokyo' : 'light';
|
||||
document.documentElement.setAttribute('data-theme', next);
|
||||
localStorage.setItem('poc-theme', next);
|
||||
});
|
||||
}
|
||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
|
||||
if (!localStorage.getItem('poc-theme')) {
|
||||
document.documentElement.setAttribute('data-theme', currentSystemTheme());
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user