* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0d1117;
  color: #e6edf3;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
}

.chat-container {
  width: 100%;
  max-width: 800px;
  height: 90vh;
  max-height: 800px;
  background: #161b22;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.chat-header {
  background: linear-gradient(135deg, #f6821f, #e0721a);
  padding: 16px;
  text-align: center;
}

.chat-header h1 {
  font-size: 1.4rem;
  color: #fff;
}

.chat-header p {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 4px;
}

.persona-selector {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.persona-selector label {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.9);
}

.persona-selector select {
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  min-width: 150px;
}

.persona-selector select option {
  background: #161b22;
  color: #e6edf3;
}

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

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: #161b22;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 3px;
}

.message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.5;
  word-wrap: break-word;
  font-size: 0.95rem;
}

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

.message.ai {
  align-self: flex-start;
  background: #21262d;
  border: 1px solid #30363d;
  border-bottom-left-radius: 4px;
}

.message.error {
  align-self: center;
  background: #da3633;
  color: #fff;
  text-align: center;
  max-width: 90%;
}

.chat-input {
  display: flex;
  gap: 10px;
  padding: 14px;
  background: #0d1117;
  border-top: 1px solid #30363d;
}

.chat-input input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #161b22;
  color: #e6edf3;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
  min-width: 0;
}

.chat-input input:focus {
  border-color: #f6821f;
}

.chat-input button {
  padding: 12px 20px;
  background: #f6821f;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.chat-input button:hover {
  background: #e0721a;
}

.chat-input button:disabled {
  background: #484f58;
  cursor: not-allowed;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  align-self: flex-start;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #484f58;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

@media (max-width: 600px) {
  body {
    padding: 0;
    align-items: stretch;
  }

  .chat-container {
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }

  .chat-header {
    padding: 12px;
  }

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

  .chat-header p {
    font-size: 0.75rem;
  }

  .persona-selector {
    flex-direction: column;
    gap: 6px;
  }

  .persona-selector select {
    width: 100%;
    max-width: 250px;
  }

  .message {
    max-width: 92%;
    font-size: 0.9rem;
    padding: 8px 12px;
  }

  .chat-input {
    padding: 10px;
    gap: 8px;
  }

  .chat-input input {
    padding: 10px 12px;
    font-size: 0.95rem;
  }

  .chat-input button {
    padding: 10px 16px;
    font-size: 0.9rem;
  }
}

@media (max-width: 380px) {
  .chat-header h1 {
    font-size: 1.1rem;
  }

  .message {
    font-size: 0.85rem;
  }

  .chat-input button {
    padding: 10px 12px;
    font-size: 0.85rem;
  }
}
