:root {
  --bg: #1e1f22;
  --panel: #2b2d31;
  --panel-2: hsl(223, 7%, 20%);
  --channels:  hsl(223, 7%, 25%);
  --text: #dbdee1;
  --muted: #949ba4;
  --accent: #5865f2;
  --border: #1a1b1e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#app {
  display: flex;
  height: 100vh;
  height: 100dvh;
}

#sidebar {
  width: 220px;
  flex: 0 0 220px;
  background: var(--panel);
  padding: 12px 8px;
  border-right: 1px solid var(--border);
}

#sidebar .channel {
  margin-top: 10px;
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--channels);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 100%;
}

.msg .avatar {
  width: 45px;
  height: 45px;
  flex: 0 0 45px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  user-select: none;
}

.msg.user .avatar { background: #3ba55d; }

.msg .body { min-width: 0; }

.msg .name {
  font-weight: 600;
 
  font-size: 15px;
  margin-bottom: 2px;
}

.msg.user .name { color: #3ba55d; }
.msg.ai .name { color: rgb(155, 155, 155); }

.msg .text {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

#composer {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--panel-2);
  border-top: 1px solid var(--border);
}

#msg {
  flex: 1;
  min-width: 0;
  padding: 20px 12px;
  border: none;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

#msg:focus { outline: 2px solid var(--accent); }

#send {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

#send:hover { filter: brightness(1.1); }

@media (max-width: 640px) {
  #sidebar { display: none; }
  #log { padding: 12px; }
  #composer { padding: 8px 12px; }
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}