body { 
  font-family: Arial, sans-serif; 
  background: #f6f8fa; 
  color: #222; 
  margin: 0;
  padding: 0;
}

.container { 
  max-width: 720px; 
  margin: 20px auto; 
  background: #fff; 
  padding: 20px; 
  border-radius: 8px; 
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 80px);
}

h1 {
  margin: 0;
  font-size: 1.5em;
}

.clear-history-btn {
  padding: 6px 12px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s;
}

.clear-history-btn:hover {
  background: #c82333;
}

#conversation { 
  flex: 1;
  border: 1px solid #eee; 
  padding: 12px; 
  margin-bottom: 12px; 
  overflow-y: auto; 
  background: #fafafa;
}

.line { 
  margin-bottom: 12px;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.input-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.text-input-container {
  display: flex;
  gap: 8px;
}

#textInput {
  flex: 1;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

#textInput:focus {
  outline: none;
  border-color: #0366d6;
}

#sendBtn {
  padding: 12px 24px;
  background: #0366d6;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

#sendBtn:hover {
  background: #0256c7;
}

.record-btn {
  padding: 16px;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.2s;
}

.record-btn:active,
.record-btn.recording {
  background: #dc3545;
  transform: scale(0.98);
}

.record-btn:hover:not(.recording) {
  background: #218838;
}

/* Streaming cursor animation */
.cursor {
  display: inline-block;
  animation: blink 1s infinite;
  color: #0366d6;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* Tool call styling */
.tool-call {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 8px 12px;
  margin: 8px 0;
  border-radius: 4px;
  font-size: 0.9em;
}

.tool-call code {
  background: rgba(0,0,0,0.1);
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: bold;
}

.tool-call small {
  color: #666;
  display: block;
  margin-top: 4px;
}

.error {
  color: #dc3545;
  font-weight: bold;
}

/* Markdown styles */
.markdown-content { 
  margin-top: 4px; 
  line-height: 1.6; 
  color: #24292e;
}

/* Headers */
.markdown-content h1, .markdown-content h2, .markdown-content h3 { 
  margin-top: 16px; 
  margin-bottom: 8px; 
  font-weight: 600;
}
.markdown-content h1 { 
  font-size: 1.5em; 
  border-bottom: 2px solid #e1e4e8; 
  padding-bottom: 8px; 
}
.markdown-content h2 { 
  font-size: 1.3em; 
  border-bottom: 1px solid #e1e4e8; 
  padding-bottom: 6px;
}
.markdown-content h3 { font-size: 1.1em; }

/* Text */
.markdown-content p { margin: 8px 0; }
.markdown-content strong { font-weight: 600; color: #1a1a1a; }
.markdown-content em { font-style: italic; }
.markdown-content a { 
  color: #0366d6; 
  text-decoration: none; 
}
.markdown-content a:hover { text-decoration: underline; }

/* Lists */
.markdown-content ul, .markdown-content ol { 
  margin: 8px 0; 
  padding-left: 24px; 
}
.markdown-content li { 
  margin: 4px 0; 
  line-height: 1.5;
}
.markdown-content li > p { margin: 2px 0; }

/* Code */
.markdown-content code { 
  background: #f6f8fa; 
  padding: 3px 6px; 
  border-radius: 3px; 
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace; 
  font-size: 0.9em;
  color: #e83e8c;
  border: 1px solid #e1e4e8;
}
.markdown-content pre { 
  background: #f6f8fa; 
  padding: 16px; 
  border-radius: 6px; 
  overflow-x: auto; 
  margin: 12px 0;
  border: 1px solid #e1e4e8;
}
.markdown-content pre code { 
  background: none; 
  padding: 0; 
  border: none;
  color: #24292e;
  font-size: 0.95em;
}

/* Tables */
.markdown-content table { 
  border-collapse: collapse; 
  width: 100%; 
  margin: 12px 0;
  display: block;
  overflow-x: auto;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.markdown-content thead {
  background: #f6f8fa;
}
.markdown-content th, .markdown-content td { 
  border: 1px solid #d0d7de; 
  padding: 10px 14px; 
  text-align: left;
  min-width: 80px;
}
.markdown-content th { 
  background: #f6f8fa; 
  font-weight: 600;
  color: #24292e;
  position: sticky;
  top: 0;
}
.markdown-content tr:nth-child(even) {
  background: #f9fafb;
}
.markdown-content tr:hover {
  background: #f0f3f6;
}

/* Blockquote */
.markdown-content blockquote { 
  border-left: 4px solid #dfe2e5; 
  padding-left: 16px; 
  margin: 12px 0; 
  color: #6a737d;
  font-style: italic;
}
.markdown-content blockquote p { margin: 4px 0; }

/* Horizontal Rule */
.markdown-content hr {
  border: none;
  border-top: 2px solid #e1e4e8;
  margin: 16px 0;
}

/* Mermaid Diagram */
.mermaid-diagram {
  margin: 16px 0;
  padding: 16px;
  background: #f9fafb;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  text-align: center;
  overflow-x: auto;
}

.mermaid-diagram svg {
  max-width: 100%;
  height: auto;
}

.mermaid-error {
  margin: 12px 0;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .container {
    margin: 10px;
    padding: 15px;
    height: calc(100vh - 60px);
  }
  
  h1 {
    font-size: 1.3em;
  }
  
  #textInput {
    font-size: 16px; /* Prevent zoom on iOS */
  }
}

