:root{
  --bg: #f6f7f8;
  --surface: #ffffff;
  --muted: #9aa3ad;
  --accent: #0b7285;
  --me: #dff3f6;
  --other: #ffffff;
  --border: #e6eaee;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

*{box-sizing:border-box}
html,body,#app{height:100%;margin:0}
body{
  background:var(--bg);
  color:#102027;
  -webkit-user-select:none;
  user-select:none;
  height:100%;
  display:flex;
  align-items:stretch;
  justify-content:center;
}

#app{
  width:100%;
  max-width:980px;
  height:100vh;
  display:flex;
  gap:12px;
  padding:12px;
}

/* Sidebar */
#sidebar{
  width:180px;
  background:var(--surface);
  border-radius:12px;
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:12px;
  box-shadow:0 2px 8px rgba(16,32,39,0.05);
  min-width:140px;
}
#status{
  font-size:13px;
  color:var(--muted);
}
#peers{
  display:flex;
  flex-direction:column;
  gap:8px;
  overflow:auto;
  padding-right:4px;
}
.peer{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px;
  border-radius:8px;
}
.avatar{
  width:36px;height:36px;border-radius:8px;flex:0 0 36px;background:#e9eef0;background-size:cover;background-position:center;
}
.peer .name{font-size:13px}
.peer .meta{font-size:11px;color:var(--muted)}

/* Main chat area */
#main{
  flex:1;
  display:flex;
  flex-direction:column;
  background:linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,255,255,0.98));
  border-radius:12px;
  padding:12px;
  min-width:0;
  box-shadow:0 2px 10px rgba(16,32,39,0.04);
}

#messages{
  flex:1;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:8px;
  -webkit-overflow-scrolling:touch;
}

.message{
  max-width:78%;
  padding:8px 10px;
  border-radius:10px;
  box-shadow:0 1px 0 rgba(16,32,39,0.02);
  font-size:14px;
  line-height:1.2;
  word-wrap:break-word;
}
.message .meta{display:block;font-size:11px;color:var(--muted);margin-bottom:6px}
.me{align-self:flex-end;background:var(--me)}
.other{align-self:flex-start;background:var(--other)}
.system{
  align-self:center;
  background:transparent;
  color:var(--muted);
  font-size:12px;
  padding:6px;
  border-radius:8px;
}

/* Composer */
#composer{
  display:flex;
  gap:8px;
  padding-top:8px;
}
#message-input{
  flex:1;
  padding:12px;
  border-radius:10px;
  border:1px solid var(--border);
  font-size:15px;
  outline:none;
  background:transparent;
}
#message-input:focus{box-shadow:0 0 0 3px rgba(11,114,133,0.06);border-color:var(--accent)}
#send-btn{
  background:var(--accent);
  color:white;
  border:none;
  padding:0 14px;
  border-radius:10px;
  min-width:64px;
  font-weight:600;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
#send-btn:active{transform:translateY(1px)}
@media (max-width:720px){
  #app{padding:8px}
  #sidebar{display:none}
  #messages{gap:6px;padding:6px}
  .message{max-width:92%}
}