/* ===== متغيّرات الهوية (مستخرجة من الصورة الرسمية للجائزة) ===== */
:root {
  --petrol-950: #0a2331;
  --petrol-900: #0e2f40;
  --petrol-800: #133b4f;
  --petrol-700: #184860; /* الأساسي المهيمن */
  --petrol-600: #1f5a78;
  --cyan-500: #18a8a8;
  --cyan-400: #3aa9cf;
  --green-600: #00a878; /* الأخضر الثانوي */
  --green-700: #139066;
  --gold-300: #e7cd84;
  --gold-400: #d4af37;
  --gold-500: #bf9b46;
  --gold-deep: #907848;
  --cream: #eaf7f6;
  --cream-dim: #adc3c9;
  --ink: #06202c;
  --radius: 20px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font: 'Tajawal', system-ui, 'Segoe UI', Tahoma, sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--cream);
  background: var(--petrol-950);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* ===== الخلفية ===== */
.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background: radial-gradient(120% 120% at 70% 0%, var(--petrol-600), var(--petrol-950) 62%);
}

.bg__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.20;
  filter: saturate(0.9) brightness(0.7);
}

.bg__gradient {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(14, 47, 64, 0.55) 0%, rgba(10, 35, 49, 0.84) 70%, var(--petrol-950) 100%),
    radial-gradient(85% 55% at 50% -12%, rgba(0, 168, 120, 0.20), transparent 70%),
    radial-gradient(50% 40% at 90% 8%, rgba(24, 168, 168, 0.16), transparent 70%);
}

/* جسيمات متحركة (أخضر/ذهبي/تركوازي) — بديل أنيق يعمل حتى بدون فيديو */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(42px);
  opacity: 0.32;
  animation: float 16s ease-in-out infinite;
}
.orb--1 { width: 360px; height: 360px; top: -60px; right: -40px;
  background: radial-gradient(circle, var(--gold-300), transparent 70%); }
.orb--2 { width: 300px; height: 300px; bottom: 6%; left: -60px; animation-delay: -5s; opacity: 0.30;
  background: radial-gradient(circle, var(--green-600), transparent 70%); }
.orb--3 { width: 220px; height: 220px; top: 42%; right: 28%; animation-delay: -9s; opacity: 0.22;
  background: radial-gradient(circle, var(--cyan-500), transparent 70%); }

@keyframes float {
  0%, 100% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-28px) translateX(18px); }
}

/* ===== الشريط العلوي ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(16px, 5vw, 56px);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand__mark {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--gold-300), var(--gold-500));
  color: var(--petrol-900);
  box-shadow: 0 6px 18px rgba(212, 175, 55, 0.32);
}
.brand__text { font-weight: 700; font-size: 0.95rem; letter-spacing: 0.2px; line-height: 1.35; }

.btn-admin {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border: 1px solid rgba(231, 205, 132, 0.45);
  border-radius: 999px;
  color: var(--gold-300);
  text-decoration: none;
  font-weight: 500; font-size: 0.92rem;
  background: rgba(231, 205, 132, 0.06);
  backdrop-filter: blur(6px);
  transition: transform 0.2s, background 0.2s, border-color 0.2s;
}
.btn-admin:hover {
  background: rgba(231, 205, 132, 0.16);
  border-color: var(--gold-300);
  transform: translateY(-1px);
}

/* ===== المحتوى الرئيسي ===== */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(24px, 6vh, 60px) clamp(16px, 5vw, 40px) 40px;
  max-width: 1220px;
  margin: 0 auto;
  width: 100%;
}

.hero__emblem { color: var(--gold-300); margin-bottom: 14px; animation: rise 0.8s ease both; }
/* شعار المنصة: دائري بأطراف تتلاشى تدريجاً لتندمج مع خلفية المنصة */
.hero__logo {
  display: block; margin: 0 auto; object-fit: cover; border-radius: 50%;
  -webkit-mask-image: radial-gradient(circle, #000 52%, rgba(0, 0, 0, 0.35) 72%, transparent 100%);
  mask-image: radial-gradient(circle, #000 52%, rgba(0, 0, 0, 0.35) 72%, transparent 100%);
}
/* مربع مسؤول لشعار المسابقة (يُستبدل بالشعار الرسمي لاحقاً) */
.logo-placeholder {
  width: 96px; height: 96px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 6px; line-height: 1.5; border-radius: 14px;
  border: 2px dashed var(--gold-300, #d4af37);
  color: var(--gold-300, #d4af37);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.82rem; font-weight: 600;
}

.hero__kicker {
  color: var(--cyan-500);
  font-weight: 500;
  letter-spacing: 2px;
  font-size: 0.85rem;
  margin-bottom: 14px;
  animation: rise 0.8s 0.05s ease both;
}

.hero__title {
  font-size: clamp(1.3rem, 3.8vw, 2.7rem);
  font-weight: 800;
  line-height: 1.3;
  background: linear-gradient(180deg, #ffffff, var(--gold-300));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 18px;
  animation: rise 0.8s 0.1s ease both;
}
/* اسم الأمير (السطر الأول) في سطر واحد لا يلتفّ، والوصف في سطر مستقل */
.hero__title-line { display: block; white-space: nowrap; }

.hero__subtitle {
  color: var(--cream-dim);
  font-size: clamp(0.95rem, 2.3vw, 1.15rem);
  font-weight: 300;
  line-height: 1.9;
  max-width: 640px;
  margin-bottom: 48px;
  animation: rise 0.8s 0.15s ease both;
}

/* دعوة التسجيل الذاتي (تظهر حين يفعّلها الأدمن) */
.hero__register { margin-top: 26px; color: var(--cream-dim); font-size: 0.98rem; }
.hero__register a { color: var(--gold-300, #e9c46a); font-weight: 700; text-decoration: none; }
.hero__register a:hover { text-decoration: underline; }

/* ===== بطاقتا الدخول ===== */
.portals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  width: 100%;
  max-width: 1180px;
  animation: rise 0.8s 0.2s ease both;
}

.portal {
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: start;
  padding: 16px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--cream);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.portal::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-400), transparent);
  opacity: 0.85;
}
.portal--eval::before { background: linear-gradient(90deg, var(--green-600), transparent); }
.portal:hover {
  transform: translateY(-6px);
  border-color: rgba(231, 205, 132, 0.5);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.portal--eval:hover { border-color: rgba(0, 168, 120, 0.55); }

.portal__icon {
  flex: 0 0 auto;
  width: 50px; height: 50px;
  display: grid; place-items: center;
  border-radius: 14px;
  color: var(--petrol-900);
  background: linear-gradient(145deg, var(--gold-300), var(--gold-500));
  box-shadow: 0 8px 20px rgba(212, 175, 55, 0.3);
}
.portal--eval .portal__icon {
  color: var(--cream);
  background: linear-gradient(145deg, var(--green-600), var(--green-700));
  box-shadow: 0 8px 20px rgba(0, 168, 120, 0.4);
}

.portal__body { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.portal__title { font-size: 1.25rem; font-weight: 700; }
.portal__desc { font-size: 0.9rem; font-weight: 300; color: var(--cream-dim); line-height: 1.7; }

.portal__arrow {
  font-size: 1.5rem; color: var(--gold-300);
  transition: transform 0.25s;
}
.portal--eval .portal__arrow { color: var(--green-600); }
.portal--judge::before { background: linear-gradient(90deg, var(--green-600), transparent); }
.portal--judge:hover { border-color: rgba(0, 168, 120, 0.55); }
.portal--judge .portal__icon { color: var(--cream); background: linear-gradient(145deg, var(--green-600), var(--green-700)); box-shadow: 0 8px 20px rgba(0, 168, 120, 0.4); }
.portal--judge .portal__arrow { color: var(--green-600); }
.portal:hover .portal__arrow { transform: translateX(-6px); }

/* ===== التذييل ===== */
.footer {
  text-align: center;
  padding: 22px 16px;
  font-size: 0.82rem;
  color: rgba(173, 195, 201, 0.6);
  position: relative;
}
.footer::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: min(420px, 70%);
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--green-600), var(--cyan-500), transparent);
  opacity: 0.5;
}

/* ===== التنبيه ===== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: rgba(19, 59, 79, 0.96);
  border: 1px solid var(--gold-400);
  color: var(--cream);
  padding: 14px 22px;
  border-radius: 14px;
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 2000; /* فوق كل النوافذ (modal 100 / crop-modal 400) ليظهر التأكيد واضحاً أمامها */
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* نافذة تنبيه الجلسة الخاملة (فوق كل شيء) */
.idle-modal { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(3px); }
.idle-modal__box { background: linear-gradient(160deg, #103246, #0c2636); border: 1px solid rgba(226, 109, 92, 0.4); border-radius: 18px; padding: 26px; max-width: 92vw; width: 420px; text-align: center; box-shadow: var(--shadow); }
.idle-modal__title { color: #fff; margin: 0 0 12px; font-size: 1.15rem; }
.idle-modal__msg { color: var(--cream, #eef4f5); margin: 0 0 16px; line-height: 1.9; }
.idle-modal__msg b { color: #e58a7c; font-size: 1.15em; }
.idle-modal__bar { height: 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.12); overflow: hidden; margin-bottom: 18px; }
.idle-modal__fill { height: 100%; width: 100%; background: linear-gradient(90deg, #e26d5c, #e9c46a); transition: width 1s linear; }
.idle-modal__acts { display: flex; gap: 10px; justify-content: center; }

/* ===== حركات ===== */
@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .orb, .hero__emblem, .hero__kicker, .hero__title, .hero__subtitle, .portals { animation: none; }
}

/* ===== استجابة ===== */
@media (max-width: 720px) {
  .portals { grid-template-columns: 1fr; }
  .brand__text { display: none; }
}
