/* =========================================
   أساسيات منسوخة من base.css — خاصة بهذه الصفحة فقط
   ========================================= */
html, body { background: #72230bff; }

/* المتغيرات */
:root {
  --primary: #AD3103;
  --secondary: #EBCE8F;
  --dark: #2b0a00;
  --text: #fffdf8;
  --muted: #d8c9a7;
  --card: #FFF5E1;
  --gold: #EBCE8F;
}

/* Reset */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: 'Tajawal','Segoe UI','Tahoma',Arial,sans-serif;
  color: var(--text);

  /* نفس خلفية الموقع (لو تبي تغيرها هنا، غيّر هذا فقط) */
  background-color: #72230bff; /* fallback فوري */
  background-image: url(/assets/img/7nkh_Background.webp);
  background-size: cover;
  background-repeat: repeat;
  background-attachment: fixed;
  background-position: center;
}

/* الأزرار */
.btn {
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  border: none;
  transition: all .2s;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: #811f00; }
.btn.secondary { background: var(--secondary); color: #000; }
.btn.secondary:hover { background: #f7e3b3; }
.btn.danger { background: #c0392b; color: #fff; }
.btn.success { background: #27ae60; color: #fff; }
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid rgba(0,0,0,.15); }

/* الفوتر */
.footer {
  padding: 18px 0;
  background: rgba(0,0,0,0.55);
  color: var(--text);
  margin-top: auto;
}
.footer .wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* أيقونات التواصل */
.social {
  display: flex;
  gap: 12px;
}
.social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: rgba(255,255,255,0.15);
  color: var(--secondary);
  transition: transform .15s, background .15s;
}
.social a:hover {
  transform: translateY(-3px);
  background: rgba(255,255,255,0.3);
}
.social svg { width: 28px; height: 28px; }

/* ====== انتهى الجزء المنسوخ من base.css ====== */
/* quiz_select.css — أنماط خاصة بتحدي الأسئلة
  */

body.layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.footer { margin-top: auto; }

/* Header */
.site-header {
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 1200px;
  margin: 20px auto;
  padding: 20px;
  background: rgba(0,0,0,0.25);
  border-radius: 12px;
  text-align: center;
}
.logo {
  margin-left: 12px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--primary);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}
.logo img { width: 100%; height: 100%; object-fit: cover; }

.brand h1 { margin: 0; font-size: 1.6rem; color: var(--secondary); }
.brand .subtitle { margin: 6px 0 0; color: var(--muted); font-size: 1rem; }

/* Back button */
.back-home {
  position: absolute;
  top: 15px;
  right: 20px;
  background: var(--primary);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}
.back-home:hover { background: #8c2502; }

/* فرق + زر البدء */
.teams-section { max-width: 800px; margin: 20px auto; text-align: center; }
.teams-inputs { display: flex; gap: 20px; justify-content: center; margin-bottom: 16px; flex-wrap: wrap; }
.team-field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
  min-width: 220px;
  background: rgba(255,255,255,0.08);
  padding: 14px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.team-field label {
  margin-bottom: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.team-field input {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--secondary);
  background: #fff;
  color: #000;
  width: 100%;
  font-size: 1rem;
}

/* Start button */
#startBtn {
  font-size: 1.2rem;
  padding: 14px 28px;
  border-radius: 12px;
  background: #AD3103;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  transition: transform .2s, box-shadow .2s;
}
#startBtn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
  background: #AD3103
}

/* Picker */
.picker { text-align: center; margin-top: 30px; }
.categories-list { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; margin: 20px 0; }

/* أقسام التصنيفات */
.category-group {
  background:rgba(235, 206, 143, 0.778);
  background-attachment: fixed;
  padding: 40px;
  border-radius: 16px;
  width: 90%;                 /* ياخذ عرض الشاشة */
  margin-bottom: 30px;         /* مسافة بين كل مجموعة */
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  align-items: flex-start;     /* العنوان والبطاقات بمحاذاة اليمين */
}
.category-group:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 26px rgba(0,0,0,0.35);
}
.category-group h4 {
  margin: 0 0 16px;
  font-size: 1.6rem;
  font-weight: 800;
  color: #ff0000;
  text-align: center;
  text-shadow:
  0 0 2px rgba(0, 0, 0, 0.9),
  0 2px 4px rgba(0, 0, 0, 0.9);


  width: 100%;
}


/* زر التصنيف الفرعي */
.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  width: 100%;
}
.cat-item {
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--secondary);
  border: none;
  font-weight: 700;
  cursor: pointer;
  color: #000;
  transition: all .2s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.cat-item:hover {
  background: #f7e3b3;
  transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}
.cat-item.selected {
  background: var(--primary);
  color: #fff;
  transform: translateY(-3px) scale(1.07);
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

/* Toasts */
#toastHost {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
#toastHost .toast {
  background: rgba(0,0,0,.75);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0,0,0,.4);
  transition: all .35s;
}

/* ✨ تأثير فوز الفريق */
.team-score-value.glow { animation: glowFlash 1.2s ease-out; }
@keyframes glowFlash {
  0%   { text-shadow: 0 0 0px gold, 0 0 0px gold; color: var(--secondary); }
  40%  { text-shadow: 0 0 12px gold, 0 0 24px gold; color: #FFD700; }
  100% { text-shadow: 0 0 0px gold, 0 0 0px gold; color: var(--secondary); }
}

.cat-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.sub-card {
  position: relative;
  flex: 0 1 calc(25% - 16px);  /* أربع بطاقات بالصف تقريبًا */
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  /* ✂️ لا نقصّ محتوى الكرت عشان التولتيب يطلع برا */
  overflow: visible;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  transition: transform 0.2s ease;
  max-width: 200px;
  min-width: 120px;
}

.sub-card:hover {
  transform: scale(1.05);
}
.sub-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  border-radius: 12px;          /* تقصّ زوايا الصورة نفسها */
  display: block;
}
.sub-card .sub-name {
  position: absolute;
  bottom: 0;
  width: 100%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  text-align: center;
  font-size: 16px;
  padding: 5px;
  pointer-events: none;
  border-radius: 0 0 12px 12px;   /* يكمّل دوران الزاوية من تحت */
}

.sub-card.disabled {
  opacity: 0.4;
  pointer-events: none;
}
.sub-card.selected {
  outline: 4px solid #AD3103; /* لون الثيم */
}
/* شارة عدد المرّات فوق بطاقة التصنيف */
.sub-card .sub-badge {
  position: absolute;
  top: 8px;
  right: 8px;           /* RTL: يمين */
  background: #AD3103;  /* لون الثيم */
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  pointer-events: none; /* ما تمنع الضغط على البطاقة */
}

/* شعار التصنيف (badge_label) */
.sub-card .sub-logo {
  position: absolute;
  top: 8px;
  left: 8px;              /* خليها يسار عشان ما تصطدم مع "متاح ×N" اللي على اليمين */
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  padding: 3px 7px;
  border-radius: 999px;    /* كأنها pill صغيرة */
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
  pointer-events: auto;    /* عشان نقدر نضغطها */
}

/* ============================================= */
/* 📱 تحسينات مظهر التطبيق على الجوال والتابلت */
/* ============================================= */

/* 🧠 القاعدة العامة للجوال */
@media (max-width: 767px) {
  body.layout {
    background: var(--background);
    padding: 0;
  }

  /* 🔹 زر العودة يصبح دائري داخل شريط علوي */
  .back-home {
    top: 10px;
    right: 10px;
    padding: 10px 12px;
    font-size: 0.9rem;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
  }

  /* 🔹 الهيدر */
  .site-header {
    flex-direction: column;
    background: transparent;
    box-shadow: none;
    padding: 10px 0;
    margin: 60px 0 10px;
  }

  .logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 10px;
  }

  .brand h1 {
    font-size: 1.3rem;
  }
  .brand .subtitle {
    font-size: 0.9rem;
  }

  /* 🔹 قسم الفرق */
  .teams-section {
    margin: 10px auto;
    padding: 0 12px;
  }
  .teams-inputs {
    flex-direction: column;
    gap: 12px;
  }
  .team-field {
    width: 100%;
    padding: 12px;
  }
  .team-field input {
    font-size: 1rem;
  }

  /* زر البدء */
  #startBtn {
    width: 100%;
    font-size: 1.1rem;
    padding: 14px 0;
    border-radius: 10px;
  }

  /* 🔹 التصنيفات */
  .category-group {
    padding: 16px;
    border-radius: 12px;
  }
  .category-group h4 {
    font-size: 1.2rem;
  }
  .category-list {
    justify-content: center;
  }
  .sub-card {
    flex: 0 1 calc(45% - 10px);  /* بطاقتين بالصف */
    max-width: none;
    min-width: 120px;
  }
  .sub-card .sub-name {
    font-size: 14px;
    padding: 4px;
  }

  /* 🔹 Toasts */
  #toastHost .toast {
    font-size: 0.9rem;
    padding: 8px 10px;
  }

  /* 🔹 الفوتر */
  .footer {
    font-size: 0.8rem;
    padding: 10px 0;
    background: rgba(0,0,0,0.3);
  }
}

/* 💻 التابلت */
@media (min-width: 768px) and (max-width: 1024px) {
  .site-header {
    flex-direction: row;
    justify-content: center;
    gap: 20px;
    padding: 14px;
  }
  .logo {
    width: 100px;
    height: 100px;
  }
  .brand h1 { font-size: 1.5rem; }
  .brand .subtitle { font-size: 1rem; }

  .teams-section {
    max-width: 600px;
  }

  .category-list {
    justify-content: center;
  }
  .sub-card {
    flex: 0 1 calc(30% - 14px); /* ثلاث بطاقات في الصف */
  }
}
/* ============================
   Modal إدخال الكود — إضافة جديدة
   لا تغيّر أي عناصر قائمة
   ============================ */
.modal.is-hidden { display: none; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.modal-dialog {
  position: relative;
  width: min(520px, 92vw);
  background: var(--card, #FFF5E1);
  color: var(--text, #000);
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(0,0,0,.35);
  padding: 18px 18px 14px;
  z-index: 1;
}
.modal-close {
  position: absolute;
  top: 6px;
  left: 8px; /* RTL */
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.08);
  font-size: 20px;
  line-height: 36px;
  cursor: pointer;
}
.modal-header h3 {
  margin: 0 0 6px;
  color: var(--primary, #AD3103);
  font-size: 1.2rem;
  font-weight: 800;
  text-align: center;
}
.modal-sub {
  margin: 0 0 10px;
  color: var(--dark, #2b0a00);
  opacity: .85;
  text-align: center;
  font-size: .95rem;
}
.modal-body { margin-top: 6px; }
.redeem-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 14px;
}
.redeem-field label {
  font-size: .9rem;
  font-weight: 700;
  color: var(--primary, #AD3103);
}
#redeemInput {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--secondary, #EBCE8F);
  background: #fff;
  color: #000;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-align: center;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
}
.btn.ghost {
  background: transparent;
  color: var(--primary, #AD3103);
  border: 1px solid rgba(0,0,0,.15);
}
.modal-footer-hint {
  margin-top: 10px;
  text-align: center;
  font-size: .95rem;
  color: var(--dark, #2b0a00);
}
.modal-footer-hint a {
  font-weight: 800;
  text-decoration: none;
}
.redeem-feedback {
  margin-top: 10px;
  text-align: center;
  min-height: 22px;
  font-weight: 700;
}
@media (max-width: 767px) {
  .modal-dialog { padding: 16px 14px 12px; border-radius: 14px; }
  .modal-header h3 { font-size: 1.05rem; }
  .modal-sub { font-size: .9rem; }
  #redeemInput { font-size: 1rem; }
}
/* 🎨 تحسين تباين ألوان المودال */
.modal-dialog {
  background: #FFF2C6; /* أدفأ قليلاً وأغمق من الأبيض السابق */
  color: #2b0a00;      /* نص غامق واضح */
}

.modal-header h3,
.modal-sub,
.redeem-field label,
.modal-footer-hint,
.redeem-feedback {
  color: #2b0a00 !important; /* توحيد لون النصوص للوضوح */
}

/* النص السفلي "❌ الكود غير صالح" */
.redeem-feedback {
  font-weight: 700;
  color: #B00020 !important; /* أحمر واضح */
  text-shadow: 0 0 2px rgba(255,255,255,0.5);
}

/* النص "ما عندك كود؟ اشترِ كودًا الآن 🔑" */
.modal-footer-hint a {
  color: #5a2c00 !important;
  text-decoration: underline;
}

/* الزر الرئيسي */
.modal-actions .btn.primary {
  background: var(--primary, #AD3103);
  color: #fff;
}
.modal-actions .btn.primary:hover {
  background: #8c2502;
}
/* ============================================================
   ✨ Tooltip راقي لشعار التوضيح (sub-logo)
   ============================================================ */
/* ============================ */
/*  🌟 Tooltip جديد وراقي جداً   */
/* ============================ */

/* البادج نفسه */
.sub-card .sub-logo {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all .18s ease;
  z-index: 50;
}

.sub-card .sub-logo:hover {
  background: rgba(0,0,0,0.85);
  transform: scale(1.07);
}
/* الصندوق — فوق الكرت، في الوسط */
.sub-card .sub-logo::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  background-image: url(/assets/img/a11dfeaccf482a05.jpg);
  background-size: cover;
  background-repeat: repeat;
  background-attachment: fixed;
  background-position: center;
  color: #fff;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,.4);
  opacity: 0;
  pointer-events: none;

  /* 👇 أهم ثلاثة أسطر */
  width: 260px;         /* مستطيل أفقي ثابت وواضح */
  max-width: 260px;     /* يمنع تمدد العرض */
  white-space: normal;  /* يسمح بسطرين أو 3 بشكل طبيعي */

  line-height: 1.4;
  text-align: center;
  word-break: break-word;
  z-index: 40;
}

/* السهم الصغير تحت الصندوق */
.sub-card .sub-logo::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #2b0a00 transparent transparent transparent;
  opacity: 0;
  transition: opacity .18s ease;
}

/* عند الوقوف */
.sub-card .sub-logo:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
.sub-card .sub-logo:hover::before {
  opacity: 1;
}


/* للجوال — يظهر تحت بشكل أفضل */
@media (max-width: 767px) {
  .sub-card .sub-logo::after {
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    white-space: normal;
    width: max-content;
    max-width: 180px;
  }
  .sub-card .sub-logo::before {
    display: none;
  }
  .sub-card .sub-logo:hover::after {
    transform: translateX(-50%) scale(1);
  }
}
.sub-card .sub-logo[title] {
  pointer-events: auto;
}

/* زر العودة للأعلى بعد اختيار ٦ تصنيفات */
.scroll-top-btn {
  position: fixed;
  bottom: 80px;
  right: 18px;
  z-index: 650;
  min-width: 46px;
  height: 46px;
  padding: 0 14px;
  border-radius: 999px;
  border: none;
  background: #ad310363;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
  display: inline-flex;
  align-items: center;
  justify-content: center;

  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
}

/* حالة الظهور */
.scroll-top-btn.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* لمسات للجوال */
@media (max-width: 767px) {
  .scroll-top-btn {
    right: 12px;
    bottom: 70px;
    min-width: 42px;
    height: 42px;
    font-size: 0.85rem;
    box-shadow: 0 4px 14px rgba(0,0,0,0.45);
  }
}
/* شريط رؤوس ذيبان لتمثيل ٦ تصنيفات مختارة */
.selection-dots {
  position: fixed;
  bottom: 130px;          /* فوق زر العودة للأعلى */
  right: 18px;
  z-index: 640;
  padding: 6px 8px;
  border-radius: 999px;
  background: #ad310300;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.selection-dot {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.selection-dot-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.25;                  /* باهتة افتراضياً */
  filter: grayscale(1);
  transform-origin: center center;
  transition: opacity .18s ease, filter .18s ease;
}

/* عند تعبئة النقطة */
.selection-dot-icon.is-active {
  opacity: 1;
  filter: none;
}

/* أنيميشن دوران 360 */
.selection-dot-icon.spin {
  animation: head-spin-360 .6s ease-out;
}

@keyframes head-spin-360 {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ضبط الموضع على الجوال */
@media (max-width: 767px) {
  .selection-dots {
    right: 12px;
    bottom: 110px;
    padding: 5px 7px;
  }

  .selection-dot {
    width: 24px;
    height: 24px;
  }
}
.toast{ transition: opacity .35s ease, transform .35s ease; }
.toast.toast-leave{ opacity:0; transform: translateY(8px); }
