:root { --primary: #2563eb; --bg: #f8fafc; }
body { margin: 0; font-family: system-ui, sans-serif; background: var(--bg); height: 100vh; display: flex; justify-content: center; }
#app-container { width: 100%; max-width: 600px; background: white; display: flex; flex-direction: column; height: 100%; box-shadow: 0 0 20px rgba(0,0,0,0.1); }

header { padding: 15px; border-bottom: 1px solid #e2e8f0; text-align: center; font-weight: bold; color: #1e293b; }
#grade-badge { background: #e0e7ff; color: #4338ca; padding: 2px 8px; border-radius: 12px; font-size: 0.8rem; margin-left: 8px; }

#chat-window { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 15px; }
.message { max-width: 85%; padding: 12px 16px; border-radius: 12px; line-height: 1.5; animation: popIn 0.2s ease-out; }
.bot { align-self: flex-start; background: #f1f5f9; color: #334155; border-bottom-left-radius: 2px; }
.user { align-self: flex-end; background: var(--primary); color: white; border-bottom-right-radius: 2px; }

#input-area { padding: 20px; border-top: 1px solid #e2e8f0; background: white; }
#button-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
#loading-indicator { text-align: center; font-size: 0.8rem; color: #94a3b8; margin-top: 10px; }

button { padding: 10px 16px; border: 1px solid #e2e8f0; background: white; border-radius: 20px; font-size: 0.9rem; cursor: pointer; transition: all 0.2s; color: #475569; font-weight: 500; }
button:hover { background: #f8fafc; transform: translateY(-1px); border-color: #cbd5e1; }
button:active { transform: translateY(1px); }
button.primary { background: var(--primary); color: white; border-color: var(--primary); }
button.secondary { background: #f1f5f9; color: #64748b; font-size: 0.8rem; }
.hidden { display: none; }
@keyframes popIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* ... (Keep previous generic styles) ... */

/* AI Thinking Animation */
.thinking-bubble {
    background: #f1f5f9;
    padding: 12px 20px;
    border-radius: 20px;
    border-bottom-left-radius: 2px;
    align-self: flex-start;
    display: flex;
    gap: 4px;
    width: fit-content;
    margin-bottom: 10px;
}

.dot {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Typewriter Cursor Effect */
.cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: #333;
    animation: blink 1s step-end infinite;
    vertical-align: text-bottom;
}

@keyframes blink { 50% { opacity: 0; } }