:root {
  color-scheme: light dark;
  --border: #c9ccd1;
  --accent: #2f6fed;
  --muted: #6b7280;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
}

header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

h1 {
  margin: 0;
  font-size: 1.25rem;
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
}

form {
  display: flex;
  gap: 0.5rem;
}

input {
  flex: 1;
  padding: 0.5rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

button {
  padding: 0.5rem 0.9rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.error {
  color: #c0392b;
  min-height: 1.2em;
  margin: 0.4rem 0 0;
}

.identity {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.columns {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1rem;
  align-items: start;
}

aside h3,
.chat h3 {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0.6rem 0 0.3rem;
}

.pick-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pick-list button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: inherit;
  border: 1px solid var(--border);
  margin-bottom: 0.35rem;
}

.pick-list button.active {
  border-color: var(--accent);
  color: var(--accent);
}

.chat {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

#message-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  overflow-y: auto;
  max-height: 420px;
}

#message-list li {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.3rem;
  background: rgba(127, 127, 127, 0.12);
}

#message-list li.mine {
  background: rgba(47, 111, 237, 0.15);
}

#message-list .meta {
  font-size: 0.75rem;
  color: var(--muted);
}

#message-list .body {
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 640px) {
  .columns {
    grid-template-columns: 1fr;
  }
}
