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

:root {
/* Apple iOS colors */
--blue: #007AFF;
--blue-dark: #0051D5;
--gray: #8E8E93;
--gray-light: #C7C7CC;
--gray-lighter: #E5E5EA;
--gray-lightest: #F2F2F7;
--white: #FFFFFF;
--black: #000000;
--text-primary: #000000;
--text-secondary: #3C3C43;
--text-tertiary: #8E8E93;
--separator: rgba(60, 60, 67, 0.36);
--fill-tertiary: rgba(118, 118, 128, 0.12);
}

@media (prefers-color-scheme: dark) {
:root {
--blue: #0A84FF;
--gray-lightest: #1C1C1E;
--gray-lighter: #2C2C2E;
--gray-light: #48484A;
--gray: #8E8E93;
--white: #000000;
--black: #FFFFFF;
--text-primary: #FFFFFF;
--text-secondary: #EBEBF5;
--text-tertiary: #8E8E93;
--separator: rgba(84, 84, 88, 0.65);
--fill-tertiary: rgba(118, 118, 128, 0.24);
}
}

body {
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
background: var(--gray-lightest);
color: var(--text-primary);
line-height: 1.47059;
font-size: 17px;
overflow: hidden;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

.container {
max-width: 980px;
margin: 0 auto;
height: 100vh;
display: flex;
flex-direction: column;
background: var(--white);
}

.header {
background: var(--white);
padding: 20px 20px 16px;
border-bottom: 0.5px solid var(--separator);
backdrop-filter: saturate(180%) blur(20px);
-webkit-backdrop-filter: saturate(180%) blur(20px);
}

.header-content {
text-align: center;
margin-bottom: 12px;
}

.title {
font-size: 28px;
font-weight: 700;
letter-spacing: -0.5px;
margin-bottom: 2px;
color: var(--text-primary);
}

.subtitle {
font-size: 13px;
color: var(--text-secondary);
font-weight: 400;
letter-spacing: -0.08px;
}

.built-with {
display: inline-block;
color: var(--blue);
text-decoration: none;
font-size: 13px;
padding: 6px 12px;
background: var(--fill-tertiary);
border-radius: 12px;
transition: all 0.2s ease;
font-weight: 500;
}

.built-with:hover {
background: var(--gray-lighter);
transform: scale(1.02);
}

.built-with:active {
transform: scale(0.98);
}

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

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

.messages-container::-webkit-scrollbar {
width: 6px;
}

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

.messages-container::-webkit-scrollbar-thumb {
background: var(--gray-light);
border-radius: 3px;
}

.welcome-message {
text-align: center;
padding: 60px 20px;
}

.welcome-icon {
margin-bottom: 20px;
animation: gentle-bounce 2s ease-in-out infinite;
}

@keyframes gentle-bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-8px); }
}

.welcome-message h2 {
font-size: 22px;
font-weight: 600;
letter-spacing: -0.4px;
margin-bottom: 8px;
color: var(--text-primary);
}

.welcome-message p {
font-size: 15px;
color: var(--text-secondary);
max-width: 400px;
margin: 0 auto;
line-height: 1.4;
}

.message {
display: flex;
margin-bottom: 16px;
animation: message-appear 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes message-appear {
from {
opacity: 0;
transform: translateY(8px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

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

.message-content {
max-width: 70%;
padding: 12px 16px;
border-radius: 18px;
font-size: 15px;
line-height: 1.4;
word-wrap: break-word;
position: relative;
}

.message.user .message-content {
background: var(--blue);
color: white;
border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
background: var(--gray-lighter);
color: var(--text-primary);
border-bottom-left-radius: 4px;
}

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

.typing-dot {
width: 8px;
height: 8px;
background: var(--gray);
border-radius: 50%;
animation: typing-animation 1.4s infinite;
}

.typing-dot:nth-child(2) {
animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
animation-delay: 0.4s;
}

@keyframes typing-animation {
0%, 60%, 100% {
transform: translateY(0);
opacity: 0.5;
}
30% {
transform: translateY(-6px);
opacity: 1;
}
}

.input-container {
padding: 8px 16px 20px;
background: var(--white);
border-top: 0.5px solid var(--separator);
}

.input-wrapper {
display: flex;
gap: 8px;
align-items: flex-end;
background: var(--gray-lightest);
border-radius: 20px;
padding: 8px 8px 8px 16px;
border: 1px solid var(--separator);
transition: all 0.2s ease;
}

.input-wrapper:focus-within {
border-color: var(--blue);
background: var(--white);
}

#userInput {
flex: 1;
border: none;
background: transparent;
padding: 4px 0;
font-size: 17px;
font-family: inherit;
resize: none;
max-height: 120px;
outline: none;
color: var(--text-primary);
line-height: 1.4;
}

#userInput::placeholder {
color: var(--text-tertiary);
}

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

.send-btn:hover:not(:disabled) {
background: var(--blue-dark);
transform: scale(1.05);
}

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

.send-btn:disabled {
background: var(--gray-light);
cursor: not-allowed;
opacity: 0.4;
}

.status {
margin-top: 8px;
text-align: center;
font-size: 13px;
color: var(--text-tertiary);
}

.loading-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.4);
backdrop-filter: saturate(180%) blur(20px);
-webkit-backdrop-filter: saturate(180%) blur(20px);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
}

.loading-overlay.hidden {
display: none;
}

.loading-content {
background: var(--white);
padding: 40px;
border-radius: 20px;
text-align: center;
max-width: 360px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.loading-spinner {
width: 50px;
height: 50px;
border: 3px solid var(--gray-lighter);
border-top-color: var(--blue);
border-radius: 50%;
animation: spin 0.8s linear infinite;
margin: 0 auto 24px;
}

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

.loading-content h3 {
font-size: 22px;
margin-bottom: 8px;
font-weight: 600;
letter-spacing: -0.4px;
color: var(--text-primary);
}

.loading-content p {
color: var(--text-secondary);
margin-bottom: 20px;
font-size: 15px;
}

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

.progress-fill {
height: 100%;
background: var(--blue);
width: 0%;
transition: width 0.3s ease;
border-radius: 2px;
}

.progress-text {
font-size: 13px;
color: var(--text-tertiary);
font-weight: 500;
}

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

.header {
padding: 16px;
}

.title {
font-size: 24px;
}

.messages-container {
padding: 16px;
}

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

.loading-content {
margin: 20px;
padding: 32px;
}
}