:root{
  --bg:#0f172a; --bg2:#111c33; --surface:#1e293b; --surface2:#243349;
  --border:#334155; --text:#e2e8f0; --muted:#94a3b8;
  --accent:#10b981; --accent-hover:#34d399; --on-accent:#052e22;
  --danger:#f87171; --radius:14px;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:var(--bg); color:var(--text);
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,Inter,Arial,sans-serif;
  font-size:16px; line-height:1.5; min-height:100vh;
}
.wrap{max-width:720px;margin:0 auto;padding:16px 14px 48px}
header.app{padding:18px 0 6px}
h1{font-size:26px;margin:0 0 4px;letter-spacing:.2px}
h1 .dot{color:var(--accent)}
.tagline{color:var(--muted);margin:0 0 8px;font-size:14px}
h2{font-size:18px;margin:22px 0 10px}
.card{
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:16px; margin:14px 0;
}
label{display:block;font-size:13px;color:var(--muted);margin:12px 0 6px}
label:first-child{margin-top:0}
input[type=text],textarea{
  width:100%; background:var(--bg2); color:var(--text);
  border:1px solid var(--border); border-radius:10px;
  padding:11px 12px; font-size:16px; font-family:inherit;
}
textarea{resize:vertical}
input:focus,textarea:focus{outline:2px solid var(--accent); outline-offset:0; border-color:var(--accent)}
button{
  appearance:none; border:0; cursor:pointer; font-family:inherit;
  border-radius:10px; padding:12px 16px; font-size:15px; font-weight:600;
}
button.primary{background:var(--accent); color:var(--on-accent); width:100%; margin-top:16px}
button.primary:hover{background:var(--accent-hover)}
button.ghost{background:var(--surface2); color:var(--text); border:1px solid var(--border)}
button.small{padding:8px 12px; font-size:13px; width:auto; margin:0}
button:disabled{opacity:.55; cursor:default}
.err{color:var(--danger); font-size:14px; min-height:20px; margin-top:8px}
.ok{color:var(--accent-hover); font-size:14px; margin-top:8px}
.muted{color:var(--muted); font-size:13px}
a{color:var(--accent-hover)}
.code{
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:22px; letter-spacing:3px; font-weight:700; color:var(--accent-hover);
  background:var(--bg2); border:1px dashed var(--border); border-radius:10px;
  padding:10px 12px; text-align:center; margin:8px 0;
}
.row{display:flex; gap:8px; align-items:center}
.row .grow{flex:1}
.roomitem{
  display:flex; justify-content:space-between; align-items:center; gap:10px;
  padding:12px 0; border-bottom:1px solid var(--border);
}
.roomitem:last-child{border-bottom:0}
.roomitem .rn{font-weight:600}
.chips{display:flex; flex-wrap:wrap; gap:6px; margin-top:8px}
.chip{
  background:var(--surface2); border:1px solid var(--border); color:var(--text);
  border-radius:999px; padding:4px 10px; font-size:12.5px;
}
.chip.owner{border-color:var(--accent); color:var(--accent-hover)}
.chip .seen{color:var(--muted)}
.feed{display:flex; flex-direction:column; gap:10px; margin:12px 0}
.msg{background:var(--bg2); border:1px solid var(--border); border-radius:12px; padding:10px 12px}
.msg .meta{display:flex; justify-content:space-between; gap:8px; font-size:12.5px; margin-bottom:3px}
.msg .sender{font-weight:700; color:var(--accent-hover)}
.msg .time{color:var(--muted)}
.msg .body{white-space:pre-wrap; word-break:break-word}
.msg .meta{align-items:center}
.msg .sender{margin-right:auto}
.msgavatar{width:26px; height:26px; border-radius:50%; overflow:hidden; flex:none; display:inline-flex; align-items:center; justify-content:center; background:var(--surface2); color:var(--accent-hover); font-size:12px; font-weight:700; margin-right:7px}
.msgavatar img{width:100%; height:100%; object-fit:cover; display:block}
.chip{display:inline-flex; align-items:center; gap:6px}
.chipavatar{width:20px; height:20px; border-radius:50%; object-fit:cover}
.chipmedal{width:20px; height:20px; border-radius:50%; background:var(--bg); color:var(--accent-hover); display:inline-flex; align-items:center; justify-content:center; font-size:11px; font-weight:700}
.msg .msgfoot{display:flex; justify-content:flex-end; margin-top:6px}
.replybtn{background:none; border:none; color:var(--muted); font-size:12.5px; font-weight:600; cursor:pointer; padding:2px 4px; width:auto}
.replybtn:hover,.replybtn:active{color:var(--accent-hover)}
.replybar{display:flex; align-items:center; gap:8px; background:var(--bg2); border:1px solid var(--border); border-left:3px solid var(--accent); border-radius:10px; padding:8px 10px; margin-bottom:10px; font-size:13px; color:var(--muted)}
.replybar .replytext{flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.replybar b{color:var(--text)}
.replycancel{background:none; border:none; color:var(--muted); font-size:15px; cursor:pointer; padding:2px 6px; width:auto}
.msg .quote{border-left:3px solid var(--accent); background:rgba(16,185,129,.08); color:var(--muted); font-size:13.5px; padding:4px 8px; border-radius:0 8px 8px 0; margin-bottom:6px; white-space:pre-wrap; word-break:break-word}
.sendbox{display:flex; gap:8px; align-items:flex-end}
.sendbox textarea{flex:1; min-height:48px; max-height:140px}
.sendbox button{width:auto; margin:0; height:48px}
.backlink{font-size:14px; display:inline-block; margin-bottom:6px}
.hidden{display:none !important}
.kv{font-size:13px; color:var(--muted); margin-top:10px}
.kv b{color:var(--text)}
