:root {
  color-scheme: light;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: #f7f7f4;
  color: #202123;
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  align-items: center;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 650;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
}

input,
textarea {
  background: #fff;
  border: 1px solid #d6d6d0;
  border-radius: 8px;
  color: #202123;
  outline: none;
  padding: 12px 14px;
  width: 100%;
}

input:focus,
textarea:focus {
  border-color: #8f8f86;
  box-shadow: 0 0 0 3px rgba(32, 33, 35, 0.08);
}

.app-shell {
  min-height: 100vh;
}

.entry {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.entry-card {
  background: #fff;
  border: 1px solid #deded8;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(32, 33, 35, 0.08);
  max-width: 500px;
  padding: 28px;
  width: 100%;
}

.entry-card h1,
.brand h1 {
  font-size: 24px;
  font-weight: 720;
  letter-spacing: 0;
  line-height: 1.2;
  margin: 0;
}

.entry-copy {
  color: #5f605d;
  line-height: 1.5;
  margin: 10px 0 24px;
}

.open-form label {
  color: #4c4d49;
  display: block;
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 8px;
}

.entry-row {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
}

.entry-row button,
.composer button {
  background: #202123;
  color: #fff;
}

.secondary-action {
  background: #f1f1ec;
  color: #202123;
  width: 100%;
}

.divider {
  align-items: center;
  color: #8a8b84;
  display: flex;
  font-size: 13px;
  gap: 12px;
  margin: 22px 0;
}

.divider::before,
.divider::after {
  background: #e4e4dd;
  content: "";
  flex: 1;
  height: 1px;
}

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

.chat-header {
  align-items: center;
  background: rgba(247, 247, 244, 0.95);
  border-bottom: 1px solid #e2e2dc;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px 22px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.brand {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.conversation-pill {
  align-items: center;
  background: #fff;
  border: 1px solid #deded8;
  border-radius: 999px;
  color: #5f605d;
  display: inline-flex;
  font-size: 13px;
  gap: 8px;
  min-height: 34px;
  padding: 4px 5px 4px 12px;
}

.conversation-pill strong {
  color: #202123;
  font-size: 14px;
}

.conversation-pill button {
  background: #f1f1ec;
  color: #202123;
  font-size: 12px;
  min-height: 26px;
  padding: 0 10px;
}

#reset-button {
  background: transparent;
  border: 1px solid #d6d6d0;
  color: #202123;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 auto;
  max-width: 820px;
  overflow-y: auto;
  padding: 26px 20px 34px;
  width: 100%;
}

.message {
  display: grid;
  gap: 8px;
  grid-template-columns: 34px minmax(0, 1fr);
  line-height: 1.55;
  padding: 18px 0;
  white-space: pre-wrap;
}

.message::before {
  align-items: center;
  border-radius: 50%;
  display: flex;
  font-size: 13px;
  font-weight: 750;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.message.user::before {
  background: #202123;
  color: #fff;
  content: "U";
}

.message.assistant::before {
  background: #ecece5;
  color: #202123;
  content: "AI";
}

.message.system {
  color: #6a5b16;
}

.message.system::before {
  background: #fbf2c8;
  color: #6a5b16;
  content: "i";
}

.composer {
  background: rgba(247, 247, 244, 0.96);
  border-top: 1px solid #e2e2dc;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin: 0 auto;
  max-width: 820px;
  padding: 14px 20px 18px;
  width: 100%;
}

.composer textarea {
  max-height: 180px;
  min-height: 46px;
  resize: none;
}

.hidden {
  display: none;
}

@media (max-width: 700px) {
  .entry {
    padding: 14px;
  }

  .entry-card {
    padding: 20px;
  }

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

  .chat-header,
  .brand {
    align-items: stretch;
    flex-direction: column;
  }

  .conversation-pill {
    border-radius: 8px;
    justify-content: space-between;
  }

  .messages {
    padding: 18px 14px 24px;
  }

  .message {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .message::before {
    height: 30px;
    width: 30px;
  }
}
