/* 
 * LEARN FMO - PVSoft Modern Design System
 * Aesthetic: Clean, Modern, Engaging, Premium Educational Interface
 */

:root {
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', 'Plus Jakarta Sans', system-ui, sans-serif;

  /* Color Palette - Light Theme */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-overlay: rgba(15, 23, 42, 0.65);
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-inverse: #ffffff;

  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;

  /* Brand & Vibrant Accents - Modern Crisp Royal Blue */
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --primary-bg: #eff6ff;
  --primary-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  --accent-gradient: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-text: #065f46;
  --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);

  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-text: #92400e;

  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-text: #991b1b;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 28px -6px rgba(15, 23, 42, 0.12);
  --shadow-xl: 0 20px 35px -8px rgba(15, 23, 42, 0.16);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.25);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

[data-theme="dark"] {
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-tertiary: #1e293b;
  --bg-card: #141d33;
  --bg-overlay: rgba(3, 7, 18, 0.82);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --text-inverse: #ffffff;

  --border-color: #27354f;
  --border-hover: #3b4d6e;

  --primary-bg: rgba(79, 70, 229, 0.18);
  --success-bg: rgba(16, 185, 129, 0.15);
  --success-text: #34d399;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --warning-text: #fbbf24;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --danger-text: #f87171;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.5);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
  cursor: pointer;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  box-shadow: var(--shadow-glow);
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Compact Grade Focus Pill in Navbar */
.header-grade-focus {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.85rem 0.35rem 0.55rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.header-grade-focus:hover {
  background: var(--bg-card);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.grade-focus-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.grade-focus-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.grade-focus-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.grade-focus-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary);
}

.grade-focus-caret {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 2px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Subject Navigation Tabs */
.subject-nav-bar {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-tertiary);
  padding: 0.35rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.subject-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.15rem;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all var(--transition-fast);
}

.subject-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.4);
}

.subject-tab.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .subject-tab:hover {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .subject-tab.active {
  background: var(--bg-card);
  color: var(--primary-light);
}

.subject-badge-count {
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background: var(--primary-bg);
  color: var(--primary);
}

/* Active Student Profile Chip in Navbar */
.student-profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.85rem 0.35rem 0.45rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.student-profile-chip:hover {
  background: var(--bg-card);
  border-color: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.student-profile-chip .chip-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.student-profile-chip .chip-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: left;
}

.student-profile-chip .chip-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.student-profile-chip .chip-grade {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.nav-btn.primary {
  background: var(--primary-gradient);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.nav-btn.primary:hover {
  opacity: 0.95;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.45);
}

.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  font-size: 1.15rem;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-hover);
}

/* App Layout & Views */
.main-content {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
}

.view-section {
  display: none;
  animation: fadeIn 0.3s ease forwards;
}

.view-section.active {
  display: block;
}

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

/* ========================================================
   1. DASHBOARD / PORTAL VIEW (Bright, Scalable, Modern)
======================================================== */
/* Focused Workspace Header (Dedicated 100% to active Grade) */
.workspace-focus-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 1rem;
}

.workspace-focus-left {
  display: flex;
  align-items: center;
  gap: 1.15rem;
}

.workspace-grade-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.15);
  flex-shrink: 0;
}

[data-theme="dark"] .workspace-grade-avatar {
  background: rgba(37, 99, 235, 0.15);
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.25);
}

.workspace-grade-text {
  display: flex;
  flex-direction: column;
}

.workspace-grade-tagline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.25rem;
  flex-wrap: wrap;
}

.ws-tag-pill {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 800;
  color: #1d4ed8;
  background: #dbeafe;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

[data-theme="dark"] .ws-tag-pill {
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.25);
}

.ws-tag-age,
.ws-tag-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.workspace-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.workspace-focus-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-change-grade {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-main);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-change-grade:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  transform: translateY(-1px);
}

/* Grade Picker Modal Grid */
.grade-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}

@media (max-width: 600px) {
  .grade-picker-grid {
    grid-template-columns: 1fr;
  }
}

.grade-picker-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  text-align: left;
}

.grade-picker-card:hover {
  border-color: var(--primary);
  background: #f8fafc;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .grade-picker-card:hover {
  background: var(--bg-tertiary);
}

.grade-picker-card.active {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: inset 0 0 0 1px var(--primary);
}

[data-theme="dark"] .grade-picker-card.active {
  background: rgba(37, 99, 235, 0.15);
  border-color: var(--primary-light);
}

.grade-picker-icon {
  font-size: 2.2rem;
  line-height: 1;
  flex-shrink: 0;
}

.grade-picker-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}

.grade-picker-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.grade-picker-card.active .grade-picker-name {
  color: var(--primary);
}

.grade-picker-meta {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.grade-picker-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-top: 0.2rem;
}

.grade-active-badge {
  font-size: 0.7rem;
  font-weight: 800;
  color: #16a34a;
  background: #dcfce7;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

[data-theme="dark"] .grade-active-badge {
  background: rgba(22, 163, 74, 0.25);
  color: #4ade80;
}

/* Quick Practice Strip (Streamlined) */
.quick-practice-strip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 0.9rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.qps-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.qps-icon {
  font-size: 1.6rem;
  background: rgba(37, 99, 235, 0.08);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.qps-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
}

.qps-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.qps-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.qps-select-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-tertiary);
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.qps-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.qps-select {
  background: transparent;
  border: none;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

.btn-start-practice {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.88rem;
  color: #ffffff;
  background: var(--primary-gradient);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: all var(--transition-fast);
}

.btn-start-practice:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}

.qps-btn-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-standard-olympic {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.86rem;
  color: #ffffff;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-standard-olympic:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.45);
}

.btn-open-bank {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--primary-color);
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.25);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-open-bank:hover {
  background: rgba(37, 99, 235, 0.16);
  border-color: var(--primary-color);
}

/* Question Bank Modal Styles */
.qb-filters-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.qb-filter-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.qb-filter-group select {
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  outline: none;
}

.qb-filter-group.checkbox label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
}

.qb-search-wrap {
  flex: 1;
  min-width: 180px;
}

.qb-search-wrap input {
  width: 100%;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.82rem;
  outline: none;
}

.qb-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--bg-body);
}

.qb-question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.qb-question-card:hover {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: var(--shadow-md);
}

.qb-q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.qb-q-badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.qb-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

.qb-badge.skill {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary-color);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.qb-badge.diff-easy {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.qb-badge.diff-medium {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
}

.qb-badge.diff-hard, .qb-badge.diff-olympic {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.qb-q-source {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.qb-q-text {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

.qb-q-image-wrap {
  margin: 0.75rem 0;
  max-width: 420px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #ffffff;
}

.qb-q-image-wrap img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
}

.qb-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.qb-opt-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.qb-opt-item.correct {
  background: rgba(16, 185, 129, 0.12);
  border-color: #10b981;
  font-weight: 700;
  color: #047857;
}

.qb-opt-lbl {
  font-weight: 800;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  font-size: 0.75rem;
}

.qb-opt-item.correct .qb-opt-lbl {
  background: #10b981;
  color: #ffffff;
}

.qb-explanation-box {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(37, 99, 235, 0.05);
  border-left: 3px solid var(--primary-color);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-main);
}

.qb-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.qb-footer-info {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.qb-pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.qb-page-btn {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.qb-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Question Badges and Solution Box */
.question-badge-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge-skill {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 800;
  color: #1d4ed8;
  background: #dbeafe;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
}

[data-theme="dark"] .badge-skill {
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.25);
}

.badge-diff {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
}

.badge-diff.easy {
  color: #15803d;
  background: #dcfce7;
}

[data-theme="dark"] .badge-diff.easy {
  color: #4ade80;
  background: rgba(22, 163, 74, 0.25);
}

.badge-diff.medium {
  color: #b45309;
  background: #fef3c7;
}

[data-theme="dark"] .badge-diff.medium {
  color: #fde047;
  background: rgba(234, 179, 8, 0.25);
}

.badge-diff.hard,
.badge-diff.olympic {
  color: #b91c1c;
  background: #fee2e2;
}

[data-theme="dark"] .badge-diff.hard,
[data-theme="dark"] .badge-diff.olympic {
  color: #f87171;
  background: rgba(239, 68, 68, 0.25);
}

.btn-toggle-solution {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 700;
  color: #059669;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-toggle-solution:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
}

[data-theme="dark"] .btn-toggle-solution {
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
}

.question-solution-box {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  font-size: 0.92rem;
  color: #166534;
  line-height: 1.55;
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.25s ease;
}

[data-theme="dark"] .question-solution-box {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
  color: #86efac;
}

/* Portal Layout */
.portal-layout {
  display: block;
  width: 100%;
}

/* Left Category Sidebar */
.catalog-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: sticky;
  top: 75px;
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sidebar-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

.sidebar-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--text-main);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.sidebar-nav-item:hover {
  background: var(--bg-tertiary);
  color: var(--primary);
  border-color: var(--border-color);
}

.sidebar-nav-item.active {
  background: var(--primary-bg);
  color: var(--primary-dark);
  font-weight: 700;
  border-color: rgba(37, 99, 235, 0.25);
  box-shadow: var(--shadow-sm);
}

.sidebar-nav-item .nav-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  flex-shrink: 0;
}

.sidebar-nav-item.active .sidebar-badge {
  background: rgba(37, 99, 235, 0.2);
  color: var(--primary-dark);
}

/* Sidebar Subcategories Box */
.sidebar-sub-box {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--border-color);
}

.sidebar-sub-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.6rem;
}

.sidebar-sub-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.sub-chip {
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sub-chip:hover {
  background: var(--primary-bg);
  color: var(--primary);
  border-color: rgba(37, 99, 235, 0.3);
}

.sub-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

/* Main Content Area */
.catalog-main {
  min-width: 0;
}

.workspace-header {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.workspace-breadcrumb {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.workspace-breadcrumb strong {
  color: var(--primary);
}

.workspace-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.workspace-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
}

.workspace-subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 0.25rem;
}

.workspace-stats-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: var(--bg-tertiary);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.workspace-stats-pill .stat-num {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.workspace-stats-pill .stat-lbl {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Toolbar: Format Filter Buttons & Round Chips */
.catalog-toolbar {
  margin-bottom: 1.25rem;
}

.format-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.format-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.format-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.format-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.format-btn .badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.format-btn.active .badge {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.round-filters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.round-chip {
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.round-chip:hover {
  background: var(--bg-tertiary);
  color: var(--text-main);
}

.round-chip.active {
  background: var(--primary-bg);
  border-color: rgba(37, 99, 235, 0.3);
  color: var(--primary-dark);
  font-weight: 700;
}

/* ==========================================================================
   PROGRESS TRACKING & MASTERY BADGES (MATH, TIẾNG VIỆT, CAMBRIDGE)
   ========================================================================== */
.grade-progress-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.03) 0%, rgba(16, 185, 129, 0.05) 100%), var(--bg-card);
}

.grade-progress-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #3b82f6 0%, #10b981 100%);
  border-radius: 4px 0 0 4px;
}

.grade-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.grade-progress-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.grade-progress-icon {
  font-size: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.1);
}

.grade-progress-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text-main);
  font-family: var(--font-display);
}

.grade-progress-desc {
  margin: 0.2rem 0 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.grade-progress-stats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.stat-pill .stat-num {
  font-weight: 800;
  color: var(--primary);
}

.stat-pill.highlight {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
  color: #059669;
}

.stat-pill.highlight .stat-num {
  color: #059669;
}

.stat-pill.gold {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.25);
  color: #d97706;
}

.stat-pill.gold .stat-num {
  color: #d97706;
}

.grade-progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.grade-progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6 0%, #10b981 100%);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Status Filter Toolbar */
.status-filters {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.status-chip:hover {
  background: var(--bg-tertiary);
  color: var(--text-main);
  transform: translateY(-1px);
}

.status-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.status-chip.active.completed {
  background: #10b981;
  border-color: #10b981;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.status-chip.active.pending {
  background: #64748b;
  border-color: #64748b;
  box-shadow: 0 2px 8px rgba(100, 116, 139, 0.3);
}

.status-chip .chip-count {
  font-size: 0.72rem;
  padding: 0.08rem 0.4rem;
  border-radius: 999px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.status-chip.active .chip-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Card-level status badge & indicator */
.badge-exam-status {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  letter-spacing: -0.2px;
}

.badge-exam-status.status-perfect {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18) 0%, rgba(251, 191, 36, 0.25) 100%);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.15);
}

.badge-exam-status.status-done {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-exam-status.status-pending {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.exam-card.is-completed {
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.06);
}

.exam-card.is-completed:hover {
  border-color: rgba(16, 185, 129, 0.65);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.12);
}

.exam-card.is-perfect {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.08);
}

.exam-card.is-perfect:hover {
  border-color: rgba(245, 158, 11, 0.7);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.15);
}

.btn-card-action.btn-redo {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #059669;
  color: #fff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-card-action.btn-redo:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
}

/* Exams Catalog Grid */
.exams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.25rem;
}

.exam-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  position: relative;
}

.exam-card:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: var(--shadow-md);
}

.exam-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.exam-badge-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.badge-subject {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: var(--primary-bg);
  color: var(--primary-dark);
}

.badge-format {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
}

.badge-format.digital {
  background: rgba(6, 182, 212, 0.12);
  color: #0891b2;
}

.badge-format.pdf {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.badge-sol {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.18rem 0.45rem;
  border-radius: 6px;
  background: var(--success-bg);
  color: var(--success-text);
}

.exam-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 0.45rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.exam-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.exam-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

.exam-card-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-card-action {
  flex: 1;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  border: none;
  background: var(--primary);
  color: #fff;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.btn-card-action:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

.btn-card-sol {
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid rgba(16, 185, 129, 0.35);
  background: var(--success-bg);
  color: var(--success-text);
  transition: all var(--transition-fast);
}

.btn-card-sol:hover {
  background: #d1fae5;
  border-color: #10b981;
}

/* PDF Viewer Stage in Quiz View */
.pdf-viewer-stage {
  margin-bottom: 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #525659;
}

.pdf-stage-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pdf-badge-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.pdf-stage-frame-wrap {
  width: 100%;
  height: 540px;
  background: #525659;
}

.pdf-exam-frame {
  width: 100%;
  height: 100%;
  border: none;
}

.topic-badge {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--primary-bg);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.grade-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.grade-badge.lop_1 {
  background: rgba(79, 70, 229, 0.12);
  color: var(--primary);
}

.grade-badge.mam_non {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.category-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
}

.exam-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  line-height: 1.35;
  color: var(--text-main);
}

.exam-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.best-score-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.85rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
}

.best-score-badge.completed {
  background: var(--success-bg);
  color: var(--success-text);
  font-weight: 600;
}

.exam-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.btn-card {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.btn-card:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-hover);
}

.btn-card.primary {
  background: var(--primary-gradient);
  color: #fff;
  border: none;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}

.btn-card.primary:hover {
  opacity: 0.95;
  box-shadow: 0 6px 14px rgba(79, 70, 229, 0.4);
}

/* ========================================================
   2. EXAM & QUIZ VIEW ("Chỉ việc tích chọn")
======================================================== */
.quiz-header {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 4.5rem;
  z-index: 40;
  backdrop-filter: blur(10px);
}

.quiz-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.quiz-title-wrap h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
}

.quiz-title-wrap span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.quiz-stats-group {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.timer-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary-bg);
  color: var(--primary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.timer-box.warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  animation: pulse 1s infinite;
}

.timer-box.danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  animation: pulse 0.6s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.quiz-progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 0.5rem;
}

.quiz-progress-bar-fill {
  height: 100%;
  background: var(--primary-gradient);
  width: 0%;
  transition: width 0.3s ease;
}

/* Quiz Stage Layout */
.quiz-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .quiz-layout {
    grid-template-columns: 1fr;
  }
}

/* Question Area */
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.question-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.85rem;
}

.question-number-badge {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.question-status-tags {
  display: flex;
  gap: 0.5rem;
}

.status-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.status-tag.flagged {
  background: var(--warning-bg);
  color: var(--warning-text);
}

/* Question Image Frame */
.question-image-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  cursor: zoom-in;
  overflow: hidden;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.02);
}

.question-image-box img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  object-fit: contain;
  transition: transform var(--transition-normal);
}

.question-image-box:hover img {
  transform: scale(1.015);
}

.zoom-hint {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Interactive Option Selection ("Tích chọn") */
.options-section {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.options-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
}

.option-button {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-tertiary);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-bounce);
  position: relative;
  text-align: left;
  user-select: none;
}

.option-button:hover {
  background: var(--bg-card);
  border-color: var(--border-hover);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.option-button.selected {
  background: var(--primary-bg);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateX(6px);
}

.option-button.correct {
  background: var(--success-bg) !important;
  border-color: var(--success) !important;
  color: var(--success-text);
}

.option-button.incorrect {
  background: var(--danger-bg) !important;
  border-color: var(--danger) !important;
  color: var(--danger-text);
}

.option-letter-badge {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.option-button.selected .option-letter-badge {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
}

.option-content {
  flex: 1;
}

.option-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
}

.key-hint {
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  margin-left: auto;
}

/* Numeric keypad for fill-in questions */
.fill-in-box {
  background: var(--bg-tertiary);
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.fill-in-input {
  width: 100%;
  padding: 0.85rem 1.25rem;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-display);
  text-align: center;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-main);
  outline: none;
  margin-bottom: 1rem;
  transition: border-color var(--transition-fast);
}

.fill-in-input:focus {
  border-color: var(--primary);
}

.num-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.num-btn {
  padding: 0.85rem;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-display);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.num-btn:hover {
  background: var(--primary-bg);
  border-color: var(--primary-light);
  transform: translateY(-2px);
}

/* Bottom Controls */
.quiz-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.quiz-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.quiz-nav-btn:hover:not(:disabled) {
  background: var(--bg-tertiary);
  transform: translateY(-1px);
}

.quiz-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.quiz-nav-btn.flag-btn.active {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: var(--warning);
}

.btn-submit-exam {
  background: var(--success-gradient);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-submit-exam:hover {
  opacity: 0.95;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
  transform: translateY(-2px);
}

/* Question Palette Sidebar */
.palette-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 11rem;
}

.palette-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.palette-legend {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.palette-btn {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.palette-btn:hover {
  border-color: var(--primary-light);
  color: var(--text-main);
  transform: scale(1.05);
}

.palette-btn.current {
  border: 2px solid var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.25);
  font-weight: 800;
}

.palette-btn.answered {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.palette-btn.flagged::after {
  content: '🚩';
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 0.65rem;
}

.palette-btn.correct {
  background: var(--success) !important;
  color: #fff !important;
  border-color: var(--success) !important;
}

.palette-btn.incorrect {
  background: var(--danger) !important;
  color: #fff !important;
  border-color: var(--danger) !important;
}

/* ========================================================
   3. RESULT & REVIEW VIEW
======================================================== */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  max-width: 900px;
  margin: 0 auto 2rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.result-celebration {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
  animation: bounceIn 0.6s var(--transition-bounce);
}

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.result-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.result-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 2rem;
}

.score-circle-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.score-circle {
  width: 180px;
  height: 180px;
  border-radius: var(--radius-full);
  background: var(--primary-bg);
  border: 8px solid var(--primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

.score-circle .score-num {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}

.score-circle .score-total {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.result-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--bg-tertiary);
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.metric-card .val {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
}

.metric-card .lbl {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 0.25rem;
}

.metric-card.correct .val { color: var(--success); }
.metric-card.incorrect .val { color: var(--danger); }
.metric-card.skipped .val { color: var(--warning); }

.result-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Review Section */
.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 900px;
  margin: 2rem auto 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.review-list {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.review-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.review-item-card.is-correct {
  border-left: 5px solid var(--success);
}

.review-item-card.is-incorrect {
  border-left: 5px solid var(--danger);
}

.review-answers-bar {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.95rem;
  flex-wrap: wrap;
}

.review-badge {
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.review-badge.user-ans {
  background: var(--primary-bg);
  color: var(--primary);
}

.review-badge.correct-ans {
  background: var(--success-bg);
  color: var(--success-text);
}

/* ========================================================
   4. ANSWER MANAGER MODAL / VIEW
======================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 950px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-tertiary);
}

/* Answer Manager Grid */
.ans-mgr-row {
  display: grid;
  grid-template-columns: 80px 140px 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem;
  border-bottom: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: background-color var(--transition-fast);
}

.ans-mgr-row:hover {
  background: var(--bg-tertiary);
}

@media (max-width: 640px) {
  .ans-mgr-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 0.75rem 0.5rem;
  }
}

.ans-mgr-thumb {
  width: 100%;
  height: 60px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.ans-selector-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ans-radio-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.ans-radio-btn:hover {
  border-color: var(--primary-light);
  transform: translateY(-1px);
}

.ans-radio-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
}

/* Lightbox Image Zoom */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
}

.lightbox-overlay.active {
  display: flex;
}

.lightbox-img {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
  background: #fff;
  padding: 0.5rem;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ========================================================
   GRADE 1 MATH DISPLAY & VISUAL CARD
======================================================== */
.math-problem-display {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.05) 0%, rgba(16, 185, 129, 0.05) 100%);
  border: 2px dashed var(--primary-light);
  border-radius: var(--radius-xl);
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.02);
}

.math-problem-tag {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  background: var(--primary-bg);
  color: var(--primary);
  margin-bottom: 1rem;
}

.math-equation-text {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 900;
  line-height: 1.1;
  color: var(--text-main);
  letter-spacing: 0.02em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

@media (max-width: 600px) {
  .math-equation-text {
    font-size: 2.8rem;
  }
}

.math-hint-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  font-weight: 500;
}

/* ========================================================
   SPEED & TIME ANALYTICS SECTION
======================================================== */
.speed-analytics-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.speed-analytics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.speed-analytics-header h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.speed-highlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.speed-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: relative;
  overflow: hidden;
}

.speed-box .title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.speed-box .value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1.2;
}

.speed-box .sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.speed-box.fastest .value { color: var(--success); }
.speed-box.slowest .value { color: var(--warning-text); }
.speed-box.avg .value { color: var(--primary); }

/* Per-Question Time Matrix Grid */
.question-time-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.q-time-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.q-time-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
  background: var(--bg-card);
}

.q-time-card .q-num-label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
}

.q-time-card .q-seconds-text {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1.1;
  color: var(--primary);
}

.q-time-card .q-speed-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
}

.q-time-card.fast .q-seconds-text { color: var(--success); }
.q-time-card.fast .q-speed-tag { background: var(--success-bg); color: var(--success-text); }
.q-time-card.medium .q-seconds-text { color: var(--primary); }
.q-time-card.medium .q-speed-tag { background: var(--primary-bg); color: var(--primary); }
.q-time-card.slow .q-seconds-text { color: var(--warning-text); }
.q-time-card.slow .q-speed-tag { background: var(--warning-bg); color: var(--warning-text); }

/* Detailed Time Breakdown Table */
.time-table-wrap {
  overflow-x: auto;
  margin-top: 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.time-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: left;
}

.time-table th {
  background: var(--bg-tertiary);
  padding: 0.75rem 1rem;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.time-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.time-table tr:hover td {
  background: var(--bg-tertiary);
}

.time-mini-bar-wrap {
  width: 100%;
  max-width: 140px;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.time-mini-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary-gradient);
}

.time-mini-bar.fast { background: var(--success-gradient); }
.time-mini-bar.slow { background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%); }

.review-time-callout {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.review-time-callout.fast {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success-text);
}

.review-time-callout.slow {
  background: var(--warning-bg);
  border-color: var(--warning);
  color: var(--warning-text);
}

@keyframes pulseHighlight {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.7); border-color: var(--primary); }
  40% { transform: scale(1.02); box-shadow: 0 0 0 12px rgba(79, 70, 229, 0); border-color: var(--primary); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

.pulse-highlight {
  animation: pulseHighlight 1.6s ease-out;
  border-color: var(--primary) !important;
}

/* Bar chart of question times */
.time-chart-container {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
  padding: 10px 0 25px 0;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  overflow-x: auto;
}

.time-chart-bar-wrap {
  flex: 1;
  min-width: 24px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
}

.time-chart-bar {
  width: 100%;
  background: var(--primary-light);
  border-radius: 4px 4px 0 0;
  transition: height 0.5s ease;
  min-height: 4px;
}

.time-chart-bar.fastest-bar {
  background: var(--success);
}

.time-chart-bar.slowest-bar {
  background: var(--warning);
}

.time-chart-label {
  position: absolute;
  bottom: -22px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
}

.time-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

/* ========================================================
   STUDENT PROFILES & PHONE AUTHENTICATION
======================================================== */
.student-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.student-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-bounce);
  position: relative;
}

.student-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.student-card.active {
  border-color: var(--primary);
  background: var(--primary-bg);
  box-shadow: 0 0 0 2px var(--primary);
}

.student-card .avatar {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  border: 3px solid var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.student-card .name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.student-card .grade {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.student-card .score-stat {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.student-add-card {
  border: 2px dashed var(--border-hover);
  background: rgba(79, 70, 229, 0.02);
  justify-content: center;
}

.student-add-card:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.student-add-card .plus-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

/* Phone Login & OTP Verification UI */
.login-banner {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(124, 58, 237, 0.1) 100%);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-xl);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.phone-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.4rem 0.75rem;
  transition: border-color var(--transition-fast);
}

.phone-input-group:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.phone-input-group .prefix {
  font-weight: 800;
  font-family: var(--font-display);
  color: var(--primary);
  padding-right: 0.5rem;
  border-right: 1px solid var(--border-color);
}

.phone-input-group input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-main);
  letter-spacing: 0.05em;
  width: 160px;
}

/* OTP 6-Digit Verification Box */
.otp-input-box {
  width: 100%;
  max-width: 320px;
  padding: 0.85rem;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.35em;
  text-align: center;
  font-family: var(--font-display);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-tertiary);
  color: var(--primary);
  outline: none;
  margin: 1rem auto;
  display: block;
}

.otp-input-box:focus {
  border-color: var(--primary);
  background: var(--bg-card);
}

/* Footer */
.app-footer {
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: auto;
}

.app-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

/* ========================================================
   MODERN GRADE / LEVEL SELECTOR BAR (Mầm non - Lớp 5)
======================================================== */
.grade-nav-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.5rem 0.25rem 1rem 0.25rem;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.grade-pill-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 1.15rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  color: var(--text-main);
  text-decoration: none;
  flex-shrink: 0;
}

.grade-pill-btn:hover {
  transform: translateY(-2px);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
}

.grade-pill-btn.active {
  background: var(--primary-gradient);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.grade-pill-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.grade-pill-info {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.grade-pill-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.2;
}

.grade-pill-age {
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.85;
}

.grade-pill-btn.active .grade-pill-age {
  color: rgba(255, 255, 255, 0.9);
}

/* Parent Login Button in Header */
.btn-parent-login {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  background: var(--primary-gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.35);
  transition: all var(--transition-fast);
}

.btn-parent-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.5);
  filter: brightness(1.08);
}

/* Non-intrusive Guest Tip Strip */
.guest-tip-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px dashed var(--primary-light);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.guest-tip-strip strong {
  color: var(--primary);
  font-family: var(--font-display);
}

/* Header search bar */
.header-search-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.35rem 0.85rem;
  width: 300px;
  transition: all var(--transition-fast);
}

.header-search-wrap:focus-within {
  width: 380px;
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.header-search-wrap input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 0.85rem;
  color: var(--text-main);
  padding-left: 0.35rem;
}

/* Format badges on exam cards */
.exam-format-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.exam-format-badge.interactive {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.exam-format-badge.pdf {
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.25);
}

.btn-logout-small {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.btn-logout-small:hover {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

/* ========================================================
   MODERN MOBILE-FIRST RESPONSIVE PERFECTION (max-width: 768px)
======================================================== */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
  }

  .main-content {
    padding: 0.65rem 0.65rem 3.5rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* 1. Header / Navbar on Mobile */
  .navbar {
    padding: 0.5rem 0.75rem !important;
    flex-wrap: wrap !important;
    row-gap: 0.5rem !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
  }

  .brand {
    gap: 0.45rem !important;
  }

  .brand-icon {
    width: 34px !important;
    height: 34px !important;
    font-size: 1.1rem !important;
    border-radius: var(--radius-sm) !important;
  }

  .brand-text h1 {
    font-size: 1.05rem !important;
    line-height: 1.15 !important;
  }

  .brand-text span {
    display: none !important;
  }

  .header-grade-focus {
    padding: 0.25rem 0.55rem !important;
    gap: 0.35rem !important;
  }

  .grade-focus-sub {
    display: none !important;
  }

  .grade-focus-name {
    font-size: 0.78rem !important;
  }

  .nav-actions {
    gap: 0.35rem !important;
    margin-left: auto !important;
  }

  .btn-parent-login {
    padding: 0.35rem 0.65rem !important;
    font-size: 0.75rem !important;
    border-radius: var(--radius-full) !important;
  }

  .btn-parent-login span:last-child {
    display: none !important;
  }

  .btn-parent-login::after {
    content: "Đăng nhập";
    font-weight: 700;
  }

  #btn-open-answers {
    padding: 0.35rem 0.55rem !important;
    font-size: 0.75rem !important;
  }

  #btn-open-answers span:last-child {
    display: none !important;
  }

  .theme-toggle,
  .icon-btn {
    width: 34px !important;
    height: 34px !important;
    font-size: 0.95rem !important;
  }

  .header-search-wrap {
    order: 10 !important;
    width: 100% !important;
    margin: 0 !important;
    max-width: 100% !important;
  }

  .header-search-wrap input {
    font-size: 0.85rem !important;
    padding: 0.5rem 0.8rem 0.5rem 2.2rem !important;
    height: 36px !important;
    border-radius: var(--radius-full) !important;
  }

  /* 2. Workspace Focus Header */
  .workspace-focus-header {
    padding: 0.85rem !important;
    gap: 0.75rem !important;
    border-radius: var(--radius-md) !important;
    margin-bottom: 0.85rem !important;
  }

  .workspace-focus-left {
    gap: 0.75rem !important;
    width: 100% !important;
  }

  .workspace-grade-avatar {
    width: 42px !important;
    height: 42px !important;
    font-size: 1.35rem !important;
    border-radius: var(--radius-sm) !important;
  }

  .workspace-title {
    font-size: 1.1rem !important;
    line-height: 1.3 !important;
  }

  .workspace-grade-tagline {
    gap: 0.4rem !important;
  }

  .ws-tag-age {
    display: none !important;
  }

  .workspace-focus-actions {
    width: 100% !important;
  }

  .btn-change-grade {
    width: 100% !important;
    justify-content: center !important;
    padding: 0.5rem 0.85rem !important;
    font-size: 0.82rem !important;
  }

  /* 3. Guest Tip Strip */
  .guest-tip-strip {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
    padding: 0.85rem !important;
    margin-bottom: 0.85rem !important;
  }

  .guest-tip-strip .btn-parent-login {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 0.55rem 1rem !important;
  }

  .guest-tip-strip .btn-parent-login::after {
    display: none !important;
  }

  /* 4. Quick Practice Strip on Mobile */
  .quick-practice-strip {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 0.85rem !important;
    gap: 0.75rem !important;
    border-radius: var(--radius-md) !important;
    margin-bottom: 1rem !important;
  }

  .qps-left {
    gap: 0.65rem !important;
  }

  .qps-icon {
    font-size: 1.5rem !important;
  }

  .qps-title {
    font-size: 0.95rem !important;
  }

  .qps-desc {
    font-size: 0.76rem !important;
  }

  .qps-controls {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.6rem !important;
  }

  .qps-select-wrap {
    width: 100% !important;
    justify-content: space-between !important;
  }

  .qps-select {
    flex: 1 !important;
  }

  .qps-btn-group {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 0.5rem !important;
  }

  .quick-practice-strip .btn-start-practice,
  .quick-practice-strip .btn-standard-olympic,
  .quick-practice-strip .btn-open-bank {
    width: 100% !important;
    justify-content: center !important;
    font-size: 0.86rem !important;
    padding: 0.65rem 1rem !important;
    border-radius: var(--radius-md) !important;
  }

  /* 5. Catalog & Sidebar on Mobile */
  .portal-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
  }

  .catalog-sidebar {
    position: static !important;
    padding: 0.65rem !important;
    border-radius: var(--radius-md) !important;
    max-height: none !important;
    width: 100% !important;
  }

  .sidebar-header {
    display: none !important;
  }

  .sidebar-nav-list {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 0.45rem !important;
    padding-bottom: 0.2rem !important;
    scrollbar-width: none !important;
  }

  .sidebar-nav-list::-webkit-scrollbar {
    display: none !important;
  }

  .sidebar-nav-item {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    padding: 0.45rem 0.75rem !important;
    border-radius: var(--radius-full) !important;
    font-size: 0.8rem !important;
    background: var(--bg-tertiary) !important;
  }

  .sidebar-nav-item.active {
    background: var(--primary) !important;
    color: #fff !important;
  }

  .sidebar-nav-item .nav-count {
    margin-left: 0.35rem !important;
    padding: 0.1rem 0.4rem !important;
    font-size: 0.7rem !important;
  }

  .sidebar-sub-box {
    margin-top: 0.5rem !important;
    padding: 0.5rem !important;
  }

  .sidebar-sub-chips {
    display: flex !important;
    overflow-x: auto !important;
    gap: 0.35rem !important;
    scrollbar-width: none !important;
  }

  .catalog-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.6rem !important;
    margin-bottom: 1rem !important;
  }

  .format-filters,
  .round-filters {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 0.4rem !important;
    scrollbar-width: none !important;
    padding-bottom: 0.25rem !important;
  }

  .format-filters::-webkit-scrollbar,
  .round-filters::-webkit-scrollbar {
    display: none !important;
  }

  .format-btn,
  .round-chip {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    font-size: 0.78rem !important;
    padding: 0.35rem 0.65rem !important;
  }

  .exams-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
  }

  .exam-card {
    padding: 1rem !important;
    border-radius: var(--radius-md) !important;
  }

  .exam-title {
    font-size: 1rem !important;
  }

  .workspace-title-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.4rem !important;
  }

  .workspace-stats-pill {
    align-self: flex-start !important;
  }

  /* 6. Quiz View on Mobile */
  .quiz-header {
    position: relative !important;
    top: 0 !important;
    padding: 0.65rem 0.85rem !important;
    border-radius: var(--radius-lg) !important;
    margin-bottom: 1rem !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 0.5rem !important;
    z-index: 10 !important;
  }

  .quiz-info {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  .quiz-title-wrap {
    flex: 1 !important;
    min-width: 0 !important;
  }

  .quiz-title-wrap h2 {
    font-size: 0.88rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin: 0 !important;
  }

  #quiz-mode-badge {
    display: none !important;
  }

  .quiz-stats-group {
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    flex-shrink: 0 !important;
  }

  .timer-box {
    padding: 0.35rem 0.65rem !important;
    font-size: 0.85rem !important;
    gap: 0.25rem !important;
  }

  .quiz-stats-group .nav-btn.primary {
    padding: 0.35rem 0.65rem !important;
    font-size: 0.8rem !important;
  }

  .quiz-progress-bar-wrap {
    width: 100% !important;
    margin-top: 0.35rem !important;
  }

  .quiz-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
    padding: 0.5rem 0 !important;
  }

  .question-card {
    padding: 1rem 0.85rem !important;
    border-radius: var(--radius-md) !important;
  }

  .q-header-row {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
    margin-bottom: 0.75rem !important;
  }

  .q-counter {
    font-size: 1.1rem !important;
  }

  #btn-toggle-q-solution {
    padding: 0.3rem 0.6rem !important;
    font-size: 0.75rem !important;
  }

  .question-image-box {
    padding: 0.4rem !important;
    margin-bottom: 0.85rem !important;
    border-radius: var(--radius-sm) !important;
  }

  .question-image-box img {
    max-height: 260px !important;
    width: 100% !important;
    object-fit: contain !important;
  }

  .q-text-caption {
    font-size: 0.88rem !important;
    line-height: 1.5 !important;
    margin-bottom: 0.85rem !important;
  }

  .options-title-row {
    font-size: 0.75rem !important;
    margin-bottom: 0.5rem !important;
  }

  .option-button {
    padding: 0.65rem 0.85rem !important;
    min-height: 48px !important;
    border-radius: var(--radius-sm) !important;
    margin-bottom: 0.5rem !important;
  }

  .option-letter-badge {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.85rem !important;
  }

  .option-text {
    font-size: 0.95rem !important;
  }

  .key-hint {
    display: none !important; /* Hide keyboard shortcut hints on phones */
  }

  .palette-card {
    padding: 0.85rem !important;
    border-radius: var(--radius-md) !important;
  }

  .palette-grid {
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 0.35rem !important;
  }

  .palette-btn {
    height: 38px !important;
    font-size: 0.82rem !important;
  }

  .quiz-bottom-nav {
    padding: 0.6rem 0.85rem !important;
  }

  .nav-action-btn {
    padding: 0.5rem 0.85rem !important;
    font-size: 0.82rem !important;
  }

  /* 7. Result Screen on Mobile */
  .result-score-card {
    padding: 1.25rem 0.85rem !important;
    border-radius: var(--radius-md) !important;
  }

  .score-circle-wrap {
    width: 120px !important;
    height: 120px !important;
  }

  .score-number {
    font-size: 2.2rem !important;
  }

  .result-stats-row {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.6rem !important;
  }

  .stat-box {
    padding: 0.75rem !important;
  }

  .stat-val {
    font-size: 1.35rem !important;
  }

  .result-actions {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.6rem !important;
  }

  .result-actions button {
    width: 100% !important;
    justify-content: center !important;
  }

  .speed-analytics-card {
    padding: 1rem 0.85rem !important;
    border-radius: var(--radius-md) !important;
  }

  .speed-highlight-grid {
    grid-template-columns: 1fr !important;
    gap: 0.6rem !important;
  }

  .speed-card {
    padding: 0.75rem !important;
  }
}

/* ==========================================================================
   APP SHELL WITH LEFT SIDEBAR LAYOUT (Khung Menu Bên Trái)
   ========================================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
  background-color: var(--bg-primary);
}

/* Sidebar Styling */
.app-sidebar {
  width: 270px;
  min-width: 270px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 90;
  transition: transform var(--transition-normal);
  box-shadow: 2px 0 12px rgba(15, 23, 42, 0.03);
}

.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  user-select: none;
}

.sidebar-brand .brand-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  flex-shrink: 0;
}

.sidebar-brand .brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar-brand .brand-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--primary);
  line-height: 1.1;
}

.sidebar-brand .brand-subtitle {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Active Grade Widget in Sidebar */
.sidebar-grade-box {
  margin: 1rem 1rem 0.5rem;
  padding: 0.75rem 0.85rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.sidebar-grade-box:hover {
  border-color: var(--primary-light);
  background: var(--primary-bg);
}

.sidebar-grade-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.sidebar-grade-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-grade-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.sidebar-grade-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-grade-arrow {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Sidebar Navigation Groups */
.sidebar-nav-section {
  padding: 0.75rem 1rem 0.25rem;
}

.sidebar-nav-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-light);
  margin-bottom: 0.5rem;
  padding-left: 0.35rem;
}

.sidebar-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
  font-family: inherit;
  user-select: none;
}

.sidebar-nav-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-main);
}

.sidebar-nav-btn.active {
  background: var(--primary-bg);
  color: var(--primary);
  border-color: rgba(37, 99, 235, 0.25);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

.sidebar-nav-btn .nav-btn-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.sidebar-nav-btn .nav-btn-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-nav-btn .nav-btn-title {
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.2;
}

.sidebar-nav-btn .nav-btn-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.sidebar-nav-btn.active .nav-btn-desc {
  color: var(--primary-light);
}

.sidebar-nav-btn .nav-btn-badge {
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-weight: 800;
}

.sidebar-nav-btn .sidebar-caret {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.sidebar-nav-btn.open .sidebar-caret {
  transform: rotate(180deg);
}

/* Sidebar Accordion Submenu */
.sidebar-submenu {
  margin: 0.25rem 0 0.5rem 1rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: all var(--transition-normal);
}

.sidebar-submenu.collapsed {
  display: none;
}

/* Prominent Create Exam Button in Submenu */
.sidebar-create-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.45rem;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
  transition: all var(--transition-fast);
  text-align: left;
  user-select: none;
}

.sidebar-create-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  filter: brightness(1.05);
}

.sidebar-sub-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: all var(--transition-fast);
  font-family: inherit;
  user-select: none;
}

.sidebar-sub-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-main);
}

.sidebar-sub-item.active {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 700;
}

.sidebar-sub-badge {
  font-size: 0.68rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-weight: 700;
}

.sidebar-sub-item.active .sidebar-sub-badge {
  background: var(--primary);
  color: #ffffff;
}

/* Section Group Headers inside Submenu (Bé Học 3D vs Kho 17K vs Ma Trận Tìm Từ) */
.sidebar-group-header {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.65rem 0.85rem;
  margin: 0.75rem 0 0.35rem 0;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.sidebar-group-header:first-of-type {
  margin-top: 0.35rem;
}

.sidebar-group-header .group-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.sidebar-group-header .group-title .group-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.sidebar-group-header .group-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.2px;
  transition: all var(--transition-fast);
}

/* Children container tree indentation */
.sidebar-group-children {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 0.85rem;
  padding-left: 0.65rem;
  margin-bottom: 0.6rem;
  border-left: 2px solid rgba(0, 0, 0, 0.08);
}

.sidebar-group-children.group-children-kids {
  border-left-color: rgba(2, 132, 199, 0.3);
}

.sidebar-group-children.group-children-full {
  border-left-color: rgba(217, 119, 6, 0.3);
}

/* 1. DÀNH CHO BÉ (3D): Fresh Sky Blue / Cyan theme */
.sidebar-group-header.header-kids {
  background: #f0f9ff;
  border-color: #7dd3fc;
}
.sidebar-group-header.header-kids .group-title {
  color: #0369a1;
}
.sidebar-group-header.header-kids .group-badge.badge-kids {
  background: #0284c7;
  color: #ffffff;
}
.sidebar-group-header.header-kids:hover {
  background: #e0f2fe;
  border-color: #38bdf8;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.2);
}
.sidebar-group-header.header-kids.active-group {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border-color: #0284c7;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}
.sidebar-group-header.header-kids.active-group .group-title {
  color: #ffffff;
}
.sidebar-group-header.header-kids.active-group .group-badge.badge-kids {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.45);
}

/* 2. KHO 17.000+ TỪ VỰNG: Warm Gold / Amber theme */
.sidebar-group-header.header-full {
  background: #fffbeb;
  border-color: #fde68a;
}
.sidebar-group-header.header-full .group-title {
  color: #b45309;
}
.sidebar-group-header.header-full .group-badge.badge-gold {
  background: #d97706;
  color: #ffffff;
}
.sidebar-group-header.header-full:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(217, 119, 6, 0.2);
}
.sidebar-group-header.header-full.active-group {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  border-color: #d97706;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
}
.sidebar-group-header.header-full.active-group .group-title {
  color: #ffffff;
}
.sidebar-group-header.header-full.active-group .group-badge.badge-gold {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.45);
}

/* 3. MA TRẬN TÌM TỪ: Royal Purple / Violet theme (ngang hàng ở dưới cùng) */
.sidebar-group-header.header-wordsearch {
  background: #faf5ff;
  border-color: #e9d5ff;
  margin-top: 0.85rem;
}
.sidebar-group-header.header-wordsearch .group-title {
  color: #6b21a8;
}
.sidebar-group-header.header-wordsearch .group-badge.badge-purple {
  background: #7c3aed;
  color: #ffffff;
}
.sidebar-group-header.header-wordsearch:hover {
  background: #f3e8ff;
  border-color: #a855f7;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(124, 58, 237, 0.2);
}
.sidebar-group-header.header-wordsearch.active-group {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  border-color: #7c3aed;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}
.sidebar-group-header.header-wordsearch.active-group .group-title {
  color: #ffffff;
}
.sidebar-group-header.header-wordsearch.active-group .group-badge.badge-purple {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.45);
}

/* Dark mode adjustments */
[data-theme="dark"] .sidebar-group-children {
  border-left-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .sidebar-group-children.group-children-kids {
  border-left-color: rgba(56, 189, 248, 0.35);
}
[data-theme="dark"] .sidebar-group-children.group-children-full {
  border-left-color: rgba(251, 191, 36, 0.35);
}

[data-theme="dark"] .sidebar-group-header.header-kids {
  background: rgba(2, 132, 199, 0.18);
  border-color: rgba(56, 189, 248, 0.4);
}
[data-theme="dark"] .sidebar-group-header.header-kids .group-title { color: #38bdf8; }
[data-theme="dark"] .sidebar-group-header.header-kids .group-badge.badge-kids {
  background: rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

[data-theme="dark"] .sidebar-group-header.header-full {
  background: rgba(217, 119, 6, 0.18);
  border-color: rgba(251, 191, 36, 0.4);
}
[data-theme="dark"] .sidebar-group-header.header-full .group-title { color: #fbbf24; }
[data-theme="dark"] .sidebar-group-header.header-full .group-badge.badge-gold {
  background: rgba(251, 191, 36, 0.25);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

[data-theme="dark"] .sidebar-group-header.header-wordsearch {
  background: rgba(124, 58, 237, 0.18);
  border-color: rgba(192, 132, 252, 0.4);
}
[data-theme="dark"] .sidebar-group-header.header-wordsearch .group-title { color: #c084fc; }
[data-theme="dark"] .sidebar-group-header.header-wordsearch .group-badge.badge-purple {
  background: rgba(192, 132, 252, 0.25);
  color: #c084fc;
  border: 1px solid rgba(192, 132, 252, 0.4);
}


/* Math Grade Selector Card inside Math Submenu */
.math-grade-selector-card {
  margin: 0.25rem 0.5rem 0.6rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.math-grade-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.math-grade-header strong {
  color: var(--primary);
  font-weight: 800;
}

.math-grade-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.math-grade-pill {
  padding: 0.4rem 0.2rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-main);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
}

.math-grade-pill:hover {
  border-color: var(--primary-light);
  background: var(--primary-bg);
  color: var(--primary);
}

.math-grade-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}

/* Creator Modal Styles */
.btn-preset-chip {
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.btn-preset-chip:hover {
  background: var(--primary-bg);
  border-color: var(--primary-light);
  color: var(--primary);
}

.creator-label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-main);
}

.sidebar-nav-btn .nav-btn-badge.badge-new {
  background: #fef3c7;
  color: #b45309;
}

.sidebar-nav-btn .nav-btn-badge.badge-print {
  background: #ede9fe;
  color: #6d28d9;
}

.sidebar-nav-btn.active .nav-btn-badge {
  background: var(--primary);
  color: #ffffff;
}

/* Sidebar Bottom Footer */
.sidebar-footer {
  margin-top: auto;
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.sidebar-footer-row {
  display: flex;
  gap: 0.5rem;
}

.sidebar-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sidebar-action-btn:hover {
  background: var(--bg-primary);
  border-color: var(--border-hover);
}

/* App Main Wrapper (Right side of screen) */
.app-main-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  font-size: 1.25rem;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  cursor: pointer;
}

/* Mobile Sidebar Backdrop */
.sidebar-backdrop {
  display: none;
}

@media (max-width: 992px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 999;
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .mobile-menu-btn {
    display: flex;
  }
}

/* ==========================================================================
   ENGLISH HUB & VOCABULARY STYLING
   ========================================================================== */
.english-hub-header {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  padding: 2rem;
  border-radius: var(--radius-xl);
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.3);
}

.english-hub-title {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.english-hub-desc {
  font-size: 0.95rem;
  opacity: 0.9;
}

.english-subtabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.eng-subtab-btn {
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.eng-subtab-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-main);
}

.eng-subtab-btn.active {
  background: var(--primary-bg);
  color: var(--primary);
}

/* Vocab Themes Chips */
.vocab-theme-chips {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
}

.v-chip {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.v-chip:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.v-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ==========================================================================
   PREMIUM KIDS ENGLISH VOCAB FLASHCARDS
   ========================================================================== */
.vocab-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.vocab-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.vocab-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.08);
  border-color: var(--primary-light);
}

/* Large Hero Image Stage */
.vocab-hero-wrap {
  width: 100%;
  height: 145px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.07) 0%, rgba(147, 197, 253, 0.16) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 1rem;
  overflow: hidden;
}

.vocab-hero-img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.12));
}

.vocab-card:hover .vocab-hero-img {
  transform: scale(1.14);
}

.vocab-hero-level {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.vocab-hero-level.starters { color: #059669; }
.vocab-hero-level.movers { color: #d97706; }
.vocab-hero-level.flyers { color: #7c3aed; }

.vocab-hero-audio-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: none;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  transition: all var(--transition-fast);
}

.vocab-hero-audio-btn:hover {
  transform: scale(1.15);
  background: var(--primary);
  color: #ffffff;
}

.vocab-hero-audio-btn:active {
  transform: scale(0.95);
}

/* Card Body Content */
.vocab-card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
}

.vocab-word {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.5px;
  margin-bottom: 0.2rem;
  text-transform: lowercase;
}

.vocab-ipa {
  font-family: monospace;
  font-size: 0.9rem;
  color: #7c3aed;
  font-weight: 700;
  background: rgba(124, 58, 237, 0.08);
  padding: 0.2rem 0.75rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.5rem;
}

.vocab-meaning {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.vocab-example {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  width: 100%;
  font-size: 0.82rem;
  text-align: left;
  line-height: 1.45;
  margin-top: auto;
  border: 1px dashed var(--border-color);
}

.vocab-example-en {
  color: var(--text-main);
  font-style: italic;
  font-weight: 600;
  margin-bottom: 2px;
}

.vocab-example-vi {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.vocab-audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-tertiary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.vocab-audio-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* ==========================================================================
   WORD SEARCH PUZZLE STYLING
   ========================================================================== */
.ws-puzzles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.ws-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all var(--transition-normal);
}

.ws-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.ws-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.ws-card-icon {
  font-size: 1.75rem;
}

.ws-card-title {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-main);
}

.ws-card-tags {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.ws-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.ws-card-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-play-ws {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
}

.btn-print-ws {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.85rem;
  background: var(--bg-tertiary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
}

/* Word Search Interactive Game Modal */
.ws-player-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
}

@media (max-width: 850px) {
  .ws-player-layout {
    grid-template-columns: 1fr;
  }
}

.ws-grid-board {
  display: inline-grid;
  gap: var(--ws-cell-gap, 4px);
  background: #cbd5e1;
  padding: 8px;
  border-radius: var(--radius-lg);
  user-select: none;
  touch-action: none;
  margin: 0 auto;
  max-width: 100%;
  overflow-x: auto;
}

.ws-grid-cell {
  width: var(--ws-cell-size, 38px);
  height: var(--ws-cell-size, 38px);
  background: #ffffff;
  border-radius: var(--ws-cell-radius, 6px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: var(--ws-cell-font, 1.15rem);
  font-weight: 800;
  color: #1e293b;
  cursor: pointer;
  transition: background 0.1s ease;
}

.ws-grid-cell.selected {
  background: #fde047;
  color: #000;
}

.ws-grid-cell.preview-line {
  background: #fef08a;
  color: #854d0e;
}

.ws-grid-cell.found {
  background: #86efac;
  color: #065f46;
}

.ws-grid-cell.found-2 { background: #93c5fd; color: #1e3a8a; }
.ws-grid-cell.found-3 { background: #f9a8d4; color: #831843; }
.ws-grid-cell.found-4 { background: #fed7aa; color: #7c2d12; }
.ws-grid-cell.found-5 { background: #c4b5fd; color: #4c1d95; }

.ws-word-bank {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.ws-word-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.4rem;
  background: var(--bg-tertiary);
  font-weight: 700;
  font-size: 0.9rem;
}

.ws-word-item.found {
  text-decoration: line-through;
  opacity: 0.5;
  background: #ecfdf5;
  color: #065f46;
}

/* ==========================================================================
   MATH WORKSHEET STUDIO & A4 PRINTING STYLES (PINTEREST STYLE)
   ========================================================================== */
.worksheet-studio-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.ws-studio-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.ws-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ws-preset-card {
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
  background: var(--bg-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ws-preset-card:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.ws-preset-card.active {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: var(--shadow-md);
}

.ws-control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ws-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ws-control-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.ws-control-select {
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-main);
  font-weight: 600;
}

/* Virtual Numpad for Math Input */
.math-fillin-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1.5rem 0;
}

.math-fillin-display {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.math-input-box {
  width: 100px;
  height: 60px;
  border: 3px solid var(--primary);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: #1e293b;
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 260px;
}

.numpad-btn {
  height: 52px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.numpad-btn:hover {
  background: var(--bg-tertiary);
}

.numpad-btn:active {
  transform: scale(0.96);
}

/* ==========================================================================
   PRINTABLE A4 WORKSHEET (PINTEREST STYLE)
   ========================================================================== */
.a4-worksheet-sheet {
  background: #ffffff !important;
  color: #000000 !important;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 30px;
  box-shadow: var(--shadow-lg);
  border: 1px solid #cbd5e1;
  font-family: 'Plus Jakarta Sans', Arial, sans-serif;
}

.a4-ws-header {
  border-bottom: 2px solid #000000;
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.a4-ws-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.a4-ws-title {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  text-transform: uppercase;
}

.a4-ws-box-num {
  width: 44px;
  height: 44px;
  border: 2px solid #000;
  font-size: 1.5rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.a4-ws-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  font-weight: 600;
}

.a4-ws-columns-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: 24px;
  row-gap: 14px;
  margin-bottom: 30px;
}

.a4-ws-columns-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 36px;
  row-gap: 16px;
  margin-bottom: 30px;
}

.a4-ws-math-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Courier New', Courier, monospace, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 4px 0;
}

.a4-ws-math-item .blank-line {
  display: inline-block;
  width: 50px;
  border-bottom: 1.5px solid #000000;
  margin-left: 8px;
}

.a4-ws-footer {
  border-top: 2px solid #000000;
  padding-top: 14px;
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.95rem;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }
  body * {
    visibility: hidden;
  }
  .print-area-active, .print-area-active * {
    visibility: visible;
  }
  .print-area-active {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border: none;
  }
  .no-print {
    display: none !important;
  }
  .page-break-after {
    page-break-after: always;
  }
}

/* ========================================================
   PRE-MADE MATH DRILLS (BỘ ĐỀ TÍNH NHẨM SOẠN SẴN)
   ======================================================== */
.math-drills-promo-card {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(124, 58, 237, 0.08) 100%);
  border: 1.5px solid rgba(37, 99, 235, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 0.5rem;
}

.math-drills-promo-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.15);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, rgba(124, 58, 237, 0.12) 100%);
}

.promo-card-icon {
  font-size: 2.2rem;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

[data-theme="dark"] .promo-card-icon {
  background: var(--bg-tertiary);
}

.promo-card-body {
  flex: 1;
}

.promo-card-tag {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: var(--primary);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
}

.promo-card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 0.35rem 0;
}

.promo-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
}

.promo-card-btn {
  padding: 0.65rem 1.2rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.promo-card-btn:hover {
  background: var(--primary-dark);
  transform: translateX(3px);
}

.math-drill-card {
  border-top: 3px solid var(--primary);
}

.math-drill-card:hover {
  border-top-color: var(--primary-dark);
}

@media (max-width: 640px) {
  .math-drills-promo-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
    gap: 0.75rem;
  }
  .promo-card-btn {
    width: 100%;
    text-align: center;
  }
}

/* Word Search Size Pills */
.ws-size-pills-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.ws-size-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 78px;
}

.ws-size-pill .pill-title {
  font-size: 0.88rem;
  font-weight: 800;
  font-family: var(--font-display);
}

.ws-size-pill .pill-sub {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 1px;
}

.ws-size-pill:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
  transform: translateY(-1px);
}

.ws-size-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}

.ws-size-pill.active .pill-title {
  color: #ffffff;
}

.ws-size-pill.active .pill-sub {
  color: rgba(255, 255, 255, 0.88);
}

/* ==========================================================================
   MULTI-SENSORY ENGLISH INTERACTIVE LEARNING MODES
   ========================================================================== */
.english-mode-bar {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding: 0.4rem 0.2rem 1rem 0.2rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--border-color);
  scrollbar-width: thin;
}

.eng-mode-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.15rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.eng-mode-btn:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.eng-mode-btn.active {
  background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.eng-mode-btn .eng-mode-icon {
  font-size: 1.15rem;
}

.eng-mode-badge {
  font-size: 0.68rem;
  font-weight: 800;
  background: #ef4444;
  color: #fff;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

/* ----------------------------------------------------
   MODE 1: 🎴 3D INTERACTIVE FLIP CARD & SPACED REPETITION
   ---------------------------------------------------- */
.flashcard-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1.5rem auto 2.5rem;
  max-width: 620px;
}

.fc-meta-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.fc-counter-badge {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
}

.fc-filter-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}

.fc-progress-track {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.fc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.flip-card-perspective {
  width: 100%;
  height: 380px;
  perspective: 1200px;
  cursor: pointer;
}

.flip-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: var(--radius-xl);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.09);
}

.flip-card-inner.is-flipped {
  transform: rotateY(180deg);
}

.flip-card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-xl);
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  overflow: hidden;
}

/* Front Face */
.fc-front {
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
}

.fc-front-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fc-theme-tag {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.fc-hero-img-wrap {
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.12) 0%, rgba(255, 255, 255, 0) 70%);
}

.fc-hero-img {
  max-width: 130px;
  max-height: 130px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.14));
  transition: transform 0.3s ease;
}

.flip-card-perspective:hover .fc-hero-img {
  transform: scale(1.08);
}

.fc-word-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.5px;
  text-align: center;
  margin: 0;
  font-family: var(--font-display, inherit);
}

.fc-word-ipa {
  font-size: 1.05rem;
  color: var(--text-muted);
  font-family: monospace;
  font-weight: 600;
  margin-top: 2px;
}

.fc-front-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.fc-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.fc-action-btn:hover {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
  transform: scale(1.05);
}

.fc-action-btn.mic-btn.listening {
  background: #fee2e2;
  border-color: #ef4444;
  color: #b91c1c;
  animation: pulse-red 1.2s infinite;
}

@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.fc-flip-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Back Face */
.fc-back {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, #f0fdf4 0%, var(--bg-card) 60%);
  justify-content: space-between;
  text-align: center;
}

.fc-back-meaning {
  font-size: 1.85rem;
  font-weight: 800;
  color: #15803d;
  margin: 1rem 0 0.5rem 0;
}

.fc-back-example-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin: 0.75rem 0;
  text-align: left;
}

.fc-example-en {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.5;
}

.fc-example-en mark {
  background: #fef08a;
  color: #854d0e;
  padding: 0 4px;
  border-radius: 4px;
  font-weight: 800;
}

.fc-example-vi {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  font-style: italic;
}

/* Flashcard Navigation & Spaced Repetition Controls */
.fc-nav-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  gap: 1rem;
}

.fc-nav-btn {
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.fc-nav-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--primary);
}

.fc-review-group {
  display: flex;
  gap: 0.75rem;
}

.fc-btn-unlearned {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-full);
  border: 1.5px solid #ef4444;
  background: #fef2f2;
  color: #dc2626;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.fc-btn-unlearned:hover {
  background: #fee2e2;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.fc-btn-mastered {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-full);
  border: 1.5px solid #10b981;
  background: #ecfdf5;
  color: #059669;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.fc-btn-mastered:hover {
  background: #d1fae5;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

/* ----------------------------------------------------
   MODE 2: 🃏 MEMORY MATCH GAME (Ghép Thẻ Trí Nhớ)
   ---------------------------------------------------- */
.memory-game-wrap {
  max-width: 800px;
  margin: 1.5rem auto 2.5rem;
}

.memory-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.memory-stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-main);
}

.memory-stat-item span.label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 640px) {
  .memory-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.mem-card-slot {
  height: 140px;
  perspective: 1000px;
  cursor: pointer;
}

.mem-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: var(--radius-lg);
}

.mem-card-inner.is-flipped {
  transform: rotateY(180deg);
}

.mem-card-front,
.mem-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Card Back (Faced down) */
.mem-card-back {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border: 2px solid #60a5fa;
  color: #ffffff;
}

.mem-card-back .mem-back-pattern {
  font-size: 2.2rem;
  opacity: 0.85;
}

/* Card Front (Faced up) */
.mem-card-front {
  transform: rotateY(180deg);
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  text-align: center;
}

.mem-card-front.matched {
  border-color: #10b981;
  background: #ecfdf5;
  animation: match-pulse 0.5s ease;
}

@keyframes match-pulse {
  0% { transform: rotateY(180deg) scale(1); }
  50% { transform: rotateY(180deg) scale(1.08); }
  100% { transform: rotateY(180deg) scale(1); }
}

.mem-card-inner.shake {
  animation: card-shake 0.5s ease;
}

@keyframes card-shake {
  0%, 100% { transform: rotateY(180deg) translateX(0); }
  25% { transform: rotateY(180deg) translateX(-6px); }
  75% { transform: rotateY(180deg) translateX(6px); }
}

/* ----------------------------------------------------
   MODE 3: 🎯 NGHE & BẮT TRANH (Picture Hunter)
   ---------------------------------------------------- */
.hunter-stage {
  max-width: 720px;
  margin: 1.5rem auto 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hunter-header-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.hunter-speaker-wrap {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.35);
  margin-bottom: 1rem;
  transition: all var(--transition-fast);
}

.hunter-speaker-wrap:hover {
  transform: scale(1.08);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.45);
}

.hunter-speaker-wrap.pulse-sound {
  animation: speaker-pulse 0.8s ease;
}

@keyframes speaker-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); box-shadow: 0 0 0 18px rgba(59, 130, 246, 0.2); }
  100% { transform: scale(1); }
}

.hunter-word-hint {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.hunter-prompt {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.hunter-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.hunter-option-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  min-height: 160px;
}

.hunter-option-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.hunter-option-card.correct {
  border-color: #10b981;
  background: #ecfdf5;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.25);
  transform: scale(1.04);
}

.hunter-option-card.wrong {
  border-color: #ef4444;
  background: #fef2f2;
  animation: card-shake 0.5s ease;
}

.hunter-option-img {
  width: 90px;
  height: 90px;
  object-fit: contain;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.08));
}

/* ----------------------------------------------------
   MODE 4: ✏️ ĐIỀN CHỮ & SPELLER (Word Scramble)
   ---------------------------------------------------- */
.speller-stage {
  max-width: 680px;
  margin: 1.5rem auto 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.speller-hero-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.speller-hero-img {
  width: 110px;
  height: 110px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.1));
}

.speller-slots-row {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
  min-height: 58px;
}

.speller-slot {
  width: 52px;
  height: 56px;
  border-radius: var(--radius-md);
  border: 2px dashed var(--border-color);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.speller-slot.filled {
  border-style: solid;
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
  animation: slot-pop 0.25s ease;
}

@keyframes slot-pop {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.speller-slot.success {
  border-color: #10b981;
  background: #10b981;
  color: #ffffff;
}

.speller-tiles-row {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.speller-tile-btn {
  width: 50px;
  height: 54px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 1.5rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
  transition: all var(--transition-fast);
}

.speller-tile-btn:hover {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.2);
}

.speller-tile-btn.used {
  opacity: 0.25;
  pointer-events: none;
  border-style: dashed;
}

.speller-actions-row {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

/* ----------------------------------------------------
   MODE 5: 🧩 GHÉP CÂU TƯƠNG TÁC (Sentence Builder)
   ---------------------------------------------------- */
.sentence-stage {
  max-width: 760px;
  margin: 1rem auto 2.5rem;
  display: flex;
  flex-direction: column;
}

.sentence-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.sentence-meta-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.sentence-counter-badge {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.sentence-streak-badge {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #ffffff;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(234, 88, 12, 0.3);
  animation: pulse-badge 1.8s infinite;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.sentence-score-badge {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 800;
}

[data-theme="dark"] .sentence-score-badge {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.sentence-skip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
}

/* Hero Prompt Card */
.sentence-hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.sentence-hero-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #3b82f6, #10b981, #f59e0b);
}

.sentence-hero-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.sentence-img-wrap {
  width: 105px;
  height: 105px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(16, 185, 129, 0.08) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(59, 130, 246, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.sentence-hero-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.12));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sentence-hero-img:hover {
  transform: scale(1.1) rotate(-3deg);
}

.sentence-fallback-icon {
  font-size: 3.5rem;
  align-items: center;
  justify-content: center;
}

.sentence-vocab-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}

.sentence-vocab-tag .tag-en {
  font-weight: 800;
  color: var(--primary);
  text-transform: capitalize;
}

.sentence-vocab-tag .tag-vi {
  color: var(--text-muted);
}

.sentence-hero-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sentence-guide-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.sentence-vietnamese-prompt {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.45;
}

.sentence-audio-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.sentence-listen-btn {
  background: var(--primary-bg);
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.25);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.sentence-listen-btn:hover {
  background: var(--primary);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.sentence-mini-btn {
  background: var(--bg-secondary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sentence-mini-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Assembly Drop Zone */
.sentence-assembly-section {
  margin-bottom: 1.5rem;
}

.sentence-zone-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 0.6rem;
}

.sentence-zone-header .zone-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-main);
}

.sentence-zone-header .zone-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sentence-drop-zone {
  min-height: 82px;
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  transition: all var(--transition-normal);
}

.sentence-drop-zone.success-glow {
  border-style: solid;
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
}

.sentence-placeholder {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-style: italic;
  width: 100%;
  justify-content: center;
  padding: 0.5rem 0;
}

.sentence-placed-tokens {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  width: 100%;
}

.sentence-punctuation-mark {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--primary);
  margin-left: 2px;
  line-height: 1;
}

/* Word Pills (Buttons) */
.sentence-word-pill {
  appearance: none;
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-pill);
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.08), 0 6px 12px rgba(0, 0, 0, 0.05);
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.sentence-word-pill:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
}

.sentence-word-pill.placed-pill {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #3b82f6;
  color: #1d4ed8;
  animation: sentence-pop 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] .sentence-word-pill.placed-pill {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(29, 78, 216, 0.3) 100%);
  border-color: #60a5fa;
  color: #93c5fd;
}

.sentence-word-pill.placed-pill .pill-remove-x {
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0.55;
  transition: opacity 0.15s;
}

.sentence-word-pill.placed-pill:hover .pill-remove-x {
  opacity: 1;
  color: #ef4444;
}

.sentence-word-pill.placed-pill.correct-pill {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #047857;
  color: #ffffff;
  box-shadow: 0 4px 0 #047857, 0 8px 16px rgba(16, 185, 129, 0.3);
}

.sentence-word-pill.placed-pill.correct-pill .pill-remove-x {
  display: none;
}

/* Word Bank */
.sentence-bank-section {
  margin-bottom: 1.75rem;
}

.sentence-bank-header {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.sentence-bank-grid {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  padding: 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  min-height: 80px;
  align-items: center;
}

.sentence-word-pill.bank-pill:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 6px 0 rgba(37, 99, 235, 0.25), 0 8px 16px rgba(37, 99, 235, 0.15);
}

.sentence-word-pill.bank-pill.used-pill,
.sentence-word-pill.bank-pill:disabled {
  opacity: 0.22;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  border-style: dashed;
  background: transparent;
}

/* Bottom Action Bar */
.sentence-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.sentence-actions-bar .actions-left,
.sentence-actions-bar .actions-right {
  display: flex;
  gap: 0.75rem;
}

.sentence-btn {
  appearance: none;
  border: none;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.sentence-btn.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.sentence-btn.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--text-muted);
  transform: translateY(-2px);
}

.sentence-btn.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.sentence-btn.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.45);
}

.sentence-btn.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.sentence-btn.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.5);
}

.pulse-anim {
  animation: pulse-button 1.6s infinite;
}

@keyframes pulse-button {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

@keyframes sentence-pop {
  0% { transform: scale(0.75); opacity: 0; }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}

.sentence-shake {
  animation: shake-anim 0.4s ease;
}

@keyframes shake-anim {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

@media (max-width: 640px) {
  .sentence-hero-card {
    flex-direction: column;
    text-align: center;
    padding: 1.25rem 1rem;
    gap: 1rem;
  }
  .sentence-audio-controls {
    justify-content: center;
  }
  .sentence-actions-bar {
    flex-direction: column;
    width: 100%;
  }
  .sentence-actions-bar .actions-left,
  .sentence-actions-bar .actions-right {
    width: 100%;
    justify-content: center;
  }
  .sentence-btn {
    flex: 1;
    justify-content: center;
  }
}

/* ==========================================================================
   MODERN SLEEK ENGLISH WORKSPACE HEADER & SEGMENTED CONTROLLER
   ========================================================================== */
.eng-modern-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .eng-modern-header {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.8) 100%);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  backdrop-filter: blur(12px);
}

.eng-modern-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
}

.eng-header-left {
  width: 100%;
}

.eng-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.25);
  margin-bottom: 0.35rem;
}

[data-theme="dark"] .eng-header-badge {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.3);
}

.eng-header-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 0.35rem 0;
  line-height: 1.3;
}

.eng-header-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
  max-width: 900px;
}

.eng-header-right {
  display: flex;
  align-items: center;
  width: 100%;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

/* Modern Segmented Controller */
.eng-segment-control {
  display: inline-flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border-color);
  padding: 4px;
  border-radius: var(--radius-full);
  gap: 4px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .eng-segment-control {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
}

.eng-segment-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.eng-segment-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.eng-segment-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .eng-segment-btn.active {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.eng-segment-btn .segment-icon {
  font-size: 1.05rem;
}

.eng-segment-btn .segment-pill {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.eng-segment-btn.active .segment-pill {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
}

[data-theme="dark"] .eng-segment-btn.active .segment-pill {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.eng-segment-btn .segment-pill.gold {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

[data-theme="dark"] .eng-segment-btn .segment-pill.gold {
  background: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
}

@media (max-width: 900px) {
  .eng-modern-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .eng-header-right {
    width: 100%;
    justify-content: space-between;
  }
}

/* ==========================================================================
   DICTIONARY (17,000+ WORDS) CONTROL PANEL
   ========================================================================== */
.dict-control-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.dict-search-wrap {
  display: flex;
  align-items: center;
  position: relative;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.35rem 0.75rem;
  margin-bottom: 1.25rem;
  transition: all var(--transition-fast);
}

.dict-search-wrap:focus-within {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.dict-search-icon {
  font-size: 1.3rem;
  margin-right: 0.6rem;
  color: var(--text-muted);
}

.dict-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  padding: 0.4rem 0;
  min-width: 0;
}

.dict-search-clear-btn {
  background: rgba(0, 0, 0, 0.08);
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  margin-right: 0.5rem;
  transition: all var(--transition-fast);
}

.dict-search-clear-btn:hover {
  background: #ef4444;
  color: #fff;
}

.dict-search-badge {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

/* Modern Smart Dropdowns & Filter Toolbar */
/* Modern Smart Dropdowns & Filter Toolbar */
.dict-filter-toolbar {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 0.95fr auto;
  gap: 0.85rem;
  align-items: flex-end;
  background: var(--bg-tertiary);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.math-drills-filter-bar {
  grid-template-columns: 1fr 1.35fr auto;
  width: 100%;
  margin-bottom: 0.75rem;
}

.ws-filter-toolbar {
  grid-template-columns: 1.1fr 1.5fr auto;
  width: 100%;
}

@media (max-width: 1024px) {
  .dict-filter-toolbar,
  .math-drills-filter-bar,
  .ws-filter-toolbar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .dict-filter-toolbar,
  .math-drills-filter-bar,
  .ws-filter-toolbar {
    grid-template-columns: 1fr;
  }
}

.dict-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.dict-filter-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dict-select-wrapper {
  position: relative;
  width: 100%;
}

.dict-select {
  width: 100%;
  height: 40px;
  padding: 0 2.2rem 0 0.85rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-main);
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: var(--shadow-sm);
}

.dict-select:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.dict-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.dict-select optgroup {
  font-weight: 800;
  color: var(--primary);
  background-color: var(--bg-card);
  padding: 4px 0;
}

.dict-select option {
  font-weight: 500;
  color: var(--text-main);
  background-color: var(--bg-card);
  padding: 6px 10px;
}

.dict-select-wrapper::after {
  content: "";
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 9px;
  height: 6px;
  background-color: var(--text-muted);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  pointer-events: none;
  transition: transform var(--transition-fast);
}

.dict-select-wrapper:focus-within::after {
  transform: translateY(-50%) rotate(180deg);
  background-color: var(--primary);
}

.dict-filter-toggles-col {
  justify-content: flex-end;
}

.dict-toggles-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  height: 40px;
}

.dict-toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 40px;
  padding: 0 0.85rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.dict-toggle-chip:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
}

.dict-toggle-chip.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(59, 130, 246, 0.2));
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.dict-reset-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 40px;
  padding: 0 0.85rem;
  border-radius: var(--radius-md);
  border: 1.5px dashed #ef4444;
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

/* Word Search Creator Modal Source Tabs */
.ws-creator-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 1.25rem;
  background: var(--bg-tertiary);
  padding: 4px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.ws-creator-tab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.ws-creator-tab-btn:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .ws-creator-tab-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.ws-creator-tab-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  border-color: var(--border-color);
  box-shadow: var(--shadow-sm);
}

.ws-word-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.35rem 0.65rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.ws-word-tag .ws-tag-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.dict-reset-filter-btn:hover {
  background: #ef4444;
  color: #ffffff;
  border-style: solid;
}

/* Fallback legacy helpers */
.dict-group-tabs-row, .dict-cat-chips-wrap, .dict-subfilters-row {
  display: none;
}

.dict-pos-btn:hover {
  color: var(--text-main);
  border-color: var(--primary);
}

.dict-pos-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* Status Bar */
.dict-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding: 0 0.5rem;
}

.dict-status-text {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
}

.dict-status-text strong {
  color: var(--text-main);
}

.dict-reset-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: #ef4444;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dict-reset-btn:hover {
  background: #fee2e2;
  border-color: #ef4444;
}

/* ==========================================================================
   DICTIONARY CARDS GRID & CARD DESIGN
   ========================================================================== */
.dict-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.dict-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.dict-card:hover {
  transform: translateY(-3px);
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.dict-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.dict-card-word-wrap {
  flex: 1;
  min-width: 0;
}

.dict-card-word {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  letter-spacing: -0.2px;
}

.dict-card-ipa {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  color: var(--primary);
  margin-top: 2px;
  font-weight: 600;
}

.dict-audio-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--primary);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.dict-audio-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  transform: scale(1.1);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.dict-audio-btn.speaking {
  animation: audioPulse 0.8s infinite;
  background: #10b981;
  border-color: #10b981;
  color: #fff;
}

@keyframes audioPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.dict-card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}

.dict-badge-type {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 4px;
  background: rgba(100, 116, 139, 0.12);
  color: #475569;
}

.dict-badge-type.noun { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.dict-badge-type.verb { background: rgba(16, 185, 129, 0.12); color: #059669; }
.dict-badge-type.adj  { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.dict-badge-type.adv  { background: rgba(139, 92, 246, 0.12); color: #7c3aed; }

.dict-badge-course {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* Meaning */
.dict-meaning {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.45;
  margin-bottom: 0.85rem;
  padding: 0.4rem 0.65rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border-left: 3px solid #10b981;
}

/* 3D Visual Preview row if has_image */
.dict-card-media {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.04), rgba(16, 185, 129, 0.04));
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.dict-media-thumb {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: #ffffff;
  padding: 3px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.dict-media-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
}

/* Example Box */
.dict-example-box {
  margin-top: auto;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px dashed var(--border-color);
  font-size: 0.82rem;
  line-height: 1.45;
}

.dict-example-en {
  color: var(--text-main);
  font-weight: 600;
  font-style: italic;
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}

.dict-mini-speak-btn {
  background: transparent;
  border: none;
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0.7;
  padding: 0;
  flex-shrink: 0;
  margin-top: 2px;
}
.dict-mini-speak-btn:hover {
  opacity: 1;
}

.dict-example-vi {
  color: var(--text-muted);
  font-size: 0.76rem;
  margin-top: 3px;
  padding-left: 1.1rem;
}

/* Pagination Bar */
.dict-pagination-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 1.5rem 0 2.5rem;
}

.dict-page-btn {
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.dict-page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.dict-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dict-page-info {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-muted);
  padding: 0 0.5rem;
}

.dict-loadmore-btn {
  padding: 0.65rem 1.75rem;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
  color: #ffffff;
  border: none;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
  transition: all var(--transition-fast);
}

.dict-loadmore-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

/* ========================================================
   TIẾNG VIỆT & CAMBRIDGE READING & LEARNING CARDS
   ======================================================== */
.reading-passage-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid #dc2626;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.reading-passage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--border-color);
}

.reading-passage-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #dc2626;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

[data-theme="dark"] .reading-passage-title {
  color: #f87171;
}

.reading-passage-author {
  font-size: 0.82rem;
  font-style: italic;
  color: var(--text-muted);
}

.reading-passage-body {
  font-size: 1.02rem;
  line-height: 1.8;
  color: var(--text-main);
  white-space: pre-line;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.reading-vocab-notes {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.reading-vocab-notes strong {
  color: var(--primary);
}

/* Cambridge Vocab Card */
.cambridge-vocab-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid #7c3aed;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.cambridge-vocab-header {
  font-size: 1rem;
  font-weight: 800;
  color: #7c3aed;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

[data-theme="dark"] .cambridge-vocab-header {
  color: #a78bfa;
}

.cam-vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.cam-vocab-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: transform var(--transition-fast);
}

.cam-vocab-item:hover {
  transform: translateY(-2px);
  border-color: #a78bfa;
}

.cam-word-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cam-word-text {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-main);
}

.cam-word-audio-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.cam-word-audio-btn:hover {
  background: var(--primary-bg);
}

.cam-word-ipa {
  font-family: monospace;
  font-size: 0.8rem;
  color: #7c3aed;
  font-weight: 600;
}

.cam-word-meaning-en {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.cam-word-meaning-vi {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Grammar Rule Card */
.grammar-rule-card {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  color: #92400e;
  font-size: 0.92rem;
  line-height: 1.6;
}

[data-theme="dark"] .grammar-rule-card {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fde68a;
}

.grammar-rule-header {
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Quick Grade Switcher Bar */
.grade-quick-switcher {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.quick-switcher-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--text-main);
  white-space: nowrap;
}

.quick-switcher-pills {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.quick-grade-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quick-grade-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.quick-grade-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.quick-grade-pill.active-tv {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #dc2626 !important;
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.35) !important;
}

.quick-grade-pill.active-cam {
  background: #7c3aed !important;
  color: #ffffff !important;
  border-color: #7c3aed !important;
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.35) !important;
}

.quick-grade-pill .pill-count {
  font-size: 0.75rem;
  opacity: 0.85;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.08);
}

.quick-grade-pill.active .pill-count,
.quick-grade-pill.active-tv .pill-count,
.quick-grade-pill.active-cam .pill-count {
  background: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   17K VOCABULARY COMPREHENSIVE INTERACTIVE LEARNING STYLES
   ========================================================================== */
.dict-mode-bar {
  margin-bottom: 1.25rem;
}

.dict-fc-perspective {
  width: 100%;
  height: 420px;
  perspective: 1200px;
  cursor: pointer;
}

.dict-fc-example-box {
  width: 100%;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--primary);
  text-align: left;
}

.dict-fc-example-en {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.dict-fc-example-vi {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
  padding-left: 1.6rem;
}

.dict-quiz-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  width: 100%;
  margin-top: 1.25rem;
}

@media (max-width: 600px) {
  .dict-quiz-grid {
    grid-template-columns: 1fr;
  }
}

.dict-quiz-option {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.dict-quiz-option:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.dict-quiz-option.correct {
  border-color: #10b981 !important;
  background: #ecfdf5 !important;
  color: #065f46 !important;
}

[data-theme="dark"] .dict-quiz-option.correct {
  background: #064e3b !important;
  color: #a7f3d0 !important;
}

.dict-quiz-option.wrong {
  border-color: #ef4444 !important;
  background: #fef2f2 !important;
  color: #991b1b !important;
}

[data-theme="dark"] .dict-quiz-option.wrong {
  background: #7f1d1d !important;
  color: #fecaca !important;
}

.dict-speller-wrap {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}

/* ==========================================================
   FAMILY PROGRESS & COMPARISON MODAL STYLES
========================================================== */
.btn-analytics-header {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.btn-analytics-header:hover {
  background: var(--primary);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.analytics-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1.25rem;
  padding-bottom: 0.25rem;
}

.analytics-tab-btn {
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.analytics-tab-btn.active {
  color: var(--primary);
  background: var(--primary-bg);
}

.analytics-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 3px;
}

/* Podium Cards */
.leaderboard-podium-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.podium-card {
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.podium-card.gold {
  border-color: #f59e0b;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, var(--bg-card) 100%);
}

.podium-card.blue {
  border-color: #2563eb;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.08) 0%, var(--bg-card) 100%);
}

.podium-card.green {
  border-color: #10b981;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.08) 0%, var(--bg-card) 100%);
}

.podium-badge-icon {
  font-size: 2.2rem;
  margin-bottom: 0.25rem;
}

.podium-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.podium-card.gold .podium-title { color: #d97706; }
.podium-card.blue .podium-title { color: #2563eb; }
.podium-card.green .podium-title { color: #059669; }

.podium-student-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.podium-value {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--primary);
}

/* Family Table */
.family-compare-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  background: var(--bg-card);
}

.family-compare-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.family-compare-table th {
  background: var(--bg-tertiary);
  padding: 0.75rem 1rem;
  font-weight: 800;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.family-compare-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.family-compare-table tr:last-child td {
  border-bottom: none;
}

/* Attempt history cards */
.attempt-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  margin-bottom: 0.85rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.attempt-header {
  padding: 0.85rem 1.15rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: var(--bg-card);
  user-select: none;
}

.attempt-header:hover {
  background: var(--bg-tertiary);
}

.attempt-detail-body {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.attempt-q-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.attempt-q-table th {
  padding: 0.5rem 0.75rem;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-weight: 700;
  text-align: left;
}

.attempt-q-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.time-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.75rem;
}

.time-tag.fast {
  background: #ecfdf5;
  color: #059669;
}

.time-tag.normal {
  background: #eff6ff;
  color: #2563eb;
}

.time-tag.slow {
  background: #fef2f2;
  color: #dc2626;
  font-weight: 800;
}

/* Evaluation & Pass/Fail Badges */
.eval-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.eval-badge.passed {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.eval-badge.excellent {
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fde68a;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.eval-badge.failed {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.eval-badge.time-badge {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.eval-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.76rem;
  font-weight: 800;
}

.eval-pill.pass {
  background: #ecfdf5;
  color: #059669;
}

.eval-pill.excellent {
  background: #fef3c7;
  color: #b45309;
}

.eval-pill.fail {
  background: #fef2f2;
  color: #dc2626;
}

.speed-tag-exam {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.76rem;
  font-weight: 700;
}

.speed-tag-exam.fastest {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #6ee7b7;
  font-weight: 800;
}

.speed-tag-exam.slowest {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* ==========================================================
   ERROR NOTEBOOK (SỔ TAY CÂU SAI & ÔN LUYỆN) STYLES
========================================================== */
.btn-wrong-q-header {
  border-color: #ef4444 !important;
  background: #fef2f2 !important;
  color: #dc2626 !important;
}

.btn-wrong-q-header:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
}

[data-theme="dark"] .btn-wrong-q-header {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: #ef4444 !important;
  color: #f87171 !important;
}

[data-theme="dark"] .btn-wrong-q-header:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
}

.wrong-q-filter-bar {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.wrong-q-pill {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.wrong-q-pill.active {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

.wrong-q-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid #ef4444;
  border-radius: var(--radius-md);
  padding: 1.15rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.wrong-q-card:hover {
  box-shadow: var(--shadow-md);
}

.wrong-q-card.mastered {
  border-left-color: #10b981;
  opacity: 0.85;
}

.wrong-q-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}

.wrong-q-exam-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.wrong-q-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.wrong-q-compare-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

@media (max-width: 640px) {
  .wrong-q-compare-box {
    grid-template-columns: 1fr;
  }
}

.wrong-ans-pane {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  font-size: 0.88rem;
}

[data-theme="dark"] .wrong-ans-pane {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

.correct-ans-pane {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  font-size: 0.88rem;
}

[data-theme="dark"] .correct-ans-pane {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
}

.wrong-q-practice-box {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1rem;
  border: 1.5px solid var(--primary);
}

.wrong-q-opt-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 0.65rem 1rem;
  margin-bottom: 0.5rem;
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.wrong-q-opt-btn:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
}

/* ==========================================================
   USER GUIDE MODAL (HƯỚNG DẪN HỌC TẬP HIỆU QUẢ) STYLES
========================================================== */
.guide-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1.25rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.guide-tab-btn {
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  position: relative;
}

.guide-tab-btn:hover {
  color: var(--primary);
}

.guide-tab-btn.active {
  color: var(--primary);
  background: var(--primary-bg);
}

.guide-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 3px;
}

.guide-step-card {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.guide-step-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.guide-step-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary);
  border: 2px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  flex-shrink: 0;
}

.guide-step-content {
  flex: 1;
}

.guide-step-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.guide-step-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 0.5rem;
}

.guide-tip-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  background: #fef3c7;
  color: #92400e;
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 0.35rem;
  border: 1px solid #fde68a;
}

[data-theme="dark"] .guide-tip-pill {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.guide-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 680px) {
  .guide-grid-2 {
    grid-template-columns: 1fr;
  }
  .guide-step-card {
    flex-direction: column;
    gap: 0.75rem;
  }
}

.guide-card-box {
  padding: 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.guide-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.guide-faq-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  margin-bottom: 0.75rem;
  background: var(--bg-card);
}

.guide-faq-q {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.guide-faq-a {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==========================================================================
   MODERN LEARNING CONTROLS TOOLBAR & DROPDOWNS (Kids & Dictionary)
   ========================================================================== */
.kids-toolbar-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 0.95rem 1.25rem;
  margin: 0.75rem 0 1.25rem 0;
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.kids-toolbar-card:hover {
  border-color: rgba(37, 99, 235, 0.25);
  box-shadow: 0 6px 20px -2px rgba(37, 99, 235, 0.08);
}

.ktc-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.ktc-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1 1 260px;
  min-width: 220px;
}

.ktc-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  user-select: none;
}

.ktc-icon {
  font-size: 0.95rem;
}

.ktc-select-wrapper {
  position: relative;
  width: 100%;
}

.ktc-select {
  width: 100%;
  height: 44px;
  padding: 0 2.5rem 0 1rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  background-color: var(--bg-card);
  border: 1.75px solid var(--border-color);
  border-radius: var(--radius-lg);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: var(--shadow-sm);
}

.ktc-select:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.ktc-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.ktc-select optgroup {
  font-weight: 800;
  color: var(--primary);
  background-color: var(--bg-card);
  padding: 4px 0;
}

.ktc-select option {
  font-weight: 600;
  color: var(--text-main);
  background-color: var(--bg-card);
  padding: 8px 12px;
}

.ktc-select-arrow {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 0.68rem;
  color: var(--text-muted);
  transition: transform var(--transition-fast), color var(--transition-fast);
}

.ktc-select-wrapper:focus-within .ktc-select-arrow {
  transform: translateY(-50%) rotate(180deg);
  color: var(--primary);
}

.ktc-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
}

.ktc-btn-shuffle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: 44px;
  padding: 0 1.15rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  background: var(--bg-card);
  border: 1.75px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.ktc-btn-shuffle:hover {
  background: rgba(37, 99, 235, 0.08);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.ktc-btn-shuffle:active {
  transform: translateY(0);
}

.ktc-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 1.1rem;
  background: rgba(37, 99, 235, 0.08);
  border: 1.75px solid rgba(37, 99, 235, 0.2);
  border-radius: var(--radius-lg);
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
  letter-spacing: 0.3px;
  user-select: none;
}

/* Dictionary Mode Dropdown Toolbar */
.dict-mode-dropdown-wrap {
  margin-bottom: 0.85rem;
}

@media (max-width: 768px) {
  .kids-toolbar-card {
    padding: 0.85rem 1rem;
  }
  .ktc-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }
  .ktc-field {
    min-width: 100%;
  }
  .ktc-actions {
    justify-content: space-between;
    width: 100%;
  }
  .ktc-btn-shuffle,
  .ktc-count-pill {
    flex: 1;
    justify-content: center;
  }
}








/* Câu đã số hoá: đề bài là chữ (không còn ảnh chứa đề) */
#q-text-caption.q-digitized-text { white-space: pre-line; font-size: 1.15rem !important; font-weight: 600; color: var(--text-main, #0f172a) !important; line-height: 1.55; margin: 0.25rem 0 0.75rem; }

/* B13 — màn hẹp (≤480px): nút «Thoát» không xuống dòng, thanh chip đầu trang cuộn ngang thay vì bị cắt */
@media (max-width: 480px) {
  .quiz-info { flex: 0 0 auto !important; }
  .quiz-info .nav-btn { white-space: nowrap; flex-shrink: 0; padding: 0.45rem 0.6rem; }
  .quiz-stats-group .hide-xs { display: none; }
  .quiz-stats-group .nav-btn { padding: 0.45rem 0.6rem; white-space: nowrap; }
  .navbar { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .navbar::-webkit-scrollbar { display: none; }
  .navbar .btn-analytics-header { white-space: nowrap; flex-shrink: 0; }
}
