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

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 0%, rgba(124, 58, 237, 0.28), transparent 38rem),
    #09090b;
}

button,
input {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-content: center;
  padding: 24px;
}

.chat-card {
  width: min(680px, calc(100vw - 32px));
  height: min(720px, calc(100vh - 92px));
  min-height: 500px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 24px;
  background: rgba(20, 20, 23, 0.88);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: white;
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, #a855f7, #4f46e5);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.35);
}

h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.chat-header p {
  margin: 4px 0 0;
  color: #a1a1aa;
  font-size: 13px;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.7);
}

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

.message {
  width: fit-content;
  max-width: min(82%, 520px);
  padding: 12px 15px;
  border-radius: 17px;
  line-height: 1.5;
  font-size: 15px;
  animation: arrive 180ms ease-out;
}

.message.bot {
  align-self: flex-start;
  color: #e4e4e7;
  background: #27272a;
  border-bottom-left-radius: 5px;
}

.message.user {
  align-self: flex-end;
  color: white;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  border-bottom-right-radius: 5px;
}

.message.pending {
  color: #a1a1aa;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.composer input {
  min-width: 0;
  padding: 13px 16px;
  color: #fafafa;
  border: 1px solid #3f3f46;
  border-radius: 14px;
  outline: none;
  background: #18181b;
}

.composer input:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.composer button {
  padding: 0 20px;
  color: white;
  font-weight: 700;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  background: #7c3aed;
}

.composer button:hover {
  background: #8b5cf6;
}

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

.footer-note {
  margin: 14px 0 0;
  color: #71717a;
  text-align: center;
  font-size: 12px;
}

.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;
}

@keyframes arrive {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
  .shell { padding: 0; }
  .chat-card {
    width: 100vw;
    height: 100vh;
    min-height: 0;
    border: 0;
    border-radius: 0;
  }
  .footer-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .message { animation: none; }
}
