:root {
  color: #1f2430;
  background: #f5f6f8;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding: 24px;
}

button,
textarea {
  font: inherit;
}

.shell {
  width: min(860px, 100%);
  min-height: calc(100vh - 48px);
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  box-shadow: 0 16px 50px rgb(31 36 48 / 8%);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #eceef2;
}

h1 {
  margin: 0;
  font-size: 23px;
}

header p,
footer {
  color: #727888;
}

header p {
  margin: 5px 0 0;
  font-size: 13px;
}

header button {
  padding: 7px 12px;
  color: #5d6472;
  background: transparent;
  border: 1px solid #d9dde5;
  border-radius: 9px;
  cursor: pointer;
}

.messages {
  min-height: 400px;
  max-height: calc(100vh - 270px);
  padding: 24px;
  overflow-y: auto;
}

.welcome {
  margin: 80px auto;
  color: #8a909c;
  text-align: center;
}

.message {
  display: flex;
  margin: 0 0 18px;
}

.message.user {
  justify-content: flex-end;
}

.bubble {
  max-width: min(720px, 88%);
  padding: 12px 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f1f3f6;
  border-radius: 14px;
}

.message.user .bubble {
  color: #fff;
  background: #6246b8;
  border-bottom-right-radius: 4px;
}

.message.assistant .bubble {
  border-bottom-left-radius: 4px;
}

.status {
  padding: 0 24px 10px;
  color: #7463aa;
  font-size: 13px;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid #eceef2;
}

textarea {
  width: 100%;
  max-height: 180px;
  padding: 12px 14px;
  resize: vertical;
  color: inherit;
  background: #fafafa;
  border: 1px solid #d9dde5;
  border-radius: 12px;
  outline: none;
}

textarea:focus {
  border-color: #7b65c8;
  box-shadow: 0 0 0 3px rgb(123 101 200 / 12%);
}

.composer button {
  align-self: end;
  min-width: 72px;
  padding: 12px 18px;
  color: #fff;
  background: #6246b8;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
}

.composer button:disabled,
textarea:disabled {
  cursor: wait;
  opacity: 0.6;
}

footer {
  padding: 0 18px 14px;
  font-size: 12px;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  body {
    padding: 0;
  }

  .shell {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .messages {
    max-height: none;
  }
}
