/* ========================================
   QUIZ APP — NGÀNH THUẾ
   Mobile-first, Dark/Light theme
   ======================================== */

:root {
  /* Dark theme (default) */
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #1e2130;
  --bg-hover: #252839;
  --bg-input: #252839;
  --text-primary: #e8eaf0;
  --text-secondary: #9ca3b4;
  --text-muted: #6b7280;
  --accent: #22d3a7;
  --accent-hover: #1ab892;
  --accent-glow: rgba(34, 211, 167, 0.15);
  --accent-soft: rgba(34, 211, 167, 0.08);
  --correct: #22c55e;
  --correct-bg: rgba(34, 197, 94, 0.12);
  --wrong: #ef4444;
  --wrong-bg: rgba(239, 68, 68, 0.12);
  --border: #2a2d3a;
  --border-light: #353849;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 0.2s ease;
}

[data-theme="light"] {
  --bg-primary: #f5f6fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f0f1f5;
  --bg-input: #f0f1f5;
  --text-primary: #1a1d27;
  --text-secondary: #5a6070;
  --text-muted: #9ca3b4;
  --accent: #0d9e7a;
  --accent-hover: #0b8568;
  --accent-glow: rgba(13, 158, 122, 0.12);
  --accent-soft: rgba(13, 158, 122, 0.06);
  --correct: #16a34a;
  --correct-bg: rgba(22, 163, 74, 0.1);
  --wrong: #dc2626;
  --wrong-bg: rgba(220, 38, 38, 0.1);
  --border: #e2e4ea;
  --border-light: #ecedf2;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
}

/* ---- RESET & BASE ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100dvh;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}

/* ---- LAYOUT ---- */
.app-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.page { display: none; flex: 1; }
.page.active { display: flex; flex-direction: column; }

/* ---- HEADER ---- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 100;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.app-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #3b82f6);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  font-weight: 700;
}

.app-logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all var(--transition);
}
.btn-icon:hover { color: var(--accent); border-color: var(--accent); }

.btn-full { width: 100%; }

.btn-lg { padding: 14px 24px; font-size: 1rem; }

/* ---- LOGIN PAGE ---- */
.login-page {
  justify-content: center;
  align-items: center;
  padding: 40px 16px;
  min-height: 100dvh;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--accent), #3b82f6);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  font-weight: 800;
  margin-bottom: 16px;
}

.login-logo h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.login-logo p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color var(--transition);
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
  width: 100%;
  padding: 12px;
  font-size: 0.95rem;
}
.btn-google:hover { border-color: var(--accent); }

.login-error {
  background: var(--wrong-bg);
  color: var(--wrong);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}

.login-success {
  background: var(--correct-bg);
  color: var(--correct);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}

/* Auth Tabs */
.auth-tabs {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.auth-tab:hover { color: var(--text-primary); background: var(--bg-hover); }

.auth-tab.active {
  background: var(--accent);
  color: #fff;
}

.auth-form { display: none; }
.auth-form.active { display: block; }

/* Forgot password link */
.btn-link {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  padding: 10px 0 0;
  text-align: center;
  transition: color var(--transition);
}
.btn-link:hover { color: var(--accent-hover); text-decoration: underline; }

.forgot-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 18px;
}

/* Verify Email Page */
.verify-card {
  text-align: center;
}

.verify-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  line-height: 1;
}

.verify-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.verify-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 8px;
}

.verify-desc strong {
  color: var(--accent);
  word-break: break-all;
}

.verify-hint {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 24px;
}

.verify-actions {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 16px;
}

.verify-actions .btn-link {
  width: auto;
  padding: 6px 0;
}

.verify-message {
  display: none;
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.verify-message.success {
  background: var(--correct-bg);
  color: var(--correct);
}

.verify-message.error {
  background: var(--wrong-bg);
  color: var(--wrong);
}

/* ---- HOME PAGE ---- */
.welcome-section {
  margin-bottom: 28px;
}

.welcome-greeting {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.welcome-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Stats Overview */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.03em;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Mode Cards */
.section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.mode-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.mode-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 16px;
}

.mode-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.mode-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.mode-card-icon.topic { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.mode-card-icon.random { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.mode-card-icon.review { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }

.mode-card-content { flex: 1; }

.mode-card-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 2px;
}

.mode-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.mode-card-arrow {
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: transform var(--transition);
}

.mode-card:hover .mode-card-arrow {
  transform: translateX(3px);
  color: var(--accent);
}

/* Topic Selection */
.topic-selection {
  display: none;
  margin-bottom: 20px;
}

.topic-selection.active { display: block; }

.topic-search {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  margin-bottom: 12px;
  outline: none;
  transition: border-color var(--transition);
}
.topic-search:focus { border-color: var(--accent); }

.topic-list {
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.topic-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.topic-item:last-child { border-bottom: none; }
.topic-item:hover { background: var(--bg-hover); }

.topic-item.selected {
  background: var(--accent-soft);
  color: var(--accent);
}

.topic-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.topic-item-name { flex: 1; }

.topic-item-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: 10px;
}

.topic-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* Random count */
.random-config {
  display: none;
  margin-bottom: 20px;
}

.random-config.active { display: block; }

.count-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.count-option {
  padding: 10px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.count-option:hover { border-color: var(--accent); color: var(--accent); }
.count-option.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---- QUIZ PAGE ---- */
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.quiz-back {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.quiz-back:hover { color: var(--accent); background: var(--bg-hover); }

.quiz-progress-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.quiz-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 24px;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #3b82f6);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.quiz-topic-badge {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
  border: 1px solid rgba(34, 211, 167, 0.2);
}

.quiz-question {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.65;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.95rem;
  line-height: 1.55;
}

.quiz-option:hover:not(.disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.quiz-option-letter {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--transition);
}

.quiz-option:hover:not(.disabled) .quiz-option-letter {
  background: var(--accent);
  color: #fff;
}

.quiz-option.correct {
  border-color: var(--correct);
  background: var(--correct-bg);
}
.quiz-option.correct .quiz-option-letter {
  background: var(--correct);
  color: #fff;
}

.quiz-option.wrong {
  border-color: var(--wrong);
  background: var(--wrong-bg);
}
.quiz-option.wrong .quiz-option-letter {
  background: var(--wrong);
  color: #fff;
}

.quiz-option.disabled { cursor: default; opacity: 0.7; }
.quiz-option.correct.disabled { opacity: 1; }

.quiz-feedback {
  display: none;
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
}

.quiz-feedback.show { display: block; }
.quiz-feedback.correct { background: var(--correct-bg); color: var(--correct); }
.quiz-feedback.wrong { background: var(--wrong-bg); color: var(--wrong); }

.quiz-next {
  margin-top: auto;
  padding-bottom: 20px;
}

/* ---- RESULT PAGE ---- */
.result-page {
  align-items: center;
  padding-top: 40px;
}

.result-circle {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  position: relative;
}

.result-circle::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 6px solid var(--border);
}

.result-circle::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 6px solid transparent;
  border-top-color: var(--accent);
  transform: rotate(-90deg);
  transition: all 1s ease;
}

.result-score {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.03em;
}

.result-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  margin-bottom: 28px;
}

.result-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.result-stat-value {
  font-size: 1.3rem;
  font-weight: 800;
}

.result-stat-value.correct-color { color: var(--correct); }
.result-stat-value.wrong-color { color: var(--wrong); }

.result-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.result-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}

/* Review wrong answers */
.review-section {
  width: 100%;
  margin-top: 24px;
}

.review-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
}

.review-item-q {
  font-weight: 600;
  margin-bottom: 10px;
  line-height: 1.55;
  font-size: 0.9rem;
}

.review-item-answer {
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}

.review-item-answer.your-answer {
  background: var(--wrong-bg);
  color: var(--wrong);
}

.review-item-answer.correct-answer {
  background: var(--correct-bg);
  color: var(--correct);
}

/* ---- STATS PAGE ---- */
.stats-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.stats-page-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}

.stats-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.stats-summary-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
}

.stats-summary-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Topic Progress */
.topic-progress-list {
  margin-bottom: 28px;
}

.topic-progress-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.topic-progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.topic-progress-name {
  font-size: 0.88rem;
  font-weight: 600;
  flex: 1;
  padding-right: 10px;
}

.topic-progress-pct {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}

.topic-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.topic-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #3b82f6);
  border-radius: 3px;
  transition: width 0.6s ease;
}

.topic-progress-fill.low { background: linear-gradient(90deg, var(--wrong), #f97316); }
.topic-progress-fill.medium { background: linear-gradient(90deg, #f59e0b, #eab308); }

/* History Chart */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 28px;
}

.chart-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.chart-canvas {
  width: 100%;
  height: 200px;
}

/* ---- BOTTOM NAV ---- */
.bottom-nav {
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-primary);
  position: sticky;
  bottom: 0;
  margin-top: auto;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.7rem;
  font-family: inherit;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.nav-item:hover { color: var(--text-secondary); }

.nav-item.active {
  color: var(--accent);
}

.nav-item-icon {
  font-size: 1.4rem;
  line-height: 1;
}

/* ---- TOAST / SNACKBAR ---- */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 12px 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- LOADING ---- */
.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- ANIMATIONS ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

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

.slide-up {
  animation: slideUp 0.4s ease forwards;
}

/* ---- RESPONSIVE ---- */
@media (min-width: 480px) {
  .stats-overview { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 360px) {
  .app-container { padding: 0 12px; }
  .login-card { padding: 28px 20px; }
  .quiz-question { font-size: 1rem; }
}

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 0.95rem;
}
