/* ClassCards - Unified Design System */

:root {
  /* Purple-Beige educational color scheme */
  --primary: #5D4C9A;
  --primary-dark: #4A3D7A;
  --primary-light: #7A6BB5;
  --primary-rgb: 93, 76, 154;
  --secondary: #7A6BB5;
  --accent-orange: #e0a820;
  --success: #4CAF50;
  --success-dark: #388E3C;
  --danger: #F44336;
  --danger-dark: #D32F2F;
  --warning: #F18846;
  --info: #5D4C9A;
  --text-primary: #1A1A1A;
  --text-secondary: #666666;
  --text-muted: #767676;
  --text-light: #767676;
  --bg-primary: #FFFFFF;
  --bg-secondary: #F9F9F9;
  --bg-tertiary: #F2F2F2;
  --card-bg: #FFFFFF;
  --border: #E8DFD3;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 1px 2px 0 rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.12), 0 4px 6px -2px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.12), 0 10px 10px -5px rgba(0, 0, 0, 0.08);
  --radius-sm: 4px;
  --radius: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Responsive spacing scale */
  --space-xs: clamp(0.25rem, 0.5vw, 0.5rem);
  --space-sm: clamp(0.5rem, 1vw, 0.75rem);
  --space-md: clamp(0.75rem, 1.5vw, 1rem);
  --space-lg: clamp(1rem, 2vw, 1.5rem);
  --space-xl: clamp(1.5rem, 3vw, 2rem);
  --space-2xl: clamp(2rem, 4vw, 3rem);

  /* Responsive font sizes */
  --text-xs: clamp(0.75rem, 1.5vw, 0.875rem);
  --text-sm: clamp(0.875rem, 2vw, 1rem);
  --text-base: clamp(1rem, 2.5vw, 1.125rem);
  --text-lg: clamp(1.125rem, 3vw, 1.25rem);
  --text-xl: clamp(1.25rem, 3.5vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 4vw, 2rem);
  --text-3xl: clamp(2rem, 5vw, 3rem);
  --text-4xl: clamp(2.5rem, 6vw, 4rem);

  /* Container widths */
  --container-xs: min(100%, 30rem);
  --container-sm: min(100%, 40rem);
  --container-md: min(100%, 60rem);
  --container-lg: min(100%, 75rem);
  --container-xl: min(100%, 90rem);

  /* Bottom nav height variable for calculations */
  --bottom-nav-height: 3.5rem;

  /* Status indicator colors (for progress, badges, stats) */
  --color-success-alt: #10b981;
  --color-info: #5D4C9A;
  --color-warning-alt: #F18846;
  --color-purple: #7A6BB5;
  --color-muted: #94a3b8;
  --color-success-alt-dark: #059669;
  --accent-orange-dark: #c48a18;
  --color-danger: #ef4444;
  --color-danger-dark: #dc2626;

  /* Alpha variants for status backgrounds */
  --color-success-alt-bg: rgba(16, 185, 129, 0.15);
  --color-info-bg: rgba(59, 130, 246, 0.15);
  --color-warning-alt-bg: rgba(241, 136, 70, 0.15);
  --color-danger-bg: rgba(239, 68, 68, 0.15);
  --color-purple-bg: rgba(122, 107, 181, 0.15);
  --color-muted-bg: rgba(148, 163, 184, 0.15);

  /* Semantic section colors for dashboard sections */
  --section-lesson-bg: linear-gradient(135deg, #e8f5e9 0%, var(--badge-info-bg) 100%);
  --section-lesson-text: #2e7d32;
  --section-suggestions-bg: linear-gradient(135deg, #fff3e0 0%, #fce4ec 100%);
  --section-suggestions-text: #e65100;
  --section-info-bg: linear-gradient(135deg, #E8E5F2 0%, #f3e5f5 100%);
  --section-info-text: #5D4C9A;
  --section-warning-bg: linear-gradient(135deg, #f5e6c0 0%, #e8d49a 100%);
  --section-warning-text: #f57c00;

  /* Diff view colors */
  --diff-removed-bg: rgba(244, 67, 54, 0.1);
  --diff-added-bg: rgba(76, 175, 80, 0.1);
  --diff-removed-text: #c62828;
  --diff-added-text: #2e7d32;

  /* Badge colors */
  --badge-success-bg: #e8f5e9;
  --badge-success-text: #2e7d32;
  --badge-warning-bg: #fff3e0;
  --badge-warning-text: #e65100;
  --badge-info-bg: #E8E5F2;
  --badge-info-text: #5D4C9A;
  --badge-purple-bg: #ede7f6;
  --badge-purple-text: #7b1fa2;
  --badge-danger-bg: #ffebee;
  --badge-danger-text: #c62828;
}

[data-theme="dark"] {
  /* Dark mode with purple accents */
  --primary: #7A6BB5;
  --primary-dark: #5D4C9A;
  --primary-light: #9A8DC7;
  --primary-rgb: 122, 107, 181;
  --secondary: #7A6BB5;
  --accent-orange: #FFE066;
  --success: #66BB6A;
  --success-dark: #4CAF50;
  --danger: #EF5350;
  --danger-dark: #F44336;
  --warning: #F5A06A;
  --info: #7A6BB5;
  --text-primary: #FAFAFA;
  --text-secondary: #BDBDBD;
  --text-muted: #8E8E8E;
  --text-light: #9E9E9E;
  --bg-primary: #212121;
  --bg-secondary: #303030;
  --bg-tertiary: #424242;
  --card-bg: #303030;
  --border: #424242;

  /* Status indicator colors (for progress, badges, stats) */
  --color-success-alt: #34d399;
  --color-info: #60a5fa;
  --color-warning-alt: #F5A06A;
  --color-purple: #9A8DC7;
  --color-muted: #9ca3af;
  --color-success-alt-dark: #059669;
  --accent-orange-dark: #FFE066;
  --color-danger: #f87171;
  --color-danger-dark: #ef4444;

  /* Alpha variants for status backgrounds */
  --color-success-alt-bg: rgba(52, 211, 153, 0.2);
  --color-info-bg: rgba(96, 165, 250, 0.2);
  --color-warning-alt-bg: rgba(245, 160, 106, 0.2);
  --color-danger-bg: rgba(248, 113, 113, 0.2);
  --color-purple-bg: rgba(154, 141, 199, 0.2);
  --color-muted-bg: rgba(156, 163, 175, 0.2);

  /* Semantic section colors for dashboard sections - dark mode */
  --section-lesson-bg: linear-gradient(135deg, rgba(76, 175, 80, 0.15) 0%, rgba(122, 107, 181, 0.15) 100%);
  --section-lesson-text: #81c784;
  --section-suggestions-bg: linear-gradient(135deg, rgba(255, 152, 0, 0.15) 0%, rgba(233, 30, 99, 0.15) 100%);
  --section-suggestions-text: #ffb74d;
  --section-info-bg: linear-gradient(135deg, rgba(122, 107, 181, 0.15) 0%, rgba(156, 39, 176, 0.15) 100%);
  --section-info-text: #9A8DC7;
  --section-warning-bg: linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, rgba(255, 152, 0, 0.15) 100%);
  --section-warning-text: #ffca28;

  /* Diff view colors - dark mode */
  --diff-removed-bg: rgba(244, 67, 54, 0.2);
  --diff-added-bg: rgba(76, 175, 80, 0.2);
  --diff-removed-text: #ef9a9a;
  --diff-added-text: #a5d6a7;

  /* Badge colors - dark mode */
  --badge-success-bg: rgba(76, 175, 80, 0.2);
  --badge-success-text: #81c784;
  --badge-warning-bg: rgba(255, 152, 0, 0.2);
  --badge-warning-text: #ffb74d;
  --badge-info-bg: rgba(122, 107, 181, 0.2);
  --badge-info-text: #9A8DC7;
  --badge-purple-bg: rgba(156, 39, 176, 0.2);
  --badge-purple-text: #ce93d8;
  --badge-danger-bg: rgba(244, 67, 54, 0.2);
  --badge-danger-text: #ef9a9a;
}

/* Accessibility: screen-reader-only class */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Accessibility: skip-to-content link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 100000;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: #fff;
  border-radius: 0 0 0.5rem 0.5rem;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 0;
  outline: 3px solid var(--accent-orange);
  outline-offset: 2px;
}

/* Accessibility: global focus indicator */
*:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* Dark mode: navbar and sidebar */
[data-theme="dark"] .navbar {
  background: linear-gradient(135deg, #2E2550 0%, #3A2D6A 50%, #2E2550 100%);
  border-bottom: none;
  box-shadow: none;
}

[data-theme="dark"] .navbar-logo-circle .logo-main {
  color: white;
}

/* ============================================
   CUSTOM SCROLLBAR STYLING
   ============================================ */

/* Webkit scrollbar (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
  border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg-secondary);
}

/* Dark mode specific adjustments */
[data-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--border);
  border-color: var(--bg-primary);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

[data-theme="dark"] * {
  scrollbar-color: var(--border) var(--bg-primary);
}

/* ============================================
   ACCESSIBILITY UTILITIES
   ============================================ */

/* Skip to main content link - visible only on focus */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: white;
  padding: 8px 16px;
  z-index: 10000;
  text-decoration: none;
  font-weight: 500;
  border-radius: 0 0 var(--radius) 0;
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 0;
  outline: 2px solid white;
  outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus visible styles for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Remove focus outline for mouse users, keep for keyboard */
button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================
   DARK MODE ADAPTIVE SECTIONS & BADGES
   ============================================ */

/* Section backgrounds that adapt to dark mode */
.section-lesson {
  background: var(--section-lesson-bg) !important;
}
.section-lesson h2,
.section-lesson h3,
.section-lesson .section-title {
  color: var(--section-lesson-text) !important;
}

.section-suggestions {
  background: var(--section-suggestions-bg) !important;
}
.section-suggestions h2,
.section-suggestions h3,
.section-suggestions .section-title {
  color: var(--section-suggestions-text) !important;
}

.section-info {
  background: var(--section-info-bg) !important;
}
.section-info h2,
.section-info h3,
.section-info .section-title {
  color: var(--section-info-text) !important;
}

.section-warning {
  background: var(--section-warning-bg) !important;
}
.section-warning h2,
.section-warning h3,
.section-warning .section-title {
  color: var(--section-warning-text) !important;
}

/* Status badges that adapt to dark mode */
.badge-success {
  background: var(--badge-success-bg) !important;
  color: var(--badge-success-text) !important;
}

.badge-warning {
  background: var(--badge-warning-bg) !important;
  color: var(--badge-warning-text) !important;
}

.badge-danger {
  background: var(--badge-danger-bg) !important;
  color: var(--badge-danger-text) !important;
}

.badge-info {
  background: var(--badge-info-bg) !important;
  color: var(--badge-info-text) !important;
}

.badge-purple {
  background: var(--badge-purple-bg) !important;
  color: var(--badge-purple-text) !important;
}

/* Diff view styles */
.diff-removed {
  background: var(--diff-removed-bg) !important;
  color: var(--diff-removed-text) !important;
}

.diff-added {
  background: var(--diff-added-bg) !important;
  color: var(--diff-added-text) !important;
}

/* Generic card background that adapts to theme */
.card-adaptive {
  background: var(--card-bg) !important;
}

/* Text colors that adapt to theme */
.text-success-adaptive {
  color: var(--badge-success-text) !important;
}

.text-warning-adaptive {
  color: var(--badge-warning-text) !important;
}

.text-danger-adaptive {
  color: var(--badge-danger-text) !important;
}

.text-info-adaptive {
  color: var(--badge-info-text) !important;
}

.text-purple-adaptive {
  color: var(--badge-purple-text) !important;
}

/* Logout button icon styles */
.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  transition: color 0.2s, background-color 0.2s;
}

.logout-btn:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
}

.logout-btn svg {
  width: 20px;
  height: 20px;
}

/* Dark mode specific styles for practice cards */
[data-theme="dark"] .card-display,
[data-theme="dark"] .flashcard {
  background: var(--bg-secondary);
  border: 2px solid var(--primary);
  box-shadow: 0 0 0 1px rgba(74, 144, 226, 0.2), var(--shadow-lg);
}

/* Theme Dropdown */
.theme-dropdown-container {
  position: relative;
  display: inline-block;
}

.theme-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff; /* Always white background for readability */
  border: 1px solid #ddd;
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 99999; /* Must be very high to appear above all elements including in practice mode */
  min-width: 160px;
  margin-top: 0.25rem;
}

.theme-dropdown.show {
  display: block;
}

.theme-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  color: #333 !important; /* Always dark text for readability */
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 0.875rem;
}

.theme-dropdown-item:hover {
  background: #f5f5f5;
}

.theme-dropdown-item.active {
  background: var(--primary);
  color: white !important;
}

.theme-dropdown-item .theme-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.theme-dropdown-item.active .theme-icon {
  border-color: rgba(255,255,255,0.5);
}

/* Theme icons show preview of the OTHER mode (what you'll switch TO) */
.theme-icon.light { background: linear-gradient(135deg, #424242, #212121); }
.theme-icon.dark { background: linear-gradient(135deg, #FAFAFA, #E0E0E0); }

/* Superadmin Pages Dropdown */
.superadmin-pages-dropdown {
  position: relative;
  display: inline-block;
}

.superadmin-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  min-width: 200px;
  max-height: 70vh;
  overflow-y: auto;
  z-index: 1000;
  padding: 0.5rem 0;
}

.superadmin-pages-dropdown.open .superadmin-dropdown-menu {
  display: block;
}

.superadmin-dropdown-menu .dropdown-section-header {
  padding: 0.5rem 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary, #666);
  background: var(--bg-secondary, #f5f5f5);
  border-top: 1px solid var(--border, #e0e0e0);
  margin-top: 0.25rem;
}

.superadmin-dropdown-menu .dropdown-section-header:first-child {
  border-top: none;
  margin-top: 0;
}

.superadmin-dropdown-menu a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text, #333);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background 0.15s;
}

.superadmin-dropdown-menu a:hover {
  background: var(--primary, #5D4C9A);
  color: white;
}

/* Class Selector Dropdown (Teacher Navbar - inside nav-right) */
.class-selector-dropdown {
  position: relative;
  display: inline-flex;
  margin-right: 0.5rem;
}

.class-selector-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
  transition: all 0.15s ease;
  max-width: 200px;
}

.class-selector-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

.class-selector-dropdown.open .class-selector-btn {
  background: rgba(255, 255, 255, 0.25);
  color: white;
  border-color: rgba(255, 255, 255, 0.4);
}

.class-selector-btn .class-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.class-selector-btn .class-selector-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
}

.class-selector-btn .dropdown-arrow {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.class-selector-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.class-selector-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  min-width: 180px;
  max-width: 280px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  padding: 0.25rem 0;
}

.class-selector-dropdown.open .class-selector-menu {
  display: block;
}

.class-selector-divider {
  height: 1px;
  background: var(--border, #e0e0e0);
  margin: 0.25rem 0;
}

.class-option {
  display: block;
  padding: 0.5rem 0.75rem;
  color: var(--text-primary, #333);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background 0.15s;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.class-option:hover {
  background: var(--bg-secondary, #f5f5f5);
}

.class-option.active {
  background: var(--primary, #5D4C9A);
  color: white;
  font-weight: 500;
}

.class-selector-empty {
  display: flex;
  align-items: center;
  margin-right: 0.5rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
}

/* Mobile responsiveness for class selector */
@media (max-width: 768px) {
  .class-selector-dropdown {
    margin-right: 0.25rem;
  }

  .class-selector-btn {
    padding: 0.35rem 0.5rem;
  }

  .class-selector-btn .class-selector-text {
    max-width: 80px;
    font-size: 0.75rem;
  }

  .class-selector-btn .class-icon {
    width: 14px;
    height: 14px;
  }

  .class-selector-menu {
    min-width: 150px;
  }

  .class-selector-empty {
    display: none;
  }
}

@media (max-width: 480px) {
  .class-selector-btn .class-selector-text {
    max-width: 60px;
    font-size: 0.7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .class-selector-btn {
    padding: 0.35rem 0.5rem;
  }

  .class-selector-btn .dropdown-arrow {
    width: 10px;
    height: 10px;
  }
}

/* Very small screens - extra compact navbar */
@media (max-width: 380px) {
  .nav-right {
    gap: 0.15rem;
  }

  .nav-right .language-switcher {
    padding: 0.25rem 0.4rem;
    font-size: 0.75rem;
  }

  .nav-right .theme-switcher {
    padding: 0.25rem;
    font-size: 0.9rem;
  }
}

/* Deck Type Badges */
.deck-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.deck-type--class {
  background: var(--badge-info-bg);
  color: var(--primary);
}

.deck-type--extra {
  background: var(--badge-success-bg);
  color: var(--badge-success-text);
}

.deck-type--personal {
  background: var(--badge-purple-bg);
  color: var(--badge-purple-text);
}

.deck-type--template {
  background: var(--badge-warning-bg);
  color: var(--badge-warning-text);
}

/* Tooltip styles */
.tooltip-icon {
  position: relative;
  display: inline-block;
  cursor: help;
  margin-left: 0.25rem;
  font-size: 0.875rem;
  opacity: 0.7;
}

.tooltip-text {
  visibility: hidden;
  position: absolute;
  z-index: 100;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.tooltip-icon:hover .tooltip-text {
  visibility: visible;
}

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

html {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  /* Removed min-width: 1006px to enable mobile viewing */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  margin: 0 0 0.75rem 0;
}

/* Header Bar - matches home-style.css for consistent look */
#backgroundHeader {
  min-height: 70px;
  width: 100%;
  background: white;
  border-bottom: 1px solid var(--beige-200, #F5EFE6);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  width: var(--container-lg);
  margin-inline: auto;
  padding: var(--space-md);
}

/* Top Navbar (for authenticated pages) */
.navbar {
  background: linear-gradient(135deg, #4A3D7A 0%, #5D4C9A 50%, #4A3D7A 100%);
  border-bottom: none;
  min-height: 80px;
  padding: 1rem 0;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  box-shadow: none;
  overflow: visible;
}

/* Navbar sparkling stars - injected via JS on all pages */
.navbar-star {
  position: absolute;
  pointer-events: none;
  z-index: 0;
}
.navbar-star-1  { top: 8%;  left: 3%;  font-size: 0.75rem; color: rgba(255,255,255,0.6);  animation: qsTwinkle 2.5s ease-in-out infinite; }
.navbar-star-2  { top: 55%; left: 7%;  font-size: 0.5rem;  color: rgba(200,180,255,0.55); animation: qsDrift 4s ease-in-out infinite 0.3s; }
.navbar-star-3  { top: 15%; left: 14%; font-size: 0.4rem;  color: rgba(255,255,255,0.5);  animation: qsPulse 3s ease-in-out infinite 0.8s; }
.navbar-star-4  { top: 70%; left: 20%; font-size: 0.65rem; color: rgba(255,255,255,0.55); animation: qsTwinkle 3.5s ease-in-out infinite 1.2s; }
.navbar-star-5  { top: 10%; left: 28%; font-size: 0.35rem; color: rgba(200,180,255,0.5);  animation: qsPulse 4.5s ease-in-out infinite 0.5s; }
.navbar-star-6  { top: 50%; left: 33%; font-size: 0.55rem; color: rgba(255,255,255,0.45); animation: qsDrift 5s ease-in-out infinite 1.5s; }
.navbar-star-7  { top: 25%; left: 40%; font-size: 0.7rem;  color: rgba(200,180,255,0.6);  animation: qsTwinkle 2.8s ease-in-out infinite 0.7s; }
.navbar-star-8  { top: 65%; left: 45%; font-size: 0.4rem;  color: rgba(255,255,255,0.5);  animation: qsPulse 3.2s ease-in-out infinite 1.8s; }
.navbar-star-9  { top: 12%; left: 52%; font-size: 0.5rem;  color: rgba(255,255,255,0.55); animation: qsDrift 4.2s ease-in-out infinite 0.2s; }
.navbar-star-10 { top: 60%; left: 58%; font-size: 0.6rem;  color: rgba(200,180,255,0.5);  animation: qsTwinkle 3s ease-in-out infinite 1s; }
.navbar-star-11 { top: 20%; left: 65%; font-size: 0.45rem; color: rgba(255,255,255,0.45); animation: qsPulse 5s ease-in-out infinite 0.6s; }
.navbar-star-12 { top: 75%; left: 70%; font-size: 0.55rem; color: rgba(200,180,255,0.55); animation: qsDrift 3.8s ease-in-out infinite 2s; }
.navbar-star-13 { top: 8%;  left: 78%; font-size: 0.7rem;  color: rgba(255,255,255,0.6);  animation: qsTwinkle 4s ease-in-out infinite 0.4s; }
.navbar-star-14 { top: 45%; left: 82%; font-size: 0.35rem; color: rgba(200,180,255,0.45); animation: qsPulse 2.5s ease-in-out infinite 1.3s; }
.navbar-star-15 { top: 30%; right: 10%; font-size: 0.6rem; color: rgba(255,255,255,0.55); animation: qsDrift 3.5s ease-in-out infinite 0.9s; }
.navbar-star-16 { top: 70%; right: 5%;  font-size: 0.5rem; color: rgba(200,180,255,0.5);  animation: qsTwinkle 4.5s ease-in-out infinite 1.7s; }
.navbar-star-17 { top: 5%;  right: 18%; font-size: 0.45rem; color: rgba(255,255,255,0.5); animation: qsPulse 3.5s ease-in-out infinite 0.1s; }
.navbar-star-18 { top: 55%; right: 22%; font-size: 0.65rem; color: rgba(200,180,255,0.6); animation: qsDrift 2.8s ease-in-out infinite 1.1s; }
.navbar-star-19 { top: 35%; left: 48%; font-size: 0.3rem;  color: rgba(255,255,255,0.4);  animation: qsTwinkle 5.5s ease-in-out infinite 0.8s; }
.navbar-star-20 { top: 80%; left: 25%; font-size: 0.5rem;  color: rgba(255,255,255,0.5);  animation: qsPulse 3s ease-in-out infinite 2.2s; }

.nav-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1;
}

.nav-content h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.nav-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Consistent sizing for all navbar buttons */
.nav-right .btn-secondary,
.nav-right .language-switcher,
.nav-right .theme-switcher,
.nav-right .logout-btn {
  min-width: 40px;
  min-height: 40px;
  padding: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* Navbar btn-secondary overrides for dark navbar */
.nav-right .btn-secondary {
  background: rgba(255, 255, 255, 0.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: rgba(255, 255, 255, 0.9) !important;
}
.nav-right .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2) !important;
  color: white !important;
}

/* --- Navbar Navigation Links --- */
.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
}

.nav-links .nav-link {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.nav-links .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.nav-links .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

/* Resources/Tools dropdown */
.nav-dropdown { position: relative; }

.nav-dropdown-btn {
  display: flex; align-items: center; gap: 0.35rem;
  color: rgba(255,255,255,0.8); background: none; border: none;
  padding: 0.5rem 0.75rem; font-size: 0.9375rem; font-weight: 500;
  cursor: pointer; border-radius: 6px; transition: color 0.15s, background 0.15s;
  font-family: inherit;
}
.nav-dropdown-btn:hover { color: #fff; background: rgba(255,255,255,0.12); }
.nav-dropdown-btn.active { color: #fff; background: rgba(255,255,255,0.15); }

.nav-dropdown-menu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0;
  background: var(--card-bg, #fff); border: 1px solid var(--border, #e0e0e0);
  border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  min-width: 200px; z-index: 1000; padding: 0.25rem 0;
}
.nav-dropdown.open .nav-dropdown-menu { display: block; }

.nav-dropdown-menu a {
  display: block; padding: 0.6rem 1rem; color: var(--text-primary, #333);
  text-decoration: none; font-size: 0.9rem; transition: background 0.15s;
}
.nav-dropdown-menu a:hover {
  background: var(--primary, #5D4C9A); color: white;
}

[data-theme="dark"] .nav-dropdown-menu {
  background: var(--card-bg); border-color: var(--border);
}

/* Navbar Upgrade Badge */
.nav-upgrade-item { list-style: none; }
.nav-upgrade-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: linear-gradient(135deg, #F5A623, #FF8C00);
  color: #fff !important; font-size: 0.8rem; font-weight: 700;
  padding: 0.3rem 0.85rem; border-radius: 999px;
  text-decoration: none; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(245,166,35,0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}
.nav-upgrade-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(245,166,35,0.45);
}
.nav-upgrade-badge::before { content: '\2B50'; font-size: 0.75rem; }

/* Usage Bars (Dashboard) */
.usage-bars-container {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center;
  padding: 0.75rem 1rem; margin-bottom: 1rem;
  background: var(--bg-secondary); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.usage-bar-item { flex: 1 1 200px; min-width: 150px; }
.usage-bar-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.3rem;
}
.usage-bar-count { font-weight: 600; color: var(--text-primary); }
.usage-bar-track {
  height: 6px; background: var(--border); border-radius: 3px; overflow: hidden;
}
.usage-bar-fill {
  height: 100%; border-radius: 3px; background: var(--primary);
  transition: width 0.4s ease;
}
.usage-bar-fill.usage-warn { background: #F5A623; }
.usage-bar-fill.usage-full { background: #e74c3c; }
.usage-upgrade-link {
  font-size: 0.8rem; font-weight: 600; color: #e74c3c;
  text-decoration: none; white-space: nowrap;
}
.usage-upgrade-link:hover { text-decoration: underline; }

/* Settings gear icon in nav-right */
.nav-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; color: rgba(255,255,255,0.8);
  text-decoration: none; border-radius: 6px; transition: color 0.15s, background 0.15s;
}
.nav-icon-btn:hover { color: #fff; background: rgba(255,255,255,0.12); }
.nav-icon-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; }

/* Hide nav-links on mobile — bottom nav handles it */
@media (max-width: 768px) {
  .nav-links { display: none !important; }
  .nav-icon-btn { display: none !important; }
  .btn { min-height: 44px; }
}

/* Tighter on medium screens */
@media (max-width: 1100px) and (min-width: 769px) {
  .nav-links .nav-link, .nav-dropdown-btn { padding: 0.5rem 0.5rem; font-size: 0.85rem; }
  .nav-links { gap: 0; }
}

/* Logout button with icon */
.logout-btn {
  padding: 0.5rem !important;
  min-width: 40px !important;
}

.logout-btn svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

/* Navbar Logo */
.navbar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.navbar-logo-circle {
  --logo-accent: #FFD700;
  float: none !important;
  position: static !important;
  width: auto !important;
  height: auto !important;
  padding: 0.3rem 0.6rem !important;
  border-radius: 8px !important;
  background: transparent !important;
  background-image: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: none;
}

.navbar-logo-circle .logo-icon {
  width: 3.2rem;
  height: 2.6rem;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.95);
}

.navbar-logo-circle .logo-icon svg {
  width: 100%;
  height: 100%;
}

.navbar-logo-circle .logo-text {
  text-align: left;
  line-height: 1.1;
}

.navbar-logo-circle .logo-main {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: white;
  text-shadow: none;
}

.navbar-logo-circle .logo-sub {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: none;
}

.superadmin-badge {
  color: var(--primary);
  background: rgba(93, 76, 154, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
}

/* Theme Switcher */
.theme-switcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.25rem;
  transition: all 0.2s;
  line-height: 1;
}

.theme-switcher:hover {
  background: rgba(255, 255, 255, 0.2) !important;
  color: white !important;
}

/* Language Switcher */
.language-switcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.language-switcher:hover {
  background: rgba(255, 255, 255, 0.2) !important;
  color: white !important;
}

/* Content Wrapper */
.contentWrapper {
  border-radius: var(--radius-xl);
  width: var(--container-lg);
  margin-inline: auto;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-xl);
  padding: var(--space-md);
  background-color: var(--bg-primary);
  box-shadow: 0px 8px 13px 0px rgba(0, 0, 0, 0.4);
}

/* Logo Circle */
.logo-circle {
  position: relative;
  z-index: 90;
  float: left;
  width: clamp(5rem, 15vw, 9rem);
  height: clamp(5rem, 15vw, 9rem);
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: var(--radius-lg);
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text x="50" y="55" font-size="40" text-anchor="middle" fill="white" font-weight="bold" font-family="Arial">Voc</text><text x="50" y="80" font-size="20" text-anchor="middle" fill="white" font-weight="bold" font-family="Arial">App</text></svg>');
  background-repeat: no-repeat;
  background-size: contain;
  box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.25);
}

#contentHead {
  position: relative;
  float: left;
  width: 100%;
  margin-bottom: 10px;
}

/* Container for authenticated pages */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Content Layout with Sidebar */
.content-layout {
  position: relative;
  float: left;
  width: 100%;
  display: flex;
  gap: 10px;
}

#contentBody, .app-content {
  flex: 1;
  min-width: 0;
}

/* App Layout - Base styles for sidebar + main content */
.app-layout {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 80px);
  margin-top: 80px;
}

/* Main content area - standardized base styles */
.main-content {
  flex: 1;
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* Gradient Boxes */
.gradient-box, .card, .section {
  background: var(--bg-secondary);
  box-shadow: 0 4px 20px rgba(var(--primary-rgb), 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.gradient-box:hover, .card:hover, .section:hover {
  box-shadow: 0 8px 32px rgba(var(--primary-rgb), 0.15), 0 4px 16px rgba(0, 0, 0, 0.06);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9375rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
  transition: all 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.45);
}

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

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

/* Navbar logout button */
.nav-right .logout-btn {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.nav-right .logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}

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

.btn-success:hover {
  background: var(--success-dark);
}

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

.btn-danger:hover {
  background: var(--danger-dark);
}

.btn-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

/* Action buttons in students table: equal size + spacing */
.students-table td:last-child {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.students-table td:last-child .btn {
  min-width: 5.5rem;
  text-align: center;
  justify-content: center;
}

.btn-large {
  padding: 0.875rem 1.75rem;
  font-size: 1.0625rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(93, 76, 154, 0.25);
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper input {
  padding-right: 2.75rem;
}

.password-toggle-btn {
  position: absolute;
  right: 0.625rem;
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 0;
  border-radius: 4px;
}

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

/* Format Toolbar - B/I/U buttons for card content formatting */
.format-toolbar {
  display: inline-flex;
  gap: 2px;
  margin-left: 0.5rem;
  opacity: 0.6;
  transition: opacity 0.2s;
  vertical-align: middle;
}

.format-toolbar:hover {
  opacity: 1;
}

.format-btn {
  padding: 2px 6px;
  font-size: 0.75rem;
  font-family: inherit;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  color: var(--text-primary);
  line-height: 1.2;
}

.format-btn:hover {
  background: var(--bg-tertiary, var(--bg-secondary));
  border-color: var(--primary);
}

.format-btn-bold { font-weight: bold; }
.format-btn-italic { font-style: italic; }
.format-btn-underline { text-decoration: underline; }

/* Mini toolbar for table cells */
.format-toolbar-mini {
  margin-left: 0.25rem;
}

.format-toolbar-mini .format-btn {
  padding: 1px 4px;
  font-size: 0.7rem;
}

/* Contenteditable inputs (WYSIWYG rich text) */
.contenteditable-input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  min-height: 2.25rem;
  max-height: 6rem;
  overflow-y: auto;
  background: var(--input-bg, var(--bg-primary));
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.contenteditable-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 33, 150, 243), 0.15);
}

.contenteditable-input[data-placeholder]:empty:before {
  content: attr(data-placeholder);
  color: var(--text-secondary);
  opacity: 0.6;
  pointer-events: none;
}

.contenteditable-input:focus[data-placeholder]:empty:before {
  opacity: 0.4;
}

/* Rich placeholder overlay for contenteditable inputs (shows HTML with bold) */
.rich-placeholder-wrapper {
  position: relative;
}
.rich-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  color: var(--text-secondary);
  opacity: 0.5;
  font-style: italic;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.rich-placeholder b {
  font-weight: 700;
  font-style: italic;
  color: var(--text-primary);
}
.rich-placeholder.hidden {
  display: none;
}
/* Make ::before placeholder invisible when rich-placeholder overlay is used,
   but keep it in layout so table cells maintain their width */
.rich-placeholder-wrapper [contenteditable]:empty:before {
  color: transparent !important;
}

/* Sentence field wrapper with bold button */
.sentence-field-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.sentence-field-wrapper .contenteditable-input {
  flex: 1;
  min-width: 0;
}

.sentence-field-wrapper .format-btn-bold {
  flex-shrink: 0;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  font-weight: bold;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-primary);
  margin-top: 0.25rem;
}

.sentence-field-wrapper .format-btn-bold:hover {
  background: var(--bg-tertiary, var(--bg-secondary));
  border-color: var(--primary);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-primary);
  border-radius: var(--radius);
  overflow: hidden;
}

.data-table thead {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  background-color: var(--primary);
  color: white;
  position: relative;
  z-index: 1;
}

.data-table th {
  padding: 0.875rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9375rem;
  color: white !important;
}

.data-table th *,
.data-table th button,
.data-table th a {
  color: white !important;
}

.data-table td {
  padding: 0.875rem;
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover {
  background: var(--bg-secondary);
}

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

.data-table tbody tr.selected-row {
  background: var(--primary-light, rgba(93, 76, 154, 0.15));
  border-left: 3px solid var(--primary);
}

/* Responsive table wrapper */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--space-md);
}

.table-responsive .data-table {
  min-width: 40rem;
}

/* Responsive table adjustments */
@media (max-width: 768px) {
  .data-table th,
  .data-table td {
    min-width: 5rem;
    font-size: var(--text-sm);
    padding: var(--space-sm);
  }

  .data-table th:first-child,
  .data-table td:first-child {
    position: sticky;
    left: 0;
    background: inherit;
    z-index: 1;
  }
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
}

.stat-box {
  background: var(--bg-secondary);
  padding: 1.25rem;
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
}

.stat-box .label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.stat-box .value {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--primary);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Flexbox Utilities */
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.align-center { align-items: center; }
.align-start { align-items: flex-start; }
.align-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

/* Gap Utilities */
.gap-0 { gap: 0; }
.gap-xs { gap: 0.25rem; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 0.75rem; }
.gap-1 { gap: 1rem; }
.gap-lg { gap: 1.5rem; }
.gap-xl { gap: 2rem; }

/* Margin Utilities */
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mt-xs { margin-top: 0.25rem; }
.mt-sm { margin-top: 0.5rem; }
.mt-1 { margin-top: 1rem; }
.mt-lg { margin-top: 1.5rem; }
.mt-xl { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-xs { margin-bottom: 0.25rem; }
.mb-sm { margin-bottom: 0.5rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-lg { margin-bottom: 1.5rem; }
.mb-xl { margin-bottom: 2rem; }
.ml-auto { margin-left: auto; }
.ml-lg { margin-left: 1.5rem; }
.mr-auto { margin-right: auto; }
.text-primary { color: var(--primary); }

/* Padding Utilities */
.p-0 { padding: 0; }
.p-xs { padding: 0.25rem; }
.p-sm { padding: 0.5rem; }
.p-1 { padding: 1rem; }
.p-lg { padding: 1.5rem; }
.px-sm { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-1 { padding-left: 1rem; padding-right: 1rem; }
.py-sm { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-1 { padding-top: 1rem; padding-bottom: 1rem; }

/* Width Utilities */
.w-100 { width: 100%; }
.w-auto { width: auto; }

/* Text Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--color-muted); }
.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-bold { font-weight: 700; }
.fs-xs { font-size: 0.75rem; }
.fs-sm { font-size: 0.875rem; }
.fs-base { font-size: 1rem; }
.fs-lg { font-size: 1.125rem; }
.text-nowrap { white-space: nowrap; }

/* Status Color Text Classes */
.text-success-alt { color: var(--color-success-alt); }
.text-info { color: var(--color-info); }
.text-warning-alt { color: var(--color-warning-alt); }
.text-danger { color: var(--danger); }
.text-purple { color: var(--color-purple); }

/* Status Badge Classes */
.badge-status {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-mastered {
  background: var(--color-success-alt-bg);
  color: var(--color-success-alt);
}
.badge-learning {
  background: var(--color-warning-alt-bg);
  color: var(--color-warning-alt);
}
.badge-struggling {
  background: var(--color-danger-bg);
  color: var(--danger);
}
.badge-excellent {
  background: var(--color-success-alt-bg);
  color: var(--color-success-alt);
}
.badge-good {
  background: var(--color-info-bg);
  color: var(--color-info);
}
.badge-not-started {
  background: var(--color-muted-bg);
  color: var(--text-secondary);
}
.badge-purple {
  background: var(--color-purple-bg);
  color: var(--color-purple);
}

/* Stat Box Color Variants */
.stat-box--success { border-left-color: var(--color-success-alt); }
.stat-box--success .value { color: var(--color-success-alt); }
.stat-box--info { border-left-color: var(--color-info); }
.stat-box--info .value { color: var(--color-info); }
.stat-box--warning { border-left-color: var(--color-warning-alt); }
.stat-box--warning .value { color: var(--color-warning-alt); }
.stat-box--danger { border-left-color: var(--danger); }
.stat-box--danger .value { color: var(--danger); }
.stat-box--purple { border-left-color: var(--color-purple); }
.stat-box--purple .value { color: var(--color-purple); }

/* Progress Bar with Status Colors */
.progress-bar {
  background: var(--bg-secondary);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  transition: width 0.3s ease;
}
.progress-success .fill { background: var(--color-success-alt); }
.progress-info .fill { background: var(--color-info); }
.progress-warning .fill { background: var(--color-warning-alt); }
.progress-danger .fill { background: var(--danger); }
.progress-purple .fill { background: var(--color-purple); }

/* Button Color Variants for inline style replacement */
.btn-success-alt {
  background: var(--color-success-alt);
  color: white;
  border-color: var(--color-success-alt);
}
.btn-success-alt:hover {
  background: var(--color-success-alt-dark);
  border-color: var(--color-success-alt-dark);
}
.btn-warning-alt {
  background: var(--color-warning-alt);
  color: white;
  border-color: var(--color-warning-alt);
}
.btn-warning-alt:hover {
  background: var(--accent-orange-dark);
  border-color: var(--accent-orange-dark);
}

/* Button Size Variants */
.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.btn-sm {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

/* Gradient Button Variants */
.btn-gradient-purple {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: white;
  border: none;
}

.btn-gradient-purple:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary));
  color: white;
}

/* Nav Link Utilities */
.nav-link-inherit {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Icon Size Utilities */
.icon-sm { width: 1.25rem; height: 1.25rem; }
.icon-md { width: 1.5rem; height: 1.5rem; }
.icon-lg { width: 2rem; height: 2rem; }
.icon-xl { width: 2.5rem; height: 2.5rem; }

/* Additional Font Size Utilities */
.fs-xl { font-size: 1.5rem; }
.fs-2xl { font-size: 2rem; }

/* Card Grid Layout */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 1rem;
}

/* Class Card Styles */
.class-card-title {
  margin-top: 0;
  color: var(--primary);
}

.class-card-description {
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.class-card-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Online Status Badge */
.badge-online {
  padding: 0.5rem 1rem;
  background: rgba(16, 185, 129, 0.13);
  color: var(--color-success-alt);
  border: 1px solid var(--color-success-alt);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.875rem;
}

/* Deck Item States */
.deck-item--inactive {
  opacity: 0.5;
  filter: grayscale(50%);
}

/* Stat Value Color Variants */
.stat-value--purple { color: var(--primary-light); text-decoration: none; cursor: pointer; }
.stat-value--blue { color: var(--primary); }

/* Impersonation Banner */
.impersonation-banner {
  background: var(--color-warning-alt);
  color: #000;
  padding: 0.75rem;
  text-align: center;
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.impersonation-banner .btn-exit {
  background: var(--danger);
  color: white;
  padding: 0.375rem 0.75rem;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  font-weight: 600;
}

.impersonation-banner .btn-exit:hover {
  background: var(--danger-dark);
}

/* Admin Dashboard Elements */
.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.bulk-actions-bar {
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.bulk-actions-label {
  font-weight: 600;
  margin-right: 0.5rem;
}

.selection-count {
  margin-left: auto;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.th-narrow {
  width: 40px;
}

/* Role Badges */
.badge-teacher {
  background: var(--badge-info-bg);
  color: var(--primary-dark);
}

.badge-student {
  background: var(--badge-success-bg);
  color: var(--badge-success-text);
}

/* Status Badges */
.badge-inactive {
  background: var(--badge-danger-bg);
  color: var(--color-danger-dark);
}

.badge-unverified {
  background: var(--badge-warning-bg);
  color: var(--accent-orange-dark);
}

.badge-active {
  background: var(--badge-success-bg);
  color: var(--badge-success-text);
}

/* Plan Select */
.plan-select {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Info Box */
.info-box {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-top: 1rem;
}

.info-box h3 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.info-box h3:first-child {
  margin-top: 0;
}

.info-box ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.info-box li {
  margin: 0.5rem 0;
  color: var(--text-primary);
}

/* Sync Result Messages */
.sync-result-success {
  padding: 1rem;
  background: var(--color-success-alt);
  color: white;
  border-radius: var(--radius);
}

.sync-result-error {
  padding: 1rem;
  background: var(--danger);
  color: white;
  border-radius: var(--radius);
}

.sync-result-loading {
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}

/* Filter Controls */
.filter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.filter-controls .form-group {
  margin: 0;
}

.filter-controls label {
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
  display: block;
}

.filter-controls input,
.filter-controls select {
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  min-width: 120px;
}

/* Engagement Color Classes */
.engagement-high { color: var(--color-success-alt); font-weight: 600; }
.engagement-medium { color: var(--color-warning-alt); font-weight: 600; }
.engagement-low { color: var(--danger); font-weight: 600; }

/* Sync Card Gradient */
.sync-card-gradient {
  background: linear-gradient(135deg, var(--card-bg) 0%, var(--bg-secondary) 100%);
}

/* Code Inline */
.code-inline {
  background: var(--bg-secondary);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: monospace;
}

/* Modal Width Variants */
.modal-content--sm { max-width: 500px; }
.modal-content--md { max-width: 600px; }
.modal-content--lg { max-width: 800px; }

/* Checkbox List Container */
.checkbox-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  padding: 0.5rem;
  border-radius: var(--radius);
}

.checkbox-list--tall {
  max-height: 300px;
}

/* Modal Action Buttons Row */
.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* Gamification Elements */
.motivational-banner {
  background: linear-gradient(135deg, var(--color-purple), var(--primary));
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.motivational-banner .content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.motivational-banner .close-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.25rem;
  opacity: 0.7;
}

.motivational-banner .close-btn:hover {
  opacity: 1;
}

.gamification-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.level-card {
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
  color: white;
  padding: 1.5rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.level-badge {
  width: 4.375rem;
  height: 4.375rem;
  background: linear-gradient(135deg, var(--accent-orange), var(--accent-orange-dark));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: bold;
  box-shadow: 0 4px 15px rgba(255, 224, 102, 0.4);
}

.level-info .level-label {
  font-size: 0.875rem;
  opacity: 0.8;
  margin-bottom: 0.25rem;
}

.level-info .level-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.xp-bar {
  background: rgba(255,255,255,0.2);
  border-radius: 1rem;
  height: 0.5rem;
  overflow: hidden;
}

.xp-bar .fill {
  background: linear-gradient(90deg, var(--accent-orange), var(--accent-orange-dark));
  height: 100%;
  transition: width 0.5s ease;
}

.xp-text {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 0.25rem;
}

.daily-goal-card {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.daily-goal-card.completed {
  border-color: var(--color-success-alt);
}

/* Level badge on goal ring */
.level-badge-ring {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: var(--primary, #5D4C9A);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.15rem 0.35rem;
  border-radius: 0.5rem;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Goal complete pulse animation */
.goal-complete-pulse {
  animation: goalPulse 2s ease-in-out infinite;
}
@keyframes goalPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* XP Progress Bar Section */
.xp-progress-section {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.xp-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}
.xp-amount {
  color: var(--text-secondary);
  font-size: 0.8rem;
}
.xp-progress-bar {
  background: var(--bg-secondary);
  border-radius: 1rem;
  height: 0.5rem;
  overflow: hidden;
}
.xp-progress-fill {
  background: linear-gradient(90deg, var(--primary, #5D4C9A), #7c6bb5);
  height: 100%;
  border-radius: 1rem;
  transition: width 0.5s ease;
  min-width: 2px;
}
.xp-total {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  text-align: right;
}

/* Class Leaderboard */
.leaderboard-section {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.leaderboard-header h3 {
  font-size: 0.95rem;
  margin: 0;
}
.leaderboard-toggle {
  font-size: 0.75rem;
  color: var(--primary, #5D4C9A);
  font-weight: 500;
}
.leaderboard-section.expanded .leaderboard-toggle::after { content: ''; }
.leaderboard-list {
  margin-top: 0.5rem;
}
.leaderboard-item {
  display: flex;
  align-items: center;
  padding: 0.4rem 0.5rem;
  border-radius: 0.5rem;
  gap: 0.5rem;
  font-size: 0.85rem;
}
.leaderboard-item:nth-child(even) {
  background: var(--bg-secondary);
}
.leaderboard-item--current {
  background: rgba(93, 76, 154, 0.1) !important;
  font-weight: 600;
  border: 1px solid var(--primary, #5D4C9A);
}
.leaderboard-item--extra {
  display: none;
}
.leaderboard-section.expanded .leaderboard-item--extra {
  display: flex;
}
.leaderboard-rank {
  width: 2rem;
  text-align: center;
  flex-shrink: 0;
}
.leaderboard-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.leaderboard-level {
  font-size: 0.75rem;
  color: var(--primary, #5D4C9A);
  font-weight: 600;
  flex-shrink: 0;
}
.leaderboard-xp {
  font-size: 0.75rem;
  color: var(--text-secondary);
  flex-shrink: 0;
  min-width: 3.5rem;
  text-align: right;
}
.leaderboard-your-rank {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
}
.leaderboard-empty {
  text-align: center;
  padding: 1rem;
}
.leaderboard-empty p {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

/* Swipe animations for practice cards */
.flashcard-container.swiping,
.mobile-flashcard.swiping {
  transition: none !important;
}
.flashcard-container.swipe-right,
.mobile-flashcard-inner.swipe-right {
  animation: swipeOffRight 0.3s ease forwards;
}
.flashcard-container.swipe-left,
.mobile-flashcard-inner.swipe-left {
  animation: swipeOffLeft 0.3s ease forwards;
}
@keyframes swipeOffRight {
  to { transform: translateX(120%) rotate(15deg); opacity: 0; }
}
@keyframes swipeOffLeft {
  to { transform: translateX(-120%) rotate(-15deg); opacity: 0; }
}
.swipe-overlay {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
  z-index: 10;
}
.swipe-overlay.good {
  background: rgba(16, 185, 129, 0.15);
}
.swipe-overlay.again {
  background: rgba(239, 68, 68, 0.15);
}
.swipe-overlay .swipe-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  font-weight: 700;
  padding: 0.3rem 0.8rem;
  border-radius: 0.5rem;
}
.swipe-overlay.good .swipe-label {
  right: 1rem;
  color: var(--color-success-alt, #10b981);
  border: 2px solid var(--color-success-alt, #10b981);
}
.swipe-overlay.again .swipe-label {
  left: 1rem;
  color: #ef4444;
  border: 2px solid #ef4444;
}

/* Floating XP gain notification */
.xp-float {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary, #5D4C9A);
  pointer-events: none;
  z-index: 9999;
  animation: xpFloat 1.2s ease forwards;
  text-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
@keyframes xpFloat {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -80%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(0.8); }
}

/* Practice Streak Heatmap */
.streak-heatmap-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1rem;
  border: 1px solid var(--border);
}
.streak-heatmap {
  display: flex;
  gap: 4px;
}
.heatmap-days {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.65rem;
  color: var(--text-secondary);
  padding-right: 4px;
  justify-content: space-around;
}
.heatmap-days span {
  height: 12px;
  line-height: 12px;
}
.heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, 12px);
  grid-auto-flow: column;
  grid-auto-columns: 12px;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
}
.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  cursor: default;
}
.heatmap-level-0 { background: var(--bg-secondary); border: 1px solid var(--border-color); }
.heatmap-level-1 { background: rgba(99, 102, 241, 0.4); border: 1px solid rgba(99, 102, 241, 0.5); }
.heatmap-level-2 { background: rgba(99, 102, 241, 0.7); border: 1px solid rgba(99, 102, 241, 0.8); }
.heatmap-level-3 { background: #6366f1; border: 1px solid #4f46e5; }
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 3px;
  justify-content: flex-end;
  margin-top: 0.5rem;
}
.heatmap-legend .heatmap-cell {
  width: 10px;
  height: 10px;
}

/* Engagement Stats Grid */
.engagement-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.engagement-stat {
  text-align: center;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}
.engagement-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}
.engagement-stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.goal-ring {
  position: relative;
  width: 4.375rem;
  height: 4.375rem;
}

.goal-ring svg {
  transform: rotate(-90deg);
}

.goal-ring .value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.25rem;
  font-weight: bold;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stats-grid--compact {
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.stat-card {
  padding: 1.25rem;
  border-radius: var(--radius);
  text-align: center;
  color: white;
}

.stats-grid--compact .stat-card {
  padding: 0.4rem 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-align: left;
}

.stat-card--blue { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.stat-card--amber { background: linear-gradient(135deg, var(--accent-orange), var(--accent-orange-dark)); }
[data-theme="dark"] .stat-card--amber { color: #1a1a2e; }
.stat-card--green { background: linear-gradient(135deg, var(--color-success-alt), var(--color-success-alt-dark)); }
.stat-card--purple { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }

.stat-card .icon {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}

.stats-grid--compact .stat-card .icon {
  font-size: 0.9rem;
  margin-bottom: 0;
}

.stat-card .value {
  font-size: 1.5rem;
  font-weight: bold;
}

.stats-grid--compact .stat-card .value {
  font-size: 0.95rem;
  font-weight: 700;
}

.stat-card .label {
  font-size: 0.75rem;
  opacity: 0.9;
}

.stats-grid--compact .stat-card .label {
  font-size: 0.7rem;
  opacity: 0.8;
}

.suggest-personal-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (max-width: 600px) {
  .suggest-personal-row {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* Responsive gamification grid */
@media (max-width: 768px) {
  .gamification-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Compact stat cards: switch to vertical layout on mobile */
  .stats-grid--compact .stat-card {
    flex-direction: column;
    text-align: center;
    padding: 0.5rem 0.3rem;
    gap: 0.15rem;
  }

  .stats-grid--compact .stat-card .icon {
    font-size: 1.1rem;
  }

  .stats-grid--compact .stat-card .value {
    font-size: 1rem;
  }

  .stats-grid--compact .stat-card .label {
    font-size: 0.6rem;
    line-height: 1.2;
  }
}

/* Activity Card */
.activity-card {
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid rgba(93, 76, 154, 0.15);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.activity-card:hover {
  border-color: rgba(93, 76, 154, 0.3);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.activity-card h3 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  color: var(--text-secondary);
}

.activity-card p {
  margin: 0 0 0.5rem 0;
}

.activity-card p:last-child {
  margin-bottom: 0;
}

/* Quick Start Card - Made More Prominent */
.quick-start-card {
  padding: 1.25rem 2rem;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: white;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  grid-column: 1 / -1; /* Span full width - center the card */
}

.quick-start-card--primary {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background-size: 400% 400%;
  animation: dreamyGradient 8s ease infinite;
}

/* Theme 0: Orange (default) */
.quick-start-card--primary.qs-theme-orange {
  background: linear-gradient(135deg, #e8a040, #d4782a, #c06030, #d4782a, #e8a040);
  background-size: 400% 400%;
}
/* Theme 1: Purple */
.quick-start-card--primary.qs-theme-purple {
  background: linear-gradient(135deg, #7c3aed, #5b21b6, #4c1d95, #6d28d9, #7c3aed);
  background-size: 400% 400%;
}
/* Theme 2: Dark blue */
.quick-start-card--primary.qs-theme-blue {
  background: linear-gradient(135deg, #1e40af, #1e3a5f, #0f172a, #1e3a8a, #1e40af);
  background-size: 400% 400%;
}
/* Theme 3: Black */
.quick-start-card--primary.qs-theme-black {
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f0f1a, #1a1a2e, #16213e);
  background-size: 400% 400%;
}

.quick-start-card--primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 80%, rgba(255, 255, 255, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 20%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 50% 50% at 50% 50%, rgba(255, 255, 255, 0.06) 0%, transparent 70%);
  background-size: 200% 200%, 200% 200%, 150% 150%;
  animation: dreamyOrbs 12s ease-in-out infinite alternate;
  z-index: 0;
  pointer-events: none;
}

.quick-start-card--primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle 120px at 30% 70%, rgba(255, 255, 255, 0.12) 0%, transparent 100%),
    radial-gradient(circle 80px at 75% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 100%),
    radial-gradient(circle 200px at 60% 90%, rgba(255, 255, 255, 0.08) 0%, transparent 100%);
  animation: dreamyShimmer 10s ease-in-out infinite alternate-reverse;
  z-index: 0;
  pointer-events: none;
}

.quick-start-card--primary > *,
.quick-start-card--purple > * {
  position: relative;
  z-index: 1;
}

.quick-start-card--purple {
  background: linear-gradient(135deg, var(--color-purple), var(--primary));
  position: relative;
  overflow: hidden;
}

/* Quick-start card decorative stars */
.qs-star {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.6), 0 0 24px rgba(255, 200, 120, 0.4);
}
.qs-star-svg {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.5));
}

.qs-star-1 {
  top: 12%; left: 6%;
  color: rgba(255, 255, 255, 0.55);
  font-size: 1.4rem;
  animation: qsTwinkle 3s ease-in-out infinite;
}
.qs-star-2 {
  top: 18%; right: 10%;
  color: rgba(255, 220, 160, 0.5);
  font-size: 1.1rem;
  animation: qsDrift 5s ease-in-out infinite 0.5s;
}
.qs-star-3 {
  bottom: 20%; left: 12%;
  color: rgba(255, 255, 255, 0.45);
  font-size: 1.6rem;
  animation: qsPulse 4s ease-in-out infinite 1s;
}
.qs-star-4 {
  top: 30%; left: 25%;
  color: rgba(255, 220, 160, 0.4);
  font-size: 0.9rem;
  animation: qsSpin 7s linear infinite;
}
.qs-star-5 {
  bottom: 30%; right: 8%;
  color: rgba(255, 255, 255, 0.35);
  font-size: 1.3rem;
  font-weight: 300;
  animation: qsSpin 9s linear infinite 2s;
}
.qs-star-6 {
  top: 55%; left: 4%;
  color: rgba(255, 220, 160, 0.5);
  font-size: 1rem;
  animation: qsTwinkle 3.5s ease-in-out infinite 1.5s;
}
.qs-star-7 {
  top: 40%; right: 18%;
  color: rgba(255, 255, 255, 0.6);
  font-size: 2rem;
  animation: qsPulse 5s ease-in-out infinite 0.3s;
}
.qs-star-8 {
  bottom: 15%; right: 25%;
  color: rgba(255, 220, 160, 0.45);
  font-size: 0.85rem;
  animation: qsDrift 6s ease-in-out infinite 1s;
}
.qs-star-9 {
  bottom: 40%; left: 35%;
  color: rgba(255, 255, 255, 0.35);
  font-size: 1.2rem;
  animation: qsTwinkle 4s ease-in-out infinite 2s;
}
.qs-star-10 {
  top: 10%; left: 45%;
  color: rgba(255, 220, 160, 0.4);
  font-size: 0.8rem;
  animation: qsPulse 3s ease-in-out infinite 0.8s;
}
.qs-star-svg-1 {
  top: 22%; right: 5%;
  width: 18px; height: 18px;
  color: rgba(255, 255, 255, 0.35);
  animation: qsDrift 7s ease-in-out infinite 0.5s;
}
.qs-star-svg-2 {
  bottom: 25%; left: 8%;
  width: 14px; height: 14px;
  color: rgba(255, 220, 160, 0.4);
  animation: qsSpin 10s linear infinite 1s;
}

@keyframes qsTwinkle {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.15); }
}
@keyframes qsDrift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); opacity: 0.3; }
  25% { transform: translate(4px, -6px) rotate(8deg); opacity: 0.6; }
  50% { transform: translate(-3px, -10px) rotate(-5deg); opacity: 0.5; }
  75% { transform: translate(6px, -3px) rotate(12deg); opacity: 0.4; }
}
@keyframes qsPulse {
  0%, 100% { transform: scale(1); opacity: 0.35; }
  50% { transform: scale(1.4); opacity: 0.75; }
}
@keyframes qsSpin {
  0% { transform: rotate(0deg) scale(1); opacity: 0.4; }
  50% { transform: rotate(180deg) scale(1.15); opacity: 0.7; }
  100% { transform: rotate(360deg) scale(1); opacity: 0.4; }
}

/* Hide stars on very small screens */
@media (max-width: 480px) {
  .qs-star, .qs-star-svg { display: none; }
}

@keyframes dreamyGradient {
  0% { background-position: 0% 50%; }
  25% { background-position: 50% 0%; }
  50% { background-position: 100% 50%; }
  75% { background-position: 50% 100%; }
  100% { background-position: 0% 50%; }
}

@keyframes dreamyOrbs {
  0% {
    background-position: 0% 0%, 100% 100%, 50% 50%;
    opacity: 0.8;
  }
  50% {
    background-position: 50% 100%, 50% 0%, 0% 100%;
    opacity: 1;
  }
  100% {
    background-position: 100% 50%, 0% 50%, 100% 0%;
    opacity: 0.8;
  }
}

@keyframes dreamyShimmer {
  0% {
    opacity: 0.6;
    transform: scale(1) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.05) rotate(1deg);
  }
  100% {
    opacity: 0.7;
    transform: scale(0.98) rotate(-1deg);
  }
}

.quick-start-card .big-number {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  line-height: 1;
}

.quick-start-card .subtitle {
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.95;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.quick-start-card--primary .big-number {
  color: white;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 0 30px rgba(255, 255, 255, 0.15);
}

.quick-start-card--primary .subtitle {
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
}

.quick-start-card .btn-pill--white-primary {
  font-size: 1rem;
  padding: 0.65rem 1.75rem;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s, box-shadow 0.2s;
}

.quick-start-card .btn-pill--white-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* One-tap practice button animation */
.one-tap-practice-btn {
  animation: practiceButtonPulse 2s ease-in-out infinite;
}

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

.one-tap-practice-btn:hover {
  animation: none;
}

/* Keyboard hint for practice shortcut */
.keyboard-hint {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  opacity: 0.7;
  letter-spacing: 0.5px;
}

@media (max-width: 768px) {
  .keyboard-hint {
    display: none; /* Hide on mobile - no keyboard */
  }
}

.btn-pill {
  font-size: 0.9rem;
  padding: 0.6rem 1.25rem;
  font-weight: 600;
  border-radius: 2rem;
  text-decoration: none;
}

.btn-pill--white-purple {
  background: white;
  color: var(--color-purple);
}

.btn-pill--white-primary {
  background: white;
  color: var(--primary);
}

.btn-pill--white-green {
  background: white;
  color: var(--color-success-alt);
}

/* Error Message */
.error {
  background: var(--badge-danger-bg);
  color: var(--badge-danger-text);
  padding: 0.875rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  border-left: 4px solid var(--danger);
}

/* Success Message */
.success {
  background: var(--badge-success-bg);
  color: var(--badge-success-text);
  padding: 0.875rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  border-left: 4px solid var(--success);
}

/* Auth Box (Login/Register) - with gold glow effect */
.auth-box {
  max-width: 400px;
  margin: 2rem auto;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(93, 76, 154, 0.15);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.auth-box:hover {
  border-color: rgba(93, 76, 154, 0.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

.auth-box h1 {
  color: var(--primary-dark);
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-box .btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-box .btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-dark) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(93, 76, 154, 0.4);
}

/* Dark mode support for auth box */
[data-theme="dark"] .auth-box {
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border-color: rgba(93, 76, 154, 0.3);
}

[data-theme="dark"] .auth-box:hover {
  border-color: rgba(93, 76, 154, 0.5);
}

[data-theme="dark"] .auth-box h1 {
  color: var(--secondary);
}

/* Practice Container */
.practice-container {
  max-width: var(--container-md);
  margin: var(--space-xl) auto;
  padding: 0 var(--space-md);
}

/* Mode Selector */
.mode-selector {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
  flex-shrink: 0;
  padding: 0 1rem;
}

.mode-btn {
  padding: 0.75rem 2rem;
  background: var(--bg-primary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

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

.mode-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

/* Practice Area */
.practice-area {
  margin-bottom: 2rem;
}

/* Card Display */
.card-display {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-lg);
  min-height: min(70vh, 31.25rem);
  max-height: 80vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
}

/* Flashcard specific - responsive size */
.flashcard {
  width: 100%;
  max-width: var(--container-md);
  min-height: min(70vh, 31.25rem);
  max-height: 80vh;
  box-sizing: border-box;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
}

.card-side {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  box-sizing: border-box;
  flex-shrink: 0;
}

.card-side.front {
  height: 350px;
  min-height: 350px;
  max-height: 350px;
}

.card-side.back {
  height: 350px;
  min-height: 350px;
  max-height: 350px;
  border-top: 2px solid var(--border);
}

.card-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
  font-weight: 600;
}

.card-content {
  font-size: 1.4rem; /* Reduced from 2.25rem for sentence-based learning */
  font-weight: 500;
  color: var(--text-primary);
  margin: 1.5rem 0;
  line-height: 1.6; /* Increased for better sentence readability */
}

/* Bold word highlighting in sentences */
.card-content b,
.card-content strong {
  color: var(--primary);
  font-weight: 700;
}

/* .with-context class deprecated - sentences are now the main content */
.card-content.with-context {
  font-size: 1.4rem;
  margin: 1.5rem 0;
}

/* Text-to-Speech Button Styling */
.tts-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  margin-right: 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.25rem;
  transition: all 0.15s ease;
  vertical-align: middle;
  flex-shrink: 0;
}

.tts-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.1);
}

.tts-btn:hover::before {
  color: white;
}

.tts-btn.speaking {
  background: var(--primary);
  border-color: var(--primary);
  animation: ttsPulse 1s ease infinite;
}

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

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

/* Position TTS button inline with text */
.card-content {
  position: relative;
}

/* Mobile TTS button - prominent and touch-friendly */
@media (max-width: 768px) {
  .tts-btn {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.15rem;
    margin-right: 0.5rem;
    touch-action: manipulation;
  }

  .mobile-flashcard-face .tts-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(93,76,154,0.15);
    border: 2px solid var(--primary, #5D4C9A);
    font-size: 1.25rem;
    margin: 0.75rem auto 0;
    display: flex;
  }

  .mobile-flashcard-face .tts-btn:hover,
  .mobile-flashcard-face .tts-btn:active {
    background: var(--primary, #5D4C9A);
    color: white;
  }
}

/* TTS auto-play toggle button */
.tts-auto-toggle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  padding: 0;
}

.tts-auto-toggle.active {
  background: var(--primary);
  border-color: var(--primary);
}

/* Streak Card with Freeze Indicator */
.streak-card {
  position: relative;
}

.streak-freeze-indicator {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  font-size: 0.7rem;
  background: var(--bg-secondary);
  padding: 0.15rem 0.35rem;
  border-radius: 0.5rem;
  opacity: 0.8;
}

.streak-freeze-indicator:hover {
  opacity: 1;
}

/* Context sentence styling - always visible */
.context-sentence {
  font-size: 1.125rem;
  font-style: italic;
  color: var(--text-primary);
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
  margin-bottom: 1rem;
  line-height: 1.8;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
}

/* Bold words in context sentences */
.context-sentence b {
  font-weight: 700;
  color: var(--primary);
}

/* Dark mode context sentence */
[data-theme="dark"] .context-sentence {
  background: var(--card-bg);
  border-left-color: var(--primary-light);
}

[data-theme="dark"] .context-sentence b {
  color: var(--primary-light);
}

/* Hint wrapper with hover effect */
.card-hint-wrapper {
  margin: 1.5rem -2rem 2rem -2rem;
  position: relative;
  min-height: 80px;
  width: calc(100% + 4rem);
}

.card-hint-wrapper .hint-icon {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  cursor: help;
  display: inline-block;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border-left: 3px solid var(--warning);
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  transition: opacity 0.2s ease-in;
  white-space: nowrap;
}

.card-hint-wrapper .hint-text {
  display: none;
  font-size: 1rem;
  color: var(--text-primary);
  font-style: italic;
  padding: 0.75rem 2rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 90%;
  animation: fadeIn 0.2s ease-in;
  line-height: 1.6;
  box-sizing: border-box;
}

.card-hint-wrapper:hover .hint-icon {
  opacity: 0;
  pointer-events: none;
}

.card-hint-wrapper:hover .hint-text {
  display: block;
}

/* Mobile tap support - same as hover but triggered by .active class */
.card-hint-wrapper.active .hint-icon {
  opacity: 0;
  pointer-events: none;
}

.card-hint-wrapper.active .hint-text {
  display: block;
}

/* Flashcard-specific hint styling (works within flex layout) */
.flashcard-content .card-hint-wrapper {
  margin: 1rem 0;
  width: 100%;
  min-height: 50px;
  position: relative;
}

.flashcard-content .card-hint-wrapper .hint-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.flashcard-content .card-hint-wrapper .hint-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: auto;
  max-width: 90%;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Feedback Buttons */
.feedback-buttons {
  margin-top: 2rem;
  gap: 0.75rem;
}

.feedback-buttons button {
  font-weight: 600;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
}

/* Typing Mode */
.typing-input {
  width: 100%;
  max-width: 500px;
  padding: 1rem;
  font-size: 1.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  margin: 1.5rem 0;
  text-align: center;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.2s;
}

.typing-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 216, 63, 0.1);
}

.typing-feedback {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: var(--radius);
  font-size: 1.125rem;
  font-weight: 600;
}

.typing-feedback.correct {
  background: var(--badge-success-bg);
  color: var(--badge-success-text);
  border-left: 4px solid var(--success);
}

.typing-feedback.incorrect {
  background: var(--badge-danger-bg);
  color: var(--badge-danger-text);
  border-left: 4px solid var(--danger);
}

.typing-feedback.partially-correct {
  background: var(--badge-warning-bg);
  color: var(--badge-warning-text);
  border-left: 4px solid var(--warning);
}

.typing-feedback.partial {
  background: var(--badge-warning-bg);
  color: var(--badge-warning-text);
  border-left: 4px solid var(--warning);
}

/* Cue-Word Label for sentence cards in typing mode */
.typing-cue-word {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0 0;
  font-size: 1.3rem;
}

.typing-cue-word .cue-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.typing-cue-word .cue-word {
  font-weight: 700;
  color: var(--primary);
}

/* AI reasoning in typing feedback */
.typing-feedback .ai-reasoning {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  font-style: italic;
  font-weight: 400;
}

.typing-feedback.correct .ai-reasoning {
  color: var(--badge-success-text);
  opacity: 0.85;
}

.typing-feedback.partial .ai-reasoning {
  color: var(--badge-warning-text);
  opacity: 0.85;
}

.typing-feedback.incorrect .ai-reasoning {
  color: var(--badge-danger-text);
  opacity: 0.85;
}

/* Practice Stats */
.practice-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  padding: 1.5rem;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  min-width: 120px;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

/* Keyboard Shortcuts Display */
.keyboard-shortcuts {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 2px dashed var(--border);
}

.shortcuts-title {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
  font-weight: 600;
  text-align: center;
}

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

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
}

.shortcut-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0.25rem 0.5rem;
  background: var(--text-primary);
  color: var(--bg-primary);
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  font-size: 0.875rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.shortcut-description {
  font-size: 0.875rem;
  color: var(--text-primary);
}

/* ========================================
   ANKI-STYLE PRACTICE INTERFACE
   ======================================== */

/* Prevent horizontal scrollbar during animations */
body:has(.practice-viewport) {
  overflow-x: hidden;
}

/* Practice Viewport - Full screen container */
.practice-viewport {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary, #f5f5f5);
  position: relative;
  overflow-x: hidden; /* Prevent horizontal scrollbar during swipe animations */
  width: 100%;
  max-width: 100vw;
}

/* Minimal Header */
.practice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: transparent;
  flex-wrap: nowrap;
  gap: 1rem;
  position: relative;
  z-index: 1001; /* Above dropdowns (1000) so child dropdowns can overlay content below */
  overflow: visible;
}

.practice-header-left,
.practice-header-center,
.practice-stats-minimal {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.practice-header-left {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.practice-header-right {
  flex: 0 0 auto;
}

.btn-minimal {
  color: var(--text-secondary, #666);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-minimal:hover {
  background: rgba(0,0,0,0.05);
}

/* Back to Dashboard button - styled like progress-saved-hint */
.btn-back-dashboard {
  color: var(--text-secondary, #888) !important;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background: rgba(76, 175, 80, 0.1);
  border: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-back-dashboard:hover {
  background: rgba(76, 175, 80, 0.2);
  color: var(--text-primary) !important;
}

/* Practice header undo button - styled like btn-back-dashboard */
.practice-header #undoBtn {
  background: rgba(76, 175, 80, 0.1);
  border: none;
  color: #666;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.practice-header #undoBtn:hover {
  background: rgba(76, 175, 80, 0.2);
  color: #333;
}

/* Progress saved hint text */
.progress-saved-hint {
  color: var(--text-secondary, #888);
  font-size: 0.75rem;
  margin-left: 0.75rem;
  padding: 0.25rem 0.5rem;
  background: rgba(76, 175, 80, 0.1);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
}

.progress-saved-hint::before {
  content: '✓';
  color: var(--success);
  margin-right: 0.35rem;
  font-weight: bold;
}

.practice-stats-minimal {
  color: var(--text-secondary, #666);
  font-size: 0.9rem;
}

/* Card Container - Centered with flex */
.practice-card-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
  overflow-x: hidden; /* Prevent horizontal scrollbar during swipe animations */
}

/* ============================================
   3D FLASHCARD WITH FLIP ANIMATION
   ============================================ */
.flashcard-container {
  perspective: 1000px;
  -webkit-perspective: 1000px;
  max-width: 620px; /* Increased for sentence-based learning */
  width: 100%;
  min-height: 320px;
  height: auto;
}

.flashcard {
  position: relative;
  width: 100%;
  min-height: 320px;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-transition: -webkit-transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.flashcard.flipped {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
}

/* Ensure front is hidden and back is visible when flipped */
.flashcard.flipped .flashcard-front {
  visibility: hidden;
  opacity: 0;
}

.flashcard.flipped .flashcard-back {
  visibility: visible;
  opacity: 1;
}

.flashcard-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 320px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 12px;
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.1),
    0 10px 20px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  overflow: visible;
  display: flex;
  flex-direction: column;
}

/* Writing lines background */
.flashcard-lines {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent,
      transparent 1.8rem,
      rgba(100, 149, 237, 0.15) 1.8rem,
      rgba(100, 149, 237, 0.15) calc(1.8rem + 1px)
    );
  /* Shift lines to align with text baseline */
  background-position-y: 0.45rem;
}

.flashcard-front {
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  z-index: 2;
  visibility: visible;
  opacity: 1;
  transition: visibility 0.3s, opacity 0.3s;
}

.flashcard-back {
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--badge-info-bg) 100%);
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
  z-index: 1;
  transition: visibility 0.3s, opacity 0.3s;
}

.flashcard-content {
  position: relative;
  z-index: 1;
  padding: 2.25rem 2.5rem 1.5rem 2.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
}

.flashcard-face .language-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1rem;
  font-weight: 600;
}

.flashcard-face .card-content {
  font-size: 1.35rem; /* Reduced for sentence-based learning */
  line-height: 1.7;
  color: var(--text-primary);
  font-weight: 500;
  word-wrap: break-word;
}

/* Bold word highlighting in flashcard sentences */
.flashcard-face .card-content b,
.flashcard-face .card-content strong {
  color: var(--primary, #5D4C9A);
  font-weight: 700;
}

.flashcard-face .card-image {
  margin-top: 1rem;
}

.flashcard-face .card-image img {
  max-width: 100%;
  max-height: 150px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.flashcard-front .btn-show-answer {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1rem 2rem 1.5rem 2rem;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light, #4a90e2) 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.flashcard-front .btn-show-answer .btn-shortcut-hint {
  display: block !important;
  font-size: 0.6rem;
  font-weight: 400;
  color: rgba(255,255,255,0.7);
  margin-top: 0.25rem;
  position: static !important;
}

.flashcard-front .btn-show-answer:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Dark mode adjustments for flashcards */
[data-theme="dark"] .flashcard-front {
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
}

[data-theme="dark"] .flashcard-back {
  background: linear-gradient(180deg, var(--card-bg) 0%, var(--bg-secondary) 100%);
}

[data-theme="dark"] .flashcard-lines {
  background:
    repeating-linear-gradient(
      to bottom,
      transparent,
      transparent 1.8rem,
      rgba(255, 255, 255, 0.05) 1.8rem,
      rgba(255, 255, 255, 0.05) calc(1.8rem + 1px)
    );
  border-left-color: rgba(255, 100, 100, 0.15);
  background-position-y: 0.45rem;
}

[data-theme="dark"] .flashcard-face .card-content {
  color: var(--text-primary);
}

/* ============================================
   END 3D FLASHCARD
   ============================================ */

/* Practice Card - Anki style (for typing mode) */
.practice-card {
  background: var(--bg-primary, white);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 3rem 2.5rem;
  max-width: 600px;
  width: 100%;
  min-height: 200px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow-y: auto;
}

/* Card Content */
.practice-card .card-content {
  font-size: 1.75rem;
  line-height: 1.5;
  color: var(--text-primary, #333);
  margin: 0;
  word-wrap: break-word;
  width: 100%;
}

/* Question Side */
.card-question {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Answer Side */
.card-answer {
  width: 100%;
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.card-divider {
  width: 100%;
  height: 1px;
  background: var(--border, #ddd);
  margin: 1.5rem 0;
}

/* Card Image */
.practice-card .card-image {
  margin-top: 1.5rem;
  width: 100%;
  display: flex;
  justify-content: center;
}

.practice-card .card-image img {
  max-width: 100%;
  max-height: 250px;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* Card Hint - Hover to reveal */
.practice-card .card-hint-wrapper {
  margin: 1.5rem -2rem 2rem -2rem;
  padding: 0;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: calc(100% + 4rem);
}

.practice-card .card-hint-wrapper .hint-icon {
  font-size: 1rem;
  color: var(--text-secondary, #999);
  cursor: help;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: opacity 0.2s;
}

.practice-card .card-hint-wrapper .hint-text {
  display: none;
  font-size: 1rem;
  color: var(--text-primary);
  font-style: italic;
  padding: 0.75rem 2rem;
  background: var(--bg-secondary, #f9f9f9);
  border-radius: 4px;
  border-left: 3px solid var(--primary);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 90%;
  animation: fadeIn 0.2s ease-in;
  line-height: 1.6;
  box-sizing: border-box;
}

.practice-card .card-hint-wrapper:hover .hint-icon {
  opacity: 0;
  pointer-events: none;
}

.practice-card .card-hint-wrapper:hover .hint-text {
  display: block;
}

/* Practice card - mobile tap support */
.practice-card .card-hint-wrapper.active .hint-icon {
  opacity: 0;
  pointer-events: none;
}

.practice-card .card-hint-wrapper.active .hint-text {
  display: block;
}

/* Show Answer Button */
.btn-show-answer {
  margin-top: 2rem;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  background: var(--primary, #5D4C9A);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  font-weight: 500;
}

.btn-show-answer:hover {
  background: var(--primary-dark);
}

/* Generic keyboard hint (fallback) */
.keyboard-hint {
  font-size: 0.65rem;
  color: var(--text-secondary, #888);
  text-align: center;
  margin-top: 0.35rem;
  opacity: 0.7;
}

/* Fixed Button Bar - Anki style */
.practice-buttons {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  background: var(--bg-primary, white);
  border-top: 1px solid var(--border, #e0e0e0);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
  flex-wrap: wrap;
}

/* Difficulty Buttons */
.btn-difficulty {
  flex: 1;
  max-width: 150px;
  min-width: 100px;
  padding: 1rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: center;
}

.btn-difficulty:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-difficulty:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(50%);
}

.btn-label {
  font-size: 1rem;
}

.btn-shortcut {
  font-size: 0.75rem;
  opacity: 0.6;
}

/* Interval preview labels (Anki-style) */
.btn-interval {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.9;
  padding: 0.15rem 0.5rem;
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.2);
  margin-top: 0.125rem;
}

.btn-again .btn-interval { background: rgba(255, 255, 255, 0.25); }
.btn-hard .btn-interval { background: rgba(255, 255, 255, 0.2); }
.btn-good .btn-interval { background: rgba(255, 255, 255, 0.25); }
.btn-easy .btn-interval { background: rgba(255, 255, 255, 0.25); }

/* Button Colors - Anki style */
.btn-again {
  background: var(--color-danger);
  color: white;
}

.btn-again:hover:not(:disabled) {
  background: var(--danger);
}

.btn-hard {
  background: var(--text-light);
  color: white;
}

.btn-hard:hover:not(:disabled) {
  background: var(--text-secondary);
}

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

.btn-good:hover:not(:disabled) {
  background: var(--success-dark);
}

.btn-easy {
  background: var(--primary-light);
  color: white;
}

.btn-easy:hover:not(:disabled) {
  background: var(--primary);
}

/* Keyboard Hint - Subtle corner indicator */
.keyboard-hint {
  position: fixed;
  bottom: 100px;  /* Clear the buttons bar */
  left: 1rem;
  font-size: 0.8rem;
  color: #999;
  background: rgba(255,255,255,0.9);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  z-index: 100;  /* Above buttons but below dropdown */
}

/* Typing Mode Adjustments */
.practice-card .typing-input {
  width: 100%;
  max-width: 500px;
  padding: 1rem;
  font-size: 1.25rem;
  border: 2px solid var(--border, #ddd);
  border-radius: 4px;
  text-align: center;
  transition: border-color 0.2s;
}

.practice-card .typing-input:focus {
  outline: none;
  border-color: var(--primary, #5D4C9A);
}

.practice-card #typingForm {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  align-items: center;
}

/* Animations for card transitions */
.practice-card.entering {
  animation: slideInUp 0.4s ease-out;
}

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

.practice-card.animating {
  pointer-events: none;
}

.practice-card.animating-known {
  animation: swipeRight 0.5s ease-out;
}

.practice-card.animating-not-known {
  animation: swipeLeft 0.5s ease-out;
}

@keyframes swipeRight {
  to {
    transform: translateX(100vw) rotate(20deg);
    opacity: 0;
  }
}

@keyframes swipeLeft {
  to {
    transform: translateX(-100vw) rotate(-20deg);
    opacity: 0;
  }
}

/* Feedback overlay for animations */
.feedback-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 100;
}

/* Counteract the rotateY(180deg) transform on flipped flashcards */
.flashcard.flipped .feedback-overlay {
  transform: rotateY(180deg);
}

.feedback-icon {
  font-size: 8rem;
  font-weight: bold;
  opacity: 0;
  animation: feedbackPulse 0.5s ease-out;
}

.feedback-icon.checkmark {
  color: var(--success);
}

.feedback-icon.x-mark {
  color: var(--color-danger);
}

@keyframes feedbackPulse {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.2);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}

/* ============================================
   WOODEN DESK PRACTICE THEME
   ============================================ */

/* Wooden desk background - applies to practice viewport */
.practice-viewport.wooden-desk-theme {
  /* Use real wooden desk texture image */
  background:
    /* Slight darkening overlay for better card contrast */
    linear-gradient(rgba(0,0,0,0.05), rgba(0,0,0,0.1)),
    url('/img/wooden-desk-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  /* Fallback color if image fails to load */
  background-color: #b8845a;
  position: relative;
}

/* Subtle vignette effect for desk depth */
.practice-viewport.wooden-desk-theme::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    /* Corner shadows for depth */
    radial-gradient(ellipse at 0% 0%, rgba(0, 0, 0, 0.15) 0%, transparent 35%),
    radial-gradient(ellipse at 100% 0%, rgba(0, 0, 0, 0.15) 0%, transparent 35%),
    radial-gradient(ellipse at 0% 100%, rgba(0, 0, 0, 0.2) 0%, transparent 40%),
    radial-gradient(ellipse at 100% 100%, rgba(0, 0, 0, 0.2) 0%, transparent 40%),
    /* Overall subtle vignette for focus effect */
    radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.15) 100%);
  pointer-events: none;
  z-index: -1;
}

/* Ensure content stays above vignette (exclude scattered-cards which needs absolute positioning) */
.practice-viewport.wooden-desk-theme > *:not(.scattered-cards):not(.pv-star):not(.pv-star-svg):not(.practice-header) {
  position: relative;
  z-index: 1;
}

/* ============================================
   PRACTICE VIEW DECORATIVE STARS
   ============================================ */
.pv-star {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  color: rgba(255, 255, 255, 0.45);
  font-size: 1rem;
}
.pv-star-svg {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  opacity: 0.8;
}
.pv-star-1 { top: 6%; left: 5%; font-size: 1.3rem; color: rgba(255,255,255,0.5); animation: qsTwinkle 3s ease-in-out infinite; }
.pv-star-2 { top: 12%; right: 8%; font-size: 0.9rem; color: rgba(200,180,255,0.45); animation: qsDrift 5s ease-in-out 0.5s infinite; }
.pv-star-3 { top: 35%; left: 2%; font-size: 1.5rem; color: rgba(255,255,255,0.4); animation: qsPulse 4s ease-in-out 1s infinite; }
.pv-star-4 { top: 55%; right: 3%; font-size: 1.1rem; color: rgba(200,180,255,0.35); animation: qsSpin 7s linear infinite; }
.pv-star-5 { bottom: 22%; left: 6%; font-size: 0.85rem; color: rgba(255,255,255,0.4); animation: qsTwinkle 3.5s ease-in-out 1.5s infinite; }
.pv-star-6 { bottom: 10%; right: 10%; font-size: 1.2rem; color: rgba(200,180,255,0.45); animation: qsPulse 5s ease-in-out 0.3s infinite; }
.pv-star-7 { top: 22%; left: 12%; font-size: 0.75rem; color: rgba(255,255,255,0.3); animation: qsDrift 6s ease-in-out 2s infinite; }
.pv-star-8 { bottom: 38%; right: 2%; font-size: 0.9rem; color: rgba(200,180,255,0.4); animation: qsTwinkle 4s ease-in-out 1.2s infinite; }
.pv-svg-1 { top: 4%; right: 3%; width: 22px; height: 22px; color: rgba(255,255,255,0.3); animation: qsDrift 7s ease-in-out infinite; }
.pv-svg-2 { bottom: 6%; left: 3%; width: 16px; height: 16px; color: rgba(200,180,255,0.35); animation: qsSpin 10s linear infinite 1s; }

/* ============================================
   SCATTERED CARDS ON DESK
   ============================================ */

/* Container for scattered cards - absolute position within practice-viewport */
.scattered-cards {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 2;  /* Above vignette (-1) and other content (1), below flashcard (5) */
  overflow: hidden;
}

/* Ensure scattered cards display in wooden desk theme */
.practice-viewport.wooden-desk-theme .scattered-cards {
  display: block;
}

/* Individual desk card - realistic flashcard appearance */
.desk-card {
  position: absolute;
  left: var(--x, 10%);
  top: var(--y, 20%);
  width: 120px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  box-sizing: border-box;

  /* 3D perspective - card lying on desk */
  transform:
    rotate(var(--rot, 0deg))
    perspective(800px)
    rotateX(8deg)
    translateZ(0);
  transform-origin: center center;

  /* Realistic paper appearance */
  background-color: #fffef5;
  border-radius: 6px;

  /* Paper texture - notebook lines on cream gradient */
  background-image:
    /* Red margin line */
    linear-gradient(90deg, transparent 8px, rgba(220, 80, 80, 0.2) 8px, rgba(220, 80, 80, 0.2) 10px, transparent 10px),
    /* Blue ruled lines */
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 10px,
      rgba(100, 149, 237, 0.18) 10px,
      rgba(100, 149, 237, 0.18) 11px
    ),
    /* Base paper gradient */
    linear-gradient(145deg, #fffef5 0%, #faf8f0 50%, #f5f3eb 100%);

  /* Realistic layered shadow - card sitting on desk */
  box-shadow:
    /* Contact shadow */
    0 1px 1px rgba(0,0,0,0.12),
    /* Soft ambient shadow */
    0 2px 4px rgba(0,0,0,0.1),
    /* Larger diffuse shadow */
    0 4px 12px rgba(0,0,0,0.08),
    /* Subtle edge highlight */
    inset 0 1px 0 rgba(255,255,255,0.5),
    /* Bottom edge shadow for thickness */
    inset 0 -1px 0 rgba(0,0,0,0.05);

  /* Subtle border for definition */
  border: 1px solid rgba(0,0,0,0.06);

  /* Idle floating animation */
  animation: cardFloat 5s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

/* Idle floating animation - subtle breathing effect */
@keyframes cardFloat {
  0%, 100% {
    transform:
      rotate(var(--rot, 0deg))
      perspective(800px)
      rotateX(8deg)
      translateY(0px)
      translateZ(0);
  }
  50% {
    transform:
      rotate(var(--rot, 0deg))
      perspective(800px)
      rotateX(8deg)
      translateY(-3px)
      translateZ(2px);
  }
}

/* Text inside scattered desk cards - shows upcoming vocabulary */
.desk-card-text {
  font-size: 0.55rem;
  font-weight: 500;
  color: #555;
  text-align: center;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-word;
  max-height: 100%;
  padding: 2px;
}

/* Known cards - green tinted paper */
.desk-card.known-card {
  background-color: #e8f5e9;
  background-image:
    linear-gradient(90deg, transparent 8px, rgba(76, 175, 80, 0.15) 8px, rgba(76, 175, 80, 0.15) 10px, transparent 10px),
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 10px,
      rgba(76, 175, 80, 0.15) 10px,
      rgba(76, 175, 80, 0.15) 11px
    ),
    linear-gradient(145deg, #e8f5e9 0%, #dcedc8 50%, #c8e6c9 100%);
  border-color: rgba(76, 175, 80, 0.2);
}

/* Known counter badge - floating in corner */
.known-counter-badge {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: bold;
  box-shadow:
    0 4px 12px rgba(76, 175, 80, 0.4),
    0 2px 4px rgba(0,0,0,0.2);
  z-index: 10;
  pointer-events: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.known-counter-badge:not(:empty):not([data-count="0"]) {
  animation: counterPulse 0.3s ease;
}

@keyframes counterPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Hide scattered cards on mobile - not enough space */
@media (max-width: 768px) {
  .scattered-cards,
  .practice-viewport.wooden-desk-theme .scattered-cards {
    display: none !important;
  }
  .known-counter-badge {
    bottom: 80px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}

/* Active card styling on wooden desk */
.wooden-desk-theme .flashcard-container {
  position: relative;
  z-index: 5;
}

.wooden-desk-theme .flashcard {
  box-shadow:
    0 8px 16px rgba(0, 0, 0, 0.2),
    0 20px 40px rgba(0, 0, 0, 0.15);
}

.wooden-desk-theme .flashcard-face {
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.15),
    0 12px 24px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* Enhanced paper texture for cards on desk */
.wooden-desk-theme .flashcard-lines {
  background:
    /* Notebook holes on left */
    radial-gradient(circle at 25px 50%, transparent 4px, #fffef8 4px, #fffef8 6px, transparent 6px),
    /* Blue lines */
    repeating-linear-gradient(
      to bottom,
      transparent,
      transparent 1.8rem,
      rgba(100, 149, 237, 0.2) 1.8rem,
      rgba(100, 149, 237, 0.2) calc(1.8rem + 1px)
    );
  /* Red margin line */
  border-left: 2px solid rgba(255, 100, 100, 0.3);
  /* Shift lines to align with text baseline */
  background-position-y: 0.45rem;
}

/* Typing mode on wooden desk */
.wooden-desk-theme .practice-card {
  background: linear-gradient(180deg, #fffef8 0%, #fff9e6 100%);
  box-shadow:
    0 8px 16px rgba(0, 0, 0, 0.2),
    0 20px 40px rgba(0, 0, 0, 0.15);
  border: none;
  position: relative;
}

/* Paper texture for typing mode */
.wooden-desk-theme .practice-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent,
      transparent 1.8rem,
      rgba(100, 149, 237, 0.15) 1.8rem,
      rgba(100, 149, 237, 0.15) calc(1.8rem + 1px)
    );
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
}

/* Ensure practice-card children render above ::before pseudo-element */
.practice-card > * {
  position: relative;
  z-index: 1;
}

/* Typing input styled as pencil writing */
.wooden-desk-theme .typing-input {
  background: transparent;
  border: none;
  border-bottom: 2px solid rgba(100, 149, 237, 0.3);
  border-radius: 0;
  font-family: 'Comic Sans MS', 'Bradley Hand', cursive;
  color: #2c3e50;
}

.wooden-desk-theme .typing-input:focus {
  border-bottom-color: var(--primary);
  box-shadow: none;
}

/* Practice header readability on wooden desk theme */
.wooden-desk-theme .practice-header .btn-minimal,
.wooden-desk-theme .practice-header .btn-back-dashboard,
.wooden-desk-theme .practice-header a,
.wooden-desk-theme .practice-header button {
  color: #fff !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.wooden-desk-theme .practice-header .language-dropdown button {
  color: var(--text-primary, #333) !important;
  text-shadow: none;
}
.wooden-desk-theme .practice-header .language-dropdown button:hover {
  background: var(--bg-secondary, #f5f5f5);
}
.wooden-desk-theme .practice-header .language-dropdown button.active {
  background: var(--bg-tertiary, #E8E5F2);
}

.wooden-desk-theme .practice-header .btn-minimal:hover,
.wooden-desk-theme .practice-header .btn-back-dashboard:hover {
  background: rgba(255, 255, 255, 0.15);
}

.wooden-desk-theme .progress-saved-hint {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9) !important;
}

/* Progress info readability on wooden desk theme */
.wooden-desk-theme #cardsRemainingNumber,
.wooden-desk-theme #cardsRemainingLabel,
.wooden-desk-theme #progressPercent,
.wooden-desk-theme .practice-stats-minimal {
  color: #fff !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Card animations for wooden desk theme */
@keyframes cardFromPile {
  0% {
    transform: translateX(-40vw) translateY(20px) rotate(-8deg) scale(0.5);
    opacity: 0.4;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
  }
  30% {
    transform: translateX(-20vw) translateY(-30px) rotate(-4deg) scale(0.8);
    opacity: 0.8;
    filter: drop-shadow(0 15px 25px rgba(0,0,0,0.3));
  }
  100% {
    transform: translateX(0) translateY(0) rotate(0) scale(1);
    opacity: 1;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
  }
}

@keyframes cardToKnownPile {
  0% {
    transform: translateX(0) translateY(0) rotate(0) scale(1);
    opacity: 1;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
  }
  40% {
    transform: translateX(15vw) translateY(-40px) rotate(5deg) scale(0.9);
    opacity: 1;
    filter: drop-shadow(0 20px 30px rgba(0,0,0,0.25));
  }
  100% {
    transform: translateX(40vw) translateY(15px) rotate(12deg) scale(0.5);
    opacity: 0.5;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.2));
  }
}

@keyframes cardBackToPile {
  0% {
    transform: translateX(0) translateY(0) rotate(0) scale(1);
    opacity: 1;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
  }
  40% {
    transform: translateX(-15vw) translateY(-35px) rotate(-5deg) scale(0.9);
    opacity: 1;
    filter: drop-shadow(0 18px 28px rgba(0,0,0,0.25));
  }
  100% {
    transform: translateX(-40vw) translateY(15px) rotate(-10deg) scale(0.5);
    opacity: 0.5;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.2));
  }
}

/* Placeholder for removed duplicate */
@keyframes cardBackToPileOld {
  0% {
    transform: translateX(0) rotate(0);
    opacity: 1;
  }
  100% {
    transform: translateX(-45vw) rotate(-10deg) scale(0.6);
    opacity: 0.5;
  }
}

/* Apply wooden desk animations */
.wooden-desk-theme .practice-card.entering,
.wooden-desk-theme .flashcard-container.entering {
  animation: cardFromPile 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.wooden-desk-theme .practice-card.animating-known,
.wooden-desk-theme .flashcard-container.animating-known {
  animation: cardToKnownPile 0.65s ease-out forwards;
}

.wooden-desk-theme .practice-card.animating-not-known,
.wooden-desk-theme .flashcard-container.animating-not-known {
  animation: cardBackToPile 0.6s ease-out forwards;
}

/* Dark theme adjustments for wooden desk */
[data-theme="dark"] .practice-viewport.wooden-desk-theme {
  /* Darker overlay on the wooden desk image for dark mode */
  background:
    linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.5)),
    url('/img/wooden-desk-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-color: #2d1f15;
}

/* Force dark text on wooden desk cards in dark mode (light paper bg stays light) */
[data-theme="dark"] .wooden-desk-theme .practice-card .card-content,
[data-theme="dark"] .wooden-desk-theme .practice-card .language-label,
[data-theme="dark"] .wooden-desk-theme .practice-card .typing-cue-word,
[data-theme="dark"] .wooden-desk-theme .practice-card .typing-feedback,
[data-theme="dark"] .wooden-desk-theme .flashcard-face .card-content,
[data-theme="dark"] .wooden-desk-theme .flashcard-face .language-label {
  color: #2c3e50 !important;
}
[data-theme="dark"] .wooden-desk-theme .practice-card .typing-input {
  color: #2c3e50 !important;
}

[data-theme="dark"] .card-pile::before,
[data-theme="dark"] .card-pile::after,
[data-theme="dark"] .card-pile .pile-card {
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .card-pile-right::before,
[data-theme="dark"] .card-pile-right::after,
[data-theme="dark"] .card-pile-right .pile-card {
  background: linear-gradient(180deg, #1b3d1f 0%, #2d4a31 100%);
  border-color: rgba(76, 175, 80, 0.3);
}

/* Desk theme toggle button */
.desk-theme-toggle {
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.2s;
}

.desk-theme-toggle:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* ============================================
   MULTIPLE DESK/TABLE BACKGROUND OPTIONS
   ============================================ */

/* Desk background dropdown container (in header bar) */
.desk-bg-dropdown-container {
  position: relative;
  z-index: 9990;
}

/* Dropdown menu (hidden by default) */
.desk-bg-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: rgba(0, 0, 0, 0.95);
  border-radius: 12px;
  padding: 0.5rem;
  min-width: 200px;
  display: none;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  z-index: 9991 !important;  /* Above container */
}

.desk-bg-dropdown.open {
  display: flex;
}

.desk-bg-dropdown hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  margin: 0.25rem 0;
}

/* Individual options in dropdown */
.desk-bg-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: transparent;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  text-align: left;
  transition: background 0.15s;
  white-space: nowrap;
}

.desk-bg-option:hover {
  background: rgba(255, 255, 255, 0.15);
}

.desk-bg-option.active {
  background: rgba(255, 255, 255, 0.25);
}

.desk-bg-option .option-icon {
  font-size: 1rem;
  width: 1.5rem;
  text-align: center;
}

.desk-bg-option .option-check {
  margin-left: auto;
  opacity: 0;
}

.desk-bg-option.active .option-check {
  opacity: 1;
}

/* Suggest Edit Button - positioned above dropdown to avoid overlap */
#suggestEditBtn {
  bottom: 210px !important;  /* Move up to clear dropdown */
  z-index: 9985 !important;  /* Below dropdown */
}

/* Individual desk theme backgrounds */
.practice-viewport.desk-theme-oak {
  background:
    linear-gradient(rgba(0,0,0,0.05), rgba(0,0,0,0.1)),
    url('/img/desk-bg-oak.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-color: #d4a574;
}

.practice-viewport.desk-theme-walnut {
  background:
    linear-gradient(rgba(0,0,0,0.05), rgba(0,0,0,0.1)),
    url('/img/wooden-desk-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-color: #5d4037;
}

.practice-viewport.desk-theme-cherry {
  background:
    linear-gradient(rgba(0,0,0,0.05), rgba(0,0,0,0.1)),
    url('/img/desk-bg-cherry.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-color: #8b4513;
}

.practice-viewport.desk-theme-barnwood {
  background:
    linear-gradient(rgba(0,0,0,0.08), rgba(0,0,0,0.15)),
    url('/img/desk-bg-barnwood.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-color: #6d5c4e;
}

/* Dark mode adjustments for all desk themes */
[data-theme="dark"] .practice-viewport.desk-theme-oak {
  background:
    linear-gradient(rgba(0,0,0,0.35), rgba(0,0,0,0.45)),
    url('/img/desk-bg-oak.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-color: #3d2a1a;
}

[data-theme="dark"] .practice-viewport.desk-theme-walnut {
  background:
    linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.5)),
    url('/img/wooden-desk-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-color: #2d1f15;
}

[data-theme="dark"] .practice-viewport.desk-theme-cherry {
  background:
    linear-gradient(rgba(0,0,0,0.35), rgba(0,0,0,0.45)),
    url('/img/desk-bg-cherry.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-color: #2d1510;
}

[data-theme="dark"] .practice-viewport.desk-theme-barnwood {
  background:
    linear-gradient(rgba(0,0,0,0.35), rgba(0,0,0,0.45)),
    url('/img/desk-bg-barnwood.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-color: #2a231d;
}


/* ============================================
   Dark Desk Themes (for night practice)
   ============================================ */
.practice-viewport.desk-theme-midnight {
  background: linear-gradient(135deg, #0a0e27 0%, #1a1f4e 50%, #0d1235 100%);
  background-attachment: fixed;
}

.practice-viewport.desk-theme-darkslate {
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 50%, #1a1a2e 100%);
  background-attachment: fixed;
}

.practice-viewport.desk-theme-carbon {
  background: linear-gradient(135deg, #0d0d0d 0%, #1a1a1a 50%, #111111 100%);
  background-attachment: fixed;
}

/* Dark themes: ensure card readability */
.practice-viewport.desk-theme-midnight .flashcard,
.practice-viewport.desk-theme-darkslate .flashcard,
.practice-viewport.desk-theme-carbon .flashcard {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.practice-viewport.desk-theme-midnight .practice-header,
.practice-viewport.desk-theme-darkslate .practice-header,
.practice-viewport.desk-theme-carbon .practice-header {
  background: rgba(0, 0, 0, 0.3);
}

.practice-viewport.desk-theme-midnight .practice-header *,
.practice-viewport.desk-theme-darkslate .practice-header *,
.practice-viewport.desk-theme-carbon .practice-header * {
  color: rgba(255, 255, 255, 0.9);
}

/* Dark mode variants stay the same */
[data-theme="dark"] .practice-viewport.desk-theme-midnight {
  background: linear-gradient(135deg, #050815 0%, #0f1335 50%, #080b20 100%);
}

[data-theme="dark"] .practice-viewport.desk-theme-darkslate {
  background: linear-gradient(135deg, #111122 0%, #1d1d33 50%, #111122 100%);
}

[data-theme="dark"] .practice-viewport.desk-theme-carbon {
  background: linear-gradient(135deg, #080808 0%, #121212 50%, #0a0a0a 100%);
}

[data-theme="dark"] .practice-viewport.desk-theme-midnight .flashcard,
[data-theme="dark"] .practice-viewport.desk-theme-darkslate .flashcard,
[data-theme="dark"] .practice-viewport.desk-theme-carbon .flashcard {
  background: rgba(30, 30, 40, 0.95);
  color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

/* ============================================
   ClassCards Brand Theme
   ============================================ */

/* Light mode background - soft purple glow with warm beige */
.practice-viewport.desk-theme-classcards,
[data-theme="dark"] .practice-viewport.desk-theme-classcards {
  background:
    /* Purple glow from top center */
    radial-gradient(ellipse at 50% 0%, rgba(138, 92, 200, 0.35) 0%, transparent 55%),
    /* Secondary glow bottom-right */
    radial-gradient(ellipse at 80% 90%, rgba(100, 60, 180, 0.15) 0%, transparent 50%),
    /* Secondary glow bottom-left */
    radial-gradient(ellipse at 20% 80%, rgba(80, 50, 160, 0.12) 0%, transparent 50%),
    /* Base dark gradient */
    linear-gradient(180deg, #1a1030 0%, #160d28 30%, #110a20 60%, #0d0818 100%);
  background-attachment: fixed;
}

/* Stars layer via ::before pseudo-element */
.practice-viewport.desk-theme-classcards::before,
[data-theme="dark"] .practice-viewport.desk-theme-classcards::before {
  background:
    /* Large bright stars */
    radial-gradient(1.5px 1.5px at 10% 15%, rgba(255,255,255,0.9) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 85% 8%, rgba(255,255,255,0.85) 50%, transparent 100%),
    radial-gradient(1px 1px at 45% 5%, rgba(255,255,255,0.8) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 70% 22%, rgba(255,255,255,0.7) 50%, transparent 100%),
    radial-gradient(1px 1px at 25% 35%, rgba(255,255,255,0.75) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 92% 40%, rgba(255,255,255,0.65) 50%, transparent 100%),
    radial-gradient(1px 1px at 55% 30%, rgba(255,255,255,0.7) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 15% 55%, rgba(255,255,255,0.6) 50%, transparent 100%),
    radial-gradient(1px 1px at 78% 58%, rgba(255,255,255,0.75) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 35% 70%, rgba(255,255,255,0.5) 50%, transparent 100%),
    /* Medium stars */
    radial-gradient(1px 1px at 5% 45%, rgba(200,180,255,0.6) 50%, transparent 100%),
    radial-gradient(1px 1px at 60% 12%, rgba(200,180,255,0.5) 50%, transparent 100%),
    radial-gradient(1px 1px at 95% 25%, rgba(200,180,255,0.55) 50%, transparent 100%),
    radial-gradient(1px 1px at 40% 48%, rgba(200,180,255,0.45) 50%, transparent 100%),
    radial-gradient(1px 1px at 72% 65%, rgba(200,180,255,0.5) 50%, transparent 100%),
    radial-gradient(1px 1px at 18% 78%, rgba(200,180,255,0.4) 50%, transparent 100%),
    radial-gradient(1px 1px at 88% 72%, rgba(200,180,255,0.45) 50%, transparent 100%),
    radial-gradient(1px 1px at 50% 85%, rgba(200,180,255,0.35) 50%, transparent 100%),
    /* Small dim stars */
    radial-gradient(0.5px 0.5px at 8% 28%, rgba(255,255,255,0.4) 50%, transparent 100%),
    radial-gradient(0.5px 0.5px at 33% 18%, rgba(255,255,255,0.35) 50%, transparent 100%),
    radial-gradient(0.5px 0.5px at 62% 42%, rgba(255,255,255,0.3) 50%, transparent 100%),
    radial-gradient(0.5px 0.5px at 82% 52%, rgba(255,255,255,0.35) 50%, transparent 100%),
    radial-gradient(0.5px 0.5px at 22% 62%, rgba(255,255,255,0.3) 50%, transparent 100%),
    radial-gradient(0.5px 0.5px at 48% 75%, rgba(255,255,255,0.25) 50%, transparent 100%),
    radial-gradient(0.5px 0.5px at 75% 88%, rgba(255,255,255,0.3) 50%, transparent 100%),
    radial-gradient(0.5px 0.5px at 3% 92%, rgba(255,255,255,0.25) 50%, transparent 100%),
    radial-gradient(0.5px 0.5px at 97% 95%, rgba(255,255,255,0.2) 50%, transparent 100%),
    /* Vignette */
    radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.25) 100%);
  animation: starsTwinkle 8s ease-in-out infinite alternate;
}

@keyframes starsTwinkle {
  0% { opacity: 0.85; }
  50% { opacity: 1; }
  100% { opacity: 0.9; }
}

/* Scattered cards - translucent cards with purple glow */
.practice-viewport.desk-theme-classcards .scattered-cards .desk-card,
[data-theme="dark"] .practice-viewport.desk-theme-classcards .scattered-cards .desk-card {
  background-color: rgba(93, 76, 154, 0.25);
  background-image: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.7);
  transform: rotate(var(--rot, 0deg)) translateZ(0);
  box-shadow:
    0 2px 8px rgba(93, 76, 154, 0.15),
    0 4px 16px rgba(93, 76, 154, 0.08);
  animation: classcardsFloat 6s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Known cards - lighter green tint */
.practice-viewport.desk-theme-classcards .scattered-cards .desk-card.known-card,
[data-theme="dark"] .practice-viewport.desk-theme-classcards .scattered-cards .desk-card.known-card {
  background-color: rgba(76, 175, 80, 0.2);
  background-image: none;
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
  box-shadow:
    0 2px 8px rgba(76, 175, 80, 0.12),
    0 4px 16px rgba(76, 175, 80, 0.06);
}

/* Floating animation - calmer 2D bob */
@keyframes classcardsFloat {
  0%, 100% {
    transform: rotate(var(--rot, 0deg)) translateY(0px) translateX(0px) translateZ(0);
    opacity: 0.85;
  }
  40% {
    transform: rotate(var(--rot, 0deg)) translateY(-4px) translateX(1px) translateZ(0);
    opacity: 0.9;
  }
  70% {
    transform: rotate(var(--rot, 0deg)) translateY(-2px) translateX(-1px) translateZ(0);
    opacity: 0.87;
  }
}

/* Active flashcard override - remove notebook lines */
.practice-viewport.desk-theme-classcards .flashcard-lines {
  background: none;
  border-left: none;
}

/* Golden glow on flashcard container (preserve-3d on .flashcard clips box-shadow on face) */
.practice-viewport.desk-theme-classcards .flashcard-container,
[data-theme="dark"] .practice-viewport.desk-theme-classcards .flashcard-container {
  border-radius: var(--radius-lg, 16px);
  box-shadow:
    0 0 25px rgba(255, 200, 60, 0.5),
    0 0 60px rgba(255, 190, 50, 0.35),
    0 0 100px rgba(255, 180, 40, 0.2),
    0 0 150px rgba(255, 170, 30, 0.1);
}

/* Golden glowy flashcard face */
.practice-viewport.desk-theme-classcards .flashcard-face,
[data-theme="dark"] .practice-viewport.desk-theme-classcards .flashcard-face {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 215, 100, 0.15) 0%, transparent 60%),
    linear-gradient(180deg, #fffdf6 0%, #fff9eb 100%) !important;
  border: 1px solid rgba(218, 175, 70, 0.5) !important;
  box-shadow:
    0 0 20px rgba(255, 200, 60, 0.5),
    0 0 50px rgba(255, 190, 50, 0.35),
    0 0 90px rgba(255, 180, 40, 0.2),
    0 0 140px rgba(255, 170, 30, 0.1),
    0 4px 16px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
}

/* Clean typing/practice card - also golden */
.practice-viewport.desk-theme-classcards .practice-card,
[data-theme="dark"] .practice-viewport.desk-theme-classcards .practice-card {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 215, 100, 0.15) 0%, transparent 60%),
    linear-gradient(180deg, #fffdf6 0%, #fff9eb 100%) !important;
  border: 1px solid rgba(218, 175, 70, 0.5) !important;
  box-shadow:
    0 0 20px rgba(255, 200, 60, 0.5),
    0 0 50px rgba(255, 190, 50, 0.35),
    0 0 90px rgba(255, 180, 40, 0.2),
    0 0 140px rgba(255, 170, 30, 0.1),
    0 4px 16px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
}

.practice-viewport.desk-theme-classcards .practice-card::before {
  background: none;
}

/* Typing input - normal app styling with purple focus ring */
.practice-viewport.desk-theme-classcards .typing-input {
  font-family: inherit;
  background: var(--bg-primary, #fff);
  border: 1px solid rgba(138, 92, 200, 0.3);
  border-radius: var(--radius-sm, 6px);
  color: var(--text-primary);
}

.practice-viewport.desk-theme-classcards .typing-input:focus {
  border-color: rgba(138, 92, 200, 0.6);
  box-shadow: 0 0 0 3px rgba(138, 92, 200, 0.15);
}

/* Header/progress text - light text on dark purple background */
.practice-viewport.desk-theme-classcards .practice-header .btn-minimal,
.practice-viewport.desk-theme-classcards .practice-header .btn-back-dashboard,
.practice-viewport.desk-theme-classcards .practice-header a,
.practice-viewport.desk-theme-classcards .practice-header button {
  color: rgba(255, 255, 255, 0.9) !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.practice-viewport.desk-theme-classcards .practice-header .btn-minimal:hover,
.practice-viewport.desk-theme-classcards .practice-header .btn-back-dashboard:hover {
  color: rgba(200, 180, 255, 1) !important;
  background: rgba(138, 92, 200, 0.2);
}

/* Direction toggle button - visible on dark background */
.practice-viewport.desk-theme-classcards #directionToggleBtn,
[data-theme="dark"] .practice-viewport.desk-theme-classcards #directionToggleBtn {
  background: rgba(138, 92, 200, 0.3) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  color: rgba(255, 255, 255, 0.9) !important;
}

.practice-viewport.desk-theme-classcards #directionToggleBtn:hover,
[data-theme="dark"] .practice-viewport.desk-theme-classcards #directionToggleBtn:hover {
  background: rgba(138, 92, 200, 0.5) !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
  color: white !important;
}

.practice-viewport.desk-theme-classcards .progress-saved-hint {
  background: rgba(138, 92, 200, 0.2);
  color: rgba(255, 255, 255, 0.75) !important;
}

.practice-viewport.desk-theme-classcards #cardsRemainingNumber,
.practice-viewport.desk-theme-classcards #cardsRemainingLabel,
.practice-viewport.desk-theme-classcards #progressPercent,
.practice-viewport.desk-theme-classcards .practice-stats-minimal {
  color: rgba(255, 255, 255, 0.9) !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Apply base desk theme styling when any desk-theme-* class is present */
.practice-viewport[class*="desk-theme-"]::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(0, 0, 0, 0.15) 0%, transparent 35%),
    radial-gradient(ellipse at 100% 0%, rgba(0, 0, 0, 0.15) 0%, transparent 35%),
    radial-gradient(ellipse at 0% 100%, rgba(0, 0, 0, 0.2) 0%, transparent 40%),
    radial-gradient(ellipse at 100% 100%, rgba(0, 0, 0, 0.2) 0%, transparent 40%),
    radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.15) 100%);
  pointer-events: none;
  z-index: -1;
}

/* Reduce golden glow on mobile to prevent overflow */
@media (max-width: 768px) {
  .practice-viewport.desk-theme-classcards .flashcard-container,
  [data-theme="dark"] .practice-viewport.desk-theme-classcards .flashcard-container {
    box-shadow:
      0 0 15px rgba(255, 200, 60, 0.45),
      0 0 35px rgba(255, 190, 50, 0.3),
      0 0 60px rgba(255, 180, 40, 0.15);
  }
}

/* Hide piles on mobile - not enough space */
@media (max-width: 768px) {
  .desk-card-piles {
    display: none;
  }

  .wooden-desk-theme .flashcard-container.entering,
  .wooden-desk-theme .practice-card.entering {
    animation: cardEntry 0.4s ease-out;
  }

  .wooden-desk-theme .flashcard-container.animating-known,
  .wooden-desk-theme .practice-card.animating-known {
    animation: swipeRight 0.5s ease-out forwards;
  }

  .wooden-desk-theme .flashcard-container.animating-not-known,
  .wooden-desk-theme .practice-card.animating-not-known {
    animation: swipeLeft 0.5s ease-out forwards;
  }
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
  .practice-card {
    padding: 2rem 1.5rem;
    max-height: 80vh;
  }

  .practice-card .card-content {
    font-size: 1.5rem;
  }

  .practice-buttons {
    padding: 0.75rem 0.5rem;
    gap: 0.4rem;
  }

  .btn-difficulty {
    min-width: 0;
    flex: 1;
    padding: 0.6rem 0.25rem;
  }

  .btn-label {
    font-size: 0.85rem;
  }

  .btn-shortcut {
    font-size: 0.65rem;
  }

  .keyboard-hint {
    font-size: 0.7rem;
    padding: 0.4rem 0.6rem;
    bottom: 90px;  /* Adjust for mobile button bar */
    left: 0.5rem;
    max-width: 200px;  /* Prevent overflow */
  }

  /* Desk dropdown is in header bar now, no fixed positioning needed */

  #suggestEditBtn {
    bottom: 190px !important;
    right: 0.5rem !important;
  }

  .practice-header {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 0.5rem;
    gap: 0.5rem;
  }

  .practice-header-left {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
    flex-wrap: wrap;
  }

  /* Consistent button sizing in practice header mobile */
  .practice-header button,
  .practice-header .btn,
  .practice-header .btn-minimal,
  .practice-header .btn-back-dashboard,
  .practice-header a.btn {
    height: 32px !important;
    min-height: 32px !important;
    font-size: 0.875rem !important;
    padding: 0 0.5rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Back button - visible with background on mobile */
  .practice-header-left .btn-minimal,
  .practice-header-left .btn-back-dashboard {
    font-size: 0 !important;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 8px !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  .practice-header-left .btn-minimal::before,
  .practice-header-left .btn-back-dashboard::before {
    content: '←';
    font-size: 1.25rem;
    font-weight: bold;
  }

  .practice-header-left .btn-minimal:hover,
  .practice-header-left .btn-back-dashboard:hover {
    background: rgba(255, 255, 255, 0.35) !important;
  }

  /* Hide progress hint on mobile - show shorter version */
  .progress-saved-hint {
    display: none !important;
  }

  /* Hide non-essential elements on mobile */
  #randomModeIndicator,
  #switchToGapBtn,
  #drillModeIndicator {
    display: none !important;
  }

  /* Hide undo text, show only icon */
  #undoBtn span {
    display: none !important;
  }

  /* Hide direction toggle text, show only SVG icon */
  #directionToggleBtn span {
    display: none !important;
  }

  /* Hide settings/username link on mobile practice */
  .practice-header-right .nav-link-inherit {
    display: none !important;
  }

  /* Compact direction toggle - consistent sizing */
  #directionToggleBtn {
    height: 32px !important;
    min-height: 32px !important;
    margin: 0 !important;
    padding: 0 0.5rem !important;
    font-size: 0.875rem !important;
    gap: 0.15rem !important;
    background: var(--bg-tertiary, var(--bg-secondary)) !important;
    border: 1px solid var(--border) !important;
    border-radius: 1rem !important;
  }

  /* Make flag emojis consistent size */
  #directionToggleBtn span {
    font-size: 0.875rem !important;
    line-height: 1 !important;
  }

  /* Fix text readability in mobile practice header for all themes */
  .practice-header,
  .practice-header .btn-minimal,
  .practice-header .btn-back-dashboard,
  .practice-header button,
  .practice-header a {
    color: var(--text-primary) !important;
  }

  /* Back button arrow needs good contrast */
  .practice-header-left .btn-minimal::before,
  .practice-header-left .btn-back-dashboard::before {
    color: var(--text-primary) !important;
  }

  .practice-header-center {
    flex: 1;
    justify-content: flex-end;
  }

  #progressInfo {
    gap: 0.4rem !important;
  }

  /* Minimal circular progress - just the number */
  #circularProgress {
    width: 32px !important;
    height: 32px !important;
  }

  #circularProgress svg {
    display: none !important;
  }

  #cardsRemainingNumber {
    position: static !important;
    transform: none !important;
    font-size: 0.875rem !important;
    font-weight: 700 !important;
    background: var(--primary, #5D4C9A);
    color: white !important;
    height: 32px !important;
    min-width: 32px;
    padding: 0 0.5rem;
    border-radius: 1rem;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Hide labels and extra info */
  #progressInfo > div:not(#circularProgress) {
    display: none !important;
  }

  #streakDisplay {
    display: none !important;
  }

  .practice-header-right {
    display: flex !important;
    align-items: center;
    gap: 0.3rem;
  }

  .practice-header-right #edit-mode-toggle {
    display: none !important;
  }

  /* Compact desk background toggle on mobile — icon only */
  .practice-header-right .desk-bg-dropdown-container .desk-theme-toggle {
    padding: 0.35rem 0.5rem;
    font-size: 1.1rem;
  }
  .practice-header-right .desk-bg-dropdown-container .desk-theme-toggle span {
    display: none;
  }
  .practice-header-right .desk-bg-dropdown {
    right: -2rem;
    min-width: 180px;
  }

  /* Theme switcher - visible and styled on mobile */
  .practice-header-right .theme-dropdown-container {
    display: flex !important;
  }

  .practice-header-right .theme-switcher {
    width: 36px !important;
    height: 36px !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 8px !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    font-size: 1.1rem;
    display: flex !important;
    align-items: center;
    justify-content: center;
  }

  .practice-header-right .theme-switcher:hover {
    background: rgba(255, 255, 255, 0.35) !important;
  }

  /* TTS auto-play toggle - match header button styling */
  .practice-header-right .tts-auto-toggle {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 8px !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    font-size: 1rem;
  }

  .practice-header-right .tts-auto-toggle.active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
  }

  /* Language switcher styling to match */
  .practice-header-right .language-switcher {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 8px !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    font-size: 0.7rem !important;
    font-weight: 600;
    padding: 0 !important;
  }

  /* Hide desktop flashcard on mobile, show mobile version */
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block;
  }


  /* Mobile flashcard - 3D flip animation */
  .mobile-flashcard {
    perspective: 1000px;
    -webkit-perspective: 1000px;
    width: 100%;
    padding: 0 1rem;
  }

  .mobile-flashcard-inner {
    position: relative;
    width: 100%;
    min-height: 280px;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-transition: -webkit-transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .mobile-flashcard-inner.flipped {
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
  }

  .mobile-flashcard-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 280px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    text-align: center;
    box-sizing: border-box;
  }

  .mobile-flashcard-front {
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    z-index: 2;
  }

  .mobile-flashcard-back {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--badge-info-bg) 100%);
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
    z-index: 1;
  }

  /* Ensure content appears above lines */
  .mobile-flashcard-face > *:not(.flashcard-lines) {
    position: relative;
    z-index: 1;
  }

  .mobile-flashcard-face .language-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
  }

  .mobile-flashcard-face .card-content {
    font-size: 1.15rem; /* Reduced for sentence-based learning */
    line-height: 1.6;
    color: var(--text-primary);
  }

  /* Bold word highlighting in mobile flashcard sentences */
  .mobile-flashcard-face .card-content b,
  .mobile-flashcard-face .card-content strong {
    color: var(--primary, #5D4C9A);
    font-weight: 700;
  }

  .mobile-flashcard-back .card-content {
    color: var(--primary);
    font-weight: 600;
  }

  .mobile-flashcard-face .btn-show-answer {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: auto;
  }

  .mobile-flashcard-face .card-image {
    max-width: 100%;
    margin: 0.5rem 0;
  }

  .mobile-flashcard-face .card-image img {
    max-width: 100%;
    border-radius: 8px;
  }

  .mobile-flashcard-face .card-hint-wrapper {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #666;
  }

  /* Mobile context sentence styling */
  .mobile-flashcard-face .context-sentence {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
  }

  .mobile-flashcard-face .card-content.with-context {
    font-size: 1.2rem;
    margin: 0.5rem 0;
  }

  .flashcard-content {
    padding: 2.3rem 1.5rem 1rem 2.5rem;
  }

  .flashcard-face .card-content {
    font-size: 1.3rem;
  }

  /* Desktop flashcard context */
  .flashcard-content .context-sentence {
    font-size: 1rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
  }

  .flashcard-face .card-content.with-context {
    font-size: 1.1rem;
    margin: 0.5rem 0;
  }
}

/* Extra small phones - further reduce button sizes */
@media (max-width: 480px) {
  .practice-buttons {
    gap: 0.3rem;
    padding: 0.5rem 0.25rem;
  }

  .btn-difficulty {
    min-width: 0;
    flex: 1;
    padding: 0.5rem 0.2rem;
    font-size: 0.8rem;
  }

  .btn-label {
    font-size: 0.8rem;
  }

  .btn-shortcut {
    display: none;
  }

  /* Hide keyboard hint on small screens */
  .keyboard-hint {
    display: none;
  }

  /* Desk dropdown is in header bar, no fixed positioning needed */

  #suggestEditBtn {
    bottom: 170px !important;
    right: 8px !important;
    font-size: 0.75rem !important;
    padding: 0.4rem 0.6rem !important;
  }

  .btn-interval {
    font-size: 0.7rem;
    padding: 0.1rem 0.35rem;
  }

  .mobile-flashcard-face .card-content {
    font-size: 1rem; /* Reduced for sentence-based learning on small screens */
  }

  /* Bold word highlighting on small screens */
  .mobile-flashcard-face .card-content b,
  .mobile-flashcard-face .card-content strong {
    color: var(--primary, #5D4C9A);
    font-weight: 700;
  }

  .mobile-flashcard-face .context-sentence {
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
    line-height: 1.35;
  }

  .mobile-flashcard-face {
    min-height: 240px;
  }
}

/* Wider phones (769–900px): still show mobile flashcard UI */
@media (max-width: 900px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block;
  }
}

/* Desktop only - hide mobile elements */
@media (min-width: 901px) {
  .mobile-only {
    display: none !important;
  }

  .desktop-only {
    display: block;
  }
}

/* Dark mode support for Anki-style interface */
@media (prefers-color-scheme: dark) {
  .practice-viewport {
    background: var(--bg-secondary);
  }

  .practice-card {
    background: var(--bg-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  }

  .keyboard-hint {
    background: rgba(0,0,0,0.7);
    color: #ccc;
  }
}

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

.deck-card {
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(93, 76, 154, 0.15);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.deck-card:hover {
  transform: translateY(-2px);
  border-color: rgba(93, 76, 154, 0.3);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.deck-card h3 {
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.deck-card h3 .deck-type-badge {
  display: block;
  margin-top: 0.35rem;
  width: fit-content;
}

.deck-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.deck-meta {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.deck-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.deck-stats .stat {
  flex: 1;
  min-width: 75px;
  text-align: center;
  padding: 0.75rem 0.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.deck-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

.deck-actions .btn {
  flex: 1;
}

/* Card */
.flashcard {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 3rem;
  box-shadow: var(--shadow-lg);
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform 0.2s;
}

.flashcard:not(.flipped):hover {
  transform: translateY(-2px);
}

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
  border-bottom: 1px dotted var(--text-secondary);
  cursor: help;
}

.tooltiptext {
  visibility: hidden;
  width: 200px;
  background-color: #2D2D3D;
  color: white;
  text-align: center;
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -100px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.875rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* Info Icon for tooltips */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary, #6C5CE7);
  color: white;
  font-size: 10px;
  font-weight: 600;
  font-style: italic;
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
  flex-shrink: 0;
}

.tooltip .info-icon {
  border-bottom: none;
}

/* Wider tooltips for info icons */
.tooltip .tooltiptext.wide {
  width: 280px;
  margin-left: -140px;
  text-align: left;
  line-height: 1.4;
}

/* Hide default tooltips in table headers - JS creates floating tooltips to escape overflow clipping */
.data-table th .tooltip .tooltiptext,
.data-table th .tooltip .tooltiptext.wide {
  display: none !important;
}

/* Floating tooltip appended to body (used by JS for tooltips in overflow containers) */
.floating-tooltip {
  position: fixed;
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  z-index: 10000;
  max-width: 300px;
  min-width: 200px;
  text-align: left;
  line-height: 1.4;
  pointer-events: none;
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin: 0.5rem 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  transition: width 0.3s;
}

/* Footer */
.info-footer {
  color: white;
  text-align: center;
  margin: 20px auto;
  padding-bottom: 20px;
}

.info-footer a {
  color: white;
  text-decoration: none;
  font-weight: 500;
}

.info-footer a:hover {
  text-decoration: underline;
}

/* Utility Classes */
.clearBoth {
  clear: both;
}

.text-center {
  text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* Responsive */
@media (max-width: 1200px) {
  html {
    min-width: auto;
  }

  .contentWrapper {
    width: 95%;
    margin-left: -47.5%;
  }

  .header-content {
    width: 95%;
    margin-left: -47.5%;
  }

  .container {
    padding: 1rem;
  }
}

@media (max-width: 768px) {
  .content-layout {
    flex-direction: column;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .deck-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .logo-circle {
    width: 100px;
    height: 100px;
  }

  /* Mobile card/box padding fixes */
  .gradient-box, .card, .section {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
  }

  .stat-card {
    padding: 1rem;
  }

  .form-group {
    margin-bottom: 1rem;
  }

  .container {
    padding: 1rem;
  }
}

/* ===================================
   GDPR/DSGVO Cookie Consent Styles
   =================================== */

.cookie-consent-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease-out;
  padding: 1.5rem;
}

.cookie-consent-overlay.cookie-consent-closing {
  animation: fadeOut 0.3s ease-out;
}

.cookie-consent-modal {
  background: var(--card-bg);
  border-radius: 20px;
  max-width: 520px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.08);
  animation: cookieSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-consent-closing .cookie-consent-modal {
  animation: cookieSlideDown 0.3s ease-in;
}

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

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

.cookie-consent-header {
  padding: 1.75rem 1.75rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cookie-consent-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-color);
}

.cookie-consent-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s, color 0.2s;
}

.cookie-consent-close:hover {
  background: var(--hover-bg);
  color: var(--text-color);
}

.cookie-consent-body {
  padding: 1rem 1.75rem 1.25rem;
}

.cookie-consent-body > p {
  margin-bottom: 1.25rem;
  line-height: 1.6;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.cookie-consent-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.cookie-option {
  background: var(--bg-secondary, #f8f9fa);
  border: none;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  transition: background-color 0.2s;
}

.cookie-option:hover {
  background: var(--hover-bg, #f0f1f3);
}

.cookie-option-header {
  margin-bottom: 0.25rem;
}

.cookie-option-header label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  color: var(--text-color);
  cursor: pointer;
  font-size: 0.95rem;
}

/* Toggle switch replacing checkbox */
.cookie-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  order: 1;
  margin-left: auto;
}

.cookie-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cookie-toggle .toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border-color, #d1d5db);
  border-radius: 24px;
  transition: background-color 0.25s;
}

.cookie-toggle .toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.25s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.cookie-toggle input:checked + .toggle-slider {
  background: #11B8A0;
}

.cookie-toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.cookie-toggle input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Generic toggle switch (reusable) */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch .toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border-color, #d1d5db);
  border-radius: 26px;
  transition: background-color 0.25s;
}

.toggle-switch .toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background: white;
  border-radius: 50%;
  transition: transform 0.25s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle-switch input:checked + .toggle-slider {
  background: #11B8A0;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

.cookie-required {
  font-size: 0.8rem;
  font-weight: normal;
  color: var(--text-muted);
  font-style: italic;
}

.cookie-option-description {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.cookie-consent-links {
  text-align: center;
  padding-top: 0.75rem;
  font-size: 0.85rem;
}

.cookie-consent-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.cookie-consent-links a:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

.cookie-consent-links span {
  margin: 0 0.5rem;
  color: var(--text-muted);
  opacity: 0.5;
}

.cookie-consent-footer {
  padding: 0 1.75rem 1.75rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.cookie-consent-footer .btn-cookie-accept {
  flex: 1;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  background: linear-gradient(135deg, #11B8A0, #0ea38e);
  color: white;
}

.cookie-consent-footer .btn-cookie-accept:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(17, 184, 160, 0.3);
}

.cookie-consent-footer .btn-cookie-reject {
  flex: 1;
  padding: 0.75rem 1.5rem;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
  color: var(--text-color);
}

.cookie-consent-footer .btn-cookie-reject:hover {
  border-color: var(--text-muted);
  background: var(--hover-bg);
}

/* Dark mode overrides for cookie banner */
[data-theme="dark"] .cookie-option {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .cookie-option:hover {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .cookie-consent-modal {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

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

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

/* ===================================
   Practice Card Swipe Animations
   =================================== */

@keyframes swipeRightKnown {
  0% {
    transform: translateX(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateX(120%) rotate(15deg);
    opacity: 0;
  }
}

@keyframes swipeLeftNotKnown {
  0% {
    transform: translateX(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateX(-120%) rotate(-15deg);
    opacity: 0;
  }
}

@keyframes pulseCheckmark {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes shakeX {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

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

/* Animation state classes */
.card-display.animating-known {
  animation: swipeRightKnown 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}

.card-display.animating-not-known {
  animation: swipeLeftNotKnown 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}

.card-display.entering {
  animation: fadeInCard 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Feedback overlay */
.feedback-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  pointer-events: none;
}

.feedback-icon {
  font-size: 120px;
  line-height: 1;
  display: block;
}

.feedback-icon.checkmark {
  color: var(--success);
  animation: pulseCheckmark 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.feedback-icon.x-mark {
  color: var(--danger);
  animation: shakeX 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ensure practice area is positioned for overlay */
.practice-area {
  position: relative;
}

/* Disable pointer events during animation */
.card-display.animating {
  pointer-events: none;
}

/* ===================================
   Legal Pages Styles
   =================================== */

.legal-page {
  max-width: 900px;
  margin: 2rem auto;
  padding: 2rem;
}

.legal-content {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 2.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.legal-content h1 {
  color: var(--text-color);
  margin-bottom: 0.5rem;
  font-size: 2.5rem;
}

.last-updated {
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.legal-content section {
  margin-bottom: 2.5rem;
}

.legal-content h2 {
  color: var(--primary-color);
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-size: 1.75rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.legal-content h3 {
  color: var(--text-color);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.legal-content h4 {
  color: var(--text-color);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.legal-content p {
  line-height: 1.8;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.legal-content ul, .legal-content ol {
  margin-left: 2rem;
  margin-bottom: 1rem;
  line-height: 1.8;
}

.legal-content li {
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.legal-content a {
  color: var(--primary-color);
  text-decoration: none;
}

.legal-content a:hover {
  text-decoration: underline;
}

.legal-content code {
  background: var(--code-bg, #f5f5f5);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: var(--code-color, #d63384);
}

.legal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border-color);
  flex-wrap: wrap;
}

.cookie-table {
  overflow-x: auto;
  margin: 1rem 0;
}

.cookie-table table {
  width: 100%;
  border-collapse: collapse;
  background: var(--table-bg, var(--card-bg));
  border-radius: 8px;
  overflow: hidden;
}

.cookie-table thead {
  background: var(--primary-color);
  color: white;
}

.cookie-table th,
.cookie-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.cookie-table th {
  font-weight: 600;
  font-size: 0.95rem;
}

.cookie-table td {
  color: var(--text-color);
}

.cookie-table tbody tr:hover {
  background: var(--hover-bg);
}

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

/* Footer Styles — see 3-column grid footer section below */

/* Responsive adjustments for legal pages */
@media (max-width: 768px) {
  .legal-page {
    padding: 1rem;
  }

  .legal-content {
    padding: 1.5rem;
  }

  .legal-content h1 {
    font-size: 2rem;
  }

  .legal-content h2 {
    font-size: 1.5rem;
  }

  .legal-actions {
    flex-direction: column;
  }

  .legal-actions .btn-primary,
  .legal-actions .btn-secondary {
    width: 100%;
    text-align: center;
  }

  .cookie-consent-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .cookie-consent-modal {
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
  }

  .cookie-consent-footer {
    flex-direction: column;
  }

  .cookie-consent-footer button {
    width: 100%;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}

/* Activity Log Styles */
.filter-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.multi-select {
  height: 120px;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text-primary);
}

.multi-select option {
  padding: 0.5rem;
  margin: 0.25rem 0;
  border-radius: 4px;
}

.multi-select option:checked {
  background: var(--primary);
  color: white;
}

.export-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.weekly-table {
  font-size: 0.875rem;
}

.weekly-table th {
  text-align: center;
  padding: 0.5rem;
  background: var(--bg-secondary);
}

.weekly-table td {
  text-align: center;
  padding: 0.5rem;
}

.weekly-table td:first-child {
  text-align: left;
  font-weight: 600;
}

/* =====================================================
   MOBILE RESPONSIVE STYLES
   ===================================================== */

/* Tablet breakpoint - 768px */
@media (max-width: 768px) {
  /* Main content takes full width */
  .main-content {
    width: 100% !important;
    padding: 1rem !important;
  }

  .app-layout {
    flex-direction: column;
    width: 100%;
    max-width: 100vw;
  }

  /* Navbar adjustments */
  .navbar {
    padding: 0.5rem 0;
  }

  .nav-content {
    padding: 0 0.5rem;
    width: 100%;
    max-width: 100%;
    gap: 0.5rem;
  }

  .nav-content h2 {
    font-size: 1.1rem;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-content h2 img {
    height: 24px;
    margin-right: 4px;
  }

  .nav-right {
    gap: 0.25rem;
    flex-shrink: 0;
  }

  /* Hide non-essential navbar items on mobile */
  .nav-right .btn-secondary:not([href="/logout"]):not(.logout-btn):not(.language-switcher) {
    display: none;
  }

  /* Hide welcome text on mobile */
  .nav-right > span:not(.theme-switcher):not(.language-switcher),
  .nav-right > a[href="/settings"] {
    display: none;
  }

  /* Keep essential buttons visible */
  .nav-right .theme-switcher,
  .nav-right .language-switcher,
  .nav-right .logout-btn,
  .nav-right [href="/logout"] {
    display: inline-flex;
  }

  /* Compact buttons on mobile */
  .nav-right .btn-secondary,
  .nav-right .language-switcher {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    min-width: unset;
  }

  /* Stats grid single column */
  .stats-grid {
    grid-template-columns: 1fr;
  }

  /* Tables scroll horizontally */
  .table-container {
    overflow-x: auto;
  }

  /* Cards full width */
  .card {
    margin: 0 0 1rem 0;
  }

  /* Form layouts */
  .form-row {
    grid-template-columns: 1fr;
  }

  /* Dashboard and section full width */
  .dashboard,
  .section {
    width: 100%;
    max-width: 100%;
    padding: 0;
  }

  /* Deck grid single column */
  .deck-grid {
    grid-template-columns: 1fr !important;
  }

  /* Container full width */
  .container {
    padding: 1rem;
    max-width: 100%;
  }

  /* Quiz results grid - stack on mobile */
  #quiz-results [style*="grid-template-columns: repeat(3"] {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  /* Quiz result stat boxes smaller padding */
  #quiz-results [style*="background: var(--bg-secondary)"] {
    padding: 1rem !important;
  }

  /* Quiz input larger touch target */
  #quiz-form input[type="text"] {
    font-size: 1rem;
    padding: 0.875rem;
  }
}

/* Small phone breakpoint - 480px */
@media (max-width: 480px) {
  /* Mobile content padding - enough space but not too much */
  .main-content {
    padding: 1rem 0.75rem;
  }

  /* Card/box padding for small screens */
  .gradient-box, .card, .section {
    padding: 0.875rem;
    margin-bottom: 0.875rem;
    margin-left: 0;
    margin-right: 0;
    border-radius: 8px;
  }

  /* Grid gaps for mobile */
  .deck-grid,
  .stats-grid,
  .gamification-grid {
    gap: 0.75rem;
  }

  /* Container width fixes */
  .container {
    padding: 0.75rem;
    width: 100%;
    max-width: 100%;
  }

  .contentWrapper {
    width: 100%;
    margin: 0;
    padding: 0 0.5rem;
  }

  /* Stat cards */
  .stat-card {
    padding: 0.875rem;
  }

  /* Navbar - hide text, show only logo */
  .nav-content h2 {
    font-size: 0;
  }

  .nav-content h2 img {
    height: 28px;
  }

  /* Hide logo text on small mobile - keep only logo icon */
  .navbar-logo-circle .logo-text {
    display: none;
  }

  /* Class selector compact on small screens */
  .class-selector-dropdown {
    display: flex;
  }

  .class-selector-btn .class-selector-text {
    max-width: 55px;
    font-size: 0.68rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .class-selector-btn {
    padding: 0.3rem 0.4rem;
    gap: 0.2rem;
  }

  /* Compact buttons */
  .nav-right .btn-secondary,
  .nav-right .language-switcher {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
  }

  .nav-right .theme-switcher {
    padding: 0.35rem;
  }

  /* Compact logout button on small screens - always visible */
  .nav-right .logout-btn {
    padding: 0.35rem !important;
    min-width: unset !important;
    display: flex !important;
    flex-shrink: 0;
  }

  .nav-right .logout-btn svg {
    width: 1.1rem;
    height: 1.1rem;
  }

  /* Ensure nav-right doesn't overflow and logout stays visible */
  .nav-right {
    flex-wrap: nowrap;
    overflow: visible;
  }

  /* Username in settings link - truncate aggressively */
  .nav-right a[href="/settings"] {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Practice card adjustments */
  .practice-card {
    padding: 1.5rem 1rem;
  }

  .card-content {
    font-size: 1.25rem;
  }

  /* 2x2 difficulty button grid */
  .difficulty-buttons {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
  }

  .btn-difficulty {
    min-height: 48px;
    min-width: unset;
    max-width: unset;
    padding: 0.75rem 0.5rem;
    font-size: 0.875rem;
  }

  /* Hide keyboard hints on touch devices */
  .keyboard-hint {
    display: none !important;
  }

  /* Practice viewport - fixed on mobile but allow vertical scroll */
  .practice-viewport {
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    overflow-y: auto; /* Allow scrolling if content is too tall */
    overflow-x: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
  }

  body:has(.practice-viewport) {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }

  /* Make card container smaller on mobile portrait to fit buttons */
  .practice-card-container {
    flex: 1;
    min-height: 0; /* Allow shrinking */
    padding: 0.5rem;
  }

  /* Smaller mobile card */
  .mobile-flashcard-face {
    padding: 1rem;
    min-height: 220px;
  }

  .mobile-flashcard-face .card-content {
    font-size: 1.2rem;
  }

  .mobile-flashcard-inner {
    min-height: 220px;
  }

  /* Compact practice buttons for portrait */
  .practice-buttons {
    padding: 0.5rem 0.4rem;
    gap: 0.35rem;
    flex-shrink: 0; /* Don't let buttons shrink */
  }

  .btn-difficulty {
    padding: 0.5rem 0.25rem;
    min-width: 0;
    flex: 1;
  }

  /* Touch-friendly hints - tap to reveal (keep icon visible, text hidden until tapped) */
  .card-hint-wrapper .hint-text {
    display: none;
    font-size: 0.875rem;
  }

  .card-hint-wrapper .hint-icon {
    display: inline-block;
    cursor: pointer;
  }

  .card-hint-wrapper.active .hint-text {
    display: block;
  }

  .card-hint-wrapper.active .hint-icon {
    display: none;
  }

  /* Stat cards smaller */
  .stat-card {
    padding: 1rem;
  }

  .stat-value {
    font-size: 1.75rem;
  }

  /* Section headers */
  .section h1 {
    font-size: 1.5rem;
  }

  .section h2 {
    font-size: 1.25rem;
  }
}

/* Portrait orientation fix - ensure buttons stay visible */
@media (max-width: 768px) and (orientation: portrait) {
  .practice-viewport {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    height: 100vh;
  }

  .practice-header {
    flex-shrink: 0;
  }

  .mode-selector {
    margin-bottom: 0.75rem;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
  }

  .mode-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }

  .practice-card-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .practice-card {
    max-height: calc(100dvh - 280px); /* Leave room for header, difficulty buttons, and mode selector */
    max-height: calc(100vh - 280px);
    overflow-y: auto;
  }

  .practice-buttons {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    background: var(--bg-primary, white);
    z-index: 10;
  }

  /* Hide circular progress on very small portrait screens to save space */
  #circularProgress {
    width: 45px !important;
    height: 45px !important;
  }

  #circularProgress svg {
    width: 45px !important;
    height: 45px !important;
  }

  #cardsRemainingNumber {
    font-size: 1rem !important;
  }
}

/* Extra small phones - 360px */
@media (max-width: 360px) {
  .practice-card {
    padding: 0.75rem 0.5rem;
  }

  .card-content {
    font-size: 1.1rem;
  }

  .btn-difficulty {
    padding: 0.4rem 0.15rem;
    font-size: 0.75rem;
  }

  .btn-interval {
    font-size: 0.6rem;
  }

}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets */
  .btn, button {
    min-height: 44px;
  }

  /* Hide keyboard hints on touch devices */
  .keyboard-hint,
  .btn-shortcut,
  .shortcut-key {
    display: none !important;
  }

  /* Hints: tap to reveal instead of hover */
  .card-hint-wrapper .hint-icon {
    cursor: pointer;
  }

  .card-hint-wrapper.active .hint-text {
    display: block;
  }

  .card-hint-wrapper.active .hint-icon {
    display: none;
  }

}

/* App Mode: Deck cards inside sections should not have separate card styling */
.dashboard .section .deck-grid .deck-card {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 1rem 0 !important;
  border-bottom: 1px solid var(--border) !important;
}

.dashboard .section .deck-grid .deck-card:last-child {
  border-bottom: none !important;
}

/* ============================================
   BOTTOM NAVIGATION BAR - Mobile Only
   ============================================ */
.bottom-nav {
  display: none; /* Hidden by default (desktop) */
}

@media (max-width: 768px) {
  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height, 3.5rem);
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  /* Adjust main content padding for bottom nav */
  .app-layout .main-content {
    padding-bottom: calc(var(--bottom-nav-height, 3.5rem) + 1rem) !important;
  }
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 500;
  padding: 0.5rem;
  min-width: 3.5rem;
  border-radius: var(--radius);
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bottom-nav a:hover {
  background: var(--bg-secondary);
}

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

.bottom-nav a.active svg {
  transform: scale(1.1);
}

.bottom-nav a svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

/* ===========================================
   Online Students Widget
   =========================================== */
.online-students-section {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.online-students-section .section-header h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1.125rem;
}

.online-indicator {
  width: 10px;
  height: 10px;
  background: var(--color-success-alt);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

.online-count {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.online-students-list {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
}

.online-student-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  transition: background 0.2s, border-color 0.2s;
  border: 2px solid transparent;
}

.online-student-item.practicing {
  border-color: var(--color-success-alt);
  background: color-mix(in srgb, var(--color-success-alt) 10%, transparent);
}

.student-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-practicing {
  background: var(--color-success-alt);
  box-shadow: 0 0 8px color-mix(in srgb, var(--color-success-alt) 50%, transparent);
}

.status-online {
  background: var(--primary-light);
}

.student-info {
  flex: 1;
  min-width: 0;
}

.student-name {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.student-class {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.student-activity {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.activity-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.activity-badge.practicing {
  background: var(--color-success-alt);
  color: white;
}

.activity-badge.browsing {
  background: var(--border);
  color: var(--text-secondary);
}

.duration {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Accessibility: Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================
   Generic Modal Overlay (Suggest Edit Modal)
   ============================================ */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  justify-content: center;
  align-items: center;
}

.modal .modal-content {
  background: var(--bg-primary, #fff);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border, #ddd);
}

.modal .modal-header h3 {
  margin: 0;
}

.modal .modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary, #666);
  padding: 0;
  line-height: 1;
}

.modal .modal-close:hover {
  color: var(--text-primary, #333);
}

[data-theme="dark"] .modal .modal-content {
  background: var(--bg-primary, #1e1e1e);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* ============================================
   Custom Modal System
   ============================================ */

.custom-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999; /* Must be highest to appear above all other modals */
  opacity: 0;
  transition: opacity 0.2s ease;
  padding: 1rem;
}

.custom-modal-overlay.modal-visible {
  opacity: 1;
}

.custom-modal-overlay.modal-closing {
  opacity: 0;
}

.custom-modal {
  background: var(--bg-primary);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 450px;
  width: 100%;
  padding: 1.5rem;
  position: relative;
  transform: scale(0.9) translateY(-20px);
  transition: transform 0.2s ease;
}

.modal-visible .custom-modal {
  transform: scale(1) translateY(0);
}

.modal-closing .custom-modal {
  transform: scale(0.9) translateY(-20px);
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.modal-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.modal-icon svg {
  width: 48px;
  height: 48px;
}

.modal-icon-warning {
  color: var(--accent-orange);
}

.modal-icon-error {
  color: var(--color-danger);
}

.modal-icon-success {
  color: var(--color-success-alt);
}

.modal-icon-info {
  color: var(--primary);
}

.modal-title {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}

.modal-message {
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.5;
  white-space: pre-line;
}

.modal-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 1.25rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.modal-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(93, 76, 154, 0.25);
}

.modal-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.modal-buttons .btn {
  min-width: 100px;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
}

/* Modal with list items (for class selection) */
.modal-list {
  text-align: left;
  margin: 0.75rem 0 1.25rem;
  padding-left: 1.5rem;
}

.modal-list li {
  color: var(--text-secondary);
  padding: 0.25rem 0;
}

/* Stacked buttons variant for custom modals */
.modal-buttons-stacked {
  flex-direction: column;
}

.modal-buttons-stacked .btn {
  width: 100%;
}

/* Dark mode adjustments */
[data-theme="dark"] .custom-modal {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .custom-modal-overlay {
  background: rgba(0, 0, 0, 0.7);
}

/* Mobile responsive */
@media (max-width: 480px) {
  .custom-modal {
    padding: 1.25rem;
    margin: 0.5rem;
  }

  .modal-content--sm,
  .modal-content--md,
  .modal-content--lg {
    max-width: calc(100vw - 2rem);
  }

  .modal-buttons {
    flex-direction: column;
  }

  .modal-buttons .btn {
    width: 100%;
  }
}

/* ============================================
   SESSION COMPLETE - Mobile Full Width
   ============================================ */
@media (max-width: 768px) {
  #noCardsState {
    width: 100%;
    max-width: 100%;
  }
}

/* ============================================
   HARD WORDS / SCHWIERIGE WÖRTER
   ============================================ */

.hard-words-section {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, rgba(239, 68, 68, 0.1) 100%);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--color-danger);
}

[data-theme="dark"] .hard-words-section {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(239, 68, 68, 0.15) 100%);
}

.hard-words-section .section-header {
  margin-bottom: 0.5rem;
}

.hard-words-section h2 {
  color: var(--color-danger-dark);
  margin: 0;
}

[data-theme="dark"] .hard-words-section h2 {
  color: var(--color-danger);
}

/* Difficulty badges */
.difficulty-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.difficulty-badge.struggling,
.badge-status.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-danger);
}

.difficulty-badge.learning,
.badge-status.badge-warning {
  background: rgba(255, 216, 63, 0.15);
  color: var(--accent-orange);
}

.difficulty-badge.mastered,
.badge-status.badge-good {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-success-alt);
}

.difficulty-badge.not-practiced,
.badge-status.badge-info {
  background: rgba(93, 76, 154, 0.15);
  color: var(--primary);
}

[data-theme="dark"] .difficulty-badge.struggling,
[data-theme="dark"] .badge-status.badge-danger {
  background: color-mix(in srgb, var(--color-danger) 20%, transparent);
  color: var(--badge-danger-text);
}

[data-theme="dark"] .difficulty-badge.learning,
[data-theme="dark"] .badge-status.badge-warning {
  background: color-mix(in srgb, var(--accent-orange) 20%, transparent);
  color: var(--accent-orange);
}

[data-theme="dark"] .difficulty-badge.mastered,
[data-theme="dark"] .badge-status.badge-good {
  background: color-mix(in srgb, var(--color-success-alt) 20%, transparent);
  color: var(--color-success-alt);
}

[data-theme="dark"] .difficulty-badge.not-practiced,
[data-theme="dark"] .badge-status.badge-info {
  background: color-mix(in srgb, var(--primary-light) 20%, transparent);
  color: var(--badge-info-text);
}

/* Drill mode indicator */
#drillModeIndicator {
  animation: pulse-drill 2s infinite;
}

@keyframes pulse-drill {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Filter bar styling */
.filter-bar {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

[data-theme="dark"] .filter-bar {
  background: var(--bg-tertiary);
}

/* Table in hard words section */
.hard-words-section .data-table {
  background: var(--card-bg);
  border-radius: var(--radius);
}

/* Recently added section styling */
.recently-added-section {
  background: linear-gradient(135deg, rgba(93, 76, 154, 0.05) 0%, rgba(93, 76, 154, 0.1) 100%);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--primary);
}

[data-theme="dark"] .recently-added-section {
  background: linear-gradient(135deg, rgba(93, 76, 154, 0.08) 0%, rgba(93, 76, 154, 0.15) 100%);
}

/* ============================================
   LAZY STUDENTS / FAULE SCHÜLER*INNEN
   ============================================ */

.lazy-students-section {
  background: linear-gradient(135deg, rgba(255, 216, 63, 0.05) 0%, rgba(255, 216, 63, 0.1) 100%);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--accent-orange);
}

[data-theme="dark"] .lazy-students-section {
  background: linear-gradient(135deg, rgba(255, 216, 63, 0.08) 0%, rgba(255, 216, 63, 0.15) 100%);
}

.lazy-students-section .section-header {
  margin-bottom: 0.5rem;
}

.lazy-students-section h2 {
  color: var(--accent-orange-dark);
  margin: 0;
}

[data-theme="dark"] .lazy-students-section h2 {
  color: var(--accent-orange);
}

.lazy-students-section .data-table {
  background: var(--card-bg);
  border-radius: var(--radius);
}

/* ============================================
   VOCAB EXPANDER - Dashboard Vocabulary Input
   ============================================ */

.vocab-expander {
  background: linear-gradient(145deg, rgba(93, 76, 154, 0.06) 0%, rgba(93, 76, 154, 0.12) 100%);
  border-radius: 16px;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(93, 76, 154, 0.25);
  overflow: visible;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 24px rgba(93, 76, 154, 0.1), 0 1px 3px rgba(0, 0, 0, 0.04);
}

.vocab-expander:hover {
  box-shadow: 0 8px 32px rgba(93, 76, 154, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

[data-theme="dark"] .vocab-expander {
  background: linear-gradient(145deg, rgba(93, 76, 154, 0.25) 0%, rgba(93, 76, 154, 0.15) 100%);
  border-color: rgba(139, 126, 240, 0.4);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
}

.vocab-expander-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.75rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(135deg, rgba(93, 76, 154, 0.08) 0%, rgba(93, 76, 154, 0.03) 100%);
}

.vocab-expander-header:hover {
  background: linear-gradient(135deg, rgba(93, 76, 154, 0.14) 0%, rgba(93, 76, 154, 0.06) 100%);
}

.vocab-expander-title {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.vocab-expander-title h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="dark"] .vocab-expander-title h2 {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.vocab-expander-icon {
  font-size: 1.75rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.vocab-expander-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.vocab-expander-badge {
  background: var(--primary);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.vocab-expander-chevron {
  color: var(--primary);
  font-size: 0.9rem;
  transition: transform 0.3s ease;
}

.vocab-expander.expanded .vocab-expander-chevron {
  transform: rotate(180deg);
}

.vocab-expander-content {
  display: none;
  padding: 0 1.5rem 1.5rem;
  animation: slideDown 0.3s ease;
}

.vocab-expander.expanded .vocab-expander-content {
  display: block;
}

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

/* Class Selector */
.vocab-expander-class-selector {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.vocab-expander-class-selector label {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.vocab-expander-select {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 0.95rem;
  min-width: 180px;
}

.vocab-expander-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(93, 76, 154, 0.25);
}

.vocab-expander-deck-info {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-style: italic;
}

/* Vocabulary Input Table - Modern Clean Design */
.vocab-expander-table-container {
  background: transparent;
  border-radius: 12px;
  padding: 0;
  margin-bottom: 1.5rem;
  border: none;
}

.vocab-expander-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: auto;
  min-width: 600px;
}

/* Class dropdown column (replaces per-class checkbox columns) */
.ve-class-dropdown-col {
  width: 80px;
  min-width: 80px;
  position: relative;
  text-align: center;
  vertical-align: middle;
}

.ve-class-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.ve-class-dropdown-trigger:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(93, 76, 154, 0.06);
}

.ve-class-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  min-width: 160px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  margin-top: 4px;
}

.ve-class-dropdown.open {
  display: block;
}

.ve-class-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-primary);
  transition: background 0.1s;
  white-space: nowrap;
}

.ve-class-dropdown-item:hover {
  background: rgba(93, 76, 154, 0.08);
}

.ve-class-dropdown-item.is-current {
  opacity: 0.5;
  pointer-events: none;
}

.ve-class-dropdown-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: pointer;
}

/* Master class dropdown in header */
.ve-master-class-col {
  position: relative;
}

.ve-master-trigger {
  font-weight: 600;
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(93, 76, 154, 0.06);
}

[data-theme="dark"] .ve-class-dropdown {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Actions column - fixed width */
.vocab-expander-table .vocab-expander-actions-col {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
}

/* Sentence columns - equal width distribution with minimum */
.vocab-expander-table th.ve-sentence-col,
.vocab-expander-table td.ve-sentence-col {
  width: 45%;
  min-width: 200px;
}

.vocab-expander-table th {
  padding: 0.25rem 0.5rem 0.5rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  border-bottom: 2px solid rgba(93, 76, 154, 0.2);
}

.vocab-expander-table td {
  padding: 0.15rem 4px;
  vertical-align: middle;
  border-bottom: 1px solid rgba(93, 76, 154, 0.08);
}

.vocab-expander-table td:first-child {
  padding-left: 0;
}

.vocab-expander-table td:last-child {
  padding-right: 0;
}

.vocab-expander-row {
  transition: background 0.15s ease;
}

.vocab-expander-row:hover {
  background: rgba(93, 76, 154, 0.04);
}

.vocab-expander-row:nth-child(even) {
  background: rgba(93, 76, 154, 0.03);
}

.vocab-expander-row:nth-child(even):hover {
  background: rgba(93, 76, 154, 0.06);
}

.vocab-expander-row .vocab-expander-input {
  width: 100%;
  padding: 0.3rem 0.5rem;
  border: none;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  font-size: 0.875rem;
  background: transparent;
  color: var(--text-primary);
  transition: background 0.15s ease, border-color 0.15s ease;
  box-shadow: none;
}

.vocab-expander-row .vocab-expander-input:hover {
  background: rgba(93, 76, 154, 0.05);
  box-shadow: none;
}

.vocab-expander-row .vocab-expander-input:focus {
  outline: none;
  border-bottom-color: rgba(93, 76, 154, 0.3);
  background: rgba(93, 76, 154, 0.06);
  box-shadow: none;
}

.vocab-expander-row .vocab-expander-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.5;
}

[data-theme="dark"] .vocab-expander-row .vocab-expander-input {
  background: transparent;
  box-shadow: none;
}

[data-theme="dark"] .vocab-expander-row .vocab-expander-input:hover {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .vocab-expander-row .vocab-expander-input:focus {
  background: rgba(255, 255, 255, 0.08);
  border-bottom-color: rgba(255, 255, 255, 0.4);
  box-shadow: none;
}

[data-theme="dark"] .vocab-expander-table th {
  color: rgba(255, 255, 255, 0.7);
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .vocab-expander-row .vocab-expander-input {
  color: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .vocab-expander-class-selector label {
  color: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] .vocab-expander-header {
  background: linear-gradient(135deg, rgba(93, 76, 154, 0.2) 0%, rgba(93, 76, 154, 0.1) 100%);
}

[data-theme="dark"] .vocab-expander-header:hover {
  background: linear-gradient(135deg, rgba(93, 76, 154, 0.3) 0%, rgba(93, 76, 154, 0.15) 100%);
}

[data-theme="dark"] .vocab-expander-table td {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .vocab-expander-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .vocab-expander-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

.vocab-expander-context-col {
  width: 20%;
}

/* Vocab expander contenteditable sentence fields - Modern Design */
.ve-sentence-wrapper {
  position: relative;
  display: flex;
  align-items: stretch;
}

.ve-sentence-wrapper .ve-rich-input {
  flex: 1;
  min-height: 1.8rem;
  padding: 0.3rem 2rem 0.3rem 0.5rem;
  border: none;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  background: transparent;
  color: var(--text-primary);
  transition: background 0.15s ease, border-color 0.15s ease;
  box-shadow: none;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.ve-sentence-wrapper .ve-rich-input:hover {
  background: rgba(93, 76, 154, 0.05);
  box-shadow: none;
}

.ve-sentence-wrapper .ve-rich-input:focus {
  outline: none;
  border-bottom-color: rgba(93, 76, 154, 0.3);
  background: rgba(93, 76, 154, 0.06);
  box-shadow: none;
}

.ve-sentence-wrapper .ve-rich-input:empty:not(:focus):before {
  content: attr(data-placeholder);
  color: var(--text-secondary);
  opacity: 0.5;
  pointer-events: none;
}
.ve-sentence-wrapper .rich-placeholder {
  padding: 0.3rem 2rem 0.3rem 0.5rem;
}

.ve-sentence-wrapper .ve-rich-input b,
.ve-sentence-wrapper .ve-rich-input strong {
  color: var(--primary);
  font-weight: 700;
  background: linear-gradient(135deg, rgba(93, 76, 154, 0.1) 0%, rgba(93, 76, 154, 0.05) 100%);
  padding: 0 4px;
  border-radius: 4px;
}

.ve-sentence-wrapper .ve-bold-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 4px;
  background: rgba(93, 76, 154, 0.15);
  color: var(--primary, #6C5CE7);
  font-weight: 700;
  font-size: 0.65rem;
  cursor: pointer;
  transition: all 0.15s ease;
  opacity: 0.6;
  box-shadow: none;
}

.ve-sentence-wrapper .ve-bold-btn:hover {
  opacity: 1;
  transform: translateY(-50%) scale(1.05);
  background: rgba(93, 76, 154, 0.25);
  color: var(--primary, #6C5CE7);
  box-shadow: none;
}

[data-theme="dark"] .ve-sentence-wrapper .ve-bold-btn {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .ve-sentence-wrapper .ve-bold-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.ve-sentence-wrapper .ve-bold-btn:active {
  transform: translateY(-50%) scale(0.95);
}

[data-theme="dark"] .ve-sentence-wrapper .ve-rich-input {
  background: transparent;
  box-shadow: none;
}

[data-theme="dark"] .ve-sentence-wrapper .ve-rich-input:hover {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .ve-sentence-wrapper .ve-rich-input:focus {
  background: rgba(255, 255, 255, 0.08);
  border-bottom-color: rgba(255, 255, 255, 0.4);
  box-shadow: none;
}

[data-theme="dark"] .ve-sentence-wrapper .ve-rich-input b,
[data-theme="dark"] .ve-sentence-wrapper .ve-rich-input strong {
  color: var(--primary-light);
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.2) 0%, rgba(96, 165, 250, 0.1) 100%);
}

[data-theme="dark"] .ve-sentence-wrapper .ve-bold-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

/* Dark mode: hero area */
[data-theme="dark"] .ve-hero-area {
  background: var(--card-bg, #2A2A3E);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .ve-hero-area .vocab-expander-table thead th {
  color: rgba(255, 255, 255, 0.7);
  border-bottom-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .ve-hero-area .vocab-expander-table td {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .ve-hero-area .vocab-expander-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .ve-hero-area .vocab-expander-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .ve-hero-area .ve-rich-input {
  color: rgba(255, 255, 255, 0.9);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .ve-hero-area .ve-rich-input:hover {
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .ve-hero-area .ve-rich-input:focus {
  border-bottom-color: var(--primary);
}

[data-theme="dark"] .ve-hero-area .rich-placeholder {
  color: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .ve-hero-area .btn-remove-row {
  color: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .ve-hero-area .btn-remove-row:hover {
  color: #ff6b6b;
}

/* Dark mode: master class dropdown trigger */
[data-theme="dark"] .ve-master-trigger {
  border-color: var(--primary-light, #8B7EF0);
  color: var(--primary-light, #8B7EF0);
  background: rgba(139, 126, 240, 0.1);
}

/* Legacy context wrapper (deprecated) */
.ve-context-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.ve-context-wrapper .ve-rich-input {
  flex: 1;
  min-height: 2rem;
  max-height: 4rem;
  overflow-y: auto;
  padding: 0.5rem;
  line-height: 1.3;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.ve-context-wrapper .ve-rich-input[data-placeholder]:empty:before {
  content: attr(data-placeholder);
  color: var(--text-light);
  pointer-events: none;
}

.ve-bold-btn {
  flex-shrink: 0;
  padding: 0.15rem 0.3rem;
  font-size: 0.65rem;
  font-weight: bold;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 3px;
  cursor: pointer;
  color: rgba(255,255,255,0.7);
  line-height: 1;
  margin-top: 0.2rem;
}

.ve-bold-btn:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.3);
  color: white;
}

.vocab-expander-btn-col {
  width: 36px;
  text-align: center;
  padding: 0.15rem !important;
  vertical-align: middle;
}

.vocab-expander-actions-col {
  width: 36px;
  text-align: center;
  vertical-align: middle;
}

.vocab-expander-row .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  transition: all 0.15s ease;
  box-shadow: none;
}

.vocab-expander-row .btn-icon:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  transform: scale(1.05);
  box-shadow: none;
}

.vocab-expander-row .btn-icon:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.vocab-expander-row .btn-translate:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--badge-info-bg) 0%, var(--badge-purple-bg) 100%);
}

.vocab-expander-row .btn-ai-generate:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--badge-warning-bg) 0%, var(--accent-orange-dark) 100%);
}

.vocab-expander-row .btn-remove-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 300;
  padding: 0;
  border-radius: 4px;
  transition: all 0.15s ease;
  opacity: 0.3;
}

.vocab-expander-row:hover .btn-remove-row {
  opacity: 0.8;
}

.vocab-expander-row .btn-remove-row:hover {
  opacity: 1;
  color: white;
  background: rgba(239, 68, 68, 0.6);
  transform: scale(1.05);
  box-shadow: none;
}

.vocab-expander-table-actions {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}

/* Apple-style add row button */
.ve-add-row-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1.5px dashed var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ve-add-row-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(93, 76, 154, 0.06);
}

.ve-add-row-icon {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
}

/* Vocab Expander Translate Button */
.ve-translate-col {
  width: 68px;
  min-width: 68px;
  text-align: center;
  padding: 0.15rem 2px;
  vertical-align: middle;
}

.ve-col-btns {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.ve-translate-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 2px;
}

.ve-translate-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.25);
  transform: scale(1.05);
}

.ve-translate-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.ve-sentence-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  transition: all 0.15s ease;
  padding: 2px;
}
.ve-sentence-btn:hover:not(.ve-sentence-btn--disabled) {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.25);
  transform: scale(1.05);
}
.ve-sentence-btn--disabled {
  opacity: 0.35;
  cursor: default;
  filter: grayscale(1);
}
.ve-hero-area .ve-sentence-btn {
  border-color: var(--border, #ddd);
  color: var(--text-primary, #333);
}
.ve-hero-area .ve-sentence-btn:hover:not(.ve-sentence-btn--disabled) {
  background: var(--bg-secondary, #f5f5f5);
  border-color: var(--primary, #5D4C9A);
}

.ve-translate-icon {
  font-size: 0.9rem;
  line-height: 1;
}

/* Action Buttons - Modern Prominent Style */
.vocab-expander-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  margin-top: 0.5rem;
}

.vocab-expander-actions .btn-primary {
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
  box-shadow: 0 4px 14px rgba(93, 76, 154, 0.25);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.vocab-expander-actions .btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(93, 76, 154, 0.35);
}

.vocab-expander-actions .btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Vocab Expander Hero Area - dark purple with stars */
.ve-hero-area {
  position: relative;
  overflow: hidden;
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  margin: -0.5rem -0.5rem 1rem;
  border: 1px solid var(--border, #e0e0e0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.ve-hero-area::before {
  display: none;
}

/* Override table styles inside hero — clean white background */
.ve-hero-area .vocab-expander-table thead th {
  color: var(--text-primary, #333);
  border-bottom: 2px solid var(--border, #e0e0e0);
  text-align: center;
}
.ve-hero-area .vocab-expander-table td {
  border-bottom-color: var(--border, #e0e0e0);
}
.ve-hero-area .vocab-expander-row:nth-child(even) {
  background: rgba(0,0,0,0.02);
}
.ve-hero-area .vocab-expander-row:hover {
  background: rgba(93,76,154,0.04);
}
.ve-hero-area .vocab-expander-row:nth-child(even):hover {
  background: rgba(93,76,154,0.06);
}
/* Input fields - clean bordered cells */
.ve-hero-area .ve-sentence-wrapper .ve-rich-input,
.ve-hero-area .vocab-expander-row .ve-rich-input {
  color: var(--text-primary, #000) !important;
  background: var(--bg-primary, #fff) !important;
  border: 1px solid var(--border, #ddd) !important;
  border-radius: 4px !important;
  box-shadow: none !important;
}
.ve-hero-area .ve-sentence-wrapper .ve-rich-input:hover,
.ve-hero-area .vocab-expander-row .ve-rich-input:hover {
  background: var(--bg-primary, #fff) !important;
  border-color: var(--text-light, rgba(0,0,0,0.2)) !important;
}
.ve-hero-area .ve-sentence-wrapper .ve-rich-input:focus,
.ve-hero-area .vocab-expander-row .ve-rich-input:focus {
  background: var(--bg-primary, #fff) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(93,76,154,0.2) !important;
}
/* ::before placeholder hidden in hero-area — rich-placeholder overlay handles it */
.ve-hero-area .ve-rich-input:empty:not(:focus):before {
  color: transparent !important;
  opacity: 0 !important;
}
.ve-hero-area .vocab-expander-row .vocab-expander-input {
  color: var(--text-primary, #000) !important;
  background: var(--bg-primary, #fff) !important;
  border: 1px solid var(--border, rgba(0,0,0,0.12)) !important;
  border-radius: 4px !important;
}
.ve-hero-area .vocab-expander-row .vocab-expander-input:hover {
  background: var(--bg-primary, #fff) !important;
  border-color: var(--text-light, rgba(0,0,0,0.2)) !important;
}
.ve-hero-area .vocab-expander-row .vocab-expander-input:focus {
  background: var(--bg-primary, #fff) !important;
  border-color: var(--primary) !important;
}
.ve-hero-area .vocab-expander-input::placeholder {
  color: var(--primary, #5D4C9A) !important;
  opacity: 0.5 !important;
}
.ve-hero-area .rich-placeholder {
  color: var(--primary, #5D4C9A);
  opacity: 0.45;
}
/* Bold highlighted words - purple on white */
.ve-hero-area .ve-rich-input b,
.ve-hero-area .ve-rich-input strong {
  color: var(--primary, #4a3d7a) !important;
  background: rgba(93, 76, 154, 0.12) !important;
  padding: 0 3px;
  border-radius: 3px;
}
/* Bold button - visible on input */
.ve-hero-area .ve-sentence-wrapper .ve-bold-btn {
  background: rgba(93, 76, 154, 0.15) !important;
  color: var(--primary, #4a3d7a) !important;
  border: none;
}
.ve-hero-area .ve-sentence-wrapper .ve-bold-btn:hover {
  background: rgba(93, 76, 154, 0.3) !important;
  color: var(--primary-light, #3a2d6a) !important;
}
[data-theme="dark"] .ve-hero-area .ve-rich-input b,
[data-theme="dark"] .ve-hero-area .ve-rich-input strong {
  color: var(--primary-light, #A89ED8) !important;
  background: rgba(139, 126, 240, 0.15) !important;
}
[data-theme="dark"] .ve-hero-area .ve-sentence-wrapper .ve-bold-btn {
  background: rgba(139, 126, 240, 0.2) !important;
  color: var(--primary-light, #A89ED8) !important;
}
[data-theme="dark"] .ve-hero-area .ve-sentence-wrapper .ve-bold-btn:hover {
  background: rgba(139, 126, 240, 0.35) !important;
}
/* Translate button */
.ve-hero-area .ve-translate-btn {
  border-color: var(--border, #ddd);
  color: var(--text-primary, #333);
}
.ve-hero-area .ve-translate-btn:hover:not(:disabled) {
  background: var(--bg-secondary, #f5f5f5);
  border-color: var(--primary, #5D4C9A);
}
/* Remove row button */
.ve-hero-area .btn-remove-row {
  color: var(--text-secondary, #999);
}
.ve-hero-area .btn-remove-row:hover {
  color: white;
  background: rgba(239, 68, 68, 0.8);
}
.ve-hero-area .vocab-expander-actions {
  margin-bottom: 0;
}

/* Hero area stars — hidden on white background */
.ve-hero-star,
.ve-hero-star-svg {
  display: none;
}
.ve-hs-1  { top: 8%; left: 3%; color: rgba(255,255,255,0.5); font-size: 1.3rem; animation: qsTwinkle 3s ease-in-out infinite; }
.ve-hs-2  { top: 12%; right: 5%; color: rgba(200,180,255,0.45); font-size: 1rem; animation: qsDrift 5s ease-in-out infinite 0.5s; }
.ve-hs-3  { bottom: 15%; left: 6%; color: rgba(255,255,255,0.4); font-size: 1.5rem; animation: qsPulse 4s ease-in-out infinite 1s; }
.ve-hs-4  { top: 45%; left: 1%; color: rgba(200,180,255,0.35); font-size: 0.85rem; animation: qsSpin 7s linear infinite; }
.ve-hs-5  { bottom: 25%; right: 3%; color: rgba(255,255,255,0.3); font-size: 1.2rem; font-weight: 300; animation: qsSpin 9s linear infinite 2s; }
.ve-hs-6  { top: 70%; left: 2%; color: rgba(200,180,255,0.45); font-size: 0.9rem; animation: qsTwinkle 3.5s ease-in-out infinite 1.5s; }
.ve-hs-7  { top: 30%; right: 2%; color: rgba(255,255,255,0.5); font-size: 1.8rem; animation: qsPulse 5s ease-in-out infinite 0.3s; }
.ve-hs-8  { bottom: 10%; right: 15%; color: rgba(200,180,255,0.4); font-size: 0.8rem; animation: qsDrift 6s ease-in-out infinite 1s; }
.ve-hs-9  { bottom: 50%; left: 15%; color: rgba(255,255,255,0.3); font-size: 1.1rem; animation: qsTwinkle 4s ease-in-out infinite 2s; }
.ve-hs-10 { top: 5%; left: 40%; color: rgba(200,180,255,0.35); font-size: 0.75rem; animation: qsPulse 3s ease-in-out infinite 0.8s; }
.ve-hsvg-1 { top: 15%; right: 8%; width: 16px; height: 16px; color: rgba(255,255,255,0.3); animation: qsDrift 7s ease-in-out infinite 0.5s; }
.ve-hsvg-2 { bottom: 20%; left: 10%; width: 12px; height: 12px; color: rgba(200,180,255,0.35); animation: qsSpin 10s linear infinite 1s; }

/* Hide stars on small screens */
@media (max-width: 480px) {
  .ve-hero-star, .ve-hero-star-svg { display: none; }
}

/* Quick Action Buttons (Challenge / Live Session) */
.quick-actions-row {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.quick-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(93, 76, 154, 0.2);
  -webkit-tap-highlight-color: transparent;
}

.quick-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(93, 76, 154, 0.35);
}

.quick-action-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(93, 76, 154, 0.2);
}

.quick-action-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.quick-action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.quick-action-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-align: center;
  max-width: 200px;
  margin: 0;
  line-height: 1.3;
}

/* Modal overlay (shared across pages) */
.pdf-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.pdf-modal-overlay.active {
  display: flex;
}
.pdf-modal {
  background: var(--card-bg, #fff);
  border-radius: var(--radius, 8px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.pdf-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border, #e0e0e0);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pdf-modal-header h3 { margin: 0; font-size: 1.125rem; }
.pdf-modal-body { padding: 1.5rem; }
.pdf-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border, #e0e0e0);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.pdf-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  line-height: 1;
}

.vocab-expander-ai-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* AI Panel */
.vocab-expander-ai-panel {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.vocab-expander-ai-section {
  margin-bottom: 1rem;
}

.vocab-expander-ai-section:last-child {
  margin-bottom: 0;
}

.vocab-expander-ai-section label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.vocab-expander-ai-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.vocab-expander-ai-input-row .vocab-expander-input {
  flex: 1;
  min-width: 200px;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text-primary);
}

.vocab-expander-select-small {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text-primary);
  width: 70px;
}

/* AI Dropzone */
.vocab-expander-ai-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
}

.vocab-expander-ai-dropzone:hover,
.vocab-expander-ai-dropzone.dragover {
  border-color: var(--primary);
  background: rgba(93, 76, 154, 0.05);
}

.vocab-expander-ai-dropzone span:first-child {
  font-size: 1.5rem;
}

/* Suggestions Section */
.vocab-expander-suggestions {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.vocab-expander-suggestions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.vocab-expander-suggestions-header h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.vocab-expander-suggestions-count {
  color: var(--text-secondary);
  font-weight: normal;
}

.vocab-expander-suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
}

.vocab-expander-suggestion-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
}

.vocab-expander-suggestion-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.vocab-expander-suggestion-word {
  font-weight: 600;
  color: var(--primary);
}

.vocab-expander-suggestion-arrow {
  color: var(--text-light);
}

.vocab-expander-suggestion-translation {
  color: var(--text-primary);
}

.vocab-expander-suggestion-meta {
  font-size: 0.8rem;
  color: var(--text-light);
}

.vocab-expander-suggestion-actions {
  display: flex;
  gap: 0.25rem;
}

.vocab-expander-suggestion-actions .btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
}

.vocab-expander-empty {
  color: var(--text-secondary);
  font-style: italic;
  text-align: center;
  padding: 1rem;
  margin: 0;
}

/* Suggestions header mobile fix */
@media (max-width: 768px) {
  .vocab-expander-suggestions-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}


/* Auto-Sentence Suggestion Popup */
/* Auto-sentence suggestion popup */
.auto-sentence-popup {
  background: var(--card-bg, #fff);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(108, 92, 231, 0.18), 0 0 0 1px rgba(108, 92, 231, 0.12);
  padding: 0.5rem 0.6rem;
  z-index: 10000;
  animation: aspIn 0.15s ease-out;
  max-width: 500px;
}
.auto-sentence-popup::after {
  content: '';
  position: absolute;
  left: 1.5rem;
  bottom: -5px;
  width: 10px;
  height: 10px;
  background: var(--card-bg, #fff);
  box-shadow: 2px 2px 4px rgba(108, 92, 231, 0.08);
  transform: rotate(45deg);
}
@keyframes aspIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Loading spinner */
.asp-content { display: flex; flex-direction: column; gap: 0.3rem; }
.asp-content > .asp-spinner { margin: 0.3rem auto; }
.asp-spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border, #e0e0e0);
  border-top-color: var(--primary, #6C5CE7);
  border-radius: 50%;
  animation: aspSpin 0.6s linear infinite;
  display: inline-block;
}
@keyframes aspSpin { to { transform: rotate(360deg); } }

/* Word translation suggestion */
.asp-word-row {
  display: flex; align-items: center; gap: 0.35rem;
  font-size: 0.8rem; padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--border, #eee);
  margin-bottom: 0.15rem;
}
.asp-label {
  font-size: 0.6rem; font-weight: 600; letter-spacing: 0.04em;
  color: var(--text-muted, #999); text-transform: uppercase;
}
.asp-word-row strong { color: var(--primary, #6C5CE7); font-size: 0.82rem; }

/* Sentences */
.asp-sent, .asp-trans {
  font-size: 0.78rem; line-height: 1.35; color: var(--text-primary);
}
.asp-sent b, .asp-trans b { color: var(--primary, #6C5CE7); font-weight: 600; }
.asp-trans { color: var(--text-secondary); font-size: 0.72rem; }

/* Clickable meaning options */
.asp-option {
  cursor: pointer; padding: 0.3rem 0.4rem; border-radius: 6px;
  transition: background 0.12s ease;
}
.asp-option:hover { background: rgba(108, 92, 231, 0.06); }
.asp-from-db {
  background: rgba(17, 184, 160, 0.08);
  border-left: 3px solid #11B8A0;
  padding-left: 0.5rem;
}
.asp-from-db:hover { background: rgba(17, 184, 160, 0.12); }
.asp-db-badge {
  font-size: 0.75rem;
  color: #11B8A0;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.asp-multi { border-left: 2px solid transparent; padding-left: 0.5rem; }
.asp-multi:hover { border-left-color: var(--primary, #6C5CE7); }
.asp-divider { height: 1px; background: var(--border, #eee); margin: 0.15rem 0; }
.asp-meaning { display: flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; margin-bottom: 0.1rem; }
.asp-meaning strong { color: var(--primary, #6C5CE7); font-size: 0.82rem; }

/* Action buttons bar */
.asp-bar {
  display: flex; gap: 0.25rem; justify-content: center;
  padding-top: 0.3rem; margin-top: 0.15rem;
  border-top: 1px solid var(--border, #eee);
}
.asp-act {
  width: 24px; height: 24px; border-radius: 5px;
  border: 1px solid var(--border, #ddd); background: var(--bg-secondary, #f8f8f8);
  cursor: pointer; font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.12s ease; color: var(--text-secondary);
}
.asp-act:hover { transform: scale(1.1); }
.asp-yes { background: #10b981; color: #fff; border-color: #10b981; }
.asp-yes:hover { background: #059669; }
.asp-redo { color: var(--primary, #6C5CE7); }
.asp-redo:hover { background: var(--primary, #6C5CE7); color: #fff; border-color: var(--primary); }
.asp-no:hover { background: #ef4444; color: #fff; border-color: #ef4444; }

/* Global Dashboard Class Selector */
.dashboard-class-selector {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.dashboard-class-selector label {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.dashboard-class-selector select {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
  min-width: 150px;
}

.dashboard-class-selector select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(93, 76, 154, 0.25);
}

.dashboard-deck-info {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Button variants */
.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-size: inherit;
}

.btn-link:hover {
  color: var(--primary-dark);
}

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

.btn-success:hover {
  background: var(--success-dark);
  border-color: var(--success-dark);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-dark);
  border-color: var(--danger-dark);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .vocab-expander-header {
    padding: 0.75rem 1rem;
  }

  .vocab-expander-content {
    padding: 0 1rem 1rem;
  }

  .vocab-expander-class-selector {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .vocab-expander-select {
    width: 100%;
  }

  .vocab-expander-context-col,
  .vocab-expander-btn-col {
    display: none;
  }

  .vocab-expander-actions {
    flex-direction: column;
  }

  .vocab-expander-actions .btn {
    width: 100%;
  }

  .vocab-expander-ai-input-row {
    flex-direction: column;
  }

  .vocab-expander-ai-input-row .vocab-expander-input {
    width: 100%;
    min-width: auto;
  }
}

/* =================================
   RTL (Right-to-Left) Support
   For Arabic and other RTL languages
   ================================= */

[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

/* Card and form elements */
[dir="rtl"] .card,
[dir="rtl"] .dashboard-card {
  text-align: right;
}

[dir="rtl"] .form-group {
  text-align: right;
}

[dir="rtl"] .form-group label {
  text-align: right;
}

/* Tables */
[dir="rtl"] table th,
[dir="rtl"] table td {
  text-align: right;
}

[dir="rtl"] table th:first-child,
[dir="rtl"] table td:first-child {
  text-align: right;
}

/* Buttons and icons */
[dir="rtl"] .btn-icon-left {
  margin-right: 0;
  margin-left: 0.5rem;
}

[dir="rtl"] .btn-icon-right {
  margin-left: 0;
  margin-right: 0.5rem;
}

/* Navigation */
[dir="rtl"] .nav-link {
  text-align: right;
}

[dir="rtl"] .nav-link svg,
[dir="rtl"] .nav-link .nav-icon {
  margin-right: 0;
  margin-left: 0.75rem;
}

/* Lists */
[dir="rtl"] ul,
[dir="rtl"] ol {
  padding-left: 0;
  padding-right: 1.5rem;
}

/* Modals */
[dir="rtl"] .modal-header {
  text-align: right;
}

[dir="rtl"] .modal-close {
  left: 1rem;
  right: auto;
}

/* Arrows and direction indicators */
[dir="rtl"] .arrow,
[dir="rtl"] .language-arrow {
  transform: scaleX(-1);
}

/* Form row with arrows */
[dir="rtl"] .language-row {
  flex-direction: row-reverse;
}

/* Card display - swap front/back visual direction */
[dir="rtl"] .flashcard-front,
[dir="rtl"] .flashcard-back {
  text-align: right;
}

/* Quick add popup */
[dir="rtl"] .quick-add-modal {
  text-align: right;
}

[dir="rtl"] .quick-add-header {
  flex-direction: row-reverse;
}

/* Vocab expander */
[dir="rtl"] .vocab-expander-modal {
  text-align: right;
}

/* Dropdown menus */
[dir="rtl"] .dropdown-menu {
  left: 0;
  right: auto;
}

[dir="rtl"] .language-dropdown {
  left: 0;
  right: auto;
}

/* Progress bars */
[dir="rtl"] .progress-bar {
  direction: rtl;
}

[dir="rtl"] .progress-fill {
  float: right;
}

/* Statistics and metrics */
[dir="rtl"] .stat-icon {
  margin-right: 0;
  margin-left: 0.5rem;
}

/* Badges */
[dir="rtl"] .badge {
  margin-left: 0;
  margin-right: 0.25rem;
}

/* Input groups */
[dir="rtl"] .input-group {
  flex-direction: row-reverse;
}

[dir="rtl"] .input-group-prepend {
  border-radius: 0 var(--radius) var(--radius) 0;
  border-left: 1px solid var(--border);
  border-right: none;
}

[dir="rtl"] .input-group-append {
  border-radius: var(--radius) 0 0 var(--radius);
  border-right: 1px solid var(--border);
  border-left: none;
}

/* Checkbox and radio alignment */
[dir="rtl"] input[type="checkbox"],
[dir="rtl"] input[type="radio"] {
  margin-right: 0;
  margin-left: 0.5rem;
}

/* Create First Class Banner */
.create-class-banner {
  background: linear-gradient(135deg, var(--warning) 0%, #d9733b 100%);
  color: #1a1a1a;
  padding: 1.5rem 2rem;
}

.create-class-banner-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.create-class-banner-text {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.create-class-banner-icon {
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.create-class-banner-text h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.create-class-banner-text p {
  margin: 0;
  opacity: 0.9;
  font-size: 0.95rem;
  line-height: 1.4;
}

.create-class-banner-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.create-class-form-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.create-class-input,
.create-class-select {
  padding: 0.6rem 1rem;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  color: #1a1a1a;
  font-size: 0.95rem;
  min-width: 150px;
}

.create-class-input::placeholder {
  color: rgba(0, 0, 0, 0.5);
}

.create-class-select {
  cursor: pointer;
}

.create-class-select option {
  background: var(--warning);
  color: white;
}

.create-class-input:focus,
.create-class-select:focus {
  outline: none;
  border-color: #1a1a1a;
  background: white;
}

.create-class-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: white;
  color: var(--warning);
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.create-class-btn:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
}

.create-class-more-options {
  color: rgba(0, 0, 0, 0.7);
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  align-self: flex-start;
}

.create-class-more-options:hover {
  color: #1a1a1a;
}

/* Mobile responsive for create class banner */
@media (max-width: 768px) {
  .create-class-banner {
    padding: 1.25rem 1rem;
  }

  .create-class-banner-text {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .create-class-form-fields {
    flex-direction: column;
    width: 100%;
  }

  .create-class-input,
  .create-class-select,
  .create-class-btn {
    width: 100%;
  }

  .create-class-more-options {
    align-self: center;
  }
}

/* Dark mode support for create class banner */
[data-theme="dark"] .create-class-banner {
  background: linear-gradient(135deg, var(--warning) 0%, #c45a1e 100%);
}

[data-theme="dark"] .create-class-input,
[data-theme="dark"] .create-class-select {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.25);
}

[data-theme="dark"] .create-class-input:focus,
[data-theme="dark"] .create-class-select:focus {
  background: rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .create-class-select option {
  background: var(--badge-warning-text);
}

/* ===== Score History Dots ===== */
.score-history-container {
  display: flex;
  justify-content: center;
  margin: 0.5rem 0;
}

.score-history {
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
  flex-wrap: wrap;
}

.score-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  transition: transform 0.15s ease;
  cursor: default;
}

.score-dot:hover {
  transform: scale(1.25);
}

.score-again {
  background-color: var(--color-danger);
}

.score-hard {
  background-color: var(--text-light);
}

.score-good {
  background-color: var(--success);
}

.score-easy {
  background-color: var(--primary-light);
}

/* Dark mode adjustments */
[data-theme="dark"] .score-again {
  background-color: var(--danger);
}

[data-theme="dark"] .score-hard {
  background-color: var(--text-secondary);
}

[data-theme="dark"] .score-good {
  background-color: var(--success-dark);
}

[data-theme="dark"] .score-easy {
  background-color: var(--primary-light);
}

/* Responsive: slightly smaller dots on mobile */
@media (max-width: 768px) {
  .score-dot {
    width: 1.1rem;
    height: 1.1rem;
    font-size: 0.6rem;
  }
  .score-history {
    gap: 0.2rem;
  }
}

/* Score History Wrapper with Direction Arrow */
.score-history-wrapper {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.score-history-direction {
  font-size: 0.6rem;
  color: var(--text-light);
  letter-spacing: 0.5px;
  cursor: help;
  user-select: none;
}

.score-history-direction::before {
  content: '';
}

/* Clickable "+N more" badge */
.score-history-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  margin-left: 0.25rem;
  background-color: var(--primary-light);
  color: #fff;
  border-radius: 0.625rem;
  font-size: 0.6rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.score-history-more:hover {
  background-color: var(--primary);
  transform: scale(1.1);
}

[data-theme="dark"] .score-history-more {
  background-color: var(--primary);
}

[data-theme="dark"] .score-history-more:hover {
  background-color: var(--primary-light);
}

/* Full History Modal */
.full-history-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.full-history-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.full-history-modal {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 90vw;
  max-height: 80vh;
  width: 500px;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.full-history-modal-overlay.active .full-history-modal {
  transform: scale(1);
}

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

.full-history-modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.full-history-modal-subtitle {
  margin: 0.25rem 0 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.full-history-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  margin-left: 1rem;
}

.full-history-modal-close:hover {
  color: var(--text-primary);
}

.full-history-modal-body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.full-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.full-history-table th,
.full-history-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.full-history-table th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.full-history-table .score-dot {
  width: 1.1rem;
  height: 1.1rem;
  font-size: 0.6rem;
}

.full-history-modal-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.full-history-loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .full-history-modal {
    width: 95vw;
    max-height: 90vh;
  }

  .full-history-table th,
  .full-history-table td {
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
  }
}

/* ===== Mastery Progress Bar ===== */
.mastery-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--border);
  min-width: 80px;
}

.mastery-mastered {
  background: var(--success);
  transition: width 0.3s ease;
}

.mastery-learning {
  background: var(--warning);
  transition: width 0.3s ease;
}

.mastery-struggling {
  background: var(--color-danger);
  transition: width 0.3s ease;
}

[data-theme="dark"] .mastery-mastered {
  background: var(--success-dark);
}

[data-theme="dark"] .mastery-learning {
  background: var(--warning);
}

[data-theme="dark"] .mastery-struggling {
  background: var(--danger);
}

/* ===== Inline Rich Edit (Bold Button) for Vocabulary Table ===== */
.inline-edit-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.inline-edit-wrapper .inline-rich-edit {
  flex: 1;
  min-height: 1.5em;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card-bg);
  font-size: 0.85rem;
  outline: none;
}

.inline-edit-wrapper .inline-rich-edit:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(93, 76, 154, 0.2);
}

.inline-edit-wrapper .inline-rich-edit:empty::before {
  content: attr(data-placeholder);
  color: var(--text-secondary);
}

.inline-edit-wrapper .inline-rich-edit[contenteditable="false"] {
  background: var(--bg-secondary);
  cursor: default;
}

.inline-bold-btn {
  padding: 2px 6px;
  font-size: 0.75rem;
  font-weight: bold;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.inline-bold-btn:hover {
  opacity: 1;
  background: var(--border);
}

/* Suggestion Edit Modal Wrapper */
.edit-sentence-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.edit-sentence-wrapper .edit-rich-input {
  flex: 1;
  min-height: 1.5em;
  outline: none;
}

.edit-sentence-wrapper .edit-rich-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(93, 76, 154, 0.2);
}

.edit-bold-btn {
  padding: 4px 8px;
  font-size: 0.8rem;
  font-weight: bold;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.7;
}

.edit-bold-btn:hover {
  opacity: 1;
  background: var(--border);
}

/* ============================================
   MOBILE UI FIXES (February 2026)
   Comprehensive fixes for mobile responsiveness
   ============================================ */

/* Fix content cutoff - ensure viewport constraints */
@media (max-width: 768px) {
  /* Prevent horizontal overflow at root level */
  html, body {
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* All main containers must respect viewport */
  .app-layout,
  .main-content,
  .dashboard,
  .page-container,
  .container {
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  /* Cards and sections should not overflow */
  .card,
  .section,
  .deck-card,
  .stats-row,
  .achievement-card {
    max-width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
  }

  /* Fix modals that cause viewport overflow */
  .modal-content,
  .card-full {
    max-width: calc(100vw - 2rem);
    margin-left: 1rem;
    margin-right: 1rem;
  }

  /* Username in topbar - truncate long names */
  .navbar .nav-content .user-name,
  .navbar .nav-right .user-info,
  .auth-user-name,
  .topbar .user-name {
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Mobile tables - horizontal scroll wrapper */
@media (max-width: 768px) {
  /* Make all tables scrollable horizontally with scroll indicators */
  .table-responsive,
  .data-table-wrapper,
  .students-table-container,
  .vocab-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    background:
      linear-gradient(to right, var(--card-bg, white) 30%, transparent),
      linear-gradient(to left, var(--card-bg, white) 30%, transparent),
      linear-gradient(to right, rgba(0,0,0,0.15), transparent),
      linear-gradient(to left, rgba(0,0,0,0.15), transparent);
    background-position: left center, right center, left center, right center;
    background-repeat: no-repeat;
    background-size: 20px 100%, 20px 100%, 10px 100%, 10px 100%;
    background-attachment: local, local, scroll, scroll;
  }

  /* Table minimum width to enable scroll */
  .data-table {
    min-width: 500px;
  }

  /* Sticky first column on mobile */
  .data-table th:first-child,
  .data-table td:first-child {
    position: sticky;
    left: 0;
    background: inherit;
    z-index: 1;
  }

  /* German column cut off fix - vocabulary tables */
  .vocab-table td:last-child,
  .vocab-table th:last-child {
    min-width: 120px;
    padding-right: 1rem;
  }
}

/* FAB positioning fix - prevent overlap with bottom nav labels */
@media (max-width: 768px) {
  .fab {
    /* Move FAB higher to avoid overlapping nav labels */
    bottom: calc(var(--bottom-nav-height, 3.5rem) + 1.5rem);
    right: 1rem;
    /* Smaller on mobile */
    width: 3rem;
    height: 3rem;
    font-size: 1.25rem;
    z-index: 999;
  }
}

@media (max-width: 480px) {
  .fab {
    /* Even higher on very small screens */
    bottom: calc(var(--bottom-nav-height, 3.5rem) + 1rem);
    right: 0.75rem;
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.1rem;
  }
}

/* Bottom nav label fix - prevent text cutoff */
@media (max-width: 768px) {
  .bottom-nav {
    padding: 0 0.25rem;
  }

  .bottom-nav a {
    min-width: auto;
    flex: 1;
    padding: 0.4rem 0.25rem;
    font-size: 0.6rem;
  }

  .bottom-nav a span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .bottom-nav a svg {
    width: 1.1rem;
    height: 1.1rem;
  }
}

@media (max-width: 380px) {
  .bottom-nav a {
    font-size: 0.55rem;
    padding: 0.35rem 0.15rem;
  }

  .bottom-nav a svg {
    width: 1rem;
    height: 1rem;
  }
}

/* Achievement stats row - horizontal scroll */
@media (max-width: 768px) {
  .achievement-stats,
  .stats-row,
  .progress-stats,
  .deck-stats {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.75rem;
    padding-bottom: 0.5rem;
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .achievement-stats > *,
  .stats-row > *,
  .progress-stats > *,
  .deck-stats > * {
    flex-shrink: 0;
    min-width: 80px;
  }

  /* Hide scrollbar but keep functionality */
  .achievement-stats::-webkit-scrollbar,
  .stats-row::-webkit-scrollbar,
  .progress-stats::-webkit-scrollbar,
  .deck-stats::-webkit-scrollbar {
    display: none;
  }

  .achievement-stats,
  .stats-row,
  .progress-stats,
  .deck-stats {
    scrollbar-width: none;
  }
}

/* Forms on mobile - prevent cutoff */
@media (max-width: 768px) {
  .form-group,
  .input-group,
  .modal-body form {
    max-width: 100%;
    overflow: visible;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  select,
  textarea {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Modal forms */
  .modal-body {
    overflow-x: hidden;
    max-width: 100%;
  }
}

/* Teacher classes page - form and table fix */
@media (max-width: 768px) {
  .class-form-container,
  .student-form-container {
    width: 100%;
    max-width: 100%;
    padding: 0 1rem;
    box-sizing: border-box;
  }

  /* Classes table responsive wrapper */
  .classes-table-wrapper,
  .students-list-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Table header text should not wrap */
  .data-table th {
    white-space: nowrap;
  }
}

/* Teacher learning progress - table and date fix */
@media (max-width: 768px) {
  .learning-progress-table {
    min-width: 600px;
  }

  .learning-progress-table th,
  .learning-progress-table td {
    padding: 0.5rem 0.4rem;
    font-size: 0.75rem;
  }

  /* Week column */
  .learning-progress-table td:first-child {
    min-width: 90px;
    white-space: nowrap;
  }
}

/* Vocab expander on mobile - card layout instead of table */
@media (max-width: 768px) {
  .ve-hero-area {
    overflow: hidden;
    padding: 1rem;
    margin: 0 0 1rem;
  }

  .vocab-expander-table-container {
    overflow-x: visible;
    margin: 0;
    padding: 0;
  }

  /* Convert table to block layout */
  .vocab-expander-table,
  .vocab-expander-table thead,
  .vocab-expander-table tbody {
    display: block;
    width: 100%;
    min-width: unset;
  }

  /* Hide header on mobile */
  .vocab-expander-table thead {
    display: none;
  }

  /* Each row becomes a card */
  .vocab-expander-row {
    display: flex !important;
    flex-wrap: wrap;
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
    position: relative;
  }

  /* All cells become block */
  .vocab-expander-row td {
    display: block;
    padding: 0;
    border: none;
  }

  /* Class dropdown - inline at top left on mobile */
  .vocab-expander-row .ve-class-dropdown-col {
    flex: 1;
    min-width: 0;
  }

  /* Delete button - top right */
  .vocab-expander-row .vocab-expander-actions-col {
    order: 1;
    width: auto !important;
    min-width: auto !important;
    max-width: auto !important;
  }

  /* Hide translate button on mobile */
  .vocab-expander-row .ve-translate-col {
    display: none !important;
  }

  /* Sentence columns - full width, stacked */
  .vocab-expander-row .ve-sentence-col {
    order: 2;
    width: 100% !important;
    min-width: unset !important;
    max-width: unset !important;
  }

  /* Add labels above sentence inputs — use child class selectors instead of nth-of-type */
  .vocab-expander-row .ve-sentence-col:has(.ve-sentence-source)::before {
    content: 'Front';
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
  }

  .vocab-expander-row .ve-sentence-col:has(.ve-sentence-target) {
    order: 3;
  }

  .vocab-expander-row .ve-sentence-col:has(.ve-sentence-target)::before {
    content: 'Back';
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
  }

  /* Sentence input wrapper - full width */
  .vocab-expander-row .ve-sentence-wrapper {
    width: 100%;
  }

  /* Input styling */
  .vocab-expander-row .ve-rich-input {
    min-height: 2.5rem;
  }

  /* B button proper size */
  .vocab-expander-row .ve-bold-btn {
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
}

/* Fix grid layouts that break on mobile */
@media (max-width: 768px) {
  .grid-2-col,
  .grid-3-col,
  .grid-4-col,
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns: repeat(4"] {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  /* 2-column grids can stay as 2 cols */
  .grid-2-col,
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: repeat(2"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Student achievements page specific fixes */
@media (max-width: 768px) {
  .achievements-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  .achievement-card {
    padding: 1rem;
  }

  .achievement-card .achievement-icon {
    font-size: 2rem;
  }

  /* Unlocked achievements count row */
  .achievements-summary {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 1rem;
    padding: 0.5rem 0;
  }

  .achievements-summary > * {
    flex-shrink: 0;
  }
}

/* Progress report page fixes */
@media (max-width: 768px) {
  .progress-chart-container {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .week-grid,
  .month-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .week-grid > *,
  .month-grid > * {
    flex-shrink: 0;
  }
}

/* ============================================
   MOBILE CARD LAYOUTS - Replace horizontal scroll
   ============================================ */

/* Vocabulary table - card layout on mobile */
@media (max-width: 768px) {
  /* Hide table header on mobile */
  .vocab-list-table thead,
  .deck-vocabulary-table thead {
    display: none;
  }

  /* Convert table rows to cards */
  .vocab-list-table tbody,
  .deck-vocabulary-table tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .vocab-list-table tbody tr,
  .deck-vocabulary-table tbody tr {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .vocab-list-table tbody td,
  .deck-vocabulary-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.25rem 0;
    border: none;
    font-size: 0.9rem;
  }

  .vocab-list-table tbody td::before,
  .deck-vocabulary-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    min-width: 60px;
  }

  /* Remove min-width from tables on mobile */
  .vocab-list-table,
  .deck-vocabulary-table,
  .data-table {
    min-width: unset !important;
  }
}

/* Student list - stack buttons vertically */
@media (max-width: 768px) {
  .student-actions,
  .student-row .actions,
  td .btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .student-actions .btn,
  .student-row .actions .btn,
  td .btn-group .btn {
    width: 100%;
    justify-content: center;
    font-size: 0.8rem;
    padding: 0.5rem;
    white-space: nowrap;
  }

  /* Student list as cards */
  .students-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    align-items: center;
  }

  .students-table tbody td {
    border: none;
    padding: 0;
  }

  .students-table tbody td:first-child {
    flex: 1;
    min-width: 120px;
    font-weight: 600;
  }

  .students-table tbody td:nth-child(2) {
    flex: 1;
    min-width: 120px;
    color: var(--text-secondary);
    font-size: 0.85rem;
  }

  .students-table tbody td:last-child {
    width: 100%;
    margin-top: 0.5rem;
  }
}

/* Learning progress - card layout on mobile */
@media (max-width: 768px) {
  .weekly-summary-table thead {
    display: none;
  }

  .weekly-summary-table tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .weekly-summary-table tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
  }

  .weekly-summary-table tbody td {
    display: flex;
    flex-direction: column;
    padding: 0.25rem;
    border: none;
    font-size: 0.85rem;
  }

  .weekly-summary-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
  }

  /* First column (student name) spans full width */
  .weekly-summary-table tbody td:first-child {
    grid-column: 1 / -1;
    font-weight: 600;
    font-size: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.25rem;
  }
}

/* Classes list - cleaner edit icons */
@media (max-width: 768px) {
  .class-edit-btn,
  .edit-icon-btn,
  .btn-icon-only {
    border-width: 1px !important;
    padding: 0.4rem !important;
  }

  .class-edit-btn svg,
  .edit-icon-btn svg,
  .btn-icon-only svg {
    width: 16px;
    height: 16px;
  }
}

/* Fix class card edit icons - thinner border */
.class-card .edit-btn,
.class-item .edit-btn,
[class*="edit"] .btn-icon {
  border-width: 1px;
}

/* Class list icons - thinner borders on mobile */
@media (max-width: 768px) {
  /* Language pair badges - cleaner look */
  .language-pair-badge {
    border: none !important;
    background: var(--badge-info-bg) !important;
    padding: 0.2rem 0.4rem !important;
    font-size: 0.8rem !important;
  }

  /* Class edit button - minimal style */
  .class-name-edit-btn {
    border: none !important;
    background: transparent !important;
    padding: 0.2rem !important;
    opacity: 0.6;
  }

  .class-name-edit-btn:hover {
    opacity: 1;
  }

  /* Any card icons - thinner borders */
  .card-icon,
  .class-icon,
  .deck-icon,
  [class*="-icon"] img,
  [class*="-icon"] svg {
    border-width: 1px !important;
  }

  /* Card thumbnails/icons in lists */
  .data-table .icon-cell img,
  .data-table .icon-cell svg,
  .class-list .icon,
  .deck-list .icon {
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm);
  }
}

/* Practice UI - more visible back button */
@media (max-width: 768px) {
  .practice-header {
    padding: 0.5rem;
  }

  .practice-header .btn-back,
  .practice-header .back-btn,
  .practice-header-left a {
    background: var(--card-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: var(--radius) !important;
    font-weight: 500 !important;
    font-size: 0.85rem !important;
    box-shadow: var(--shadow-sm);
  }

  .practice-header .btn-back:hover,
  .practice-header .back-btn:hover,
  .practice-header-left a:hover {
    background: var(--bg-secondary) !important;
  }

  /* Theme switcher in practice mode */
  .practice-header .theme-dropdown-container,
  .practice-header .theme-switcher {
    display: flex !important;
  }
}

/* General table improvements for mobile */
@media (max-width: 768px) {
  /* Prevent any table from requiring horizontal scroll */
  table {
    width: 100%;
    table-layout: auto;
  }

  /* Allow text to wrap in table cells */
  td, th {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
}

/* Mobile card layout for dashboard tables */
@media (max-width: 768px) {
  /* Remove fixed min-widths that cause horizontal scroll */
  .data-table,
  .learning-progress-table {
    min-width: unset !important;
  }

  /* Lazy students table - convert to card layout */
  #lazyStudentsContainer .data-table {
    border-collapse: collapse;
  }

  #lazyStudentsContainer .data-table thead {
    display: none;
  }

  #lazyStudentsContainer .data-table tbody tr {
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    background: var(--card-bg);
    gap: 0.25rem;
  }

  #lazyStudentsContainer .data-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border: none;
  }

  #lazyStudentsContainer .data-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
  }

  /* Recent cards table - convert to card layout */
  #recentCardsContainer .data-table thead {
    display: none;
  }

  #recentCardsContainer .data-table tbody tr {
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    background: var(--card-bg);
    gap: 0.25rem;
  }

  #recentCardsContainer .data-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border: none;
  }

  #recentCardsContainer .data-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
  }

  /* Student progress deck table */
  .student-progress-table thead {
    display: none;
  }

  .student-progress-table tbody tr {
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    background: var(--card-bg);
    gap: 0.25rem;
  }

  .student-progress-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border: none;
  }

  .student-progress-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
  }

  /* Deck library table on mobile */
  .deck-library-table thead {
    display: none;
  }

  .deck-library-table tbody tr {
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    background: var(--card-bg);
    gap: 0.25rem;
  }

  .deck-library-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border: none;
  }

  .deck-library-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
  }
}

/* Mobile portrait fix - force practice buttons to always be visible */
@media screen and (max-width: 768px) and (orientation: portrait) {
  html.practice-mode, body.practice-mode,
  .practice-viewport ~ html, .practice-viewport ~ body {
    height: 100% !important;
    overflow: hidden !important;
  }
  .practice-viewport {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: 100% !important;
    height: 100dvh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  .practice-header {
    flex-shrink: 0 !important;
    padding: 0.25rem 0.5rem !important;
  }
  #progressBarContainer {
    flex-shrink: 0 !important;
  }
  #motivationalMessage {
    display: none !important;
  }
  .practice-card-container {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 0.25rem !important;
  }
  .practice-card {
    max-height: none !important;
    overflow-y: auto !important;
    padding: 0.75rem !important;
  }
  #feedbackButtons {
    flex-shrink: 0 !important;
    padding: 0.4rem !important;
    background: var(--bg-primary, white) !important;
    border-top: 1px solid var(--border) !important;
  }
  .keyboard-hint,
  .btn-shortcut {
    display: none !important;
  }
  .mode-selector {
    flex-shrink: 0 !important;
    margin-bottom: 0.25rem !important;
    padding: 0.25rem 0.5rem !important;
  }
  .mode-btn {
    padding: 0.4rem 0.75rem !important;
    font-size: 0.8rem !important;
  }
  .keyboard-hint {
    display: none !important;
  }
}
@media screen and (max-width: 768px) {
  .keyboard-hint,
  .btn-shortcut {
    display: none !important;
  }
}

/* Loading state for buttons */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}
.btn-loading::after {
  content: '';
  position: absolute;
  width: 1em;
  height: 1em;
  top: 50%;
  left: 50%;
  margin-top: -0.5em;
  margin-left: -0.5em;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* ===== Mobile Table Responsive Fixes ===== */
@media (max-width: 768px) {
  /* General: prevent horizontal scroll on table containers */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-responsive .data-table {
    min-width: unset;
  }

  /* Classes table: hide Description and Created columns (3rd and 5th) */
  .classes-table th:nth-child(3),
  .classes-table td:nth-child(3),
  .classes-table th:nth-child(5),
  .classes-table td:nth-child(5) {
    display: none;
  }

  /* Students table: hide Username and Created columns (2nd and 5th) */
  .students-table th:nth-child(2),
  .students-table td:nth-child(2),
  .students-table th:nth-child(5),
  .students-table td:nth-child(5) {
    display: none;
  }

  /* Students table: stack password buttons vertically */
  .students-table td:nth-child(3) {
    white-space: normal;
  }
  .students-table td:nth-child(3) .btn-minimal {
    display: block;
    margin-bottom: 0.25rem;
  }

  /* Lazy students table (JS-generated): hide Klasse, Sitzungen, Minuten (2nd, 4th, 6th cols) */
  #lazyStudentsContainer .data-table th:nth-child(2),
  #lazyStudentsContainer .data-table td:nth-child(2),
  #lazyStudentsContainer .data-table th:nth-child(4),
  #lazyStudentsContainer .data-table td:nth-child(4),
  #lazyStudentsContainer .data-table th:nth-child(6),
  #lazyStudentsContainer .data-table td:nth-child(6) {
    display: none;
  }

  /* General table cell overflow handling */
  .data-table td {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .data-table td:first-child {
    max-width: none;
  }
}


/* ============================================
   FOOTER (authenticated pages)
   ============================================ */
.site-footer {
  background: white;
  border-top: 1px solid var(--border);
  padding: 3rem 1.5rem 1.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.footer-container {
  max-width: 1100px;
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 2rem;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.footer-logo-icon {
  color: var(--primary);
}

.footer-logo-text {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.footer-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
  max-width: 300px;
}

.footer-links h4 {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  margin: 0 0 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-links ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links ul li {
  margin-bottom: 0.625rem;
}

.footer-links ul li a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
  font-size: 0.9rem;
}

.footer-links ul li a:hover {
  color: var(--primary);
}

.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-light);
}

[data-theme="dark"] .site-footer {
  background: var(--bg-primary);
  border-top-color: var(--border);
}

[data-theme="dark"] .footer-logo-text {
  color: var(--text-primary);
}

[data-theme="dark"] .footer-links h4 {
  color: var(--text-primary);
}

[data-theme="dark"] .footer-bottom {
  border-top-color: var(--border);
}

@media (max-width: 768px) {
  .site-footer {
    margin-left: 0;
    padding: 2rem 1rem 1rem;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* ============================================
   MINT CTA BUTTONS
   ============================================ */
.btn-mint {
  background: linear-gradient(135deg, #11B8A0, #0EA68E);
  color: white;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-full, 9999px);
  font-weight: 700;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 10px rgba(17, 184, 160, 0.3);
  text-decoration: none;
  display: inline-block;
}
.btn-mint:hover {
  box-shadow: 0 4px 20px rgba(17, 184, 160, 0.45);
  transform: translateY(-1px);
  color: white;
  text-decoration: none;
}
.btn-mint-lg { padding: 1rem 2.5rem; font-size: 1.0625rem; }
.btn-mint-sm { padding: 0.5rem 1.25rem; font-size: 0.875rem; }
.btn-mint-ghost {
  background: transparent;
  color: #11B8A0;
  border: 2px solid #11B8A0;
  box-shadow: none;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-full, 9999px);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}
.btn-mint-ghost:hover {
  background: rgba(17, 184, 160, 0.1);
  color: #11B8A0;
  text-decoration: none;
}

[data-theme="dark"] .btn-mint {
  background: linear-gradient(135deg, #11B8A0, #0EA68E);
}
[data-theme="dark"] .btn-mint-ghost {
  color: #4DD9C0;
  border-color: #4DD9C0;
}
[data-theme="dark"] .btn-mint-ghost:hover {
  background: rgba(77, 217, 192, 0.1);
  color: #4DD9C0;
}

/* ============================================
   DEMO BANNER
   ============================================ */
.demo-banner {
  background: linear-gradient(135deg, #6C5CE7, #5B4BD5);
  color: white;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 80px;
  left: 0;
  right: 0;
  z-index: 999;
  font-size: 0.9rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.demo-banner .btn-mint-sm { margin-left: 0.5rem; }
.demo-banner + .app-layout, .demo-banner ~ .app-layout { margin-top: 130px; }
@media (max-width: 768px) {
  .demo-banner { flex-direction: column; text-align: center; padding: 0.5rem 1rem; }
}

/* ============================================
   PWA STANDALONE MODE
   ============================================ */
@media (display-mode: standalone) {
  .topbar { display: none !important; }
  .practice-header-right .nav-link-inherit { display: none !important; }
}

/* ============================================
   VOCABULARY TEST FEATURE
   ============================================ */

/* ---- 1. Test List Page ---- */

.test-list-page {
  max-width: var(--container-lg);
  margin: 0 auto;
  padding: var(--space-lg);
}

.test-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--space-xl);
}

.test-tab {
  padding: 0.75rem 1.5rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -2px;
}

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

.test-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.test-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  transition: box-shadow 0.2s, transform 0.2s;
}

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

.test-card-info {
  flex: 1;
  min-width: 0;
}

.test-card-title {
  font-family: 'Outfit', sans-serif;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.25rem 0;
}

.test-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  flex-wrap: wrap;
}

.test-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.test-card-actions {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.test-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-draft {
  background: var(--color-muted-bg);
  color: var(--color-muted);
}

.badge-active {
  background: rgba(17, 184, 160, 0.15);
  color: #11B8A0;
  animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.badge-completed {
  background: var(--color-purple-bg);
  color: var(--primary);
}

.test-empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--text-muted);
}

.test-empty-state i {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.4;
}

.test-empty-state p {
  font-size: var(--text-base);
  margin: 0;
}

/* ---- 2. Test Create Page ---- */

.test-create-page {
  max-width: var(--container-md);
  margin: 0 auto;
  padding: var(--space-lg);
}

.test-create-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.test-create-form .form-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.test-create-form .form-section-title {
  font-family: 'Outfit', sans-serif;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 var(--space-md) 0;
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.card-select-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.card-select-table thead th {
  background: var(--bg-secondary);
  padding: 0.625rem 0.75rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--border);
}

.card-select-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.card-select-table tbody tr:nth-child(even) {
  background: var(--bg-secondary);
}

.card-select-table tbody tr:hover {
  background: rgba(108, 92, 231, 0.05);
}

.card-select-table td {
  padding: 0.625rem 0.75rem;
  color: var(--text-primary);
  vertical-align: middle;
}

.card-select-table input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.card-select-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.card-select-actions .btn {
  font-size: var(--text-xs);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-md);
}

.direction-toggle {
  display: inline-flex;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.direction-toggle input[type="radio"] {
  display: none;
}

.direction-toggle label {
  padding: 0.5rem 1.25rem;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-primary);
  cursor: pointer;
  transition: all 0.2s;
  border-right: 1px solid var(--border);
  user-select: none;
}

.direction-toggle label:last-of-type {
  border-right: none;
}

.direction-toggle input[type="radio"]:checked + label {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ---- 3. Test Worksheet (Student) ---- */

.test-worksheet {
  max-width: var(--container-md);
  margin: 0 auto;
  padding: var(--space-lg);
  padding-top: calc(var(--space-lg) + 50px);
  padding-bottom: calc(var(--space-lg) + 80px);
}

.test-timer-bar {
  position: fixed;
  top: 80px;
  left: 0;
  right: 0;
  height: 50px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 998;
  box-shadow: var(--shadow-sm);
}

.test-timer-bar .timer-display {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  transition: color 0.3s;
}

.test-timer-bar .timer-display i {
  margin-right: 0.4rem;
  font-size: 1.1rem;
}

.test-timer-bar.timer-warning .timer-display {
  color: var(--danger);
  animation: timer-blink 1s ease-in-out infinite;
}

@keyframes timer-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.test-question {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: var(--space-md);
  transition: border-color 0.2s;
}

.test-question:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.test-question-number {
  font-family: 'Outfit', sans-serif;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

.test-question-context {
  font-size: var(--text-base);
  color: var(--text-primary);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.test-highlight {
  font-weight: 700;
  color: var(--primary);
  background: rgba(108, 92, 231, 0.1);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.test-answer-input {
  width: 100%;
  padding: 0.6rem 0;
  font-size: 1.1rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border);
  outline: none;
  transition: border-color 0.2s;
}

.test-answer-input::placeholder {
  color: var(--text-muted);
}

.test-answer-input:focus {
  border-bottom-color: var(--primary);
}

.test-submit-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 998;
}

.test-submit-bar .progress-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

.test-submit-bar .btn-submit-test {
  padding: 0.65rem 2rem;
  font-size: var(--text-base);
  font-weight: 700;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.test-submit-bar .btn-submit-test:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.test-submit-bar .btn-submit-test:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ---- 4. Grading Page ---- */

.test-grade-page {
  max-width: var(--container-lg);
  margin: 0 auto;
  padding: var(--space-lg);
}

.grade-summary {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.grade-summary-student {
  font-family: 'Outfit', sans-serif;
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
}

.grade-summary-score {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.grade-summary-score .score-value {
  font-family: 'Outfit', sans-serif;
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--primary);
}

.grade-summary-score .score-percent {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-secondary);
}

.grade-answer-row {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: var(--space-md);
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  gap: var(--space-md);
  align-items: start;
}

.grade-answer-number {
  font-family: 'Outfit', sans-serif;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  padding-top: 0.15rem;
}

.grade-answer-content {
  min-width: 0;
}

.grade-answer-sentence {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.grade-answer-comparison {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.grade-answer-correct,
.grade-answer-student {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
}

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

.grade-answer-student.answer-match {
  background: var(--badge-success-bg);
  color: var(--badge-success-text);
}

.grade-answer-student.answer-wrong {
  background: var(--badge-danger-bg);
  color: var(--badge-danger-text);
}

.grade-answer-student.answer-review {
  background: var(--badge-warning-bg);
  color: var(--badge-warning-text);
}

.grade-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  align-items: flex-end;
  flex-shrink: 0;
}

.grade-override {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.grade-override .override-toggle {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.grade-override .override-toggle:hover,
.grade-override .override-toggle.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.grade-override .points-input {
  width: 3.5rem;
  padding: 0.3rem 0.4rem;
  font-size: var(--text-sm);
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-primary);
}

.grade-notes-input {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.4rem 0.6rem;
  font-size: var(--text-xs);
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  transition: border-color 0.2s;
}

.grade-notes-input::placeholder {
  color: var(--text-muted);
}

.grade-notes-input:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-finalize {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  font-size: var(--text-base);
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, #11B8A0, #0EA68E);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(17, 184, 160, 0.3);
}

.btn-finalize:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(17, 184, 160, 0.4);
}

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

/* ---- 5. Results Page ---- */

.test-results-page {
  max-width: var(--container-md);
  margin: 0 auto;
  padding: var(--space-lg);
}

.test-score-header {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  margin-bottom: var(--space-xl);
}

.test-score-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 140px;
  margin-bottom: var(--space-md);
}

.test-score-ring svg {
  width: 140px;
  height: 140px;
  transform: rotate(-90deg);
}

.test-score-ring .ring-bg {
  fill: none;
  stroke: var(--bg-tertiary);
  stroke-width: 8;
}

.test-score-ring .ring-fill {
  fill: none;
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease-out;
}

.test-score-ring .score-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
}

.test-score-header .score-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
}

.test-result-row {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: var(--space-sm);
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  gap: var(--space-md);
  align-items: center;
  transition: border-color 0.2s;
}

.test-result-row .result-number {
  font-family: 'Outfit', sans-serif;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
}

.test-result-row .result-body {
  min-width: 0;
}

.test-result-row .result-sentence {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.test-result-row .result-answers {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  align-items: center;
}

.test-result-row .result-answers span {
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
}

.test-result-row .result-points {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--text-primary);
  text-align: right;
  white-space: nowrap;
}

.test-result-row .result-note {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.25rem;
}

.answer-correct {
  border-left: 3px solid var(--success);
  background: var(--badge-success-bg);
  color: var(--badge-success-text);
}

.answer-incorrect {
  border-left: 3px solid var(--danger);
  background: var(--badge-danger-bg);
  color: var(--badge-danger-text);
}

.answer-review {
  border-left: 3px solid var(--warning);
  background: var(--badge-warning-bg);
  color: var(--badge-warning-text);
}

/* ---- 6. Live Monitor ---- */

.test-live-monitor {
  max-width: var(--container-lg);
  margin: 0 auto;
  padding: var(--space-lg);
}

.monitor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.monitor-student-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.monitor-student-card .student-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--text-sm);
  margin-bottom: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.monitor-student-card .student-status-icon {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.monitor-student-card .student-status-label {
  font-size: var(--text-xs);
  font-weight: 500;
}

.monitor-status-not-started {
  border-color: var(--color-muted);
}

.monitor-status-not-started .student-status-icon {
  color: var(--color-muted);
}

.monitor-status-not-started .student-status-label {
  color: var(--color-muted);
}

.monitor-status-in-progress {
  border-color: var(--warning);
}

.monitor-status-in-progress .student-status-icon {
  color: var(--warning);
  animation: monitor-pulse 1.5s ease-in-out infinite;
}

.monitor-status-in-progress .student-status-label {
  color: var(--warning);
}

@keyframes monitor-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.1); }
}

.monitor-status-submitted {
  border-color: var(--success);
}

.monitor-status-submitted .student-status-icon {
  color: var(--success);
}

.monitor-status-submitted .student-status-label {
  color: var(--success);
}

.monitor-progress-bar {
  background: var(--bg-tertiary);
  border-radius: 9999px;
  height: 0.75rem;
  overflow: hidden;
  margin-bottom: var(--space-sm);
}

.monitor-progress-bar .progress-fill {
  height: 100%;
  background: linear-gradient(135deg, #11B8A0, #0EA68E);
  border-radius: 9999px;
  transition: width 0.5s ease-out;
}

.monitor-progress-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
  text-align: center;
}

/* ---- 7. Active Test Banner (Student Dashboard) ---- */

.active-test-banner {
  background: linear-gradient(135deg, #11B8A0, #0EA68E);
  color: #fff;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  animation: banner-pulse 2.5s ease-in-out infinite;
  position: relative;
}

@keyframes banner-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(17, 184, 160, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(17, 184, 160, 0); }
}

.active-test-banner .banner-content {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
  min-width: 0;
}

.active-test-banner .banner-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.active-test-banner .banner-text {
  font-weight: 700;
  font-size: var(--text-base);
}

.active-test-banner .banner-link {
  color: #fff;
  text-decoration: underline;
  font-weight: 700;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.active-test-banner .banner-link:hover {
  opacity: 0.85;
}

.active-test-banner .banner-dismiss {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.active-test-banner .banner-dismiss:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

/* ---- 8. Dark Mode Overrides ---- */

/* Test List */
[data-theme="dark"] .test-tab {
  color: var(--text-secondary);
}
[data-theme="dark"] .test-tab:hover {
  background: var(--bg-tertiary);
}
[data-theme="dark"] .test-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

[data-theme="dark"] .test-card {
  background: var(--card-bg);
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .test-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .badge-active {
  background: rgba(17, 184, 160, 0.2);
  color: #4DD9C0;
}
[data-theme="dark"] .badge-completed {
  background: var(--color-purple-bg);
  color: var(--primary);
}

/* Test Create */
[data-theme="dark"] .test-create-form .form-section {
  background: var(--card-bg);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .card-select-table thead th {
  background: var(--bg-tertiary);
  border-bottom-color: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}
[data-theme="dark"] .card-select-table tbody tr {
  border-bottom-color: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .card-select-table tbody tr:nth-child(even) {
  background: var(--bg-secondary);
}
[data-theme="dark"] .card-select-table tbody tr:hover {
  background: rgba(122, 107, 181, 0.1);
}

[data-theme="dark"] .direction-toggle {
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .direction-toggle label {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-right-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .direction-toggle input[type="radio"]:checked + label {
  background: var(--primary);
  color: #fff;
}

/* Test Worksheet */
[data-theme="dark"] .test-timer-bar {
  background: #1A1A2E;
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .test-question {
  background: var(--card-bg);
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .test-question:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

[data-theme="dark"] .test-highlight {
  background: rgba(122, 107, 181, 0.2);
  color: var(--primary);
}

[data-theme="dark"] .test-answer-input {
  color: var(--text-primary);
  border-bottom-color: rgba(255, 255, 255, 0.15);
}
[data-theme="dark"] .test-answer-input:focus {
  border-bottom-color: var(--primary);
}
[data-theme="dark"] .test-answer-input::placeholder {
  color: var(--text-muted);
}

[data-theme="dark"] .test-submit-bar {
  background: #1A1A2E;
  border-top-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
}

/* Grading Page */
[data-theme="dark"] .grade-summary {
  background: var(--card-bg);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .grade-answer-row {
  background: var(--card-bg);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .grade-override .override-toggle {
  background: var(--bg-tertiary);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}
[data-theme="dark"] .grade-override .override-toggle:hover,
[data-theme="dark"] .grade-override .override-toggle.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

[data-theme="dark"] .grade-override .points-input {
  background: #1E1E3A;
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

[data-theme="dark"] .grade-notes-input {
  background: #1E1E3A;
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}
[data-theme="dark"] .grade-notes-input:focus {
  border-color: var(--primary);
}

[data-theme="dark"] .btn-finalize {
  background: linear-gradient(135deg, #11B8A0, #0EA68E);
}

/* Results Page */
[data-theme="dark"] .test-score-ring .ring-bg {
  stroke: var(--bg-tertiary);
}
[data-theme="dark"] .test-score-ring .ring-fill {
  stroke: var(--primary);
}
[data-theme="dark"] .test-score-ring .score-label {
  color: var(--primary);
}

[data-theme="dark"] .test-result-row {
  background: var(--card-bg);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .answer-correct {
  border-left-color: var(--success);
  background: var(--badge-success-bg);
  color: var(--badge-success-text);
}
[data-theme="dark"] .answer-incorrect {
  border-left-color: var(--danger);
  background: var(--badge-danger-bg);
  color: var(--badge-danger-text);
}
[data-theme="dark"] .answer-review {
  border-left-color: var(--warning);
  background: var(--badge-warning-bg);
  color: var(--badge-warning-text);
}

/* Live Monitor */
[data-theme="dark"] .monitor-student-card {
  background: var(--card-bg);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .monitor-progress-bar {
  background: var(--bg-tertiary);
}

/* Active Test Banner */
[data-theme="dark"] .active-test-banner {
  background: linear-gradient(135deg, #0EA68E, #0B8F7A);
}

/* ---- 9. Mobile Responsive ---- */

@media (max-width: 768px) {

  /* Test List */
  .test-list-page {
    padding: var(--space-md);
  }

  .test-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .test-tab {
    white-space: nowrap;
    padding: 0.6rem 1rem;
    font-size: var(--text-xs);
  }

  .test-card {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
  }

  .test-card-actions {
    justify-content: flex-end;
  }

  /* Test Create */
  .test-create-page {
    padding: var(--space-md);
  }

  .card-select-table th:nth-child(n+4),
  .card-select-table td:nth-child(n+4) {
    display: none;
  }

  .card-select-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .direction-toggle {
    align-self: flex-start;
  }

  /* Timer Bar */
  .test-timer-bar .timer-display {
    font-size: 1.1rem;
  }

  /* Worksheet */
  .test-worksheet {
    padding: var(--space-md);
    padding-top: calc(var(--space-md) + 50px);
    padding-bottom: calc(var(--space-md) + 80px);
  }

  .test-question {
    padding: 1rem;
  }

  .test-question-context {
    font-size: var(--text-sm);
  }

  .test-answer-input {
    font-size: 1rem;
  }

  .test-submit-bar {
    padding: 0.6rem 1rem;
  }

  .test-submit-bar .btn-submit-test {
    padding: 0.55rem 1.25rem;
    font-size: var(--text-sm);
  }

  /* Grading Page */
  .test-grade-page {
    padding: var(--space-md);
  }

  .grade-summary {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .grade-summary-score {
    justify-content: center;
  }

  .grade-answer-row {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .grade-answer-number {
    text-align: left;
    font-size: var(--text-sm);
  }

  .grade-controls {
    align-items: stretch;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-sm);
  }

  .grade-override {
    flex: 1;
    min-width: 0;
  }

  /* Results */
  .test-results-page {
    padding: var(--space-md);
  }

  .test-score-ring {
    width: 110px;
    height: 110px;
  }

  .test-score-ring svg {
    width: 110px;
    height: 110px;
  }

  .test-score-ring .score-label {
    font-size: 1.5rem;
  }

  .test-result-row {
    grid-template-columns: 1fr;
    gap: var(--space-xs);
    padding: 0.85rem 1rem;
  }

  .test-result-row .result-number {
    text-align: left;
    font-size: var(--text-sm);
  }

  .test-result-row .result-points {
    text-align: left;
  }

  /* Live Monitor */
  .test-live-monitor {
    padding: var(--space-md);
  }

  .monitor-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-sm);
  }

  .monitor-student-card {
    padding: 0.75rem;
  }

  /* Active Test Banner */
  .active-test-banner {
    flex-direction: column;
    text-align: center;
    padding: 0.75rem 1rem;
    gap: var(--space-sm);
  }

  .active-test-banner .banner-content {
    flex-direction: column;
  }
}
