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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 16px;
}

header {
    text-align: center;
    padding: 8px 0;
    position: relative;
}

header h1 { font-size: 1.3rem; margin-bottom: 8px; }

/* Tabs */
.tabs { display: flex; gap: 4px; justify-content: center; margin-bottom: 4px; }
.tab {
    padding: 8px 20px; border: none; border-radius: 8px 8px 0 0;
    background: #1e293b; color: #94a3b8; cursor: pointer;
    font-size: 0.9rem; font-weight: 600; transition: all 0.2s;
}
.tab.active { background: #334155; color: #e2e8f0; }
.tab:hover { color: #e2e8f0; }

.tab-content { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.tab-content.active { display: flex; }

/* Auth */
.loading {
    display: flex; justify-content: center; align-items: center;
    height: 100vh; color: #94a3b8; font-size: 1.1rem;
}

.btn-logout {
    position: absolute; top: 8px; right: 0;
    background: transparent; color: #94a3b8; font-size: 0.9rem;
    padding: 6px 10px; border: 1px solid #334155; border-radius: 6px; cursor: pointer;
}
.btn-logout:hover { color: #ef4444; border-color: #ef4444; }

/* Chat box */
.chat-box {
    flex: 1; overflow-y: auto; padding: 12px; background: #1e293b;
    border-radius: 12px; margin: 8px 0; display: flex;
    flex-direction: column; gap: 12px;
}
.welcome-msg { text-align: center; color: #94a3b8; padding: 40px 20px; line-height: 1.6; }

/* Messages */
.msg { max-width: 85%; padding: 10px 14px; border-radius: 12px; line-height: 1.5; font-size: 0.95rem; }
.msg-bot { align-self: flex-start; background: #334155; border-bottom-left-radius: 4px; }
.msg-user { align-self: flex-end; background: #1d4ed8; border-bottom-right-radius: 4px; }
.msg-correction { align-self: flex-start; background: #7c3aed22; border-left: 3px solid #7c3aed; font-size: 0.85rem; color: #c4b5fd; }
.msg-tip { align-self: flex-start; background: #065f4622; border-left: 3px solid #10b981; font-size: 0.85rem; color: #6ee7b7; }
.msg-translation { align-self: flex-start; background: #1e3a5f22; border-left: 3px solid #60a5fa; font-size: 0.85rem; color: #93c5fd; margin-top: -8px; }
.msg-system { align-self: center; background: transparent; color: #64748b; font-size: 0.8rem; font-style: italic; }

/* Controls */
.controls { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.btn { padding: 12px 20px; border: none; border-radius: 10px; font-size: 1rem; cursor: pointer; font-weight: 600; transition: all 0.2s; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-start { background: #10b981; color: white; }
.btn-start:hover:not(:disabled) { background: #059669; }
.btn-mic { background: #1e293b; color: #e2e8f0; border: 2px solid #334155; }
.btn-mic:hover:not(:disabled) { border-color: #ef4444; }
.btn-mic.recording { background: #ef4444; color: white; border-color: #ef4444; animation: pulse 1s infinite; }
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}
.text-input { display: flex; gap: 8px; }
.text-input input { flex: 1; padding: 10px 14px; border-radius: 10px; border: 2px solid #334155; background: #1e293b; color: #e2e8f0; font-size: 0.95rem; }
.text-input input:focus { outline: none; border-color: #3b82f6; }
.text-input button { padding: 10px 16px; border-radius: 10px; border: none; background: #3b82f6; color: white; font-size: 1rem; cursor: pointer; }
.text-input button:hover { background: #2563eb; }
.chat-box::-webkit-scrollbar { width: 6px; }
.chat-box::-webkit-scrollbar-track { background: transparent; }
.chat-box::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }

/* ==================== VOCAB TAB ==================== */
.vocab-header { padding: 8px 0; }
.vocab-progress { text-align: center; }
.progress-bar {
    width: 100%; height: 12px; background: #1e293b; border-radius: 6px;
    overflow: hidden; margin-bottom: 6px;
}
.progress-fill {
    height: 100%; background: linear-gradient(90deg, #10b981, #3b82f6);
    border-radius: 6px; transition: width 0.5s ease; width: 0%;
}
#progress-text { font-size: 0.85rem; color: #94a3b8; }

.vocab-cards {
    flex: 1; overflow-y: auto; display: flex; flex-direction: column;
    gap: 10px; padding: 8px 0;
}
.vocab-loading { text-align: center; color: #94a3b8; padding: 40px; }

.vocab-card {
    background: #1e293b; border-radius: 12px; padding: 16px;
    border: 2px solid #334155; transition: all 0.3s;
}
.vocab-card.learned { border-color: #10b981; opacity: 0.6; }
.vocab-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.vocab-word { font-size: 1.3rem; font-weight: 700; color: #f1f5f9; }
.vocab-article { font-size: 0.85rem; color: #60a5fa; margin-left: 8px; }
.vocab-translation { font-size: 1rem; color: #94a3b8; margin-bottom: 8px; }
.vocab-example { font-size: 0.85rem; color: #64748b; font-style: italic; line-height: 1.4; margin-bottom: 8px; }
.vocab-example-en { font-size: 0.8rem; color: #475569; margin-bottom: 8px; }
.vocab-actions { display: flex; gap: 8px; }
.vocab-btn {
    padding: 8px 14px; border: none; border-radius: 8px;
    font-size: 0.85rem; cursor: pointer; font-weight: 600; transition: all 0.2s;
}
.vocab-btn-listen { background: #1d4ed8; color: white; }
.vocab-btn-listen:hover { background: #2563eb; }
.vocab-btn-listen:disabled { opacity: 0.5; cursor: wait; }
.vocab-btn-learned { background: #334155; color: #94a3b8; }
.vocab-btn-learned:hover { background: #10b981; color: white; }
.vocab-btn-learned.done { background: #10b981; color: white; pointer-events: none; }
.vocab-controls { padding: 8px 0; display: flex; gap: 8px; }
.vocab-controls .btn { flex: 1; font-size: 0.9rem; padding: 10px; }
