:root {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #171a21;
  --text: #e6e6e6;
  --muted: #8b93a1;
  --accent: #7aa2f7;
  --border: #262b36;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
header h1 { font-size: 15px; margin: 0; font-weight: 600; }
.status { font-size: 12px; color: var(--muted); margin-left: auto; }
.status.on { color: #7ee787; }
.status.err { color: #f47067; }

.chat { flex: 1; overflow-y: auto; padding: 10px 14px; }
.msg { margin: 4px 0; display: flex; gap: 8px; }
.msg .nick { color: var(--accent); font-weight: 600; white-space: nowrap; }
.msg .time { color: var(--muted); font-size: 11px; flex-shrink: 0; margin-top: 3px; }
.msg .body { word-break: break-word; }
.msg .body img { max-width: 100%; max-height: 260px; border-radius: 8px; display: block; margin-top: 4px; }
.msg.system { color: var(--muted); font-size: 13px; }
.msg.error { color: #f47067; }

.composer { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--panel); }
.composer input { flex: 1; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 15px; }
.composer button, .login button { background: var(--accent); color: #0f1115; border: 0; border-radius: 8px; padding: 10px 14px; font-weight: 600; }

.login { margin: auto; width: min(320px, 90vw); display: flex; flex-direction: column; gap: 12px; padding: 20px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.login input { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-size: 15px; }
