:root {
  --bg: #0e0b17; --panel: #1a1626; --ink: #f4f1fa; --muted: #a49cb8; --line: #2d2640;
  --mine-a: #7c3aed; --mine-b: #db2777; --theirs: #241e33; --accent: #a78bfa; --warn: #e5484d;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f6f4fb; --panel: #ffffff; --ink: #1d1a26; --muted: #6b6480; --line: #e3deef; --theirs: #ece8f5; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { background: radial-gradient(1200px 600px at 80% -10%, rgba(124, 58, 237, .25), transparent), radial-gradient(900px 500px at -10% 110%, rgba(219, 39, 119, .18), transparent), var(--bg); }
#app { max-width: 720px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; padding: 0 16px; }
.hidden { display: none !important; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 0; position: sticky; top: 0; background: linear-gradient(var(--bg) 70%, transparent); z-index: 2; }
.logo { width: 40px; height: 40px; border-radius: 12px; }
.peer { font-weight: 700; font-size: 18px; }
.lock { color: var(--muted); font-size: 13px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 24px; margin: 24px 0; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
.card h1 { margin: 0 0 8px; font-size: 26px; background: linear-gradient(90deg, var(--accent), #f472b6); -webkit-background-clip: text; background-clip: text; color: transparent; }
label { display: block; margin: 16px 0 6px; font-weight: 600; }
input { width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; }
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button.primary { margin-top: 14px; border: 0; border-radius: 14px; padding: 12px 20px; font: inherit; font-weight: 700; color: #fff; background: linear-gradient(90deg, var(--mine-a), var(--mine-b)); cursor: pointer; }
button.primary:disabled { opacity: .5; cursor: default; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
#chat { flex: 1; display: flex; flex-direction: column; }
.status { margin: 8px 0; padding: 10px 14px; border-radius: 14px; background: rgba(229, 72, 77, .14); border: 1px solid rgba(229, 72, 77, .4); font-size: 14px; }
.status.info { background: rgba(167, 139, 250, .12); border-color: rgba(167, 139, 250, .35); }
.messages { list-style: none; margin: 0; padding: 8px 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.messages li { max-width: 78%; padding: 9px 13px; border-radius: 18px; background: var(--theirs); align-self: flex-start; white-space: pre-wrap; word-wrap: break-word; }
.messages li.out { align-self: flex-end; color: #fff; background: linear-gradient(135deg, var(--mine-a), var(--mine-b)); border-bottom-right-radius: 6px; }
.messages li.in { border-bottom-left-radius: 6px; }
.messages li time { display: block; font-size: 11px; opacity: .7; margin-top: 2px; text-align: right; }
.messages li.empty { align-self: center; background: none; color: var(--muted); text-align: center; }
.composer { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 10px 0 6px; background: linear-gradient(transparent, var(--bg) 30%); }
.composer input { border-radius: 22px; }
.composer button { margin: 0; border-radius: 50%; width: 46px; height: 46px; padding: 0; flex: none; }
.app-hint { text-align: center; color: var(--muted); font-size: 13px; padding-bottom: 12px; }
a { color: var(--accent); }
code { background: var(--theirs); padding: 1px 5px; border-radius: 6px; }
