* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 24px;
  display: grid;
  place-items: center;
  background: #eef2f8;
  color: #1f2937;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.chat-app {
  width: min(100%, 560px);
  height: min(720px, calc(100vh - 48px));
  min-height: 420px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  box-shadow: 0 16px 48px rgb(31 41 55 / 10%);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  color: #fff;
  background: #4f46e5;
}

.avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgb(255 255 255 / 20%);
  font-weight: 700;
}

.chat-header h1,
.chat-header p {
  margin: 0;
}

.chat-header h1 {
  font-size: 1.05rem;
}

.chat-header p {
  margin-top: 3px;
  color: #e0e7ff;
  font-size: 0.85rem;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  background: #86efac;
}

.chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 22px;
}

.message {
  max-width: 85%;
  padding: 12px 15px;
  border-radius: 16px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.assistant-message {
  align-self: flex-start;
  background: #f1f5f9;
  border-bottom-left-radius: 5px;
}

.user-message {
  align-self: flex-end;
  color: #fff;
  background: #4f46e5;
  border-bottom-right-radius: 5px;
}

.chat-form {
  display: flex;
  gap: 10px;
  padding: 16px 20px 10px;
  border-top: 1px solid #e2e8f0;
}

.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font: inherit;
  outline: none;
}

.chat-form input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgb(79 70 229 / 14%);
}

.chat-form button {
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: #4f46e5;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.chat-form button:hover {
  background: #4338ca;
}

.chat-form button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.note {
  margin: 0;
  padding: 0 20px 14px;
  color: #64748b;
  text-align: center;
  font-size: 0.78rem;
}

.visually-hidden {
  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: 480px) {
  body {
    padding: 0;
  }

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