:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }

#app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: 220px; background: var(--bg-card); border-right: 1px solid var(--border); padding: 24px 16px; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 10; }
.logo { font-size: 20px; font-weight: 700; margin-bottom: 32px; color: var(--primary); }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px; color: var(--text-secondary); text-decoration: none; font-size: 15px; transition: all .2s; cursor: pointer; }
.nav-item:hover { background: #f1f5f9; color: var(--text); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item span { font-size: 18px; }
.sidebar-footer { font-size: 13px; color: var(--text-secondary); padding-top: 16px; border-top: 1px solid var(--border); }

/* Main */
.main { flex: 1; margin-left: 220px; padding: 32px 40px; max-width: 960px; }
.view { display: none; animation: fadeIn .3s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.view-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.view-header h1 { font-size: 24px; }

/* Dashboard */
.dash-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 20px; }
.dashboard-header { flex: 1; }
.dashboard-header h1 { font-size: 28px; font-weight: 700; }
.subtitle { color: var(--text-secondary); font-size: 16px; margin-top: 4px; }

/* Streak */
.streak-box { display: flex; align-items: center; gap: 10px; background: linear-gradient(135deg, #fff7ed, #ffedd5); border: 1px solid #fed7aa; border-radius: var(--radius); padding: 12px 20px; min-width: 140px; }
.streak-fire { font-size: 28px; }
.streak-num { font-size: 32px; font-weight: 800; color: #ea580c; }
.streak-label { font-size: 13px; color: #9a3412; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); border-radius: var(--radius); padding: 20px; text-align: center; box-shadow: var(--shadow); border: 1px solid var(--border); }
.stat-value { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

/* Chart */
.chart-section { margin-bottom: 24px; }
.chart-section h2 { font-size: 16px; margin-bottom: 12px; color: var(--text); }
.chart-container { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; height: 140px; position: relative; }
.chart-empty { font-size: 14px; color: var(--text-secondary); text-align: center; padding: 20px; }

.btn-large { display: block; width: 100%; padding: 16px; font-size: 18px; margin-bottom: 32px; }

.recent-section h2 { font-size: 18px; margin-bottom: 12px; }
.recent-list { display: flex; flex-direction: column; gap: 8px; }

.recent-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: all .2s; box-shadow: var(--shadow); }
.recent-item:hover { border-color: var(--primary-light); box-shadow: var(--shadow-lg); }
.recent-item .ri-title { font-weight: 600; margin-bottom: 4px; }
.recent-item .ri-meta { display: flex; gap: 16px; font-size: 13px; color: var(--text-secondary); }
.recent-item .ri-score { margin-left: auto; font-weight: 700; color: var(--primary); }

/* Buttons */
.btn-primary { background: var(--primary); color: #fff; border: none; padding: 12px 24px; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; transition: all .2s; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); padding: 12px 24px; border-radius: 8px; font-size: 15px; cursor: pointer; transition: all .2s; }
.btn-secondary:hover { background: #f1f5f9; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-success { background: var(--success); color: #fff; border: none; padding: 12px 24px; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; transition: all .2s; }

/* Task Card */
.task-card { background: linear-gradient(135deg, #f0f4ff, #faf5ff); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; }
.task-card h2 { font-size: 20px; color: var(--primary-dark); margin-bottom: 12px; }
.task-instruction { font-size: 15px; color: var(--text); margin-bottom: 12px; line-height: 1.8; }
.task-requirements { margin-bottom: 12px; }
.task-requirements li { font-size: 14px; color: var(--text-secondary); margin: 4px 0; margin-left: 18px; }
.task-tips { background: rgba(99,102,241,.08); border-radius: 8px; padding: 12px 16px; margin-bottom: 12px; }
.task-tips p { font-size: 13px; color: var(--primary); margin: 2px 0; }
.task-meta { display: flex; gap: 20px; font-size: 13px; color: var(--text-secondary); }

/* Editor */
.editor-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.editor-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.editor-header label { font-weight: 600; font-size: 15px; }
.editor-header-right { display: flex; align-items: center; gap: 16px; }
.word-count { font-size: 13px; color: var(--text-secondary); }
.save-status { font-size: 12px; color: var(--text-secondary); min-width: 50px; text-align: right; }
.save-status.saved { color: var(--success); }
.save-status.saving { color: var(--warning); }

/* Goal bar */
.goal-bar { height: 4px; background: #e2e8f0; border-radius: 2px; margin-bottom: 12px; overflow: hidden; }
.goal-fill { height: 100%; background: linear-gradient(90deg, var(--primary-light), var(--primary)); border-radius: 2px; transition: width .4s ease; width: 0%; }
.goal-fill.over { background: linear-gradient(90deg, var(--success), #16a34a); }

/* Draft notice */
.draft-notice { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #f0f4ff; border: 1px solid #c7d2fe; border-radius: 6px; font-size: 13px; color: var(--primary-dark); margin-bottom: 12px; }
.draft-discard { margin-left: auto; background: none; border: none; color: var(--text-secondary); font-size: 12px; cursor: pointer; text-decoration: underline; padding: 2px 6px; }
.draft-discard:hover { color: var(--danger); }

#essayInput { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 14px; font-size: 15px; line-height: 1.8; resize: vertical; font-family: inherit; transition: border-color .2s; }
#essayInput:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
#essayInput.goal-met { border-color: var(--success); }
#essayInput.goal-met:focus { box-shadow: 0 0 0 3px rgba(34,197,94,.1); }
.editor-actions { display: flex; gap: 12px; margin-top: 12px; justify-content: flex-end; }

/* Review */
.review-overall { text-align: center; padding: 24px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 20px; }
.review-score { font-size: 56px; font-weight: 700; color: var(--primary); }
.review-score-label { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.review-bar { height: 8px; background: #e2e8f0; border-radius: 4px; margin-top: 12px; overflow: hidden; max-width: 400px; margin-left: auto; margin-right: auto; }
.review-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light)); border-radius: 4px; transition: width .6s ease; }
.assist-usage-row { text-align: center; padding: 10px 20px; margin: -12px auto 18px; font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.assist-badge { display: inline-flex; align-items: center; gap: 3px; background: #f1f5f9; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; color: var(--text-primary); }

.review-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 20px; }
.review-dimension { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.dim-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.dim-name { font-weight: 600; font-size: 14px; }
.dim-score { font-weight: 700; color: var(--primary); }
.dim-feedback { font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.6; }
.dim-suggestions { list-style: none; }
.dim-suggestions li { font-size: 13px; color: var(--text); padding: 4px 0 4px 16px; position: relative; }
.dim-suggestions li::before { content: '💡'; position: absolute; left: -4px; }

.review-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.review-section h3 { font-size: 16px; margin-bottom: 10px; color: var(--primary-dark); }
.strength-list li { color: var(--success); padding: 3px 0; }
.weakness-list li { color: var(--warning); padding: 3px 0; }

.general-feedback { font-size: 15px; line-height: 1.8; color: var(--text); }

.model-essay { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 16px; white-space: pre-wrap; font-size: 14px; line-height: 1.8; margin-top: 8px; }

.revise-section { margin-top: 20px; padding: 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.revise-section h3 { margin-bottom: 12px; }
.revise-section textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 14px; font-size: 15px; line-height: 1.8; resize: vertical; font-family: inherit; }
.revise-section textarea:focus { outline: none; border-color: var(--primary); }

/* History */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: all .2s; }
.history-item:hover { border-color: var(--primary-light); box-shadow: var(--shadow-lg); }
.hi-title { font-weight: 600; }
.hi-meta { display: flex; gap: 16px; font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.hi-score { margin-left: auto; font-weight: 700; }
.hi-improved { color: var(--success); margin-left: auto; font-size: 13px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state p { font-size: 16px; margin-bottom: 16px; }

/* Settings */
.settings-form { max-width: 480px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-group input, .form-group select { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; transition: border-color .2s; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.form-hint { font-size: 12px; color: #94a3b8; margin-top: 4px; }

.model-select-row { display: flex; gap: 8px; }
.model-select-row select { flex: 1; }
.model-select-row button { white-space: nowrap; }
.form-divider { height: 1px; background: var(--border); margin: 20px 0; }

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--text-secondary); font-size: 15px; }
.loading::before { content: ''; display: block; width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Utilities */
.hidden { display: none !important; }

/* Rewrite badge */
.revision-badge { font-size: 12px; background: #e0e7ff; color: var(--primary-dark); padding: 2px 8px; border-radius: 4px; }

/* Score colors */
.score-high { color: var(--success) !important; }
.score-mid { color: var(--warning) !important; }
.score-low { color: var(--danger) !important; }

/* ====== AI Assistant Features ====== */

/* Toolbar */
.assist-toolbar { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.assist-btn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-card); color: var(--text-secondary); font-size: 13px; cursor: pointer; transition: all .2s; font-family: inherit; }
.assist-btn:hover { border-color: var(--primary-light); color: var(--primary); background: #f0f4ff; }
.assist-btn .ab-icon { font-size: 15px; }

/* Popups */
.assist-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 100; animation: fadeIn .15s ease; }
.assist-popup { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); background: var(--bg-card); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.15); z-index: 110; width: 480px; max-width: calc(100vw - 40px); max-height: calc(100vh - 80px); overflow-y: auto; animation: popIn .2s ease; }
@keyframes popIn { from { opacity: 0; transform: translate(-50%,-50%) scale(.95); } to { opacity: 1; transform: translate(-50%,-50%) scale(1); } }
.popup-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 15px; }
.popup-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-secondary); padding: 4px 8px; border-radius: 4px; }
.popup-close:hover { background: #f1f5f9; color: var(--text); }
.popup-body { padding: 16px 20px 20px; }
.popup-loading { text-align: center; padding: 20px; color: var(--text-secondary); font-size: 14px; }
.popup-loading::after { content: ''; display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin-left: 8px; vertical-align: middle; }

/* Vocab word cards */
.vocab-list { display: flex; flex-direction: column; gap: 10px; }
.vocab-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; transition: all .2s; }
.vocab-item:hover { border-color: var(--primary); background: #f0f4ff; }
.vocab-item:active { transform: scale(.98); }
.vi-word { font-size: 18px; font-weight: 700; color: var(--primary-dark); white-space: nowrap; }
.vi-difficulty { font-size: 12px; margin-left: 6px; }
.vi-pos { font-size: 12px; color: var(--text-secondary); background: #f1f5f9; padding: 1px 6px; border-radius: 3px; }
.vi-meaning { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.vi-example { font-size: 12px; color: #94a3b8; margin-top: 2px; font-style: italic; }
.vi-hint { font-size: 11px; color: var(--primary); margin-top: 2px; }

/* Sentence analysis results */
.sentence-result { margin-bottom: 12px; }
.sr-original { padding: 10px 14px; background: #fef9c3; border-radius: 6px; font-size: 14px; margin-bottom: 8px; border-left: 3px solid var(--warning); }
.sr-analysis { font-size: 14px; color: var(--text); margin-bottom: 8px; }
.sr-hint { font-size: 14px; color: var(--primary); font-weight: 600; margin-bottom: 8px; }
.sr-revised { padding: 10px 14px; background: #f0fdf4; border-radius: 6px; font-size: 14px; margin-bottom: 8px; border-left: 3px solid var(--success); }
.sr-good { padding: 10px 14px; background: #f0fdf4; border-radius: 6px; color: var(--success); font-size: 14px; }
.sr-apply { margin-top: 4px; font-size: 12px; }

/* Continuation cards */
.cont-list { display: flex; flex-direction: column; gap: 12px; }
.cont-item { padding: 14px; border: 1px solid var(--border); border-radius: 8px; transition: all .2s; }
.cont-item:hover { border-color: var(--primary-light); }
.ci-direction { font-size: 14px; font-weight: 600; color: var(--primary-dark); margin-bottom: 6px; }
.ci-opening { font-size: 14px; line-height: 1.7; color: var(--text); padding: 8px 12px; background: #f8fafc; border-radius: 6px; margin-bottom: 6px; cursor: pointer; }
.ci-opening:hover { background: #f0f4ff; }
.ci-advice { font-size: 13px; color: var(--text-secondary); }

/* Sentence highlight markers in textarea */
.sentence-markers { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.s-marker { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; background: #fef9c3; border: 1px solid #fde68a; border-radius: 4px; font-size: 12px; cursor: pointer; transition: all .2s; }
.s-marker:hover { background: #fef08a; }
.s-marker .sm-num { font-weight: 700; color: #92400e; }
.s-marker .sm-text { color: #92400e; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Editor hint text */
.editor-hint { font-size: 12px; color: #94a3b8; margin-top: 6px; }

/* ====== Loading Animation ====== */
.loading-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; z-index: 200; backdrop-filter: blur(4px); animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.loading-card { background: #fff; border-radius: 20px; padding: 40px 48px; text-align: center; box-shadow: 0 16px 48px rgba(0,0,0,.15); animation: popIn .35s cubic-bezier(.34,1.56,.64,1); min-width: 240px; }
@keyframes popIn { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.loading-icon { font-size: 48px; animation: bounce 1s ease infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0) rotate(0deg); } 25% { transform: translateY(-10px) rotate(-8deg); } 75% { transform: translateY(-10px) rotate(8deg); } }
.loading-title { font-size: 18px; font-weight: 700; color: var(--text-primary); margin: 12px 0 6px; }
.loading-status { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; min-height: 20px; }
.loading-dots { display: inline; }
.loading-dots::after { content: ''; }
.loading-bar-track { height: 4px; background: #e2e8f0; border-radius: 2px; overflow: hidden; }
.loading-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #a78bfa); border-radius: 2px; animation: loadingBar 4s ease-in-out infinite; }
@keyframes loadingBar { 0% { width: 5%; } 50% { width: 70%; } 100% { width: 95%; } }

/* ====== Toast Notifications ====== */
.toast-container { position: fixed; top: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { padding: 14px 20px; border-radius: 10px; font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.12); animation: toastIn .35s ease, toastOut .4s ease 2.6s forwards; pointer-events: auto; max-width: 320px; }
.toast-success { background: linear-gradient(135deg, #dcfce7, #bbf7d0); color: #166534; border: 1px solid #86efac; }
.toast-info { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #1e40af; border: 1px solid #93c5fd; }
.toast-warn { background: linear-gradient(135deg, #fef9c3, #fef08a); color: #854d0e; border: 1px solid #fde047; }
@keyframes toastIn { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-10px); } }

/* ====== Confetti ====== */
.confetti-container { position: fixed; inset: 0; pointer-events: none; z-index: 190; overflow: hidden; }
.confetti-piece { position: absolute; width: 10px; height: 10px; top: -20px; animation: confettiFall 2.5s ease-in forwards; }
@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ====== Goal Met Pulse ====== */
.goal-reached { animation: goalPulse .6s ease; }
@keyframes goalPulse { 0% { transform: scale(1); } 50% { transform: scale(1.02); } 100% { transform: scale(1); } }

/* ====== Score Animations ====== */
.score-animate { animation: scorePop .5s cubic-bezier(.34,1.56,.64,1); }
@keyframes scorePop { 0% { transform: scale(.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ====== Improvement Badge ====== */
.improve-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.improve-badge.positive { background: #dcfce7; color: #166534; }
.improve-badge.negative { background: #fee2e2; color: #991b1b; }
.improve-badge.neutral { background: #f1f5f9; color: #64748b; }

@media (max-width: 768px) {
    .sidebar { width: 60px; padding: 16px 8px; }
    .sidebar .logo, .sidebar .nav-item span:not(:first-child), .sidebar-footer { display: none; }
    .nav-item { justify-content: center; padding: 10px; }
    .nav-item span { margin: 0; }
    .main { margin-left: 60px; padding: 20px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .review-grid { grid-template-columns: 1fr; }
}

/* Comparison */
.comparison-section { margin-top: 20px; }
.comparison-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.comparison-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.comparison-card h4 { font-size: 14px; margin-bottom: 8px; color: var(--text-secondary); }
.comparison-score { font-size: 28px; font-weight: 700; }

/* ====== Analytics View ====== */
.analytics-content { max-width: 680px; }
.stats-overview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.analytics-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.analytics-section h3 { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: var(--text-primary); }
.dim-bars { display: flex; flex-direction: column; gap: 10px; }
.dim-bar-row { display: flex; align-items: center; gap: 10px; }
.dim-label { width: 42px; font-size: 13px; color: var(--text-secondary); text-align: right; flex-shrink: 0; }
.dim-bar-track { flex: 1; height: 10px; background: #f1f5f9; border-radius: 5px; overflow: hidden; }
.dim-bar-fill { height: 100%; border-radius: 5px; transition: width .6s ease; }
.dim-val { width: 30px; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.trend-chart { width: 100%; height: auto; }
@media (max-width: 768px) { .stats-overview { grid-template-columns: repeat(2, 1fr); } }

/* ====== Annotated Essay ====== */
.annotated-essay { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.annot-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.annot-header h3 { font-size: 15px; font-weight: 600; margin: 0; }
.annot-legend { display: flex; gap: 12px; font-size: 12px; color: var(--text-secondary); }
.annot-legend-item { display: flex; align-items: center; gap: 4px; }
.annot-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.annot-body { line-height: 2; font-size: 15px; color: var(--text-primary); }
.annot-body p { margin: 0; }
.annot-highlight { padding: 2px 4px; border-radius: 3px; cursor: pointer; position: relative; background: var(--annot-bg); border-bottom: 2px solid var(--annot-color); transition: all .15s; }
.annot-highlight:hover { filter: brightness(.95); }
.annot-popup { position: fixed; width: 300px; background: #fff; border: 1px solid #e2e8f0; border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 1000; padding: 0; font-size: 14px; }
.annot-popup-header { padding: 10px 14px; font-weight: 600; font-size: 13px; border-bottom: 1px solid #f1f5f9; }
.annot-popup-body { padding: 10px 14px; }
.annot-popup-row { margin-bottom: 8px; font-size: 13px; line-height: 1.5; color: var(--text-primary); }
.annot-popup-row:last-child { margin-bottom: 0; }
.annot-popup-row strong { color: var(--text-secondary); font-size: 12px; }

/* ====== Badges ====== */
.badge-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.badge-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 12px; border-radius: var(--radius); background: #f0fdf4; border: 1px solid #bbf7d0; min-width: 70px; transition: transform .2s; }
.badge-item:hover { transform: scale(1.05); }
.badge-item.locked { background: #f8fafc; border-color: #e2e8f0; opacity: .45; }
.badge-icon { font-size: 24px; }
.badge-name { font-size: 11px; font-weight: 600; color: var(--text-primary); }
.badge-item.locked .badge-name { color: var(--text-secondary); }

/* ====== Vocab Notebook ====== */
.vocab-list { display: flex; flex-direction: column; gap: 6px; }
.vocab-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.vocab-word { font-weight: 700; font-size: 14px; color: var(--primary); min-width: 80px; }
.vocab-meaning { flex: 1; font-size: 13px; color: var(--text-secondary); }
.vocab-del { background: none; border: none; color: #94a3b8; cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 4px; }
.vocab-del:hover { background: #fee2e2; color: #dc2626; }
.empty-vocab { font-size: 13px; color: var(--text-secondary); text-align: center; padding: 12px; }

/* Button disabled */
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-success:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
