:root {
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-size: 15px;
  --bg-color: #1e1e2e;
  --text-color: #cdd6f4;
  --meta-color: #6c7086;
  --accent-color: #89b4fa;
}

:root[data-theme="light"] {
  --bg-color: #ffffff;
  --text-color: #1e1e2e;
  --meta-color: #6c6f85;
  --accent-color: #1e66f5;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-color);
  font-family: var(--font-family);
  font-size: var(--font-size);
  color: var(--text-color);
}

html.no-bg, body.no-bg {
  background: transparent !important;
}

#messages {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: 8px 10px;
  gap: 2px;
}

/* Hugs short message lists against the bottom edge without using
   justify-content: flex-end, which — combined with overflow: auto —
   makes browsers clip overflowing content at the start edge instead of
   letting you scroll to it. margin-top: auto on the oldest visible
   message achieves the same look while keeping normal, scrollable
   overflow once content grows past the container height. */
#messages > .msg:first-child {
  margin-top: auto;
}

.msg {
  line-height: 1.35;
  overflow-wrap: anywhere;
  opacity: 1;
  transition: opacity 0.6s ease;
}

.msg.fade-out {
  opacity: 0;
}

.msg-time {
  color: var(--meta-color);
  margin-right: 6px;
  font-size: 0.85em;
}

.msg-nick {
  font-weight: 600;
  margin-right: 6px;
}

.msg-nick::after {
  content: ":";
  color: var(--meta-color);
}

.msg-action .msg-nick::before {
  content: "* ";
  color: var(--meta-color);
}

.msg-action .msg-nick::after {
  content: "";
}

.msg-action .msg-text {
  font-style: italic;
}

.msg-notice .msg-nick {
  color: var(--accent-color) !important;
}

.msg-text {
  white-space: pre-wrap;
}
