/* ============================================
   ArtikelMeister v2 — Enhanced Design System
   Bol animasyon, vurgulu, oyunlaştırılmış
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ── CSS Variables ── */
:root {
  --der-color: #4A9EFF;
  --der-bg: rgba(74, 158, 255, 0.15);
  --der-glow: 0 0 30px rgba(74, 158, 255, 0.4);
  --die-color: #FF6B9D;
  --die-bg: rgba(255, 107, 157, 0.15);
  --die-glow: 0 0 30px rgba(255, 107, 157, 0.4);
  --das-color: #4ADE80;
  --das-bg: rgba(74, 222, 128, 0.15);
  --das-glow: 0 0 30px rgba(74, 222, 128, 0.4);
  --bg-primary: #0a0a1a;
  --bg-secondary: #12122a;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-glass: rgba(255, 255, 255, 0.07);
  --border-glass: rgba(255, 255, 255, 0.1);
  --text-primary: #f0f0f5;
  --text-secondary: rgba(240, 240, 245, 0.6);
  --text-muted: rgba(240, 240, 245, 0.35);
  --accent: #8B5CF6;
  --accent-glow: 0 0 30px rgba(139, 92, 246, 0.3);
  --success: #4ADE80;
  --error: #FF4757;
  --warning: #FBBF24;
  --xp-color: #F59E0B;
  --combo-color: #FF6B35;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 100px;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative
}

/* ── Animated Background ── */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: orbFloat 20s ease-in-out infinite
}

.bg-orb:nth-child(1) {
  width: 400px;
  height: 400px;
  background: rgba(74, 158, 255, 0.08);
  top: -10%;
  left: -10%;
  animation-delay: 0s
}

.bg-orb:nth-child(2) {
  width: 350px;
  height: 350px;
  background: rgba(255, 107, 157, 0.06);
  bottom: -10%;
  right: -10%;
  animation-delay: -7s
}

.bg-orb:nth-child(3) {
  width: 300px;
  height: 300px;
  background: rgba(74, 222, 128, 0.05);
  top: 50%;
  left: 50%;
  animation-delay: -14s
}

@keyframes orbFloat {

  0%,
  100% {
    transform: translate(0, 0) scale(1)
  }

  25% {
    transform: translate(30px, -40px) scale(1.1)
  }

  50% {
    transform: translate(-20px, 30px) scale(0.95)
  }

  75% {
    transform: translate(40px, 20px) scale(1.05)
  }
}

/* ── App Container ── */
#app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: 85px
}

/* ──────────────────────────────────────
   LOGIN / PROFILE SELECT SCREEN
   ────────────────────────────────────── */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  z-index: 2000;
  padding: var(--space-xl);
  animation: fadeIn 0.5s ease
}

.login-screen.hidden {
  display: none
}

.login-logo {
  font-size: 80px;
  margin-bottom: var(--space-lg);
  animation: float 3s ease-in-out infinite
}

.login-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--der-color), var(--die-color), var(--das-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-xs);
  text-align: center
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: var(--space-2xl);
  text-align: center
}

.login-profiles {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-lg)
}

.profile-slot {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden
}

.profile-slot::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), transparent);
  opacity: 0;
  transition: opacity 0.3s ease
}

.profile-slot:hover::before,
.profile-slot:active::before {
  opacity: 1
}

.profile-slot:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--accent-glow)
}

.profile-slot:active {
  transform: scale(0.97)
}

.profile-avatar {
  font-size: 36px;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 92, 246, 0.12);
  border-radius: 50%;
  flex-shrink: 0
}

.profile-info {
  flex: 1
}

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

.profile-meta {
  font-size: 12px;
  color: var(--text-secondary)
}

.profile-slot.empty {
  border-style: dashed;
  opacity: 0.6
}

.profile-slot.empty:hover {
  opacity: 1
}

.profile-slot .profile-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 71, 87, 0.15);
  border: none;
  color: var(--error);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease
}

.profile-slot:hover .profile-delete {
  opacity: 1
}

/* Avatar Picker Modal */
.avatar-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 26, 0.95);
  backdrop-filter: blur(20px);
  z-index: 2100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  animation: fadeIn 0.3s ease
}

.avatar-modal.hidden {
  display: none
}

.avatar-modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: var(--space-sm)
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-md);
  margin: var(--space-lg) 0;
  max-width: 320px
}

.avatar-option {
  font-size: 32px;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-glass);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease
}

.avatar-option:hover,
.avatar-option.selected {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.15);
  transform: scale(1.15)
}

.name-input {
  width: 100%;
  max-width: 280px;
  padding: 12px 16px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 15px;
  text-align: center;
  outline: none;
  transition: border 0.2s ease;
  margin-bottom: var(--space-lg)
}

.name-input:focus {
  border-color: var(--accent)
}

.name-input::placeholder {
  color: var(--text-muted)
}

/* ── Splash Screen ── */
.splash-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  z-index: 1500;
  transition: opacity 0.8s ease, transform 0.8s ease
}

.splash-screen.hidden {
  opacity: 0;
  transform: scale(1.1);
  pointer-events: none
}

.splash-logo {
  font-size: 72px;
  margin-bottom: var(--space-lg);
  animation: splashPop 1s ease-out forwards
}

.splash-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--der-color), var(--die-color), var(--das-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-sm);
  animation: slideUp 0.8s ease 0.3s both
}

.splash-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  letter-spacing: 6px;
  animation: slideUp 0.8s ease 0.5s both
}

.splash-loader {
  margin-top: var(--space-2xl);
  width: 140px;
  height: 4px;
  background: var(--bg-glass);
  border-radius: var(--radius-full);
  overflow: hidden;
  animation: fadeIn 0.5s ease 0.7s both
}

.splash-loader-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--der-color), var(--die-color), var(--das-color));
  border-radius: var(--radius-full);
  animation: loadBar 1.8s ease-in-out 0.8s forwards
}

/* ── Header ── */
.app-header {
  padding: var(--space-md) var(--space-lg);
  padding-top: calc(var(--safe-top) + var(--space-md));
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: rgba(10, 10, 26, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 100;
  border-bottom: 1px solid var(--border-glass)
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm)
}

.header-logo {
  font-size: 24px;
  animation: float 4s ease-in-out infinite
}

.header-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm)
}

.header-xp {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(245, 158, 11, 0.12);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  color: var(--xp-color);
  transition: all 0.3s ease
}

.header-xp.pulse {
  animation: headerPulse 0.5s ease
}

.header-streak {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--error);
  background: rgba(255, 71, 87, 0.1);
  padding: 6px 10px;
  border-radius: var(--radius-full)
}

.header-streak.fire {
  animation: fireGlow 1s ease-in-out infinite
}

.header-profile-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease
}

.header-profile-btn:hover {
  border-color: var(--accent);
  transform: scale(1.1)
}

/* ── Section (page) ── */
.section {
  display: none;
  padding: var(--space-lg)
}

.section.active {
  display: block;
  animation: pageEnter 0.5s cubic-bezier(0.16, 1, 0.3, 1)
}

.section-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  margin-bottom: var(--space-lg);
  position: relative;
  display: inline-block
}

.section-title .gradient-text {
  background: linear-gradient(135deg, var(--der-color), var(--die-color), var(--das-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: -12px;
  margin-bottom: var(--space-lg)
}

/* ── Daily Tip Banner ── */
.daily-tip {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(74, 158, 255, 0.08));
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  animation: tipSlide 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden
}

.daily-tip::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
  animation: tipShimmer 3s ease-in-out infinite
}

.daily-tip:hover {
  border-color: var(--accent);
  transform: translateY(-1px)
}

.daily-tip-icon {
  font-size: 28px;
  flex-shrink: 0;
  animation: float 3s ease-in-out infinite
}

.daily-tip-content {
  flex: 1
}

.daily-tip-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 2px
}

.daily-tip-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5
}

/* ── Welcome Banner ── */
.welcome-banner {
  margin-bottom: var(--space-lg);
  padding: var(--space-lg);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(255, 107, 157, 0.06), rgba(74, 222, 128, 0.06));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden
}

.welcome-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.12), transparent);
  border-radius: 50%;
  animation: orbFloat 15s ease-in-out infinite
}

.welcome-greeting {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 2px
}

.welcome-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800
}

.welcome-motivate {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  font-style: italic
}

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl)
}

.stat-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s ease
}

.stat-card:hover::before {
  opacity: 1
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15)
}

.stat-card:nth-child(1)::before {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), transparent)
}

.stat-card:nth-child(2)::before {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.08), transparent)
}

.stat-card:nth-child(3)::before {
  background: linear-gradient(135deg, rgba(255, 107, 157, 0.08), transparent)
}

.stat-card:nth-child(4)::before {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), transparent)
}

.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800
}

.stat-value.counting {
  animation: countPop 0.4s ease
}

.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px
}

/* ── Level Progress ── */
.level-bar-container {
  margin-bottom: var(--space-xl);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg)
}

.level-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm)
}

.level-badge {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 600;
  font-size: 14px
}

.level-number {
  background: linear-gradient(135deg, var(--accent), #7C3AED);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
  animation: levelGlow 2s ease-in-out infinite
}

.level-xp-text {
  font-size: 12px;
  color: var(--text-secondary)
}

.level-bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative
}

.level-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #A78BFA, var(--die-color));
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative
}

.level-bar-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
  border-radius: var(--radius-full);
  animation: levelShine 2s ease-in-out infinite
}

/* ── Mode Cards ── */
.mode-grid {
  display: grid;
  gap: var(--space-md)
}

.mode-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  position: relative;
  overflow: hidden
}

.mode-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s ease
}

.mode-card:hover::before,
.mode-card:active::before {
  opacity: 1
}

.mode-card.learn::before {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), transparent)
}

.mode-card.quiz::before {
  background: linear-gradient(135deg, rgba(74, 158, 255, 0.12), transparent)
}

.mode-card.speed::before {
  background: linear-gradient(135deg, rgba(255, 107, 157, 0.12), transparent)
}

.mode-card.rules::before {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.12), transparent)
}

.mode-card:hover,
.mode-card:active {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-3px) scale(1.01)
}

.mode-card:active {
  transform: scale(0.97)
}

.mode-icon {
  font-size: 36px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  position: relative
}

.mode-card.learn .mode-icon {
  background: rgba(139, 92, 246, 0.15)
}

.mode-card.quiz .mode-icon {
  background: rgba(74, 158, 255, 0.15)
}

.mode-card.speed .mode-icon {
  background: rgba(255, 107, 157, 0.15)
}

.mode-card.rules .mode-icon {
  background: rgba(74, 222, 128, 0.15)
}

.mode-info {
  flex: 1;
  position: relative;
  z-index: 1
}

.mode-title {
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 4px
}

.mode-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4
}

.mode-arrow {
  font-size: 20px;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
  transition: transform 0.3s ease
}

.mode-card:hover .mode-arrow {
  transform: translateX(4px);
  color: var(--text-secondary)
}

/* ── Combo Indicator ── */
.combo-display {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 150;
  text-align: right;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1)
}

.combo-display.active {
  opacity: 1;
  transform: scale(1)
}

.combo-count {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 900;
  color: var(--combo-color);
  text-shadow: 0 0 20px rgba(255, 107, 53, 0.5);
  line-height: 1
}

.combo-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--warning)
}

.combo-display.fire .combo-count {
  animation: comboFire 0.3s ease
}

.combo-bonus {
  font-size: 12px;
  color: var(--xp-color);
  font-weight: 600;
  margin-top: 2px
}

/* ── Article Buttons (enhanced) ── */
.article-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-top: var(--space-lg)
}

.article-btn {
  background: var(--bg-glass);
  border: 2px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 20px var(--space-md);
  cursor: pointer;
  text-align: center;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden
}

.article-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s ease
}

.article-btn:active {
  transform: scale(0.92)
}

.article-btn.der {
  border-color: rgba(74, 158, 255, 0.3)
}

.article-btn.der::after {
  background: var(--der-bg)
}

.article-btn.der:hover {
  border-color: var(--der-color);
  box-shadow: var(--der-glow);
  transform: translateY(-3px)
}

.article-btn.der:hover::after {
  opacity: 1
}

.article-btn.die {
  border-color: rgba(255, 107, 157, 0.3)
}

.article-btn.die::after {
  background: var(--die-bg)
}

.article-btn.die:hover {
  border-color: var(--die-color);
  box-shadow: var(--die-glow);
  transform: translateY(-3px)
}

.article-btn.die:hover::after {
  opacity: 1
}

.article-btn.das {
  border-color: rgba(74, 222, 128, 0.3)
}

.article-btn.das::after {
  background: var(--das-bg)
}

.article-btn.das:hover {
  border-color: var(--das-color);
  box-shadow: var(--das-glow);
  transform: translateY(-3px)
}

.article-btn.das:hover::after {
  opacity: 1
}

.article-btn.correct {
  animation: correctBurst 0.6s ease;
  border-color: var(--success) !important;
  box-shadow: 0 0 40px rgba(74, 222, 128, 0.5) !important
}

.article-btn.wrong {
  animation: wrongShake 0.5s ease;
  border-color: var(--error) !important;
  box-shadow: 0 0 30px rgba(255, 71, 87, 0.4) !important
}

.article-btn.reveal {
  border-color: var(--success) !important;
  box-shadow: 0 0 25px rgba(74, 222, 128, 0.3) !important;
  animation: revealPulse 0.8s ease
}

.article-btn:disabled {
  pointer-events: none;
  opacity: 0.45
}

/* ── Quiz Area ── */
.quiz-area {
  text-align: center
}

.quiz-progress {
  display: flex;
  gap: 4px;
  margin-bottom: var(--space-xl)
}

.quiz-dot {
  flex: 1;
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  transition: all 0.4s ease
}

.quiz-dot.correct {
  background: var(--success);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.3)
}

.quiz-dot.wrong {
  background: var(--error);
  box-shadow: 0 0 8px rgba(255, 71, 87, 0.3)
}

.quiz-dot.current {
  background: var(--accent);
  animation: dotPulse 1.5s ease-in-out infinite
}

.quiz-word-container {
  margin: var(--space-xl) 0;
  animation: wordEnter 0.4s cubic-bezier(0.16, 1, 0.3, 1)
}

.quiz-question-mark {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px
}

.quiz-word {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 900;
  margin-bottom: var(--space-sm);
  line-height: 1.2;
  transition: all 0.3s ease
}

.quiz-word.correct-reveal {
  color: var(--success)
}

.quiz-word.wrong-reveal {
  color: var(--error)
}

.quiz-translation {
  font-size: 16px;
  color: var(--text-secondary)
}

.quiz-category {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px
}

.quiz-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-md);
  padding: 8px 16px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: var(--radius-full);
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600
}

.quiz-hint:hover {
  background: rgba(139, 92, 246, 0.2);
  transform: scale(1.05)
}

.quiz-score-bar {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-xl);
  padding: var(--space-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md)
}

.quiz-score-item {
  text-align: center;
  flex: 1
}

.quiz-score-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800
}

.quiz-score-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px
}

/* ── Speed Game ── */
.speed-timer {
  text-align: center;
  margin-bottom: var(--space-lg)
}

.speed-time {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 900;
  transition: color 0.3s ease
}

.speed-time.warning {
  color: var(--warning);
  animation: timerPulse 1s ease-in-out infinite
}

.speed-time.danger {
  color: var(--error);
  animation: timerPulse 0.5s ease-in-out infinite
}

.speed-score {
  font-size: 16px;
  color: var(--text-secondary);
  margin-top: var(--space-xs)
}

.speed-score span {
  color: var(--success);
  font-weight: 700
}

/* ── Rule Tabs ── */
.rule-tabs {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: var(--space-xs)
}

.rule-tabs::-webkit-scrollbar {
  display: none
}

.rule-tab {
  flex-shrink: 0;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary)
}

.rule-tab.active {
  color: white;
  transform: scale(1.05)
}

.rule-tab.active.der {
  background: var(--der-color);
  border-color: var(--der-color);
  box-shadow: 0 0 15px rgba(74, 158, 255, 0.3)
}

.rule-tab.active.die {
  background: var(--die-color);
  border-color: var(--die-color);
  box-shadow: 0 0 15px rgba(255, 107, 157, 0.3)
}

.rule-tab.active.das {
  background: var(--das-color);
  border-color: var(--das-color);
  box-shadow: 0 0 15px rgba(74, 222, 128, 0.3)
}

.rule-tab.active.tips {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--accent-glow)
}

/* Rule & Category Cards */
.rule-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  animation: cardEnter 0.4s ease both;
  transition: all 0.2s ease
}

.rule-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(4px)
}

.rule-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md)
}

.rule-suffix {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800
}

.rule-suffix.der {
  color: var(--der-color)
}

.rule-suffix.die {
  color: var(--die-color)
}

.rule-suffix.das {
  color: var(--das-color)
}

.rule-example {
  font-size: 14px;
  color: var(--text-secondary);
  padding: var(--space-sm) 0;
  border-top: 1px solid var(--border-glass)
}

.rule-example span {
  font-weight: 600;
  color: var(--text-primary)
}

.category-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  animation: cardEnter 0.4s ease both;
  transition: all 0.2s ease
}

.category-card:hover {
  border-color: rgba(255, 255, 255, 0.15)
}

.category-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md)
}

.category-icon {
  font-size: 26px
}

.category-title {
  font-weight: 700;
  font-size: 16px
}

.category-examples {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm)
}

.category-tag {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  transition: transform 0.2s ease
}

.category-tag:hover {
  transform: scale(1.08)
}

.category-tag.der {
  background: var(--der-bg);
  color: var(--der-color)
}

.category-tag.die {
  background: var(--die-bg);
  color: var(--die-color)
}

.category-tag.das {
  background: var(--das-bg);
  color: var(--das-color)
}

/* Tip Card (enhanced) */
.tip-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  animation: cardEnter 0.4s ease both
}

.tip-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.08), transparent);
  border-radius: 50%
}

.tip-card:hover {
  border-color: rgba(139, 92, 246, 0.25);
  transform: translateY(-2px)
}

.tip-icon {
  font-size: 32px;
  margin-bottom: var(--space-sm)
}

.tip-title {
  font-weight: 700;
  font-size: 17px;
  margin-bottom: var(--space-sm)
}

.tip-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7
}

/* ── Results Screen (enhanced) ── */
.results-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 26, 0.97);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  animation: fadeIn 0.5s ease
}

.results-overlay.hidden {
  display: none
}

.results-emoji {
  font-size: 80px;
  margin-bottom: var(--space-lg);
  animation: resultsBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1)
}

.results-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 900;
  margin-bottom: var(--space-sm);
  text-align: center;
  animation: slideUp 0.5s ease 0.2s both
}

.results-subtitle {
  color: var(--text-secondary);
  font-size: 16px;
  text-align: center;
  margin-bottom: var(--space-xl);
  animation: slideUp 0.5s ease 0.3s both
}

.results-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  width: 100%;
  max-width: 360px;
  margin-bottom: var(--space-lg);
  animation: slideUp 0.5s ease 0.4s both
}

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

.result-stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800
}

.result-stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px
}

.results-xp {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 20px;
  font-weight: 800;
  color: var(--xp-color);
  margin-bottom: var(--space-xl);
  animation: xpReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.6s both
}

.results-new-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: var(--space-lg);
  animation: badgePop 0.5s ease 0.8s both
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 14px 28px;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 100%;
  position: relative;
  overflow: hidden
}

.btn:active {
  transform: scale(0.95)
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #7C3AED);
  color: white;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3)
}

.btn-primary:hover {
  box-shadow: 0 8px 35px rgba(139, 92, 246, 0.4);
  transform: translateY(-2px)
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s ease
}

.btn-primary:hover::after {
  left: 100%
}

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

.btn-secondary:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px)
}

.btn-danger {
  background: rgba(255, 71, 87, 0.12);
  border: 1px solid rgba(255, 71, 87, 0.25);
  color: var(--error)
}

/* ── Bottom Nav ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: rgba(10, 10, 26, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  padding: var(--space-xs) 0;
  padding-bottom: calc(var(--safe-bottom) + var(--space-xs));
  z-index: 100
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: var(--space-sm) 4px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.3s ease;
  background: none;
  border: none;
  font-family: var(--font-main);
  position: relative
}

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

.nav-item.active::after {
  content: '';
  position: absolute;
  top: -1px;
  width: 24px;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 var(--radius-full) var(--radius-full)
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform 0.3s ease
}

.nav-item.active .nav-icon {
  transform: scale(1.15)
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px
}

/* ── Toast ── */
.toast {
  position: fixed;
  top: calc(var(--safe-top) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  z-index: 500;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(20px);
  white-space: nowrap
}

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

.toast.success {
  background: rgba(74, 222, 128, 0.2);
  border: 1px solid rgba(74, 222, 128, 0.3);
  color: var(--success)
}

.toast.error {
  background: rgba(255, 71, 87, 0.2);
  border: 1px solid rgba(255, 71, 87, 0.3);
  color: var(--error)
}

.toast.info {
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--accent)
}

.toast.xp {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--xp-color)
}

/* Confetti & Feedback */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 400
}

.feedback-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease
}

.feedback-overlay.show {
  opacity: 1
}

.feedback-icon {
  font-size: 100px;
  animation: feedbackPop 0.7s ease forwards
}

/* ── Back Button ── */
.back-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-md);
  font-family: var(--font-main);
  transition: all 0.2s ease
}

.back-btn:hover {
  color: var(--text-primary);
  transform: translateX(-3px)
}

/* ── Achievement Cards ── */
.achievement-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md)
}

.achievement-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
  transition: all 0.3s ease
}

.achievement-card.unlocked {
  border-color: rgba(139, 92, 246, 0.3);
  background: rgba(139, 92, 246, 0.08);
  animation: achieveGlow 2s ease-in-out infinite
}

.achievement-card.locked {
  opacity: 0.35;
  filter: grayscale(1)
}

.achievement-icon {
  font-size: 36px;
  margin-bottom: var(--space-sm)
}

.achievement-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 2px
}

.achievement-desc {
  font-size: 11px;
  color: var(--text-secondary)
}

.achievement-xp {
  font-size: 11px;
  color: var(--xp-color);
  font-weight: 600;
  margin-top: 4px
}

/* Exception badge */
.exception-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
  margin-left: var(--space-sm);
  animation: badgeShake 3s ease-in-out infinite
}

/* ── Profile Stats Section ── */
.profile-header {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
  padding: var(--space-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl)
}

.profile-avatar-large {
  font-size: 52px;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(74, 158, 255, 0.1));
  border-radius: 50%;
  border: 2px solid var(--accent)
}

.profile-header-info {
  flex: 1
}

.profile-header-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 2px
}

.profile-header-level {
  font-size: 13px;
  color: var(--text-secondary)
}

/* Article Distribution Bar */
.article-dist {
  display: flex;
  height: 8px;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: var(--space-md) 0;
  background: var(--bg-glass)
}

.article-dist-der {
  background: var(--der-color);
  transition: width 0.8s ease
}

.article-dist-die {
  background: var(--die-color);
  transition: width 0.8s ease
}

.article-dist-das {
  background: var(--das-color);
  transition: width 0.8s ease
}

.article-dist-legend {
  display: flex;
  justify-content: space-around;
  margin-top: var(--space-sm)
}

.article-dist-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary)
}

.article-dist-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%
}

/* ── XP Float ── */
.xp-float {
  position: fixed;
  font-size: 20px;
  font-weight: 800;
  color: var(--xp-color);
  animation: xpFloat 1.2s ease forwards;
  pointer-events: none;
  z-index: 350;
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.5)
}

/* ── Mini Tutorial Tooltip ── */
.mini-tutorial {
  position: relative
}

.mini-tutorial-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: rgba(139, 92, 246, 0.95);
  color: white;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 50
}

.mini-tutorial-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(139, 92, 246, 0.95)
}

.mini-tutorial:hover .mini-tutorial-tip {
  opacity: 1;
  transform: translateX(-50%) scale(1)
}

/* ══════════════════════════
   ANIMATIONS
   ══════════════════════════ */
@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(24px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0)
  }

  50% {
    transform: translateY(-8px)
  }
}

@keyframes loadBar {
  0% {
    width: 0%
  }

  50% {
    width: 70%
  }

  100% {
    width: 100%
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: 0.5
  }
}

@keyframes splashPop {
  0% {
    transform: scale(0) rotate(-30deg);
    opacity: 0
  }

  60% {
    transform: scale(1.2) rotate(5deg);
    opacity: 1
  }

  100% {
    transform: scale(1) rotate(0)
  }
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.97)
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1)
  }
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateX(-15px)
  }

  to {
    opacity: 1;
    transform: translateX(0)
  }
}

@keyframes wordEnter {
  from {
    opacity: 0;
    transform: scale(0.8)
  }

  to {
    opacity: 1;
    transform: scale(1)
  }
}

@keyframes correctBurst {
  0% {
    transform: scale(1)
  }

  30% {
    transform: scale(1.12)
  }

  50% {
    transform: scale(0.97)
  }

  100% {
    transform: scale(1)
  }
}

@keyframes wrongShake {

  0%,
  100% {
    transform: translateX(0)
  }

  15% {
    transform: translateX(-10px) rotate(-1deg)
  }

  30% {
    transform: translateX(10px) rotate(1deg)
  }

  45% {
    transform: translateX(-8px)
  }

  60% {
    transform: translateX(8px)
  }

  75% {
    transform: translateX(-4px)
  }

  90% {
    transform: translateX(4px)
  }
}

@keyframes revealPulse {
  0% {
    box-shadow: 0 0 0 rgba(74, 222, 128, 0)
  }

  50% {
    box-shadow: 0 0 30px rgba(74, 222, 128, 0.4)
  }

  100% {
    box-shadow: 0 0 15px rgba(74, 222, 128, 0.2)
  }
}

@keyframes bounceIn {
  0% {
    transform: scale(0)
  }

  50% {
    transform: scale(1.2)
  }

  100% {
    transform: scale(1)
  }
}

@keyframes feedbackPop {
  0% {
    transform: scale(0) rotate(-20deg);
    opacity: 0
  }

  40% {
    transform: scale(1.4) rotate(5deg);
    opacity: 1
  }

  70% {
    transform: scale(0.9);
    opacity: 0.8
  }

  100% {
    transform: scale(1);
    opacity: 0
  }
}

@keyframes xpFloat {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1
  }

  100% {
    transform: translateY(-80px) scale(1.3);
    opacity: 0
  }
}

@keyframes headerPulse {
  0% {
    transform: scale(1)
  }

  50% {
    transform: scale(1.15)
  }

  100% {
    transform: scale(1)
  }
}

@keyframes fireGlow {

  0%,
  100% {
    box-shadow: 0 0 5px rgba(255, 71, 87, 0.2)
  }

  50% {
    box-shadow: 0 0 15px rgba(255, 71, 87, 0.4)
  }
}

@keyframes levelGlow {

  0%,
  100% {
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.3)
  }

  50% {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.5)
  }
}

@keyframes levelShine {

  0%,
  100% {
    opacity: 0
  }

  50% {
    opacity: 1
  }
}

@keyframes comboFire {
  0% {
    transform: scale(1)
  }

  50% {
    transform: scale(1.3)
  }

  100% {
    transform: scale(1)
  }
}

@keyframes countPop {
  0% {
    transform: scale(1)
  }

  50% {
    transform: scale(1.2)
  }

  100% {
    transform: scale(1)
  }
}

@keyframes dotPulse {

  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 5px rgba(139, 92, 246, 0.3)
  }

  50% {
    opacity: 0.7;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5)
  }
}

@keyframes timerPulse {

  0%,
  100% {
    transform: scale(1)
  }

  50% {
    transform: scale(1.05)
  }
}

@keyframes resultsBounce {
  0% {
    transform: scale(0) rotate(-15deg)
  }

  50% {
    transform: scale(1.15) rotate(5deg)
  }

  75% {
    transform: scale(0.95)
  }

  100% {
    transform: scale(1) rotate(0)
  }
}

@keyframes xpReveal {
  from {
    opacity: 0;
    transform: scale(0.5) translateY(20px)
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0)
  }
}

@keyframes badgePop {
  from {
    opacity: 0;
    transform: scale(0)
  }

  to {
    opacity: 1;
    transform: scale(1)
  }
}

@keyframes achieveGlow {

  0%,
  100% {
    box-shadow: 0 0 5px rgba(139, 92, 246, 0.1)
  }

  50% {
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.2)
  }
}

@keyframes tipSlide {
  from {
    opacity: 0;
    transform: translateX(-20px)
  }

  to {
    opacity: 1;
    transform: translateX(0)
  }
}

@keyframes tipShimmer {
  0% {
    left: -100%
  }

  50% {
    left: 100%
  }

  100% {
    left: 100%
  }
}

@keyframes badgeShake {

  0%,
  90%,
  100% {
    transform: rotate(0)
  }

  93% {
    transform: rotate(-3deg)
  }

  96% {
    transform: rotate(3deg)
  }
}

/* ── Responsive ── */
@media(min-width:768px) {
  #app {
    max-width: 520px
  }

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

  .achievement-grid {
    grid-template-columns: repeat(3, 1fr)
  }
}

@media(min-width:1024px) {
  #app {
    max-width: 560px;
    border-left: 1px solid var(--border-glass);
    border-right: 1px solid var(--border-glass)
  }
}

::-webkit-scrollbar {
  width: 4px
}

::-webkit-scrollbar-track {
  background: transparent
}

::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: var(--radius-full)
}

/* ══════════════════════════
   LANGUAGE SELECTOR
   ══════════════════════════ */

/* Language selector on login screen */
.login-lang-bar {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap
}

.lang-flag-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-glass);
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease
}

.lang-flag-btn:hover,
.lang-flag-btn.active {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.15);
  transform: scale(1.15)
}

/* Settings Language Button */
.lang-btn-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.3s ease;
  font-family: var(--font-main)
}

.lang-btn-header:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  transform: scale(1.05)
}

.lang-btn-header .lang-flag {
  font-size: 16px
}

/* Language Modal */
.lang-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 26, 0.95);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  z-index: 2200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  animation: fadeIn 0.3s ease
}

.lang-modal.hidden {
  display: none
}

.lang-modal-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  margin-bottom: var(--space-sm);
  text-align: center
}

.lang-modal-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: var(--space-xl);
  text-align: center
}

.lang-options {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: var(--space-md)
}

.lang-option {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden
}

.lang-option::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), transparent);
  opacity: 0;
  transition: opacity 0.3s ease
}

.lang-option:hover::before,
.lang-option.active::before {
  opacity: 1
}

.lang-option:hover,
.lang-option.active {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--accent-glow)
}

.lang-option:active {
  transform: scale(0.97)
}

.lang-option .lang-flag {
  font-size: 28px;
  flex-shrink: 0
}

.lang-option .lang-name {
  font-weight: 700;
  font-size: 15px;
  flex: 1;
  position: relative;
  z-index: 1
}

.lang-option .lang-check {
  font-size: 18px;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.3s ease;
  position: relative;
  z-index: 1
}

.lang-option.active .lang-check {
  opacity: 1
}

.lang-close {
  margin-top: var(--space-xl)
}

/* ══════════════════════════
   RTL SUPPORT (Arabic)
   ══════════════════════════ */
body.rtl {
  direction: rtl;
  text-align: right
}

body.rtl .header-left {
  flex-direction: row-reverse
}

body.rtl .header-right {
  flex-direction: row-reverse
}

body.rtl .mode-card {
  flex-direction: row-reverse
}

body.rtl .mode-arrow {
  transform: scaleX(-1)
}

body.rtl .mode-card:hover .mode-arrow {
  transform: scaleX(-1) translateX(4px)
}

body.rtl .back-btn {
  flex-direction: row-reverse
}

body.rtl .back-btn:hover {
  transform: translateX(3px)
}

body.rtl .profile-slot {
  flex-direction: row-reverse
}

body.rtl .profile-slot .profile-delete {
  left: 8px;
  right: auto
}

body.rtl .category-header {
  flex-direction: row-reverse
}

body.rtl .rule-card-header {
  flex-direction: row-reverse
}

body.rtl .level-info {
  flex-direction: row-reverse
}

body.rtl .level-badge {
  flex-direction: row-reverse
}

body.rtl .daily-tip {
  flex-direction: row-reverse
}

body.rtl .welcome-banner {
  text-align: right
}


body.rtl .combo-display {
  left: 20px;
  right: auto;
  text-align: left
}

body.rtl .rule-card:hover {
  transform: translateX(-4px)
}

body.rtl .profile-header {
  flex-direction: row-reverse
}

body.rtl .article-dist-legend {
  flex-direction: row-reverse
}

body.rtl .stat-card {
  text-align: center
}

body.rtl .header-xp,
.rtl .header-streak {
  flex-direction: row-reverse
}

/* ── CASES MODE ── */
.case-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
  margin-bottom: var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  animation: fadeIn 0.4s ease;
}

.case-sentence {
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.6;
  font-weight: 500;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.case-blank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  height: 40px;
  border-bottom: 2px dashed var(--text-muted);
  color: transparent;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-weight: 800;
  padding: 0 10px;
  user-select: none;
}

.case-blank:hover:not(.revealed) {
  border-bottom-color: var(--accent);
  background: rgba(139, 92, 246, 0.1);
  border-radius: var(--radius-sm);
}

.case-blank.revealed {
  border-bottom: 2px solid transparent;
  border-radius: var(--radius-md);
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  transform: scale(1.1);
  cursor: default;
}

.case-blank.revealed.der {
  background: var(--der-color);
  box-shadow: var(--der-glow);
}

.case-blank.revealed.die {
  background: var(--die-color);
  box-shadow: var(--die-glow);
}

.case-blank.revealed.das {
  background: var(--das-color);
  box-shadow: var(--das-glow);
}

.case-noun {
  font-weight: 700;
  display: inline-flex;
}

.case-suffix.der {
  color: var(--der-color);
  font-weight: 900;
}

.case-suffix.die {
  color: var(--die-color);
  font-weight: 900;
}

.case-suffix.das {
  color: var(--das-color);
  font-weight: 900;
}

.case-focus-word {
  color: var(--accent);
  font-weight: 800;
  border-bottom: 1px dotted var(--accent);
}

.case-explanation {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent);
  font-size: 14px;
  color: var(--text-primary);
  text-align: left;
  line-height: 1.5;
  display: none;
  width: 100%;
  animation: slideDown 0.3s ease-out;
}

.case-explanation.show {
  display: block;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Animations for Cases Guide */
.anim-box {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 50px;
  margin: 10px 0;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 0 15px;
  position: relative;
  overflow: hidden;
}

.anim-nom {
  font-size: 28px;
  animation: bounceNom 2s infinite ease-in-out;
}

@keyframes bounceNom {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.anim-akk-obj {
  font-size: 28px;
}

.anim-akk-arrow {
  color: var(--accent);
  font-size: 20px;
  margin: 0 15px;
  animation: moveAkk 1.5s infinite;
}

@keyframes moveAkk {
  0% {
    transform: translateX(-5px);
    opacity: 0;
  }

  50% {
    transform: translateX(5px);
    opacity: 1;
  }

  100% {
    transform: translateX(15px);
    opacity: 0;
  }
}

.anim-dat-gift {
  font-size: 24px;
  position: absolute;
  animation: giveDat 2s infinite ease-in-out;
}

@keyframes giveDat {
  0% {
    left: 50px;
    transform: scale(0.8);
    opacity: 0;
  }

  30% {
    opacity: 1;
    transform: scale(1);
  }

  70% {
    left: 90px;
    transform: scale(1);
    opacity: 1;
  }

  100% {
    left: 90px;
    transform: scale(0.8);
    opacity: 0;
  }
}

.anim-gen-link {
  font-size: 20px;
  color: #10B981;
  margin: 0 10px;
  animation: pulseGen 2s infinite ease-in-out;
}

@keyframes pulseGen {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }

  50% {
    transform: scale(1.3);
    opacity: 1;
  }
}

@keyframes giveDatAr {
  0% {
    right: 50px;
    left: auto;
    transform: scale(0.8);
    opacity: 0;
  }

  30% {
    opacity: 1;
    transform: scale(1);
  }

  70% {
    right: 90px;
    left: auto;
    transform: scale(1);
    opacity: 1;
  }

  100% {
    right: 90px;
    left: auto;
    transform: scale(0.8);
    opacity: 0;
  }
}

.anim-eat-apple {
  font-size: 28px;
  animation: eatApple 2s infinite ease-in;
}

@keyframes eatApple {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(0.5);
    opacity: 0.5;
  }

  100% {
    transform: scale(0);
    opacity: 0;
  }
}

.anim-drive-car {
  font-size: 28px;
  animation: driveCar 2s infinite ease-out;
  display: inline-block;
}

@keyframes driveCar {
  0% {
    transform: translateX(-15px);
    opacity: 0;
  }

  20% {
    opacity: 1;
  }

  80% {
    opacity: 1;
  }

  100% {
    transform: translateX(30px);
    opacity: 0;
  }
}

@keyframes driveCarAr {
  0% {
    transform: translateX(15px);
    opacity: 0;
  }

  20% {
    opacity: 1;
  }

  80% {
    opacity: 1;
  }

  100% {
    transform: translateX(-30px);
    opacity: 0;
  }
}

.anim-bike {
  font-size: 24px;
  animation: driveBike 2.5s infinite linear;
  display: inline-block;
}

@keyframes driveBike {
  0% {
    transform: translateX(-10px);
  }

  50% {
    transform: translateX(20px);
  }

  100% {
    transform: translateX(-10px);
  }
}

.anim-static-park {
  font-size: 28px;
}