:root{
  --bg0:#1e1f22;      /* app background */
  --bg1:#2b2d31;      /* panels */
  --bg2:#313338;      /* chat */
  --bg3:#383a40;      /* input */
  --text:#dbdee1;
  --muted:#949ba4;
  --border:#1f2023;
  --accent:#5865f2;   /* blurple */
  --danger:#f23f42;
  --green:#23a559;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:var(--bg0);
  color:var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

.shell{
  height:100vh;
  display:flex;
}

/* Left server bar */
.servers{
  width:72px;
  background:#1e1f22;
  padding:12px 0;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  border-right:1px solid #141517;
}

.servers-top{
  width:48px; height:48px;
  display:flex; align-items:center; justify-content:center;
}

.home-dot{
  width:48px;height:48px;border-radius:16px;
  background:linear-gradient(135deg, var(--accent), #3ba55d);
}

.server-icons{
  width:72px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  overflow:auto;
  padding-bottom:12px;
}

.server-btn{
  width:48px;height:48px;
  border:0;
  background:#313338;
  border-radius:24px;
  color:var(--text);
  cursor:pointer;
  position:relative;
  transition: all .15s ease;
  display:grid;
  place-items:center;
}
.server-btn:hover{border-radius:16px;background:#3b3d45}
.server-btn.active{border-radius:16px;background:var(--accent)}
.server-pill{
  position:absolute;
  left:-10px;
  width:6px;
  height:0;
  border-radius:3px;
  background:#fff;
  transition:height .15s ease;
}
.server-btn:hover .server-pill{height:24px}
.server-btn.active .server-pill{height:40px}

.server-icon-img{
  width:48px;height:48px;border-radius:24px;
  object-fit:cover;
}
.server-fallback{
  width:48px;height:48px;border-radius:24px;
  display:grid;place-items:center;
  font-weight:700;
}

/* Middle channel sidebar */
.sidebar{
  width:280px;
  background:var(--bg1);
  border-right:1px solid #232428;
  display:flex;
  flex-direction:column;
}
.sidebar-header{
  padding:14px 14px 10px 14px;
  border-bottom:1px solid #232428;
}
.sidebar-title{
  font-weight:700;
  font-size:16px;
  line-height:1.2;
}
.sidebar-sub{
  color:var(--muted);
  font-size:12px;
  margin-top:4px;
}

.channel-scroller{
  overflow:auto;
  padding:10px 8px 14px 8px;
}
.channel-section-title{
  color:var(--muted);
  font-size:12px;
  font-weight:700;
  padding:8px 8px;
}

.channel-list{
  display:flex;
  flex-direction:column;
  gap:2px;
}

.channel-btn{
  border:0;
  background:transparent;
  color:var(--text);
  text-align:left;
  padding:8px 10px;
  border-radius:8px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.channel-btn:hover{background:#3a3c43}
.channel-btn.active{background:#404249}

.channel-left{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
}
.channel-hash{
  color:var(--muted);
  font-weight:800;
}
.channel-name{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.badge-lock{
  color:var(--muted);
  font-size:12px;
  display:flex;
  align-items:center;
  gap:4px;
}

/* Chat */
.chat{
  flex:1;
  display:flex;
  flex-direction:column;
  background:var(--bg2);
}

.chat-header{
  height:48px;
  display:flex;
  align-items:center;
  padding:0 16px;
  border-bottom:1px solid #232428;
}
.chat-header-left{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.hash{
  color:var(--muted);
  font-weight:900;
}
.chat-channel-name{
  font-weight:700;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.messages{
  flex:1;
  overflow:auto;
  padding:14px 0;
}

.msg{
  display:flex;
  gap:12px;
  padding:6px 16px;
}
.msg:hover{background:rgba(255,255,255,0.03)}
.avatar{
  width:40px;height:40px;border-radius:50%;
  object-fit:cover;
  flex:0 0 auto;
  background:#202225;
}
.avatar-fallback{
  width:40px;height:40px;border-radius:50%;
  display:grid;place-items:center;
  font-weight:800;
  background:#202225;
  color:#fff;
  flex:0 0 auto;
}

.msg-main{
  min-width:0;
}
.msg-top{
  display:flex;
  align-items:baseline;
  gap:8px;
}
.msg-user{
  font-weight:700;
}
.msg-time{
  color:var(--muted);
  font-size:12px;
}
.msg-content{
  color:var(--text);
  white-space:pre-wrap;
  word-break:break-word;
  line-height:1.35;
  margin-top:2px;
}

/* Composer */
.composer-wrap{
  padding:10px 16px 16px 16px;
}
.composer-topline{
  color:var(--muted);
  font-size:12px;
  margin-bottom:8px;
  min-height:16px;
}
.composer-topline.error{color:var(--danger)}
.composer{
  background:var(--bg3);
  border-radius:12px;
  padding:10px;
  display:flex;
  gap:10px;
  align-items:center;
  border:1px solid #26282c;
}
.nameSelect, .customName, .messageInput{
  background:#1e1f22;
  color:var(--text);
  border:1px solid #2a2c31;
  border-radius:10px;
  padding:10px 12px;
  outline:none;
}
.nameSelect{max-width:160px}
.customName{max-width:220px}
.messageInput{
  flex:1;
}
.sendBtn{
  background:var(--accent);
  border:0;
  color:#fff;
  padding:10px 14px;
  border-radius:10px;
  cursor:pointer;
  font-weight:700;
}
.sendBtn:disabled{
  opacity:.5;
  cursor:not-allowed;
}

.hint{
  color:var(--muted);
  padding:10px 16px;
  font-size:14px;
}
.authWrap{
  height:100vh;
  display:grid;
  place-items:center;
  padding:20px;
}
.authCard{
  width:min(900px, 95vw);
  background:#2b2d31;
  border:1px solid #232428;
  border-radius:16px;
  padding:18px;
}
.authCard h1{margin:0 0 6px 0}
.authCard h2{margin:14px 0 8px 0}
.authCard input{
  width:100%;
  margin:6px 0;
  background:#1e1f22;
  color:#dbdee1;
  border:1px solid #2a2c31;
  border-radius:10px;
  padding:10px 12px;
  outline:none;
}
.authCard button{
  width:100%;
  margin-top:8px;
  background:#5865f2;
  border:0;
  color:#fff;
  padding:10px 14px;
  border-radius:10px;
  cursor:pointer;
  font-weight:700;
}
.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:16px;
}
@media (max-width: 800px){
  .grid2{grid-template-columns:1fr;}
}
.muted{color:#949ba4}
hr{border:0;border-top:1px solid #232428;margin:14px 0}
