* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  direction: rtl;
  background: #f0faf6;
  color: #1a1a1a;
}

/* ── الشاشات ── */
#welcome-screen,
#learn-screen,
#review-screen { display: none; }

#welcome-screen.active,
#learn-screen.active,
#review-screen.active { display: block; }

/* ══════════════════════════════
   شاشة الترحيب
══════════════════════════════ */
#welcome-screen {
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #0F6E56 0%, #1D9E75 50%, #5DCAA5 100%);
}
#welcome-screen.active {
  display: flex;
}
.welcome-content {
  background: #fff;
  border-radius: 20px;
  padding: 3rem 2.5rem;
  max-width: 480px;
  width: 90%;
  text-align: center;
}
.welcome-logo {
  font-size: 64px;
  margin-bottom: 1rem;
}
.welcome-content h1 {
  font-size: 26px;
  font-weight: 700;
  color: #0F6E56;
  margin-bottom: 12px;
}
.welcome-content p {
  font-size: 15px;
  color: #555;
  line-height: 1.75;
  margin-bottom: 2rem;
}
.welcome-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
  padding: 1.25rem;
  background: #f0faf6;
  border-radius: 12px;
}
.stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stat-num { font-size: 28px; font-weight: 700; color: #0F6E56; }
.stat-label { font-size: 13px; color: #666; }
.start-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  background: #1D9E75;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.start-btn:hover { background: #0F6E56; }

/* ══════════════════════════════
   شاشة التعلم — هيدر
══════════════════════════════ */
header {
  background: #0F6E56;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 12px 1.5rem;
}
.header-inner h1 {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
}
.back-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.back-btn:hover { background: rgba(255,255,255,0.1); }
.header-progress {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  min-width: 40px;
  text-align: left;
}
.progress-bar-wrap {
  height: 5px;
  background: rgba(255,255,255,0.2);
}
.progress-bar-fill {
  height: 100%;
  background: #FAC775;
  transition: width 0.5s ease;
  width: 0%;
}

/* ══════════════════════════════
   شاشة التعلم — body
══════════════════════════════ */
.learn-body {
  display: flex;
  min-height: calc(100vh - 65px);
}

/* sidebar */
.sidebar {
  width: 280px;
  min-width: 280px;
  background: #fff;
  border-left: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  order: 2;
}
.sidebar-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #0F6E56;
  border-bottom: 1px solid #e0e0e0;
  background: #f0faf6;
}
.sidebar-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 13px;
  color: #333;
}
.sidebar-item:hover { background: #f0faf6; }
.sidebar-item.active { background: #E1F5EE; color: #0F6E56; font-weight: 600; }
.sidebar-item.done .item-icon { color: #1D9E75; }
.sidebar-item.locked { opacity: 0.45; cursor: not-allowed; }
.item-icon { font-size: 16px; min-width: 20px; text-align: center; }
.item-info { flex: 1; }
.item-name { font-weight: 600; margin-bottom: 2px; }
.item-duration { font-size: 11px; color: #888; }

/* المنطقة الرئيسية */
.main-area {
  flex: 1;
  padding: 1.5rem;
  order: 1;
  max-width: calc(100% - 280px);
}

/* أزرار التنقل */
.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.nav-arrow {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid #1D9E75;
  background: #fff;
  color: #0F6E56;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.nav-arrow:hover { background: #E1F5EE; }
.nav-arrow:disabled { opacity: 0.35; cursor: not-allowed; }
#nav-label { font-size: 14px; color: #666; }

/* الفيديو */
.video-section {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #ddd;
  overflow: hidden;
  margin-bottom: 1rem;
}
#main-video {
  width: 100%;
  max-height: 420px;
  background: #000;
  display: block;
}
.video-meta { padding: 1rem 1.25rem; }
.vid-badge {
  display: inline-block;
  font-size: 12px;
  padding: 3px 12px;
  border-radius: 20px;
  background: #E1F5EE;
  color: #085041;
  font-weight: 600;
  margin-bottom: 8px;
}
.video-meta h2 { font-size: 19px; font-weight: 700; color: #0F6E56; margin-bottom: 8px; }
.video-meta p  { font-size: 14px; color: #555; line-height: 1.75; }

.quiz-trigger-btn {
  display: block;
  width: calc(100% - 2.5rem);
  margin: 0 1.25rem 1.25rem;
  padding: 12px;
  border-radius: 10px;
  border: 2px dashed #1D9E75;
  background: #f0faf6;
  color: #0F6E56;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.quiz-trigger-btn:hover { background: #E1F5EE; border-style: solid; }

/* الكويز */
.quiz-section {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #ddd;
  padding: 1.5rem;
  margin-bottom: 1rem;
  display: none;
}
.quiz-section.show { display: block; }
.quiz-inner h3 {
  font-size: 16px;
  font-weight: 700;
  color: #0F6E56;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}
.quiz-q {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 16px;
  line-height: 1.6;
}
.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
  text-align: right;
  transition: all 0.15s;
}
.opt:hover:not(:disabled) { background: #f0faf6; border-color: #1D9E75; }
.opt.correct { background: #E1F5EE; border-color: #1D9E75; color: #085041; font-weight: 600; }
.opt.wrong   { background: #FCEBEB; border-color: #E24B4A; color: #501313; }
.q-result {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  display: none;
}
.q-result.show { display: block; }
.q-result.ok { background: #E1F5EE; color: #085041; }
.q-result.no { background: #FCEBEB; color: #501313; }
.continue-btn {
  margin-top: 14px;
  padding: 11px 28px;
  border-radius: 10px;
  border: none;
  background: #1D9E75;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: none;
}
.continue-btn.show { display: inline-block; }
.continue-btn:hover { background: #0F6E56; }

/* ══════════════════════════════
   شاشة المراجعة
══════════════════════════════ */
#review-screen {
  min-height: 100vh;
  background: linear-gradient(160deg, #0F6E56 0%, #1D9E75 60%, #5DCAA5 100%);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
#review-screen.active { display: flex; }
.review-inner {
  background: #fff;
  border-radius: 20px;
  padding: 2rem;
  max-width: 680px;
  width: 100%;
}
.review-header { text-align: center; margin-bottom: 1.5rem; }
.trophy { font-size: 56px; margin-bottom: 8px; }
.review-header h2 { font-size: 22px; font-weight: 700; color: #0F6E56; margin-bottom: 6px; }
.review-header p  { font-size: 14px; color: #666; }

.road-wrapper {
  background: #E1F5EE;
  border-radius: 14px;
  border: 1px solid #9FE1CB;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.road-hint { font-size: 13px; color: #085041; text-align: center; margin-bottom: 1rem; }
.road-scene { position: relative; height: 115px; }
.sky {
  position: absolute;
  top: 0; width: 100%;
  display: flex;
  justify-content: space-between;
}
.mcol {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}
.mcol:hover .dot { transform: scale(1.4); }
.dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #0F6E56;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px #0F6E56;
  transition: transform 0.2s;
}
.dot-label {
  font-size: 10px;
  color: #085041;
  font-weight: 600;
  text-align: center;
  max-width: 65px;
  line-height: 1.3;
  margin-top: 4px;
}
.road-strip {
  position: absolute;
  bottom: 0; width: 100%;
  height: 46px;
  background: #5DCAA5;
  border-radius: 8px;
}
.road-dashes {
  position: absolute;
  bottom: 19px; width: 100%; height: 4px;
  background: repeating-linear-gradient(to left, #fff 0, #fff 20px, transparent 20px, transparent 40px);
  opacity: 0.6;
}
.car {
  position: absolute;
  bottom: 26px;
  right: 92%;
  font-size: 28px;
  transition: right 1.4s cubic-bezier(.4,0,.2,1);
  z-index: 3;
}
.era-detail {
  background: #f0faf6;
  border-radius: 12px;
  padding: 1.25rem;
  display: none;
}
.era-detail.show { display: block; }
.era-detail h2 { font-size: 18px; font-weight: 700; color: #0F6E56; margin-bottom: 8px; }
.era-detail p  { font-size: 14px; color: #444; line-height: 1.75; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .sidebar { display: none; }
  .main-area { max-width: 100%; }
}