/* ============================================================
   موقع تعليمي تفاعلي - تطوير الويب والذكاء الاصطناعي
   Full Motion | RTL | Modern Dark Theme
   ============================================================ */

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

/* ===== المتغيرات ===== */
:root {
  --primary: #7c6aff;
  --primary-dark: #5a4ae3;
  --secondary: #ff6b9d;
  --accent: #00d4ff;
  --bg: #080c1f;
  --bg2: #0e1330;
  --bg3: #141840;
  --card: rgba(255, 255, 255, 0.04);
  --card-hover: rgba(255, 255, 255, 0.08);
  --text: #e8eaff;
  --text-muted: rgba(232, 234, 255, 0.55);
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.15);
  --success: #4ade80;
  --error: #f87171;
  --warning: #facc15;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px rgba(124, 106, 255, 0.3);
  --transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);

  /* ألوان الأقسام */
  --color-html: #e34c26;
  --color-css: #264de4;
  --color-js: #f7df1e;
  --color-php: #8892be;
  --color-db: #00758f;
  --color-server: #27ae60;
  --color-domain: #e67e22;
  --color-pwa: #9b59b6;
  --color-ai: #ff6b6b;
}

/* ===== المؤشر المخصص ===== */
*, *::before, *::after { cursor: none !important; }

#cursor-dot {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent);
  pointer-events: none;
  z-index: 99999;
  transform: translate(-50%, -50%);
  transition: width 0.15s, height 0.15s, background 0.15s, box-shadow 0.15s;
}

#cursor-ring {
  position: fixed;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(124, 106, 255, 0.6);
  pointer-events: none;
  z-index: 99998;
  transform: translate(-50%, -50%);
  transition: width 0.25s ease, height 0.25s ease, border-color 0.25s ease;
}

body.cursor-hover #cursor-dot {
  width: 14px;
  height: 14px;
  background: var(--primary);
  box-shadow: 0 0 14px var(--primary), 0 0 30px rgba(124, 106, 255, 0.5);
}

body.cursor-hover #cursor-ring {
  width: 50px;
  height: 50px;
  border-color: rgba(124, 106, 255, 0.9);
}

body.cursor-click #cursor-dot {
  width: 6px;
  height: 6px;
  background: var(--secondary);
  box-shadow: 0 0 12px var(--secondary), 0 0 28px rgba(255, 107, 157, 0.6);
}

body.cursor-click #cursor-ring {
  width: 20px;
  height: 20px;
  border-color: var(--secondary);
}

/* ===== الأساس ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  /* scroll-behavior يُدار بـ JS (momentum scroll) */
  scroll-padding-top: 84px;
}

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  text-align: right;
  overflow-x: hidden;
  min-height: 100vh;
  line-height: 1.7;
}

/* ===== الخلفية المتحركة ===== */
#particles-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  animation: float-particle linear infinite;
  opacity: 0;
}

@keyframes float-particle {
  0%   { transform: translateY(100vh) scale(0); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 0.6; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.12;
  pointer-events: none;
  z-index: 0;
}

.bg-glow-1 {
  width: 600px; height: 600px;
  background: var(--primary);
  top: -200px; right: -200px;
  animation: pulse-glow 8s ease-in-out infinite alternate;
}

.bg-glow-2 {
  width: 500px; height: 500px;
  background: var(--secondary);
  bottom: -150px; left: -150px;
  animation: pulse-glow 10s ease-in-out infinite alternate-reverse;
}

@keyframes pulse-glow {
  from { transform: scale(1) rotate(0deg); opacity: 0.1; }
  to   { transform: scale(1.3) rotate(180deg); opacity: 0.2; }
}

/* ===== الـ Layout الرئيسي ===== */
#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== شريط التنقل ===== */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(8, 12, 31, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.navbar.scrolled {
  padding: 12px 32px;
  box-shadow: var(--shadow);
}

/* الحاوية الداخلية للـ Navbar */
#main-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.nav-logo {
  font-size: 1.4rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  cursor: pointer;
  letter-spacing: -0.5px;
}

.nav-info {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-student {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.nav-student span:first-child {
  color: var(--primary);
  font-weight: 700;
}

.nav-score-badge {
  padding: 6px 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(124, 106, 255, 0.4);
  animation: score-pulse 2s ease-in-out infinite;
}

@keyframes score-pulse {
  0%, 100% { box-shadow: 0 4px 15px rgba(124, 106, 255, 0.4); }
  50% { box-shadow: 0 4px 25px rgba(124, 106, 255, 0.7); }
}

/* ===== شريط التقدم ===== */
.progress-container {
  position: fixed;
  top: 65px;
  width: 100%;
  z-index: 99;
  padding: 12px 32px;
  background: rgba(8, 12, 31, 0.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.progress-bar-wrap {
  background: var(--bg3);
  border-radius: 50px;
  height: 6px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 50px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 20px; height: 100%;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50px;
  animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
  0%   { opacity: 0; transform: translateX(10px); }
  50%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50px); }
}

.steps-dots {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  border: 2px solid var(--border);
  color: var(--text-muted);
  transition: var(--transition);
  cursor: default;
}

.step-dot.done {
  background: var(--success);
  border-color: var(--success);
  color: #000;
  transform: scale(1.1);
}

.step-dot.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 12px rgba(124, 106, 255, 0.6);
  transform: scale(1.2);
}

/* ===== صفحة الهبوط ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}

.hero-content {
  max-width: 700px;
  animation: hero-entry 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes hero-entry {
  from {
    opacity: 0;
    transform: translateY(60px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: rgba(124, 106, 255, 0.15);
  border: 1px solid rgba(124, 106, 255, 0.4);
  border-radius: 50px;
  font-size: 0.9rem;
  color: var(--primary);
  margin-bottom: 32px;
  animation: badge-float 3s ease-in-out infinite;
}

@keyframes badge-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 20px;
}

.hero h1 .gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--accent), var(--secondary));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 4s ease infinite;
}

@keyframes gradient-shift {
  0%   { background-position: 0% center; }
  50%  { background-position: 100% center; }
  100% { background-position: 0% center; }
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: 40px;
}

/* ===== الـ Registration Form ===== */
.register-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 500px;
  margin: 0 auto 40px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.register-card:hover {
  border-color: rgba(124, 106, 255, 0.3);
  box-shadow: var(--shadow), var(--shadow-glow);
}

.form-label {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.form-input {
  width: 100%;
  padding: 16px 20px;
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Cairo', sans-serif;
  font-size: 1.1rem;
  text-align: right;
  direction: rtl;
  transition: var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(124, 106, 255, 0.15);
}

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

/* ===== الأزرار ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 36px;
  border: none;
  border-radius: var(--radius);
  font-family: 'Cairo', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 8px 25px rgba(124, 106, 255, 0.45);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(124, 106, 255, 0.6);
}

.btn-primary:active {
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: var(--card-hover);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}

.btn-success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  box-shadow: 0 8px 25px rgba(34, 197, 94, 0.4);
}

.btn-success:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(34, 197, 94, 0.6);
}

.btn-lg {
  padding: 20px 48px;
  font-size: 1.15rem;
  border-radius: var(--radius-lg);
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* ===== مسار الدروس (Roadmap) ===== */
.roadmap {
  padding: 60px 0;
}

.roadmap-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.roadmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.roadmap-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  transition: var(--transition);
  cursor: none;
  position: relative;
  overflow: hidden;
  animation: card-entry 0.6s ease both;
}

.roadmap-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255,255,255,0.03));
  border-radius: inherit;
  pointer-events: none;
}

.roadmap-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: skewX(-15deg);
  transition: left 0.55s ease;
  pointer-events: none;
}

.roadmap-card:hover::after {
  left: 160%;
}

.roadmap-card:hover {
  transform: translateY(-8px) scale(1.03);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border-color: transparent;
  background-image:
    linear-gradient(var(--bg), var(--bg)),
    conic-gradient(from calc(var(--border-angle) - 108deg), transparent 55%, var(--card-color, var(--primary)) 75%, transparent 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  background-color: transparent;
  box-shadow: 0 20px 50px rgba(0,0,0,0.4), 0 0 40px rgba(0,0,0,0.2);
  animation: border-spin 2.5s linear infinite;
}

.roadmap-card:hover .roadmap-icon {
  animation: icon-pop 0.35s ease forwards;
}

@keyframes icon-pop {
  0%   { transform: scale(1) rotate(0deg); }
  50%  { transform: scale(1.4) rotate(-8deg); }
  100% { transform: scale(1.15) rotate(0deg); }
}

@keyframes card-entry {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

@property --border-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes border-spin {
  to { --border-angle: -360deg; }
}

.roadmap-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
  animation: icon-bounce 3s ease-in-out infinite;
}

@keyframes icon-bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25%       { transform: translateY(-4px) rotate(-3deg); }
  75%       { transform: translateY(-4px) rotate(3deg); }
}

.roadmap-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.roadmap-card p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.roadmap-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
}

.roadmap-status.locked { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.roadmap-status.done   { background: rgba(74, 222, 128, 0.15); color: var(--success); }
.roadmap-status.active { background: rgba(124,106,255,0.2); color: var(--primary); }

/* ===== صفحة الدرس ===== */
.page-wrapper {
  padding-top: 130px;
  min-height: 100vh;
  padding-bottom: 60px;
}

.lesson-header {
  text-align: center;
  padding: 60px 24px 40px;
  animation: fadeInUp 0.7s ease both;
}

.lesson-section-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 20px;
  border: 2px solid currentColor;
  opacity: 0.9;
}

.lesson-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 900;
  margin-bottom: 12px;
}

.lesson-header p.subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* ===== محتوى الدرس ===== */
.lesson-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

.content-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 24px;
  animation: fadeInUp 0.6s ease both;
  transition: var(--transition);
}

.content-section:hover {
  border-color: rgba(255,255,255,0.15);
}

.content-section h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.content-section h2::before {
  content: '';
  width: 4px;
  height: 24px;
  background: var(--section-color, var(--primary));
  border-radius: 2px;
  flex-shrink: 0;
}

.content-section p {
  color: var(--text-muted);
  line-height: 1.9;
  margin-bottom: 12px;
}

.content-section p:last-child {
  margin-bottom: 0;
}

/* ===== كتل الكود ===== */
.code-block {
  background: #0d1117;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  margin: 20px 0;
  overflow: hidden;
  font-family: 'Courier New', 'Consolas', monospace;
  direction: ltr;
  text-align: left;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.code-dots {
  display: flex;
  gap: 6px;
}

.code-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.code-dots span:nth-child(1) { background: #ff5f57; }
.code-dots span:nth-child(2) { background: #febc2e; }
.code-dots span:nth-child(3) { background: #28c840; }

.code-lang {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
  font-family: 'Cairo', sans-serif;
}

.code-block pre {
  padding: 20px;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.8;
  color: #e6edf3;
}

.code-block .kw  { color: #ff7b72; }   /* keywords */
.code-block .str { color: #a5d6ff; }   /* strings */
.code-block .tag { color: #7ee787; }   /* html tags */
.code-block .attr{ color: #79c0ff; }   /* attributes */
.code-block .val { color: #ffa657; }   /* values */
.code-block .cm  { color: #8b949e; font-style: italic; } /* comments */
.code-block .fn  { color: #d2a8ff; }   /* functions */
.code-block .num { color: #f2cc60; }   /* numbers */

/* ===== بطاقات المعلومات ===== */
.info-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  border-radius: var(--radius-sm);
  margin: 16px 0;
}

.info-card.tip {
  background: rgba(124, 106, 255, 0.1);
  border: 1px solid rgba(124, 106, 255, 0.25);
}

.info-card.note {
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.2);
}

.info-card.warning {
  background: rgba(250, 204, 21, 0.08);
  border: 1px solid rgba(250, 204, 21, 0.2);
}

.info-card.success {
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.2);
}

.info-card-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.info-card-body p {
  margin: 0;
  color: var(--text);
}

/* ===== قائمة ===== */
.content-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.content-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--text-muted);
  line-height: 1.7;
}

.content-list li::before {
  content: '◈';
  color: var(--primary);
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 0.9rem;
}

/* ===== Live Example ===== */
.live-example {
  background: var(--bg3);
  border: 2px solid rgba(74, 222, 128, 0.3);
  border-radius: var(--radius);
  padding: 24px;
  margin: 20px 0;
}

.live-example-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-weight: 700;
  color: var(--success);
}

.live-preview {
  background: white;
  border-radius: var(--radius-sm);
  padding: 20px;
  min-height: 80px;
  color: #000;
  font-family: 'Cairo', sans-serif;
  direction: rtl;
}

/* ===== صفحة الاختبار ===== */
.quiz-wrapper {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 24px;
}

.quiz-header {
  text-align: center;
  padding: 60px 0 40px;
  animation: fadeInUp 0.6s ease both;
}

.quiz-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.question-counter {
  color: var(--text-muted);
}

.btn-reset-quiz {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: none;
  transition: var(--transition);
}

.btn-reset-quiz:hover {
  border-color: var(--secondary);
  color: var(--secondary);
}

.question-points {
  color: var(--primary);
  font-weight: 700;
}

.quiz-bar-wrap {
  background: var(--bg3);
  border-radius: 50px;
  height: 8px;
  margin-bottom: 32px;
}

.quiz-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 50px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.question-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  margin-bottom: 24px;
  animation: fadeInUp 0.5s ease both;
}

.question-number {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 12px;
}

.question-text {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.6;
  margin-bottom: 32px;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 18px 24px;
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Cairo', sans-serif;
  font-size: 1rem;
  cursor: pointer;
  text-align: right;
  direction: rtl;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: rgba(124, 106, 255, 0.08);
  transform: translateX(-4px);
}

.option-btn.correct {
  border-color: var(--success) !important;
  background: rgba(74, 222, 128, 0.12) !important;
  color: var(--success) !important;
  animation: correct-bounce 0.5s ease;
}

.option-btn.wrong {
  border-color: var(--error) !important;
  background: rgba(248, 113, 113, 0.12) !important;
  color: var(--error) !important;
  animation: wrong-shake 0.5s ease;
}

.option-btn:disabled {
  cursor: default;
}

@keyframes correct-bounce {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.03); }
  60%  { transform: scale(0.98); }
  100% { transform: scale(1); }
}

@keyframes wrong-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}

.option-letter {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  border: 2px solid var(--border);
  transition: var(--transition);
}

.option-btn.correct .option-letter,
.option-btn.wrong .option-letter {
  border-color: currentColor;
}

/* ===== نتيجة السؤال ===== */
.answer-feedback {
  padding: 20px 24px;
  border-radius: var(--radius);
  margin-top: 16px;
  display: none;
  animation: fadeIn 0.4s ease;
}

.answer-feedback.show { display: block; }

.answer-feedback.correct-fb {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.answer-feedback.wrong-fb {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.feedback-icon {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.feedback-text {
  font-weight: 600;
  font-size: 1rem;
}

.feedback-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== نهاية الاختبار ===== */
.quiz-result {
  text-align: center;
  padding: 60px 40px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  animation: fadeInUp 0.7s ease both;
}

.result-icon {
  font-size: 5rem;
  display: block;
  margin-bottom: 24px;
  animation: result-bounce 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) both;
  animation-delay: 0.2s;
}

@keyframes result-bounce {
  from { transform: scale(0) rotate(-20deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg); opacity: 1; }
}

.result-score {
  font-size: 4rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.result-label {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.result-message {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 32px;
}

/* ===== صفحة الـ Scoreboard ===== */
.scoreboard-header {
  text-align: center;
  padding: 60px 24px 40px;
  animation: fadeInUp 0.7s ease both;
}

.scoreboard-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  margin-bottom: 12px;
}

.score-table-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

.top-three {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.top-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  min-width: 160px;
  transition: var(--transition);
  animation: top-card-entry 0.8s ease both;
}

.top-card:hover {
  transform: translateY(-8px);
}

.top-card.rank-1 {
  border-color: #ffd700;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.2);
  transform: scale(1.08);
  animation-delay: 0s;
}

.top-card.rank-2 {
  border-color: #c0c0c0;
  box-shadow: 0 0 20px rgba(192, 192, 192, 0.15);
  animation-delay: 0.15s;
}

.top-card.rank-3 {
  border-color: #cd7f32;
  box-shadow: 0 0 20px rgba(205, 127, 50, 0.15);
  animation-delay: 0.3s;
}

@keyframes top-card-entry {
  from { opacity: 0; transform: translateY(40px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.rank-medal {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 8px;
  animation: medal-spin 1s ease both;
  animation-delay: 0.5s;
}

@keyframes medal-spin {
  from { transform: rotateY(180deg); opacity: 0; }
  to   { transform: rotateY(0deg); opacity: 1; }
}

.top-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 6px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0 auto 6px;
}

.top-total {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--primary);
}

.top-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ===== جدول النقاط ===== */
.scores-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.scores-table th {
  padding: 16px 20px;
  background: var(--bg3);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}

.scores-table th:hover {
  color: var(--primary);
}

.scores-table td {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  transition: var(--transition);
}

.scores-table tr:hover td {
  background: var(--card-hover);
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.85rem;
}

.rank-badge.gold   { background: rgba(255,215,0,0.2); color: #ffd700; border: 1px solid rgba(255,215,0,0.4); }
.rank-badge.silver { background: rgba(192,192,192,0.2); color: #c0c0c0; border: 1px solid rgba(192,192,192,0.4); }
.rank-badge.bronze { background: rgba(205,127,50,0.2); color: #cd7f32; border: 1px solid rgba(205,127,50,0.4); }
.rank-badge.normal { background: var(--bg3); color: var(--text-muted); border: 1px solid var(--border); }

.total-score-cell {
  font-weight: 900;
  font-size: 1.05rem;
  color: var(--primary);
}

.score-mini {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(124,106,255,0.15);
  color: var(--primary);
}

/* ===== شريط أدوات الـ Scoreboard ===== */
.scoreboard-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.scoreboard-tools input {
  flex: 1;
  min-width: 200px;
  padding: 12px 18px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Cairo', sans-serif;
  font-size: 0.95rem;
  text-align: right;
  direction: rtl;
  outline: none;
  transition: var(--transition);
}

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

/* ===== مؤشر التحميل ===== */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  gap: 20px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Toast Notifications ===== */
.toast-container {
  position: fixed;
  bottom: 30px;
  left: 30px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  animation: toast-in 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
  max-width: 320px;
}

.toast.success { background: rgba(74,222,128,0.15); border: 1px solid rgba(74,222,128,0.4); color: var(--success); }
.toast.error   { background: rgba(248,113,113,0.15); border: 1px solid rgba(248,113,113,0.4); color: var(--error); }
.toast.info    { background: rgba(124,106,255,0.15); border: 1px solid rgba(124,106,255,0.4); color: var(--primary); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-30px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

.toast.hiding {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(-30px) scale(0.9); }
}

/* ===== Confetti ===== */
.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
  z-index: 999;
  pointer-events: none;
}

@keyframes confetti-fall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ===== الرسوم المتحركة المشتركة ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

.fade-in    { animation: fadeIn 0.6s ease both; }
.fade-in-up { animation: fadeInUp 0.6s ease both; }

/* ===== Delay Classes ===== */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* ===== Divider ===== */
.divider {
  height: 1px;
  background: var(--border);
  margin: 32px 0;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.5;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .navbar { padding: 14px 20px; }
  .progress-container { padding: 10px 20px; }
  .question-card { padding: 28px 24px; }
  .roadmap-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .top-three { gap: 12px; }
  .scores-table th,
  .scores-table td { padding: 10px 12px; font-size: 0.8rem; }
  .register-card { padding: 28px 24px; }
  .content-section { padding: 24px 20px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.8rem; }
  .btn-lg { padding: 16px 32px; font-size: 1rem; }
  .steps-dots { gap: 5px; }
  .step-dot { width: 24px; height: 24px; font-size: 0.65rem; }
  .nav-student { display: none; }
}

/* ============================================================
   وضع المعلم — عناصر الاختبار التفاعلي
   ============================================================ */

/* ملخص النقاط أعلى السؤال */
.mini-scores-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  justify-content: center;
}

.mini-score-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 0.85rem;
  transition: var(--transition);
}

.mini-score-chip strong {
  color: var(--primary);
  font-size: 1rem;
}

.mini-score-chip.just-scored {
  background: rgba(74,222,128,0.15);
  border-color: rgba(74,222,128,0.4);
  animation: correct-bounce 0.5s ease;
}

.mini-score-chip.just-scored strong { color: var(--success); }

/* خيارات السؤال — للعرض فقط */
.q-options-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 24px 0 0;
}

.q-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
  user-select: none;
}

.q-option .option-letter {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.88rem;
  flex-shrink: 0;
  transition: var(--transition);
}

.q-option .option-text {
  font-size: 0.98rem;
  color: var(--text);
  font-family: 'Courier New', monospace;
  direction: ltr;
  unicode-bidi: embed;
}

/* تمييز الإجابة الصحيحة بعد الكشف */
.q-option.opt-correct {
  border-color: var(--success) !important;
  background: rgba(74,222,128,0.12) !important;
  animation: correct-bounce 0.6s ease;
}

.q-option.opt-correct .option-letter {
  background: var(--success);
  border-color: var(--success);
  color: #000;
}

.q-option.opt-correct .option-text {
  color: var(--success);
  font-weight: 700;
}

/* تعتيم الخيارات الخاطئة */
.q-option.opt-dim {
  opacity: 0.35;
}

/* صندوق الكشف عن الإجابة */
.reveal-box {
  margin-top: 20px;
  animation: fadeInUp 0.4s ease both;
}

.correct-banner {
  padding: 16px 20px;
  background: rgba(74,222,128,0.1);
  border: 1px solid rgba(74,222,128,0.35);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--success);
  margin-bottom: 10px;
  font-family: 'Cairo', sans-serif;
}

.correct-banner strong {
  font-family: 'Courier New', monospace;
  direction: ltr;
  unicode-bidi: embed;
}

.explanation {
  font-size: 0.88rem;
  color: var(--text-muted);
  padding: 10px 16px;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  font-family: 'Cairo', sans-serif;
  direction: rtl;
}

/* صندوق اختيار الطالب */
.assign-box {
  animation: fadeInUp 0.4s ease 0.15s both;
}

.assign-label {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
}

.student-pick-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.student-pick-btn {
  padding: 12px 24px;
  background: var(--bg3);
  border: 2px solid rgba(124,106,255,0.3);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Cairo', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.student-pick-btn::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  background: rgba(124,106,255,0.15);
  border-radius: 50%;
  transform: translate(-50%,-50%);
  transition: width .5s, height .5s;
}

.student-pick-btn:hover::before { width: 200%; height: 200%; }

.student-pick-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(124,106,255,0.25);
}

.student-pick-btn:active { transform: scale(0.97); }

.skip-btn {
  border-color: var(--border) !important;
  color: var(--text-muted) !important;
  opacity: 0.7;
}

.skip-btn:hover {
  border-color: var(--error) !important;
  color: var(--error) !important;
  box-shadow: none !important;
}

/* نتائج الاختبار */
.result-students-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0;
  text-align: right;
}

.result-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
}

.result-row.result-winner {
  background: rgba(255,215,0,0.08);
  border-color: rgba(255,215,0,0.3);
  box-shadow: 0 4px 20px rgba(255,215,0,0.1);
}

.result-rank-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.result-name-txt { flex: 1; font-weight: 700; }

.result-stars-txt {
  font-size: 0.9rem;
  letter-spacing: 1px;
}

.result-score-num {
  font-size: 1rem;
  font-weight: 900;
  color: var(--primary);
  min-width: 36px;
  text-align: left;
}

/* ============================================================
   Scroll Reveal — حركة العناصر عند الدخول للشاشة
   ============================================================ */
.sr-hidden {
  opacity: 0;
  transform: translateY(36px) scale(0.97);
  transition:
    opacity    0.65s cubic-bezier(0.22, 1, 0.36, 1),
    transform  0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.sr-visible {
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
}

/* تأخير تدريجي لبطاقات الـ Grid */
.roadmap-card.sr-hidden:nth-child(1)  { transition-delay: 0.00s; }
.roadmap-card.sr-hidden:nth-child(2)  { transition-delay: 0.06s; }
.roadmap-card.sr-hidden:nth-child(3)  { transition-delay: 0.12s; }
.roadmap-card.sr-hidden:nth-child(4)  { transition-delay: 0.18s; }
.roadmap-card.sr-hidden:nth-child(5)  { transition-delay: 0.24s; }
.roadmap-card.sr-hidden:nth-child(6)  { transition-delay: 0.30s; }
.roadmap-card.sr-hidden:nth-child(7)  { transition-delay: 0.36s; }
.roadmap-card.sr-hidden:nth-child(8)  { transition-delay: 0.40s; }
.roadmap-card.sr-hidden:nth-child(9)  { transition-delay: 0.44s; }

/* ============================================================
   زر الدوامة العائم (FAB)
   ============================================================ */
.fab-wheel {
  position: fixed;
  bottom: 28px;
  left: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6b9d, #f97316);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  text-decoration: none;
  z-index: 90;
  box-shadow: 0 6px 24px rgba(255, 107, 157, 0.5);
  transition: var(--transition);
  animation: fab-pulse 3s ease-in-out infinite;
  border: 2px solid rgba(255,255,255,0.2);
}

.fab-wheel:hover {
  transform: scale(1.18) rotate(15deg);
  box-shadow: 0 10px 35px rgba(255, 107, 157, 0.7);
  animation: none;
}

@keyframes fab-pulse {
  0%, 100% { transform: scale(1);    box-shadow: 0 6px 24px rgba(255,107,157,0.5); }
  50%       { transform: scale(1.08); box-shadow: 0 8px 32px rgba(255,107,157,0.7); }
}

/* ===== Print ===== */
@media print {
  .navbar, .progress-container, #particles-bg, .bg-glow, .toast-container { display: none; }
  body { background: white; color: black; }
  .scores-table th, .scores-table td { color: black; }
}
