* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #e2e8f0;
    min-height: 100vh;
    padding-bottom: 80px;
}

.navbar {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    grid-column: 1;
    justify-self: start;
}

.chat-title {
    font-size: 1.2rem;
    color: #cbd5e1;
    font-weight: 500;
    grid-column: 2;
}

.main-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(59, 130, 246, 0.3);
    border-left: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: #cbd5e1;
    font-size: 1.1rem;
}

.error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}

.error-icon {
    font-size: 3rem;
    color: #ef4444;
    margin-bottom: 1rem;
}

.error-title {
    font-size: 1.5rem;
    color: #ef4444;
    margin-bottom: 0.5rem;
}

.error-message {
    color: #cbd5e1;
    font-size: 1rem;
}

.message {
    margin-bottom: 2rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.message.user {
    flex-direction: row-reverse;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.avatar.user {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
}

.avatar.assistant {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.message-content {
    flex: 0 1 auto;
}

.message.user .message-content {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 1.5rem 1.5rem 0.5rem 1.5rem;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
    display: inline-block;
    max-width: 70%;
    word-wrap: break-word;
}

.message.assistant .message-content {
    background: transparent;
    padding: 0;
    flex: 1;
    max-width: calc(100% - 60px);
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    color: #f1f5f9;
    margin: 1.5rem 0 1rem 0;
    font-weight: 600;
}

.markdown-content h1 { font-size: 2rem; }
.markdown-content h2 { font-size: 1.5rem; }
.markdown-content h3 { font-size: 1.25rem; }

.markdown-content p {
    margin-bottom: 1rem;
    line-height: 1.7;
    color: #cbd5e1;
}

.markdown-content ul,
.markdown-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.markdown-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
    color: #cbd5e1;
}

.markdown-content a {
    color: #60a5fa;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.markdown-content a:hover {
    color: #93c5fd;
    border-bottom-color: #60a5fa;
}

.markdown-content code {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    padding: 0.2rem 0.4rem;
    border-radius: 0.3rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

.markdown-content pre {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
    position: relative;
}

.markdown-content pre code {
    background: none;
    color: #e2e8f0;
    padding: 0;
}

.hljs {
    background: rgba(15, 23, 42, 0.8) !important;
    color: #e2e8f0;
}

.hljs-keyword { color: #c678dd; }
.hljs-string { color: #98c379; }
.hljs-number { color: #d19a66; }
.hljs-comment { color: #5c6370; font-style: italic; }
.hljs-function { color: #61afef; }
.hljs-variable { color: #e06c75; }
.hljs-tag { color: #e06c75; }
.hljs-attr { color: #d19a66; }
.hljs-built_in { color: #56b6c2; }
.hljs-selector-tag { color: #e06c75; }
.hljs-selector-class { color: #d19a66; }
.hljs-selector-id { color: #61afef; }
.hljs-property { color: #56b6c2; }
.hljs-value { color: #98c379; }

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
}

::-webkit-scrollbar-corner {
    background: rgba(15, 23, 42, 0.3);
}

.markdown-content pre::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.markdown-content pre::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.markdown-content pre::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.5);
    border-radius: 3px;
}

.markdown-content pre::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.7);
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 0.5rem;
    overflow: hidden;
}

.markdown-content th,
.markdown-content td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.markdown-content th {
    background: rgba(59, 130, 246, 0.1);
    font-weight: 600;
    color: #f1f5f9;
}

.markdown-content blockquote {
    border-left: 4px solid #60a5fa;
    margin: 1rem 0;
    padding-left: 1rem;
    color: #94a3b8;
    font-style: italic;
}

.floating-button {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
}

.floating-button:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.6);
}

.floating-button:active {
    transform: translateX(-50%) translateY(0);
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .nav-container {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
        grid-template-columns: none;
    }

    .logo, .chat-title {
        grid-column: auto;
        justify-self: auto;
    }

    .main-container {
        padding: 0 1rem;
    }

    .message {
        gap: 0.5rem;
    }

    .avatar {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .floating-button {
        bottom: 1rem;
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }

    .nav-buttons {
        margin-top: 0.5rem;
    }
}