:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101114;
  color: #f3f4f6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #101114;
}

button,
input,
textarea {
  font: inherit;
}

.app,
.chat-view,
.login-view {
  min-height: 100vh;
}

.login-view {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-box {
  width: min(100%, 340px);
  display: grid;
  gap: 12px;
}

.login-box h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

input,
textarea {
  width: 100%;
  border: 1px solid #30333a;
  border-radius: 6px;
  background: #1b1d22;
  color: #f9fafb;
  padding: 12px 14px;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: #7aa2f7;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: #5865f2;
  color: white;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
}

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

.ghost {
  background: #24262d;
}

.error {
  min-height: 22px;
  margin: 0;
  color: #ff7d7d;
}

.chat-view {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid #24262d;
  background: #15171c;
}

.topbar div {
  display: grid;
  gap: 2px;
}

.topbar span {
  color: #a5adba;
  font-size: 13px;
}

.messages {
  overflow-y: auto;
  padding: 14px 12px 20px;
}

.message {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  padding: 8px 4px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2f333b;
  object-fit: cover;
}

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

.meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.author {
  font-weight: 700;
}

.time {
  color: #8d96a5;
  font-size: 12px;
}

.content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.42;
}

.deleted {
  color: #8d96a5;
  font-style: italic;
}

.attachments,
.embeds,
.stickers {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.attachment-image,
.attachment-video,
.embed img,
.sticker {
  max-width: min(560px, 100%);
  max-height: 440px;
  border-radius: 6px;
  background: #1b1d22;
}

.attachment-link {
  display: inline-block;
  color: #9db8ff;
  overflow-wrap: anywhere;
}

.embed {
  max-width: 560px;
  border-left: 4px solid #4f5665;
  border-radius: 4px;
  background: #181a1f;
  padding: 10px 12px;
}

.embed-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.embed-description,
.embed-field {
  color: #d8dce3;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.embed-field {
  margin-top: 8px;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid #24262d;
  background: #15171c;
}

.composer textarea {
  min-height: 42px;
  max-height: 160px;
  resize: none;
}

@media (max-width: 640px) {
  .topbar,
  .composer {
    padding: 10px;
  }

  .message {
    grid-template-columns: 34px 1fr;
  }

  .avatar {
    width: 34px;
    height: 34px;
  }
}
