body { margin: 0; font-family: 'Segoe UI', Arial, sans-serif; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #1e293b; min-height: 100vh; }
.shell { max-width: 1100px; margin: 0 auto; padding: 18px; }
.auth-card { max-width: 420px; margin: 60px auto; background: #fff; border: none; border-radius: 16px; padding: 32px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.auth-card h2 { color: #6366f1; margin-top: 0; }
.auth-card form { display: grid; gap: 14px; margin-top: 16px; }
input, textarea, button { font: inherit; }
input, textarea { width: 100%; padding: 12px; border-radius: 10px; border: 2px solid #e2e8f0; box-sizing: border-box; transition: all 0.3s; }
input:focus, textarea:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
button { padding: 12px 20px; border: none; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border-radius: 10px; cursor: pointer; font-weight: 600; transition: all 0.3s; box-shadow: 0 4px 15px rgba(102,126,234,0.4); }
button:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(102,126,234,0.6); }
button.secondary { background: white; color: #6366f1; border: 2px solid #6366f1; box-shadow: none; }
button.secondary:hover { background: #f0f4ff; }
.links { margin-top: 14px; display: flex; gap: 14px; }
.links a { color: #6366f1; text-decoration: none; }
.links a:hover { text-decoration: underline; }
.error { margin-top: 8px; color: #dc2626; background: #fee2e2; padding: 10px; border-radius: 8px; }
.ok { margin-top: 8px; color: #059669; background: #d1fae5; padding: 10px; border-radius: 8px; }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding: 8px 0; }
.topbar h1 { color: white; margin: 0; font-size: 28px; font-weight: 600; text-shadow: 0 2px 8px rgba(0,0,0,0.2); flex: 1; }
.topbar h1:before { content: '📚 '; font-size: 30px; margin-right: 8px; }
.topbar-buttons { display: flex; align-items: center; gap: 10px; }
.view-btn { padding: 10px 16px; font-size: 13px; font-weight: 600; background: rgba(255,255,255,0.2); color: white; border: 2px solid rgba(255,255,255,0.3); border-radius: 8px; cursor: pointer; transition: all 0.3s; backdrop-filter: blur(10px); }
.view-btn:hover { background: rgba(255,255,255,0.3); border-color: rgba(255,255,255,0.5); }
.logout-btn { color: white; background: rgba(255,255,255,0.2); padding: 10px 20px; border-radius: 10px; text-decoration: none; font-weight: 600; backdrop-filter: blur(10px); transition: all 0.3s; border: none; cursor: pointer; font-size: 14px; }
.logout-btn:hover { background: rgba(255,255,255,0.3); }
.panel { background: white; border: none; border-radius: 16px; padding: 24px; margin-top: 16px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); }
.panel h2 { color: #6366f1; margin-top: 0; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.panel h2:before { content: '📚'; font-size: 24px; }
.tabs, .mode-row { display: flex; flex-wrap: wrap; gap: 10px; }
.mode-row.right { justify-content: flex-end; margin-top: 12px; }
.content-grid { display: grid; grid-template-columns: 300px 1fr; gap: 16px; margin-top: 16px; }
.topic-list { display: grid; gap: 10px; }
.topic-btn { text-align: left; background: #f8fafc; color: #475569; border: 2px solid #e2e8f0; transition: all 0.3s; font-weight: 500; }
.topic-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }
.topic-btn.active { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; border-color: transparent; box-shadow: 0 4px 15px rgba(102,126,234,0.4); }
.topic-content { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); border-radius: 12px; padding: 20px; border: none; box-shadow: inset 0 2px 8px rgba(0,0,0,0.1); }
.topic-content h3 { color: #92400e; margin-top: 0; }
.topic-content ul { color: #78350f; line-height: 1.8; }
.topic-content p { color: #78350f; line-height: 1.7; }

/* Subject-specific topic content colors */
body.subject-methods .topic-content { background: linear-gradient(135deg, #e0e7ff 0%, #ddd6fe 100%); }
body.subject-methods .topic-content h3, body.subject-methods .topic-content ul, body.subject-methods .topic-content p { color: #3730a3; }
body.subject-physics .topic-content { background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%); }
body.subject-physics .topic-content h3, body.subject-physics .topic-content ul, body.subject-physics .topic-content p { color: #831843; }
body.subject-economics .topic-content { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); }
body.subject-economics .topic-content h3, body.subject-economics .topic-content ul, body.subject-economics .topic-content p { color: #92400e; }

.question-card { border: 2px solid #e0e7ff; border-radius: 12px; padding: 18px; margin-top: 14px; background: linear-gradient(to bottom, #ffffff 0%, #f8faff 100%); box-shadow: 0 2px 10px rgba(99,102,241,0.1); transition: all 0.3s; }
.question-card:hover { box-shadow: 0 4px 20px rgba(99,102,241,0.2); border-color: #c7d2fe; }
.question-card .question-header { font-size: 16px; font-weight: 600; color: #4338ca; margin-bottom: 8px; }
.question-card .difficulty { font-size: 12px; color: #7c3aed; background: #ede9fe; padding: 4px 12px; border-radius: 20px; display: inline-block; margin-bottom: 12px; font-weight: 600; }
.mcq-option { display: flex; align-items: center; gap: 12px; padding: 14px; margin: 8px 0; background: white; border: 2px solid #e2e8f0; border-radius: 10px; cursor: pointer; transition: all 0.3s; }
.mcq-option:hover { background: #f8fafc; border-color: #cbd5e1; }
.mcq-option.selected { background: linear-gradient(135deg, #ddd6fe 0%, #c7d2fe 100%); border-color: #6366f1; box-shadow: 0 2px 10px rgba(99,102,241,0.2); }
.mcq-option .option-label { font-size: 16px; font-weight: 700; color: white; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mcq-option.selected .option-label { background: linear-gradient(135deg, #4f46e5 0%, #6d28d9 100%); box-shadow: 0 4px 12px rgba(79,70,229,0.4); }

/* Subject-specific MCQ colors */
body.subject-methods .mcq-option.selected { background: linear-gradient(135deg, #ddd6fe 0%, #c7d2fe 100%); border-color: #6366f1; }
body.subject-methods .mcq-option .option-label { background: linear-gradient(135deg, #667eea 0%, #4f46e5 100%); }
body.subject-physics .mcq-option.selected { background: linear-gradient(135deg, #fbcfe8 0%, #f9a8d4 100%); border-color: #ec4899; }
body.subject-physics .mcq-option .option-label { background: linear-gradient(135deg, #ec4899 0%, #db2777 100%); }
body.subject-economics .mcq-option.selected { background: linear-gradient(135deg, #fef08a 0%, #fde047 100%); border-color: #f59e0b; }
body.subject-economics .mcq-option .option-label { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.mcq-option .option-text { flex: 1; color: #334155; font-weight: 500; }
.mcq-option input[type=radio] { display: none; }
.feedback { margin-top: 12px; padding: 14px; border-radius: 10px; font-size: 14px; font-weight: 500; }
.feedback.ok { background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%); color: #065f46; border: 2px solid #34d399; }
.feedback.bad { background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%); color: #991b1b; border: 2px solid #f87171; }
.feedback:before { font-size: 18px; margin-right: 8px; }
.feedback.ok:before { content: '✅'; }
.feedback.bad:before { content: '❌'; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 14px; }
.insight-card { border: none; border-radius: 12px; padding: 16px; background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); box-shadow: 0 4px 15px rgba(0,0,0,0.1); transition: all 0.3s; }
.insight-card:hover { transform: translateY(-4px); box-shadow: 0 8px 25px rgba(0,0,0,0.15); }
.insight-card h4 { color: #92400e; margin: 8px 0; }
.insight-card p { color: #78350f; line-height: 1.6; }
.insight-card small { color: #a16207; font-weight: 600; }
.insight-card a { color: #b45309; font-weight: 600; text-decoration: none; }
.insight-card a:hover { text-decoration: underline; }

/* Outcomes Box Styling */
.outcomes-section { margin-bottom: 16px; }
.outcome-btn { padding: 10px 12px; font-size: 12px; border-radius: 8px; border: 2px solid #e2e8f0; background: white; color: #475569; cursor: pointer; transition: all 0.2s; font-weight: 500; }
.outcome-btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.outcome-btn.active { background: #6366f1; color: white; border-color: #6366f1; box-shadow: 0 2px 8px rgba(99,102,241,0.3); }

/* Subject-specific outcome button colors */
body.subject-methods .outcome-btn.active { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); border-color: #4f46e5; }
body.subject-physics .outcome-btn.active { background: linear-gradient(135deg, #ec4899 0%, #db2777 100%); border-color: #db2777; }
body.subject-economics .outcome-btn.active { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); border-color: #d97706; }
.bar-wrap { margin-top: 10px; }
.bar { height: 16px; background: linear-gradient(90deg, #667eea 0%, #764ba2 100%); border-radius: 10px; box-shadow: 0 2px 8px rgba(102,126,234,0.3); }

/* ── Impersonate banner ────────────────────────── */
.impersonate-banner { background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%); color: #78350f; padding: 12px 20px; border-radius: 12px; margin-bottom: 10px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.impersonate-banner button { background: #78350f; color: white; padding: 6px 16px; border-radius: 8px; border: none; cursor: pointer; font-weight: 600; }

/* ── Rewards banner ────────────────────────────── */
.rewards-banner { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important; }
.reward-tier { padding: 8px 14px; background: white; border-radius: 8px; font-size: 13px; font-weight: 600; color: #92400e; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.total-earned { font-size: 22px; font-weight: 700; color: #059669; background: white; padding: 10px 20px; border-radius: 12px; box-shadow: 0 4px 15px rgba(5,150,105,0.2); }

/* ── Badges grid ───────────────────────────────── */
.badges-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px; margin-top: 12px; }
.badge-card { text-align: center; padding: 16px 8px; border-radius: 12px; border: 2px solid #e2e8f0; transition: all 0.3s; }
.badge-card.earned { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); border-color: #f59e0b; box-shadow: 0 4px 15px rgba(245,158,11,0.3); }
.badge-card.locked { background: #f1f5f9; opacity: 0.5; }
.badge-icon { font-size: 32px; margin-bottom: 6px; }
.badge-label { font-size: 11px; font-weight: 600; color: #475569; }

/* ── Badge / Reward toast ──────────────────────── */
.badge-toast { position: fixed; bottom: -80px; right: 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 16px 24px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,0.3); font-size: 15px; display: flex; align-items: center; gap: 12px; transition: bottom 0.4s ease; z-index: 9999; }
.badge-toast.show { bottom: 20px; }
.badge-toast.reward-toast { background: linear-gradient(135deg, #059669 0%, #047857 100%); }

/* ── Scope row ─────────────────────────────────── */
.scope-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scope-btn { padding: 8px 16px; font-size: 13px; border-radius: 8px; border: 2px solid #e2e8f0; background: white; color: #475569; cursor: pointer; font-weight: 600; transition: all 0.2s; }
.scope-btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.scope-btn.active { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); color: white; border-color: #4f46e5; box-shadow: 0 2px 8px rgba(99,102,241,0.3); }

/* ── Voice button ──────────────────────────────── */
.voice-btn { padding: 10px 18px; font-size: 14px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.voice-btn.secondary { background: white; color: #dc2626; border: 2px solid #dc2626; box-shadow: none; }

/* ── Subject avg cards ─────────────────────────── */
.subject-avg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.subject-avg-card { text-align: center; padding: 20px; border-radius: 12px; background: linear-gradient(to bottom, #ffffff 0%, #f8faff 100%); border: 2px solid #e0e7ff; box-shadow: 0 2px 10px rgba(99,102,241,0.1); }

/* ── Examples grid ─────────────────────────────── */
.examples-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-top: 12px; }
.example-card { padding: 18px; border-radius: 12px; background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%); border: 2px solid #a7f3d0; box-shadow: 0 2px 10px rgba(5,150,105,0.1); transition: all 0.3s; }
.example-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(5,150,105,0.2); }

/* ── AI Analysis ───────────────────────────────── */
.analysis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.analysis-col h3 { margin-top: 0; }
.analysis-item { padding: 12px; border-radius: 10px; margin-bottom: 8px; }
.analysis-item.weak { background: #fef2f2; border-left: 4px solid #dc2626; }
.analysis-item.strong { background: #f0fdf4; border-left: 4px solid #059669; }

@media (max-width: 860px) {
  .content-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; gap: 10px; text-align: center; }
  .analysis-grid { grid-template-columns: 1fr; }
  .examples-grid { grid-template-columns: 1fr; }
}
