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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #0a0a0a;
  color: #e0e0e0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  text-align: center;
  padding: 20px 0;
  border-bottom: 1px solid #222;
  margin-bottom: 20px;
}

header h1 {
  font-size: 2rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

header .subtitle {
  color: #888;
  font-size: 0.9rem;
}

#chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
  margin-bottom: 20px;
}

#messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 85%;
  line-height: 1.5;
  word-wrap: break-word;
}

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

.message.assistant {
  background: #1e1e1e;
  color: #e0e0e0;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.message.assistant p {
  margin-bottom: 0.5em;
}

.message.assistant p:last-child {
  margin-bottom: 0;
}

.message.assistant strong {
  color: #fff;
}

.message.assistant a {
  color: #58a6ff;
}

.message.error {
  background: #3d1a1a;
  color: #ff6b6b;
  align-self: center;
  font-size: 0.9rem;
}

#chat-form {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid #222;
}

#message-input {
  flex: 1;
  padding: 14px 18px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #1a1a1a;
  color: #fff;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

#message-input:focus {
  border-color: #1a73e8;
}

#message-input::placeholder {
  color: #666;
}

#send-btn {
  padding: 14px 24px;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

#send-btn:hover {
  background: #1557b0;
}

#send-btn:disabled {
  background: #333;
  cursor: not-allowed;
}

#status {
  text-align: center;
  font-size: 0.85rem;
  color: #666;
  padding: 10px 0;
}

#status.error {
  color: #ff6b6b;
}

.typing-indicator {
  display: inline-block;
}

.typing-indicator::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

@media (max-width: 600px) {
  .container {
    padding: 10px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .message {
    max-width: 90%;
    padding: 10px 14px;
  }

  #message-input {
    padding: 12px 14px;
  }

  #send-btn {
    padding: 12px 18px;
  }
}
