*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0f172a;
  color: #e5e7eb;
}

.app {
  max-width: 900px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 12px;
}

.header {
  padding: 8px 12px;
  border-radius: 12px;
  background: #111827;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.header h1 {
  margin: 0;
  font-size: 1.1rem;
}

.conn-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.conn-info label {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.conn-info input {
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid #4b5563;
  background: #020617;
  color: #e5e7eb;
}

button {
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  background: #2563eb;
  color: white;
  transition: background 0.15s ease;
}

button:hover {
  background: #1d4ed8;
}

button:disabled {
  background: #4b5563;
  cursor: not-allowed;
}

.status {
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 999px;
}

.status-connected {
  background: #065f46;
  color: #bbf7d0;
}

.status-disconnected {
  background: #7f1d1d;
  color: #fecaca;
}

.main {
  flex: 1;
  margin-top: 10px;
  margin-bottom: 10px;
  padding: 8px;
  border-radius: 12px;
  background: #020617;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.message-row {
  display: flex;
}

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

.message-row.neria {
  justify-content: flex-start;
}

.message-bubble {
  max-width: 70%;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.message-row.user .message-bubble {
  background: #1d4ed8;
  color: white;
  border-bottom-right-radius: 0;
}

.message-row.neria .message-bubble {
  background: #111827;
  border-bottom-left-radius: 0;
}

.message-meta {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 2px;
}

.footer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

#messageInput {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid #4b5563;
  resize: vertical;
  background: #020617;
  color: #e5e7eb;
}

@media (max-width: 600px) {
  .app {
    padding: 8px;
  }
  .message-bubble {
    max-width: 85%;
  }
}
