:root {
  --primary: #1a4731;
  --primary-light: #2a5741;
  --secondary: #2d6a4f;
  --accent: #40916c;
  --gold: #d4a373;
  --cream: #faf6f1;
  --dark: #1b4332;
  --background: linear-gradient(135deg, #f8fffe 0%, #f1f5f3 50%, #eef3f1 100%);
  --text-color: #1f2937;
  --text-light: #f1faee;
  --danger: #e76f51;
  --warning: #fca311;
  --success: #52b788;
  --shadow: 0 4px 20px rgba(26, 71, 49, 0.08);
  --shadow-hover: 0 8px 30px rgba(26, 71, 49, 0.15);
  --card-shadow: 0 10px 40px rgba(26, 71, 49, 0.12);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --fast-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius: 20px;
  --border-radius-sm: 14px;
  --border-radius-xs: 10px;
  --glow: 0 0 20px rgba(64, 145, 108, 0.2);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(235, 235, 235, 0.5);
  --input-border: rgba(0, 0, 0, 0.08);
}

body.dark-mode {
  --primary: #52b788;
  --primary-light: #40916c;
  --secondary: #2d6a4f;
  --accent: #b7e4c7;
  --gold: #f4d35e;
  --dark: #edf2f4;
  --background: linear-gradient(135deg, #1d2d27 0%, #15201b 50%, #101815 100%);
  --text-color: #e2e8f0;
  --text-light: #1d2d27;
  --danger: #f28482;
  --warning: #fca311;
  --success: #80ed99;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.25);
  --card-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  --glass-bg: rgba(30, 41, 59, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --input-border: rgba(255, 255, 255, 0.12);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: clamp(14px, 1.2vw, 16px);
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'SF Pro Display', 'Segoe UI', -apple-system, sans-serif;
  background: var(--background);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
  transition: background-color 0.4s ease, color 0.4s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse at 20% 10%, rgba(64, 145, 108, 0.04) 0%, transparent 40%),
    radial-gradient(ellipse at 80% 90%, rgba(212, 163, 115, 0.03) 0%, transparent 40%),
    radial-gradient(ellipse at 40% 60%, rgba(26, 71, 49, 0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

.container {
  width: min(95%, 1440px);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 3vw, 2rem);
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.btn {
  padding: clamp(0.75rem, 2vw, 1rem) clamp(1.5rem, 4vw, 2.5rem);
  font-size: clamp(0.9rem, 1.8vw, 1rem);
  font-weight: 600;
  text-decoration: none;
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: inherit;
  letter-spacing: 0.02em;
  text-transform: none;
  touch-action: manipulation;
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover::before {
  left: 100%;
}

.btn:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:active, .btn.active {
  transform: translateY(1px) scale(0.98);
  box-shadow: var(--shadow);
}

.btn .spinner {
  animation: spin 1s linear infinite;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: linear-gradient(135deg, var(--accent) 0%, #52b788 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #c04c30 100%);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #c04c30 0%, #a53e26 100%);
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(231, 111, 81, 0.25);
}

header {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.04);
  padding: clamp(0.8rem, 2vw, 1.2rem) 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: min(95%, 1440px);
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem);
}

.logo {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: var(--transition);
  letter-spacing: -0.02em;
}

.logo:hover {
  transform: scale(1.02);
  color: var(--accent);
}

.logo::before {
  content: "";
  display: inline-block;
  width: clamp(1rem, 2.5vw, 1.4rem);
  height: clamp(1rem, 2.5vw, 1.4rem);
  background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(64, 145, 108, 0.25);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.8rem, 2vw, 1.2rem);
}

.user-menu {
  position: relative;
}

#user-menu-btn {
  background: transparent;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  width: clamp(40px, 8vw, 48px);
  height: clamp(40px, 8vw, 48px);
  padding: 0;
  border-radius: 50%;
  transition: var(--transition);
}

#user-menu-btn:hover {
  background: var(--glass-border);
  transform: translateY(-1px);
  color: var(--primary);
}

#user-menu-btn svg {
  width: clamp(18px, 4vw, 22px);
  height: clamp(18px, 4vw, 22px);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--card-shadow);
  list-style: none;
  padding: 0.6rem;
  z-index: 1001;
  display: none;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 220px;
  border: 1px solid var(--glass-border);
}

.user-menu.open .user-dropdown {
  display: flex;
  animation: fadeInScale 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.user-dropdown .dropdown-header {
  padding: 0.8rem 1rem;
  font-size: 0.85rem;
  color: var(--text-color);
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 0.4rem;
  cursor: default;
  font-weight: 600;
}

.user-dropdown a,
.user-dropdown button {
  text-align: left;
  background: none;
  border: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-radius: var(--border-radius-xs);
  cursor: pointer;
  transition: var(--fast-transition);
  font-size: 0.9rem;
  color: var(--text-color);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  font-family: inherit;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
  background-color: var(--glass-border);
  color: var(--primary);
  transform: translateX(2px);
}

.user-dropdown .lang-dropdown-inner {
  list-style: none;
  padding: 0;
  margin-top: 0.4rem;
}

.dropdown-back-btn {
  background: none;
  border: none;
  width: 100%;
  padding: 0.6rem 1rem;
  font-weight: 600;
  color: var(--secondary);
  cursor: pointer;
  text-align: left;
  border-radius: var(--border-radius-xs);
  font-size: 0.85rem;
  font-family: inherit;
}

.dropdown-back-btn:hover {
  background-color: var(--glass-border);
}

.user-dropdown .lang-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-radius: var(--border-radius-xs);
  cursor: pointer;
  transition: var(--fast-transition);
}

.user-dropdown .lang-option:hover {
  background-color: var(--glass-border);
  transform: translateX(2px);
}

.user-dropdown .lang-option .flag-icon {
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: screenFadeIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  width: 100%;
  flex-grow: 1;
}

.screen.active {
  display: flex;
}

@keyframes screenFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#auth-screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  width: 100%;
  padding: 1rem;
  overflow-y: auto;
}

.auth-screen-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 480px;
}

.app-description {
  background: transparent;
  padding: 0;
  text-align: left;
  width: 100%;
  border: none;
  box-shadow: none;
  margin-bottom: -0.8rem;
}

.description-wrapper {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.description-wrapper:has(.expanded) {
  flex-direction: column;
  align-items: flex-start;
}

.app-description-content {
  font-size: 0.85rem;
  line-height: 1.5;
  transition: max-height 0.4s ease-in-out;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
}

.app-description-content.expanded {
  max-height: 250px;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

#read-more-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  padding: 0 0 0 0.4rem;
  flex-shrink: 0;
}

.card-container {
  max-width: 480px;
  width: 100%;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  transition: var(--transition);
  border: 1px solid var(--glass-border);
  position: relative;
  overflow: hidden;
}

#progress-screen .card-container {
  max-width: 900px;
}

.card-container:hover {
  box-shadow: 0 15px 50px rgba(26, 71, 49, 0.12);
  transform: translateY(-1px);
}

body.dark-mode .card-container:hover {
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.18);
}

.auth-tabs,
.account-tabs {
  display: flex;
  border-bottom: 2px solid var(--glass-border);
  margin-bottom: 1.5rem;
  position: relative;
  border-radius: var(--border-radius-xs) var(--border-radius-xs) 0 0;
  overflow: hidden;
}

.auth-tab,
.account-tab {
  flex: 1;
  padding: 1rem;
  background: none;
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text-color);
  opacity: 0.7;
  border-bottom: 3px solid transparent;
  transition: var(--transition);
  position: relative;
  z-index: 1;
  font-weight: 600;
  font-family: inherit;
}

.auth-tab.active,
.account-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  opacity: 1;
}

.auth-form,
.account-form-panel {
  display: none;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

.auth-form.active,
.account-form-panel.active {
  display: flex;
  animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-form h2 {
  font-size: clamp(1.4rem, 3vw, 1.6rem);
  color: var(--dark);
  margin-bottom: 1.2rem;
  text-align: center;
  font-weight: 700;
}

.input-group {
  text-align: left;
  position: relative;
}

.input-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
  color: var(--text-color);
}

.input-field {
  width: 100%;
  padding: 1rem 1.2rem;
  font-size: 0.95rem;
  border: 2px solid var(--input-border);
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  position: relative;
  font-family: inherit;
  color: var(--text-color);
}

body.dark-mode .input-field {
  background: rgba(0, 0, 0, 0.15);
}

.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 71, 49, 0.1), var(--glow);
  outline: none;
  transform: translateY(-1px);
}

.message-box {
  text-align: center;
  font-weight: 600;
  padding: 1rem 1.2rem;
  border-radius: var(--border-radius-sm);
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeInUp 0.25s;
}

.message-box.success {
  color: #0f5132;
  background: linear-gradient(135deg, rgba(212, 237, 218, 0.85) 0%, rgba(195, 230, 203, 0.85) 100%);
  border: 2px solid rgba(195, 230, 203, 0.5);
  display: flex;
  box-shadow: 0 4px 15px rgba(82, 183, 136, 0.15);
}

.message-box.error {
  color: #58151c;
  background: linear-gradient(135deg, rgba(248, 215, 218, 0.85) 0%, rgba(245, 198, 203, 0.85) 100%);
  border: 2px solid rgba(245, 198, 203, 0.5);
  display: flex;
  box-shadow: 0 4px 15px rgba(231, 111, 81, 0.15);
}

.forgot-password-link {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
  font-size: 0.8rem;
  margin-top: 0.4rem;
}

.forgot-password-link a {
  color: var(--secondary);
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  font-weight: 500;
  text-align: center;
  flex: 1;
  min-width: 130px;
}

.forgot-password-link a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 0.25s ease;
}

.forgot-password-link a:hover::after {
  width: 100%;
}

.forgot-password-link a:hover {
  color: var(--primary);
}

.remember-me-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-align: left;
  margin-top: -0.4rem;
}

.remember-me-group label {
  font-weight: 500;
  color: var(--text-color);
  cursor: pointer;
}

.remember-me-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.form-step {
  display: none;
  flex-direction: column;
  gap: 1.4rem;
}

.form-step.active {
  display: flex;
  animation: fadeInUp 0.3s ease-out;
}

.screen h2 {
  margin-bottom: 2rem;
  color: var(--primary);
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  font-weight: 700;
  letter-spacing: -0.02em;
}

body.dark-mode .screen h2 {
  background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.screen h2::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
  border-radius: 2px;
}

.progress-container {
  width: 100%;
  max-width: 900px;
}

.progress-dialect-card {
  background: var(--glass-bg);
  border-radius: var(--border-radius);
  margin-bottom: 1.2rem;
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  transition: var(--transition);
}

.progress-dialect-card:hover {
  box-shadow: var(--card-shadow);
  transform: translateY(-2px);
}

.dialect-summary {
  padding: clamp(1.2rem, 3vw, 1.6rem);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialect-summary h4 {
  margin: 0;
  font-size: clamp(1.3rem, 2.8vw, 1.5rem);
  color: var(--text-color);
  font-family: 'Inter', sans-serif;
  font-weight: 700;
}

.dialect-details {
  padding: clamp(1.2rem, 3vw, 1.6rem);
  border-top: 1px solid var(--glass-border);
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: clamp(1.2rem, 3vw, 1.6rem);
  width: 100%;
}

.lesson-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  padding: clamp(1.5rem, 4vw, 2rem);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--glass-border);
  border-left: 4px solid var(--accent);
  text-align: left;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 160px;
}

.lesson-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow);
  border-left-color: var(--primary);
}

.lesson-card.locked {
  opacity: 0.6;
  border-left-color: #ccc;
  cursor: pointer;
}

.lesson-card.locked::after {
  content: '🔒';
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  font-size: 1.6rem;
  opacity: 0.6;
}

.lesson-card h3 {
  font-size: 1rem;
}

.back-link {
  color: var(--primary);
  background: var(--glass-bg);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.2rem;
  border-radius: 50px;
  box-shadow: var(--shadow);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: var(--transition);
}

.back-link:hover {
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.back-link::before {
  content: '←';
  font-size: 1.1rem;
  transition: transform 0.2s ease-out;
}

.back-link:hover::before {
  transform: translateX(-2px);
}

#flashcard-screen {
  max-width: 900px;
  justify-content: flex-start;
}

.flashcard-ui {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 0.8rem 0.4rem;
}

.flashcard-widget {
  position: relative;
  width: 100%;
  margin-top: 1.2rem;
}

.card-area {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  padding: 0;
}

.flashcard-ui .card-scene {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  perspective: 1200px;
  -webkit-perspective: 1200px;
}

.flashcard-ui .card-container-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 260px;
  transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  border-radius: var(--border-radius);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: 0 15px 35px -8px rgba(26, 71, 49, 0.1);
}

body.dark-mode .flashcard-ui .card-container-inner {
  box-shadow: 0 15px 35px -8px rgba(0, 0, 0, 0.15);
}

.flashcard-ui .card-container-inner.is-flipped {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
}

.flashcard-ui .card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  padding: clamp(1.2rem, 4vw, 1.6rem);
  padding-top: clamp(2rem, 4vw, 2.4rem);
  border-radius: var(--border-radius);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.flashcard-ui .card-front,
.flashcard-ui .card-back {
  background: transparent;
}

.flashcard-ui .card-back {
  display: flex;
  justify-content: center;
  align-items: center;
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
}

.flashcard-ui .card-back .card-content-text {
  font-size: clamp(0.85rem, 4vw, 1.2rem);
  line-height: 1.5;
  text-align: center;
  width: 100%;
  max-height: 100%;
  overflow-y: auto;
}

.card-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: absolute;
  top: 0;
  left: 0;
  padding: clamp(0.8rem, 3vw, 1.2rem);
  box-sizing: border-box;
}

.lesson-title-display {
  position: static;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-color);
  opacity: 0.6;
  z-index: 2;
}

#play-audio-btn {
  position: static;
  flex-shrink: 0; 
  width: 44px;
  height: 44px;
  background: var(--glass-border);
  color: var(--secondary);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
  z-index: 5;
}

#play-audio-btn:hover {
  transform: scale(1.08);
  background-color: var(--accent);
  color: white;
}

#play-audio-btn svg {
  width: 20px;
  height: 20px;
}

.flashcard-center-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex-grow: 1;
  width: 100%;
  padding-top: 44px;
}

.card-content-text {
  width: 100%;
  text-align: center;
  padding: 0 0.4rem;
}

.content-word {
  font-size: clamp(2.2rem, 10vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
}

.content-sentence {
  font-size: clamp(1.1rem, 5vw, 1.8rem);
  font-weight: 600;
  line-height: 1.4;
}

.content-paragraph {
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
  align-self: flex-start;
  padding-top: 0.8rem;
}

.flashcard-ui #card-phonetic {
  font-size: clamp(0.9rem, 4vw, 1.1rem);
  color: var(--secondary);
  margin-top: 0.8rem;
  font-weight: 400;
  font-style: italic;
}

.flashcard-actions {
  flex-shrink: 0;
  width: 100%;
  padding: 0;
  margin-top: 0;
  position: relative;
  z-index: 5;
}

.difficulty-buttons-on-card {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.6rem;
  width: 100%;
  max-width: 420px;
  margin: 0.8rem auto 0 auto;
  padding: 0 0.8rem;
}

.btn-difficulty {
  flex: 1;
  padding: 0.7rem 0.4rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.8rem;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: transform 0.1s ease-out, box-shadow 0.1s ease-out;
  min-width: 0;
  white-space: nowrap;
}

.btn-difficulty:active {
  transform: translateY(1px);
  box-shadow: none !important;
}

.btn-difficulty[data-difficulty="again"] {
  background: linear-gradient(to top, #d97706, #f59e0b);
  box-shadow: 0 3px 0 0 #b45309;
}

.btn-difficulty[data-difficulty="again"]:hover {
  background: linear-gradient(to top, #e08110, #ffb02b);
}

.btn-difficulty[data-difficulty="hard"] {
  background: linear-gradient(to top, #dc2626, #ef4444);
  box-shadow: 0 3px 0 0 #b91c1c;
}

.btn-difficulty[data-difficulty="hard"]:hover {
  background: linear-gradient(to top, #e23535, #ff5353);
}

.btn-difficulty[data-difficulty="medium"] {
  background: linear-gradient(to top, #2563eb, #3b82f6);
  box-shadow: 0 3px 0 0 #1d4ed8;
}

.btn-difficulty[data-difficulty="medium"]:hover {
  background: linear-gradient(to top, #346ff1, #4a8cf9);
}

.btn-difficulty[data-difficulty="easy"] {
  background: linear-gradient(to top, #16a34a, #22c55e);
  box-shadow: 0 3px 0 0 #15803d;
}

.btn-difficulty[data-difficulty="easy"]:hover {
  background: linear-gradient(to top, #25b259, #31d46d);
}

.flip-instruction {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.2rem;
  color: var(--secondary);
  opacity: 0.7;
  font-size: 0.75rem;
  font-style: italic;
}

.card-feedback-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--border-radius);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 1.6rem;
  z-index: 10;
  color: var(--primary);
  animation: overlayFadeIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: var(--card-shadow);
  border: 2px solid var(--glass-border);
}

@keyframes overlayFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.notification-menu {
  position: relative;
  display: none;
}

#notification-btn {
  background: transparent;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(40px, 8vw, 48px);
  height: clamp(40px, 8vw, 48px);
  padding: 0;
  border-radius: 50%;
  transition: var(--transition);
  position: relative;
}

#notification-btn:hover {
  background: var(--glass-border);
  color: var(--primary);
}

.notification-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background-color: var(--danger);
  color: white;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 10px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--background);
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--card-shadow);
  padding: 0.4rem;
  z-index: 1001;
  display: none;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 300px;
  border: 1px solid var(--glass-border);
}

.notification-menu.open .notification-dropdown {
  display: flex;
  animation: fadeInScale 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.notification-item {
  display: flex;
  gap: 0.8rem;
  padding: 0.8rem;
  border-radius: var(--border-radius-xs);
  text-align: left;
  color: var(--text-color);
  cursor: pointer;
  transition: var(--fast-transition);
  border: 1px solid transparent;
  position: relative;
}

.notification-item:hover {
  background-color: var(--glass-border);
  border-color: var(--accent);
}

.notification-close-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: none;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  color: #9ca3af;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  transition: color 0.2s ease;
}

.notification-close-btn:hover {
  color: var(--text-color);
}

.notification-icon {
  flex-shrink: 0;
  font-size: 1.3rem;
  margin-top: 2px;
}

.notification-content h4 {
  margin: 0 0 0.2rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-color);
}

.notification-content p {
  font-size: 0.85rem;
  opacity: 0.8;
  line-height: 1.4;
  margin: 0;
}

.notification-progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
  font-weight: 600;
  color: var(--secondary);
  width: 100%;
}

.notification-item .goal-progress-bar-container {
  width: 100%;
  height: 6px;
  background-color: var(--glass-border);
  border-radius: 3px;
  overflow: hidden;
}

.notification-item .goal-progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  border-radius: 3px;
  transition: width 0.4s ease;
}

.no-notifications {
  padding: 1.2rem;
  text-align: center;
  color: var(--text-color);
  opacity: 0.6;
  font-style: italic;
  cursor: default;
}

#dialect-selection-screen .dialect-choice-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  max-width: 650px;
  width: 100%;
}

#dialect-selection-screen .btn {
  width: 100%;
  padding: clamp(1.2rem, 3vw, 2rem);
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  position: relative;
  overflow: hidden;
  font-weight: 700;
}

#level-choice-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  width: 100%;
  max-width: 650px;
}

.modal {
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 1.2rem;
  overflow-y: auto;
  padding-top: 4vh;
  padding-bottom: 4vh;
}

.modal-content {
  background: var(--glass-bg);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--card-shadow);
  max-width: 520px;
  width: 100%;
  text-align: center;
  position: relative;
  border: 1px solid var(--glass-border);
  color: var(--text-color);
}

.close-modal {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 2.2rem;
  font-weight: bold;
  color: var(--text-color);
  opacity: 0.6;
  cursor: pointer;
  line-height: 1;
  transition: var(--fast-transition);
}

.close-modal:hover {
  opacity: 1;
  transform: scale(1.08);
}

.modal.active {
  display: flex;
  animation: modalFadeIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

footer {
  width: 100%;
  background: linear-gradient(135deg, #1d2d27 0%, #101815 100%);
  color: var(--cream);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1.2rem;
  padding: 1.6rem 5%;
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.2rem;
  font-size: 0.85rem;
}

.footer-links a {
  color: var(--cream);
  text-decoration: none;
  font-weight: 500;
  opacity: 0.8;
  transition: var(--fast-transition);
  position: relative;
  padding-bottom: 3px;
}

.footer-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--gold);
  transition: width 0.25s ease;
}

.footer-links a:hover {
  opacity: 1;
}

.footer-links a:hover::after {
  width: 100%;
}

.patreon-notice {
  font-size: 0.75rem;
  opacity: 0.7;
  max-width: 550px;
  line-height: 1.4;
}

.floating-home-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: clamp(50px, 10vw, 58px);
  height: clamp(50px, 10vw, 58px);
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  z-index: 1000;
  transition: var(--transition);
  text-decoration: none;
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

#auth-screen.active .floating-home-btn {
  display: flex;
  animation: fadeInUp 0.4s ease-out;
}

.floating-home-btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: var(--shadow-hover);
}

.floating-home-btn svg {
  width: clamp(20px, 5vw, 24px);
  height: clamp(20px, 5vw, 24px);
}

.faq-modal-content {
  max-width: 850px;
  text-align: left;
}

.faq-modal-content h2 {
  text-align: center;
}

.faq-container {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 0.8rem;
}

.faq-item {
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--glass-border);
  transition: var(--transition);
}

.faq-item[open] {
  background: var(--glass-bg);
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}

.faq-item summary {
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  font-weight: 600;
  color: var(--text-color);
  padding: clamp(1rem, 2.5vw, 1.2rem);
  cursor: pointer;
  list-style: none;
  position: relative;
  transition: var(--fast-transition);
}

.faq-item summary:hover {
  background-color: var(--glass-border);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '+';
  position: absolute;
  right: clamp(1rem, 2.5vw, 1.2rem);
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  font-weight: 300;
  color: var(--accent);
  transition: transform 0.25s ease;
}

.faq-item[open] summary::after {
  transform: translateY(-50%) rotate(45deg);
}

.faq-item p {
  padding: 0 clamp(1rem, 2.5vw, 1.2rem) clamp(1rem, 2.5vw, 1.2rem) clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-color);
  opacity: 0.8;
  line-height: 1.6;
}

.faq-item ul {
  padding: 0 clamp(1rem, 2.5vw, 1.2rem) clamp(1rem, 2.5vw, 1.2rem) clamp(2.5rem, 5vw, 3rem);
  color: var(--text-color);
  opacity: 0.8;
  line-height: 1.6;
}

html[lang="mg"] #faq-link {
  display: none;
}

details > summary {
  list-style: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

details > summary::before {
  content: '▶';
  margin-right: 0.8rem;
  font-size: 0.75em;
  color: var(--accent);
  transition: transform 0.2s ease-in-out;
  display: inline-block;
}

details[open] > summary::before {
  transform: rotate(90deg);
}

#header-back-btn {
  background: transparent;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 50%;
  transition: var(--fast-transition);
  margin-right: 0.4rem;
}

#header-back-btn:hover {
  background-color: var(--glass-border);
  color: var(--accent);
}

#header-back-btn svg {
  display: block;
}

.navigation-popup-buttons, .revision-reminder-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 1.2rem;
}

.navigation-popup-buttons .btn, .revision-reminder-buttons .btn {
  width: 100%;
}

.navigation-popup-buttons .btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  border-color: #bbb;
  transform: none;
  box-shadow: none;
}

.navigation-popup-buttons .btn:disabled:hover {
  background: #ccc;
}

#revision-reminder-modal p {
  font-size: 1.05rem;
  line-height: 1.5;
  margin: 0.8rem 0 1.2rem 0;
}

.password-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.password-wrapper .input-field {
    padding-left: 1.2rem !important; 
    padding-right: 70px !important;  
}

.toggle-password {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 44px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--secondary);
  padding: 0;
}

.toggle-password:hover {
  color: var(--primary);
}

.toggle-password svg {
  width: 18px;
  height: 18px;
}

.toggle-password .icon-eye-off {
  display: none;
}

#account-screen .screen-navigation, #account-details-screen .screen-navigation {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto 1.5rem auto;
}

.dashboard-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.dashboard-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 0.4rem;
}

.dashboard-subtitle {
  font-size: 1.05rem;
  color: var(--secondary);
  margin-top: 0;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.2rem;
  width: 100%;
  max-width: 1200px;
}

.dashboard-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-sm);
  padding: 1.2rem;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.dashboard-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.card-icon {
  flex-shrink: 0;
  width: 54px;
  height: 54px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  background-color: var(--glass-border);
}

.card-content h3 {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-color);
  margin: 0;
}

.card-content p {
  font-size: 0.85rem;
  color: var(--text-color);
  opacity: 0.7;
  margin: 0.2rem 0 0 0;
  line-height: 1.3;
}

.dashboard-card.danger-action .card-content h3 {
  color: var(--danger);
}

.password-strength-container {
  display: none;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.6rem;
  align-items: flex-start;
  text-align: left;
}

.password-strength-bar-container {
  width: 100%;
  height: 6px;
  background-color: var(--glass-border);
  border-radius: 3px;
  overflow: hidden;
}

.password-strength-bar {
  height: 100%;
  width: 0;
  border-radius: 3px;
  transition: width 0.25s ease-in-out, background-color 0.25s ease-in-out;
}

.password-strength-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-color);
}

.flashcard-progress-text {
  text-align: right;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 0.4rem;
}

.flashcard-progress-bar {
  width: 100%;
  height: 6px;
  background-color: var(--glass-border);
  border-radius: 3px;
  margin-bottom: 0.8rem;
}

.flashcard-progress-bar-inner {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 3px;
  transition: width 0.25s ease;
}

.lesson-card-progress {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.8rem;
}

.lesson-progress-container {
  flex-grow: 1;
  height: 8px;
  background-color: var(--glass-border);
  border-radius: 4px;
  overflow: hidden;
}

.lesson-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.lesson-progress-percentage {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
}

.progress-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.2rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.summary-card {
  background: var(--glass-bg);
  padding: 1.2rem;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow);
  border: 1px solid var(--glass-border);
}

.summary-card h4 {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--secondary);
  margin: 0 0 0.4rem 0;
}

.summary-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
}

.heatmap-title {
  text-align: left;
  font-size: 1.1rem;
  margin-bottom: 0.8rem;
  color: var(--text-color);
}

.heatmap-container {
  display: flex;
  justify-content: center;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  grid-auto-rows: 1fr;
  gap: 3px;
  width: 100%;
}

.heatmap-cell {
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: var(--glass-border);
  border-radius: 3px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.heatmap-cell:hover {
  transform: scale(1.15);
}

.heatmap-cell[data-level="1"] { background-color: #c6e48b; }
.heatmap-cell[data-level="2"] { background-color: #7bc96f; }
.heatmap-cell[data-level="3"] { background-color: #239a3b; }
.heatmap-cell[data-level="4"] { background-color: #196127; }

.summary-action {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.progress-card-list {
  padding-left: 18px;
  max-height: 180px;
  overflow-y: auto;
}

.modal-icon-wrapper {
  width: 54px;
  height: 54px;
  background: linear-gradient(145deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -54px auto 16px auto;
  box-shadow: 0 6px 20px rgba(26, 71, 49, 0.15);
  border: 3px solid #fff;
}

body.dark-mode .modal-icon-wrapper {
  border-color: #1d2d27;
}

.modal-icon-wrapper svg {
  width: 28px;
  height: 28px;
  color: #fff;
}

#price-gate-modal .modal-title {
  font-size: clamp(1.4rem, 5vw, 1.6rem);
  font-weight: 700;
  margin-bottom: 0.8rem;
  color: var(--text-color);
}

#price-gate-modal .modal-text {
  color: var(--text-color);
  opacity: 0.9;
  line-height: 1.5;
  margin-bottom: 1.2rem;
}

.price-display-wrapper {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1.2rem;
  margin: 0 auto;
  padding: 0.4rem;
  perspective: 250px;
}

.original-price {
  font-size: clamp(1.6rem, 6vw, 2rem);
  font-weight: 600;
  color: var(--text-color);
  opacity: 0.4;
  position: relative;
}

.original-price::after {
  content: '';
  position: absolute;
  left: -4%;
  top: 50%;
  width: 0;
  height: 2px;
  background-color: var(--danger);
  border-radius: 2px;
  transform: rotate(-4deg);
  animation: strike-through-anim 0.5s 0.25s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes strike-through-anim {
  from { width: 0; }
  to { width: 108%; }
}

.final-price {
  font-size: clamp(3rem, 12vw, 4rem);
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  min-width: 130px;
  display: inline-block;
  transition: transform 0.12s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.08s ease-in-out;
}

.price-animating {
  transform: rotateX(12deg) scale(1.04);
  opacity: 0.8;
}

.per-month {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-color);
  opacity: 0.7;
  margin-top: -0.4rem;
  margin-bottom: 1.2rem;
}

#confirm-price-gate-btn {
  transform: scale(1.04);
  animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
  0% { box-shadow: 0 0 0 0 rgba(26, 71, 49, 0.35); }
  70% { box-shadow: 0 0 0 8px rgba(26, 71, 49, 0); }
  100% { box-shadow: 0 0 0 0 rgba(26, 71, 49, 0); }
}

body.dark-mode @keyframes pulse-animation {
  0% { box-shadow: 0 0 0 0 rgba(82, 183, 136, 0.35); }
  70% { box-shadow: 0 0 0 8px rgba(82, 183, 136, 0); }
  100% { box-shadow: 0 0 0 0 rgba(82, 183, 136, 0); }
}

.section-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-color);
  margin-top: 1.2rem;
  margin-bottom: 0.8rem;
  text-align: left;
}

.benefits-section {
  margin: 1.2rem 0;
}

.benefits-list {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.benefits-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--text-color);
  opacity: 0.9;
  opacity: 0;
  transform: translateY(8px);
  animation: fadeInBenefit 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.benefits-list li:nth-child(1) { animation-delay: 0.08s; }
.benefits-list li:nth-child(2) { animation-delay: 0.16s; }
.benefits-list li:nth-child(3) { animation-delay: 0.24s; }
.benefits-list li:nth-child(4) { animation-delay: 0.32s; }

@keyframes fadeInBenefit {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.benefits-list li::before {
  content: '✓';
  color: var(--success);
  font-weight: 800;
  font-size: 1.1rem;
  flex-shrink: 0;
}

#cancel-price-gate-btn {
  background: transparent;
  color: var(--secondary);
  box-shadow: none;
  border: 2px solid var(--glass-border);
}

#cancel-price-gate-btn:hover {
  background: var(--glass-border);
  color: var(--primary);
  transform: translateY(-1px);
}

.patreon-info-box {
  margin-top: 1.2rem;
  background: transparent;
  border: 1px solid var(--glass-border);
  padding: 0.6rem 0.8rem;
}

.patreon-info-box p {
  font-size: 0.8rem;
}

.modal-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
}

.user-email-display {
  display: block;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0.6rem 0;
  word-break: break-all;
}

.payment-tip {
  font-size: 0.8rem;
  font-style: italic;
  opacity: 0.9;
  margin-top: 0.8rem;
  color: var(--text-color);
  padding: 0.4rem;
  background-color: var(--glass-border);
  border-radius: var(--border-radius-xs);
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#toast-container {
  position: fixed;
  top: 10px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 12px 20px;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--card-shadow);
  color: white;
  font-weight: 600;
  opacity: 0;
  transform: translateX(calc(100% + 16px));
  animation: slideInAndOut 4.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
}

.toast.success { background: linear-gradient(135deg, var(--success), #2a9d8f); }
.toast.error { background: linear-gradient(135deg, var(--danger), #c04c30); }

@keyframes slideInAndOut {
  5%, 80% { opacity: 1; transform: translateX(0); }
  95%, 100% { opacity: 0; transform: translateX(calc(100% + 16px)); }
}

.streak-display {
  display: none;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: var(--warning);
  font-size: 1.1rem;
  padding: 0 8px;
}

.skeleton {
  opacity: 0.7;
  animation: shimmer 1.5s infinite linear;
  background: linear-gradient(90deg,
    var(--glass-border) 25%,
    rgba(255, 255, 255, 0.3) 50%,
    var(--glass-border) 75%);
  background-size: 200% 100%;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.reminder-buttons-container {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  width: 100%;
  margin-top: 0.8rem;
}

.reminder-buttons-container .btn {
  width: 100%;
}

.audio-settings {
  padding: 0.6rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 0.4rem;
  border-top: 1px solid var(--glass-border);
}

.audio-toggle-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 500;
}

.volume-slider-wrapper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.volume-slider-wrapper svg {
  color: var(--secondary);
}

#volume-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  background: var(--glass-border);
  border-radius: 3px;
  outline: none;
  opacity: 0.8;
  transition: opacity .15s;
}

#volume-slider:hover {
  opacity: 1;
}

#volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--primary);
  cursor: pointer;
  border-radius: 50%;
  border: 2px solid var(--glass-bg);
}

#volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--primary);
  cursor: pointer;
  border-radius: 50%;
  border: 2px solid var(--glass-bg);
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--primary);
}

input:checked + .slider:before {
  transform: translateX(18px);
}

.slider.round {
  border-radius: 22px;
}

.slider.round:before {
  border-radius: 50%;
}

#logout-btn, #nav-popup-logout {
  color: var(--danger) !important;
  font-weight: 600;
}

.user-dropdown button#logout-btn:hover {
  background-color: rgba(231, 111, 81, 0.08);
  color: var(--danger) !important;
}

#nav-popup-logout:hover {
  background: linear-gradient(135deg, #c04c30 0%, #a53e26 100%);
  color: white !important;
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(231, 111, 81, 0.2);
}

.search-bar-container {
  margin-bottom: 1.2rem;
  max-width: 550px;
  margin-left: auto;
  margin-right: auto;
}

.search-wrapper {
  position: relative;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  stroke: var(--secondary);
  pointer-events: none;
  transition: stroke 0.15s ease-in-out;
}

#lesson-search-input {
  width: 100%;
  padding: 10px 12px 10px 12px; 
  border: 2px solid var(--input-border);
  border-radius: var(--border-radius-sm);
  background: var(--glass-bg);
  font-size: 0.95rem;
  color: var(--text-color);
  font-family: inherit;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, padding 0.2s ease-in-out;
  text-align: center;
}

#lesson-search-input::placeholder {
  text-align: center;
}

#lesson-search-input::-webkit-input-placeholder {
  text-align: center;
}

#lesson-search-input::-moz-placeholder {
  text-align: center;
  opacity: 1;
}

#lesson-search-input:-ms-input-placeholder {
  text-align: center;
}
#lesson-search-input:focus,
#lesson-search-input:not(:placeholder-shown) {
  text-align: left;
  padding-left: 44px; 
}

.search-wrapper:focus-within .search-icon {
  stroke: var(--primary);
}

#email-suggestion {
  font-size: 0.85em;
  font-weight: 500;
  margin-top: 6px;
  padding: 0 4px;
  text-align: left;
  color: var(--secondary);
}

#email-suggestion a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

#email-suggestion a:hover {
  color: var(--accent);
}

.otp-inputs-container {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 0.4rem;
}

.otp-digit-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  max-width: 48px;
  height: 52px;
  font-size: 1.6rem;
  text-align: center;
  border: 2px solid var(--input-border);
  border-radius: var(--border-radius-xs);
  background: var(--glass-bg);
  color: var(--text-color);
  transition: var(--fast-transition);
  caret-color: var(--primary);
}

.otp-digit-input:focus {
  outline: none;
  border-color: var(--primary);
  transform: scale(1.04);
  box-shadow: 0 0 0 3px rgba(26, 71, 49, 0.1), var(--glow);
}

.otp-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 1.2rem;
  gap: 0.8rem;
  font-size: 0.85rem;
}

#otp-timer {
  font-weight: 600;
  color: var(--secondary);
}

.link-button {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  padding: 0;
  text-decoration: underline;
}

.link-button:disabled {
  color: var(--text-color);
  opacity: 0.5;
  cursor: not-allowed;
  text-decoration: none;
}

@media (max-width: 768px) {
  .container {
    padding: clamp(1.2rem, 3vw, 1.6rem) clamp(0.6rem, 2vw, 0.8rem);
  }

  .lesson-grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }

  .flashcard-ui {
    padding: 0.8rem 0.4rem;
  }

  .account-tabs {
    flex-wrap: wrap;
    justify-content: center;
  }

  .account-tab {
    flex-basis: 48%;
    min-width: 110px;
  }

  .header-content {
    padding: 0 0.8rem;
  }

  .header-nav {
    gap: 0.8rem;
  }

  .notification-dropdown {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    width: 90vw;
    max-width: 380px;
    min-width: unset;
  }

  #price-gate-modal .modal-content {
    padding: 0.8rem;
    overflow: hidden;
    max-width: calc(100% - 1.6rem);
    display: flex;
    flex-direction: column;
  }

  #price-gate-modal .modal-icon-wrapper {
    width: 36px;
    height: 36px;
    margin: -28px auto 8px auto;
    border-width: 2px;
  }

  #price-gate-modal .modal-icon-wrapper svg {
    width: 18px;
    height: 18px;
  }

  #price-gate-modal .modal-title {
    font-size: 1.05rem;
    margin-bottom: 0.2rem;
  }

  #price-gate-modal .price-display-wrapper {
    gap: 0.6rem;
    padding: 0;
  }

  #price-gate-modal .final-price {
    font-size: 2.4rem;
    line-height: 1.05;
  }

  #price-gate-modal .original-price {
    font-size: 1.2rem;
  }

  #price-gate-modal .per-month {
    margin-bottom: 0.6rem;
    font-size: 0.75rem;
  }

  #price-gate-modal .benefits-section {
    margin: 0.6rem 0;
  }

  #price-gate-modal .benefits-list {
    gap: 0.25rem;
  }

  #price-gate-modal .benefits-list li {
    font-size: 0.75rem;
  }

  #price-gate-modal .patreon-info-box {
    margin-top: 0.6rem;
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
  }

  #price-gate-modal .user-email-display {
    font-size: 0.85rem;
  }

  #price-gate-modal .modal-actions {
    margin-top: 0.8rem;
    flex-direction: column;
    gap: 0.4rem;
  }

  #price-gate-modal .modal-actions .btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 600px) {
  footer {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    gap: 1.2rem;
  }

  .subscription-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    min-width: auto;
  }

  .screen h2 {
    font-size: clamp(1.6rem, 7vw, 2.2rem);
  }

  #dialect-selection-screen .btn,
  #level-selection-screen .btn {
    font-size: clamp(0.95rem, 4vw, 1.1rem);
    padding: clamp(1rem, 3vw, 1.6rem);
  }
}

@media (max-width: 480px) {
  .account-tab {
    font-size: 0.85rem;
    padding: 0.8rem 0.6rem;
    flex-basis: 100%;
  }

  .modal-content {
    margin: 0.8rem;
    width: calc(100% - 1.6rem);
  }

  .faq-container {
    padding-right: 0.4rem;
  }

  .forgot-password-link {
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
  }

  .forgot-password-link a {
    flex: auto;
    width: 100%;
  }
}

@media (max-width: 420px) {
  .btn-difficulty {
    padding: 0.6rem 0.3rem;
    font-size: 0.75rem;
    gap: 0.25rem;
  }

  #price-gate-modal .modal-content {
    padding: 0.6rem;
    max-width: calc(100% - 1.2rem);
  }

  #price-gate-modal .modal-icon-wrapper {
    display: none;
  }

  #price-gate-modal .modal-title {
    margin-top: 0;
    font-size: 0.95rem;
  }

  #price-gate-modal .final-price {
    font-size: 2rem;
  }

  #price-gate-modal .original-price {
    font-size: 1.05rem;
  }

  #price-gate-modal .benefits-list li,
  #price-gate-modal .patreon-info-box {
    font-size: 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.flashcard-ui .card-face.card-front {
  justify-content: space-between;
}

.flashcard-ui .card-face.card-back {
  justify-content: center; 
}

.btn:disabled {
    background: #ccc;
    color: #888;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

.btn:disabled:hover {
    background: #ccc;
    transform: none;
    box-shadow: none;
}

.consent-group {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-top: 0.4rem;
    text-align: left;
}

.consent-group label {
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text-color);
    opacity: 0.8;
    cursor: pointer;
}

.consent-group input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.input-group {
    position: relative; 
}

.validation-icon {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    pointer-events: none; 
}

.input-field.validated ~ .validation-icon,
.input-field.invalid ~ .validation-icon {
    opacity: 1;
}

.validation-icon.success {
    color: var(--success);
}

.validation-icon.error {
    color: var(--danger);
}

.input-field.validated {
    border-color: var(--success);
}

.input-field.invalid {
    border-color: var(--danger);
}

.password-wrapper .validation-icon {
    right: 44px; 
}

.consent-group.invalid label {
    color: var(--danger);
    font-weight: 600;
}
.consent-group.invalid input[type="checkbox"] {
    outline: 2px solid var(--danger);
    outline-offset: 2px;
    border-radius: 2px;
}

.input-wrapper {
    position: relative; 
}

.input-wrapper .validation-icon {
    top: 50%;
    right: 1.5rem; 
    transform: translateY(-50%);
}

.quiz-main-container {
    width: 100%;
    max-width: 800px; 
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 0 auto;
}

.lesson-explanation-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-left: 5px solid var(--gold); 
    border-radius: var(--border-radius-sm);
    padding: clamp(1.2rem, 4vw, 2rem);
    text-align: left;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.4s ease-out;
}

.lesson-explanation-content h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--primary);
    font-size: clamp(1.4rem, 4vw, 1.8rem);
}

.lesson-explanation-content h3 + p::before {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--accent));
    margin-bottom: 1.5rem;
    border-radius: 2px;
}

.quiz-practice-btn-container {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

#start-quiz-btn {
    transform: scale(1.05);
    animation: pulse-animation 2.5s infinite;
}

.quiz-container {
    width: 100%;
    animation: fadeInUp 0.4s ease-out;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--secondary);
    padding: 0 0.25rem;
}

.quiz-progress-bar-container {
    width: 100%;
    height: 8px;
    background-color: var(--glass-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.quiz-progress-bar-inner {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    border-radius: 4px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.quiz-question-text {
    font-size: clamp(1.2rem, 3vw, 1.6rem);
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 2.5rem;
    text-align: center;
    color: var(--text-color);
}

.quiz-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
}

@media (min-width: 768px) {
    .quiz-options {
        grid-template-columns: 1fr 1fr; 
    }
}

.quiz-option-btn {
    width: 100%;
    text-align: left;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    color: var(--text-color);
    padding: 1rem 1.2rem;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 60px; 
    display: flex;
    align-items: center;
}

.quiz-option-btn:not(:disabled):hover {
    border-color: var(--primary);
    background-color: var(--glass-border);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.quiz-option-btn.correct {
    background: var(--success) !important;
    border-color: var(--success) !important;
    color: white !important;
    font-weight: 700;
    transform: scale(1.02);
}

.quiz-option-btn.incorrect {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
    color: white !important;
}

.quiz-option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.8;
}

.quiz-option-btn:disabled:not(.correct):not(.incorrect) {
    opacity: 0.5;
    filter: grayscale(50%);
}

.quiz-feedback-container {
    margin-top: 2rem;
    text-align: center;
}

.quiz-explanation {
    background: var(--glass-border);
    padding: 1.2rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1.5rem;
    font-style: italic;
    text-align: left;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s ease-in-out;
    border-left: 4px solid var(--accent);
}

.quiz-explanation.visible {
    opacity: 1;
    max-height: 250px;
}

.quiz-results-container {
    animation: fadeInScale 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.quiz-results-container h3 {
    color: var(--primary);
}

.quiz-score {
    font-size: clamp(3rem, 15vw, 5rem);
    font-weight: 800;
    color: var(--primary);
    margin: 1.5rem 0;
    line-height: 1;
}

.quiz-results-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

@media (min-width: 600px) {
    .quiz-results-actions {
        flex-direction: row;
        justify-content: center;
    }
}

.lesson-grid h3 {
    width: 100%;
    grid-column: 1 / -1; 
    text-align: left;
    color: var(--primary);
    margin-bottom: 0.5rem;
    margin-top: 1rem;
    font-size: 1.2rem;
    border-bottom: 2px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

.lesson-grid h3:first-child {
    margin-top: 0;
}

.explanation-card {
    background-color: var(--glass-border);
    border-radius: var(--border-radius-xs);
    border-left: 4px solid var(--accent);
    padding: 1rem 1.2rem;
    margin-top: 1.5rem;
}

.explanation-card h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.explanation-card .example-arabic {
    font-family: 'Tajawal', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    margin: 1rem 0;
}

.practice-prompt {
    margin-top: 2rem;
    padding: 1rem;
    background-color: var(--glass-border);
    border-radius: var(--border-radius-xs);
    border-left: 4px solid var(--gold);
    text-align: center;
    font-style: italic;
    font-weight: 500;
    color: var(--secondary);
}

.lesson-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.lesson-badges-row {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.mini-badge {
    font-size: 0.65rem;
    padding: 2px 5px;
    border-radius: 4px;
    font-weight: 700;
    color: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.card-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: absolute;
    top: 0;
    left: 0;
    padding: clamp(0.8rem, 3vw, 1.2rem);
    box-sizing: border-box;
    pointer-events: none; 
}

.card-header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.card-level-badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 10px;
    color: white;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

#play-audio-btn {
    pointer-events: auto;
}

.mini-badge[data-level="A1"], .card-level-badge[data-level="A1"] { background: #4ade80; color: #064e3b; }
.mini-badge[data-level="A2"], .card-level-badge[data-level="A2"] { background: #22c55e; }

.mini-badge[data-level="B1"], .card-level-badge[data-level="B1"] { background: #facc15; color: #422006; }
.mini-badge[data-level="B2"], .card-level-badge[data-level="B2"] { background: #fb923c; }

.mini-badge[data-level="C1"], .card-level-badge[data-level="C1"] { background: #f87171; }
.mini-badge[data-level="C2"], .card-level-badge[data-level="C2"] { background: #c084fc; }

/* --- ANIMATIONS DE VALIDATION --- */

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.shake-animation {
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

.consent-group.shake-animation {
    border: 1px solid var(--danger);
    background-color: rgba(231, 111, 81, 0.05);
    border-radius: var(--border-radius-xs);
    padding: 8px;
}
.auth-separator {
    display: flex;
    align-items: center;
    margin: 1.2rem 0;
    color: var(--secondary);
    font-size: 0.85em;
    font-weight: 500;
    opacity: 0.8;
}

.auth-separator::before,
.auth-separator::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

.auth-separator span {
    padding: 0 10px;
}

.btn-google {
    background: white;
    color: #333;
    border: 1px solid rgba(0,0,0,0.2);
    width: 100%;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.btn-google:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

body.dark-mode .btn-google {
    background: #eee;
    color: #333;
    border: none;
}

body.dark-mode .btn-google:hover {
    background: #fff;
}

@media (max-width: 768px) {
    .container {
        padding: 1.5rem 1rem;
    }
}

@media (max-width: 600px) {
    #auth-screen.active {
        justify-content: center; 
        padding: 1rem 0.5rem;  
        overflow-y: auto;       
    }

    .auth-screen-wrapper {
        width: 100%;
        max-width: 100%;
        gap: 1rem; 
    }

    .card-container {
        padding: 1.5rem 1.2rem !important; 
    }

    body {
        font-size: 15px; 
    }

    .input-field {
        padding: 0.9rem 1.1rem !important;
        font-size: 16px; 
    }
    
    .btn {
        padding: 0.9rem !important;
        font-size: 1rem;
    }
    
    .auth-form {
        gap: 0.9rem !important;
    }

    .consent-group label, 
    .remember-me-group label {
        font-size: 0.8rem !important; /* Assez petit pour ne pas prendre trop de place */
    }

    .auth-separator {
        margin: 1rem 0 !important;
    }
}

@media (max-width: 420px) {
    .auth-form {
        gap: 0.7rem !important;
    }
    .input-field, .btn {
        padding: 0.8rem 1rem !important;
    }
    .auth-separator {
        margin: 0.8rem 0 !important;
    }
}


.section-title { font-size: 11px; font-weight: 800; color: var(--text-muted, #64748B); text-transform: uppercase; letter-spacing: 0.5px; margin: 12px 0 8px 0; text-align: left; }
.plan-grid { display: flex; gap: 8px; margin-bottom: 10px; }
.plan-card { flex: 1; border: 2px solid var(--glass-border); border-radius: 10px; padding: 10px 4px; text-align: center; cursor: pointer; transition: all 0.2s; background: var(--glass-bg); position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
.plan-card.active { border-color: var(--primary); background: rgba(82, 183, 136, 0.1); }
.plan-card .badge { position: absolute; top: 0; right: 0; background: var(--danger); color: white; font-size: 9px; font-weight: bold; padding: 2px 6px; border-bottom-left-radius: 6px; }
.plan-duration { font-size: 14px; font-weight: 900; color: var(--text-main); margin-bottom: 2px; }
.plan-card.active .plan-duration { color: var(--primary); }
.plan-price { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.operator-grid { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 15px; }
.operator-card { flex: 1; text-align: center; border: 1.5px solid var(--glass-border); border-radius: 10px; padding: 8px 4px; color: var(--text-muted); background: var(--glass-bg); cursor: pointer; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.operator-card svg { height: 32px; width: auto; margin-bottom: 2px; }
.operator-card span { font-size: 12px; font-weight: 700; }
.operator-card.active { border-color: var(--primary); background: rgba(82, 183, 136, 0.1); color: var(--primary); }
.checkmark { display: none; position: absolute; top: 4px; right: 4px; width: 14px; height: 14px; background-color: var(--primary); color: white; border-radius: 50%; }
.operator-card.active .checkmark { display: flex; align-items: center; justify-content: center; }
.receipt { background: rgba(0,0,0,0.02); border: 1px solid var(--glass-border); border-radius: 8px; padding: 10px 12px; margin-bottom: 15px; }
body.dark-mode .receipt { background: rgba(255,255,255,0.05); }
.receipt-row { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; color: var(--text-muted); }
.receipt-row strong { color: var(--text-main); font-weight: 600; }
.receipt-total { display: flex; justify-content: space-between; font-size: 15px; font-weight: 800; color: var(--primary); margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--glass-border); }


.chat-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 800px;
    height: 80vh;
    max-height: 800px;
    background: var(--glass-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--glass-border);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    margin-top: 1rem;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
}

.chat-header h3 {
    margin: 0;
    color: white !important;
    font-size: 1.2rem;
    background: none !important;
    -webkit-text-fill-color: white !important;
}
.chat-header h3::after { display: none; }

.btn-close-chat {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: var(--fast-transition);
}
.btn-close-chat:hover { background: rgba(255, 255, 255, 0.3); }

.chat-messages-area {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.chat-message {
    max-width: 80%;
    padding: 1rem 1.2rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    animation: fadeInUp 0.3s ease-out;
}

.chat-message.ai {
    align-self: flex-start;
    background: var(--glass-border);
    border-bottom-left-radius: 4px;
    color: var(--text-color);
}

.chat-message.user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-input-area {
    display: flex;
    gap: 0.8rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.02);
}

.chat-input-area input {
    flex-grow: 1;
    border-radius: 25px;
    padding-left: 1.5rem;
}

.chat-input-area button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 0.5rem 1rem;
    background: var(--glass-border);
    border-radius: 18px;
    align-self: flex-start;
    width: fit-content;
}
.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.btn-tts-chat {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    margin-left: 10px;
    vertical-align: middle;
    padding: 4px;
    border-radius: 50%;
}
.btn-tts-chat:hover { background: rgba(0,0,0,0.05); }
.chat-message.user .btn-tts-chat { color: white; }
.secure-badge { text-align: center; font-size: 11px; color: var(--text-muted); margin-top: 10px; display: block;}