* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 10px;
}

.chat-container {
    flex: 1;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.status-bar {
    background: #f0f4ff;
    border-bottom: 1px solid #e0e8ff;
    padding: 8px 14px;
    font-size: 12px;
    color: #667eea;
    font-weight: 500;
    min-height: 34px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.status-bar.error {
    background: #fff0f0;
    border-bottom-color: #ffd0d0;
    color: #dc3545;
}

.status-bar.success {
    background: #f0fff4;
    border-bottom-color: #c3e6cb;
    color: #28a745;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f8f9fa;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

.message {
    margin: 8px 0;
    display: flex;
    animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.message-content {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 15px;
    word-break: break-word;
}

.user-message .message-content {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message .message-content {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.chat-input-container {
    background: white;
    border-top: 1px solid #e8e8e8;
    padding: 10px 10px 14px;
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

#message-input {
    flex: 1;
    padding: 11px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
    background: #f8f9fa;
    min-width: 0;
}

#message-input:focus {
    border-color: #667eea;
    background: white;
}

.send-btn {
    padding: 11px 18px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.send-btn:active { background: #5568d3; }
.send-btn:disabled { background: #ccc; cursor: not-allowed; }

@media (min-width: 600px) {
    .container { padding: 20px; max-width: 680px; margin: 0 auto; }
    .message-content { max-width: 72%; }
    .send-btn { padding: 11px 22px; }

    ::-webkit-scrollbar { width: 6px; }
    ::-webkit-scrollbar-track { background: #f1f1f1; }
    ::-webkit-scrollbar-thumb { background: #667eea; border-radius: 10px; }
}
