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

:root {
--primary-color: #007AFF;
--secondary-color: #5856D6;
--background: #F5F5F7;
--surface: #FFFFFF;
--text-primary: #1D1D1F;
--text-secondary: #86868B;
--border-color: #D2D2D7;
--assistant-bg: #F5F5F7;
--user-bg: #007AFF;
--shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
--shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
}

body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
background: var(--background);
color: var(--text-primary);
line-height: 1.6;
overflow: hidden;
}

.container {
max-width: 1200px;
margin: 0 auto;
height: 100vh;
display: flex;
flex-direction: column;
background: var(--surface);
box-shadow: var(--shadow-lg);
}

header {
background: rgba(255, 255, 255, 0.8);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border-bottom: 1px solid var(--border-color);
padding: 16px 24px;
position: sticky;
top: 0;
z-index: 100;
}

.header-content {
display: flex;
justify-content: space-between;
align-items: center;
}

.logo {
display: flex;
align-items: center;
gap: 12px;
color: var(--primary-color);
}

.logo svg {
color: var(--primary-color);
}

.logo h1 {
font-size: 20px;
font-weight: 600;
color: var(--text-primary);
}

.built-with {
color: var(--text-secondary);
text-decoration: none;
font-size: 14px;
font-weight: 500;
padding: 8px 16px;
border-radius: 20px;
transition: all 0.3s ease;
}

.built-with:hover {
background: var(--background);
color: var(--primary-color);
}

.chat-container {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
position: relative;
}

.loading-screen {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
background: var(--surface);
}

.loading-content {
text-align: center;
max-width: 400px;
padding: 40px;
}

.spinner {
width: 60px;
height: 60px;
border: 3px solid var(--border-color);
border-top-color: var(--primary-color);
border-radius: 50%;
animation: spin 1s linear infinite;
margin: 0 auto 24px;
}

@keyframes spin {
to { transform: rotate(360deg); }
}

.loading-content h2 {
font-size: 24px;
font-weight: 600;
margin-bottom: 12px;
color: var(--text-primary);
}

#loading-status {
color: var(--text-secondary);
margin-bottom: 24px;
font-size: 15px;
}

.progress-bar {
width: 100%;
height: 4px;
background: var(--border-color);
border-radius: 2px;
overflow: hidden;
margin-bottom: 16px;
}

.progress-fill {
height: 100%;
background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
border-radius: 2px;
transition: width 0.3s ease;
width: 0%;
}

.loading-info {
color: var(--text-secondary);
font-size: 13px;
}

.chat-area {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
}

.messages {
flex: 1;
overflow-y: auto;
padding: 24px;
scroll-behavior: smooth;
}

.messages::-webkit-scrollbar {
width: 8px;
}

.messages::-webkit-scrollbar-track {
background: transparent;
}

.messages::-webkit-scrollbar-thumb {
background: var(--border-color);
border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb:hover {
background: var(--text-secondary);
}

.message {
display: flex;
gap: 12px;
margin-bottom: 24px;
animation: fadeIn 0.3s ease;
}

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

.message-avatar {
width: 32px;
height: 32px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}

.assistant-avatar {
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
color: white;
}

.user-avatar {
background: var(--text-secondary);
color: white;
font-weight: 600;
font-size: 14px;
}

.message-content {
flex: 1;
max-width: 70%;
}

.message-header {
font-size: 13px;
font-weight: 600;
margin-bottom: 4px;
color: var(--text-secondary);
}

.message-text {
background: var(--assistant-bg);
padding: 12px 16px;
border-radius: 16px;
font-size: 15px;
line-height: 1.5;
white-space: pre-wrap;
word-wrap: break-word;
}

.user-message {
flex-direction: row-reverse;
}

.user-message .message-content {
display: flex;
flex-direction: column;
align-items: flex-end;
}

.user-message .message-text {
background: var(--user-bg);
color: white;
}

.typing-indicator {
display: flex;
gap: 4px;
padding: 12px 16px;
}

.typing-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--text-secondary);
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);
opacity: 0.5;
}
30% {
transform: translateY(-10px);
opacity: 1;
}
}

.input-area {
padding: 16px 24px 24px;
background: var(--surface);
border-top: 1px solid var(--border-color);
}

.input-container {
display: flex;
gap: 12px;
align-items: flex-end;
background: var(--background);
border-radius: 20px;
padding: 8px 12px;
border: 2px solid transparent;
transition: all 0.3s ease;
}

.input-container:focus-within {
border-color: var(--primary-color);
background: var(--surface);
}

#user-input {
flex: 1;
border: none;
background: transparent;
resize: none;
font-size: 15px;
font-family: inherit;
color: var(--text-primary);
outline: none;
max-height: 120px;
padding: 8px;
}

#user-input::placeholder {
color: var(--text-secondary);
}

.send-button {
width: 36px;
height: 36px;
border-radius: 50%;
border: none;
background: var(--primary-color);
color: white;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
background: var(--secondary-color);
transform: scale(1.05);
}

.send-button:active:not(:disabled) {
transform: scale(0.95);
}

.send-button:disabled {
opacity: 0.5;
cursor: not-allowed;
}

.input-footer {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 8px;
padding: 0 8px;
}

.model-info {
font-size: 12px;
color: var(--text-secondary);
}

@media (max-width: 768px) {
.container {
max-width: 100%;
}

header {
padding: 12px 16px;
}

.logo h1 {
font-size: 18px;
}

.messages {
padding: 16px;
}

.message-content {
max-width: 85%;
}

.input-area {
padding: 12px 16px 16px;
}
}