:root {
  --bg: #eceef1;
  --panel: #ffffff;
  --fg: #1c1e21;
  --muted: #8a8f98;
  --line: #e2e4e8;
  --bot: #f1f2f4;
  --me: #2f6f4f;
  --me-fg: #ffffff;
  --code: #eceef1;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.55 -apple-system, "Segoe UI", "Malgun Gothic", sans-serif;
  display: flex;
  justify-content: center;
}
.room {
  width: 100%;
  max-width: 560px;
  min-height: 100vh;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.room-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bot);
  flex: none;
}
.avatar.sm { width: 30px; height: 30px; }
.head-text { flex: 1; min-width: 0; }
.name { font-weight: 600; font-size: 15px; }
.sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.src { font-size: 12px; color: var(--me); text-decoration: none; flex: none; }
.src:hover { text-decoration: underline; }

.note {
  padding: 7px 16px;
  font-size: 12px;
  color: var(--muted);
  background: #f7f8f9;
  border-bottom: 1px solid var(--line);
}
.note code {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  color: var(--fg);
  background: var(--code);
  padding: 1px 5px;
  border-radius: 4px;
}

.log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 300px;
}
.msg { display: flex; gap: 8px; max-width: 86%; }
.msg.bot { align-self: flex-start; }
.msg.me { align-self: flex-end; justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.msg.bot .bubble { background: var(--bot); border-top-left-radius: 4px; }
.msg.me .bubble {
  background: var(--me);
  color: var(--me-fg);
  border-top-right-radius: 4px;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 13px;
}
.heard {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 12px;
  color: var(--muted);
  padding: 0 4px;
}

.composer {
  display: flex;
  gap: 8px;
  padding: 12px 16px 6px;
  border-top: 1px solid var(--line);
}
textarea {
  flex: 1;
  resize: none;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--fg);
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
}
textarea:focus { outline: none; border-color: var(--me); }
button {
  flex: none;
  align-self: stretch;
  padding: 0 18px;
  border: none;
  border-radius: 10px;
  background: var(--me);
  color: var(--me-fg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: #275c42; }
.status { padding: 2px 16px 12px; font-size: 12px; color: var(--muted); }

.ref { padding: 0 16px 18px; font-size: 13px; color: var(--muted); }
.ref summary { cursor: pointer; padding: 6px 0; }
.ref ul { margin: 6px 0 0; padding-left: 18px; }
.ref li { margin: 4px 0; }
.ref code {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 12px;
  background: var(--code);
  padding: 1px 5px;
  border-radius: 4px;
}

@media (max-width: 600px) {
  .room { border-left: none; border-right: none; }
}
