:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f1ea;
  color: #202124;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(244, 241, 234, 0.92), rgba(244, 241, 234, 1)),
    radial-gradient(circle at 20% 10%, rgba(22, 163, 123, 0.18), transparent 24rem),
    radial-gradient(circle at 80% 0%, rgba(45, 99, 155, 0.16), transparent 28rem);
}

button,
textarea {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-rows: auto 1fr;
  width: min(960px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px;
  gap: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  font-weight: 720;
  letter-spacing: 0;
}

.topbar p {
  margin-top: 4px;
  color: #6a6258;
  font-size: 14px;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.button,
.send {
  min-height: 42px;
  border: 1px solid #cfc6b7;
  border-radius: 8px;
  background: #fffaf2;
  color: #24211d;
  padding: 0 16px;
  cursor: pointer;
}

.button:hover,
.send:hover {
  border-color: #948b7d;
}

.button.primary,
.send {
  border-color: #1f6f5b;
  background: #1f6f5b;
  color: white;
}

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

.signed-out {
  align-self: start;
  background: #fffaf2;
  border: 1px solid #d9d0c0;
  border-radius: 8px;
  padding: 28px;
  display: grid;
  gap: 14px;
  max-width: 520px;
}

.signed-out h2 {
  font-size: 20px;
}

.signed-out p {
  color: #5c554d;
  line-height: 1.5;
}

.chat {
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  background: #fffdf8;
  border: 1px solid #d9d0c0;
  border-radius: 8px;
  overflow: hidden;
}

.messages {
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.empty {
  margin: auto;
  max-width: 460px;
  text-align: center;
  color: #736b60;
  line-height: 1.5;
}

.message {
  max-width: min(740px, 92%);
  border-radius: 8px;
  padding: 13px 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.user {
  align-self: flex-end;
  background: #1f6f5b;
  color: white;
}

.message.assistant {
  align-self: flex-start;
  background: #eee8de;
  color: #24211d;
}

.message.error {
  align-self: center;
  background: #fde8e4;
  color: #8a261d;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border-top: 1px solid #d9d0c0;
  background: #fffaf2;
}

textarea {
  width: 100%;
  max-height: 180px;
  min-height: 44px;
  resize: none;
  border: 1px solid #cfc6b7;
  border-radius: 8px;
  padding: 11px 12px;
  line-height: 1.45;
  background: white;
  color: #202124;
}

textarea:focus {
  outline: 3px solid rgba(31, 111, 91, 0.18);
  border-color: #1f6f5b;
}

@media (max-width: 640px) {
  .shell {
    padding: 12px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions,
  .button {
    width: 100%;
  }

  .button {
    justify-content: center;
  }

  .messages {
    padding: 16px;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .send {
    width: 100%;
  }
}
