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

:root {
    --bg-deep: #070b14;
    --bg-panel: #0d1220;
    --bg-card: #121929;
    --bg-input: #1a2235;
    --accent-blue: #3b82f6;
    --accent-purple: #7c3aed;
    --accent-glow: #6366f1;
    --text-primary: #e8edf5;
    --text-secondary: #8899b4;
    --text-muted: #4a5670;
    --border: #1e2d47;
    --border-light: #243450;
    --user-bubble: #1e3a5f;
    --ai-bubble: #131e30;
    --beginner: #22c55e;
    --intermediate: #f59e0b;
    --advanced: #ef4444;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.app {
    display: flex;
    height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
}

.logo-text {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo-ai {
    color: var(--accent-blue);
}

/* LEVEL CARD */
.level-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}

.level-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.level-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.level-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.4s ease;
}

.level-dot.beginner { background: var(--beginner); box-shadow: 0 0 6px var(--beginner); }
.level-dot.intermediate { background: var(--intermediate); box-shadow: 0 0 6px var(--intermediate); }
.level-dot.advanced { background: var(--advanced); box-shadow: 0 0 6px var(--advanced); }

.level-text {
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.level-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.level-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    border-radius: 2px;
    transition: width 0.6s ease;
}

/* SIDEBAR INFO */
.sidebar-info p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* HOW IT WORKS */
.how-it-works {
    margin-top: auto;
}

.how-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.step-num {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent-blue);
}

/* MAIN CHAT */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 1.75rem 2rem 1rem;
    border-bottom: 1px solid var(--border);
}

.chat-header h1 {
    font-family: 'Syne', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.chat-header p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.chat-header em {
    color: var(--accent-blue);
    font-style: normal;
}

/* CHAT BOX */
.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.chat-box::-webkit-scrollbar { width: 4px; }
.chat-box::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* WELCOME */
.welcome-message {
    text-align: center;
    margin: auto;
    max-width: 400px;
    padding: 3rem 2rem;
}

.welcome-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.welcome-message p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.welcome-message strong {
    color: var(--text-primary);
}

/* MESSAGES */
.message {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    animation: fadeIn 0.3s ease;
}

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

.message.user {
    align-self: flex-end;
    align-items: flex-end;
}

.message.ai {
    align-self: flex-start;
    align-items: flex-start;
}

.message-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    padding: 0 0.25rem;
}

.message-bubble {
    padding: 0.9rem 1.1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text-primary);
}

.message.user .message-bubble {
    background: var(--user-bubble);
    border: 1px solid #2a4a70;
    border-bottom-right-radius: 4px;
}

.message.ai .message-bubble {
    background: var(--ai-bubble);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

/* TYPING INDICATOR */
.typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 0.9rem 1.1rem;
    background: var(--ai-bubble);
    border: 1px solid var(--border);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.typing span {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.2s infinite;
}

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

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* INPUT AREA */
.input-area {
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
    align-items: center;
    background: var(--bg-panel);
}

#user-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 0.8rem 1.1rem;
    font-size: 0.9rem;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}

#user-input::placeholder { color: var(--text-muted); }
#user-input:focus { border-color: var(--accent-blue); }

#send-btn {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border: none;
    border-radius: 10px;
    padding: 0.8rem 1.5rem;
    font-size: 0.9rem;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}

#send-btn:hover { opacity: 0.9; }
#send-btn:active { transform: scale(0.97); }
#send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* RESPONSIVE */
@media (max-width: 640px) {
    .sidebar { display: none; }
    .chat-header { padding: 1rem; }
    .chat-box { padding: 1rem; }
    .input-area { padding: 1rem; }
    .message { max-width: 90%; }
}