:root {
  color-scheme: dark;
  --bg: #10080a;
  --panel: #1a0e11;
  --in: #241416;
  --out: #3d1820;
  --text: #f4e8ea;
  --muted: #b09096;
  --line: #3a2428;
  --accent: #9c2a32;
  --danger: #e07070;
  font-family: system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; background: var(--bg); color: var(--text); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.screen { min-height: 100%; display: flex; flex-direction: column; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
.card { width: min(420px, 100%); margin: auto; display: flex; flex-direction: column; gap: 12px; }
h1 { font-size: 28px; margin: 0; }
p { color: var(--muted); line-height: 1.4; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
input, .btn {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
}
.btn { background: var(--accent); color: #f8ecec; border: 0; font-weight: 650; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.top {
  display: flex; align-items: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  border-bottom: 1px solid var(--line);
}
.top h2 { margin: 0; font-size: 18px; flex: 1; }
.icon {
  width: 40px; height: 40px; border-radius: 12px; border: 0;
  background: var(--panel); color: var(--text);
}
.list { flex: 1; overflow: auto; }
.person, .msg {
  width: 100%; text-align: left; border: 0; background: transparent; color: inherit;
}
.person { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.person strong { display: block; }
.person span, .meta { color: var(--muted); font-size: 13px; }
.thread { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.bubble {
  max-width: min(78%, 420px); padding: 8px 10px; border-radius: 16px;
  background: var(--in); align-self: flex-start;
}
.bubble.mine { background: var(--out); align-self: flex-end; }
.bubble .text { white-space: pre-wrap; word-break: break-word; }
.bubble img, .bubble video { max-width: 100%; border-radius: 10px; display: block; }
.bubble audio { width: 220px; }
.quote { border-left: 3px solid var(--accent); padding-left: 8px; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.composer {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 8px 10px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.composer textarea {
  flex: 1; resize: none; min-height: 44px; max-height: 120px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
  padding: 10px 12px; font-size: 16px; color: inherit;
}
.banner, .replybar {
  margin: 8px 12px 0; padding: 10px 12px; border-radius: 12px; background: var(--panel); color: var(--muted);
}
.number { font-variant-numeric: tabular-nums; letter-spacing: 1px; color: var(--text); }
.error { color: var(--danger); min-height: 1.2em; }
.menu { display: flex; gap: 8px; padding: 0 12px 8px; }
.typing { min-height: 18px; color: var(--accent); font-size: 13px; padding: 0 16px; }
