:root{--bg:#0b0b0b;--card:#111;--text:#fff;--muted:rgba(255,255,255,.65);--line:rgba(255,255,255,.12);--bubble:#1a1a1a;--bubbleMe:#f2c94c;}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--text);font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial;}

.wrap{width:100%;max-width:1200px;margin:0 auto;padding:10px;}
.card{background:var(--card);border:1px solid var(--line);padding:12px;border-radius:14px;}
.hidden{display:none}

h1{font-size:22px;margin:0 0 8px;letter-spacing:.06em}
.sub{margin:0 0 14px;color:var(--muted);line-height:1.5}

.row{display:flex;gap:10px;align-items:center}
input{flex:1;background:#0e0e0e;border:1px solid var(--line);border-radius:12px;color:#fff;padding:12px 12px;font-size:16px;outline:none;min-width:0}
input:focus{border-color:rgba(255,255,255,.28)}
button{background:#fff;color:#000;border:0;border-radius:999px;padding:10px 14px;font-weight:900;cursor:pointer;white-space:nowrap}
button:hover{filter:brightness(.96)}
.hint{margin-top:10px;color:#ffdf7e;min-height:20px}

.chat-shell{min-height:calc(100vh - 40px);display:flex;flex-direction:column}
.chat-head{display:flex;justify-content:space-between;gap:10px;align-items:flex-start;flex-wrap:wrap}
.room{font-weight:900;letter-spacing:.14em;text-transform:uppercase}
.me{color:var(--muted);font-size:13px;margin-top:6px}
.users{color:var(--muted);font-size:13px;line-height:1.4}

/* rename inline (small, like WeChat header actions) */
.rename-inline{margin-top:10px;display:flex;gap:10px;align-items:center;max-width:520px}
.rename-inline-input{flex:1;padding:10px 12px;font-size:14px;border-radius:999px}
.rename-inline-btn{padding:10px 14px;font-size:14px}

/* main chat area */
.main{display:flex;flex-direction:column;min-width:0;flex:1;margin-top:10px}

.log{
  flex:1;
  min-height:320px;
  height:calc(100vh - 260px);
  overflow:auto;
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px;
  background:#0c0c0c;
}

.sys{color:rgba(255,255,255,.55);font-size:12px;margin:10px auto;text-align:center}

.mrow{display:flex;flex-direction:column;margin:8px 0}
.mrow.mine{align-items:flex-end}
.mrow.other{align-items:flex-start}
.name{color:rgba(255,255,255,.55);font-size:12px;margin:0 0 4px 2px}

.bubble{max-width:min(76%, 520px);padding:10px 12px;border-radius:14px;line-height:1.45;background:var(--bubble);border:1px solid rgba(255,255,255,.10)}
.bubble.mine{background:var(--bubbleMe);border-color:rgba(0,0,0,.15)}
.text{white-space:pre-wrap;word-break:break-word}
.time{margin-top:6px;font-size:11px;color:rgba(255,255,255,.7);text-align:right}

.send-row{margin-top:12px}

@media (max-width: 520px){
  .wrap{padding:8px}
  .log{height:calc(100vh - 310px)}
  button{padding:10px 12px}
  .bubble{max-width:84%}
}

.attach{background:#1a1a1a;color:#fff;border:1px solid rgba(255,255,255,.14)}
.attach:hover{filter:none;border-color:rgba(255,255,255,.28)}
.file{display:none}
