/* HSK Vocabulary Flashcards - Design Tokens & Stylesheet */

:root {
  /* Fonts */
  --font-sans: 'Be Vietnam Pro', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', 'Be Vietnam Pro', sans-serif;
  --font-handwriting: 'Be Vietnam Pro', sans-serif;
  --font-chinese: 'Noto Sans SC', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  --font-pinyin: 'Be Vietnam Pro', 'Inter', 'Segoe UI', Roboto, sans-serif;

  /* Layout */
  --nav-height: 70px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --container-width: 1200px;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Cartoon / Gamified Playful Theme Tokens (Duolingo & Quizlet Inspired) */
html {
  /* Fonts */
  --font-sans: 'Be Vietnam Pro', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', 'Be Vietnam Pro', sans-serif;
  --font-chinese: 'Noto Sans SC', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  --font-pinyin: 'Be Vietnam Pro', 'Inter', 'Segoe UI', Roboto, sans-serif;
  
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-xl: 36px;
  
  /* Cartoon Colors (Vibrant, Friendly & Engaging for Students) */
  --bg-primary: transparent;
  --bg-secondary: rgba(255, 255, 255, 0.65);
  --bg-card: rgba(255, 255, 255, 0.65);
  --bg-glass: rgba(255, 255, 255, 0.65);
  
  --border-glass: #e5e7eb;
  --border-glass-hover: #58cc02;
  
  --text-primary: #2b3a4a;
  --text-secondary: #52657a;
  --text-muted: #8b9eb0;
  
  --accent-primary: #58cc02; /* Duolingo Friendly Green */
  --accent-primary-hover: #46a302;
  --accent-blue: #1cb0f6;   /* Bright Sky Blue */
  --accent-purple: #ce82ff; /* Cute Pastel Violet */
  --accent-amber: #ffc800;  /* Cartoon Gold/Yellow */
  --accent-rose: #ff4b4b;   /* Soft Coral Red */
  
  --card-bg-front: #ffffff;
  --card-bg-back: #eef8ff;
  
  --success: #58cc02;
  --success-bg: #e5f9d3;
  --warning: #ffb100;
  --warning-bg: #fff5d6;
  --danger: #ff4b4b;
  --danger-bg: #ffe5e5;
  
  /* 3D Cartoon Shadow / Press Effects */
  --shadow-sm: 0 3px 0 #e5e7eb;
  --shadow-md: 0 5px 0 #d1d5db;
  --shadow-lg: 0 8px 0 #9ca3af;
  --shadow-glow: 0 6px 20px rgba(88, 204, 2, 0.25);
  
  --btn-3d-green: 0 4px 0 #46a302;
  --btn-3d-blue: 0 4px 0 #1899d6;
  --btn-3d-amber: 0 4px 0 #e5b200;
  --btn-3d-purple: 0 4px 0 #b45be6;
  
  --scrollbar-thumb: #cbd5e1;
  --scrollbar-track: transparent;
}

html.dark {
  --bg-primary: transparent;
  --bg-secondary: rgba(15, 23, 42, 0.55);
  --bg-card: rgba(15, 23, 42, 0.55);
  --bg-glass: rgba(15, 23, 42, 0.55);
  
  --border-glass: #2b4550;
  --border-glass-hover: #58cc02;
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --card-bg-front: rgba(15, 23, 42, 0.55);
  --card-bg-back: rgba(15, 23, 42, 0.55);
  
  --shadow-sm: 0 3px 0 rgba(0,0,0,0.2);
  --shadow-md: 0 5px 0 rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 0 rgba(0,0,0,0.4);
  --shadow-glow: 0 6px 25px rgba(88, 204, 2, 0.35);
  
  --scrollbar-thumb: #2b4550;
  --scrollbar-track: #131f24;
}

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

button, input, select, textarea {
  font-family: inherit;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background: url('/assets/app_bg_night_v3.png') no-repeat center center fixed / cover !important;
  color: var(--text-primary);
  line-height: 1.6;
  transition: background 0.5s ease-in-out, color var(--transition-normal);
  padding-bottom: 80px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

a {
  color: inherit;
  text-decoration: none;
}

/* Glassmorphism & Cartoon Card Utilities */
.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 2px solid var(--border-glass);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-lg);
  transition: all var(--transition-normal);
}
.glass-panel:hover {
  border-color: var(--border-glass-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

/* Vibrant HSK Level Badges (Inspired by HiHSK categorizations) */
.hsk-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.03em;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  text-transform: uppercase;
}
.hsk-badge-1 { background: var(--hsk-1, linear-gradient(135deg, #10b981, #059669)); }
.hsk-badge-2 { background: var(--hsk-2, linear-gradient(135deg, #06b6d4, #0891b2)); }
.hsk-badge-3 { background: var(--hsk-3, linear-gradient(135deg, #3b82f6, #2563eb)); }
.hsk-badge-4 { background: var(--hsk-4, linear-gradient(135deg, #8b5cf6, #7c3aed)); }
.hsk-badge-5 { background: var(--hsk-5, linear-gradient(135deg, #f59e0b, #d97706)); }
.hsk-badge-6 { background: var(--hsk-6, linear-gradient(135deg, #ef4444, #dc2626)); }

/* Navigation Bar */
.app-sidebar {
  width: 260px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  background: rgba(15, 23, 42, 0.6) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.15) !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 16px;
  transition: all var(--transition-normal);
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-glass);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.nav-container {
  max-width: var(--container-width);
  margin: 0 auto;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.brand-logo-img {
  height: 52px;
  width: auto;
  object-fit: contain;
  transition: transform var(--transition-fast);
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.4));
}

html.dark .brand-logo-img {
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.8));
}

.brand-logo-img:hover {
  transform: scale(1.03);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 8px;
  height: 100%;
  align-items: center;
}

.nav-link {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-secondary);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: rgba(59, 130, 246, 0.08);
}

.nav-chevron {
  font-size: 0.75rem;
  transition: transform var(--transition-fast);
}

/* Dropdown Menu */
.dropdown {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 200px;
  padding: 8px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all var(--transition-fast);
  list-style: none;
}

.dropdown:hover .dropdown-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown:hover .nav-chevron {
  transform: rotate(180deg);
}

.dropdown-menu li a {
  display: block;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.dropdown-menu li a:hover {
  background: rgba(59, 130, 246, 0.08);
  color: var(--text-primary);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  transform: scale(1.05);
}

/* User profile & Authentication states */
.auth-container {
  display: flex;
  align-items: center;
  border-left: 1px solid var(--border-glass);
  padding-left: 16px;
  height: 40px;
}

.logged-out-view {
  display: flex;
  align-items: center;
  gap: 12px;
}

#demo-login-btn {
  height: 36px;
  padding: 0 12px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

#demo-login-btn:hover {
  background-color: rgba(59, 130, 246, 0.08);
  border-color: var(--text-muted);
  color: var(--text-primary);
}

/* Ensure Google SSO button wrapper aligns nicely */
#google-signin-button {
  height: 36px;
  display: flex;
  align-items: center;
}

.auth-container.logged-out .logged-in-view {
  display: none !important;
}

.auth-container.logged-in .logged-out-view {
  display: none !important;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.user-avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-blue);
  box-shadow: var(--shadow-sm);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  font-family: var(--font-display);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dropdown Menu for Profile */
.user-dropdown {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

.profile-chevron {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.profile-dropdown-menu {
  position: absolute;
  top: calc(100% + 15px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 160px;
  padding: 6px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all var(--transition-fast);
  list-style: none;
  z-index: 200;
}

.user-dropdown.show-menu .profile-dropdown-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.user-dropdown.show-menu .profile-chevron {
  transform: rotate(180deg);
}

.profile-dropdown-menu li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.profile-dropdown-menu li a:hover {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
}

.profile-dropdown-menu li a.logout-link:hover {
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger);
}

/* Layout Main Container */
.main-layout {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 40px 24px;
  box-sizing: border-box !important;
}

/* Hero Banner (matching design details) */
.hero-banner {
  background: linear-gradient(135deg, #1d4ed8 0%, #06b6d4 50%, #7c3aed 100%);
  border-radius: var(--radius-xl);
  padding: 60px 40px;
  text-align: center;
  color: white;
  margin-bottom: 48px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: -30%;
  left: -20%;
  width: 60%;
  height: 120%;
  background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 70%);
  transform: rotate(-15deg);
  pointer-events: none;
}

.hero-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 24px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.hero-title {
  font-family: var(--font-display);
  font-size: 3.25rem;
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.hero-subtitle {
  font-size: 1.15rem;
  opacity: 0.9;
  max-width: 650px;
  margin: 0 auto 32px auto;
  font-weight: 400;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Button UI */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  gap: 8px;
}

/* Sidebar Custom Enhancements (NhaiTOPIK Style) */
.sidebar-section-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 14px 14px 6px 14px;
}

.sidebar-group {
  margin-bottom: 2px;
}

.sidebar-dropdown-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.sidebar-dropdown-toggle:hover {
  background: rgba(59, 130, 246, 0.08);
  color: var(--text-primary);
}

.sidebar-dropdown-toggle .dropdown-arrow {
  font-size: 0.75rem;
  transition: transform 0.25s ease;
  margin-left: auto;
}

.sidebar-group.open .sidebar-dropdown-toggle .dropdown-arrow {
  transform: rotate(180deg);
}

.sidebar-submenu {
  list-style: none;
  display: none;
  flex-direction: column;
  gap: 2px;
  padding-left: 18px;
  margin-top: 4px;
}

.sidebar-group.open .sidebar-submenu {
  display: flex;
}

.sidebar-subitem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-subitem:hover {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-blue);
  transform: translateX(3px);
}

.badge-vip {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 6px;
  margin-left: 6px;
}

.sidebar-upgrade-btn {
  background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
  color: #0f172a !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3) !important;
  border: 1px solid #f59e0b !important;
}

.sidebar-upgrade-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4) !important;
}

.btn-lg {
  padding: 14px 28px;
  border-radius: var(--radius-lg);
  font-size: 1.05rem;
}

.btn-sm {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.btn-primary {
  background-color: #ffffff;
  color: var(--accent-blue);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  background-color: #f8fafc;
}

.btn-outline {
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #ffffff;
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
}
.btn-secondary:hover {
  background-color: rgba(59, 130, 246, 0.08);
  border-color: var(--text-muted);
}

.circle-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-glass);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.circle-btn:hover {
  transform: scale(1.08);
  border-color: var(--text-muted);
  box-shadow: var(--shadow-md);
  color: var(--accent-blue);
}

/* Sections Structure */
.workspace-section {
  margin-bottom: 48px;
  scroll-margin-top: calc(var(--nav-height) + 20px);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 20px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Stats summary widget */
.stats-summary-widget {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.widget-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--shadow-sm);
  min-width: 110px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.widget-item[data-status]:hover {
  transform: translateY(-2px);
  border-color: var(--accent-blue);
  background-color: rgba(59, 130, 246, 0.08);
  box-shadow: var(--shadow-md);
}

.widget-item[data-status]:active {
  transform: translateY(0);
}

/* Filtered vocabulary table button styles */
.study-row-btn:hover {
  background-color: var(--success) !important;
  color: white !important;
}

.star-row-btn {
  background: rgba(245, 158, 11, 0.1);
  color: var(--text-secondary);
}

.star-row-btn.active {
  background-color: var(--warning) !important;
  color: #1e1b1b !important;
}

.star-row-btn.active:hover {
  background-color: var(--warning) !important;
  color: #1e1b1b !important;
  opacity: 0.9;
}

.star-row-btn:hover:not(.active) {
  background-color: rgba(245, 158, 11, 0.25) !important;
  color: var(--warning) !important;
}

.check-row-btn {
  background: rgba(16, 185, 129, 0.1);
  color: var(--text-secondary);
}

.check-row-btn.active {
  background-color: var(--success) !important;
  color: white !important;
}

.check-row-btn.active:hover {
  background-color: var(--success) !important;
  color: white !important;
  opacity: 0.9;
}

.check-row-btn:hover:not(.active) {
  background-color: rgba(16, 185, 129, 0.25) !important;
  color: var(--success) !important;
}

.speak-row-btn:hover {
  background-color: var(--accent-blue) !important;
  color: white !important;
}

/* List Tab buttons */
.list-tab-btn {
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.list-tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.list-tab-btn.active {
  background: rgba(59, 130, 246, 0.15) !important;
  color: var(--text-primary) !important;
  border-color: var(--accent-blue) !important;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.widget-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
}

.widget-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }

/* Controls Dashboard Dashboard */
.controls-dashboard {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 24px;
  padding: 20px 24px;
  margin-bottom: 32px;
}

@media (max-width: 900px) {
  .controls-dashboard {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* Tabs */
.level-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.level-tab {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.level-tab:hover {
  background: rgba(59, 130, 246, 0.05);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.level-tab.active {
  background-color: var(--accent-blue);
  color: white;
  border-color: var(--accent-blue);
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

/* Forms Select */
.form-select {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.9rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border var(--transition-fast);
}

.form-select:focus {
  border-color: var(--accent-blue);
}

.select-sm {
  padding: 6px 8px;
  font-size: 0.8rem;
}

.select-voice {
  max-width: 180px;
}

.inline-controls {
  flex-direction: row;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.autoplay-wrap, .tts-voice-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
}

/* Search Box style */
.search-container {
  margin-bottom: 24px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
  font-size: 1rem;
}

.search-box input {
  width: 100%;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px 16px 14px 44px;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.search-box input:focus {
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-glow), var(--shadow-md);
  background: var(--bg-secondary);
}

.clear-btn {
  position: absolute;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
}

.clear-btn:hover {
  color: var(--text-primary);
}

/* Flashcard Workspace */
.flashcard-workspace {
  max-width: 650px;
  margin: 0 auto;
}

/* Card Viewport */
.card-viewport {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}

/* Progress bar */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background-color: rgba(59, 130, 246, 0.08);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 10px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-teal));
  border-radius: var(--radius-sm);
  transition: width var(--transition-normal);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.progress-text {
  position: absolute;
  right: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* 3D Card Animation viewport container */
.flashcard-card-container {
  width: 100%;
  perspective: 1200px;
  height: 360px;
}

.flashcard-card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform var(--transition-slow);
  cursor: pointer;
}

/* Flipped trigger class */
.flashcard-card.flipped {
  transform: rotateY(180deg);
}

.card-side {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-xl);
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-glass);
  box-sizing: border-box;
}

/* Front & Back specific background styling */
.card-front {
  background: var(--card-bg-front);
}

.card-back {
  background: var(--card-bg-back);
  transform: rotateY(180deg);
}

/* Card Header tags */
.card-header-tags {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  display: inline-flex;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.badge-level {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
}

.badge-category {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-purple);
}

/* Card Main content */
.card-content-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.chinese-word {
  font-family: var(--font-chinese);
  font-size: 5.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
  line-height: 1;
  user-select: none;
}

/* ─── PINYIN UNIFORM FONT STACK (Fixes ǒ, ǎ, ě, ǐ, ǔ, ǚ tone mark font glitch) ─── */
.pinyin-text,
.card-pinyin,
.card-pinyin-back,
.vocab-pinyin,
.word-pinyin,
.dict-pinyin,
.q-pinyin,
.vd-pinyin,
.char-pinyin,
.flashcard-pinyin,
.table-pinyin,
.detail-pinyin,
.dict-popular-pinyin,
.pinyin-card,
.recent-pinyin,
.recent-title-pinyin,
#quiz-pinyin,
[class*="pinyin"],
[class*="Pinyin"],
[data-pinyin] {
  font-family: var(--font-pinyin), 'Be Vietnam Pro', 'Inter', 'Segoe UI', Roboto, sans-serif !important;
}

.pinyin-text {
  font-family: var(--font-pinyin), 'Be Vietnam Pro', 'Inter', 'Segoe UI', Roboto, sans-serif !important;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent-teal);
  margin-bottom: 8px;
  user-select: none;
}

.meaning-text {
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 20px;
}

/* Example Box */
.example-box {
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  width: 100%;
  max-width: 480px;
  text-align: left;
}

.example-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.example-zh {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.example-vi {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-style: italic;
}

.speak-example-btn {
  background: none;
  border: none;
  color: var(--accent-teal);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px;
  transition: all var(--transition-fast);
}

.speak-example-btn:hover {
  color: white;
  transform: scale(1.1);
}

/* Card Action bar bottom */
.card-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.speak-btn {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
  border-color: rgba(59, 130, 246, 0.2);
}

.speak-btn:hover {
  background-color: var(--accent-blue);
  color: white;
}

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

.placeholder-icon {
  width: 48px; /* matching speaker button width to keep center layout perfect */
}

/* Card HUD navigation bar */
.card-hud-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  justify-content: space-between;
  margin-top: 10px;
}

.btn-hud {
  flex-grow: 1;
  max-width: 160px;
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 0.9rem;
  border-radius: 50px; /* pill styling */
}

.btn-hud:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.mark-btn.active {
  background-color: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
  font-weight: 700;
}

.mark-btn.active:hover {
  background-color: var(--success);
  color: white;
}

.star-btn.active {
  background-color: var(--warning-bg);
  border-color: var(--warning);
  color: var(--warning);
  font-weight: 700;
}

.star-btn.active:hover {
  background-color: var(--warning);
  color: white;
}

.unmark-btn.active {
  background-color: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
  font-weight: 700;
}

.unmark-btn.active:hover {
  background-color: var(--danger);
  color: white;
}


.card-page-indicator {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Empty state styling */
.empty-state {
  width: 100%;
  height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
}

.empty-icon {
  font-size: 3.5rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  opacity: 0.6;
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 320px;
  margin-bottom: 24px;
}

/* Grid Layout for Custom words & Form */
.grid-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

@media (max-width: 900px) {
  .grid-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

.panel-header {
  margin-bottom: 24px;
}

.panel-header h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-header p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.text-primary { color: var(--accent-blue); }
.text-success { color: var(--success); }

/* Form inputs styling */
.add-word-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-item.full-width {
  grid-column: span 2;
}

@media (max-width: 500px) {
  .form-item.full-width {
    grid-column: span 1;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-item label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.required {
  color: var(--danger);
}

.form-item input {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition-fast);
}

.form-item input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
}

/* Custom Table style */
.custom-words-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

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

.custom-words-table th {
  background-color: rgba(59, 130, 246, 0.05);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-glass);
}

.custom-words-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-glass);
  color: var(--text-primary);
}

.custom-words-table tbody tr:last-child td {
  border-bottom: none;
}

.custom-words-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.table-empty {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 30px !important;
}

.delete-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1rem;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.delete-btn:hover {
  background-color: var(--danger-bg);
  transform: scale(1.1);
}

/* Keyboard Help Box */
.hotkeys-section {
  padding: 24px;
  margin-top: 48px;
}

.hotkeys-section h4 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
}

.hotkeys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.hotkey-item {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.key-badge {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-bottom: 2px solid var(--scrollbar-thumb);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-primary);
}

/* Toast alert notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  border-left: 4px solid var(--accent-blue);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all var(--transition-normal);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Animations */
@keyframes logoPulse {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 0px rgba(229, 62, 62, 0));
  }
  100% {
    transform: scale(1.05);
    filter: drop-shadow(0 0 8px rgba(229, 62, 62, 0.6));
  }
}

/* --- HSK EXAMS STYLING --- */
.level-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.level-card {
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.level-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.level-card h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
}

.level-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  flex-grow: 1;
}

.level-meta {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.level-meta i {
  color: var(--accent-blue);
}

.btn-full {
  width: 100%;
}

.exam-papers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.exam-paper-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.exam-paper-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-blue);
}

.exam-paper-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.exam-paper-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.exam-paper-status {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.status-todo {
  background: var(--border-glass);
  color: var(--text-secondary);
}

.status-done {
  background: var(--success-bg);
  color: var(--success);
}

.exam-player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  margin-bottom: 24px;
}

.player-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-header-left h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.exam-timer-widget {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--warning);
  display: flex;
  align-items: center;
  gap: 8px;
}

.exam-timer-widget.warning-time {
  color: var(--danger);
  animation: timerWarning 1s infinite alternate;
}

@keyframes timerWarning {
  0% { transform: scale(1); }
  100% { transform: scale(1.05); }
}

.exam-player-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
}

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

.exam-player-nav {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 500px;
  overflow-y: auto;
}

.exam-player-nav h4 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 8px;
}

.nav-sections-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nav-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.nav-questions-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.q-btn {
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.q-btn:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.q-btn.active {
  background: var(--accent-blue);
  color: white;
  border-color: var(--accent-blue);
}

.q-btn.answered {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

.q-btn.answered.active {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.exam-player-main {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 12px;
}

.question-header span {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-secondary);
}

.question-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.question-audio-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.question-text {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-primary);
}

.question-options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.option-item:hover {
  border-color: var(--border-glass-hover);
  background: rgba(59, 130, 246, 0.04);
}

.option-item.selected {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.08);
}

.option-item input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent-blue);
}

.option-label {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
}

.question-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
}

.submit-exam-btn {
  background-color: var(--success);
  color: white;
}

.submit-exam-btn:hover {
  background-color: #059669;
}

/* Result styles */
.result-header-panel {
  padding: 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.result-badge-wrap {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.result-status-badge {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  color: white;
  box-shadow: var(--shadow-sm);
}

.result-status-badge.pass {
  background: var(--success);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.result-status-badge.fail {
  background: var(--danger);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

.result-stats-row {
  display: flex;
  gap: 24px;
  margin: 16px 0;
  flex-wrap: wrap;
  justify-content: center;
}

.result-stat-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 16px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 140px;
}

.result-stat-box .stat-num {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.result-stat-box .stat-lbl {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.result-review-panel {
  padding: 32px;
}

.review-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.review-questions-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.review-q-item {
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  background: var(--bg-secondary);
}

.review-q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 8px;
}

.review-q-header .q-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}

.review-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.rev-option {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  font-size: 0.95rem;
}

.rev-option.correct {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
  font-weight: 600;
}

.rev-option.wrong {
  border-color: var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 600;
}

.explanation-box {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(59, 130, 246, 0.06);
  border-left: 4px solid var(--accent-blue);
}

html.dark .explanation-box {
  background: rgba(59, 130, 246, 0.1);
}

.explanation-box h5 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent-blue);
  margin-bottom: 6px;
}

.explanation-box p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* --- ENHANCEMENTS: STATS, TYPING MODE & CUSTOM LISTS --- */

/* Stats Table Styling */
.stats-table {
  width: 100%;
  border-collapse: collapse;
}

.stats-table th, .stats-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-glass);
}

.stats-table tr {
  transition: background-color var(--transition-fast);
}

.stats-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

html:not(.dark) .stats-table tr:hover {
  background: rgba(0, 0, 0, 0.01);
}

/* Segmented Control */
.segmented-control {
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
}

.segmented-control button {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.segmented-control button.active-mode {
  background: var(--accent-blue) !important;
  color: white !important;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.25);
}

/* Typing Mode attempts dots */
.attempt-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--scrollbar-thumb);
  transition: background-color 0.2s, transform 0.2s;
}

.attempt-dot.active-dot {
  background-color: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.attempt-dot.active-dot.warning-dot {
  background-color: var(--warning);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.attempt-dot.active-dot.danger-dot {
  background-color: var(--danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

/* Typing Mode card overlay */
.typing-card-container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  animation: fadeIn var(--transition-normal);
}

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

/* Shake Animation for incorrect input */
.shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
  20%, 40%, 60%, 80% { transform: translateX(8px); }
}

/* Success flash outline */
.correct-glow {
  border-color: var(--success) !important;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.3) !important;
}

/* Error flash outline */
.incorrect-glow {
  border-color: var(--danger) !important;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.3) !important;
}

/* Custom Lists Sidebar & Pills */
.custom-lists-container {
  margin-top: 20px;
}

.list-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-weight: 500;
  font-size: 0.9rem;
}

.list-pill:hover {
  border-color: var(--border-glass-hover);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

html:not(.dark) .list-pill:hover {
  background: rgba(0, 0, 0, 0.02);
}

.list-pill.active-list {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.05));
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.list-pill-actions {
  display: flex;
  gap: 6px;
  opacity: 0.3;
  transition: opacity var(--transition-fast);
}

.list-pill:hover .list-pill-actions, .list-pill.active-list .list-pill-actions {
  opacity: 1;
}

.list-action-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  font-size: 0.8rem;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.list-action-btn:hover {
  transform: scale(1.15);
}

.list-action-btn.study-btn:hover {
  color: var(--success);
}

.list-action-btn.delete-btn:hover {
  color: var(--danger);
}

.list-word-count {
  font-size: 0.75rem;
  background: var(--border-glass);
  padding: 2px 8px;
  border-radius: 20px;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .custom-lists-container {
    grid-template-columns: 1fr !important;
  }
}

/* Typing Mode Active Layout Tweaks */
.card-viewport.typing-mode-active .flashcard-card-container {
  height: 460px !important;
}

.card-viewport.typing-mode-active #mark-memorized-btn,
.card-viewport.typing-mode-active #mark-unmemorized-btn,
.card-viewport.typing-mode-active #mark-starred-btn {
  display: none !important;
}

/* ==========================================================================
   AI CHATBOT WIDGET STYLES
   ========================================================================== */

.chatbot-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  font-family: var(--font-sans);
}

/* Toggle Button */
.chatbot-toggle-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-teal) 100%);
  border: none;
  color: white;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25), var(--shadow-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
  position: relative;
}

.chatbot-toggle-btn:hover {
  transform: scale(1.1) rotate(-5deg);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 0 25px rgba(59, 130, 246, 0.4);
}

.chatbot-toggle-btn:active {
  transform: scale(0.95);
}

.chatbot-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background-color: var(--danger);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-primary);
  box-shadow: var(--shadow-sm);
  animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Chat Panel */
.chatbot-panel {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 380px;
  height: 520px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-lg), 0 10px 30px rgba(0,0,0,0.15);
  animation: slideInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Header */
.chatbot-header {
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chatbot-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  border: 1px solid rgba(59, 130, 246, 0.25);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.1);
}

.chatbot-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.chatbot-status {
  font-size: 0.7rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot {
  width: 6px;
  height: 6px;
  background-color: var(--success);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px var(--success);
}

.chatbot-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  transition: color var(--transition-fast);
  padding: 4px;
}

.chatbot-close-btn:hover {
  color: var(--danger);
}

/* Messages Area */
.chatbot-messages {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(0, 0, 0, 0.05);
}

.chat-message {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.5;
  word-wrap: break-word;
  box-shadow: var(--shadow-sm);
  white-space: pre-line;
}

.chat-message.bot {
  align-self: flex-start;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-glass);
}

.chat-message.bot strong {
  color: var(--accent-teal);
}

.chat-message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent-blue) 0%, #1d4ed8 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

/* Typing Bouncing Dots */
.chatbot-typing {
  align-self: flex-start;
  background: var(--bg-secondary);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-glass);
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: 20px;
  margin-bottom: 14px;
}

.chatbot-typing .dot {
  width: 6px;
  height: 6px;
  background-color: var(--text-muted);
  border-radius: 50%;
  display: inline-block;
  animation: bounceDot 1.4s infinite ease-in-out both;
}

.chatbot-typing .dot:nth-child(1) { animation-delay: -0.32s; }
.chatbot-typing .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounceDot {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

/* Input Area */
.chatbot-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border-glass);
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  gap: 8px;
}

.chatbot-input-area input {
  flex-grow: 1;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-primary);
  outline: none;
  font-size: 0.88rem;
  transition: border-color var(--transition-fast);
}

.chatbot-input-area input:focus {
  border-color: var(--accent-blue);
  background: rgba(0, 0, 0, 0.3);
}

.chatbot-input-area button {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--accent-blue);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.chatbot-input-area button:hover {
  background-color: #1d4ed8;
  transform: translateY(-1px);
}

.chatbot-input-area button:active {
  transform: translateY(0);
}

/* Responsive adjustment */
@media (max-width: 450px) {
  .chatbot-panel {
    width: calc(100vw - 32px);
    right: -8px;
    height: 450px;
  }
}

.chatbot-header-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: color var(--transition-fast), transform var(--transition-fast);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-header-action-btn:hover {
  color: var(--accent-blue);
  transform: scale(1.15);
}

/* ==========================================================================
   DECK SELECTION SCREEN STYLES
   ========================================================================== */

/* Review Banner (matching screenshot style) */
.review-banner-container {
  width: 100%;
}

.review-banner {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.review-banner::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
  z-index: 1;
  pointer-events: none;
}

.review-banner-content {
  display: flex;
  align-items: baseline;
  gap: 10px;
  z-index: 2;
}

.review-banner-title {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 800;
  color: white;
  margin: 0;
  line-height: 1;
  text-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

.review-banner-text {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0;
}

.review-banner-panda {
  font-size: 2.5rem;
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.15);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(59, 130, 246, 0.25);
  z-index: 2;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
  animation: pulseGraduation 3s infinite ease-in-out;
}

@keyframes pulseGraduation {
  0%, 100% { transform: scale(1); box-shadow: 0 0 15px rgba(59, 130, 246, 0.2); }
  50% { transform: scale(1.05); box-shadow: 0 0 25px rgba(59, 130, 246, 0.4); }
}

/* Category Sections */
.deck-category-section {
  margin-top: 32px;
}

.deck-category-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Deck Grid */
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

/* Deck Card */
.deck-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
  box-shadow: var(--shadow-sm);
}

.deck-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-glass-hover);
  box-shadow: var(--shadow-md);
  background: rgba(255, 255, 255, 0.02);
}

.deck-card-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-blue);
}

/* Specific Card theme colors */
.deck-card.personal-wrong .deck-card-glow { background: var(--danger); }
.deck-card.personal-starred .deck-card-glow { background: var(--warning); }
.deck-card.personal-custom .deck-card-glow { background: var(--accent-teal); }
.deck-card.hsk-1 .deck-card-glow { background: #3b82f6; }
.deck-card.hsk-2 .deck-card-glow { background: #06b6d4; }
.deck-card.hsk-3 .deck-card-glow { background: #10b981; }
.deck-card.hsk-4 .deck-card-glow { background: #f59e0b; }
.deck-card.hsk-5 .deck-card-glow { background: #f97316; }
.deck-card.hsk-6 .deck-card-glow { background: #ef4444; }
.deck-card.premium-locked .deck-card-glow { background: var(--text-muted); }

.deck-card-top {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.deck-card-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.deck-card-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

.deck-card-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Progress bar inside cards */
.deck-progress-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.deck-progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  overflow: hidden;
}

.deck-progress-bar-fill {
  height: 100%;
  background: var(--accent-blue);
  border-radius: 10px;
  width: 0%;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Specific Progress colors matching card glow */
.deck-card.personal-wrong .deck-progress-bar-fill { background: var(--danger); }
.deck-card.personal-starred .deck-progress-bar-fill { background: var(--warning); }
.deck-card.personal-custom .deck-progress-bar-fill { background: var(--accent-teal); }
.deck-card.hsk-1 .deck-progress-bar-fill { background: #3b82f6; }
.deck-card.hsk-2 .deck-progress-bar-fill { background: #06b6d4; }
.deck-card.hsk-3 .deck-progress-bar-fill { background: #10b981; }
.deck-card.hsk-4 .deck-progress-bar-fill { background: #f59e0b; }
.deck-card.hsk-5 .deck-progress-bar-fill { background: #f97316; }
.deck-card.hsk-6 .deck-progress-bar-fill { background: #ef4444; }

.deck-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Locked Deck Details */
.deck-card.premium-locked {
  opacity: 0.75;
}

.deck-card.premium-locked:hover {
  opacity: 0.95;
  cursor: pointer;
}

.deck-lock-badge {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.deck-new-badge {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

/* Study View Customization */
.flex-stats {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 16px !important;
  width: 100% !important;
}

@media (max-width: 768px) {
  .flex-stats {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .study-header {
    flex-direction: column-reverse !important;
    align-items: stretch !important;
  }
  .study-deck-title-wrap {
    text-align: left !important;
  }
}

/* --- PREMIUM REDESIGN UI STYLES --- */

/* 1. Brand Header with Block Letters */
.premium-brand-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 0 24px 0;
  width: 100%;
}

.brand-cap-text {
  font-family: var(--font-sans);
  color: var(--accent-primary);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  text-transform: uppercase;
}

.brand-blocks {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-bottom: 12px;
}

.brand-block {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.4rem;
  font-weight: 800;
  font-family: var(--font-sans);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
}

.brand-block:hover {
  transform: scale(1.15) rotate(0deg) !important;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

/* Dynamic slightly offset rotations for playful brand feel */
.brand-block:nth-child(1) { background-color: #ff5e7e; transform: rotate(-5deg); }
.brand-block:nth-child(2) { background-color: #10b981; transform: rotate(4deg); }
.brand-block:nth-child(3) { background-color: #3b82f6; transform: rotate(-3deg); }
.brand-block:nth-child(4) { background-color: #f59e0b; transform: rotate(6deg); }
.brand-block:nth-child(5) { background-color: #8b5cf6; transform: rotate(-4deg); }
.brand-block:nth-child(6) { background-color: #f97316; transform: rotate(5deg); }
.brand-block:nth-child(7) { background-color: #06b6d4; transform: rotate(-2deg); }

.brand-slogan {
  font-size: 0.95rem;
  font-style: italic;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* 2. Premium Welcome Banner Card */
.premium-welcome-card {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  padding: 36px 40px;
  border-radius: 24px;
  margin-bottom: 40px;
  align-items: center;
  background: linear-gradient(135deg, #fff5f2 0%, #fffaf5 100%);
  border: 1px solid rgba(229, 62, 62, 0.12);
  box-shadow: 0 10px 30px rgba(229, 62, 62, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

html.dark .premium-welcome-card {
  background: linear-gradient(135deg, #1f1816 0%, #151312 100%);
  border: 1px solid rgba(229, 62, 62, 0.15);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.premium-welcome-card:hover {
  border-color: rgba(229, 62, 62, 0.25);
  box-shadow: 0 12px 36px rgba(229, 62, 62, 0.08);
}

html.dark .premium-welcome-card:hover {
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
}

.welcome-content-left {
  display: flex;
  flex-direction: column;
}

.welcome-tag {
  align-self: flex-start;
  background: rgba(229, 62, 62, 0.08);
  color: var(--accent-primary);
  border: 1px solid rgba(229, 62, 62, 0.15);
  padding: 5px 14px;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin-bottom: 18px;
  text-transform: uppercase;
}

.welcome-title {
  font-family: var(--font-sans);
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 12px;
  color: #1e293b;
}

html.dark .welcome-title {
  color: #f8fafc;
}

.welcome-title span {
  color: var(--accent-primary);
}

.welcome-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #475569;
  margin-bottom: 24px;
}

html.dark .welcome-desc {
  color: #94a3b8;
}

.welcome-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.btn-red-pill {
  background-color: var(--accent-primary);
  color: white !important;
  border-radius: 50px;
  padding: 12px 28px;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(229, 62, 62, 0.3);
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-red-pill:hover {
  transform: translateY(-2px);
  background-color: #c53030;
  box-shadow: 0 6px 20px rgba(229, 62, 62, 0.4);
}

.btn-outline-pill {
  background: transparent;
  color: #475569 !important;
  border: 1px solid rgba(71, 85, 105, 0.25);
  border-radius: 50px;
  padding: 12px 28px;
  font-weight: 700;
  transition: all 0.2s;
}

html.dark .btn-outline-pill {
  color: #cbd5e1 !important;
  border-color: rgba(203, 213, 225, 0.25);
}

.btn-outline-pill:hover {
  background: rgba(0, 0, 0, 0.03);
  color: #1e293b !important;
  border-color: #1e293b;
  transform: translateY(-2px);
}

html.dark .btn-outline-pill:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f8fafc !important;
  border-color: #f8fafc;
}

.welcome-stats-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.welcome-stat-card {
  background: white;
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.03);
  transition: transform 0.2s;
}

html.dark .welcome-stat-card {
  background: rgba(30, 27, 26, 0.5);
  border-color: rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.welcome-stat-card:hover {
  transform: translateY(-2px);
}

.welcome-stat-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.welcome-stat-icon-wrapper.orange {
  background: #fff0eb;
  color: #f97316;
}

html.dark .welcome-stat-icon-wrapper.orange {
  background: rgba(249, 115, 22, 0.15);
}

.welcome-stat-icon-wrapper.pink {
  background: #fff0f3;
  color: #ff5e7e;
}

html.dark .welcome-stat-icon-wrapper.pink {
  background: rgba(255, 94, 126, 0.15);
}

.welcome-stat-icon-wrapper.blue {
  background: #eff6ff;
  color: #3b82f6;
}

html.dark .welcome-stat-icon-wrapper.blue {
  background: rgba(59, 130, 246, 0.15);
}

.welcome-stat-info {
  display: flex;
  flex-direction: column;
}

.welcome-stat-label {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 2px;
  font-weight: 500;
}

html.dark .welcome-stat-label {
  color: #94a3b8;
}

.welcome-stat-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: #1e293b;
}

html.dark .welcome-stat-value {
  color: #f8fafc;
}

/* 3. Section Accent Header */
.section-accent-header {
  font-family: var(--font-sans);
  font-size: 1.35rem;
  font-weight: 800;
  margin-top: 10px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #1e293b;
  border-left: 4px solid var(--accent-primary);
  padding-left: 12px;
}

html.dark .section-accent-header {
  color: #f8fafc;
}

/* 4. Curriculum selection grid */
.curriculum-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 40px;
}

.curriculum-card {
  padding: 24px 28px;
  border-radius: 20px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
}

.curriculum-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-glass-hover);
  box-shadow: var(--shadow-lg);
}

.curriculum-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.curriculum-badge {
  font-size: 0.85rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
}

.curriculum-badge.red {
  background: rgba(229, 62, 62, 0.1);
  color: var(--accent-primary);
}

.curriculum-badge.green {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.curriculum-desc-right {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.curriculum-card h3 {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
}

/* 5. Sticky Bottom Navigation Bar (Hidden - chỉ sử dụng Left Sidebar) */
.bottom-nav-bar {
  display: none !important;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  width: 70px;
  height: 100%;
  transition: all 0.2s ease;
  font-weight: 600;
  font-size: 0.72rem;
  border-radius: 8px;
  user-select: none;
}

.bottom-nav-item i {
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

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

.bottom-nav-item:hover i {
  transform: translateY(-2px);
}

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

.bottom-nav-item.active i {
  transform: scale(1.1);
}

/* Screen widths adjustments */
@media (max-width: 800px) {
  .premium-welcome-card {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 28px;
  }
  .curriculum-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* ==========================================================================
   SMART CONFIGURATION VIEW FOR FLASHCARDS
   ========================================================================== */
.smart-flashcard-config {
  background: rgba(255, 255, 255, 0.38);
  backdrop-filter: blur(6px) saturate(160%);
  -webkit-backdrop-filter: blur(6px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  padding: 40px;
  max-width: 900px;
  margin: 0 auto 32px auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  font-family: 'Be Vietnam Pro', sans-serif;
}

html.dark .smart-flashcard-config {
  background: rgba(15, 23, 42, 0.28) !important;
  backdrop-filter: blur(6px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(6px) saturate(160%) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
}

.config-header {
  text-align: center;
  margin-bottom: 36px;
}

.config-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

html.dark .config-title {
  color: #f8fafc;
}

.config-title .title-icon {
  color: #ff2a5f;
  animation: pulseGraduation 3s infinite ease-in-out;
}

.config-subtitle {
  color: #64748b;
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 700px;
  margin: 0 auto;
}

html.dark .config-subtitle {
  color: #94a3b8;
}

/* Steps list */
.config-steps-grid {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.config-step-section {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding-bottom: 28px;
}

html.dark .config-step-section {
  border-bottom-color: var(--border-glass);
}

.config-step-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.step-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 16px;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 8px;
}

html.dark .step-title {
  color: #cbd5e1;
}

/* Row layouts */
.curriculum-selection-row,
.mode-selection-row,
.range-selection-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 640px) {
  .curriculum-selection-row,
  .mode-selection-row,
  .range-selection-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* Selection Cards */
.smart-flashcard-config .selection-card {
  background: white;
  border: 1.5px solid #edf2f7;
  border-radius: 16px;
  padding: 24px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.01);
  user-select: none;
}

html.dark .smart-flashcard-config .selection-card {
  background: rgba(30, 27, 26, 0.2);
  border-color: var(--border-glass);
}

.smart-flashcard-config .selection-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.04);
  border-color: #cbd5e1;
}

html.dark .smart-flashcard-config .selection-card:hover {
  border-color: var(--border-glass-hover);
  background: rgba(30, 27, 26, 0.4);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

/* Selected state: Red/Pink theme matching screenshot */
.smart-flashcard-config .selection-card.active {
  background: #fff5f6;
  border-color: #ff2a5f;
  box-shadow: 0 4px 20px rgba(255, 42, 95, 0.08);
}

html.dark .smart-flashcard-config .selection-card.active {
  background: rgba(255, 42, 95, 0.06);
  border-color: #ff2a5f;
  box-shadow: 0 4px 20px rgba(255, 42, 95, 0.15);
}

.smart-flashcard-config .selection-card-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #1e293b;
  transition: color 0.2s;
}

html.dark .smart-flashcard-config .selection-card-title {
  color: #f8fafc;
}

.smart-flashcard-config .selection-card.active .selection-card-title {
  color: #e11d48;
}

html.dark .smart-flashcard-config .selection-card.active .selection-card-title {
  color: #ff5e7e;
}

.smart-flashcard-config .selection-card-subtitle {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.5;
}

html.dark .smart-flashcard-config .selection-card-subtitle {
  color: #94a3b8;
}

/* Checkmark Badge */
.smart-flashcard-config .check-badge {
  position: absolute;
  top: 24px;
  right: 24px;
  font-size: 1.3rem;
  color: #edf2f7;
  transition: color 0.2s, transform 0.2s;
}

html.dark .smart-flashcard-config .check-badge {
  color: rgba(255, 255, 255, 0.08);
}

.smart-flashcard-config .selection-card.active .check-badge {
  color: #ff2a5f;
  transform: scale(1.15);
}

/* Step 2: Level Selection Pills */
.level-selection-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.level-pill {
  background: white;
  border: 1px solid #edf2f7;
  border-radius: 10px;
  padding: 12px 24px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

html.dark .level-pill {
  background: rgba(30, 27, 26, 0.2);
  border-color: var(--border-glass);
  color: #cbd5e1;
}

.level-pill:hover {
  background: #f8fafc;
  color: #1e293b;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

html.dark .level-pill:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #f8fafc;
  border-color: var(--border-glass-hover);
}

.level-pill.active {
  background: #ff2a5f;
  color: white;
  border-color: #ff2a5f;
  box-shadow: 0 4px 12px rgba(255, 42, 95, 0.2);
}

html.dark .level-pill.active {
  background: #ff2a5f;
  color: white;
  border-color: #ff2a5f;
  box-shadow: 0 4px 12px rgba(255, 42, 95, 0.35);
}

/* Smart start button */
.config-action-container {
  display: flex;
  justify-content: center;
  margin-top: 36px;
}

.btn-start-smart {
  background: #ff2a5f;
  color: white;
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: 50px;
  padding: 16px 48px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(255, 42, 95, 0.25);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.btn-start-smart:hover {
  background: #e11d48;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 42, 95, 0.35);
}

.btn-start-smart:active {
  transform: translateY(0);
}

/* Custom list picker inside configurations */
.smart-config-custom-picker {
  margin-top: 18px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.01);
  border: 1px dashed rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  display: none;
  animation: fadeIn 0.25s ease-out;
}

html.dark .smart-config-custom-picker {
  background: rgba(255, 255, 255, 0.01);
  border-color: var(--border-glass);
}

/* Custom mini deck cards styling for selection picker */
.smart-mini-deck-card {
  background: white;
  border: 1px solid #edf2f7;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

html.dark .smart-mini-deck-card {
  background: rgba(30, 27, 26, 0.3);
  border-color: var(--border-glass);
}

.smart-mini-deck-card:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

html.dark .smart-mini-deck-card:hover {
  border-color: var(--border-glass-hover);
  background: rgba(255, 255, 255, 0.02);
}

.smart-mini-deck-card.active {
  border-color: #ff2a5f;
  background: #fff5f6;
}

html.dark .smart-mini-deck-card.active {
  border-color: #ff2a5f;
  background: rgba(255, 42, 95, 0.05);
}

.smart-mini-deck-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.smart-mini-deck-count {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

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

/* ==========================================================================
   LESSONS SECTION STYLES
   ========================================================================== */
.lessons-top-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.lessons-cap-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.lessons-curriculum-pills {
  display: flex;
  gap: 12px;
}

.lessons-pill-btn {
  background: white;
  border: 1px solid #edf2f7;
  color: #475569;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s;
}

html.dark .lessons-pill-btn {
  background: rgba(30, 27, 26, 0.2);
  border-color: var(--border-glass);
  color: #cbd5e1;
}

.lessons-pill-btn:hover {
  background: #f8fafc;
  color: #1e293b;
  border-color: #cbd5e1;
}

html.dark .lessons-pill-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-glass-hover);
}

.lessons-pill-btn.active {
  background: #ff2a5f;
  border-color: #ff2a5f;
  color: white !important;
  box-shadow: 0 4px 12px rgba(255, 42, 95, 0.25);
}

/* Header Card */
.lessons-header-card {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 20px;
  padding: 24px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.01);
  gap: 24px;
}

html.dark .lessons-header-card {
  background: linear-gradient(135deg, #181616 0%, #111010 100%);
  border-color: rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.lessons-book-icon-wrapper {
  background: #fff0f3;
  color: #ff2a5f;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

html.dark .lessons-book-icon-wrapper {
  background: rgba(255, 42, 95, 0.12);
}

.lessons-header-title {
  font-family: var(--font-sans);
  font-size: 1.6rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 8px;
}

html.dark .lessons-header-title {
  color: #f8fafc;
}

.lessons-header-subtitle {
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 600px;
}

html.dark .lessons-header-subtitle {
  color: #94a3b8;
}

.lessons-level-pills {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.lessons-level-btn {
  background: white;
  border: 1.5px solid #cbd5e1;
  color: #1e293b;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 10px 24px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

html.dark .lessons-level-btn {
  background: rgba(30, 27, 26, 0.2);
  border-color: var(--border-glass);
  color: #cbd5e1;
}

.lessons-level-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

html.dark .lessons-level-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-glass-hover);
}

.lessons-level-btn.active {
  background: #ff2a5f;
  border-color: #ff2a5f;
  color: white !important;
  box-shadow: 0 4px 12px rgba(255, 42, 95, 0.25);
}

/* Volume selection pills (Thượng / Hạ) */
.lessons-volume-pills {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.lessons-volume-btn {
  background: white;
  border: 1.5px solid #cbd5e1;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

html.dark .lessons-volume-btn {
  background: rgba(30, 27, 26, 0.3);
  border-color: var(--border-glass);
  color: #94a3b8;
}

.lessons-volume-btn:hover {
  background: #f1f5f9;
}

html.dark .lessons-volume-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.lessons-volume-btn.active {
  background: #0284c7;
  border-color: #0284c7;
  color: white !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

/* === Lessons Dropdown Select === */
.lessons-dropdown-select {
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: #f1f5f9;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  padding: 8px 36px 8px 14px;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='%2394a3b8' d='M4.5 6l3.5 4 3.5-4z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  min-width: 140px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.lessons-dropdown-select:hover,
.lessons-dropdown-select:focus {
  border-color: rgba(255, 42, 95, 0.6);
  box-shadow: 0 0 0 3px rgba(255, 42, 95, 0.12);
}

.lessons-dropdown-select option {
  background: #1e1b26;
  color: #f1f5f9;
  font-weight: 600;
  padding: 6px 12px;
}

/* Light mode overrides for dropdown */
html:not(.dark) .lessons-dropdown-select {
  background-color: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #0f172a !important;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  background-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='%23334155' d='M4.5 6l3.5 4 3.5-4z'/></svg>");
}

html:not(.dark) .lessons-dropdown-select:hover,
html:not(.dark) .lessons-dropdown-select:focus {
  border-color: #e53e3e;
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.15);
}

html:not(.dark) .lessons-dropdown-select option {
  background: #ffffff;
  color: #0f172a;
}



/* Objectives Bar */
.lessons-objectives-bar {
  background: #fffdf9;
  border: 1px solid rgba(245, 158, 11, 0.12);
  border-radius: 12px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  font-size: 0.9rem;
  color: #b45309;
}

html.dark .lessons-objectives-bar {
  background: rgba(245, 158, 11, 0.04);
  border-color: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.lessons-objectives-bar .info-icon {
  font-size: 1.1rem;
  color: #f59e0b;
}

/* Lessons Grid */
.lessons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

@media (max-width: 768px) {
  .lessons-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .lessons-header-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
  }
  .lessons-level-pills {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 6px;
  }
}

/* Lesson Card */
.lesson-card {
  background: white;
  border: 1.5px solid #edf2f7;
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 180px;
  transition: all 0.25s ease;
  min-height: 220px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

html.dark .lesson-card {
  background: var(--bg-card);
  border-color: var(--border-glass);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

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

/* Cartoon Lesson Wireframe Module Buttons */
.lesson-modules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 2px dashed var(--border-glass);
}

.lesson-mod-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: var(--radius-md);
  border: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.lesson-mod-btn i {
  font-size: 1.15rem;
}

.lesson-mod-btn small {
  font-size: 0.7rem;
  opacity: 0.85;
}

.lesson-mod-btn.mod-vocab {
  background: #58cc02;
  color: #ffffff;
  box-shadow: 0 4px 0 #46a302;
}
.lesson-mod-btn.mod-vocab:hover {
  background: #61df02;
}
.lesson-mod-btn.mod-vocab:active {
  box-shadow: 0 1px 0 #46a302;
  transform: translateY(3px);
}

.lesson-mod-btn.mod-grammar {
  background: #1cb0f6;
  color: #ffffff;
  box-shadow: 0 4px 0 #1899d6;
}
.lesson-mod-btn.mod-grammar:hover {
  background: #24bbfd;
}
.lesson-mod-btn.mod-grammar:active {
  box-shadow: 0 1px 0 #1899d6;
  transform: translateY(3px);
}

.lesson-mod-btn.mod-text {
  background: #ffc800;
  color: #4b3200;
  box-shadow: 0 4px 0 #e5b200;
}
.lesson-mod-btn.mod-text:hover {
  background: #ffd21a;
}
.lesson-mod-btn.mod-text:active {
  box-shadow: 0 1px 0 #e5b200;
  transform: translateY(3px);
}

.lesson-mod-btn.mod-review {
  background: #ce82ff;
  color: #ffffff;
  box-shadow: 0 4px 0 #b45be6;
}
.lesson-mod-btn.mod-review:hover {
  background: #d896ff;
}
.lesson-mod-btn.mod-review:active {
  box-shadow: 0 1px 0 #b45be6;
  transform: translateY(3px);
}

.lesson-badge {
  align-self: flex-start;
  background: rgba(229, 62, 62, 0.06);
  color: #ff2a5f;
  border: 1px solid rgba(229, 62, 62, 0.15);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.lesson-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
}

html.dark .lesson-title {
  color: #f8fafc;
}

.lesson-desc {
  font-size: 0.88rem;
  line-height: 1.5;
  color: #64748b;
  margin-bottom: 20px;
}

html.dark .lesson-desc {
  color: #cbd5e1;
}

.lesson-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  padding-top: 14px;
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

html.dark .lesson-footer {
  border-top-color: var(--border-glass);
}

.lesson-words-indicator {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.lesson-detail-link {
  font-size: 0.85rem;
  color: #ff2a5f;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.2s;
  cursor: pointer;
}

.lesson-detail-link:hover {
  transform: translateX(3px);
  color: #e11d48;
}

/* ==========================================================================
   AI DICTIONARY VIEW STYLES
   ========================================================================== */
.dict-segmented-control {
  border-radius: 50px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  width: 100%;
}

.dict-tab-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  font-weight: 700;
  transition: all var(--transition-fast) ease;
}

.dict-tab-btn:hover {
  color: var(--text-primary);
}

.dict-tab-btn.active {
  background: var(--accent-blue) !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.dict-popular-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  user-select: none;
}

html.dark .dict-popular-item {
  background: rgba(30, 27, 26, 0.2);
}

.dict-popular-item:hover {
  transform: translateX(2px);
  border-color: var(--border-glass-hover);
  background: rgba(255, 255, 255, 0.02);
}

.dict-popular-item.active {
  border-color: #ff2a5f;
  background: #fff5f6;
}

html.dark .dict-popular-item.active {
  background: rgba(255, 42, 95, 0.05);
}

.dict-popular-word {
  font-family: var(--font-chinese);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.dict-popular-pinyin {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-left: 6px;
}

.dict-popular-meaning {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Grammar Correction and Structure Analysis */
.dict-grammar-card {
  background: rgba(59, 130, 246, 0.03);
  border: 1px solid rgba(59, 130, 246, 0.1);
  border-radius: 12px;
  padding: 16px 20px;
  border-left: 4px solid var(--accent-blue);
  text-align: left;
}

html.dark .dict-grammar-card {
  background: rgba(59, 130, 246, 0.05);
  border-color: rgba(255, 255, 255, 0.05);
}

.dict-grammar-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.dict-grammar-explain {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

/* Tutor correction cards */
.dict-correction-item {
  border: 1.5px solid var(--border-glass);
  border-radius: 14px;
  padding: 18px;
  background: var(--bg-glass);
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.dict-correction-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.dict-correction-header.error {
  color: var(--danger);
}

.dict-correction-desc {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

.dict-correction-original {
  font-family: var(--font-chinese);
  text-decoration: line-through;
  color: var(--danger);
  font-weight: 500;
}

.dict-correction-fixed {
  font-family: var(--font-chinese);
  color: var(--success);
  font-weight: 700;
}

/* Tianzi ge grid box style for Hanzi Writer */
.dict-stroke-writer-grid {
  position: relative;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
  overflow: hidden;
}

/* Background grid styling for traditional Chinese character writing */
.dict-stroke-writer-grid::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: 
    linear-gradient(to right, rgba(239, 68, 68, 0.12) 1px, transparent 1px) 50% 0 / 100% 100% repeat-y,
    linear-gradient(to bottom, rgba(239, 68, 68, 0.12) 1px, transparent 1px) 0 50% / 100% 100% repeat-x,
    repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(239, 68, 68, 0.06) 4px, rgba(239, 68, 68, 0.06) 5px),
    repeating-linear-gradient(-45deg, transparent, transparent 4px, rgba(239, 68, 68, 0.06) 4px, rgba(239, 68, 68, 0.06) 5px);
  z-index: 1;
}

.dict-stroke-writer-grid svg {
  position: relative;
  z-index: 2;
}

/* Speech Mic Recording State Pulse */
@keyframes mic-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }
  70% {
    transform: scale(1.08);
    box-shadow: 0 0 0 12px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.mic-recording-pulse {
  animation: mic-pulse 1.4s infinite !important;
  background: var(--success) !important;
  color: white !important;
}

/* Quick save dropdown menu item */
.dict-quick-save-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast) ease;
  text-align: left;
}

.dict-quick-save-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

html.light .dict-quick-save-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Suggested tutor prompt pills */
.dict-tutor-prompt-pill {
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast) ease;
}

.dict-tutor-prompt-pill:hover {
  background: var(--accent-blue);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.2);
}

/* --- TOPICS & DASHBOARD STYLES --- */
.topic-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.topic-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-blue) !important;
  box-shadow: var(--shadow-lg), 0 0 15px rgba(59, 130, 246, 0.15) !important;
  background: rgba(255, 255, 255, 0.03) !important;
}
html.dark .topic-card:hover {
  background: rgba(255, 255, 255, 0.02) !important;
}

/* Notebook dashboard buttons hover */
#nb-start-flashcard-btn:hover {
  border-color: var(--accent-blue) !important;
  background: rgba(59, 130, 246, 0.06) !important;
  transform: scale(1.01);
}
#nb-start-typing-btn:hover {
  border-color: var(--success) !important;
  background: rgba(16, 185, 129, 0.06) !important;
  transform: scale(1.01);
}
#nb-start-quiz-btn:hover {
  border-color: var(--warning) !important;
  background: rgba(245, 158, 11, 0.06) !important;
  transform: scale(1.01);
}

/* --- QUIZ GAME STYLES --- */
.quiz-option-btn {
  display: block;
  width: 100%;
  padding: 16px 24px;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px solid var(--border-glass);
  border-radius: 12px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  font-family: var(--font-sans);
}
.quiz-option-btn:hover:not([disabled]) {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--text-secondary);
  transform: translateX(4px);
}
.quiz-option-btn.correct {
  background: var(--success-bg) !important;
  border-color: var(--success) !important;
  color: var(--success) !important;
  font-weight: 700;
}
.quiz-option-btn.incorrect {
  background: var(--danger-bg) !important;
  border-color: var(--danger) !important;
  color: var(--danger) !important;
  font-weight: 700;
}
.quiz-option-btn[disabled] {
  cursor: not-allowed;
}



/* --- Study Method Cards New UI --- */
.study-method-card {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.study-method-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  border-color: var(--accent-blue);
  background: var(--bg-card);
}

.study-method-card.quiz-card:hover {
  border-color: #f59e0b;
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.15);
}

/* Limit Button Toggle */
.limit-btn {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-glass);
}
.limit-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}
.limit-btn.active-limit {
  background: var(--accent-blue);
  color: white;
  border-color: var(--accent-blue);
}

/* Filter Button Toggle */
.filter-btn {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-glass);
}
.filter-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}
.filter-btn.active-filter {
  background: var(--accent-purple);
  color: white;
  border-color: var(--accent-purple);
}

/* --- UNIVERSAL CROSS-PLATFORM & MOBILE RESPONSIVE POLISH --- */
html, body {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overflow-x: hidden;
}

body {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

button, input, select, textarea, .btn, .nav-item, .quiz-option-btn, .speaker-btn {
  touch-action: manipulation;
  min-height: 44px;
}

.table-responsive, .custom-words-table-wrap, .detail-table-wrap {
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .flashcard-card {
    min-height: 320px !important;
    padding: 16px !important;
  }
  .study-controls {
    flex-wrap: wrap;
    gap: 8px;
  }
  .control-btn {
    flex: 1 1 45%;
  }
}

/* --- ZUBI / INVOICE.IO DASHBOARD LAYOUT (EXACT MATCH FOR USER SCREENSHOT) --- */
.zubi-dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin-bottom: 40px;
}

/* 1. Header Banner */
.zubi-header-banner {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 50%, #3b82f6 100%);
  border-radius: 20px;
  padding: 36px 40px 64px 40px;
  position: relative;
  overflow: hidden;
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.25);
}

html.dark .zubi-header-banner {
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 60%, #2563eb 100%);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
}

.zubi-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.zubi-header-title .title-bar {
  width: 4px;
  height: 28px;
  background: #ffffff;
  border-radius: 4px;
}

.zubi-header-title h1 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.02em;
}

.zubi-header-subtitle {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
  font-weight: 400;
}

.zubi-header-illustration {
  display: flex;
  gap: 12px;
  align-items: center;
}

.illustration-badge {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #ffffff;
}

.illustration-badge.secondary {
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.15);
}

/* 2. Overlapping Stat Cards Grid */
.zubi-stat-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: -50px;
  position: relative;
  z-index: 10;
  padding: 0 16px;
}

@media (max-width: 900px) {
  .zubi-stat-cards-grid {
    grid-template-columns: 1fr;
    margin-top: -30px;
  }
}

.zubi-stat-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.55) 0%, rgba(225, 238, 255, 0.38) 100%);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 10px 32px 0 rgba(31, 38, 135, 0.08), inset 0 1px 1px rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

html.dark .zubi-stat-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.65) 0%, rgba(30, 41, 59, 0.5) 100%) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 10px 32px 0 rgba(0, 0, 0, 0.37) !important;
}

.zubi-stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12);
}

.zubi-stat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.zubi-circle-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.zubi-circle-icon.pink {
  background: #fce7f3;
  color: #ec4899;
}

.zubi-circle-icon.orange {
  background: #ffedd5;
  color: #f97316;
}

.zubi-circle-icon.cyan {
  background: #e0f2fe;
  color: #0284c7;
}

html.dark .zubi-circle-icon.pink {
  background: rgba(236, 72, 153, 0.2);
}
html.dark .zubi-circle-icon.orange {
  background: rgba(249, 115, 22, 0.2);
}
html.dark .zubi-circle-icon.cyan {
  background: rgba(2, 132, 199, 0.2);
}

.zubi-eye-icon {
  color: #94a3b8;
  font-size: 1.05rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.zubi-eye-icon:hover {
  color: #3b82f6;
}

.zubi-stat-val {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
}

html.dark .zubi-stat-val {
  color: #f8fafc;
}

.zubi-stat-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #64748b;
}

html.dark .zubi-stat-label {
  color: #94a3b8;
}

/* 3. Section Block */
.zubi-section-block {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.zubi-section-header h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

html.dark .zubi-section-header h2 {
  color: #f8fafc;
}

.zubi-recent-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.zubi-recent-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.55) 0%, rgba(225, 238, 255, 0.38) 100%);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.08);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

html.dark .zubi-recent-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.65) 0%, rgba(30, 41, 59, 0.5) 100%) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 10px 32px 0 rgba(0, 0, 0, 0.37) !important;
}

.zubi-recent-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.recent-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.recent-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
  line-height: 1.3;
}

html.dark .recent-title {
  color: #f8fafc;
}

.recent-val {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
}

.recent-val.green-text {
  color: #10b981;
}

.recent-val.cyan-text {
  color: #06b6d4;
}

.recent-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.recent-date {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 500;
}

/* Pills */
.zubi-pill {
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-block;
}

.zubi-pill.warning {
  background: #fef3c7;
  color: #d97706;
}

.zubi-pill.danger {
  background: #fee2e2;
  color: #ef4444;
}

.zubi-pill.success {
  background: #d1fae5;
  color: #059669;
}

html.dark .zubi-pill.warning {
  background: rgba(217, 119, 6, 0.2);
  color: #fbbf24;
}

html.dark .zubi-pill.danger {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

html.dark .zubi-pill.success {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

/* 4. Table Wrap */
.zubi-table-wrap {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.55) 0%, rgba(225, 238, 255, 0.38) 100%);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.08);
  overflow-x: auto;
}

html.dark .zubi-table-wrap {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.65) 0%, rgba(30, 41, 59, 0.5) 100%) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 10px 32px 0 rgba(0, 0, 0, 0.37) !important;
}

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

.zubi-table th {
  padding: 14px 16px;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #e2e8f0;
}

html.dark .zubi-table th {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.zubi-table td {
  padding: 16px;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
}

html.dark .zubi-table td {
  color: #cbd5e1;
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

.zubi-table tr:last-child td {
  border-bottom: none;
}

.zubi-progress-bar-wrap {
  width: 120px;
  height: 8px;
  background: #e2e8f0;
  border-radius: 50px;
  overflow: hidden;
}

html.dark .zubi-progress-bar-wrap {
  background: rgba(255, 255, 255, 0.1);
}

.zubi-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #10b981 100%);
  border-radius: 50px;
}

.zubi-action-link {
  color: #2563eb;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s ease;
}

.zubi-action-link:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

html.dark .zubi-action-link {
  color: #60a5fa;
}

/* --- ZUBI DASHBOARD LIGHT / DARK THEME ADAPTATION --- */
html:not(.dark) .zubi-stat-card {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(226, 232, 240, 0.9) !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05) !important;
}

html:not(.dark) .zubi-stat-val {
  color: #0f172a !important;
}

html:not(.dark) .zubi-stat-label {
  color: #64748b !important;
}

html:not(.dark) .zubi-recent-card {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(226, 232, 240, 0.9) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05) !important;
}

html:not(.dark) .zubi-recent-card .recent-title {
  color: #0f172a !important;
}

html:not(.dark) .zubi-recent-card .recent-date {
  color: #64748b !important;
}

html:not(.dark) .zubi-eye-icon {
  color: #64748b !important;
}

html:not(.dark) .zubi-dashboard-hero {
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.95), rgba(245, 243, 255, 0.95)) !important;
  border-color: rgba(226, 232, 240, 0.9) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04) !important;
}

html:not(.dark) #zubi-hero-title,
html:not(.dark) #zubi-hero-user-name {
  color: #0f172a !important;
}

html:not(.dark) #zubi-hero-subtitle,
html:not(.dark) #zubi-hero-tip {
  color: #475569 !important;
}

html:not(.dark) .zubi-dashboard-table-container {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.58) 0%, rgba(225, 238, 255, 0.42) 100%) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border-color: rgba(255, 255, 255, 0.85) !important;
  box-shadow: 0 10px 32px rgba(31, 38, 135, 0.08) !important;
}

html:not(.dark) .zubi-table th,
html:not(.dark) .zubi-th {
  background: rgba(255, 255, 255, 0.45) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  color: #0f172a !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.8) !important;
}

html:not(.dark) .zubi-table td,
html:not(.dark) .zubi-td {
  color: #1e293b !important;
  border-bottom-color: rgba(255, 255, 255, 0.5) !important;
}

html:not(.dark) #zubi-stat-modal > div,
html:not(.dark) #about-hongtai-modal > div {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.65) 0%, rgba(230, 240, 255, 0.48) 100%) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  border-color: rgba(255, 255, 255, 0.85) !important;
  box-shadow: 0 25px 50px rgba(31, 38, 135, 0.12) !important;
  color: #1e293b !important;
}

html:not(.dark) #zubi-modal-title,
html:not(.dark) #about-hongtai-modal h2,
html:not(.dark) #about-hongtai-modal h3 {
  color: #0f172a !important;
}

html:not(.dark) #zubi-modal-subtitle,
html:not(.dark) #about-hongtai-modal p {
  color: #475569 !important;
}

/* About Hongtai Modal Theme Styles */
html.dark #about-hongtai-modal .about-quote-box {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95)) !important;
  color: #f1f5f9 !important;
  border-left-color: #38bdf8 !important;
}
html:not(.dark) #about-hongtai-modal .about-quote-box {
  background: rgba(255, 255, 255, 0.6) !important;
  backdrop-filter: blur(12px) !important;
  color: #0f172a !important;
  border-left-color: #0284c7 !important;
}

html.dark #about-hongtai-modal .about-card-box {
  background: rgba(15, 23, 42, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #cbd5e1 !important;
}
html:not(.dark) #about-hongtai-modal .about-card-box {
  background: rgba(255, 255, 255, 0.55) !important;
  backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255, 255, 255, 0.8) !important;
  color: #334155 !important;
}

html.dark #about-hongtai-modal .about-card-box p {
  color: #cbd5e1 !important;
}
html:not(.dark) #about-hongtai-modal .about-card-box p {
  color: #475569 !important;
}

html.dark #about-hongtai-modal .about-mission-box {
  background: rgba(239, 68, 68, 0.12) !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
}
html:not(.dark) #about-hongtai-modal .about-mission-box {
  background: rgba(254, 242, 242, 0.7) !important;
  backdrop-filter: blur(12px) !important;
  border: 1px solid #fca5a5 !important;
}

html.dark #about-hongtai-modal .about-mission-title {
  color: #ffffff !important;
}
html:not(.dark) #about-hongtai-modal .about-mission-title {
  color: #991b1b !important;
}

html.dark #about-hongtai-modal .about-mission-box p {
  color: #cbd5e1 !important;
}
html:not(.dark) #about-hongtai-modal .about-mission-box p {
  color: #7f1d1d !important;
}

#about-hongtai-modal .btn-primary {
  background: linear-gradient(135deg, #2563eb, #3b82f6) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3) !important;
}

html.dark #about-hongtai-modal .about-modal-footer {
  background: rgba(15, 23, 42, 0.5) !important;
  border-top-color: rgba(255, 255, 255, 0.1) !important;
  color: #94a3b8 !important;
}
html:not(.dark) #about-hongtai-modal .about-modal-footer {
  background: rgba(255, 255, 255, 0.5) !important;
  border-top-color: rgba(255, 255, 255, 0.8) !important;
  color: #64748b !important;
}

/* --- ZUBI DASHBOARD TABLE & SECTION TITLE STYLES --- */
html.dark .zubi-section-title {
  color: #ffffff !important;
}
html:not(.dark) .zubi-section-title {
  color: #0f172a !important;
}

html.dark .zubi-table-wrap {
  background: rgba(30, 41, 59, 0.65) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35) !important;
}
html:not(.dark) .zubi-table-wrap {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.58) 0%, rgba(225, 238, 255, 0.42) 100%) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.85) !important;
  box-shadow: 0 10px 30px rgba(31, 38, 135, 0.08) !important;
}

html.dark .zubi-th {
  color: #cbd5e1 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  background: rgba(15, 23, 42, 0.4) !important;
}
html:not(.dark) .zubi-th {
  color: #0f172a !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.8) !important;
  background: rgba(255, 255, 255, 0.45) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
}

html.dark .zubi-td {
  color: #f1f5f9 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
html:not(.dark) .zubi-td {
  color: #1e293b !important;
  border-bottom: 1px solid rgba(241, 245, 249, 0.9) !important;
}

html.dark .zubi-td-bold {
  color: #ffffff !important;
}
html:not(.dark) .zubi-td-bold {
  color: #0f172a !important;
}

html.dark .zubi-table-btn {
  color: #60a5fa !important;
}
html:not(.dark) .zubi-table-btn {
  color: #2563eb !important;
}

/* ===== Exam Mode Tabs ===== */
.exam-mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 0;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
  position: relative;
  bottom: -2px;
}

.exam-mode-tab:hover {
  color: #f1f5f9;
}

.exam-mode-tab.active {
  color: #ff2a5f;
  border-bottom-color: #ff2a5f;
}

html:not(.dark) .exam-mode-tab {
  color: #64748b;
}
html:not(.dark) .exam-mode-tab:hover {
  color: #1e293b;
}
html:not(.dark) .exam-mode-tab.active {
  color: #ff2a5f;
}

.exam-tab-badge {
  background: rgba(255,42,95,0.18);
  color: #ff2a5f;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
}

/* ===== Exam Library Cards ===== */
.exam-lib-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 18px 20px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  position: relative;
  overflow: hidden;
}

.exam-lib-card:hover {
  border-color: rgba(255,42,95,0.4);
  box-shadow: 0 4px 20px rgba(255,42,95,0.12);
  transform: translateY(-2px);
}

html:not(.dark) .exam-lib-card,
html.light-mode .exam-lib-card,
html.light .exam-lib-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.58) 0%, rgba(225, 238, 255, 0.42) 100%) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.85) !important;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.08), inset 0 1px 1px rgba(255, 255, 255, 0.9) !important;
}

html.dark .exam-lib-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.65) 0%, rgba(30, 41, 59, 0.5) 100%) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37), inset 0 1px 1px rgba(255, 255, 255, 0.15) !important;
}

html:not(.dark) .exam-lib-card:hover {
  border-color: #ff2a5f !important;
  box-shadow: 0 10px 35px rgba(255,42,95,0.18) !important;
}

.exam-lib-card-level-badge {
  display: inline-block;
  background: linear-gradient(135deg, #ff2a5f, #e11d48);
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
  letter-spacing: 0.05em;
}

.exam-lib-card-code {
  font-size: 1.05rem;
  font-weight: 800;
  color: #f1f5f9;
  margin: 0 0 4px 0;
}
html:not(.dark) .exam-lib-card-code {
  color: #1e293b;
}

.exam-lib-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 14px 0;
}

.exam-lib-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 14px;
}
html:not(.dark) .exam-lib-actions {
  border-top-color: #e2e8f0;
}

.exam-lib-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}

.exam-lib-btn-pdf {
  background: rgba(239,68,68,0.12);
  color: #f87171;
  border-color: rgba(239,68,68,0.25);
}
.exam-lib-btn-pdf:hover {
  background: rgba(239,68,68,0.25);
  color: #fca5a5;
}

.exam-lib-btn-mp3 {
  background: rgba(34,197,94,0.1);
  color: #4ade80;
  border-color: rgba(34,197,94,0.2);
}
.exam-lib-btn-mp3:hover {
  background: rgba(34,197,94,0.22);
  color: #86efac;
}

.exam-lib-btn-ans {
  background: rgba(251,191,36,0.1);
  color: #fcd34d;
  border-color: rgba(251,191,36,0.2);
}
.exam-lib-btn-ans:hover {
  background: rgba(251,191,36,0.22);
  color: #fde68a;
}
html:not(.dark) .exam-lib-btn-mp3 { color: #16a34a; border-color: #bbf7d0; background: #f0fdf4; }
html:not(.dark) .exam-lib-btn-mp3:hover { background: #dcfce7; }
html:not(.dark) .exam-lib-btn-pdf { color: #dc2626; border-color: #fecaca; background: #fff1f2; }
html:not(.dark) .exam-lib-btn-pdf:hover { background: #fee2e2; }
html:not(.dark) .exam-lib-btn-ans { color: #b45309; border-color: #fde68a; background: #fffbeb; }
html:not(.dark) .exam-lib-btn-ans:hover { background: #fef3c7; }

/* ===== Exam Library Filter Pills ===== */
.exam-lib-pill {
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  border: 1.5px solid rgba(255,255,255,0.15);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s;
}
.exam-lib-pill:hover {
  border-color: rgba(255,42,95,0.5);
  color: #f1f5f9;
}
.exam-lib-pill.active {
  background: #ff2a5f;
  border-color: #ff2a5f;
  color: white;
  box-shadow: 0 2px 10px rgba(255,42,95,0.3);
}
html:not(.dark) .exam-lib-pill {
  border-color: #cbd5e1;
  color: #64748b;
}
html:not(.dark) .exam-lib-pill:hover {
  border-color: #ff2a5f;
  color: #1e293b;
}
html:not(.dark) .exam-lib-pill.active { background: #ff2a5f; color: white; }

/* ==========================================================================
   APP SIDEBAR LAYOUT (Lấy cảm hứng từ nhaitopik.com)
   ========================================================================== */
body {
  display: flex;
  min-height: 100vh;
  padding-bottom: 0 !important;
}

/* Left Fixed Sidebar Container */
.app-sidebar {
  width: 260px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 16px;
  transition: all var(--transition-normal);
}

  .sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px 20px 12px;
    border-bottom: 1px solid var(--border-glass);
    margin-bottom: 16px;
  }

  .sidebar-logo {
    height: 44px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.6));
  }

  .sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    overflow-y: auto;
  }

  .sidebar-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
  }

  .sidebar-item i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    color: var(--text-muted);
    transition: color var(--transition-fast);
  }

  .sidebar-item:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-primary);
  }

  .sidebar-item:hover i {
    color: var(--accent-blue);
  }

  .sidebar-item.active {
    background: linear-gradient(135deg, rgba(229, 62, 62, 0.18), rgba(239, 68, 68, 0.08));
    color: var(--accent-primary);
    border: 1px solid rgba(229, 62, 62, 0.25);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.15);
  }

  .sidebar-item.active i {
    color: var(--accent-primary);
  }

  .app-sidebar .auth-container {
    border-left: none;
    padding: 0 0 14px 0;
    height: auto;
    width: 100%;
    position: relative;
    border-bottom: 1px solid var(--border-glass);
    margin-bottom: 12px;
  }

  .app-sidebar .user-dropdown {
    width: 100%;
    position: relative;
  }

  .app-sidebar .sidebar-profile-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    transition: background 0.2s;
  }

  .app-sidebar .sidebar-profile-card:hover {
    background: rgba(59, 130, 246, 0.08);
  }

  .app-sidebar .sidebar-avatar-wrap {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-tertiary, #334155);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-glass);
  }

  .app-sidebar .user-avatar-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: none;
    box-shadow: none;
  }

  .app-sidebar .sidebar-avatar-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .app-sidebar .user-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
  }

  .app-sidebar .user-name {
    font-size: 0.93rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
  }

  .app-sidebar .user-sub {
    font-size: 0.76rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
  }

  .app-sidebar .user-role-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent-blue, #3b82f6);
    margin-top: 1px;
  }

  .app-sidebar .profile-chevron {
    flex-shrink: 0;
    color: var(--text-muted);
  }

  .app-sidebar .profile-dropdown-menu {
    top: calc(100% + 6px);
    bottom: auto;
    left: 0;
    right: 0;
    width: 100%;
  }

  .sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
  }

  /* Main layout offset for Sidebar */
  .navbar {
    display: none !important; /* Hide old navbar */
  }

  .main-layout {
    margin-left: 260px;
    width: calc(100% - 260px) !important;
    max-width: none !important;
    padding: 32px 40px;
    box-sizing: border-box !important;
  }

/* Roadmap Visual Timeline Styles */
.roadmap-step-title, .hsk-badge-label, .comic-title {
  font-family: var(--font-handwriting);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.roadmap-timeline {
  position: relative;
  max-width: 900px;
  margin: 30px auto;
  padding: 20px 0;
}
.roadmap-timeline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 28px;
  width: 4px;
  background: linear-gradient(180deg, var(--accent-blue), var(--accent-primary), var(--accent-teal));
  border-radius: 4px;
}
.roadmap-step {
  position: relative;
  padding-left: 70px;
  margin-bottom: 36px;
}
.roadmap-step-icon {
  position: absolute;
  left: 8px;
  top: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 3px solid var(--accent-blue);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
  z-index: 2;
}
.roadmap-step.completed .roadmap-step-icon {
  border-color: var(--success);
  background: var(--success);
  color: white;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}
.roadmap-step-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.roadmap-step-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-glass-hover);
}

/* ===== GAMIFIED ROADMAP MAP PATH GRAPH STYLES ===== */
.roadmap-container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 10px 0 60px 0;
}

/* ─── DYNAMIC GARDEN HERO BANNER (.cartoon-roadmap-hero) ─── */
.cartoon-roadmap-hero {
  border-radius: 28px !important;
  padding: 36px 32px 28px 32px;
  position: relative;
  overflow: hidden;
  margin-bottom: 32px;
  transition: all 0.5s ease-in-out;
}

/* Light Mode: Glass card mà không chèn hình thứ 2 */
html:not(.dark) .cartoon-roadmap-hero,
html.light-mode .cartoon-roadmap-hero {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.68) 0%, rgba(225, 238, 255, 0.48) 100%) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  border: 2px solid rgba(255, 255, 255, 0.85) !important;
  box-shadow: 0 12px 35px rgba(31, 38, 135, 0.08), inset 0 1px 1px rgba(255, 255, 255, 0.9) !important;
}

html:not(.dark) .cartoon-roadmap-hero .hero-title {
  font-family: var(--font-display, sans-serif);
  font-size: 2.2rem;
  font-weight: 900;
  color: #0f172a !important;
  text-shadow: 0 2px 10px rgba(255, 255, 255, 0.9), 0 0 20px rgba(255, 255, 255, 0.8) !important;
  margin: 0;
  line-height: 1.2;
}

html:not(.dark) .cartoon-roadmap-hero .hero-subtitle {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: #d97706 !important;
  text-shadow: 0 1px 4px rgba(255, 255, 255, 0.9) !important;
  margin-top: 4px;
}

html:not(.dark) .cartoon-roadmap-hero .hero-desc {
  color: #1e293b !important;
  font-size: 0.95rem;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8) !important;
  margin: 8px 0 0 0;
  max-width: 520px;
  line-height: 1.5;
}

html:not(.dark) .cartoon-roadmap-hero .hero-progress-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.68) 0%, rgba(225, 238, 255, 0.5) 100%) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 2px solid rgba(255, 255, 255, 0.9) !important;
  border-radius: 22px;
  padding: 16px 24px;
  margin-top: 20px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 10px 30px rgba(31, 38, 135, 0.1) !important;
  color: #0f172a !important;
}

html:not(.dark) .cartoon-roadmap-hero .hero-ver-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: #0f172a !important;
  text-transform: uppercase;
  font-family: var(--font-display);
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8);
}

html:not(.dark) .cartoon-roadmap-hero .roadmap-ver-pill {
  background: rgba(255, 255, 255, 0.75) !important;
  backdrop-filter: blur(12px) !important;
  border: 2px solid rgba(255, 255, 255, 0.9) !important;
  color: #0f172a !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 12px rgba(31, 38, 135, 0.08) !important;
}

html:not(.dark) .cartoon-roadmap-hero .roadmap-ver-pill:hover {
  background: rgba(255, 255, 255, 0.95) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(31, 38, 135, 0.15) !important;
}

html:not(.dark) .cartoon-roadmap-hero .roadmap-ver-pill.active {
  background: #2563eb !important;
  border-color: #ffffff !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4) !important;
}

/* Dark Mode: Glass card mà không chèn hình thứ 2 */
html.dark .cartoon-roadmap-hero {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.65) 0%, rgba(30, 41, 59, 0.5) 100%) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.18) !important;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.1) !important;
}

html.dark .cartoon-roadmap-hero .hero-title {
  font-family: var(--font-display, sans-serif);
  font-size: 2.2rem;
  font-weight: 900;
  color: #ffffff !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6), 0 0 20px rgba(59, 130, 246, 0.4) !important;
  margin: 0;
  line-height: 1.2;
}

html.dark .cartoon-roadmap-hero .hero-subtitle {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: #fbbf24 !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5) !important;
  margin-top: 4px;
}

html.dark .cartoon-roadmap-hero .hero-desc {
  color: #f8fafc !important;
  font-size: 0.95rem;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
  margin: 8px 0 0 0;
  max-width: 520px;
  line-height: 1.5;
}

html.dark .cartoon-roadmap-hero .hero-progress-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.72) 0%, rgba(30, 41, 59, 0.6) 100%) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 2px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 22px;
  padding: 16px 24px;
  margin-top: 20px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35) !important;
  color: #ffffff !important;
}

html.dark .cartoon-roadmap-hero .hero-ver-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: #ffffff !important;
  text-transform: uppercase;
  font-family: var(--font-display);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

html.dark .cartoon-roadmap-hero .roadmap-ver-pill {
  background: rgba(30, 41, 59, 0.75) !important;
  backdrop-filter: blur(12px) !important;
  border: 2px solid rgba(255, 255, 255, 0.2) !important;
  color: #f8fafc !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

html.dark .cartoon-roadmap-hero .roadmap-ver-pill:hover {
  background: rgba(30, 41, 59, 0.95) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3) !important;
}

html.dark .cartoon-roadmap-hero .roadmap-ver-pill.active {
  background: #3b82f6 !important;
  border-color: #ffffff !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4) !important;
}

#home-view-section {
  background: transparent;
  padding: 0;
}

#roadmap-view-section,
#flashcard-section,
#custom-section {
  background: rgba(15, 23, 42, 0.45) !important;
  backdrop-filter: blur(28px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(200%) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 28px;
  padding: 28px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3) !important;
}

html.light-mode #roadmap-view-section,
html.light-mode #flashcard-section,
html.light-mode #custom-section {
  background: rgba(255, 255, 255, 0.6) !important;
  backdrop-filter: blur(28px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(200%) !important;
  border: 1px solid rgba(255, 255, 255, 0.8) !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08) !important;
}

.roadmap-path-trail {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  padding: 20px 0;
}

.roadmap-node-item {
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
  z-index: 5;
}

/* Winding Path Layout for Saga Map */
.roadmap-node-item:nth-child(even) {
  flex-direction: row-reverse;
}

/* Custom positioning to create the zigzag */
.roadmap-node-item:nth-child(4n+1) { transform: translateX(-15%); }
.roadmap-node-item:nth-child(4n+2) { transform: translateX(0%); }
.roadmap-node-item:nth-child(4n+3) { transform: translateX(15%); }
.roadmap-node-item:nth-child(4n+4) { transform: translateX(0%); }

/* Arrow Connector Customization for ZigZag */
.roadmap-connector-arrow {
  text-align: center;
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.6);
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  margin: -15px 0;
  z-index: 1;
}

/* CANDY CRUSH 3D GLOSSY JELLY NODE BUTTON */
.node-icon-circle {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
  border: 4px solid #ffffff;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 900;
  cursor: pointer;
  position: relative;
  box-shadow: 0 10px 0 #b45309, 0 14px 20px rgba(0,0,0,0.35);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Ánh sáng bóng Candy Highlight 3D */
.node-icon-circle::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 10px;
  width: 52px;
  height: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.1));
  border-radius: 40px 40px 20px 20px;
  pointer-events: none;
}

.node-icon-circle:hover {
  transform: translateY(-4px) scale(1.06);
  box-shadow: 0 14px 0 #b45309, 0 18px 25px rgba(0,0,0,0.4);
}

.node-icon-circle:active {
  transform: translateY(6px) scale(0.96);
  box-shadow: 0 4px 0 #b45309, 0 6px 10px rgba(0,0,0,0.3);
}

.node-icon-circle .node-num {
  font-size: 1.5rem;
  font-weight: 900;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  font-family: var(--font-display);
}

/* Nút Hồng Nút Vàng Candy cho cấp Hoàn Thành & Đang Học */
.node-done .node-icon-circle {
  background: linear-gradient(180deg, #f472b6 0%, #db2777 100%);
  border-color: #ffffff;
  box-shadow: 0 10px 0 #9d174d, 0 14px 20px rgba(219, 39, 119, 0.4);
}

.node-done .node-icon-circle:hover {
  box-shadow: 0 14px 0 #9d174d, 0 18px 25px rgba(219, 39, 119, 0.5);
}

.node-active .node-icon-circle {
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
  border-color: #ffffff;
  animation: candyPulse 1.8s infinite alternate;
  box-shadow: 0 10px 0 #b45309, 0 14px 25px rgba(245, 158, 11, 0.6);
}

.node-locked .node-icon-circle {
  background: linear-gradient(180deg, #94a3b8 0%, #64748b 100%);
  border-color: #e2e8f0;
  box-shadow: 0 8px 0 #334155, 0 10px 15px rgba(0,0,0,0.2);
  filter: grayscale(0.5);
}

@keyframes candyPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.1); box-shadow: 0 12px 0 #b45309, 0 0 30px rgba(251, 191, 36, 0.8); }
}

.node-info-card {
  flex: 1;
  max-width: 380px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.node-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.node-card-title {
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
}

.roadmap-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
}

.roadmap-badge.done { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.roadmap-badge.active-pulse { background: rgba(59, 130, 246, 0.25); color: #60a5fa; }
.roadmap-badge.locked { background: rgba(100, 116, 139, 0.2); color: var(--text-muted); }

.node-card-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.btn-node-start {
  width: 100%;
  padding: 8px 14px;
  background: #3b82f6;
  border: none;
  border-radius: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
}
html.light-mode .level-tab.active,
html.light-mode .status-filter-btn.active {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
}

/* ─── LIGHT MODE EXTENDED: Flashcard ─── */
html.light-mode .flashcard-card,
html.light .flashcard-card,
html:not(.dark) .flashcard-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.62) 0%, rgba(225, 238, 255, 0.45) 100%) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.85) !important;
  color: #0f172a !important;
  box-shadow: 0 10px 32px rgba(31, 38, 135, 0.08) !important;
}
html.light-mode .card-word-front {
  color: #0f172a !important;
}
html.light-mode .card-pinyin-back {
  color: #1d4ed8 !important;
}
html.light-mode .card-meaning-back {
  color: #0f172a !important;
}
html.light-mode .card-example-zh-back {
  color: #0f172a !important;
}
html.light-mode .card-example-vi-back {
  color: #334155 !important;
}

/* ─── LIGHT MODE EXTENDED: Modals (rendered via main.js inline) ─── */
html.light-mode [style*="background: var(--bg-primary, #1e293b)"],
html.light-mode [style*="background:var(--bg-primary, #1e293b)"],
html.light-mode [style*="background: var(--bg-secondary, #0f172a)"],
html.light-mode [style*="background:var(--bg-secondary, #0f172a)"] {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.65) 0%, rgba(230, 240, 255, 0.45) 100%) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.85) !important;
  color: #0f172a !important;
}
html.light-mode [style*="color: var(--text-primary, #fff)"],
html.light-mode [style*="color:var(--text-primary, #fff)"] {
  color: #0f172a !important;
}

/* ─── LEADERBOARD LIQUID GLASS SYSTEM (Light & Dark Mode) ─── */
#leaderboard-modal {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

html.light-mode #leaderboard-modal,
html:not(.dark) #leaderboard-modal {
  background: rgba(15, 23, 42, 0.35) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
}

html.dark #leaderboard-modal {
  background: rgba(0, 0, 0, 0.72) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
}

/* Modal Main Card Container */
.leaderboard-modal-content {
  border-radius: 28px !important;
  width: 100%;
  max-width: 680px;
  padding: 24px 28px;
  position: relative;
  transition: all 0.3s ease;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lb-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: var(--text-muted, #94a3b8);
  font-size: 1.4rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
}

.lb-close-btn:hover {
  transform: scale(1.1);
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* Modal Header */
.lb-modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.lb-mascot-img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(251, 191, 36, 0.4));
  animation: floatMascot 3s ease-in-out infinite alternate;
}

@keyframes floatMascot {
  0% { transform: translateY(0px) rotate(-2deg); }
  100% { transform: translateY(-6px) rotate(3deg); }
}

.lb-title {
  font-size: 1.35rem;
  font-weight: 900;
  margin: 0;
  letter-spacing: -0.01em;
}

.lb-subtitle {
  font-size: 0.8rem;
  opacity: 0.85;
  margin-top: 2px;
  font-weight: 600;
}

.lb-body-container {
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* PODIUM STAGE CONTAINER */
.lb-podium-stage {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  padding: 20px 10px 10px 10px;
  margin-bottom: 8px;
  position: relative;
}

.lb-podium-slot {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
}

/* Slot Heights & Elevation */
.rank-1-slot {
  order: 2;
  z-index: 3;
}
.rank-2-slot {
  order: 1;
  z-index: 2;
}
.rank-3-slot {
  order: 3;
  z-index: 1;
}

.lb-podium-crown {
  font-size: 1.6rem;
  margin-bottom: -6px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
  z-index: 2;
}

.gold-crown {
  font-size: 2.2rem;
  margin-bottom: -8px;
  animation: pulseGold 2s infinite alternate;
}

@keyframes pulseGold {
  0% { transform: scale(1); }
  100% { transform: scale(1.12); }
}

.lb-podium-avatar-wrap {
  position: relative;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-podium-user {
  font-weight: 800;
  font-size: 0.88rem;
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.gold-user {
  font-size: 1rem;
  font-weight: 900;
}

.lb-podium-score {
  font-weight: 900;
  font-size: 0.8rem;
  margin-bottom: 8px;
}

/* Liquid Glass Podium Stand Bases */
.lb-podium-stand {
  width: 100%;
  border-radius: 18px 18px 8px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  position: relative;
  transition: all 0.3s ease;
}

.p-1 {
  height: 110px;
}

.p-2 {
  height: 85px;
}

.p-3 {
  height: 68px;
}

.lb-podium-num {
  font-size: 2.2rem;
  font-weight: 900;
  opacity: 0.9;
  font-family: var(--font-display);
}

/* Light Mode Podium Liquid Glass Styles */
html.light-mode .leaderboard-modal-content,
html:not(.dark) .leaderboard-modal-content {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.82) 0%, rgba(225, 238, 255, 0.65) 100%) !important;
  backdrop-filter: blur(28px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(180%) !important;
  border: 2.5px solid rgba(255, 255, 255, 0.95) !important;
  box-shadow: 0 20px 60px rgba(31, 38, 135, 0.18), inset 0 1px 1px rgba(255, 255, 255, 0.95) !important;
  color: #0f172a !important;
}

html.light-mode .lb-title,
html:not(.dark) .lb-title {
  color: #0f172a !important;
}

html.light-mode .lb-subtitle,
html:not(.dark) .lb-subtitle {
  color: #475569 !important;
}

html.light-mode .p-1,
html:not(.dark) .p-1 {
  background: linear-gradient(180deg, rgba(254, 243, 199, 0.9) 0%, rgba(251, 191, 36, 0.6) 100%) !important;
  border: 2px solid rgba(245, 158, 11, 0.7) !important;
  color: #b45309 !important;
  box-shadow: 0 10px 25px rgba(217, 119, 6, 0.22) !important;
}

html.light-mode .p-2,
html:not(.dark) .p-2 {
  background: linear-gradient(180deg, rgba(241, 245, 249, 0.9) 0%, rgba(203, 213, 225, 0.6) 100%) !important;
  border: 2px solid rgba(148, 163, 184, 0.7) !important;
  color: #475569 !important;
  box-shadow: 0 8px 20px rgba(71, 85, 105, 0.15) !important;
}

html.light-mode .p-3,
html:not(.dark) .p-3 {
  background: linear-gradient(180deg, rgba(254, 226, 226, 0.9) 0%, rgba(252, 165, 165, 0.6) 100%) !important;
  border: 2px solid rgba(239, 68, 68, 0.6) !important;
  color: #b91c1c !important;
  box-shadow: 0 8px 20px rgba(225, 29, 72, 0.15) !important;
}

html.light-mode .gold-user,
html:not(.dark) .gold-user {
  color: #b45309 !important;
}

html.light-mode .gold-score,
html:not(.dark) .gold-score {
  color: #d97706 !important;
}

html.light-mode .lb-podium-user,
html:not(.dark) .lb-podium-user {
  color: #0f172a !important;
}

html.light-mode .lb-podium-score,
html:not(.dark) .lb-podium-score {
  color: #2563eb !important;
}

/* Dark Mode Podium Liquid Glass Styles */
html.dark .leaderboard-modal-content {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85) 0%, rgba(30, 41, 59, 0.75) 100%) !important;
  backdrop-filter: blur(28px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(180%) !important;
  border: 2px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
}

html.dark .lb-title {
  color: #ffffff !important;
}

html.dark .lb-subtitle {
  color: #94a3b8 !important;
}

html.dark .p-1 {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.35) 0%, rgba(217, 119, 6, 0.2) 100%) !important;
  border: 2px solid rgba(251, 191, 36, 0.7) !important;
  color: #fbbf24 !important;
  box-shadow: 0 10px 25px rgba(251, 191, 36, 0.25) !important;
}

html.dark .p-2 {
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.3) 0%, rgba(100, 116, 139, 0.18) 100%) !important;
  border: 2px solid rgba(148, 163, 184, 0.6) !important;
  color: #e2e8f0 !important;
  box-shadow: 0 8px 20px rgba(148, 163, 184, 0.2) !important;
}

html.dark .p-3 {
  background: linear-gradient(180deg, rgba(225, 29, 72, 0.3) 0%, rgba(180, 83, 9, 0.18) 100%) !important;
  border: 2px solid rgba(244, 63, 94, 0.6) !important;
  color: #f43f5e !important;
  box-shadow: 0 8px 20px rgba(244, 63, 94, 0.2) !important;
}

html.dark .gold-user {
  color: #fbbf24 !important;
}

html.dark .gold-score {
  color: #fbbf24 !important;
}

html.dark .lb-podium-user {
  color: #ffffff !important;
}

html.dark .lb-podium-score {
  color: #38bdf8 !important;
}

/* Rest List Title */
.lb-rest-title {
  font-weight: 800;
  font-size: 0.95rem;
  margin-top: 10px;
  margin-bottom: 6px;
  padding-left: 4px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

html.light-mode .lb-rest-title,
html:not(.dark) .lb-rest-title {
  color: #3b82f6 !important;
}

html.dark .lb-rest-title {
  color: #38bdf8 !important;
}

.lb-rest-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Rest Items Rows */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  transition: all 0.2s ease;
}

html.light-mode .leaderboard-item,
html:not(.dark) .leaderboard-item {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.65) 0%, rgba(240, 246, 255, 0.5) 100%) !important;
  backdrop-filter: blur(16px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.9) !important;
  box-shadow: 0 4px 16px rgba(31, 38, 135, 0.06) !important;
  color: #0f172a !important;
}

html.dark .leaderboard-item {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.65) 0%, rgba(15, 23, 42, 0.55) 100%) !important;
  backdrop-filter: blur(16px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.14) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25) !important;
  color: #ffffff !important;
}

.lb-rank-num {
  font-weight: 800;
  font-size: 0.95rem;
  width: 32px;
  text-align: center;
  opacity: 0.8;
}

.lb-row-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255,255,255,0.4);
}

.lb-row-avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #3b82f6;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

/* ──────── STANDALONE RANK.HTML STYLES ──────── */
.rank-page-body {
  min-height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.rank-header-nav {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  position: sticky;
  top: 0;
  z-index: 100;
}

html.light-mode .rank-header-nav,
html:not(.dark) .rank-header-nav {
  background: rgba(255, 255, 255, 0.72) !important;
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.85) !important;
}

html.dark .rank-header-nav {
  background: rgba(15, 23, 42, 0.75) !important;
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.12) !important;
}

.rank-brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.15rem;
}

.rank-brand-logo img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

html.light-mode .rank-brand-logo span,
html:not(.dark) .rank-brand-logo span {
  color: #0f172a !important;
}

html.dark .rank-brand-logo span {
  color: #ffffff !important;
}

.rank-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ──────── ICON-ONLY HEADER BUTTONS ACROSS ALL PAGES ──────── */
.theme-btn-text,
.home-btn-text,
.nav-btn-text {
  display: none !important;
}

.theme-toggle-btn-top,
.btn-theme-toggle,
.btn-home-top,
.nav-home-btn,
.rank-theme-btn,
.rank-nav-btn,
.particle-toggle-btn {
  width: 40px !important;
  height: 40px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.1rem !important;
  text-decoration: none !important;
  line-height: 1 !important;
  cursor: pointer !important;
}

.particle-toggle-btn {
  pointer-events: auto !important;
  z-index: 1000 !important;
  position: relative !important;
  cursor: pointer !important;
}

.particle-toggle-btn.particles-off {
  opacity: 0.5 !important;
  filter: grayscale(80%) !important;
}

.rank-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 40px;
  border-radius: 20px;
  font-size: 1.1rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

html.light-mode .rank-nav-btn,
html:not(.dark) .rank-nav-btn {
  background: rgba(255, 255, 255, 0.8) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.95) !important;
  color: #0f172a !important;
  box-shadow: 0 4px 12px rgba(31, 38, 135, 0.08) !important;
}

html.dark .rank-nav-btn {
  background: rgba(30, 41, 59, 0.7) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
}

.rank-nav-btn:hover {
  transform: translateY(-2px);
}

.rank-theme-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

html.light-mode .rank-theme-btn,
html:not(.dark) .rank-theme-btn {
  background: rgba(255, 255, 255, 0.85) !important;
  color: #d97706 !important;
  border: 1.5px solid rgba(255, 255, 255, 0.95) !important;
}

html.dark .rank-theme-btn {
  background: rgba(30, 41, 59, 0.8) !important;
  color: #fbbf24 !important;
  border: 1.5px solid rgba(255, 255, 255, 0.15) !important;
}

.rank-main-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.rank-modal-standalone {
  margin: 0 auto;
  max-width: 720px !important;
}

.rank-modal-standalone .lb-close-btn {
  display: none !important;
}

/* ─── LIGHT MODE EXTENDED: Game History modal ─── */
html.light-mode #gameHistoryModal .modal-content,
html.light-mode .modal-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.65) 0%, rgba(230, 240, 255, 0.48) 100%) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.85) !important;
  color: #0f172a !important;
  box-shadow: 0 12px 40px rgba(31, 38, 135, 0.12) !important;
}
html.light-mode #gameHistoryModal table th {
  color: #1d4ed8 !important;
}
html.light-mode #gameHistoryModal table td {
  color: #334155 !important;
  border-color: rgba(255, 255, 255, 0.6) !important;
}

/* ─── LIGHT MODE EXTENDED: Badges / Tags ─── */
html.light-mode .badge,
html.light-mode .level-badge,
html.light-mode .hsk-badge {
  background: rgba(37,99,235,0.12) !important;
  color: #1d4ed8 !important;
  border-color: rgba(37,99,235,0.25) !important;
}

/* ─── LIGHT MODE EXTENDED: Stats row ─── */
html.light-mode .stats-bar,
html.light-mode .stat-item {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.55) 0%, rgba(225, 238, 255, 0.38) 100%) !important;
  backdrop-filter: blur(16px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.82) !important;
  color: #0f172a !important;
}
html.light-mode .stat-value {
  color: #1d4ed8 !important;
}
html.light-mode .stat-label {
  color: #334155 !important;
}

/* ─── LIGHT MODE EXTENDED: Toast Notification ─── */
html.light-mode #toast {
  background: rgba(15, 23, 42, 0.85) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* ─── LIGHT MODE EXTENDED: Chest / Gamification ─── */
html.light-mode .chest-desc {
  color: #475569 !important;
}

/* ─── LIGHT MODE EXTENDED: Inline colors in rendered HTML ─── */
html.light-mode [style*="color: #64748b"],
html.light-mode [style*="color:#64748b"] {
  color: #475569 !important;
}
html.light-mode [style*="background: rgba(15,23,42"],
html.light-mode [style*="background:rgba(15,23,42"],
html.light-mode [style*="background: rgba(15, 23, 42"],
html.light-mode [style*="background: rgba(30,41,59"],
html.light-mode [style*="background:rgba(30,41,59"],
html.light-mode [style*="background: rgba(30, 41, 59"] {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

/* ─── LIGHT MODE: Google Account Cards in Login Modal ─── */
html.light-mode .google-acc-card {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #1e293b !important;
}
html.light-mode .google-acc-card:hover {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}
html.light-mode .modal-card {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #e2e8f0 !important;
}

/* ─── LIGHT MODE: Zubi/Dashboard Stat Cards ─── */
html.light-mode .zubi-stat-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06) !important;
  color: #1e293b !important;
}

/* ─── LIGHT MODE: Sidebar menu & Profile card (iOS 26 Light Glass) ─── */
html.light-mode .app-sidebar,
html.light .app-sidebar,
html:not(.dark) .app-sidebar,
body.light-mode .app-sidebar {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.42) 0%, rgba(220, 235, 255, 0.28) 100%) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.75) !important;
  box-shadow: 0 10px 35px rgba(31, 38, 135, 0.08), inset 0 1px 1px rgba(255, 255, 255, 0.9), inset -1px 0 0 rgba(255, 255, 255, 0.5) !important;
}

html.light-mode .sidebar-menu-item,
html.light-mode .sidebar-item,
html.light-mode .sidebar-subitem,
html.light-mode .sidebar-dropdown-toggle,
html.light .sidebar-item,
html.light .sidebar-subitem,
html:not(.dark) .sidebar-item,
html:not(.dark) .sidebar-subitem {
  color: #0f172a !important;
  font-weight: 700 !important;
}

html.light-mode .sidebar-item i,
html.light-mode .sidebar-subitem i,
html.light .sidebar-item i,
html:not(.dark) .sidebar-item i {
  color: #1e293b !important;
  font-weight: 700 !important;
}

html.light-mode .sidebar-section-label,
html.light .sidebar-section-label,
html:not(.dark) .sidebar-section-label {
  color: #0f172a !important;
  font-weight: 800 !important;
  letter-spacing: 0.04em !important;
}

html.light-mode .sidebar-header span,
html.light .sidebar-header span,
html:not(.dark) .sidebar-header span {
  color: #0f172a !important;
  font-weight: 900 !important;
}

html.light-mode .sidebar-menu-item:hover,
html.light-mode .sidebar-item:hover,
html.light-mode .sidebar-subitem:hover,
html.light-mode .sidebar-dropdown-toggle:hover {
  background: rgba(37, 99, 235, 0.14) !important;
  border: 1px solid rgba(37, 99, 235, 0.25) !important;
  color: #1d4ed8 !important;
}

html.light-mode .sidebar-menu-item.active,
html.light-mode .sidebar-item.active,
html.light-mode .sidebar-subitem.active {
  background: linear-gradient(135deg, #1d4ed8, #1e40af) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.4) !important;
}

html.light-mode .sidebar-item.active i,
html.light-mode .sidebar-subitem.active i {
  color: #ffffff !important;
}

html.light-mode .sidebar-profile-card {
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.95) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
  color: #0f172a !important;
}

html.light-mode .sidebar-profile-card .user-name {
  color: #0f172a !important;
  font-weight: 800 !important;
}

html.light-mode .sidebar-profile-card .user-sub {
  color: #475569 !important;
  font-weight: 600 !important;
}

html.light-mode .sidebar-profile-card:hover {
  background: #f1f5f9 !important;
  border-color: #2563eb !important;
}

html.light-mode #sidebar-theme-toggle {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html.light-mode #sidebar-theme-toggle:hover {
  background: #e2e8f0 !important;
  color: #1d4ed8 !important;
}

/* ─── DARK MODE: Sidebar menu & Profile card (iOS 26 Liquid Glass) ─── */
html.dark .app-sidebar {
  background: rgba(11, 15, 25, 0.45) !important;
  backdrop-filter: blur(28px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(200%) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.18) !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3) !important;
}

html.dark .sidebar-profile-card,
html.dark .user-profile,
html.dark .google-acc-card {
  background: rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  border-radius: 18px !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2) !important;
  color: #ffffff !important;
}

html.dark .sidebar-menu-item,
html.dark .sidebar-item,
html.dark .sidebar-subitem,
html.dark .sidebar-dropdown-toggle {
  color: #f1f5f9 !important;
  border-radius: 14px !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

html.dark .sidebar-menu-item:hover,
html.dark .sidebar-item:hover,
html.dark .sidebar-subitem:hover,
html.dark .sidebar-dropdown-toggle:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
}

html.dark .sidebar-menu-item.active,
html.dark .sidebar-item.active,
html.dark .sidebar-subitem.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.85), rgba(37, 99, 235, 0.95)) !important;
  border: 1px solid rgba(255, 255, 255, 0.4) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45) !important;
}

html.dark .user-name {
  color: #ffffff !important;
  font-weight: 700 !important;
}

html.dark .user-sub,
html.dark .sidebar-section-label {
  color: #94a3b8 !important;
}

html.dark #sidebar-theme-toggle {
  background: #1e293b !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
}

html.dark #sidebar-theme-toggle:hover {
  background: #334155 !important;
  color: #ffffff !important;
}

/* ─── LIGHT MODE: Vocab table rows ─── */
html.light-mode .vocab-table tr:nth-child(even) {
  background: #f8fafc !important;
}
html.light-mode .vocab-table th {
  background: #f1f5f9 !important;
  color: #475569 !important;
}
html.light-mode .vocab-table td {
  color: #334155 !important;
  border-color: #e2e8f0 !important;
}

/* ─── LIGHT MODE: Lesson card ─── */
html.light-mode .lesson-card,
html.light-mode .lesson-item {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #1e293b !important;
}

/* ─── GLOBAL ABSOLUTE DARK MODE OVERRIDES (Đảm bảo chuyển Tối dứt khoát 100%) ─── */
html.dark {
  --bg-primary: #0b0f19;
  --bg-secondary: #131c31;
  --border-glass-hover: rgba(255, 255, 255, 0.15);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  color: #f8fafc !important;
}

html.dark body {
  background: url('/assets/app_bg_night_v3.png') no-repeat center center fixed / cover !important;
  color: #f8fafc !important;
  transition: background 0.5s ease-in-out;
}

/* Ép trả lại màu nền tối cho tất cả ô card khi ở chế độ TỐI */
html.dark .zubi-stat-card,
html.dark .zubi-recent-card,
html.dark .zubi-table-card,
html.dark .google-acc-card,
html.dark .modal-card,
html.dark .glass-panel,
html.dark .voice-control-bar,
html.dark .info-sub-card,
html.dark .group-block,
html.dark .char-detail-inspector,
html.dark .vd-box,
html.dark .modal-content,
html.dark .vocab-panel,
html.dark .filter-section,
html.dark .writing-workshop,
html.dark .sidebar-profile-card {
  background: rgba(15, 23, 42, 0.6) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 10px 32px 0 rgba(0, 0, 0, 0.37) !important;
  color: #ffffff !important;
}

html.dark .zubi-stat-val,
html.dark .recent-title,
html.dark .zubi-td-bold {
  color: #ffffff !important;
}

html.dark .zubi-stat-label,
html.dark .zubi-eye-icon,
html.dark .text-secondary {
  color: #94a3b8 !important;
}

/* ─── GLOBAL ABSOLUTE LIGHT MODE TEXT & ROADMAP OVERRIDES ─── */
html.light-mode {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.9);
  --border-glass: rgba(0, 0, 0, 0.1);
  --border-glass-hover: rgba(0, 0, 0, 0.2);
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --card-bg-front: #ffffff;
  --card-bg-back: #f8fafc;
  color: #0f172a !important;
}

html.light-mode body {
  background: url('/assets/app_bg_day_v3.png') no-repeat center center fixed / cover !important;
  color: #0f172a !important;
  transition: background 0.5s ease-in-out;
}

/* Ép tất cả các thẻ chữ thông thường sang màu tối chuẩn khi ở chế độ SÁNG */
html.light-mode h1:not(.btn *),
html.light-mode h2:not(.btn *),
html.light-mode h3:not(.btn *),
html.light-mode h4:not(.btn *),
html.light-mode h5:not(.btn *),
html.light-mode h6:not(.btn *),
html.light-mode p:not(.btn *),
html.light-mode span:not(.btn *):not(.badge):not(.badge *):not(.c-red):not(.c-blue):not(.c-green):not(.c-yellow),
html.light-mode div:not(.btn *):not(.badge *):not(.btn-node-start),
html.light-mode td,
html.light-mode th,
html.light-mode li,
html.light-mode label {
  color: inherit;
}

/* Đảm bảo chữ trắng inline style chuyển thành tối dứt khoát */
html.light-mode [style*="color: #fff"]:not(.btn *):not(.btn):not(.badge *):not(.roadmap-header-banner *):not(.btn-node-start),
html.light-mode [style*="color:#fff"]:not(.btn *):not(.btn):not(.badge *):not(.roadmap-header-banner *):not(.btn-node-start),
html.light-mode [style*="color: #ffffff"]:not(.btn *):not(.btn):not(.badge *):not(.roadmap-header-banner *):not(.btn-node-start),
html.light-mode [style*="color:#ffffff"]:not(.btn *):not(.btn):not(.badge *):not(.roadmap-header-banner *):not(.btn-node-start),
html.light-mode [style*="color: white"]:not(.btn *):not(.btn):not(.badge *):not(.roadmap-header-banner *):not(.btn-node-start),
html.light-mode [style*="color:white"]:not(.btn *):not(.btn):not(.badge *):not(.roadmap-header-banner *):not(.btn-node-start) {
  color: #0f172a !important;
}

html.light-mode [style*="color: #f8fafc"],
html.light-mode [style*="color:#f8fafc"],
html.light-mode [style*="color: #e2e8f0"],
html.light-mode [style*="color:#e2e8f0"],
html.light-mode [style*="color: #cbd5e1"],
html.light-mode [style*="color:#cbd5e1"],
html.light-mode [style*="color: #94a3b8"],
html.light-mode [style*="color:#94a3b8"],
html.light-mode [style*="color: #64748b"],
html.light-mode [style*="color:#64748b"] {
  color: #334155 !important;
}

/* Tự động chuyển nền tối sẫm inline style sang nền Liquid Glass mờ */
html.light-mode [style*="background: rgba(15,23,42"],
html.light-mode [style*="background:rgba(15,23,42"],
html.light-mode [style*="background: rgba(15, 23, 42"],
html.light-mode [style*="background: rgba(30,41,59"],
html.light-mode [style*="background:rgba(30,41,59"],
html.light-mode [style*="background: rgba(30, 41, 59"],
html.light-mode [style*="background: #0f172a"],
html.light-mode [style*="background:#0f172a"],
html.light-mode [style*="background: #1e293b"],
html.light-mode [style*="background:#1e293b"],
html.light-mode [style*="background: #0b0f19"],
html.light-mode [style*="background:#0b0f19"],
html.light-mode [style*="background:rgba(30, 41, 59"],
html.light-mode [style*="background: rgba(30,41,59,0.9)"],
html.light-mode [style*="background: rgba(30, 41, 59, 0.9)"],
html.light-mode [style*="background: rgba(30, 41, 59, 0.95)"],
html.light-mode [style*="background: rgba(30,41,59,0.95)"],
html.light-mode [style*="background: rgba(30, 41, 59, 0.6)"],
html.light-mode [style*="background: rgba(30,41,59,0.6)"] {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.62) 0%, rgba(225, 238, 255, 0.45) 100%) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border-color: rgba(255, 255, 255, 0.85) !important;
  color: #0f172a !important;
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.08) !important;
}

/* ─── ROADMAP SPECIFIC LIGHT MODE OVERRIDES ─── */
html.light-mode .roadmap-ver-pill {
  background: rgba(255, 255, 255, 0.6) !important;
  backdrop-filter: blur(12px) !important;
  border-color: rgba(255, 255, 255, 0.8) !important;
  color: #334155 !important;
}
html.light-mode .roadmap-ver-pill:hover {
  background: rgba(255, 255, 255, 0.85) !important;
  color: #0f172a !important;
}
html.light-mode .roadmap-ver-pill.active {
  background: #3b82f6 !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3) !important;
}

/* Roadmap Level Nodes & Cards in Light Mode */
html.light-mode .node-info-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.62) 0%, rgba(225, 238, 255, 0.45) 100%) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.85) !important;
  color: #0f172a !important;
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.08) !important;
}
html.light-mode .node-card-title {
  color: #0f172a !important;
}

/* Roadmap Connector Arrow Contrast Fix */
html.dark .roadmap-connector-arrow {
  color: rgba(255, 255, 255, 0.4) !important;
}
html:not(.dark) .roadmap-connector-arrow {
  color: #3b82f6 !important;
}

/* Foreign / Sidebar Elements in Light Mode */
html.light-mode .app-sidebar,
html.light .app-sidebar,
html:not(.dark) .app-sidebar,
body.light-mode .app-sidebar {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.42) 0%, rgba(220, 235, 255, 0.28) 100%) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.75) !important;
  box-shadow: 0 10px 35px rgba(31, 38, 135, 0.08), inset 0 1px 1px rgba(255, 255, 255, 0.9), inset -1px 0 0 rgba(255, 255, 255, 0.5) !important;
}
html.light-mode .sidebar-section-label {
  color: #64748b !important;
}

/* Ngoại lệ: Giữ chữ trắng tương phản cho Nút bấm màu, Thẻ Badge màu */
html.light-mode .btn-primary,
html.light-mode .btn-success,
html.light-mode .btn-danger,
html.light-mode .btn-warning,
html.light-mode .ans-btn,
html.light-mode .c-red,
html.light-mode .c-blue,
html.light-mode .c-yellow,
html.light-mode .c-green,
html.light-mode .btn-node-start {
  color: #ffffff !important;
}

/* Notebook Lesson Pill Filter Buttons */
.nb-lesson-pill {
  font-size: 0.78rem;
  padding: 6px 14px;
  border-radius: 50px;
  cursor: pointer;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(241, 245, 249, 0.9);
  color: #1e293b !important;
  font-weight: 600;
  transition: all 0.2s ease;
}
html.dark .nb-lesson-pill,
body.dark .nb-lesson-pill {
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9 !important;
  border-color: rgba(255, 255, 255, 0.15);
}
.nb-lesson-pill:hover {
  border-color: #3b82f6;
  color: #2563eb !important;
}
html.dark .nb-lesson-pill:hover,
body.dark .nb-lesson-pill:hover {
  border-color: #60a5fa;
  color: #60a5fa !important;
}
.nb-lesson-pill.active {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* Sidebar Toggle & Collapsed State Rules */
.sidebar-expand-float-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 999;
  background: var(--bg-glass, rgba(15, 23, 42, 0.88));
  backdrop-filter: blur(16px);
}

/* =======================================================
   LIGHT MODE iOS 26 LIQUID GLASSMORPHISM
   ======================================================= */
html.light-mode, body.light-mode, html.light {
  --bg-primary: #f1f5f9;
  --bg-secondary: rgba(255, 255, 255, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.68);
  --border-glass: rgba(255, 255, 255, 0.8);
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  color: #0f172a !important;
}

html.light-mode body, body.light-mode {
  background: url('/assets/app_bg_day_v3.png') no-repeat center center fixed / cover !important;
  color: #0f172a !important;
  transition: background 0.5s ease-in-out;
}

/* Đảm bảo toàn bộ thẻ panel, card, modal ở chế độ sáng dùng iOS 26 Liquid Glass */
html.light-mode .glass-panel,
html.light-mode .voice-control-bar,
html.light-mode .zubi-stat-card,
html.light-mode .zubi-recent-card,
html.light-mode .zubi-table-card,
html.light-mode .info-sub-card,
html.light-mode .group-block,
html.light-mode .char-detail-inspector,
html.light-mode .vd-box,
html.light-mode .modal-content,
html.light-mode .vocab-panel,
html.light-mode .filter-section,
html.light-mode .writing-workshop,
html.light-mode .sidebar-profile-card,
html.light-mode .user-profile,
html.light-mode .google-acc-card {
  background: rgba(255, 255, 255, 0.68) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.85) !important;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.08) !important;
  color: #0f172a !important;
}
.sidebar-expand-float-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 999;
  background: var(--bg-glass, rgba(15, 23, 42, 0.88));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass, rgba(255, 255, 255, 0.18));
  color: var(--text-primary, #ffffff);
  padding: 8px 18px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
}
.sidebar-expand-float-btn:hover {
  background: #2563eb;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.4);
}

.sidebar-toggle-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass, rgba(255, 255, 255, 0.12));
  color: var(--text-secondary, #cbd5e1);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: auto;
  transition: all 0.2s ease;
}
.sidebar-toggle-btn:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

body.sidebar-collapsed .app-sidebar {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}
body.sidebar-collapsed .main-layout {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}
body.sidebar-collapsed .sidebar-expand-float-btn {
  display: flex !important;
}

/* ==========================================================================
   100% UNIFIED CARTOON GAMIFIED DESIGN SYSTEM (Duolingo & Quizlet Style)
   ========================================================================== */

/* Cartoon Buttons globally */
.btn, .node-btn, .btn-node-start, .lesson-mod-btn, .circle-btn, button {
  border-radius: 16px !important;
  font-family: var(--font-display), 'Be Vietnam Pro', sans-serif !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.2s ease !important;
}

/* 3D Button Press Effect for standard primary buttons */
.btn-primary, .btn-cartoon-green {
  background: #58cc02 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 0 #46a302, 0 6px 12px rgba(88, 204, 2, 0.3) !important;
  border: none !important;
}
.btn-primary:active, .btn-cartoon-green:active {
  transform: translateY(3px) !important;
  box-shadow: 0 1px 0 #46a302 !important;
}

.btn-secondary, .btn-cartoon-blue {
  background: #1cb0f6 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 0 #1899d6, 0 6px 12px rgba(28, 176, 246, 0.3) !important;
  border: none !important;
}
.btn-secondary:active, .btn-cartoon-blue:active {
  transform: translateY(3px) !important;
  box-shadow: 0 1px 0 #1899d6 !important;
}

/* Cartoon Modal Windows & Dialogs */
.modal-content, .zubi-stat-card, .glass-panel, .card, .dashboard-card {
  border-radius: 24px !important;
  border: 2px solid var(--border-glass, #e2e8f0) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 4px 0 rgba(0, 0, 0, 0.05) !important;
}

/* Gamified Badges */
.roadmap-badge, .badge, .zubi-pill, .lesson-badge {
  border-radius: 50px !important;
  font-family: var(--font-display), sans-serif !important;
  font-weight: 800 !important;
}

/* Cartoon Pills & Tabs */
.tab-btn, .pill-btn, .nb-lesson-pill {
  border-radius: 20px !important;
  font-weight: 700 !important;
}
.tab-btn.active, .nb-lesson-pill.active {
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.15) !important;
}

/* ==========================================================================
   SUPER MASTER 100% FULL WINDOW STRETCH & RED CHIBI DRAGON BACKGROUND OVERRIDE
   ========================================================================== */

/* 1. Force html, body, and #app to expand 100% with ZERO margins, ZERO white borders */
html, body, #app {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  min-width: 100vw !important;
  max-width: 100vw !important;
  min-height: 100vh !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
  background-attachment: fixed !important;
}

/* Master Full-Window Chibi Dragon Background (Night/Dark Mode) */
html, body, #app, html.dark, html.dark body, body.dark, html.dark #app {
  background: url('/assets/app_bg_night_v3.png') no-repeat center center fixed / cover !important;
}

/* Master Full-Window Chibi Dragon Background (Day/Light Mode) */
html.light-mode, html.light-mode body, body.light-mode, html.light, html.light body, html.light-mode #app {
  background: url('/assets/app_bg_day_v3.png') no-repeat center center fixed / cover !important;
}

/* 2. Strip all dark/white solid backgrounds, rounded container margins, and drop shadows from main layout wrappers */
.main-layout,
.zubi-dashboard-container,
#home-view-section,
.workspace-section,
.app-container,
.content-wrapper {
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 20px 28px !important;
  box-sizing: border-box !important;
}

body.sidebar-collapsed .main-layout,
body.sidebar-collapsed .zubi-dashboard-container {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* 3. Dark Mode iOS 26 Liquid Glass Panels */
html.dark .zubi-header-banner,
html.dark .zubi-stat-card,
html.dark .zubi-recent-card,
html.dark .zubi-table-wrap,
html.dark .zubi-table-card,
html.dark .glass-panel,
html.dark .controls-dashboard,
html.dark .review-banner,
html.dark .deck-card,
html.dark .notebook-card,
html.dark .modal-content,
html.dark .sidebar-profile-card,
html.dark .google-acc-card,
html.dark .pinyin-card,
html.dark .phonetic-card,
html.dark .grammar-card,
html.dark .hub-card,
html.dark .reader-card,
html.dark .info-sub-card,
html.dark .char-detail-inspector,
html.dark .vd-box,
html.dark .vocab-panel,
html.dark .filter-section,
html.dark .writing-workshop,
html.dark .voice-control-bar,
html.dark .phonetics-header,
html.dark .table-card,
html.dark .game-card,
html.dark .chat-card,
html.dark .rules-card,
html.dark .detail-card,
html.dark .top-bar,
html.dark .custom-words-table-wrapper,
html.dark .dict-search-panel,
html.dark .dict-details-panel,
html.dark .smart-flashcard-config,
html.dark .topic-card,
html.dark .selection-card,
html.dark #flashcard-topics-view,
html.dark #flashcard-subdecks-view,
html.dark #deck-selection-view,
html.dark #roadmap-view-section,
html.dark #flashcard-section,
html.dark #custom-section {
  background: rgba(15, 23, 42, 0.28) !important;
  backdrop-filter: blur(6px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(6px) saturate(160%) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25) !important;
  color: #ffffff !important;
}

/* 4. Light Mode iOS 26 Liquid Glass Panels */
html.light-mode .zubi-header-banner,
html.light-mode .zubi-stat-card,
html.light-mode .zubi-recent-card,
html.light-mode .zubi-table-wrap,
html.light-mode .zubi-table-card,
html.light-mode .glass-panel,
html.light-mode .controls-dashboard,
html.light-mode .review-banner,
html.light-mode .deck-card,
html.light-mode .notebook-card,
html.light-mode .modal-content,
html.light-mode .sidebar-profile-card,
html.light-mode .google-acc-card,
html.light-mode .pinyin-card,
html.light-mode .phonetic-card,
html.light-mode .grammar-card,
html.light-mode .hub-card,
html.light-mode .reader-card,
html.light-mode .info-sub-card,
html.light-mode .char-detail-inspector,
html.light-mode .vd-box,
html.light-mode .vocab-panel,
html.light-mode .filter-section,
html.light-mode .writing-workshop,
html.light-mode .voice-control-bar,
html.light-mode .phonetics-header,
html.light-mode .table-card,
html.light-mode .game-card,
html.light-mode .chat-card,
html.light-mode .rules-card,
html.light-mode .detail-card,
html.light-mode .top-bar,
html.light-mode .custom-words-table-wrapper,
html.light-mode .dict-search-panel,
html.light-mode .dict-details-panel,
html.light-mode .smart-flashcard-config,
html.light-mode .topic-card,
html.light-mode .selection-card,
html.light-mode #flashcard-topics-view,
html.light-mode #flashcard-subdecks-view,
html.light-mode #deck-selection-view,
html.light-mode #roadmap-view-section,
html.light-mode #flashcard-section,
html.light-mode #custom-section {
  background: rgba(255, 255, 255, 0.38) !important;
  backdrop-filter: blur(6px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(6px) saturate(160%) !important;
  border: 1px solid rgba(255, 255, 255, 0.75) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08) !important;
  color: #0f172a !important;
}


