
:root {
  --bg-base: #f8fafc;       
  --bg-elevated: #f1f5f9;    
  --bg-card: #ffffff;
  --bg-card-hover: #eef2ff;

  
  --indigo-500: #4f46e5;
  --indigo-600: #4338ca;
  --indigo-glow: #6366f1;

  
  --sky-400: #0284c7;
  --sky-500: #075985;

  
  --green-500: #16a34a;
  --green-600: #15803d;
  --red-500: #dc2626;
  --red-600: #b91c1c;

  
  --text-primary: #1e1b4b;   
  --text-secondary: #475569; 
  --text-muted: #64748b;

  --border-soft: rgba(30, 27, 75, 0.1);
  --border-strong: rgba(30, 27, 75, 0.18);

  --font-display: 'Tajawal', 'IBM Plex Sans Arabic', sans-serif;
  --font-body: 'IBM Plex Sans Arabic', 'Tajawal', sans-serif;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --shadow-card: 0 8px 24px rgba(30, 27, 75, 0.08);
  --shadow-glow: 0 0 50px rgba(79, 70, 229, 0.18);

  --hero-radial: rgba(79, 70, 229, 0.12);
  --navbar-bg: rgba(248, 250, 252, 0.75);
}


[data-theme="dark"] {
  
  --bg-base: #0f172a;        
  --bg-elevated: #131c33;
  --bg-card: #182238;
  --bg-card-hover: #1d2a47;

 
  --indigo-500: #6366f1;
  --indigo-600: #4338ca;
  --indigo-glow: #4f3bd6;

  
  --sky-400: #38bdf8;
  --sky-500: #0ea5e9;

  --green-500: #22c55e;
  --green-600: #16a34a;
  --red-500: #ef4444;
  --red-600: #dc2626;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --border-soft: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.28);

  --shadow-card: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 60px rgba(99, 102, 241, 0.25);

  --hero-radial: rgba(67, 56, 202, 0.28);
  --navbar-bg: rgba(15, 23, 42, 0.7);
}


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

html {
  scroll-behavior: smooth;
  color-scheme: light;
  transition: background-color 0.3s ease;
}

[data-theme="dark"] {
  color-scheme: dark;
}

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  direction: rtl;
  text-align: right;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

::selection { background: var(--indigo-500); color: #fff; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--bg-card-hover); border-radius: 10px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}


.navbar {
  position: fixed;
  top: 0;
  inset-inline-start: 0;
  inset-inline-end: 0;
  width: 100%;
  z-index: 100;
  background: var(--navbar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
  box-shadow: none;
  transition: box-shadow 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.navbar--scrolled {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .navbar--scrolled {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.navbar__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.95rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.navbar__controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.navbar__logo {
  height: 55px;
  max-width: 38vw;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .navbar__logo { height: 30px; }
}

@media (max-width: 360px) {
  .navbar__logo { height: 26px; max-width: 30vw; }
}

.navbar__links {
  display: flex;
  gap: 0.4rem;
  min-width: 0;
}

.navbar__link {
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.navbar__link:hover {
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.12);
}

@media (max-width: 600px) {
  .navbar__inner { padding: 0.8rem 1rem; gap: 0.5rem; }
  .navbar__link { padding: 0.5rem 0.7rem; font-size: 0.82rem; }
  .navbar__controls { gap: 0.35rem; }
}

@media (max-width: 360px) {
  .navbar__link { padding: 0.45rem 0.55rem; font-size: 0.74rem; }
}


.theme-toggle {
  position: relative;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  color: var(--sky-400);
  transition: border-color 0.25s ease, background-color 0.25s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--sky-400);
  transform: translateY(-2px);
}

.theme-toggle:active { transform: translateY(0) scale(0.94); }

.theme-toggle__icon {
  position: absolute;
  width: 20px;
  height: 20px;
  transition: transform 0.4s cubic-bezier(0.4, 0.2, 0.2, 1), opacity 0.3s ease;
}


.theme-toggle__icon--moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}


.theme-toggle__icon--sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

[data-theme="dark"] .theme-toggle__icon--moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

[data-theme="dark"] .theme-toggle__icon--sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

@media (max-width: 480px) {
  .theme-toggle { width: 38px; height: 38px; }
  .theme-toggle__icon { width: 18px; height: 18px; }
}


.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 1.5rem 4rem;
  overflow: hidden;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, var(--hero-radial), transparent 60%),
              var(--bg-base);
  transition: background-color 0.3s ease;
}

.hero__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

.hero__glow--one {
  width: 420px; height: 420px;
  background: var(--indigo-glow);
  top: -120px; inset-inline-end: -100px;
  animation: floatGlow 12s ease-in-out infinite;
}

.hero__glow--two {
  width: 360px; height: 360px;
  background: var(--sky-500);
  bottom: -100px; inset-inline-start: -80px;
  animation: floatGlow 14s ease-in-out infinite reverse;
}

@keyframes floatGlow {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, 30px) scale(1.08); }
}

.hero__content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  animation: heroRise 0.9s ease both;
}

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

.hero__title {
  font-family: 'Amiri', serif;
  font-weight: 800;
  font-size: clamp(2rem, 6vw, 3.6rem);
  line-height: 1.7;
  padding: 0.4rem 0;
  background: linear-gradient(90deg, #4201ac, var(--sky-400) 90%, var(--indigo-500));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__subtitle {
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto;
}

.hero__scroll-cue {
  position: absolute;
  bottom: 2.2rem;
  left: 50%;
  transform: translateX(-50%);
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  color: var(--sky-400);
  background: rgba(56, 189, 248, 0.06);
  animation: bounceArrow 2s ease-in-out infinite;
  transition: background 0.25s ease, border-color 0.25s ease;
  z-index: 1;
}

.hero__scroll-cue:hover {
  background: rgba(56, 189, 248, 0.14);
  border-color: var(--sky-400);
}

.hero__scroll-cue svg { width: 22px; height: 22px; }

@keyframes bounceArrow {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(10px); }
}


.menu {
  padding: 5rem 1.5rem;
  background: var(--bg-base);
}

@media (max-width: 480px) {
  .menu { padding: 3.5rem 0.9rem; }
}

.menu__inner {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
  align-items: center;
}

.menu__eyebrow {
  display: block;
  text-align: center;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--sky-400);
  font-weight: 600;
}

.menu__buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  width: 100%;
}

@media (max-width: 720px) {
  .menu__buttons { grid-template-columns: 1fr; }
}

.option-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2.75rem 2rem;
  background: linear-gradient(160deg, var(--bg-card), var(--bg-elevated));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  text-align: center;
  overflow: hidden;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

@media (max-width: 480px) {
  .option-card { padding: 2rem 1.25rem; }
}

.option-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(56, 189, 248, 0.1));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.option-card:hover {
  transform: translateY(-6px);
  border-color: var(--sky-400);
  box-shadow: var(--shadow-glow);
}

.option-card:hover::before { opacity: 1; }

.option-card:active { transform: translateY(-3px) scale(0.99); }

.option-card__icon {
  position: relative;
  z-index: 1;
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(56, 189, 248, 0.12);
  color: var(--sky-400);
  transition: transform 0.3s ease, background 0.3s ease;
}

.option-card:hover .option-card__icon {
  transform: scale(1.08);
  background: rgba(56, 189, 248, 0.2);
}

.option-card__icon svg { width: 30px; height: 30px; }

.option-card__text {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
}

.option-card__hint {
  position: relative;
  z-index: 1;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.option-card.is-active {
  border-color: var(--sky-400);
  box-shadow: var(--shadow-glow);
}


.section-header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.section-header__eyebrow {
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: var(--sky-400);
  font-weight: 600;
}

.section-header__title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 800;
}

.section-header__hint {
  color: var(--text-secondary);
  font-size: 0.95rem;
}


.cards-section {
  padding: 5rem 1.5rem 6rem;
  background: linear-gradient(180deg, var(--bg-base), var(--bg-elevated));
}

.cards-section.is-revealing { animation: heroRise 0.5s ease both; }

.cards-section__inner { max-width: 1180px; margin: 0 auto; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1.1rem;
}

@media (max-width: 1024px) { .cards-grid { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 860px)  { .cards-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 640px)  { .cards-grid { grid-template-columns: repeat(3, 1fr); gap: 0.8rem; } }
@media (max-width: 420px)  { .cards-grid { grid-template-columns: repeat(2, 1fr); gap: 0.65rem; } }

.flip-card {
  -webkit-perspective: 1200px;
  perspective: 1200px;
  aspect-ratio: 3 / 4;
}

.flip-card__inner {
  position: relative;
  width: 100%; height: 100%;
  transition: -webkit-transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1),
              transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  cursor: pointer;
}


.flip-card:hover .flip-card__inner,
.flip-card:focus-within .flip-card__inner,
.flip-card.is-flipped .flip-card__inner {
  will-change: transform;
}

.flip-card.is-flipped .flip-card__inner {
  -webkit-transform: rotateY(180deg);
  transform: rotateY(180deg);
}

.flip-card__face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.85rem;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-card);
}

.flip-card__face--front { background: linear-gradient(160deg, var(--bg-card), var(--bg-elevated)); }

.flip-card__face--back {
  background: linear-gradient(160deg, var(--indigo-600), var(--sky-500));
  -webkit-transform: rotateY(180deg);
  transform: rotateY(180deg);
  color: #fff;
}

.flip-card__number {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--sky-400);
  background: rgba(56, 189, 248, 0.12);
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.55rem;
}

.flip-card__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
}

.flip-card__hint { margin-top: 0.5rem; font-size: 0.65rem; color: var(--text-muted); }

.flip-card__desc { font-size: 0.8rem; line-height: 1.5; }

.flip-card:hover .flip-card__inner { -webkit-transform: translateY(-4px); transform: translateY(-4px); }
.flip-card.is-flipped:hover .flip-card__inner {
  -webkit-transform: rotateY(180deg) translateY(-4px);
  transform: rotateY(180deg) translateY(-4px);
}


.quiz-section {
  padding: 5rem 1.5rem 6rem;
  background: var(--bg-elevated);
}

.quiz-section.is-revealing { animation: heroRise 0.5s ease both; }

.quiz-section__inner { max-width: 680px; margin: 0 auto; }

.quiz-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
}

@media (max-width: 480px) {
  .quiz-section { padding: 3.5rem 0.9rem 4rem; }
  .quiz-card { padding: 1.25rem; border-radius: var(--radius-md); }
}

.quiz-progress { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.75rem; }

.quiz-progress__bar {
  height: 6px; width: 100%;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
  overflow: hidden;
}

.quiz-progress__fill {
  height: 100%; width: 10%;
  background: linear-gradient(90deg, var(--sky-400), var(--indigo-500));
  border-radius: 999px;
  transition: width 0.4s ease;
}

.quiz-progress__label { font-size: 0.82rem; color: var(--text-muted); }

.quiz-question {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3.2vw, 1.5rem);
  font-weight: 700;
  text-align: center;
  margin-bottom: 1.75rem;
  min-height: 2.4em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.85rem; }
@media (max-width: 480px) { .quiz-options { grid-template-columns: 1fr; } }

.quiz-option {
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  color: var(--text-primary);
  font-size: 0.98rem;
  font-weight: 500;
  text-align: center;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.25s ease, color 0.25s ease;
}

.quiz-option:hover:not(:disabled) { border-color: var(--sky-400); transform: translateY(-2px); }
.quiz-option:disabled { cursor: default; }

.quiz-option.is-correct {
  background: var(--green-600);
  border-color: var(--green-500);
  color: #fff;
  animation: pulseFeedback 0.35s ease;
}

.quiz-option.is-incorrect {
  background: var(--red-600);
  border-color: var(--red-500);
  color: #fff;
  animation: pulseFeedback 0.35s ease;
}

.quiz-option.is-revealed-correct {
  border-color: var(--green-500);
  box-shadow: inset 0 0 0 2px var(--green-500);
}

@keyframes pulseFeedback {
  0% { transform: scale(0.97); }
  60% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.quiz-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.75rem;
  flex-wrap: wrap;
}

.quiz-score { font-size: 0.92rem; color: var(--text-secondary); }
.quiz-score strong { color: var(--sky-400); }

.quiz-next {
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--indigo-600), var(--sky-500));
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.quiz-next:disabled { opacity: 0.35; cursor: not-allowed; }
.quiz-next:not(:disabled):hover { transform: translateY(-2px); }

.quiz-result {
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  margin-top: 1.5rem;
  animation: heroRise 0.5s ease both;
}

.quiz-result__score {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--sky-400), var(--indigo-500));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.5rem;
}

.quiz-result__msg { color: var(--text-secondary); margin-bottom: 1.5rem; }

.quiz-retry {
  padding: 0.7rem 1.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-weight: 600;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.quiz-retry:hover { border-color: var(--sky-400); background: rgba(56, 189, 248, 0.08); }


.footer {
  background: var(--bg-base);
  border-top: 1px solid var(--border-soft);
  padding: 3.5rem 1.5rem 0;
}

.footer__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding-bottom: 2.5rem;
}

.footer__about { max-width: 480px; }

.footer__logo {
  height: 80px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  margin-bottom: 0.85rem;
}

.footer__desc { color: var(--text-secondary); font-size: 0.92rem; line-height: 1.7; }

.footer__bottom { border-top: 1px solid var(--border-soft); padding: 1.25rem 0; text-align: center; }
.footer__bottom p { font-size: 0.82rem; color: var(--text-muted); }

.footer__author-link {
  color: var(--sky-400);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.footer__author-link:hover {
  color: var(--indigo-500);
  text-decoration-color: currentColor;
}


[hidden] { display: none !important; }
