:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #6b7686;
  --line: #dde2e9;
  --accent: #2f6fde;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --card: #1b212a;
    --text: #e7ebf0;
    --muted: #94a0b1;
    --line: #2c3541;
    --accent: #6c9cf0;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 24px 16px 48px;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main {
  max-width: 560px;
  margin: 0 auto;
}

h1 { margin: 0 0 4px; font-size: 28px; }
h2 { margin: 32px 0 12px; font-size: 20px; }
.lead { margin: 0 0 20px; color: var(--muted); }

form {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

label {
  display: grid;
  gap: 4px;
  font-size: 14px;
  color: var(--muted);
}

input, textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  resize: vertical;
}

input:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  justify-self: start;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

#status { margin: 0; min-height: 1.5em; font-size: 14px; color: var(--muted); }

#messages {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

#messages li {
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

#messages li.empty { color: var(--muted); }

.head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.head time { font-size: 13px; color: var(--muted); }

#messages p {
  margin: 4px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
