@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700;900&family=Nunito:wght@400;600;700;800;900&family=Amiri:wght@400;700&display=swap');
@import url('mobile.css');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 20px; scroll-behavior: smooth; }

:root {
  /* ── Primary brand: soft lavender purple ── */
  --brand: #7C5CFC;
  --brand-light: #9B82FD;
  --brand-dark: #6344E8;
  --brand-deeper: #4D30C4;
  --brand-glow: rgba(124, 92, 252, 0.18);

  /* ── Accent palette ── */
  --accent-blue: #3B82F6;
  --accent-sky: #60A5FA;
  --accent-teal: #06B6D4;
  --accent-coral: #FF6B7A;
  --accent-pink: #F472B6;
  --accent-gold: #F59E0B;
  --accent-lemon: #FEF08A;
  --accent-mint: #34D399;
  --accent-violet: #A78BFA;
  --accent-rose: #FB7185;

  /* ── Gold (streak/XP/reward — the warm accent) ── */
  --gold: #F59E0B;
  --gold-light: #FBBF24;
  --gold-border: rgba(245, 158, 11, 0.3);
  --gold-faint: #FFFBEB;
  --gold-glow: rgba(245, 158, 11, 0.25);

  /* ── Surfaces — clean white/off-white, no color tint ── */
  --surface-bg: #F8F8FC;
  --surface-card: #FFFFFF;
  --surface-tint: #F0EFFE;
  --surface-tint-blue: #EFF6FF;
  --surface-tint-warm: #FFFBEB;

  /* ── Text — dark navy, not green-tinted ── */
  --text-dark: #1A1A2E;
  --text-mid: #4A4A6A;
  --text-muted: #8888AA;

  /* ── Semantic colours ── */
  --success: #4ADE80;
  --success-bg: #ECFDF5;
  --success-border: #BBF7D0;
  --success-dark: #22C55E;

  --amber: #FB923C;
  --amber-bg: #FFF7ED;
  --amber-border: #FED7AA;
  --amber-dark: #F97316;

  --red: #F87171;
  --red-bg: #FEF2F2;
  --red-border: #FECACA;
  --red-dark: #EF4444;

  /* ── CTA orange (skip/action) ── */
  --cta-orange: #FB923C;
  --cta-orange-light: #FDBA74;
  --cta-orange-soft: #FFEDD5;
  --cta-orange-text: #7C2D12;
  --cta-orange-border: #F97316;

  /* ── Shadows ── */
  --shadow-xs: 0 1px 3px rgba(26, 26, 46, 0.05), 0 1px 2px rgba(26, 26, 46, 0.06);
  --shadow-sm: 0 2px 8px rgba(26, 26, 46, 0.07), 0 1px 3px rgba(26, 26, 46, 0.04);
  --shadow-md: 0 8px 24px rgba(26, 26, 46, 0.10), 0 2px 6px rgba(26, 26, 46, 0.05);
  --shadow-lg: 0 16px 40px rgba(26, 26, 46, 0.12), 0 4px 12px rgba(26, 26, 46, 0.06);
  --shadow-pop: 0 8px 0 rgba(99, 68, 232, 0.22), 0 12px 32px rgba(124, 92, 252, 0.18);
  --shadow-pop-hover: 0 10px 0 rgba(99, 68, 232, 0.28), 0 16px 40px rgba(124, 92, 252, 0.22);

  /* ── Radii ── */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* ── Aliases ── */
  --bg-card: var(--surface-card);
  --bg: var(--surface-bg);
  --brand-primary: var(--brand);
  --brand-primary-dark: var(--brand-dark);
  --spark-coral: var(--accent-coral);
  --spark-sky: var(--accent-sky);
  --spark-lemon: var(--accent-lemon);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--surface-bg);
  color: var(--text-dark);
  font-family: 'Nunito', 'Lato', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  line-height: 1.6;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse at 15% 15%, rgba(124, 92, 252, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 85%, rgba(245, 158, 11, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(59, 130, 246, 0.03) 0%, transparent 60%);
}

.geo-bg {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  opacity: 0.022;
  pointer-events: none;
  z-index: 0;
}

.geo-bg polygon,
.geo-bg line {
  stroke: var(--brand) !important;
}

.arabic-watermark {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Amiri', serif;
  font-size: clamp(160px, 32vw, 380px);
  color: var(--brand);
  opacity: 0.03;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  z-index: 0;
}

/* ── Navigation ── */
body > nav:not(.bottom-nav):not(.app-nav) {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border-bottom: 1px solid rgba(124, 92, 252, 0.1);
  padding: 0.7rem 2rem;
  display: flex; align-items: center; gap: 0.75rem;
  box-shadow: 0 1px 12px rgba(124, 92, 252, 0.06);
  transition: box-shadow 0.3s ease, background 0.3s ease;
}

.nav-back {
  font-family: 'Nunito', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--brand);
  text-decoration: none;
  display: flex; align-items: center; gap: 6px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
}
.nav-back:hover {
  color: var(--brand-dark);
  background: var(--surface-tint);
  transform: translateX(-3px);
}
.nav-back::before { content: '←'; font-size: 1rem; transition: transform 0.2s; }
.nav-back:hover::before { transform: translateX(-2px); }

.nav-link {
  font-family: 'Nunito', sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-mid);
  text-decoration: none;
  border: 1.5px solid rgba(124, 92, 252, 0.15);
  border-radius: var(--radius-full);
  padding: 0.38rem 0.8rem;
  transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--brand);
  border-color: var(--brand-light);
  background: var(--surface-tint);
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px var(--brand-glow);
}

.nav-divider { color: var(--brand); opacity: 0.3; font-size: 0.7rem; }

.nav-title {
  font-family: 'Amiri', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
}

.nav-progress {
  margin-left: auto;
  display: flex; align-items: center; gap: 10px;
}

.progress-bar-wrap {
  width: 140px; height: 10px;
  background: rgba(14, 36, 32, 0.06);
  border-radius: var(--radius-full); overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-light), var(--accent-mint));
  border-radius: var(--radius-full); width: 0%;
  transition: width 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}
.progress-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  border-radius: inherit;
  animation: progressShimmer 2s ease infinite;
}
@keyframes progressShimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-label {
  font-family: 'Nunito', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-mid);
}

/* ── Chips ── */
.chips {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-top: 6px;
}
.chip {
  font-family: 'Nunito', sans-serif;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  transition: transform 0.15s ease;
}
.chip:hover { transform: scale(1.05); }

.chip-vocab   { color: #065F46; background: #D1FAE5; border: 1.5px solid #6EE7B7; }
.chip-grammar { color: #4C1D95; background: #EDE9FE; border: 1.5px solid #C4B5FD; }
.chip-reading { color: #1E40AF; background: #DBEAFE; border: 1.5px solid #93C5FD; }
.chip-practice{ color: #9A3412; background: #FFF7ED; border: 1.5px solid #FDBA74; }
.chip-quiz    { color: #9D174D; background: #FCE7F3; border: 1.5px solid #F9A8D4; }

/* ── Ornament ── */
.ornament-divider {
  display: flex; align-items: center; gap: 16px;
  width: 100%;
}
.ornament-divider-line {
  flex: 1; height: 1px;
  background: linear-gradient(to right, rgba(124, 92, 252, 0.15), transparent);
}
.ornament-divider-diamond {
  width: 10px; height: 10px;
  background: var(--accent-coral);
  transform: rotate(45deg);
  opacity: 0.65;
  border-radius: 2px;
}

/* ═══════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════ */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes bounceIn {
  0%   { opacity: 0; transform: scale(0.3); }
  40%  { opacity: 1; transform: scale(1.1); }
  60%  { transform: scale(0.93); }
  80%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}
@keyframes popIn {
  0%   { opacity: 0; transform: scale(0.5) translateY(10px); }
  60%  { opacity: 1; transform: scale(1.08) translateY(0); }
  100% { transform: scale(1) translateY(0); }
}
@keyframes springIn {
  0%   { opacity: 0; transform: scale(0.6) translateY(16px); }
  55%  { opacity: 1; transform: scale(1.06) translateY(-4px); }
  75%  { transform: scale(0.97) translateY(2px); }
  100% { transform: scale(1) translateY(0); }
}
@keyframes bounceUp {
  0%   { transform: translateY(0) scale(1); }
  25%  { transform: translateY(-10px) scale(1.06); }
  50%  { transform: translateY(0) scale(0.97); }
  75%  { transform: translateY(-5px) scale(1.02); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-4deg); }
  40% { transform: rotate(4deg); }
  60% { transform: rotate(-3deg); }
  80% { transform: rotate(2deg); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124, 92, 252, 0.2); }
  50% { box-shadow: 0 0 0 10px transparent; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes confettiFall {
  0% { transform: translateY(-10vh) rotate(0deg) scale(1); opacity: 1; }
  75% { opacity: 1; }
  100% { transform: translateY(105vh) rotate(720deg) scale(0.5); opacity: 0; }
}
@keyframes confettiSway {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(15px); }
  75% { transform: translateX(-15px); }
}
@keyframes scorePopIn {
  0% { transform: scale(0) rotate(-10deg); opacity: 0; }
  50% { transform: scale(1.2) rotate(3deg); }
  70% { transform: scale(0.9) rotate(-1deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes xpBounce {
  0% { transform: translateY(0) scale(0); opacity: 0; }
  30% { transform: translateY(-30px) scale(1.3); opacity: 1; }
  50% { transform: translateY(-10px) scale(0.9); }
  70% { transform: translateY(-25px) scale(1.08); }
  85% { transform: translateY(-18px) scale(0.97); }
  100% { transform: translateY(-20px) scale(1); opacity: 1; }
}
@keyframes floatUp {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-80px) scale(0.6); opacity: 0; }
}
@keyframes gentleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes celebratePulse {
  0% { transform: scale(1); }
  10% { transform: scale(1.15); }
  20% { transform: scale(0.95); }
  30% { transform: scale(1.08); }
  40% { transform: scale(0.97); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
@keyframes scoreCardIn {
  0%   { opacity: 0; transform: scale(0.7) translateY(24px); }
  60%  { opacity: 1; transform: scale(1.04) translateY(-4px); }
  80%  { transform: scale(0.98) translateY(2px); }
  100% { transform: scale(1) translateY(0); }
}
@keyframes scoreBarShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes heartbeat {
  0%  { transform: scale(1); }
  14% { transform: scale(1.15); }
  28% { transform: scale(1); }
  42% { transform: scale(1.1); }
  70% { transform: scale(1); }
}
@keyframes tilt {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-2deg) scale(1.02); }
  75% { transform: rotate(2deg) scale(1.02); }
}

/* ── Confetti ── */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99999;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: -10px;
  animation: confettiFall linear forwards, confettiSway ease-in-out infinite;
}
.confetti-piece:nth-child(odd) { animation-duration: 2.5s, 1.5s; }
.confetti-piece:nth-child(even) { animation-duration: 3s, 2s; }

/* ── Skeleton Loading ── */
.skeleton {
  background: linear-gradient(110deg, rgba(12,192,160,0.04) 30%, rgba(12,192,160,0.08) 50%, rgba(12,192,160,0.04) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite;
  border-radius: var(--radius-sm);
}

/* ── Step Progress Dots ── */
.step-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(14, 36, 32, 0.1);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.step-dot--done {
  background: var(--success);
  transform: scale(1.3);
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}
.step-dot--current {
  background: var(--accent-gold);
  animation: pulse 1.2s infinite;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

/* ── Global Focus ── */
:focus-visible {
  outline: 2.5px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Selection ── */
::selection {
  background: var(--brand-light);
  color: #fff;
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */
@media (max-width: 600px) {
  body > nav:not(.bottom-nav):not(.app-nav) {
    padding: 0.55rem 0.75rem;
    gap: 0.45rem;
    flex-wrap: wrap;
  }
  .nav-back { font-size: 0.7rem; padding: 0.25rem 0.45rem; }
  .nav-back::before { font-size: 0.8rem; }
  .nav-link { display: none; }
  .nav-divider { display: none; }
  .nav-title {
    font-size: 0.95rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  nav .streak-widget,
  .nav-progress { display: none; }
  .progress-bar-wrap { width: 64px; height: 8px; }
  .progress-label { display: none; }
}
