* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: #f5f5f5;
    height: 100vh;
    display: flex;
    flex-direction: column;
}
.header {
    background: white;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.header h1 {
    font-size: 20px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.clear-btn {
    padding: 8px 16px;
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}
.clear-btn:hover {
    background: #f57c00;
}
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f5f5f5;
}
.message {
    display: flex;
    animation: fadeIn 0.3s;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.message.user {
    justify-content: flex-end;
}
.message.assistant {
    justify-content: flex-start;
}
.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
}
.message.user .message-content {
    background: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
}
.message.assistant .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 {
    margin: 12px 0 8px 0;
    font-weight: 600;
}
.message-content h1 { font-size: 1.4em; }
.message-content h2 { font-size: 1.2em; }
.message-content h3 { font-size: 1.1em; }
.message-content h4 { font-size: 1em; }
.message-content p {
    margin: 8px 0;
}
.message-content ul,
.message-content ol {
    margin: 8px 0;
    padding-left: 24px;
}
.message-content li {
    margin: 4px 0;
}
.message-content strong {
    font-weight: 600;
}
.message-content em {
    font-style: italic;
}
.message-content code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}
.message.user .message-content code {
    background: rgba(255,255,255,0.2);
}
.message-content pre {
    background: #f4f4f4;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}
.message-content pre code {
    background: none;
    padding: 0;
}
.message-content blockquote {
    border-left: 3px solid #ddd;
    padding-left: 12px;
    margin: 8px 0;
    color: #666;
}
.message-content a {
    color: #007bff;
    text-decoration: none;
}
.message-content a:hover {
    text-decoration: underline;
}
.message-content hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 12px 0;
}
.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
}
.message-content th,
.message-content td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}
.message-content th {
    background: #f4f4f4;
    font-weight: 600;
}
.message-label {
    font-size: 11px;
    color: #999;
    margin-bottom: 4px;
    padding: 0 4px;
}
.empty-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
}
.input-container {
    background: white;
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -1px 3px rgba(0,0,0,0.05);
}
.input-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}
.voice-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}
.record-btn {
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.record-btn:hover {
    background: #45a049;
}
.record-btn.recording {
    background: #f44336;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
.record-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}
.stop-btn {
    padding: 10px 20px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}
.stop-btn:hover {
    background: #d32f2f;
}
.stop-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}
.recording-status {
    color: #f44336;
    font-size: 13px;
    font-weight: 500;
}
.text-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}
.text-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.text-input:focus {
    border-color: #007bff;
}
.send-btn {
    padding: 12px 24px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}
.send-btn:hover {
    background: #0056b3;
}
.send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}
.typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}
.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}
.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}
