:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --success-color: #16a34a;
  --error-color: #dc2626;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --bg-hover: #f1f5f9;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
}

body.dark-theme,
.mobile-app.dark-theme {
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --bg-hover: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.dark-theme .mobile-app {
  background: #0f172a;
}

.dark-theme .mobile-header,
.dark-theme .bottom-nav,
.dark-theme .word-card-container,
.dark-theme .stat-card,
.dark-theme .curriculum-block,
.dark-theme .settings-card,
.dark-theme .fav-card,
.dark-theme .dict-card,
.dark-theme .modal-content,
.dark-theme .empty-favorites-box {
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
}

.dark-theme .quiz-option {
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
}

.dark-theme .quiz-option:hover:not(:disabled) {
  background: #334155;
  border-color: #3b82f6;
}

.dark-theme .quiz-option.correct {
  background: #14532d !important;
  border-color: #22c55e !important;
  color: #bbf7d0 !important;
}

.dark-theme .quiz-option.wrong {
  background: #7f1d1d !important;
  border-color: #ef4444 !important;
  color: #fecaca !important;
}

.dark-theme .flashcard-box {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

.dark-theme .flashcard-box:hover {
  background: #1e293b !important;
}

.dark-theme .flashcard-box.flipped {
  border-color: #3b82f6 !important;
}

.dark-theme .flashcard-hint {
  color: #94a3b8 !important;
}

.dark-theme .card-translation {
  color: #f8fafc !important;
}

.dark-theme .category-badge,
.dark-theme .total-words-badge,
.dark-theme .sound-button-sm,
.dark-theme .secondary-button,
.dark-theme .profile-avatar {
  background: #334155;
  color: #cbd5e1;
  border-color: #475569;
}

.dark-theme .answer-input,
.dark-theme .settings-select,
.dark-theme .search-input,
.dark-theme .filter-select,
.dark-theme .form-group input {
  background: #0f172a;
  color: #f8fafc;
  border-color: #475569;
}

.dark-theme .training-word {
  color: #f8fafc;
}

.theme-toggle-btn {
  background: #f1f5f9;
  border: 1.5px solid var(--border-color);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  font-size: 18px;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 0;
  line-height: 1;
  transition: all 0.15s ease;
}

.theme-toggle-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.dark-theme .theme-toggle-btn {
  background: #1e293b;
  border-color: #334155;
  color: #7c3aed; /* dark violet / purple */
  font-size: 20px;
  font-weight: 700;
}

.dark-theme .theme-toggle-btn:hover {
  background: #334155;
  border-color: #7c3aed;
  color: #8b5cf6;
}

.dark-theme .header-profile-badge {
  background: #334155;
  border-color: #64748b;
  color: #f8fafc;
}

.dark-theme .header-profile-badge:hover {
  background: #475569;
  border-color: #94a3b8;
}

.theme-options-row,
.voice-options-row,
.sound-options-row {
  display: flex;
  gap: 8px;
}

.theme-option-btn,
.voice-option-btn,
.sound-option-btn {
  flex: 1;
  padding: 6px 10px;
  min-height: 36px;
  border: 1.5px solid #cbd5e1;
  background: #f1f5f9;
  color: var(--text-main);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.theme-option-btn:hover:not(.active),
.voice-option-btn:hover:not(.active),
.sound-option-btn:hover:not(.active) {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.theme-option-btn.active,
.voice-option-btn.active,
.sound-option-btn.active {
  border-color: #16a34a;
  background: #ecfdf5;
  color: #15803d;
  font-weight: 700;
}

.voice-option-btn.flag-btn {
  padding: 4px 10px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flag-svg-icon {
  width: 38px;
  height: 26px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  display: block;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.voice-option-btn.active .flag-svg-icon {
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

.dark-theme .theme-option-btn,
.dark-theme .voice-option-btn,
.dark-theme .sound-option-btn {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

.dark-theme .theme-option-btn:hover:not(.active),
.dark-theme .voice-option-btn:hover:not(.active),
.dark-theme .sound-option-btn:hover:not(.active) {
  background: #334155;
  border-color: #475569;
  color: #f8fafc;
}

.dark-theme .theme-option-btn.active,
.dark-theme .voice-option-btn.active,
.dark-theme .sound-option-btn.active {
  background: rgba(22, 163, 74, 0.25);
  color: #4ade80;
  border-color: #22c55e;
}

* {
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  overflow-x: clip;
  max-width: 100%;
  box-sizing: border-box;
}

html,
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 15px;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
}

/* App Wrapper */
.mobile-app {
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}

/* Header */
.mobile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  min-height: 54px;
  height: 54px;
  border-bottom: 1px solid var(--border-color);
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-sizing: border-box;
  flex-wrap: nowrap;
  overflow: hidden;
}

.brand {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}

.brand-icon {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
}

.brand h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
  line-height: 1.2;
  letter-spacing: -0.2px;
}

.user-status-text {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 125px;
  display: block;
  line-height: 1.2;
}

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

.header-auth-btn {
  background: #eff6ff;
  color: var(--primary-color);
  border: 1px solid #bfdbfe;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  height: 36px;
  box-sizing: border-box;
  white-space: nowrap;
  flex-shrink: 0;
}

.header-profile-badge {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--border-color);
  background: #e2e8f0;
  font-size: 18px;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 0;
  line-height: 1;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.header-profile-badge:hover {
  background: #cbd5e1;
  border-color: #94a3b8;
}

/* Header XP Badge */
.header-xp-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  padding: 0 2px;
  height: 36px;
  cursor: pointer;
  box-sizing: border-box;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.header-xp-badge:hover {
  background: transparent;
  transform: scale(1.06);
  opacity: 0.9;
}

.dark-theme .header-xp-badge {
  background: transparent;
  border: none;
}

.xp-badge-icon {
  font-size: 27px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-0.5px);
  margin-right: 3px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
}

.xp-badge-level {
  font-size: 12px;
  font-weight: 800;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.25);
  padding: 2px 6px;
  border-radius: 6px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.dark-theme .xp-badge-level {
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(96, 165, 250, 0.35);
}

.xp-badge-text {
  font-size: 16px;
  font-weight: 800;
  color: #f59e0b;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  letter-spacing: -0.2px;
}

.dark-theme .xp-badge-text {
  color: #fbbf24;
}

@keyframes xpPopUp {
  0% { transform: scale(1); }
  35% { transform: scale(1.28); filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.8)); }
  100% { transform: scale(1); }
}

@keyframes xpPopDown {
  0% { transform: scale(1); }
  35% { transform: scale(0.9); color: #ef4444; }
  100% { transform: scale(1); }
}

.header-xp-badge.xp-bump-up {
  animation: xpPopUp 0.6s ease-out;
}

.header-xp-badge.xp-bump-down {
  animation: xpPopDown 0.6s ease-out;
}

/* Main Content Area */
.app-main-content {
  flex: 1;
  padding: 12px 14px;
  padding-bottom: 24px;
}

/* Bottom Navigation (Hidden) */
.bottom-nav {
  display: none !important;
}

.nav-tab {
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px 4px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  flex: 0 0 auto;
  min-height: 36px;
}

.nav-tab .tab-icon {
  font-size: 20px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.nav-tab:hover .tab-icon {
  transform: scale(1.15);
}

.nav-tab.active {
  color: #16a34a;
  background: #f1f5f9;
}

.nav-tab.active .tab-icon {
  transform: scale(1.18);
}

.dark-theme .nav-tab.active {
  background: #334155;
  color: #4ade80;
}

.dark-theme .nav-tab[data-tab="training"] .tab-icon {
  filter: brightness(1.7) contrast(1.2) drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

/* Word Card / Training Screen */
.word-card-container {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 14px;
  box-shadow: var(--shadow-sm);
}

.train-category-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: #1e3a8a;
  background: #e0e7ff;
  border: 1px solid rgba(99, 102, 241, 0.2);
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
}

.dark-theme .train-category-badge {
  color: #93c5fd;
  background: rgba(30, 58, 138, 0.4);
  border-color: rgba(147, 197, 253, 0.25);
}

.card-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.mode-switch-pills {
  position: relative;
  display: inline-flex;
  flex: 1;
  background: #f1f5f9;
  border-radius: 24px;
  padding: 3px;
  gap: 0;
  border: 1px solid var(--border-color);
  box-sizing: border-box;
}

.dark-theme .mode-switch-pills {
  background: #1e293b;
  border-color: #334155;
}

.mode-pill-glider {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  background: #16a34a;
  border-radius: 20px;
  box-shadow: 0 3px 10px rgba(22, 163, 74, 0.35);
  transition: transform 0.32s cubic-bezier(0.34, 1.35, 0.7, 1), width 0.25s ease;
  pointer-events: none;
  z-index: 1;
  will-change: transform, width;
}

.mode-pill-btn {
  position: relative;
  z-index: 2;
  flex: 1;
  padding: 8px 4px;
  border-radius: 20px;
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  background: transparent !important;
  color: var(--text-muted);
  transition: color 0.2s ease;
  white-space: nowrap;
  user-select: none;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mode-pill-btn:hover {
  color: var(--text-main);
}

.mode-pill-btn.active {
  color: #ffffff !important;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.mode-pill-btn:disabled,
.mode-pill-btn.disabled-mode {
  opacity: 0.3 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

@keyframes heartHintBlink {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(239, 68, 68, 0));
  }
  30% {
    transform: scale(1.45) rotate(-8deg);
    filter: drop-shadow(0 0 14px #ec4899) hue-rotate(90deg);
  }
  60% {
    transform: scale(1.3) rotate(8deg);
    filter: drop-shadow(0 0 16px #a855f7) hue-rotate(240deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    filter: drop-shadow(0 0 0 rgba(239, 68, 68, 0));
  }
}

.favorite-button {
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  transition: transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  padding: 0;
  border-radius: 50%;
  position: absolute;
  top: -4px;
  right: -4px;
  z-index: 5;
}

.favorite-button:hover {
  transform: scale(1.15);
}

.favorite-button.heart-hint-blink {
  animation: heartHintBlink 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) 1 forwards;
  display: inline-flex !important;
}

.word-main-display {
  text-align: center;
  margin-bottom: 12px;
  position: relative;
}

.sound-button {
  border: none;
  background: #eef2ff;
  color: var(--primary-color);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 20px;
  cursor: pointer;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.sound-button:hover {
  background: #e0e7ff;
}

.turtle-indicator {
  display: inline-block;
  margin-top: 4px;
  background: #fef3c7;
  color: #92400e;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.clickable-word-box {
  cursor: pointer;
  display: inline-block;
  padding: 6px 16px;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
  user-select: none;
  margin-top: 4px;
  text-align: center;
  position: relative;
}

.clickable-word-box:hover {
  background: rgba(59, 130, 246, 0.08);
}

.clickable-word-box:hover .word-audio-indicator {
  opacity: 1 !important;
  transform: translateY(-50%) scale(1.15);
}

.clickable-word-box:active {
  transform: scale(0.96);
  background: rgba(59, 130, 246, 0.15);
}

.dark-theme .clickable-word-box:hover {
  background: rgba(96, 165, 250, 0.15);
}

.dark-theme .clickable-word-box:active {
  background: rgba(96, 165, 250, 0.25);
}

.word-header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 4px 0 2px;
}

.word-side-icon-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, opacity 0.15s ease;
  opacity: 0.8;
  user-select: none;
}

.word-side-icon-btn:hover {
  transform: scale(1.2);
  opacity: 1;
}

.word-side-icon-btn:active {
  transform: scale(0.95);
}

.training-word {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
  line-height: 1.25;
  position: relative;
  display: inline-block;
  text-align: center;
}

.word-audio-indicator {
  display: none;
}

.training-transcription {
  color: var(--text-muted);
  font-size: 17px;
  margin: 4px 0 0;
  text-align: center;
}

/* Quiz Options 2x2 Grid */
.quiz-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quiz-option {
  padding: 8px 6px;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  background: #f1f5f9;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 84px;
  height: 92px;
  max-height: 115px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.25;
  box-sizing: border-box;
  overflow: hidden;
  color: var(--text-main);
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
}

.quiz-option-inner {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 100%;
  width: 100%;
  line-height: 1.22;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
}

.quiz-option:hover:not(:disabled) {
  border-color: #16a34a;
  background: #f0fdf4;
}

.quiz-option.correct {
  border-color: var(--success-color);
  background: #dcfce7;
  color: #14532d;
}

.quiz-option.wrong {
  border-color: var(--error-color);
  background: #fef2f2;
  color: #7f1d1d;
}

/* Pairs Matching Mode */
.pairs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
  perspective: 1200px;
  -webkit-perspective: 1200px;
}

.pairs-col {
  display: flex;
  flex-direction: column;
  gap: 9px;
  perspective: 1200px;
  -webkit-perspective: 1200px;
}

.pairs-card {
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 5px 8px;
  font-size: 17px;
  font-weight: 500;
  text-align: center;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  min-height: 52px;
  max-height: 70px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  box-sizing: border-box;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}

.pairs-card-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-height: 100%;
  width: 100%;
  line-height: 1.2;
  word-break: normal;
  overflow-wrap: break-word;
}

.pairs-card:hover:not(:disabled) {
  border-color: var(--primary-color);
  background: #f0f7ff;
}

.pairs-card.selected {
  background: #eff6ff !important;
  border-color: var(--primary-color) !important;
  color: var(--primary-color) !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

.pairs-card.matched {
  background: #dcfce7 !important;
  border: 2px solid #22c55e !important;
  color: #15803d !important;
  font-weight: 700;
  pointer-events: none;
  cursor: default;
  transform: scale(0.98);
}

.pairs-card.wrong {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
  animation: pairShake 0.4s ease;
}

/* Casino 3D Horizontal Flip Animation on All Pairs Matched (Dollar Emerald Green / White) */
@-webkit-keyframes casinoCardFlipX {
  0% {
    -webkit-transform: rotateX(0deg) scale(1);
    transform: rotateX(0deg) scale(1);
    background: #16a34a !important;
    border-color: #4ade80 !important;
    color: #ffffff !important;
  }
  30% {
    background: #15803d !important;
    border-color: #86efac !important;
    color: #ffffff !important;
    box-shadow: 0 0 25px rgba(34, 197, 94, 0.95) !important;
  }
  50% {
    -webkit-transform: rotateX(180deg) scale(0.88);
    transform: rotateX(180deg) scale(0.88);
    background: #14532d !important;
    border-color: #86efac !important;
    color: #ffffff !important;
    box-shadow: 0 0 35px rgba(34, 197, 94, 1) !important;
  }
  70% {
    background: #15803d !important;
    border-color: #86efac !important;
    color: #ffffff !important;
    box-shadow: 0 0 25px rgba(34, 197, 94, 0.95) !important;
  }
  92% {
    background: #16a34a !important;
    border-color: #4ade80 !important;
    color: #ffffff !important;
  }
  100% {
    -webkit-transform: rotateX(360deg) scale(1);
    transform: rotateX(360deg) scale(1);
    background: #ffffff !important;
    border-color: #22c55e !important;
    color: #15803d !important;
    box-shadow: var(--shadow-sm) !important;
  }
}

@keyframes casinoCardFlipX {
  0% {
    -webkit-transform: rotateX(0deg) scale(1);
    transform: rotateX(0deg) scale(1);
    background: #16a34a !important;
    border-color: #4ade80 !important;
    color: #ffffff !important;
  }
  30% {
    background: #15803d !important;
    border-color: #86efac !important;
    color: #ffffff !important;
    box-shadow: 0 0 25px rgba(34, 197, 94, 0.95) !important;
  }
  50% {
    -webkit-transform: rotateX(180deg) scale(0.88);
    transform: rotateX(180deg) scale(0.88);
    background: #14532d !important;
    border-color: #86efac !important;
    color: #ffffff !important;
    box-shadow: 0 0 35px rgba(34, 197, 94, 1) !important;
  }
  70% {
    background: #15803d !important;
    border-color: #86efac !important;
    color: #ffffff !important;
    box-shadow: 0 0 25px rgba(34, 197, 94, 0.95) !important;
  }
  92% {
    background: #16a34a !important;
    border-color: #4ade80 !important;
    color: #ffffff !important;
  }
  100% {
    -webkit-transform: rotateX(360deg) scale(1);
    transform: rotateX(360deg) scale(1);
    background: #ffffff !important;
    border-color: #22c55e !important;
    color: #15803d !important;
    box-shadow: var(--shadow-sm) !important;
  }
}

.pairs-card.casino-flipping {
  background: #16a34a !important;
  color: #ffffff !important;
  border-color: #4ade80 !important;
  -webkit-animation: casinoCardFlipX 0.95s cubic-bezier(0.35, 0.05, 0.25, 1) forwards !important;
  animation: casinoCardFlipX 0.95s cubic-bezier(0.35, 0.05, 0.25, 1) forwards !important;
  pointer-events: none !important;
}

.pairs-card.casino-flipping * {
  color: inherit !important;
}

.dark-theme .pairs-card {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

.dark-theme .pairs-card:hover:not(:disabled) {
  background: #334155;
  border-color: #3b82f6;
}

.dark-theme .pairs-card.selected {
  background: #1e3a8a !important;
  border-color: #60a5fa !important;
  color: #93c5fd !important;
}

.dark-theme .pairs-card.matched {
  background: #14532d !important;
  border: 2px solid #22c55e !important;
  color: #bbf7d0 !important;
  font-weight: 700;
  pointer-events: none;
  cursor: default;
  transform: scale(0.98);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.25);
}

.dark-theme .pairs-card.wrong {
  background: rgba(239, 68, 68, 0.3) !important;
  border-color: #ef4444 !important;
  color: #fca5a5 !important;
}

@keyframes pairShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* Pairs Timer Badge */
.pairs-header-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 8px;
  width: 100%;
}

.pairs-timer-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f1f5f9;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.dark-theme .pairs-timer-badge {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

.pairs-timer-badge.timer-active {
  background: rgba(34, 197, 94, 0.12);
  border-color: #22c55e;
  color: #16a34a;
}

.dark-theme .pairs-timer-badge.timer-active {
  background: rgba(34, 197, 94, 0.18);
  border-color: #22c55e;
  color: #4ade80;
}

.pairs-timer-badge.timer-warning {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #dc2626;
  animation: pairsTimerPulse 0.5s ease infinite alternate;
}

.dark-theme .pairs-timer-badge.timer-warning {
  background: rgba(239, 68, 68, 0.22);
  border-color: #ef4444;
  color: #f87171;
}

@keyframes pairsTimerPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.08); box-shadow: 0 0 10px rgba(239, 68, 68, 0.45); }
}

.pairs-card.timeout-failed {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.1) !important;
  color: #dc2626 !important;
  pointer-events: none;
  animation: pairShake 0.4s ease;
}

.dark-theme .pairs-card.timeout-failed {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.25) !important;
  color: #fca5a5 !important;
}

.pairs-timeout-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  border-radius: var(--radius-md);
  animation: fadeIn 0.2s ease;
}

.pairs-timeout-card {
  background: #ffffff;
  border: 2px solid #ef4444;
  border-radius: var(--radius-md);
  padding: 24px 20px;
  text-align: center;
  max-width: 280px;
  width: 90%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  animation: scaleInBounce 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dark-theme .pairs-timeout-card {
  background: #1e293b;
  border-color: #ef4444;
  color: #f8fafc;
}

@keyframes scaleInBounce {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* 3D Vertical Flashcard */
.flashcard-3d-wrapper {
  perspective: 1000px;
  width: 100%;
  margin: 0 auto;
}

.flashcard-3d {
  position: relative;
  width: 100%;
  min-height: 220px;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.34, 1.25, 0.64, 1);
  cursor: pointer;
  border-radius: var(--radius-lg, 16px);
}

.flashcard-3d.is-flipped {
  transform: rotateX(180deg);
}

.flashcard-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-height: 220px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg, 16px);
  padding: 16px 18px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  box-shadow: 4px 6px 18px rgba(15, 23, 42, 0.09), 1px 2px 5px rgba(15, 23, 42, 0.05);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  transform: rotateX(0deg) translateZ(1px);
  will-change: transform;
}

.dark-theme .flashcard-face {
  background: #27364b;
  border-color: #3d4f68;
  box-shadow: 4px 6px 22px rgba(0, 0, 0, 0.5), 1px 2px 6px rgba(0, 0, 0, 0.35);
}

.flashcard-face:hover {
  box-shadow: 5px 8px 26px rgba(15, 23, 42, 0.13), 2px 3px 8px rgba(15, 23, 42, 0.08);
  border-color: var(--primary-color, #2563eb);
}

.dark-theme .flashcard-face:hover {
  box-shadow: 5px 8px 28px rgba(0, 0, 0, 0.65), 2px 3px 8px rgba(0, 0, 0, 0.45);
  border-color: #3b82f6;
}

.flashcard-back {
  transform: rotateX(180deg) translateZ(1px);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: #eef2f6;
  border-color: #cbd5e1;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0;
}

.dark-theme .flashcard-back {
  background: #2a3b52;
  border-color: #3d4f68;
}

.flashcard-back .flashcard-face-top {
  position: absolute;
  top: 16px;
  left: 18px;
  right: 18px;
  width: calc(100% - 36px);
  z-index: 2;
}

.flashcard-face-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.flashcard-sound-btn,
.flashcard-fav-btn {
  background: rgba(100, 116, 139, 0.08);
  border: 1px solid rgba(100, 116, 139, 0.18);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.flashcard-sound-btn:hover,
.flashcard-fav-btn:hover {
  transform: scale(1.1);
  background: rgba(100, 116, 139, 0.18);
}

.flashcard-fav-btn.is-favorite {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
}

@keyframes heartShimmer45 {
  0% {
    background: rgba(100, 116, 139, 0.08);
    box-shadow: 0 0 0 rgba(239, 68, 68, 0);
    transform: scale(1);
  }
  25% {
    background: linear-gradient(45deg, #ef4444, #f43f5e, #fda4af, #ef4444);
    background-size: 200% 200%;
    background-position: 0% 50%;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.6);
    transform: scale(1.22);
  }
  50% {
    background: linear-gradient(45deg, #ef4444, #f43f5e, #fda4af, #ef4444);
    background-size: 200% 200%;
    background-position: 100% 50%;
    box-shadow: 0 0 18px rgba(239, 68, 68, 0.8);
    transform: scale(1.28) rotate(-8deg);
  }
  75% {
    background: linear-gradient(45deg, #ef4444, #f43f5e, #fda4af, #ef4444);
    background-size: 200% 200%;
    background-position: 0% 50%;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
    transform: scale(1.18) rotate(8deg);
  }
  100% {
    background: rgba(100, 116, 139, 0.08);
    box-shadow: 0 0 0 rgba(239, 68, 68, 0);
    transform: scale(1) rotate(0deg);
  }
}

.heart-shimmer-45 {
  animation: heartShimmer45 1.4s ease-in-out forwards;
  border-color: rgba(239, 68, 68, 0.6) !important;
}

.flashcard-face-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 0;
}

.flashcard-word {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-main, #0f172a);
  margin: 0 0 4px;
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.dark-theme .flashcard-word {
  color: #f8fafc;
}

.flashcard-transcription {
  font-size: 15px;
  color: var(--text-muted, #64748b);
  margin: 0;
  font-weight: 500;
}

.flashcard-back .flashcard-face-body {
  flex: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
  padding: 16px 18px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.flashcard-translation {
  font-size: 22px;
  font-weight: 600;
  color: #15803d;
  margin: 0;
  line-height: 1.35;
  letter-spacing: -0.2px;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.dark-theme .flashcard-translation {
  color: #4ade80;
}

/* WOTD card back face: white text with outline (same style as English word) */
.wotd-card .flashcard-translation {
  color: #ffffff !important;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
.dark-theme .wotd-card .flashcard-translation {
  color: #ffffff !important;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

.flashcard-subword {
  font-size: 15px;
  color: var(--text-muted, #64748b);
  margin: 0;
  font-weight: 600;
}

.flashcard-face-bottom {
  text-align: center;
  width: 100%;
}

.flashcard-flip-prompt {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  opacity: 0.75;
  letter-spacing: 0.2px;
}

.difficulty-buttons {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  animation: fadeInHint 0.25s ease-out;
}

.btn-repeat, .btn-easy {
  flex: 1;
  padding: 15px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-repeat {
  background: #fee2e2;
  color: #991b1b;
}

.btn-easy {
  background: #dcfce7;
  color: #166534;
}

/* Input Form */
.input-form-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.answer-input {
  width: 100%;
  height: 56px;
  min-height: 56px;
  box-sizing: border-box;
  padding: 0 16px;
  font-size: 19px;
  font-weight: 600;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--text-main);
  text-align: center;
  transition: all 0.2s ease;
  line-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: text;
  cursor: text;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior: contain;
  letter-spacing: 1px;
}

.answer-input.correction-mode {
  letter-spacing: 5px;
}

.answer-input:empty::before {
  content: attr(aria-placeholder);
  color: var(--text-muted);
  opacity: 0.65;
  pointer-events: none;
  font-weight: 500;
}

.answer-input.disabled {
  pointer-events: none;
  opacity: 0.85;
}

.dark-theme .answer-input {
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
}

.diff-char-inline {
  display: inline;
  padding: 0;
  margin: 0;
}

.diff-char-inline.match {
  color: #16a34a;
  font-weight: 700;
}

.dark-theme .diff-char-inline.match {
  color: #4ade80;
}

.diff-char-inline.mismatch {
  color: #ef4444;
  font-weight: 800;
  background: rgba(239, 68, 68, 0.16);
  border-radius: 4px;
  padding: 1px 3px;
}

.dark-theme .diff-char-inline.mismatch {
  color: #f87171;
  background: rgba(239, 68, 68, 0.32);
}

/* Yellow dashes for missing letters */
.diff-missing-dash {
  display: inline-block;
  width: 14px;
  height: 3px;
  background-color: #f59e0b;
  border-radius: 2px;
  margin: 0 4px;
  vertical-align: middle;
  user-select: none;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.3);
}

.dark-theme .diff-missing-dash {
  background-color: #fbbf24;
  box-shadow: 0 1px 4px rgba(251, 191, 36, 0.4);
}

.answer-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.answer-input.correct {
  border-color: var(--success-color) !important;
  background: #dcfce7 !important;
  color: #14532d !important;
}

.dark-theme .answer-input.correct {
  border-color: #22c55e !important;
  background: #14532d !important;
  color: #bbf7d0 !important;
}

.answer-input.wrong {
  border-color: var(--error-color) !important;
  background: #fef2f2 !important;
  color: #7f1d1d !important;
}

.dark-theme .answer-input.wrong {
  border-color: #ef4444 !important;
  background: #7f1d1d !important;
  color: #fecaca !important;
}

/* Second Chance & Typo Diff Styles */
.input-typo-hint {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(239, 68, 68, 0.08);
  border: 1.5px dashed rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-md);
  text-align: center;
  animation: fadeInHint 0.2s ease-out;
}

.dark-theme .input-typo-hint {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.5);
}

.input-typo-label {
  font-size: 13.5px;
  font-weight: 700;
  color: #ef4444;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.dark-theme .input-typo-label {
  color: #f87171;
}

.diff-letters-row {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 1px;
}

.diff-char {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 34px;
  padding: 0 4px;
  border-radius: 6px;
  box-sizing: border-box;
}

.diff-char.match {
  color: #15803d;
  background: #dcfce7;
  border: 1px solid #86efac;
}

.dark-theme .diff-char.match {
  color: #4ade80;
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(74, 222, 128, 0.35);
}

.diff-char.mismatch {
  color: #b91c1c;
  background: #fee2e2;
  border: 1.5px solid #f87171;
  text-decoration: underline;
}

.dark-theme .diff-char.mismatch {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.28);
  border-color: rgba(248, 113, 113, 0.5);
}

.diff-char.missing {
  color: #d97706;
  background: #fef3c7;
  border: 1px dashed #f59e0b;
  animation: pulseMissing 1s infinite alternate;
}

.dark-theme .diff-char.missing {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(251, 191, 36, 0.4);
}

@keyframes pulseMissing {
  from { opacity: 0.5; }
  to { opacity: 1; }
}

@keyframes shakeInput {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.shake-input {
  animation: shakeInput 0.35s ease-in-out;
}

@keyframes fadeInHint {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.check-button {
  width: 100%;
  height: 56px;
  min-height: 56px;
  box-sizing: border-box;
  background: var(--primary-color);
  color: #ffffff;
  border: none;
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-size: 17.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.check-button:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.check-button:active:not(:disabled) {
  transform: translateY(1px);
}

.primary-button {
  width: 100%;
  min-height: 52px;
  height: 52px;
  box-sizing: border-box;
  background: var(--primary-color);
  color: #ffffff;
  border: none;
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-size: 16.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-button:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.primary-button:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-green {
  background: #16a34a !important;
  color: #ffffff !important;
}

.btn-green:hover:not(:disabled) {
  background: #15803d !important;
  transform: translateY(-1px);
}

.btn-green:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-learn {
  flex: 1;
  padding: 14px 16px;
  min-height: 50px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 16px;
  background: var(--primary-color, #2563eb);
  color: #ffffff;
  border: none;
  box-shadow: 0 3px 0 #1d4ed8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-learn:hover {
  background: var(--primary-hover, #1d4ed8);
  transform: translateY(-1px);
}

.btn-learn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #1d4ed8;
}

.btn-know {
  flex: 1;
  padding: 14px 16px;
  min-height: 50px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 16px;
  background: #16a34a;
  color: #ffffff;
  border: none;
  box-shadow: 0 3px 0 #15803d;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-know:hover {
  background: #15803d;
  transform: translateY(-1px);
}

.btn-know:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #15803d;
}

.secondary-button {
  width: 100%;
  min-height: 52px;
  height: 52px;
  box-sizing: border-box;
  background: #f1f5f9;
  color: var(--text-main);
  border: 1.5px solid var(--border-color);
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-size: 16.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dark-theme .secondary-button {
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
}

.secondary-button:hover:not(:disabled) {
  background: #e2e8f0;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.dark-theme .secondary-button:hover:not(:disabled) {
  background: #334155;
  border-color: #475569;
}

.secondary-button:active:not(:disabled) {
  transform: translateY(1px);
}

/* Result Box */
.result-card {
  margin-top: 20px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
}

.result-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.result-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.next-button {
  margin-top: 14px;
  background: var(--success-color);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

/* Pages Header */
.page-header {
  margin-bottom: 20px;
}

.page-header h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.subtitle {
  color: var(--text-muted);
  margin: 0;
  font-size: 14px;
}

.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

/* Stats Page & Curriculum Block */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  font-size: 26px;
  flex-shrink: 0;
}

.stat-info h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.stat-info p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
}

.curriculum-block {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.wotd-standalone-wrapper {
  margin-top: 16px;
}

/* Gold VIP Bank Card styling for Word of the Day */
/* Gold VIP Bank Card styling for Word of the Day - Premium Gold-on-Dark always */
.wotd-card .flashcard-face {
  background: 
    linear-gradient(45deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0.08) 16%, rgba(255, 255, 255, 0) 30%),
    linear-gradient(135deg, #713f12 0%, #a16207 24%, #ca8a04 46%, #eab308 64%, #854d0e 82%, #451a03 100%);
  border: 1.5px solid rgba(253, 224, 71, 0.7);
  border-top-color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 4px 14px rgba(202, 138, 4, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.35);
}

.wotd-card .flashcard-face {
  transform: rotateX(0deg) translateZ(1px);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.wotd-card .flashcard-face.flashcard-back {
  transform: rotateX(180deg) translateZ(1px);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(45deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0.08) 16%, rgba(255, 255, 255, 0) 30%),
    linear-gradient(135deg, #713f12 0%, #a16207 24%, #ca8a04 46%, #eab308 64%, #854d0e 82%, #451a03 100%);
}

/* Delicate sliding specular glint along the top-right card rim */
.card-edge-rim-glint {
  position: absolute;
  top: -1px;
  right: 14px;
  width: 44px;
  height: 2.5px;
  background: linear-gradient(90deg, transparent 0%, #ffffff 50%, #fef08a 70%, transparent 100%);
  box-shadow: 0 0 6px 1px rgba(255, 255, 255, 0.95), 0 0 10px 2px rgba(253, 224, 71, 0.7);
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
}

.wotd-card.gleam-active .card-edge-rim-glint {
  animation: edgeRimGlint 0.65s ease-out 0.35s forwards;
}

@keyframes edgeRimGlint {
  0% {
    opacity: 0;
    transform: translateX(-45px);
  }
  30% {
    opacity: 1;
  }
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(18px);
  }
}

/* 3D Embossed Relief Text (Выпуклый объёмный шрифт с внутренней светотенью) */
.wotd-card .embossed-text {
  background: linear-gradient(180deg, #ffffff 0%, #ffffff 28%, #e2e8f0 55%, #cbd5e1 78%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 1.5px;
  font-weight: 900;
  filter: 
    drop-shadow(-1px -1px 0px rgba(255, 255, 255, 0.95))
    drop-shadow(1px 1.5px 0px rgba(69, 26, 3, 0.95))
    drop-shadow(0px 3px 6px rgba(0, 0, 0, 0.65));
}

.dark-theme .wotd-card .embossed-text {
  background: linear-gradient(180deg, #ffffff 0%, #ffffff 28%, #e2e8f0 55%, #cbd5e1 78%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: 
    drop-shadow(-1px -1px 0px rgba(255, 255, 255, 0.95))
    drop-shadow(1px 1.5px 0px rgba(69, 26, 3, 0.98))
    drop-shadow(0px 4px 8px rgba(0, 0, 0, 0.75));
}

.wotd-card .flashcard-flip-prompt {
  color: rgba(255, 255, 255, 0.95);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.wotd-card .flashcard-sound-btn,
.wotd-card .flashcard-fav-btn {
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px solid rgba(253, 224, 71, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2;
}

.wotd-card .flashcard-crown-btn {
  position: relative;
  background: transparent;
  border: none;
  border-radius: 0;
  width: 42px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease;
  overflow: visible;
  z-index: 2;
}

.wotd-card .flashcard-crown-btn:hover {
  transform: scale(1.1);
}

.wotd-card .wotd-crown-icon {
  width: 38px;
  height: 30px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.45));
  pointer-events: none;
}

/* Sparkle glint on top tip of crown */
.wotd-card .crown-glint {
  position: absolute;
  top: 7px;
  left: 22px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffffff;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
  z-index: 5;
}

.wotd-card .crown-glint::before,
.wotd-card .crown-glint::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, #ffffff, #fef08a, #ffffff, transparent);
  transform: translate(-50%, -50%);
  border-radius: 2px;
}

.wotd-card .crown-glint::before {
  width: 22px;
  height: 2.5px;
}

.wotd-card .crown-glint::after {
  width: 2.5px;
  height: 22px;
  background: linear-gradient(180deg, transparent, #ffffff, #fef08a, #ffffff, transparent);
}

.wotd-card .crown-glint.sparkle-active {
  animation: crownHornSparkle 1.1s cubic-bezier(0.16, 1, 0.3, 1) 2.5s forwards;
}

@keyframes crownHornSparkle {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0) rotate(0deg);
    box-shadow: 0 0 0px #ffffff;
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.6) rotate(45deg);
    box-shadow: 0 0 10px #ffffff, 0 0 20px #fef08a, 0 0 30px #eab308;
  }
  50% {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(1.1) rotate(90deg);
    box-shadow: 0 0 8px #ffffff, 0 0 14px #fef08a;
  }
  75% {
    opacity: 0.3;
    transform: translate(-50%, -50%) scale(0.5) rotate(135deg);
    box-shadow: 0 0 4px #ffffff;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0) rotate(180deg);
    box-shadow: 0 0 0px #ffffff;
  }
}

/* Elegant premium italic typography for "Слово дня" with internal 3D depth */
.wotd-card-badge {
  font-family: 'Playfair Display', 'Cormorant Garamond', 'Georgia', serif;
  font-style: italic;
  font-weight: 600;
  font-size: 21px;
  letter-spacing: 0.6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  user-select: none;
  background: linear-gradient(180deg, #ffffff 0%, #ffffff 30%, #fef08a 65%, #ca8a04 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  border: none;
  padding: 0;
  filter: 
    drop-shadow(-1px -1px 0px rgba(255, 255, 255, 0.85))
    drop-shadow(1px 1px 0px rgba(69, 26, 3, 0.9))
    drop-shadow(0px 2px 6px rgba(0, 0, 0, 0.6));
}

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

.section-title-row h3 {
  margin: 0;
  font-size: 16px;
}

.total-words-badge {
  font-size: 12px;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 12px;
  color: var(--text-muted);
}

.category-row {
  margin-bottom: 16px;
}

.category-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.category-progress-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

.category-progress-fill {
  height: 100%;
  background: var(--primary-color);
  border-radius: 10px;
  transition: width 0.4s ease;
}

/* Settings Page */
.settings-page {
  max-width: 540px;
  margin: 0 auto;
}

.settings-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin-bottom: 7px;
}

.settings-card-title,
.settings-card h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 6px 0;
}

.profile-card {
  display: flex;
  gap: 10px;
  align-items: center;
}

.profile-name {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}

.profile-sub {
  font-size: 12px;
  margin: 2px 0 0;
  color: var(--text-muted);
}

.settings-auth-btn {
  width: auto !important;
  padding: 6px 14px !important;
  min-height: 34px !important;
  height: 34px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
}

.settings-page .custom-dropdown-trigger {
  height: 38px;
  min-height: 38px;
  padding: 0 12px;
  font-size: 14px;
}

#clear-app-cache-btn {
  width: 100%;
  min-height: 36px;
  height: 36px;
  font-weight: 600;
  font-size: 14px;
}

/* Avatar styles */
.header-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.header-profile-badge.has-avatar {
  padding: 0;
  overflow: hidden;
  border-color: #22c55e;
}

.profile-avatar-wrapper {
  position: relative;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  cursor: pointer;
  user-select: none;
}

.profile-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2px solid var(--primary-color);
  transition: filter 0.2s ease;
}

.profile-avatar-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #e2e8f0;
  color: var(--text-main);
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed var(--border-color);
  transition: all 0.2s ease;
}

.dark-theme .profile-avatar-placeholder {
  background: #334155;
  color: #f8fafc;
}

.avatar-edit-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  background: var(--primary-color);
  border-radius: 50%;
  color: #ffffff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.15s ease;
}

.dark-theme .avatar-edit-badge {
  border-color: #1e293b;
}

.profile-avatar-wrapper:hover .avatar-edit-badge {
  transform: scale(1.15);
}

.profile-avatar-wrapper:hover .profile-avatar-img {
  filter: brightness(0.9);
}

.profile-avatar-wrapper:hover .profile-avatar-placeholder {
  border-color: var(--primary-color);
  background: #eff6ff;
}

.dark-theme .profile-avatar-wrapper:hover .profile-avatar-placeholder {
  background: #475569;
}

/* Avatar Picker Modal */
.avatar-picker-modal-content {
  max-width: 360px;
  width: 90%;
  padding: 20px 18px;
  border-radius: var(--radius-lg);
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  animation: scaleUp 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.avatar-grid-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-height: 380px;
  overflow-y: auto;
  padding: 4px 2px;
  margin-bottom: 16px;
}

.avatar-grid-item {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: #f1f5f9;
  border: 2.5px solid transparent;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  box-sizing: border-box;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dark-theme .avatar-grid-item {
  background: #1e293b;
}

.avatar-grid-item:hover {
  transform: scale(1.08);
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.avatar-grid-item.selected {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.15);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.35);
  transform: scale(1.04);
}

.avatar-grid-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.avatar-check-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #22c55e;
  border-radius: 50%;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}

.dark-theme .avatar-check-badge {
  border-color: #1e293b;
}

.avatar-modal-footer {
  display: flex;
  justify-content: center;
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
}

.avatar-action-link {
  font-size: 12px;
  color: var(--primary-color);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  font-weight: 500;
  transition: opacity 0.15s ease;
}

.avatar-action-link:hover {
  opacity: 0.8;
}

.avatar-action-link.delete-link {
  color: #ef4444;
}

.profile-details {
  flex: 1;
}

.profile-details h3 {
  margin: 0;
  font-size: 15px;
}

.profile-details p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.card-desc {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: -4px;
  margin-bottom: 16px;
}

.methods-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.label-text strong {
  display: block;
  font-size: 14px;
}

.label-text small {
  color: var(--text-muted);
}

.setting-field {
  margin-bottom: 14px;
}

.setting-field label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
}

.settings-select {
  width: 100%;
  height: 44px;
  min-height: 44px;
  box-sizing: border-box;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  font-size: 15px;
  font-weight: 600;
  background: var(--bg-card, #ffffff);
  color: var(--text-main);
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.settings-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.dark-theme .settings-select {
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
}

/* Custom In-Container Dropdown for Settings */
.custom-dropdown {
  position: relative;
  width: 100%;
}

.custom-dropdown-trigger {
  width: 100%;
  height: 46px;
  min-height: 46px;
  box-sizing: border-box;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  font-size: 15px;
  font-weight: 600;
  background: var(--card-bg, #ffffff);
  color: var(--text-main);
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.dark-theme .custom-dropdown-trigger,
[data-theme="dark"] .custom-dropdown-trigger,
body.dark-theme .custom-dropdown-trigger {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

.custom-dropdown-trigger:hover,
.custom-dropdown-trigger:focus {
  border-color: var(--primary-color, #22c55e);
}

.custom-dropdown-trigger .dropdown-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

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

.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  width: 100%;
  box-sizing: border-box;
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  z-index: 100;
  max-height: 260px;
  overflow-y: auto;
  display: none;
  animation: dropdownFade 0.15s ease;
}

@keyframes dropdownFade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.dark-theme .custom-dropdown-menu {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.custom-dropdown.open .custom-dropdown-menu {
  display: block;
}

.custom-dropdown-item,
.dropdown-item {
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  line-height: 1.35;
}

.dark-theme .custom-dropdown-item,
.dark-theme .dropdown-item {
  color: #f8fafc;
}

.custom-dropdown-item:hover,
.dropdown-item:hover {
  background: var(--bg-hover, #f1f5f9);
}

.dark-theme .custom-dropdown-item:hover,
.dark-theme .dropdown-item:hover {
  background: #334155;
}

.custom-dropdown-item.selected,
.dropdown-item.selected {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
  font-weight: 700;
}

.dark-theme .custom-dropdown-item.selected,
.dark-theme .dropdown-item.selected {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.dict-cat-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.dict-cat-check {
  font-weight: 800;
  font-size: 14px;
  color: #16a34a;
  margin-left: 8px;
}

.dark-theme .dict-cat-check {
  color: #4ade80;
}

@keyframes hourglassFlip {
  0% { transform: rotate(0deg); }
  45% { transform: rotate(180deg); }
  55% { transform: rotate(180deg); }
  95% { transform: rotate(360deg); }
  100% { transform: rotate(360deg); }
}

.hourglass-flip {
  display: inline-block;
  animation: hourglassFlip 1.6s infinite ease-in-out;
  transform-origin: center center;
  line-height: 1;
  margin-right: 6px;
  vertical-align: middle;
}

.train-left-badge {
  font-size: 13px;
  font-weight: 600;
  color: #16a34a;
  margin-bottom: 8px;
  background: rgba(22, 163, 74, 0.08);
  padding: 4px 12px;
  border-radius: 12px;
  display: inline-block;
}

.autosave-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.autosave-badge {
  background: rgba(22, 163, 74, 0.12);
  color: var(--success-color, #16a34a);
  border: 1px solid rgba(22, 163, 74, 0.25);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dark-theme .autosave-badge {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.35);
}

.save-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.save-status {
  color: var(--success-color);
  font-weight: 600;
}

/* Favorites Grid & Dictionary */
.favorites-grid, .dictionary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.fav-card, .dict-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 12px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.dict-card.mastered, .fav-card.mastered {
  background: #dcfce7 !important;
  border: 2px solid #22c55e !important;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.25) !important;
}

.dark-theme .dict-card.mastered, .dark-theme .fav-card.mastered {
  background: #064e3b !important;
  border: 2px solid #10b981 !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
}

.dark-theme .dict-card.mastered h3 {
  color: #f0fdf4 !important;
}

.dark-theme .dict-card.mastered .dict-translation {
  color: #86efac !important;
}

.mastered-badge {
  background: #22c55e;
  color: #ffffff;
  border: 1px solid #16a34a;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.dark-theme .mastered-badge {
  background: #059669;
  color: #ffffff;
  border-color: #10b981;
}

.in-progress-badge {
  background: rgba(234, 179, 8, 0.15);
  color: #ca8a04;
  border: 1px solid rgba(234, 179, 8, 0.35);
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.dark-theme .in-progress-badge {
  background: rgba(234, 179, 8, 0.2);
  color: #fde047;
  border-color: rgba(250, 204, 21, 0.4);
}

/* Category Selection Tiles (matches Dictionary Card style) */
.category-tile-card {
  cursor: pointer;
  position: relative;
  text-align: left;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 14px 12px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.category-tile-card:hover {
  transform: translateY(-2px);
  border-color: #3b82f6;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.16);
}

.category-tile-card:active {
  transform: scale(0.98);
}

.category-tile-card.active {
  border: 2px solid #2563eb;
  background: #f0f7ff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.18);
}

.dark-theme .category-tile-card {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.dark-theme .category-tile-card:hover {
  border-color: #60a5fa;
  box-shadow: 0 4px 14px rgba(96, 165, 250, 0.22);
}

.dark-theme .category-tile-card.active {
  border-color: #3b82f6;
  background: #172554;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.28);
}

.dark-theme .category-tile-card h3 {
  color: #f8fafc;
}

.dark-theme .category-tile-card .dict-translation {
  color: #94a3b8;
}

.fav-card-top, .dict-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fav-card-actions, .dict-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.fav-audio-btn, .dict-audio-btn, .remove-fav-btn, .fav-icon-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: transform 0.15s ease, background 0.15s ease;
  line-height: 1;
}

.fav-audio-btn:hover, .dict-audio-btn:hover, .remove-fav-btn:hover, .fav-icon-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  transform: scale(1.12);
}

.fav-audio-btn:active, .dict-audio-btn:active, .remove-fav-btn:active, .fav-icon-btn:active {
  transform: scale(0.92);
}

.dark-theme .fav-audio-btn:hover, .dark-theme .dict-audio-btn:hover, .dark-theme .remove-fav-btn:hover, .dark-theme .fav-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.fav-sticky-controls {
  position: -webkit-sticky;
  position: sticky;
  top: var(--fav-sticky-top, 58px);
  z-index: 25;
  background: var(--bg-main, #ffffff);
  padding: 4px 0 10px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.dark-theme .fav-sticky-controls {
  background: #0f172a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.fav-word, .dict-card h3 {
  margin: 6px 0 2px;
  font-size: 17px;
  line-height: 1.25;
  font-weight: 700;
}

.fav-transcription, .dict-transcription {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-muted);
}

.fav-translation, .dict-translation {
  margin: 3px 0 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--primary-color);
  line-height: 1.3;
}

.sound-button-sm {
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: all 0.15s ease;
}

.dictionary-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
  width: 100%;
  box-sizing: border-box;
  position: -webkit-sticky;
  position: sticky;
  top: var(--dict-sticky-top, 58px);
  z-index: 25;
  background: var(--bg-main, #ffffff);
  padding: 6px 0 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.dark-theme .dictionary-controls {
  background: #0f172a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.search-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 13.5px;
  background: var(--card-bg, #ffffff);
  color: var(--text-main);
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s ease;
}

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

.filter-select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 42px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 13.5px;
  font-weight: 600;
  background: var(--card-bg, #ffffff);
  color: var(--text-main);
  box-sizing: border-box;
  outline: none;
  cursor: pointer;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  transition: border-color 0.2s ease;
}

.dict-dropdown {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  position: relative;
}

.dict-dropdown .custom-dropdown-trigger {
  width: 100%;
  height: 42px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-sizing: border-box;
  font-size: 13.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg, #ffffff);
  color: var(--text-main);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.dark-theme .dict-dropdown .custom-dropdown-trigger,
[data-theme="dark"] .dict-dropdown .custom-dropdown-trigger,
body.dark-theme .dict-dropdown .custom-dropdown-trigger {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

.dark-theme .dict-dropdown .custom-dropdown-trigger .dropdown-arrow,
[data-theme="dark"] .dict-dropdown .custom-dropdown-trigger .dropdown-arrow,
body.dark-theme .dict-dropdown .custom-dropdown-trigger .dropdown-arrow {
  color: #94a3b8 !important;
}

.dict-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  width: 100%;
  min-width: 100%;
  max-height: 280px;
  overflow-y: auto;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--card-bg, #ffffff);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  padding: 4px 0;
  z-index: 100;
  box-sizing: border-box;
}

.dark-theme .dict-dropdown-menu,
[data-theme="dark"] .dict-dropdown-menu,
body.dark-theme .dict-dropdown-menu {
  background: #1e293b !important;
  border-color: #334155 !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45) !important;
}

.filter-select:focus {
  border-color: var(--primary-color);
}

.dark-theme .search-input,
.dark-theme .filter-select,
[data-theme="dark"] .search-input,
[data-theme="dark"] .filter-select,
body.dark-theme .search-input,
body.dark-theme .filter-select {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

/* Auth Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 420px;
  padding: 24px;
  position: relative;
  box-shadow: var(--shadow-md);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
}

.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 20px;
}

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

.auth-tab.active {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
  margin-bottom: -2px;
}

/* Google Auth Button & Divider */
.social-auth-section {
  margin-bottom: 16px;
  width: 100%;
}

.google-auth-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  min-height: 46px;
  height: 46px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
}

.google-auth-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.dark-theme .google-auth-btn {
  background: #0f172a;
  border-color: #475569;
  color: #f8fafc;
}

.dark-theme .google-auth-btn:hover {
  background: #1e293b;
  border-color: #64748b;
}

.google-auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}

.auth-divider span {
  padding: 0 10px;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.auth-error {
  background: #fef2f2;
  color: #991b1b;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
}

.empty-favorites-box {
  text-align: center;
  padding: 40px 20px;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
}

.empty-icon {
  font-size: 48px;
}

/* Leaderboard Page Styles */
.leaderboard-page {
  padding-bottom: 70px;
  margin-top: -12px;
  margin-left: -14px;
  margin-right: -14px;
}

.leaderboard-sticky-group {
  position: sticky;
  top: 54px;
  z-index: 45;
  background: var(--bg-main, var(--bg-color, #ffffff));
  padding: 8px 14px 6px 14px;
  border-bottom: 1.5px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform;
}

.leaderboard-sticky-group::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 0;
  right: 0;
  height: 4px;
  background: inherit;
  z-index: 1;
}

#leaderboard-content {
  padding: 8px 14px 0 14px;
}

.refresh-leaderboard-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  width: 30px;
  height: 30px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.15s ease;
  color: var(--text-main);
  padding: 0;
}

.refresh-leaderboard-btn:hover {
  background: var(--border-color);
  transform: rotate(45deg);
}

.dark-theme .refresh-leaderboard-btn {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

.dark-theme .refresh-leaderboard-btn:hover {
  background: #2a3b52;
}

.refresh-leaderboard-btn.is-loading {
  animation: spinLeaderboard 0.8s linear infinite;
  pointer-events: none;
  opacity: 0.7;
}

@keyframes spinLeaderboard {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Leaderboard Header Symmetrical Chips (3fr 1fr Grid matching podium cards) */
.leaderboard-top-row {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 8px;
  width: 100%;
  margin-bottom: 8px;
  align-items: stretch;
  box-sizing: border-box;
}

.leaderboard-top-row.no-timer {
  grid-template-columns: 1fr;
}

.leaderboard-top-row .custom-dropdown {
  width: 100%;
  min-width: 0;
  display: flex;
}

.leaderboard-header-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-md, 12px);
  background: #f1f5f9;
  border: 1.5px solid var(--border-color, #e2e8f0);
  color: var(--text-main, #0f172a);
  font-size: 14.5px;
  font-weight: 800;
  box-sizing: border-box;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
  width: 100%;
}

button.leaderboard-header-chip {
  cursor: pointer;
  font-family: inherit;
  user-select: none;
  justify-content: space-between;
}

button.leaderboard-header-chip:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.custom-dropdown.open button.leaderboard-header-chip {
  border-color: var(--primary-color, #3b82f6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

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

.leaderboard-timer-chip {
  flex-shrink: 0;
  font-size: 13.5px;
  font-weight: 700;
  cursor: default;
  color: var(--text-main, #0f172a);
  justify-content: center;
  padding: 0 8px;
}

.dark-theme .leaderboard-header-chip {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}

.dark-theme button.leaderboard-header-chip:hover {
  background: #273549;
  border-color: #475569;
}

.dark-theme .custom-dropdown.open button.leaderboard-header-chip {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.25);
}

.notebook-theme .leaderboard-header-chip {
  background: #fffdf5;
  border-color: #d4c5a9;
  color: #2c2518;
}

.league-timer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-md, 12px);
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  box-sizing: border-box;
}

.dark-theme .league-timer-badge {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

.scoring-rules-banner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 16px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-sizing: border-box;
}

@media (max-width: 500px) {
  .scoring-rules-banner {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}

.dark-theme .scoring-rules-banner {
  background: #1e293b;
  border-color: #334155;
}

.rule-chip {
  font-size: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 6px 4px;
  border-radius: 6px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  min-width: 0;
  box-sizing: border-box;
}

.dark-theme .rule-chip {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

.rule-chip.error-chip {
  border-color: #e2e8f0;
  background: #ffffff;
  color: var(--text-main);
}

.dark-theme .rule-chip.error-chip {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

.rule-chip-icon {
  margin-right: 4px;
}

.rule-chip-val {
  margin-left: 4px;
  font-weight: 800;
}

.rule-chip.error-chip .error-xp-val {
  color: #ef4444;
  margin-left: 4px;
  font-weight: 800;
}

.dark-theme .rule-chip.error-chip .error-xp-val {
  color: #f87171;
  margin-left: 4px;
  font-weight: 800;
}

/* Sticky Podium Top 4 Container */
.podium-sticky-wrapper {
  position: -webkit-sticky;
  position: sticky;
  top: var(--podium-sticky-top, 58px);
  z-index: 25;
  background: var(--bg-main, #ffffff);
  padding: 4px 0 8px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.dark-theme .podium-sticky-wrapper {
  background: #0f172a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Podium Top 4 Grid */
.podium-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 0;
}

@media (min-width: 520px) {
  .podium-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.podium-card {
  position: relative;
  background: linear-gradient(180deg, #fff7ed 0%, #ffffff 100%);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 6px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.dark-theme .podium-card {
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.15) 0%, #1e293b 100%);
  border-color: #334155;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}



.podium-card.is-me {
  box-shadow: 0 0 0 2px #22c55e, 0 4px 12px rgba(34, 197, 94, 0.2);
}

.podium-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 26px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.28));
}

.podium-avatar-wrapper {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  margin-bottom: 4px;
}

.podium-avatar-wrapper.has-wreath {
  overflow: visible;
}

.diamond-laurel-wreath {
  position: absolute;
  top: -7px;
  left: -7px;
  width: 52px;
  height: 52px;
  pointer-events: none;
  z-index: 3;
}

.podium-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #ffffff;
  background: #f1f5f9;
}

.dark-theme .podium-avatar-img {
  border-color: #334155;
  background: #0f172a;
}

.podium-avatar-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #3b82f6;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  border: 1.5px solid #ffffff;
}

.podium-rank-num {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: #0f172a;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 999px;
  border: 1.5px solid #ffffff;
}

.dark-theme .podium-rank-num {
  background: #f8fafc;
  color: #0f172a;
  border-color: #1e293b;
}

.podium-info {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.podium-name {
  font-size: 13.5px;
  font-weight: 700;
  margin: 0 0 2px;
  width: 100%;
  line-height: 1.2;
  word-break: normal;
  overflow-wrap: break-word;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 94%;
  text-align: center;
}

.podium-xp {
  font-size: 13px;
  font-weight: 800;
  color: #16a34a;
  line-height: 1.1;
}

.dark-theme .podium-xp {
  color: #4ade80;
}

/* Leaderboard List for #5+ */
.leaderboard-table {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 20px;
}

.dark-theme .leaderboard-table {
  background: #1e293b;
  border-color: #334155;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
  transition: background 0.15s ease;
}

.dark-theme .leaderboard-row {
  border-bottom-color: #334155;
}

.leaderboard-row:last-child {
  border-bottom: none;
}

.leaderboard-row.is-me {
  background: rgba(34, 197, 94, 0.08);
}

.dark-theme .leaderboard-row.is-me {
  background: rgba(34, 197, 94, 0.15);
}

.row-rank {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  width: 24px;
  text-align: center;
}

.row-avatar-wrapper {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}

.row-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #f1f5f9;
}

.row-avatar-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #64748b;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.row-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.me-tag {
  color: #16a34a;
  font-size: 12px;
  font-weight: 700;
}

.row-xp {
  font-size: 14px;
  font-weight: 800;
  color: #16a34a;
}

.dark-theme .row-xp {
  color: #4ade80;
}

/* Sticky Bottom User Bar */
.my-leaderboard-bar {
  position: sticky;
  bottom: 80px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid #16a34a;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
  margin-top: 10px;
  z-index: 10;
}

.dark-theme .my-leaderboard-bar {
  background: #1e293b;
  border-color: #22c55e;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.my-rank-badge {
  font-size: 14px;
  font-weight: 800;
  background: #16a34a;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 6px;
}

.dark-theme .my-rank-badge {
  background: #22c55e;
  color: #0f172a;
}

.my-bar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #22c55e;
}

.my-bar-avatar-placeholder {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #3b82f6;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.my-bar-xp {
  font-size: 16px;
  font-weight: 800;
  color: #16a34a;
}

.dark-theme .my-bar-xp {
  color: #4ade80;
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .stat-card {
    padding: 10px 6px;
    gap: 6px;
  }

  .stat-icon {
    font-size: 20px;
  }

  .stat-info h3 {
    font-size: 15px;
    white-space: nowrap;
  }

  .stat-info p {
    font-size: 11px;
    white-space: nowrap;
  }

}

@media (max-width: 520px) {
  .favorites-grid, .dictionary-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}



.pairs-title {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.notebook-theme .pairs-title {
  font-family: 'Caveat', cursive !important;
  font-size: 21px !important;
  font-weight: 700 !important;
  color: var(--nb-blue-pen) !important;
  letter-spacing: 0.5px;
}

.app-main-content,
.word-card-container {
  position: relative;
  z-index: 5;
}

@media (max-width: 340px) {
  .stats-grid {
    gap: 4px;
  }

  .stat-card {
    padding: 8px 4px;
    gap: 4px;
  }

  .stat-icon {
    font-size: 17px;
  }

  .stat-info h3 {
    font-size: 13.5px;
  }

  .stat-info p {
    font-size: 10px;
  }
}

/* Wide Screen Framing (Screens > 680px) */
@media (min-width: 681px) {
  body {
    background: #e2e8f0;
  }

  body.dark-theme {
    background: #090d16;
  }

  .mobile-app {
    border-left: 1.5px solid var(--border-color);
    border-right: 1.5px solid var(--border-color);
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.12);
  }

  .dark-theme .mobile-app {
    border-left: 1.5px solid #334155;
    border-right: 1.5px solid #334155;
    box-shadow: 0 0 45px rgba(0, 0, 0, 0.6);
  }

  .bottom-nav {
    border-left: 1.5px solid var(--border-color);
    border-right: 1.5px solid var(--border-color);
  }

  .dark-theme .bottom-nav {
    border-left: 1.5px solid #334155;
    border-right: 1.5px solid #334155;
  }
}

/* ==========================================================================
   PRIZE PODIUM CELEBRATION & CONFETTI
   ========================================================================== */
.prize-podium-backdrop {
  z-index: 10000;
  backdrop-filter: blur(8px);
  background: rgba(15, 23, 42, 0.75);
  animation: fadeIn 0.3s ease;
}

.prize-podium-content {
  position: relative;
  overflow: hidden;
  text-align: center;
  max-width: 360px;
  width: 90%;
  padding: 32px 24px 28px;
  border-radius: 28px;
  background: var(--bg-card, #ffffff);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
  animation: popInBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dark-theme .prize-podium-content {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.podium-shine-effect {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
  pointer-events: none;
  animation: shineRotate 12s linear infinite;
}

@keyframes shineRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes popInBounce {
  0% { transform: scale(0.65); opacity: 0; }
  70% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.prize-icon-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary, #f8fafc);
  border: 3px solid rgba(255, 255, 255, 0.4);
  animation: prizeIconPulse 2s ease-in-out infinite;
}

.dark-theme .prize-icon-circle {
  background: #0f172a;
}

.prize-huge-icon {
  font-size: 50px;
  line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.2));
}

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

.prize-badge-pill {
  display: inline-block;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 5px 14px;
  border-radius: 20px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-bottom: 12px;
}

.prize-congrats-title {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 6px;
  color: var(--text-primary, #0f172a);
}

.dark-theme .prize-congrats-title {
  color: #f8fafc;
}

.prize-congrats-subtitle {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 18px;
  color: #10b981;
}

.prize-rank-box {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 22px;
}

.dark-theme .prize-rank-box {
  background: rgba(255, 255, 255, 0.05);
}

.prize-rank-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
}

.dark-theme .prize-rank-name {
  color: #f1f5f9;
}

.prize-rank-desc {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  margin-top: 2px;
}

.prize-continue-btn {
  width: 100%;
  font-size: 16px;
  font-weight: 700;
  padding: 14px;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
}

/* ==========================================================================
   CONFETTI PARTICLES
   ========================================================================== */
.confetti-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 10001;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  opacity: 0.9;
  border-radius: 2px;
}

.confetti-circle {
  border-radius: 50% !important;
}

.confetti-star {
  line-height: 1;
  text-align: center;
}

@keyframes confettiFall {
  0% {
    top: -20px;
    transform: translateX(0) rotateZ(0deg) rotateY(0deg);
    opacity: 1;
  }
  25% {
    transform: translateX(18px) rotateZ(90deg) rotateY(180deg);
  }
  50% {
    transform: translateX(-18px) rotateZ(180deg) rotateY(360deg);
  }
  75% {
    transform: translateX(12px) rotateZ(270deg) rotateY(540deg);
  }
  100% {
    top: 105vh;
    transform: translateX(-12px) rotateZ(360deg) rotateY(720deg);
    opacity: 0.2;
  }
}

/* ==========================================================================
   SPEECH RECOGNITION & QUIZ STAGES
   ========================================================================== */
.listening-word-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(59, 130, 246, 0.08);
  border: 1.5px dashed var(--primary-color);
  border-radius: var(--radius-md);
  padding: 6px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.listening-word-box:hover {
  background: rgba(59, 130, 246, 0.15);
  transform: scale(1.02);
}

.dark-theme .listening-word-box {
  background: rgba(59, 130, 246, 0.16);
  border-color: #60a5fa;
}

.listening-audio-icon {
  font-size: 20px;
  line-height: 1;
}

.listening-word-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-color);
  transition: all 0.2s ease;
}

.dark-theme .listening-word-text {
  color: #93c5fd;
}

.speech-quiz-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 12px 48px;
  width: 100%;
  box-sizing: border-box;
  position: relative;
}

.speech-mic-btn {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  border: none;
  font-size: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.speech-mic-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.45);
}

.speech-mic-btn:active,
.speech-mic-btn.holding {
  transform: scale(0.92);
}

.speech-hold-hint {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
}

.speech-mic-btn.listening {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  animation: micPulseRippleYellow 1.1s infinite;
}

.speech-mic-btn.processing {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  animation: micPulseRippleYellow 0.9s infinite;
}

.speech-mic-btn.success {
  background: linear-gradient(135deg, #22c55e, #16a34a) !important;
  box-shadow: 0 0 25px rgba(34, 197, 94, 0.6) !important;
  transform: scale(1.08);
}

@keyframes micPulseRippleYellow {
  0% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.75);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 20px rgba(245, 158, 11, 0);
    transform: scale(1.08);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    transform: scale(1);
  }
}

.speech-status-msg {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  text-align: center;
  min-height: 28px;
  margin-top: 16px;
  line-height: 1.4;
}

.speech-transcript-box {
  font-size: 13.5px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 12px;
  margin-top: 10px;
  max-width: 300px;
  text-align: center;
}

.dark-theme .speech-transcript-box {
  background: rgba(255, 255, 255, 0.06);
}

.speech-cant-speak-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  margin-top: 18px;
  padding: 4px 8px;
  opacity: 0.85;
  transition: all 0.2s ease;
}

.speech-cant-speak-btn:hover {
  opacity: 1;
  color: var(--primary-color);
}

.card-bottom-diag-btn {
  position: absolute;
  bottom: 12px;
  left: 14px;
  background: transparent;
  border: none;
  font-size: 18px;
  opacity: 0.45;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease, transform 0.25s ease;
  line-height: 1;
  user-select: none;
}

.card-bottom-diag-btn:hover {
  opacity: 1;
  transform: rotate(45deg) scale(1.1);
}

.card-bottom-diag-btn:active {
  transform: rotate(90deg) scale(0.95);
}

.speech-diag-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.speech-diag-card {
  background: var(--card-bg, #ffffff);
  color: var(--text-main, #1e293b);
  border-radius: 20px;
  padding: 24px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
}

.dark-theme .speech-diag-card {
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.speech-diag-title {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.speech-diag-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 10px;
}

.dark-theme .speech-diag-item {
  background: rgba(255, 255, 255, 0.05);
}

.speech-volume-meter-container {
  width: 100%;
  height: 16px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.dark-theme .speech-volume-meter-container {
  background: rgba(255, 255, 255, 0.1);
}

.speech-volume-meter-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
  border-radius: 8px;
  transition: width 0.08s ease;
}

.speech-diag-live-box {
  background: rgba(59, 130, 246, 0.08);
  border: 1px dashed var(--primary-color);
  padding: 12px;
  border-radius: 12px;
  font-size: 13.5px;
  text-align: center;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* ============================================================
   📓 NOTEBOOK THEME — graph paper + ballpoint pen aesthetic
   ============================================================ */

body.notebook-theme,
.mobile-app.notebook-theme {
  --nb-bg: #fdf8f0;
  --nb-card: #fffdf7;
  --nb-grid-color: #b8cfe8;
  --nb-line-color: #d0e4f5;
  --nb-blue-pen: #1a3a8f;
  --nb-black-pen: #1a1a2e;
  --nb-red-pen: #c0392b;
  --nb-green-pen: #1a7a3a;
  --nb-border: #7a9fc0;
  --nb-muted: #5a7a9a;
  --nb-shadow: 2px 3px 0px rgba(26, 58, 143, 0.12);

  /* Override global vars */
  --primary-color: #1a3a8f;
  --primary-hover: #152d6e;
  --success-color: #1a7a3a;
  --error-color: #c0392b;
  --bg-color: var(--nb-bg);
  --card-bg: var(--nb-card);
  --text-main: var(--nb-black-pen);
  --text-muted: var(--nb-muted);
  --border-color: var(--nb-grid-color);

  font-family: 'Caveat', 'Comic Sans MS', cursive !important;
  font-size: 18px !important;
  background-color: #eae3d8 !important; /* Elegant natural desk surface behind notebook sheet */
}

@media (max-width: 680px) {
  body.notebook-theme {
    background-color: var(--nb-bg) !important;
  }
}

.notebook-theme .mobile-app {
  position: relative !important;
  background-color: var(--nb-bg) !important;
  font-family: 'Caveat', cursive !important;

  /* Math notebook background — strictly kept INSIDE the notebook sheet */
  background-image:
    linear-gradient(rgba(164, 200, 232, 0.55) 1px, transparent 1px),
    linear-gradient(90deg, rgba(164, 200, 232, 0.55) 1px, transparent 1px) !important;
  background-size: 24px 24px !important;
  border-left: 2px solid var(--nb-border) !important;
  border-right: 2px solid var(--nb-border) !important;
  box-shadow: 0 4px 35px rgba(26, 58, 143, 0.15) !important;
}

/* Header */
.notebook-theme .mobile-header {
  background: #fffdf7 !important;
  border-bottom: 2px solid var(--nb-blue-pen) !important;
  font-family: 'Caveat', cursive !important;
  box-shadow: 0 2px 0 var(--nb-grid-color) !important;
}

.notebook-theme .mobile-header .app-title {
  font-family: 'Caveat', cursive !important;
  font-size: 24px !important;
  font-weight: 700 !important;
  color: var(--nb-blue-pen) !important;
  letter-spacing: 0.5px;
}

/* Bottom nav — notebook spiral binding */
.notebook-theme .bottom-nav {
  background: #fffdf7 !important;
  border-top: 2px solid var(--nb-blue-pen) !important;
  font-family: 'Caveat', cursive !important;
  position: fixed !important;
}



.notebook-theme .nav-btn {
  color: var(--nb-muted) !important;
  font-family: 'Caveat', cursive !important;
  font-size: 14px !important;
}

.notebook-theme .nav-btn.active,
.notebook-theme .nav-btn:hover {
  color: var(--nb-blue-pen) !important;
}

/* Cards — plain cream, NO grid on cards (grid only on page background) */
.notebook-theme .word-card-container,
.notebook-theme .stat-card,
.notebook-theme .settings-card,
.notebook-theme .fav-card,
.notebook-theme .dict-card,
.notebook-theme .modal-content,
.notebook-theme .empty-favorites-box {
  background: var(--nb-card) !important;
  background-image: none !important;
  border: 2px solid var(--nb-blue-pen) !important;
  border-radius: 4px 14px 6px 12px !important;
  box-shadow: var(--nb-shadow) !important;
  font-family: 'Caveat', cursive !important;
}

/* Training word */
.notebook-theme .training-word,
.notebook-theme .training-word-text {
  font-family: 'Caveat', cursive !important;
  font-size: 42px !important;
  font-weight: 700 !important;
  color: var(--nb-blue-pen) !important;
  letter-spacing: 1px;
}

.notebook-theme .card-translation {
  font-family: 'Caveat', cursive !important;
  color: var(--nb-black-pen) !important;
  font-size: 26px !important;
}

/* Quiz options */
.notebook-theme .quiz-option {
  background: var(--nb-card) !important;
  border: 2px solid var(--nb-blue-pen) !important;
  border-radius: 3px 10px 5px 8px !important;
  color: var(--nb-blue-pen) !important;
  font-family: 'Caveat', cursive !important;
  box-shadow: 2px 2px 0 rgba(26, 58, 143, 0.15) !important;
  transition: transform 0.1s ease, box-shadow 0.1s ease !important;
}

.notebook-theme .quiz-option-inner {
  font-family: 'Caveat', cursive !important;
  font-weight: 700 !important;
  color: var(--nb-blue-pen) !important;
  letter-spacing: 0.2px;
}

.notebook-theme .quiz-option:hover:not(:disabled) {
  background: rgba(26, 58, 143, 0.06) !important;
  transform: translate(-1px, -1px) !important;
  box-shadow: 3px 3px 0 rgba(26, 58, 143, 0.2) !important;
}

.notebook-theme .quiz-option.correct {
  background: rgba(26, 122, 58, 0.1) !important;
  border: 2.5px solid var(--nb-green-pen) !important;
  color: var(--nb-green-pen) !important;
  border-radius: 3px 10px 5px 8px !important;
}

.notebook-theme .quiz-option.wrong {
  background: rgba(192, 57, 43, 0.08) !important;
  border: 2.5px solid var(--nb-red-pen) !important;
  color: var(--nb-red-pen) !important;
  border-radius: 3px 10px 5px 8px !important;
  text-decoration: line-through;
}

/* Primary buttons */
.notebook-theme .primary-button,
.notebook-theme .btn-blue {
  background: var(--nb-blue-pen) !important;
  border: 2px solid #0f2660 !important;
  border-radius: 4px 12px 6px 10px !important;
  font-family: 'Caveat', cursive !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  box-shadow: 2px 2px 0 rgba(15, 38, 96, 0.3) !important;
}

.notebook-theme .primary-button:hover {
  transform: translate(-1px, -1px) !important;
  box-shadow: 3px 3px 0 rgba(15, 38, 96, 0.35) !important;
}

.notebook-theme .btn-green {
  background: var(--nb-green-pen) !important;
  border-color: #145c2b !important;
}

/* Mic button */
.notebook-theme .speech-mic-btn {
  background: linear-gradient(135deg, var(--nb-blue-pen), #2a4fa0) !important;
  border: 3px solid #0f2660 !important;
  border-radius: 50% !important;
  box-shadow: 3px 3px 0 rgba(15, 38, 96, 0.25) !important;
  font-size: 36px !important;
}

/* Flashcard */
.notebook-theme .flashcard-box {
  background: var(--nb-card) !important;
  border: 2px solid var(--nb-blue-pen) !important;
  border-radius: 4px 16px 8px 14px !important;
  box-shadow: var(--nb-shadow) !important;
  font-family: 'Caveat', cursive !important;
}

/* Inputs */
.notebook-theme .answer-input,
.notebook-theme .search-input,
.notebook-theme .filter-select,
.notebook-theme .settings-select,
.notebook-theme .form-group input {
  background: var(--nb-card) !important;
  border: 2px solid var(--nb-blue-pen) !important;
  border-radius: 3px 8px 4px 6px !important;
  color: var(--nb-black-pen) !important;
  font-family: 'Caveat', cursive !important;
  font-size: 18px !important;
  box-shadow: inset 1px 1px 0 rgba(26, 58, 143, 0.08) !important;
}

.notebook-theme .answer-input:focus,
.notebook-theme .search-input:focus {
  border-color: var(--nb-blue-pen) !important;
  box-shadow: 2px 2px 0 rgba(26, 58, 143, 0.2) !important;
  outline: none !important;
}

/* Mode pills */
.notebook-theme .mode-switch-pills {
  background: rgba(184, 207, 232, 0.3) !important;
  border: 1.5px solid var(--nb-border) !important;
  border-radius: 4px 12px 6px 10px !important;
}

.notebook-theme .mode-pill-glider {
  background: var(--nb-blue-pen) !important;
  border-radius: 3px 10px 5px 8px !important;
}

.notebook-theme .mode-pill-btn {
  font-family: 'Caveat', cursive !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  color: var(--nb-muted) !important;
}

.notebook-theme .mode-pill-btn.active {
  color: #fff !important;
}

/* Category badge */
.notebook-theme .category-badge,
.notebook-theme .total-words-badge {
  background: rgba(26, 58, 143, 0.08) !important;
  border: 1.5px solid var(--nb-blue-pen) !important;
  color: var(--nb-blue-pen) !important;
  font-family: 'Caveat', cursive !important;
  font-size: 15px !important;
  line-height: 1 !important;
  padding: 3px 8px !important;
  border-radius: 4px 8px 4px 7px !important;
  display: inline-flex !important;
  align-items: center !important;
  max-width: fit-content !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
}

/* Sound button */
.notebook-theme .sound-button-sm,
.notebook-theme .word-side-icon-btn {
  background: rgba(26, 58, 143, 0.08) !important;
  border: 1.5px solid var(--nb-border) !important;
  border-radius: 50% !important;
  color: var(--nb-blue-pen) !important;
}

/* Leaderboard / stats */
.notebook-theme .stat-label {
  font-family: 'Caveat', cursive !important;
  color: var(--nb-muted) !important;
  font-size: 18px !important;
}

.notebook-theme .stat-value {
  font-family: 'Caveat', cursive !important;
  color: var(--nb-blue-pen) !important;
  font-size: 28px !important;
  font-weight: 700 !important;
}

/* Pairs game cards */
.notebook-theme .pairs-card {
  background: var(--nb-card) !important;
  border: 2px solid var(--nb-blue-pen) !important;
  border-radius: 4px 12px 6px 10px !important;
  font-family: 'Caveat', cursive !important;
  font-weight: 700 !important;
  color: var(--nb-blue-pen) !important;
  box-shadow: 2px 2px 0 rgba(26, 58, 143, 0.12) !important;
}

.notebook-theme .pairs-card-inner {
  font-family: 'Caveat', cursive !important;
  font-weight: 700 !important;
  color: var(--nb-blue-pen) !important;
  letter-spacing: 0.2px;
}

/* Dictionary & Favorites Cards Typography in Notebook theme */
.notebook-theme .dict-card h3,
.notebook-theme .fav-word {
  font-family: 'Caveat', cursive !important;
  font-size: 22.5px !important;
  font-weight: 700 !important;
  color: var(--nb-blue-pen) !important;
  line-height: 1.2 !important;
  margin: 4px 0 2px !important;
}

.notebook-theme .dict-translation,
.notebook-theme .fav-translation {
  font-family: 'Caveat', cursive !important;
  font-size: 20px !important;
  font-weight: 600 !important;
  color: var(--nb-black-pen) !important;
  line-height: 1.25 !important;
  margin: 2px 0 4px !important;
}

.notebook-theme .dict-notes,
.notebook-theme .fav-card .dict-notes {
  font-family: 'Caveat', cursive !important;
  font-size: 15px !important;
  color: var(--nb-blue-pen) !important;
  opacity: 0.88 !important;
  line-height: 1.25 !important;
  margin-top: 4px !important;
}

.notebook-theme .pairs-card.selected {
  background: rgba(26, 58, 143, 0.1) !important;
  border-color: var(--nb-blue-pen) !important;
}

.notebook-theme .pairs-card.matched {
  background: rgba(26, 122, 58, 0.1) !important;
  border-color: var(--nb-green-pen) !important;
  color: var(--nb-green-pen) !important;
}

/* Theme toggle button */
.notebook-theme .theme-toggle-btn {
  background: rgba(26, 58, 143, 0.1) !important;
  border: 1.5px solid var(--nb-border) !important;
  color: var(--nb-blue-pen) !important;
}

/* Profile badge */
.notebook-theme .header-profile-badge {
  background: rgba(26, 58, 143, 0.08) !important;
  border: 1.5px solid var(--nb-border) !important;
  font-family: 'Caveat', cursive !important;
}

/* Theme option buttons in settings */
.notebook-theme .theme-option-btn,
.notebook-theme .voice-option-btn,
.notebook-theme .sound-option-btn {
  background: var(--nb-card) !important;
  border: 2px solid var(--nb-border) !important;
  border-radius: 4px 10px 5px 8px !important;
  color: var(--nb-muted) !important;
  font-family: 'Caveat', cursive !important;
  font-size: 16px !important;
}

.notebook-theme .theme-option-btn.active,
.notebook-theme .voice-option-btn.active,
.notebook-theme .sound-option-btn.active {
  background: rgba(26, 58, 143, 0.12) !important;
  border-color: var(--nb-blue-pen) !important;
  color: var(--nb-blue-pen) !important;
  font-weight: 700 !important;
}

/* Progress bar */
.notebook-theme .progress-fill,
.notebook-theme .category-fill {
  background: linear-gradient(90deg, var(--nb-blue-pen), #3a5fb0) !important;
}

/* XP badge */
.notebook-theme .xp-badge {
  background: rgba(26, 58, 143, 0.12) !important;
  border: 1.5px solid var(--nb-blue-pen) !important;
  color: var(--nb-blue-pen) !important;
  font-family: 'Caveat', cursive !important;
  font-weight: 700 !important;
}

/* Word of the day gold card — keep gold but add notebook feel */
/* Word of the Day card — always keeps its original design, unaffected by notebook theme fonts */
.notebook-theme .wotd-standalone-wrapper,
.notebook-theme .wotd-standalone-wrapper * {
  font-family: inherit !important;
}

.notebook-theme .wotd-card .embossed-text,
.notebook-theme .wotd-card .flashcard-flip-prompt,
.notebook-theme .wotd-card .flashcard-word,
.notebook-theme .wotd-card .flashcard-translation,
.notebook-theme .wotd-card .flashcard-transcription,
.notebook-theme .wotd-card .wotd-card-badge {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.notebook-theme .wotd-card .flashcard-face {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  border-radius: var(--radius-lg, 16px) !important;
}

/* Success/error colors override */
.notebook-theme .correct-answer-banner {
  background: rgba(26, 122, 58, 0.12) !important;
  border: 2px solid var(--nb-green-pen) !important;
  color: var(--nb-green-pen) !important;
  font-family: 'Caveat', cursive !important;
}

.notebook-theme .wrong-answer-banner {
  background: rgba(192, 57, 43, 0.10) !important;
  border: 2px solid var(--nb-red-pen) !important;
  color: var(--nb-red-pen) !important;
  font-family: 'Caveat', cursive !important;
}

/* Scrollbar */
.notebook-theme ::-webkit-scrollbar {
  width: 6px;
}
.notebook-theme ::-webkit-scrollbar-thumb {
  background: var(--nb-border);
  border-radius: 3px;
}

/* Hamburger Drawer Styles */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  z-index: 120;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-out;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.burger-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 290px;
  max-width: 85vw;
  height: 100vh;
  background: var(--bg-main, #ffffff);
  border-left: 1.5px solid var(--border-color);
  z-index: 130;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.burger-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 20px 16px;
  border-bottom: 1.5px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.drawer-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.drawer-avatar-wrapper {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  background: #f1f5f9;
  border: 1.5px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.drawer-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.drawer-avatar-placeholder {
  font-size: 20px;
  font-weight: 700;
}

.drawer-profile-info {
  min-width: 0;
  flex: 1;
}

.drawer-username {
  font-weight: 800;
  font-size: 15px;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-email {
  font-size: 11.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-close-btn {
  background: transparent;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  margin-top: -6px;
  transition: color 0.15s ease;
}

.drawer-close-btn:hover {
  color: var(--text-main);
}

.drawer-menu {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

/* Let's style the nav-tab and share button inside the drawer */
.burger-drawer .nav-tab,
.burger-drawer .drawer-share-action-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  min-height: 44px;
  height: 44px;
  flex: 0 0 auto;
  text-align: left;
}

.burger-drawer .nav-tab .tab-icon,
.burger-drawer .drawer-share-action-btn .tab-icon {
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}

.burger-drawer .drawer-share-action-btn .tab-icon svg {
  color: #3b82f6;
  stroke: #3b82f6;
}

.burger-drawer .nav-tab:hover,
.burger-drawer .drawer-share-action-btn:hover {
  background: var(--bg-hover, #f1f5f9);
}

.burger-drawer .nav-tab.active {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.08);
}

/* Notebook Theme specific overrides for drawer */
.notebook-theme .burger-drawer {
  background: #fcfbf7;
  border-left: 1.5px solid var(--nb-border);
}

.notebook-theme .burger-drawer .nav-tab:hover,
.notebook-theme .burger-drawer .drawer-share-action-btn:hover {
  background: #f0ede4;
  color: var(--nb-text);
}

.notebook-theme .burger-drawer .nav-tab.active {
  background: #f0ede4;
  color: #c26a38;
}

/* Dark Theme overrides for drawer */
.dark-theme .burger-drawer {
  background: #0f172a;
}
.dark-theme .burger-drawer .nav-tab:hover,
.dark-theme .burger-drawer .drawer-share-action-btn:hover {
  background: #1e293b;
  color: #f8fafc;
}
.dark-theme .burger-drawer .drawer-share-action-btn .tab-icon svg {
  color: #60a5fa;
  stroke: #60a5fa;
}
.dark-theme .burger-drawer .nav-tab.active {
  background: rgba(22, 163, 74, 0.15);
  color: #4ade80;
}
.dark-theme .burger-drawer .nav-tab.active:hover {
  background: rgba(22, 163, 74, 0.22);
  color: #4ade80;
}

/* Drawer Footer & Modern Feedback Button */
.drawer-footer {
  padding: 12px 14px 16px;
  border-top: 1.5px solid var(--border-color);
  background: var(--card-bg, rgba(255, 255, 255, 0.7));
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.drawer-feedback-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-surface, rgba(0, 0, 0, 0.02));
  color: var(--text-main);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  box-sizing: border-box;
}

.drawer-feedback-btn:hover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  color: #3b82f6;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.12);
  transform: translateY(-1px);
}

.drawer-feedback-btn:active {
  transform: translateY(0);
}

.drawer-feedback-icon {
  font-size: 18px;
  line-height: 1;
  padding: 6px;
  background: rgba(245, 158, 11, 0.15);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.drawer-feedback-title {
  font-weight: 700;
  font-size: 13.5px;
  color: inherit;
  line-height: 1.25;
}

.drawer-app-version {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  opacity: 0.75;
  font-weight: 500;
}

.dark-theme .drawer-footer {
  background: #0b1120;
}

.dark-theme .drawer-feedback-btn {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

.dark-theme .drawer-feedback-btn:hover {
  border-color: #60a5fa;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  box-shadow: 0 4px 16px rgba(96, 165, 250, 0.15);
}

/* Toast message for feedback copy notification */
.feedback-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e293b;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 999999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: center;
  max-width: 90vw;
  box-sizing: border-box;
}

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

/* Hamburger button in header - square with rounded edges */
.header-burger-btn {
  background: var(--card-bg, #ffffff);
  border: 1.5px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  transition: all 0.15s ease;
  padding: 0;
  box-shadow: var(--shadow-sm);
}

.header-burger-btn:hover {
  background: var(--bg-hover, #f1f5f9);
}

.dark-theme .header-burger-btn:hover {
  background: #1e293b;
}

.notebook-theme .header-burger-btn {
  background: #fffdf7;
  border: 2px solid var(--nb-blue-pen);
  box-shadow: var(--nb-shadow);
}

.notebook-theme .header-burger-btn:hover {
  background: #f0ede4;
}

/* Scale up small fonts in Notebook theme for readability */
.notebook-theme small,
.notebook-theme .user-status-text,
.notebook-theme .xp-badge-text,
.notebook-theme .drawer-email,
.notebook-theme .drawer-username,
.notebook-theme .dict-translation,
.notebook-theme .fav-translation,
.notebook-theme .word-transcription,
.notebook-theme .card-transcription,
.notebook-theme .word-example,
.notebook-theme .settings-option-subtitle,
.notebook-theme .settings-info-text {
  font-size: 1.25em !important;
}

.notebook-theme .dropdown-item,
.notebook-theme .custom-dropdown-trigger,
.notebook-theme .train-left-badge {
  font-size: 19px !important;
  font-family: 'Caveat', cursive !important;
}

.notebook-theme .mode-pill-btn {
  font-family: 'Caveat', cursive !important;
  font-size: 21px !important;
}

.notebook-theme .podium-name,
.notebook-theme .row-name,
.notebook-theme .my-bar-name {
  font-family: 'Caveat', cursive !important;
  font-size: 19px !important;
}

.notebook-theme .podium-xp,
.notebook-theme .row-xp,
.notebook-theme .my-bar-xp,
.notebook-theme .my-rank-badge,
.notebook-theme .row-rank {
  font-family: 'Caveat', cursive !important;
  font-size: 18px !important;
}

.notebook-theme #leaderboard-type-trigger,
.notebook-theme #leaderboard-type-label {
  font-family: 'Caveat', cursive !important;
  font-size: 23px !important;
}

.notebook-theme .league-timer-badge,
.notebook-theme #leaderboard-timer-badge {
  font-family: 'Caveat', cursive !important;
  font-size: 18px !important;
}

.notebook-theme .my-bar-status {
  font-family: 'Caveat', cursive !important;
  font-size: 16px !important;
}

/* Responsive Header Optimizations for Narrow Screens */
@media (max-width: 480px) {
  .mobile-header {
    padding: 8px 10px !important;
  }
  
  #brand-logo svg {
    width: 170px !important;
    height: 35px !important;
  }
  
  #header-user-status {
    margin-left: 40px !important;
  }
  
  .header-right-actions {
    gap: 6px !important;
  }
  
  .header-right-actions > div {
    gap: 6px !important;
  }

  .header-xp-badge {
    padding: 4px 6px !important;
  }
  
  .xp-badge-text {
    font-size: 11.5px !important;
  }
  
  .xp-badge-icon {
    font-size: 15px !important;
  }
}

/* Custom Notes styles for Cards and Dictionary */
.flashcard-notes {
  font-size: 14.5px;
  font-weight: 500;
  color: #475569;
  margin-top: 8px;
  margin-bottom: 0;
  line-height: 1.35;
  text-align: center;
}

.dark-theme .flashcard-notes {
  color: rgba(255, 255, 255, 0.85) !important;
}

.notebook-theme .flashcard-notes {
  color: var(--nb-blue-pen) !important;
  opacity: 0.85;
  font-family: 'Caveat', cursive !important;
}

.dict-notes {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 0;
  line-height: 1.3;
}

.notebook-theme .dict-notes {
  color: var(--nb-blue-pen) !important;
  opacity: 0.85;
  font-family: 'Caveat', cursive !important;
}

/* App Maintenance: Clear Cache Button (Green in all themes) */
.btn-clear-cache,
#clear-app-cache-btn {
  background-color: #16a34a !important;
  color: #ffffff !important;
  transition: background-color 0.2s ease;
}

.btn-clear-cache:hover,
#clear-app-cache-btn:hover {
  background-color: #15803d !important;
}

[data-theme="dark"] .btn-clear-cache,
[data-theme="dark"] #clear-app-cache-btn,
body.dark-theme .btn-clear-cache,
body.dark-theme #clear-app-cache-btn {
  background-color: #16a34a !important;
  color: #ffffff !important;
}

[data-theme="dark"] .btn-clear-cache:hover,
[data-theme="dark"] #clear-app-cache-btn:hover,
body.dark-theme .btn-clear-cache:hover,
body.dark-theme #clear-app-cache-btn:hover {
  background-color: #15803d !important;
}

/* Consonants Quiz letter boxes: reset Safari WebKit input padding and metrics */
.letter-box {
  padding: 0 !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
}

.consonant-input {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  padding: 0 !important;
  margin: 1px !important;
  box-sizing: border-box !important;
  text-indent: 0 !important;
  text-align: center !important;
}

/* ==========================================================================
   Document OCR Scanner & Lemma Extraction Modal
   ========================================================================== */

.scanner-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.scanner-modal-card {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 16px;
  padding: 22px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
  position: relative;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.scanner-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.scanner-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main, #0f172a);
}

.scanner-close-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted, #64748b);
  padding: 2px 6px;
  line-height: 1;
  transition: color 0.2s;
}

.scanner-close-btn:hover {
  color: var(--text-main, #0f172a);
}

.scanner-modal-body {
  overflow-y: auto;
  flex: 1;
  padding-right: 2px;
}

/* Upload & Dropzone */
.scanner-dropzone {
  border: 2px dashed var(--border-color, #cbd5e1);
  border-radius: 14px;
  padding: 30px 16px;
  text-align: center;
  background: var(--bg-hover, #f8fafc);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.scanner-dropzone.dragover {
  border-color: #0284c7;
  background: rgba(2, 132, 199, 0.08);
}

.scanner-dropzone-icon {
  font-size: 44px;
  line-height: 1;
  animation: pulseScan 2.5s infinite ease-in-out;
}

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

.scanner-dropzone-text {
  font-size: 14px;
  color: var(--text-muted, #64748b);
  margin: 0;
  max-width: 320px;
  line-height: 1.4;
}

.scanner-action-buttons {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 360px;
  margin-top: 8px;
}

.scanner-btn-camera {
  flex: 1;
  min-height: 46px;
  height: 46px;
  font-size: 14px;
  font-weight: 700;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #fff !important;
  border-radius: 12px;
  border: none;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
  cursor: pointer;
}

.scanner-btn-gallery {
  flex: 1;
  min-height: 46px;
  height: 46px;
  font-size: 14px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1) !important;
  color: var(--text-main, #0f172a) !important;
  border: 1px solid var(--border-color, #cbd5e1) !important;
  border-radius: 12px;
  cursor: pointer;
}

.scanner-btn-paste {
  width: 100%;
  max-width: 360px;
  min-height: 46px;
  height: 46px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  border: 1.5px solid var(--border-color, #cbd5e1);
  background: var(--card-bg, #ffffff);
  color: var(--text-main, #0f172a);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  transition: all 0.2s ease;
}

.scanner-btn-paste:hover {
  background: var(--bg-hover, #f8fafc);
  border-color: #0284c7;
}

.scanner-error {
  margin-top: 14px;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid #ef4444;
  border-radius: 8px;
  font-size: 13px;
  color: #ef4444;
  font-weight: 500;
  line-height: 1.4;
}

/* Processing State */
.scanner-processing-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 10px 0;
}

.scanner-preview-container {
  position: relative;
  max-width: 100%;
  max-height: 240px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color, #e2e8f0);
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-preview-img {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  display: block;
}

.scanner-laser-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(2, 132, 199, 0) 0%, #38bdf8 50%, rgba(2, 132, 199, 0) 100%);
  box-shadow: 0 0 12px #38bdf8, 0 0 20px #0284c7;
  animation: laserScan 2s infinite alternate ease-in-out;
}

@keyframes laserScan {
  0% { top: 0%; }
  100% { top: 96%; }
}

.scanner-processing-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.scanner-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(2, 132, 199, 0.2);
  border-top-color: #0284c7;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.scanner-processing-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main, #0f172a);
  margin: 0;
}

/* Snippet & Results */
.scanner-snippet-box {
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid rgba(2, 132, 199, 0.25);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
}

.scanner-snippet-header {
  font-size: 11.5px;
  font-weight: 700;
  color: #0284c7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.scanner-snippet-text {
  font-size: 12.5px;
  color: var(--text-main, #0f172a);
  margin: 0;
  line-height: 1.4;
  font-style: italic;
}

.scanner-lemmas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.scanner-lemmas-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main, #0f172a);
}

.scanner-select-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.scanner-link-btn {
  background: none;
  border: none;
  color: #0284c7;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.scanner-link-btn:hover {
  color: #0369a1;
}

.scanner-lemmas-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  margin-bottom: 14px;
  padding-right: 2px;
}

.scanner-lemma-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-hover, #f8fafc);
  transition: border-color 0.2s ease, background 0.2s ease;
  cursor: pointer;
}

.scanner-lemma-item.selected {
  border-color: #0284c7;
  background: rgba(2, 132, 199, 0.06);
}

.scanner-lemma-checkbox {
  margin-top: 3px;
  width: 17px;
  height: 17px;
  cursor: pointer;
  accent-color: #0284c7;
}

.scanner-lemma-content {
  flex: 1;
  min-width: 0;
}

.scanner-lemma-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.scanner-lemma-word {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main, #0f172a);
}

.scanner-lemma-ipa {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  font-family: inherit;
}

.scanner-lemma-level {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
}

.scanner-lemma-cat {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(100, 116, 139, 0.12);
  color: var(--text-muted, #64748b);
  border: 1px solid rgba(100, 116, 139, 0.22);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.scanner-lemma-cat:hover {
  transform: translateY(-1px);
  filter: brightness(0.95);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.scanner-lemma-cat.cat-pattern {
  background: #f3e8ff;
  color: #7e22ce;
  border-color: #d8b4fe;
}
.scanner-lemma-cat.cat-irregular-verbs {
  background: #ffedd5;
  color: #c2410c;
  border-color: #fed7aa;
}
.scanner-lemma-cat.cat-elementary {
  background: #dcfce7;
  color: #15803d;
  border-color: #bbf7d0;
}
.scanner-lemma-cat.cat-intermediate {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #bae6fd;
}
.scanner-lemma-cat.cat-advanced {
  background: #ede9fe;
  color: #4338ca;
  border-color: #c7d2fe;
}

/* Translation Chips with Checkbox Toggles */
.scanner-lemma-trans-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.scanner-trans-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--card-bg, #ffffff);
  color: var(--text-main, #0f172a);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  font-family: inherit;
}
.scanner-trans-chip.selected {
  background: #f0fdf4;
  color: #15803d;
  border-color: #86efac;
  font-weight: 700;
}
.scanner-trans-chip.unselected {
  background: #f8fafc;
  color: #94a3b8;
  border-color: #e2e8f0;
  text-decoration: line-through;
  opacity: 0.65;
}
.scanner-trans-chip:hover {
  transform: translateY(-1px);
}
.scanner-chip-check {
  font-size: 11px;
  font-weight: 800;
}
.scanner-trans-chip.selected .scanner-chip-check {
  color: #16a34a;
}
.scanner-trans-chip.unselected .scanner-chip-check {
  color: #ef4444;
}

.scanner-trans-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}
.scanner-trans-edit-btn:hover {
  opacity: 1;
}

.scanner-trans-edit-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  width: 100%;
}
.scanner-trans-input {
  flex: 1;
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 6px;
  background: var(--card-bg, #ffffff);
  color: var(--text-main, #0f172a);
  font-family: inherit;
}
.scanner-trans-input:focus {
  outline: none;
  border-color: #22c55e;
}
.scanner-trans-done-btn {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  background: #22c55e;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.scanner-lemma-trans {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-main, #0f172a);
  margin-top: 2px;
}

.scanner-lemma-context {
  font-size: 11.5px;
  color: var(--text-muted, #64748b);
  margin-top: 3px;
  line-height: 1.3;
}

/* Existing Words Collapsible */
.scanner-existing-box {
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
}

.scanner-existing-header {
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-hover, #f8fafc);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
}

.scanner-existing-header:hover {
  color: var(--text-main, #0f172a);
}

.scanner-existing-list {
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--card-bg, #ffffff);
}

.scanner-existing-chip {
  background: var(--bg-hover, #f1f5f9);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11.5px;
  color: var(--text-muted, #64748b);
}

.scanner-results-footer {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color, #e2e8f0);
}

.scanner-btn-rescan {
  flex: 1;
  min-height: 42px;
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-main, #0f172a) !important;
  border: 1px solid var(--border-color, #cbd5e1) !important;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.scanner-btn-save {
  flex: 2;
  min-height: 42px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
}

/* Dark theme overrides */
.dark-theme .scanner-modal-card {
  background: #1e293b;
  border-color: #334155;
}

.dark-theme .scanner-modal-header,
.dark-theme .scanner-results-footer,
.dark-theme .scanner-existing-box {
  border-color: #334155;
}

.dark-theme .scanner-dropzone,
.dark-theme .scanner-lemma-item,
.dark-theme .scanner-existing-header {
  background: #0f172a;
  border-color: #334155;
}

.dark-theme .scanner-existing-list {
  background: #1e293b;
}

.dark-theme .scanner-existing-chip {
  background: #0f172a;
  border-color: #334155;
  color: #94a3b8;
}

.dark-theme .scanner-lemma-level {
  background: #0369a1;
  color: #e0f2fe;
}

.dark-theme .scanner-btn-gallery,
.dark-theme .scanner-btn-rescan {
  border-color: #334155 !important;
}

.dark-theme .scanner-btn-paste {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}



.scanner-group-cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main, #0f172a);
  cursor: pointer;
  transition: all 0.15s ease;
}

.scanner-group-cat-btn:hover {
  border-color: #0284c7;
  background: rgba(2, 132, 199, 0.08);
}

.scanner-group-cat-label {
  color: #0284c7;
  font-weight: 700;
}

.dark-theme .scanner-group-cat-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: #f8fafc;
}

.dark-theme .scanner-group-cat-btn:hover {
  background: rgba(2, 132, 199, 0.2);
  border-color: #38bdf8;
}

.dark-theme .scanner-group-cat-label {
  color: #38bdf8;
}

/* ========================================================
   SHARE MODAL & TOAST
   ======================================================== */
.share-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
}

.share-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.share-modal-card {
  background: var(--card-bg, #ffffff);
  border: 1.5px solid var(--border-color, #e2e8f0);
  border-radius: 20px;
  width: 100%;
  max-width: 420px;
  padding: 22px 22px 20px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.22);
  transform: scale(0.92) translateY(10px);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.share-modal-overlay.open .share-modal-card {
  transform: scale(1) translateY(0);
}

.share-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 12px;
}

.share-modal-header-text {
  flex: 1;
  min-width: 0;
}

.share-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main, #0f172a);
}

.share-title-icon {
  color: #FF6A00;
  stroke: #FF6A00;
  flex-shrink: 0;
}

.share-modal-subtitle {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-muted, #64748b);
}

.share-modal-close {
  background: transparent;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}

.share-modal-close:hover {
  color: var(--text-main, #0f172a);
  background: var(--bg-hover, #f1f5f9);
}

.share-channels-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 10px;
  margin-bottom: 20px;
}

.share-channel-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px 4px;
  border-radius: 12px;
  transition: transform 0.15s ease, background 0.15s ease;
  user-select: none;
  outline: none;
}

.share-channel-btn:hover {
  transform: translateY(-3px);
  background: var(--bg-hover, rgba(0, 0, 0, 0.04));
}

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

.share-channel-icon-wrap {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.share-channel-btn:hover .share-channel-icon-wrap {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.share-icon-tg {
  background: linear-gradient(135deg, #2AABEE, #229ED9);
}

.share-icon-wa {
  background: linear-gradient(135deg, #25D366, #128C7E);
}

.share-icon-vb {
  background: linear-gradient(135deg, #7F66FF, #665CAC);
}

.share-icon-tt {
  background: linear-gradient(135deg, #111111, #222222);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.share-icon-em {
  background: linear-gradient(135deg, #FF6A00, #EA4335);
}

.share-icon-sms {
  background: linear-gradient(135deg, #10B981, #059669);
}

.share-channel-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main, #334155);
  text-align: center;
}

.share-link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle, #f8fafc);
  border: 1.5px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  padding: 4px 4px 4px 12px;
}

.share-link-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  font-size: 13px;
  color: var(--text-muted, #64748b);
  outline: none;
  font-family: inherit;
  user-select: all;
}

.share-copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #FF6A00;
  color: #ffffff;
  border: none;
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
  flex-shrink: 0;
}

.share-copy-btn:hover {
  background: #e55e00;
}

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

.share-copy-btn.copied {
  background: #16a34a;
}

/* Share Toast */
.share-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e293b;
  color: #ffffff;
  padding: 11px 20px;
  border-radius: 30px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 100001;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  max-width: 90vw;
}

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

/* Dark theme overrides for Share Modal */
.dark-theme .share-modal-card {
  background: #0f172a;
  border-color: #334155;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
}

.dark-theme .share-modal-close:hover {
  background: #1e293b;
  color: #f8fafc;
}

.dark-theme .share-channel-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.dark-theme .share-channel-label {
  color: #e2e8f0;
}

.dark-theme .share-link-box {
  background: #1e293b;
  border-color: #334155;
}

.dark-theme .share-link-input {
  color: #94a3b8;
}

.dark-theme .share-toast {
  background: #334155;
  border: 1px solid #475569;
}

/* Notebook theme overrides for Share Modal */
.notebook-theme .share-modal-card {
  background: #fcfbf7;
  border: 1.5px solid var(--nb-border, #dcd7cb);
}

.notebook-theme .share-link-box {
  background: #f0ede4;
  border-color: var(--nb-border, #dcd7cb);
}

