/* ===== هوية وزارة التعليم - الكحلي والبنفسجي ===== */
:root {
  --moe-navy: #1B2A6B;       /* الكحلي الرئيسي */
  --moe-purple: #5B2D8E;     /* البنفسجي الرئيسي */
  --moe-light-purple: #7B4DB0;
  --moe-dark-navy: #0D1A4A;
  --moe-gold: #C8A84B;       /* الذهبي التراثي */
  --moe-light-gold: #FFD700;
  --moe-accent: #8B5CF6;     /* بنفسجي فاتح */
  --moe-teal: #0EA5E9;       /* أزرق مكمل */
  --moe-green: #22C55E;      /* أخضر النجاح */
  --moe-red: #EF4444;        /* أحمر الخطأ */
  --moe-orange: #F97316;     /* برتقالي التحذير */
  
  /* تدرجات رئيسية */
  --gradient-main: linear-gradient(135deg, var(--moe-dark-navy) 0%, var(--moe-navy) 50%, var(--moe-purple) 100%);
  --gradient-card: linear-gradient(145deg, rgba(27,42,107,0.95) 0%, rgba(91,45,142,0.95) 100%);
  --gradient-btn: linear-gradient(135deg, var(--moe-navy) 0%, var(--moe-purple) 100%);
  --gradient-gold: linear-gradient(135deg, #C8A84B 0%, #FFD700 50%, #C8A84B 100%);
  
  /* الخطوط */
  --font-main: 'Tajawal', 'Arial', sans-serif;
  
  /* الظلال */
  --shadow-card: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-btn: 0 4px 15px rgba(91,45,142,0.4);
  --shadow-glow: 0 0 20px rgba(91,45,142,0.6);
}

/* ===== إعادة الضبط الأساسية ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  width: 100%;
  height: 100%;
  height: 100dvh;
}
body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font-main);
  background: var(--moe-dark-navy);
  color: #fff;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}
/* ===== الشاشات ===== */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--gradient-main);
  z-index: 10;
  overflow: clip;
}
.screen.active { display: flex; }

/* ===== نجوم الخلفية ===== */
.stars-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.star-particle {
  position: absolute;
  border-radius: 50%;
  background: white;
  animation: twinkle 3s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.3); }
}

/* ===== شاشة التحميل - تصميم جديد ===== */
#loading-screen {
  background: #0a0a1a;
  z-index: 100;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  height: 100dvh !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}
/* صورة الملك - تملأ الشاشة كاملة كخلفية */
.loading-king-wrap {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1;
}
.loading-king-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.loading-king-fade {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60%;
  background: linear-gradient(to top, rgba(10,10,26,0.97) 0%, rgba(10,10,26,0.88) 35%, rgba(10,10,26,0.5) 65%, transparent 100%);
}
/* العنوان فوق خط التحميل */
.loading-center-content {
  position: relative;
  z-index: 5;
  text-align: center;
  padding: 0 20px;
  margin-bottom: 14px;
}
.loading-title {
  font-size: clamp(28px, 9vw, 56px);
  font-weight: 900;
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
  line-height: 1.2;
  margin: 0 0 6px;
  text-shadow: none;
  filter: drop-shadow(0 2px 8px rgba(200,168,75,0.5));
}
.loading-subtitle {
  font-size: clamp(12px, 3.5vw, 16px);
  color: rgba(255,255,255,0.9);
  font-weight: 500;
  margin: 0;
  text-shadow: 0 1px 6px rgba(0,0,0,0.9);
}
/* الجزء السفلي: شريط تحميل + شعار متحرك + نص + حقوق */
.loading-bottom {
  position: relative;
  z-index: 5;
  width: 100%;
  padding: 0 20px;
  padding-bottom: max(22px, env(safe-area-inset-bottom, 22px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
/* صف الشعار وخط التحميل */
.loading-bar-row {
  width: 100%;
  max-width: 440px;
  position: relative;
  height: 46px;
  display: flex;
  align-items: center;
  direction: ltr;
}
/* خط التحميل الكامل */
.loading-bar-container {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 6px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  overflow: visible;
  border: 1px solid rgba(200,168,75,0.3);
  direction: ltr;
}
.loading-bar {
  height: 100%;
  width: 0%;
  background: var(--gradient-gold);
  border-radius: 10px;
  transition: width 0.25s ease;
  box-shadow: 0 0 12px rgba(200,168,75,0.7);
  position: relative;
}
/* شعار الوزارة يتحرك مع خط التحميل */
.loading-moe-icon {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 46px;
  height: 46px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(200,168,75,1)) brightness(1.4);
  transition: left 0.25s ease;
  z-index: 3;
  pointer-events: none;
}
.loading-text {
  font-size: clamp(11px, 3vw, 13px);
  color: rgba(255,255,255,0.65);
  animation: fadeInOut 1.5s ease-in-out infinite;
  margin: 0;
}
.loading-copyright {
  font-size: clamp(9px, 2.5vw, 11px);
  color: rgba(255,255,255,0.38);
  margin: 0;
  text-align: center;
}
@keyframes fadeInOut { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

/* عناصر قديمة غير مستخدمة - احتفاظ للتوافق */
.game-logo {
  font-size: clamp(32px, 6vw, 52px);
  font-weight: 900;
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  letter-spacing: 2px;
}
.game-subtitle { font-size: 16px; color: rgba(255,255,255,0.8); font-weight: 500; }
.game-ministry { font-size: 13px; color: var(--moe-gold); font-weight: 600; letter-spacing: 1px; }

/* ===== القائمة الرئيسية ===== */
#main-menu {
  background: var(--gradient-main);
}
.menu-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.desert-silhouette {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 35%;
  background: linear-gradient(to top, rgba(13,26,74,0.8) 0%, transparent 100%);
}
.menu-content {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 20px;
  width: 100%;
  max-width: 500px;
}
.moe-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(200,168,75,0.3);
  border-radius: 12px;
  padding: 10px 20px;
  backdrop-filter: blur(10px);
}
.moe-logo-main {
  width: 45px; height: 45px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(200,168,75,0.5));
}
.moe-title-block {
  display: flex;
  flex-direction: column;
}
.moe-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--moe-gold);
}
.moe-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
}
.menu-header {
  text-align: center;
}
.title-swords {
  font-size: 36px;
  animation: swordGlow 2s ease-in-out infinite;
}
.saudi-emblem-img {
  width: 70px;
  height: auto;
  filter: drop-shadow(0 0 8px rgba(200,168,75,0.6)) brightness(1.1);
  animation: swordGlow 2s ease-in-out infinite;
}
@keyframes swordGlow {
  0%, 100% { filter: drop-shadow(0 0 5px rgba(200,168,75,0.3)); }
  50% { filter: drop-shadow(0 0 15px rgba(200,168,75,0.8)); }
}
.title-main {
  font-size: clamp(28px, 7vw, 48px);
  font-weight: 900;
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 5px 0;
  letter-spacing: 1px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1;
}
.title-sub {
  font-size: 14px;
  color: rgba(255,255,255,0.75);
  font-weight: 500;
}
.title-decoration {
  font-size: 24px;
  margin-top: 5px;
}
.menu-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  align-items: stretch;
}
.menu-buttons > button:nth-child(-n+2) {
  grid-column: 1 / -1;
}
.menu-buttons > button:nth-child(3) { order: 1; }
.menu-buttons > button:nth-child(5) { order: 2; }
.menu-buttons > button:nth-child(4) { order: 3; }
.menu-buttons > button:nth-child(6) { order: 4; }
@media (max-width: 640px) {
  .menu-buttons {
    grid-template-columns: 1fr 1fr;
  }
  .menu-buttons > button {
    min-height: 58px;
  }
  .menu-buttons > button:nth-child(-n+2) {
    grid-column: 1 / -1;
  }
  .menu-buttons > button span:last-child {
    font-size: 14px;
  }
}
.menu-stats {
  display: flex;
  gap: 15px;
  justify-content: center;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(200,168,75,0.2);
  border-radius: 10px;
  padding: 8px 16px;
}
.stat-icon { font-size: 18px; }
.stat-label { font-size: 11px; color: rgba(255,255,255,0.6); }
.stat-value { font-size: 18px; font-weight: 700; color: var(--moe-gold); }
.menu-footer {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  text-align: center;
}

/* ===== الأزرار الرئيسية ===== */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  background: var(--gradient-btn);
  border: 2px solid var(--moe-gold);
  border-radius: 12px;
  color: white;
  font-size: 17px;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(91,45,142,0.6);
  border-color: var(--moe-light-gold);
}
.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  background: rgba(27,42,107,0.7);
  border: 1.5px solid rgba(200,168,75,0.4);
  border-radius: 12px;
  color: rgba(255,255,255,0.9);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  backdrop-filter: blur(5px);
}
.btn-secondary:hover {
  background: rgba(91,45,142,0.5);
  border-color: var(--moe-gold);
  transform: translateY(-1px);
}
.btn-danger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: rgba(239,68,68,0.2);
  border: 1.5px solid rgba(239,68,68,0.5);
  border-radius: 12px;
  color: #FCA5A5;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
}
.btn-danger:hover { background: rgba(239,68,68,0.4); }
.btn-icon { font-size: 20px; }
.glow-btn {
  animation: glowPulse 2.5s ease-in-out infinite;
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 4px 15px rgba(91,45,142,0.4); }
  50% { box-shadow: 0 6px 30px rgba(91,45,142,0.8), 0 0 20px rgba(200,168,75,0.4); }
}

/* ===== شاشة إدخال الاسم ===== */
#name-screen {
  background: var(--gradient-main);
}
.name-screen-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 30px 20px;
  width: 100%;
  max-width: 450px;
}
.name-moe-logo {
  width: 60px; height: 60px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(200,168,75,0.5));
}
.name-screen-icon { font-size: 40px; }
.name-screen-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--moe-gold);
  text-align: center;
}
.name-screen-subtitle {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  text-align: center;
}
.name-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}
.name-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.name-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--moe-gold);
}
.name-input, .name-select {
  padding: 12px 16px;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(200,168,75,0.3);
  border-radius: 10px;
  color: white;
  font-size: 15px;
  font-family: var(--font-main);
  outline: none;
  transition: border-color 0.3s;
  width: 100%;
}
.name-input:focus, .name-select:focus {
  border-color: var(--moe-gold);
  background: rgba(255,255,255,0.12);
}
.name-input::placeholder { color: rgba(255,255,255,0.4); }
.name-select option {
  background: var(--moe-navy);
  color: white;
}
.name-confirm-btn {
  margin-top: 5px;
  font-size: 18px;
  padding: 15px;
}

/* ===== شاشة التعليمات ===== */
#instructions-screen {
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(10px);
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(5px);
}
.modal-box {
  background: var(--gradient-card);
  border: 1.5px solid rgba(200,168,75,0.4);
  border-radius: 20px;
  padding: 28px;
  width: min(480px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-card);
}
.modal-box.large { width: min(560px, 95vw); }
.modal-moe-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
  padding: 8px 14px;
  background: rgba(200,168,75,0.1);
  border-radius: 8px;
  border: 1px solid rgba(200,168,75,0.3);
}
.modal-moe-badge span {
  font-size: 14px;
  font-weight: 600;
  color: var(--moe-gold);
}
.modal-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--moe-gold);
  text-align: center;
  margin-bottom: 20px;
}
.instructions-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}
.inst-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,0.08);
}
.inst-icon { font-size: 28px; flex-shrink: 0; }
.inst-item h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--moe-gold);
  margin-bottom: 4px;
}
.inst-item p {
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  line-height: 1.5;
}

/* ===== شاشة اللعبة - HUD ===== */
#game-screen {
  background: transparent;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(13,26,74,0.95) 0%, rgba(91,45,142,0.95) 100%);
  border-bottom: 2px solid rgba(200,168,75,0.4);
  height: 52px;
  flex-shrink: 0;
  z-index: 20;
  position: relative;
}
.hud-right, .hud-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hud-center {
  flex: 1;
  display: flex;
  justify-content: center;
}
.hud-btn {
  padding: 6px 12px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: white;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-main);
  transition: background 0.2s;
}
.hud-btn:hover { background: rgba(255,255,255,0.2); }
/* زر تخطي مؤقت - يُحذف بعد الاعتماد */
.hud-btn-skip {
  background: rgba(255, 160, 0, 0.25) !important;
  border-color: rgba(255, 160, 0, 0.6) !important;
  color: #ffd54f !important;
  font-weight: 700;
  letter-spacing: 0.5px;
  position: relative;
}
.hud-btn-skip::after {
  content: 'اختبار';
  position: absolute;
  top: -8px;
  right: 50%;
  transform: translateX(50%);
  font-size: 8px;
  background: #e65100;
  color: white;
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
}
.hud-btn-skip:hover { background: rgba(255, 160, 0, 0.45) !important; }
/* نهاية تنسيق زر التخطي */
.stage-info {
  display: flex;
  align-items: baseline;
  gap: 3px;
}
.stage-label { font-size: 11px; color: rgba(255,255,255,0.6); }
.stage-num { font-size: 20px; font-weight: 900; color: var(--moe-gold); }
.stage-total { font-size: 12px; color: rgba(255,255,255,0.5); }
.era-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--moe-gold);
  background: rgba(200,168,75,0.15);
  border: 1px solid rgba(200,168,75,0.4);
  border-radius: 20px;
  padding: 4px 14px;
  white-space: nowrap;
}
.score-display, .stars-display {
  display: flex;
  align-items: center;
  gap: 4px;
}
.score-icon { font-size: 14px; }
.score-label { font-size: 10px; color: rgba(255,255,255,0.6); }
.score-value { font-size: 16px; font-weight: 800; color: var(--moe-gold); }

/* ===== منطقة اللعب ===== */
.game-area {
  flex: 1;
  width: 100%;
  position: relative;
  overflow: visible;
  min-height: 0;
}
.scene-container {
  position: absolute;
  inset: 0;
  overflow: visible;
}
/* مشهد القصة: flex column لضمان ظهور story-panel كاملاً على جميع الأجهزة */
#story-scene {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 2;
  position: absolute;
  inset: 0;
  /* الخلفية تملأ الشاشة كاملة */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
/* السماح بالتمرير داخل quiz-scene */
#quiz-scene {
  overflow: visible;
}

/* ===== مشهد السرد ===== */
.scene-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.5s ease;
}
/* صورة خلفية حقيقية تضمن الظهور على جميع الأجهزة بما فيها iOS */
.scene-bg-img {
  display: none !important;
}
.scene-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(7,12,34,0.97) 0%,
    rgba(7,12,34,0.72) 34%,
    rgba(7,12,34,0.34) 64%,
    rgba(7,12,34,0.12) 100%
  );
}
.character-container {
  position: absolute;
  bottom: 0;
  right: 5%;
  width: 45%;
  height: 85%;
  z-index: 3;
}
.character-back {
  width: 100%;
  height: 100%;
  background-size: contain;
  background-position: bottom center;
  background-repeat: no-repeat;
  filter: drop-shadow(0 0 20px rgba(91,45,142,0.5));
  animation: characterFloat 4s ease-in-out infinite;
}
.character-group {
  position: absolute;
  bottom: 0; left: -30%;
  width: 70%;
  height: 70%;
  background-size: contain;
  background-position: bottom center;
  background-repeat: no-repeat;
  opacity: 0.7;
}
@keyframes characterFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.story-panel {
  position: relative;
  flex-shrink: 0;
  background: linear-gradient(to top, rgba(5,10,28,0.99) 0%, rgba(8,16,50,0.97) 58%, rgba(8,16,50,0.82) 82%, rgba(8,16,50,0.18) 100%);
  padding: 40px 20px 22px;
  padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));
  z-index: 10;
  border-top: none;
  width: 100%;
  box-sizing: border-box;
  max-height: 60vh;
  overflow-y: auto;
  margin-top: -20px;
}
/* تقليل ارتفاع story-panel في مشاهد الملوك لإظهار الخلفية */
.story-panel--king {
  max-height: 55vh !important;
  margin-top: 0 !important;
}
@media (max-width: 768px) {
  .story-panel--king {
    max-height: 52vh !important;
  }
}
/* صورة علوية في story-panel لمشاهد الملوك والمشاريع */
.story-top-image {
  width: 100%;
  height: 180px;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 14px;
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
@media (max-width: 768px) {
  .story-top-image {
    height: 140px;
    margin-bottom: 10px;
    border-radius: 10px;
  }
}
.story-era {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--moe-gold);
  background: rgba(200,168,75,0.15);
  border: 1px solid rgba(200,168,75,0.4);
  border-radius: 20px;
  padding: 3px 12px;
  margin-bottom: 8px;
}
.story-title {
  font-size: clamp(18px, 4vw, 26px);
  font-weight: 900;
  color: #ffe082;
  margin-bottom: 10px;
  text-shadow: 0 3px 12px rgba(0,0,0,0.78);
}
.story-text {
  font-size: clamp(13px, 2.5vw, 16px);
  line-height: 1.8;
  color: rgba(255,255,255,0.98);
  margin-bottom: 12px;
  max-height: 132px;
  overflow-y: auto;
  text-shadow: 0 2px 10px rgba(0,0,0,0.72);
}
.story-encouragement {
  font-size: 13px;
  font-style: italic;
  color: #f8d46a;
  border-right: 3px solid var(--moe-gold);
  padding: 8px 10px 8px 0;
  margin-bottom: 14px;
  opacity: 1;
  text-shadow: 0 2px 8px rgba(0,0,0,0.65);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03));
  border-radius: 8px;
}
.btn-story-next {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--gradient-btn);
  border: 1.5px solid var(--moe-gold);
  border-radius: 10px;
  color: white;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: var(--shadow-btn);
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(200,168,75,0.3);
  position: relative;
  z-index: 10;
}
.btn-story-next:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(91,45,142,0.6);
}
.arrow { font-size: 18px; }
.sand-effect {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  background: linear-gradient(to top, rgba(139,90,43,0.3) 0%, transparent 100%);
  pointer-events: none;
}

/* ===== مشهد إطلاق النار ===== */
.shooting-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}
.shooting-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(13,26,74,0.7) 0%,
    rgba(13,26,74,0.3) 50%,
    rgba(13,26,74,0.7) 100%
  );
}
.shooting-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  z-index: 5;
}
.shooting-hud {
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  background: rgba(13,26,74,0.85);
  border: 1.5px solid rgba(200,168,75,0.5);
  border-radius: 30px;
  padding: 8px 20px;
  z-index: 10;
  backdrop-filter: blur(10px);
}
.ammo-display, .hits-display, .shooting-timer {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 15px;
  font-weight: 700;
  color: var(--moe-gold);
}
.ammo-icon, .hits-icon { font-size: 18px; }
.shooting-title {
  position: absolute;
  top: 60px; left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  font-weight: 800;
  color: var(--moe-gold);
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  z-index: 10;
  white-space: nowrap;
  background: rgba(13,26,74,0.7);
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid rgba(200,168,75,0.3);
}
.crosshair {
  position: absolute;
  width: 40px; height: 40px;
  pointer-events: none;
  z-index: 15;
  transform: translate(-50%, -50%);
}
.crosshair::before, .crosshair::after {
  content: '';
  position: absolute;
  background: rgba(255,215,0,0.8);
}
.crosshair::before {
  width: 2px; height: 100%;
  left: 50%; top: 0;
  transform: translateX(-50%);
}
.crosshair::after {
  height: 2px; width: 100%;
  top: 50%; left: 0;
  transform: translateY(-50%);
}
.muzzle-flash {
  position: absolute;
  bottom: 20%; left: 50%;
  transform: translateX(-50%) scale(0);
  font-size: 40px;
  z-index: 20;
  pointer-events: none;
  transition: all 0.1s ease;
  opacity: 0;
}
.shooting-result-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  backdrop-filter: blur(5px);
}
.shooting-result-box {
  background: var(--gradient-card);
  border: 2px solid rgba(200,168,75,0.5);
  border-radius: 20px;
  padding: 28px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-card);
}
.shooting-result-box.success { border-color: rgba(34,197,94,0.6); }
.shooting-result-box.fail { border-color: rgba(239,68,68,0.4); }
.result-icon { font-size: 52px; margin-bottom: 10px; }
.shooting-result-box h3 {
  font-size: 20px;
  font-weight: 800;
  color: var(--moe-gold);
  margin-bottom: 16px;
}
.shooting-stats {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}
.ss-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.1);
}
.ss-icon { font-size: 20px; }
.ss-label { font-size: 11px; color: rgba(255,255,255,0.6); }
.ss-value { font-size: 18px; font-weight: 800; color: var(--moe-gold); }
.shooting-msg {
  font-size: 14px;
  color: rgba(255,255,255,0.8);
  line-height: 1.6;
  margin-bottom: 18px;
  font-style: italic;
}
.btn-continue-quiz {
  padding: 13px 24px;
  background: var(--gradient-btn);
  border: 1.5px solid var(--moe-gold);
  border-radius: 10px;
  color: white;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.3s;
  width: 100%;
}
.btn-continue-quiz:hover { transform: translateY(-2px); }

/* ===== مشهد الأسئلة ===== */
.quiz-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  filter: brightness(0.55) blur(1px);
}
.quiz-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(13,26,74,0.75) 0%, rgba(91,45,142,0.7) 100%);
}
.quiz-container {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  z-index: 5;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-top: max(10px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  gap: 8px;
}
.quiz-character-mini {
  display: none;
}
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 560px;
  margin-bottom: 8px;
  margin-top: 8px;
  flex-shrink: 0;
}
.quiz-progress {
  font-size: 15px;
  font-weight: 700;
  color: var(--moe-gold);
  background: rgba(200,168,75,0.15);
  border: 1px solid rgba(200,168,75,0.4);
  border-radius: 20px;
  padding: 5px 14px;
}
.quiz-attempts-display {
  display: flex;
  gap: 6px;
  align-items: center;
}
.attempt-dot {
  font-size: 20px;
  color: var(--moe-green);
  transition: color 0.3s;
}
.attempt-dot.used { color: var(--moe-red); }
.quiz-score-mini {
  font-size: 15px;
  font-weight: 700;
  color: var(--moe-gold);
}
.question-card {
  background: rgba(13,26,74,0.92);
  border: 1.5px solid rgba(200,168,75,0.4);
  border-radius: 18px;
  padding: 16px;
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
  height: auto !important;
  min-height: 0 !important;
}
.question-points {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--moe-gold);
  background: rgba(200,168,75,0.15);
  border: 1px solid rgba(200,168,75,0.3);
  border-radius: 20px;
  padding: 3px 12px;
  margin-bottom: 10px;
}
.question-text {
  font-size: clamp(14px, 3vw, 16px);
  font-weight: 700;
  color: white;
  line-height: 1.5;
  margin-bottom: 10px;
  text-align: center;
}
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.option-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.07);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  color: rgba(255,255,255,0.9);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: right;
  line-height: 1.4;
  width: 100%;
  min-height: 44px;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  box-sizing: border-box;
}
.option-btn:hover:not(:disabled) {
  background: rgba(91,45,142,0.4);
  border-color: var(--moe-accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(91,45,142,0.3);
}
.option-btn.correct {
  background: rgba(34,197,94,0.25) !important;
  border-color: var(--moe-green) !important;
  color: #86EFAC !important;
  animation: correctPulse 0.5s ease;
}
.option-btn.wrong {
  background: rgba(239,68,68,0.2) !important;
  border-color: var(--moe-red) !important;
  color: #FCA5A5 !important;
  animation: wrongShake 0.4s ease;
}
.option-btn:disabled { cursor: not-allowed; opacity: 0.7; }
.option-btn:focus { outline: none; box-shadow: none; }
.option-btn:focus-visible { outline: none; box-shadow: none; }
.option-btn:active:not(:disabled) { transform: scale(0.98); }
.opt-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  min-width: 28px;
  background: rgba(200,168,75,0.2);
  border: 1px solid rgba(200,168,75,0.4);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  color: var(--moe-gold);
  flex-shrink: 0;
}
.opt-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  text-align: right;
}
.hint-area {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(200,168,75,0.1);
  border: 1px solid rgba(200,168,75,0.3);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
}
.hint-icon { font-size: 18px; flex-shrink: 0; }
.hint-area span:last-child {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  line-height: 1.5;
}
.advisor-message {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(91,45,142,0.2);
  border: 1px solid rgba(91,45,142,0.4);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
}
.advisor-icon { font-size: 22px; flex-shrink: 0; }
.advisor-message span:last-child {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  line-height: 1.5;
}
.btn-hint {
  padding: 9px 16px;
  background: rgba(200,168,75,0.12);
  border: 1px solid rgba(200,168,75,0.35);
  border-radius: 8px;
  color: var(--moe-gold);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-hint:hover { background: rgba(200,168,75,0.25); }
.quiz-encouragement {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  min-height: 24px;
  margin-top: 8px;
  transition: all 0.3s;
}

/* ===== مشهد رؤية 2030 ===== */
.vision-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.35) blur(3px);
}
.vision-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(13,26,74,0.92) 0%, rgba(91,45,142,0.88) 100%);
}
.vision-container {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  z-index: 5;
  overflow-y: auto;
}
.vision-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.vision-moe-logo {
  width: 40px; height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}
.vision-title {
  font-size: clamp(18px, 4vw, 24px);
  font-weight: 900;
  color: var(--moe-gold);
  flex: 1;
}
.vision-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 12px;
}
.vision-budget {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(200,168,75,0.15);
  border: 1px solid rgba(200,168,75,0.4);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--moe-gold);
  white-space: nowrap;
}
.budget-value { font-size: 18px; font-weight: 900; }
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  flex: 1;
  overflow-y: auto;
  padding-bottom: 10px;
}
.project-card {
  background: rgba(27,42,107,0.7);
  border: 1.5px solid rgba(200,168,75,0.25);
  border-radius: 14px;
  padding: 14px 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  backdrop-filter: blur(5px);
  position: relative;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: auto;
}
.project-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(91,45,142,0.1) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 0;
}
.project-card:hover:not(.built):not(.cant-afford) {
  transform: translateY(-4px);
  border-color: var(--moe-gold);
  box-shadow: 0 8px 25px rgba(91,45,142,0.4);
}
.project-card:hover::before { opacity: 1; }
.project-card.built {
  border-color: rgba(34,197,94,0.5);
  background: rgba(34,197,94,0.1);
  cursor: default;
}
.project-card.cant-afford {
  opacity: 0.5;
  cursor: not-allowed;
}
.project-icon { font-size: 30px; margin-bottom: 6px; position: relative; z-index: 1; }
.project-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--moe-gold);
  margin-bottom: 4px;
  position: relative;
  z-index: 1;
  width: 100%;
  text-align: center;
}
.project-desc {
  font-size: 11px;
  color: rgba(255,255,255,0.65);
  line-height: 1.4;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
  width: 100%;
  text-align: center;
}
.project-cost {
  font-size: 12px;
  font-weight: 700;
  color: var(--moe-light-gold);
  position: relative;
  z-index: 1;
  background: rgba(200,168,75,0.1);
  border-radius: 6px;
  padding: 3px 8px;
}
.btn-vision-continue {
  display: block;
  margin: 12px auto 0;
  padding: 13px 30px;
  background: var(--gradient-btn);
  border: 1.5px solid var(--moe-gold);
  border-radius: 12px;
  color: white;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: var(--shadow-btn);
}
.btn-vision-continue:hover { transform: translateY(-2px); }

/* ===== نافذة تفاصيل المشروع ===== */
.project-modal {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0,0,0,0.85) !important;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999 !important;
  padding: 16px;
}
.project-modal-content {
  background: var(--gradient-card);
  border: 2px solid rgba(200,168,75,0.5);
  border-radius: 20px;
  padding: 24px;
  width: min(480px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-card);
  position: relative;
}
.project-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(200,168,75,0.2);
}
.pm-icon { font-size: 40px; }
.project-modal-header h3 {
  font-size: 22px;
  font-weight: 800;
  color: var(--moe-gold);
}
.pm-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.pm-info-item {
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.08);
}
.pm-label {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 3px;
}
.pm-info-item span:last-child {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
}
.pm-description {
  font-size: 14px;
  color: rgba(255,255,255,0.8);
  line-height: 1.6;
  margin-bottom: 16px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.06);
}
.pm-cost {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--moe-gold);
  background: rgba(200,168,75,0.1);
  border: 1px solid rgba(200,168,75,0.3);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 16px;
}
.cost-value { font-size: 22px; font-weight: 900; }
.pm-actions {
  display: flex;
  gap: 10px;
}
.btn-build {
  flex: 1;
  padding: 13px;
  background: var(--gradient-btn);
  border: 1.5px solid var(--moe-gold);
  border-radius: 10px;
  color: white;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.3s;
}
.btn-build:hover:not(:disabled) { transform: translateY(-2px); }
.btn-build:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-cancel {
  padding: 13px 20px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-cancel:hover { background: rgba(255,255,255,0.15); }

/* ===== شاشة إكمال المرحلة ===== */
#stage-complete-screen {
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
}
.stage-complete-box {
  max-width: 420px;
  text-align: center;
}
.stage-complete-header { margin-bottom: 18px; }
.complete-icon { font-size: 52px; margin-bottom: 8px; }
.complete-title {
  font-size: 28px;
  font-weight: 900;
  color: var(--moe-gold);
  margin-bottom: 4px;
}
.complete-subtitle {
  font-size: 15px;
  color: rgba(255,255,255,0.75);
}
.stage-stats {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}
.stage-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,0.1);
  min-width: 80px;
}
.ss-icon { font-size: 22px; }
.ss-label { font-size: 11px; color: rgba(255,255,255,0.6); }
.ss-value { font-size: 20px; font-weight: 800; color: var(--moe-gold); }
.encouragement-banner {
  background: rgba(200,168,75,0.1);
  border: 1px solid rgba(200,168,75,0.3);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  line-height: 1.5;
  margin-bottom: 18px;
  min-height: 44px;
}
.stage-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===== شاشة الإيقاف المؤقت ===== */
#pause-screen {
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(10px);
}
.pause-stats {
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pause-stats p {
  font-size: 15px;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 8px 14px;
}
.pause-stats strong { color: var(--moe-gold); }
.pause-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===== بطاقة الفخر الوطنية ===== */
#pride-card-screen {
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(10px);
}
.pride-card-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 20px;
  overflow-y: auto;
  width: 100%;
  max-width: 480px;
}
.pride-card {
  background: linear-gradient(145deg, var(--moe-dark-navy) 0%, var(--moe-navy) 50%, var(--moe-purple) 100%);
  border: 3px solid var(--moe-gold);
  border-radius: 20px;
  overflow: hidden;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5), 0 0 30px rgba(200,168,75,0.2);
  position: relative;
}
.pride-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 20px,
    rgba(255,255,255,0.01) 20px,
    rgba(255,255,255,0.01) 40px
  );
  pointer-events: none;
}
.pc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(13,26,74,0.9) 0%, rgba(91,45,142,0.8) 100%);
  border-bottom: 2px solid rgba(200,168,75,0.4);
}
.pc-moe-logo {
  width: 50px; height: 50px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(200,168,75,0.5));
}
.pc-header-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.pc-ministry {
  font-size: 16px;
  font-weight: 800;
  color: var(--moe-gold);
}
.pc-kingdom {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
}
.pc-vision-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--moe-gold);
  background: rgba(200,168,75,0.15);
  border: 1px solid rgba(200,168,75,0.4);
  border-radius: 20px;
  padding: 4px 12px;
}
.pc-body {
  padding: 24px 20px;
  text-align: center;
}
.pc-avatar {
  font-size: 48px;
  margin-bottom: 12px;
  animation: medalGlow 2s ease-in-out infinite;
}
@keyframes medalGlow {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(200,168,75,0.4)); }
  50% { filter: drop-shadow(0 0 20px rgba(200,168,75,0.8)); }
}
.pc-name {
  font-size: 24px;
  font-weight: 900;
  color: var(--moe-gold);
  margin-bottom: 6px;
}
.pc-school {
  font-size: 14px;
  color: rgba(255,255,255,0.8);
  margin-bottom: 3px;
}
.pc-grade {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 14px;
}
.pc-title-badge {
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  color: white;
  background: var(--gradient-btn);
  border: 1px solid rgba(200,168,75,0.5);
  border-radius: 20px;
  padding: 6px 18px;
  margin-bottom: 18px;
}
.pc-stats-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}
.pc-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,0.1);
  min-width: 80px;
}
.pc-stat-val {
  font-size: 22px;
  font-weight: 900;
  color: var(--moe-gold);
}
.pc-stat-lbl {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
}
.pc-era-completed {
  font-size: 15px;
  font-weight: 700;
  color: var(--moe-accent);
  background: rgba(139,92,246,0.15);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 10px;
  padding: 8px 16px;
}
.pc-footer {
  padding: 14px 20px;
  background: rgba(13,26,74,0.6);
  border-top: 1px solid rgba(200,168,75,0.2);
  text-align: center;
}
.pc-decoration { font-size: 20px; margin-bottom: 6px; }
.pc-quote {
  font-size: 13px;
  font-style: italic;
  color: rgba(255,255,255,0.7);
}
.pride-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: 100%;
}
.btn-share-snap, .btn-share-whatsapp, .btn-share-download {
  flex: 1;
  min-width: 120px;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.3s;
  border: 1.5px solid;
}
.btn-share-snap {
  background: rgba(255,252,0,0.1);
  border-color: rgba(255,252,0,0.4);
  color: #FFFC00;
}
.btn-share-whatsapp {
  background: rgba(37,211,102,0.1);
  border-color: rgba(37,211,102,0.4);
  color: #25D366;
}
.btn-share-download {
  background: rgba(14,165,233,0.1);
  border-color: rgba(14,165,233,0.4);
  color: var(--moe-teal);
}
.btn-share-snap:hover, .btn-share-whatsapp:hover, .btn-share-download:hover {
  transform: translateY(-2px);
}

/* ===== شاشة الفوز ===== */
#victory-screen {
  background: var(--gradient-main);
}
.victory-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.fireworks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.victory-content {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 30px 20px;
  text-align: center;
  max-width: 500px;
  width: 100%;
}
.victory-moe img { filter: drop-shadow(0 0 15px rgba(200,168,75,0.6)); }
.victory-emblem { font-size: 60px; animation: medalGlow 2s ease-in-out infinite; }
.victory-title {
  font-size: clamp(22px, 5vw, 32px);
  font-weight: 900;
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.victory-subtitle {
  font-size: 15px;
  color: rgba(255,255,255,0.75);
}
.victory-stats {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.vs-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 14px 18px;
  border: 1px solid rgba(200,168,75,0.25);
  min-width: 100px;
}
.vs-icon { font-size: 24px; }
.vs-label { font-size: 11px; color: rgba(255,255,255,0.6); }
.vs-value { font-size: 24px; font-weight: 900; color: var(--moe-gold); }
.victory-medal {
  background: var(--gradient-card);
  border: 2px solid var(--moe-gold);
  border-radius: 16px;
  padding: 16px 24px;
  text-align: center;
}
.medal-icon { font-size: 48px; }
.medal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--moe-gold);
  margin-top: 8px;
}
.victory-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* ===== الإشعارات ===== */
.notification-container {
  position: fixed;
  top: 70px; left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: min(400px, 90vw);
}
.notification {
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  animation: slideDown 0.3s ease, fadeOut 0.5s ease 2.5s forwards;
  backdrop-filter: blur(10px);
}
.notification.success {
  background: rgba(34,197,94,0.2);
  border: 1px solid rgba(34,197,94,0.5);
  color: #86EFAC;
}
.notification.error {
  background: rgba(239,68,68,0.2);
  border: 1px solid rgba(239,68,68,0.5);
  color: #FCA5A5;
}
.notification.warning {
  background: rgba(249,115,22,0.2);
  border: 1px solid rgba(249,115,22,0.5);
  color: #FED7AA;
}
.notification.info {
  background: rgba(14,165,233,0.2);
  border: 1px solid rgba(14,165,233,0.5);
  color: #BAE6FD;
}
@keyframes slideDown {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ===== الألعاب النارية ===== */
.fireworks-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
}
.firework-particle {
  position: fixed;
  border-radius: 50%;
  animation: fireworkExplode 1s ease-out forwards;
}
@keyframes fireworkExplode {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

/* ===== تأثير الإجابة ===== */
.answer-effect {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 900;
  opacity: 0;
  transition: opacity 0.3s;
}

/* ===== الرسوم المتحركة ===== */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
@keyframes correctPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); box-shadow: 0 0 20px rgba(34,197,94,0.5); }
  100% { transform: scale(1); }
}
@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}
.shake { animation: shake 0.5s ease; }
@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fade-in 0.4s ease; }
@keyframes slide-in {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}
.slide-in { animation: slide-in 0.4s ease; }
@keyframes floatUp {
  0% { transform: translateX(-50%) translateY(0); opacity: 1; }
  100% { transform: translateX(-50%) translateY(-80px); opacity: 0; }
}
@keyframes smokeRise {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0.7; }
  100% { transform: translate(-50%, -100%) scale(2); opacity: 0; }
}
@keyframes streakPop {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  50% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* ===== تمرير مخصص ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 3px; }
::-webkit-scrollbar-thumb { background: rgba(200,168,75,0.4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(200,168,75,0.7); }

/* ===== استجابة الشاشات الصغيرة ===== */
@media (max-width: 480px) {
  .options-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .option-btn {
    font-size: 13px;
    padding: 10px 12px;
    min-height: 48px;
    width: 100%;
  }
  .opt-text {
    font-size: 13px;
    line-height: 1.5;
  }
  .question-card {
    padding: 14px 12px;
  }
  .question-text {
    font-size: 14px;
  }
  .projects-grid { 
    grid-template-columns: repeat(2, 1fr); 
    gap: 8px;
  }
  .project-card {
    padding: 10px 8px;
    min-height: 130px;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow: visible;
  }
  .project-icon { font-size: 24px; margin-bottom: 4px; flex-shrink: 0; }
  .project-name {
    font-size: 11px;
    font-weight: 700;
    color: var(--moe-gold);
    margin-bottom: 3px;
    text-align: center;
    line-height: 1.3;
    word-break: break-word;
    white-space: normal;
    display: block;
    width: 100%;
  }
  .project-desc {
    font-size: 9px;
    color: rgba(255,255,255,0.65);
    line-height: 1.3;
    margin-bottom: 4px;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    width: 100%;
  }
  .project-cost {
    font-size: 10px;
    padding: 2px 6px;
    white-space: nowrap;
  }
  .stage-stats, .shooting-stats { flex-wrap: wrap; }
  .pc-stats-row { gap: 8px; }
  .pc-stat { min-width: 70px; padding: 10px 12px; }
  .quiz-container { padding: 8px 10px; }
  .quiz-header { margin-bottom: 6px; }
}
@media (max-height: 600px) {
  .story-panel { padding: 12px 16px 16px; }
  .story-text { max-height: 80px; }
  .quiz-container { padding: 6px 10px; }
  .question-card { padding: 14px; }
}

/* ===== إصلاح شاشة الجوال iOS ===== */
@supports (-webkit-touch-callout: none) {
  html, body {
    height: -webkit-fill-available;
  }
  .screen {
    height: -webkit-fill-available;
  }
  #loading-screen {
    height: -webkit-fill-available !important;
  }
  /* story-panel على iOS - نسبي داخل flex لضمان ظهوره كاملاً */
  .story-panel {
    position: relative !important;
    padding-bottom: max(20px, env(safe-area-inset-bottom, 16px)) !important;
    z-index: 10 !important;
    background: linear-gradient(to top, rgba(10,20,60,0.97) 0%, rgba(10,20,60,0.85) 60%, rgba(10,20,60,0.3) 100%) !important;
  }
  .btn-story-next {
    min-height: 50px;
    font-size: 16px;
  }
}

/* ===== لعبة الصيد بين المراحل ===== */
/* ===== شاشة المعركة التاريخية ===== */
#hunting-game-screen {
  background: linear-gradient(180deg, #1a0a00 0%, #2d1200 50%, #0d1a4a 100%);
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
}
.battle-bg {
  position: absolute;
  inset: 0;
  background-image: url('assets/battle_scene_bg.webp');
  background-size: cover;
  background-position: center bottom;
  opacity: 0.65;
  z-index: 0;
}
.battle-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(10,5,0,0.85) 0%,
    rgba(20,10,5,0.5) 50%,
    rgba(10,5,0,0.3) 100%
  );
  z-index: 1;
}

.battle-mission-bar {
  display:flex;
  align-items:center;
  gap:12px;
  justify-content:center;
  flex-wrap:wrap;
  margin:10px auto 6px;
  max-width:1000px;
}
.battle-mode-chip {
  padding:8px 14px;
  border-radius:999px;
  background:linear-gradient(135deg, rgba(180,120,20,0.95), rgba(102,62,8,0.95));
  color:#fff6d6;
  font-weight:900;
  box-shadow:0 10px 25px rgba(0,0,0,0.18);
}
.battle-objective, .battle-progress, .battle-event-strip {
  background:rgba(255,255,255,0.10);
  border:1px solid rgba(255,255,255,0.16);
  color:#f6efe2;
  border-radius:16px;
  padding:8px 14px;
  backdrop-filter: blur(8px);
}
.battle-progress { font-weight:800; color:#ffe29c; }
.battle-event-strip {
  max-width:900px;
  margin:0 auto 8px;
  text-align:center;
  color:#fff4cf;
  box-shadow:0 10px 24px rgba(0,0,0,0.16);
}
.special-stat {
  min-width: 120px;
}
#hunting-game-screen.mode-defend .battle-mode-chip {
  background:linear-gradient(135deg, rgba(40,90,140,0.95), rgba(18,56,94,0.95));
}
#hunting-game-screen.mode-flag .battle-mode-chip {
  background:linear-gradient(135deg, rgba(14,115,87,0.95), rgba(8,74,56,0.95));
}
#hunting-game-screen.mode-intercept .battle-mode-chip,
#hunting-game-screen.mode-pursuit .battle-mode-chip {
  background:linear-gradient(135deg, rgba(136,47,17,0.95), rgba(95,24,7,0.95));
}
#hunting-game-screen.mode-survive .battle-mode-chip {
  background:linear-gradient(135deg, rgba(103,58,183,0.95), rgba(61,35,103,0.95));
}
#hunting-game-screen.mode-defend .battle-overlay { background: linear-gradient(180deg, rgba(5,20,40,0.2), rgba(3,8,16,0.65)); }
#hunting-game-screen.mode-flag .battle-overlay { background: linear-gradient(180deg, rgba(0,80,50,0.15), rgba(5,26,18,0.6)); }
#hunting-game-screen.mode-intercept .battle-overlay,
#hunting-game-screen.mode-pursuit .battle-overlay { background: linear-gradient(180deg, rgba(80,20,0,0.10), rgba(30,6,0,0.62)); }
@media (max-width: 900px) {
  .battle-mission-bar { gap:8px; }
  .battle-objective, .battle-progress, .battle-event-strip { font-size:13px; }
}


.battle-briefing {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: radial-gradient(circle at center, rgba(9,16,24,0.45), rgba(4,7,10,0.86));
  backdrop-filter: blur(6px);
}
.battle-briefing.show { display:flex; }
.battle-brief-card {
  width: min(900px, 96vw);
  background: linear-gradient(180deg, rgba(15,18,24,0.95), rgba(8,10,15,0.94));
  border: 1px solid rgba(200,168,75,0.35);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  padding: 14px;
  color: #fff;
  max-height: 90dvh;
  overflow-y: auto;
}
.battle-brief-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(200,168,75,0.12);
  border: 1px solid rgba(200,168,75,0.35);
  color: var(--moe-gold);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 700;
  margin-bottom: 10px;
}
#battle-brief-title { margin: 0 0 6px; font-size: clamp(22px, 4vw, 34px); color: #fff; }
#battle-brief-text { margin: 0 0 16px; color: rgba(255,255,255,0.82); font-size: 15px; }
.battle-tactics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 14px;
}
.battle-tactic {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.battle-tactic:hover { transform: translateY(-2px); border-color: rgba(200,168,75,0.45); }
.battle-tactic.selected {
  border-color: rgba(200,168,75,0.8);
  box-shadow: 0 0 0 2px rgba(200,168,75,0.18), 0 14px 30px rgba(0,0,0,0.28);
  background: linear-gradient(180deg, rgba(200,168,75,0.12), rgba(255,255,255,0.04));
}
.battle-tactic-top { display:flex; align-items:center; justify-content:space-between; gap:6px; margin-bottom:6px; }
.battle-tactic-icon { font-size: 22px; }
.battle-tactic-name { font-size: 15px; font-weight: 800; }
.battle-tactic-tag {
  font-size: 10px; padding: 3px 7px; border-radius: 999px;
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.82);
}
.battle-tactic-desc { font-size: 12px; color: rgba(255,255,255,0.82); min-height: 0; }
.battle-tactic-bonus { margin-top: 6px; font-size: 11px; color: var(--moe-gold); font-weight: 700; }
.battle-brief-actions { display:flex; justify-content:flex-end; margin-top: 10px; }
.battle-path-chip {
  position: absolute; left: 16px; bottom: 16px; z-index: 18;
  background: rgba(5,8,12,0.72); color: #fff; border: 1px solid rgba(200,168,75,0.45);
  border-radius: 999px; padding: 8px 12px; font-size: 13px; font-weight: 700; backdrop-filter: blur(4px);
}
@media (max-width: 900px) {
  .battle-tactics { grid-template-columns: 1fr; gap: 8px; }
  .battle-brief-card { padding: 12px; }
  .battle-path-chip { left: 10px; bottom: 70px; font-size: 12px; }
  #battle-brief-title { font-size: 18px; margin-bottom: 4px; }
  #battle-brief-text { font-size: 13px; margin-bottom: 10px; }
  .battle-tactic { padding: 8px 10px; }
  .battle-tactic-icon { font-size: 18px; }
  .battle-tactic-name { font-size: 13px; }
  .battle-tactic-desc { font-size: 11px; }
  .battle-tactic-bonus { font-size: 10px; margin-top: 4px; }
  .battle-brief-kicker { padding: 4px 10px; font-size: 12px; margin-bottom: 8px; }
}

/* رأس شاشة المعركة */
.battle-header {
  position: relative;
  z-index: 10;
  width: 100%;
  padding: 10px 16px 8px;
  background: linear-gradient(to bottom, rgba(10,5,0,0.92) 0%, transparent 100%);
}
.battle-context {
  font-size: clamp(12px, 3.5vw, 16px);
  font-weight: 700;
  color: var(--moe-gold);
  text-align: center;
  margin-bottom: 8px;
  text-shadow: 0 0 10px rgba(200,168,75,0.5);
  border-bottom: 1px solid rgba(200,168,75,0.3);
  padding-bottom: 6px;
}
.battle-stats-row {
  display: flex;
  justify-content: center;
  gap: 12px;
}
.battle-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(200,168,75,0.4);
  border-radius: 10px;
  padding: 5px 14px;
  min-width: 65px;
  backdrop-filter: blur(5px);
}
.timer-stat .bs-val { color: #FF6B35; }
.bs-icon { font-size: 14px; }
.bs-val {
  font-size: 22px;
  font-weight: 900;
  color: var(--moe-gold);
  line-height: 1;
}
.bs-lbl {
  font-size: 10px;
  color: rgba(255,255,255,0.6);
}
/* ميدان المعركة */
.battle-arena {
  position: relative;
  z-index: 5;
  flex: 1;
  width: 100%;
  overflow: hidden;
}
#hunting-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}
/* وميض فوهة البندقية */
.gun-flash {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,220,100,1) 0%, rgba(255,150,0,0.8) 30%, rgba(255,80,0,0.4) 60%, transparent 80%);
  pointer-events: none;
  z-index: 20;
  opacity: 0;
  transition: opacity 0.05s, transform 0.05s;
}
.gun-flash.active {
  opacity: 1;
  transform: translateX(-50%) scale(1.5);
}
/* شبكة التصويب */
.battle-crosshair {
  position: absolute;
  width: 40px;
  height: 40px;
  pointer-events: none;
  z-index: 15;
  display: none;
  transform: translate(-50%, -50%);
}
.battle-crosshair::before,
.battle-crosshair::after {
  content: '';
  position: absolute;
  background: rgba(255,200,0,0.8);
  border-radius: 2px;
}
.battle-crosshair::before {
  width: 2px;
  height: 100%;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}
.battle-crosshair::after {
  width: 100%;
  height: 2px;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}
/* شريط الذخيرة */
.battle-footer {
  position: relative;
  z-index: 10;
  padding: 8px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to top, rgba(10,5,0,0.92) 0%, transparent 100%);
  gap: 12px;
}
.ammo-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.ammo-icon { font-size: 20px; }
.ammo-bullets {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.ammo-bullet {
  width: 8px;
  height: 20px;
  background: var(--moe-gold);
  border-radius: 3px 3px 1px 1px;
  transition: all 0.2s;
  box-shadow: 0 0 6px rgba(200,168,75,0.5);
}
.ammo-bullet.spent {
  background: rgba(100,80,40,0.4);
  box-shadow: none;
}
.btn-skip-battle {
  padding: 8px 16px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(200,168,75,0.3);
  border-radius: 8px;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  font-family: var(--font-main);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
/* رسالة الإصابة */
.hunt-hit-msg {
  position: fixed;
  font-size: 22px;
  font-weight: 900;
  color: #FFD700;
  pointer-events: none;
  z-index: 9999;
  text-shadow: 0 0 12px rgba(255,215,0,0.9), 0 2px 4px rgba(0,0,0,0.8);
  animation: huntHitAnim 0.9s ease-out forwards;
  transform: translateX(-50%);
}
@keyframes huntHitAnim {
  0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.3); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-60px) scale(0.8); }
}
#hunting-result-screen {
  background: var(--gradient-main);
}

/* ===== شاشة نقطة التوقف الاحترافية ===== */
#checkpoint-screen {
  background: var(--gradient-main);
}
.checkpoint-overlay {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 0;
}
.checkpoint-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.3) blur(3px);
  z-index: 0;
}
.checkpoint-particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.checkpoint-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 24px;
  max-width: 480px;
  width: 100%;
  gap: 12px;
}
.checkpoint-moe {
  margin-bottom: 4px;
}
.checkpoint-moe-logo {
  height: 36px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}
.checkpoint-medal {
  font-size: 72px;
  animation: medalPulse 1.5s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(200,168,75,0.8));
}
@keyframes medalPulse {
  0%, 100% { transform: scale(1) rotate(-5deg); }
  50% { transform: scale(1.1) rotate(5deg); }
}
.checkpoint-era {
  background: linear-gradient(135deg, var(--moe-gold), #FFE066);
  color: var(--moe-dark);
  font-size: 13px;
  font-weight: 800;
  padding: 6px 18px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}
.checkpoint-title {
  font-size: 26px;
  font-weight: 900;
  color: white;
  text-shadow: 0 2px 12px rgba(0,0,0,0.6);
  margin: 0;
  line-height: 1.3;
}
.checkpoint-message {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(200,168,75,0.3);
  border-radius: 14px;
  padding: 14px 18px;
  color: rgba(255,255,255,0.9);
  font-size: 15px;
  line-height: 1.7;
}
.checkpoint-message strong {
  color: var(--moe-gold);
  font-size: 18px;
}
.checkpoint-stats {
  display: flex;
  gap: 16px;
  justify-content: center;
  width: 100%;
}
.cp-stat {
  flex: 1;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(200,168,75,0.25);
  border-radius: 14px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.cp-stat-icon { font-size: 22px; }
.cp-stat-val {
  font-size: 22px;
  font-weight: 900;
  color: var(--moe-gold);
}
.cp-stat-lbl {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  font-weight: 600;
}
.checkpoint-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}
.btn-checkpoint-continue, .btn-checkpoint-save {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  text-align: right;
  transition: all 0.3s ease;
  width: 100%;
}
.btn-checkpoint-continue {
  background: linear-gradient(135deg, var(--moe-gold), #B8860B);
  color: var(--moe-dark);
  box-shadow: 0 6px 20px rgba(200,168,75,0.4);
}
.btn-checkpoint-continue:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(200,168,75,0.6);
}
.btn-checkpoint-save {
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.3);
  color: white;
}
.btn-checkpoint-save:hover {
  background: rgba(255,255,255,0.18);
  transform: translateY(-2px);
}
.cpb-icon {
  font-size: 28px;
  flex-shrink: 0;
}
.cpb-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cpb-title {
  font-size: 17px;
  font-weight: 800;
  display: block;
}
.cpb-sub {
  font-size: 12px;
  opacity: 0.75;
  display: block;
}
.cpb-arrow {
  font-size: 20px;
  flex-shrink: 0;
}
.btn-checkpoint-share {
  background: transparent;
  border: 1.5px solid rgba(200,168,75,0.5);
  color: var(--moe-gold);
  font-family: 'Tajawal', sans-serif;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 24px;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.btn-checkpoint-share:hover {
  background: rgba(200,168,75,0.15);
  border-color: var(--moe-gold);
}

/* جسيمات متحركة للخلفية */
.cp-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--moe-gold);
  opacity: 0;
  animation: cpParticle var(--dur, 3s) var(--delay, 0s) ease-in-out infinite;
}
@keyframes cpParticle {
  0% { opacity: 0; transform: translateY(100vh) scale(0); }
  20% { opacity: 0.8; }
  80% { opacity: 0.4; }
  100% { opacity: 0; transform: translateY(-20vh) scale(1.5); }
}

/* ===== تحسين لعبة مشاريع الرؤية ===== */
.vision-project-built-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--moe-green);
  color: white;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
}
.project-card {
  position: relative;
  transition: all 0.3s ease;
}
.project-card.built {
  border-color: var(--moe-green) !important;
  box-shadow: 0 0 20px rgba(34,197,94,0.3) !important;
}
.project-card.built::after {
  content: '✓ مكتمل';
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--moe-green);
  color: white;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
}

/* ===== لعبة التركيب (Lego) ===== */
#lego-game-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.lego-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.3) blur(2px);
}
.lego-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10,20,60,0.85) 0%, rgba(5,10,30,0.95) 100%);
}
.lego-container {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px 12px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}
.lego-header {
  background: rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 8px;
  border: 1px solid rgba(255,255,255,0.15);
}
.lego-title {
  font-size: 16px;
  font-weight: 900;
  color: var(--moe-gold);
  text-align: center;
  margin-bottom: 6px;
}
.lego-stats-row {
  display: flex;
  justify-content: space-around;
  gap: 8px;
}
.lego-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: rgba(255,255,255,0.9);
  font-weight: 700;
}
.lego-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  text-align: center;
  margin-bottom: 8px;
}
.lego-play-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  overflow: auto;
}
.lego-target-zone, .lego-pieces-zone {
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  padding: 10px;
}
.lego-target-label, .lego-pieces-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--moe-gold);
  text-align: center;
  margin-bottom: 8px;
}
.lego-target-grid, .lego-pieces-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.lego-target-slot {
  width: 52px;
  height: 52px;
  border: 2px dashed rgba(255,255,255,0.3);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255,255,255,0.05);
}
.lego-target-slot.active-target {
  border-color: var(--moe-gold);
  background: rgba(200,168,75,0.15);
  animation: targetPulse 0.8s ease-in-out infinite;
  cursor: pointer;
}
.lego-target-slot.filled {
  border-style: solid;
  border-color: var(--moe-green);
  background: rgba(34,197,94,0.15);
  cursor: default;
}
.lego-target-slot.correct-piece {
  animation: correctPulse 0.5s ease;
}
.lego-target-slot.wrong-piece {
  border-color: var(--moe-red);
  background: rgba(239,68,68,0.2);
  animation: wrongShake 0.4s ease;
}
.lego-piece-btn {
  width: 52px;
  height: 52px;
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  font-size: 26px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lego-piece-btn:hover:not(:disabled) {
  border-color: var(--moe-gold);
  background: rgba(200,168,75,0.2);
  transform: scale(1.1);
}
.lego-piece-btn.selected {
  border-color: var(--moe-gold);
  background: rgba(200,168,75,0.3);
  transform: scale(1.15);
  box-shadow: 0 0 12px rgba(200,168,75,0.5);
}
.lego-piece-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}
@keyframes targetPulse {
  0%, 100% { box-shadow: 0 0 5px rgba(200,168,75,0.3); }
  50% { box-shadow: 0 0 15px rgba(200,168,75,0.7); }
}

/* ===== شعار الوزارة في أعلى الشاشة الرئيسية ===== */
.menu-moe-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 20px;
  background: rgba(255,255,255,0.08);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  width: 100%;
}
.menu-moe-header-logo {
  height: 50px;
  width: auto;
  filter: brightness(1.2);
}
.menu-moe-header-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.menu-moe-country {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
}
.menu-moe-name {
  font-size: 0.95rem;
  color: #fff;
  font-weight: 700;
}
/* إخفاء السيفين والنخلة القديمة */
.title-swords, .saudi-emblem-img {
  display: none !important;
}

/* === تحسينات التطوير v14 === */
.ui-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.ui-modal.show { display: flex !important; }
.ui-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 10, 24, 0.72);
  backdrop-filter: blur(8px);
}
.ui-modal-box {
  position: relative;
  width: min(680px, 94vw);
  max-height: 86vh;
  overflow: auto;
  border-radius: 24px;
  padding: 24px 22px 20px;
  background: linear-gradient(180deg, rgba(18,30,57,0.98), rgba(7,14,30,0.98));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 30px 60px rgba(0,0,0,0.4);
  color: #fff;
}
.ui-modal-icon {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 34px;
  background: radial-gradient(circle at 30% 30%, rgba(255,215,0,0.35), rgba(255,255,255,0.08));
  border: 1px solid rgba(255,255,255,0.12);
}
.ui-modal-title {
  text-align: center;
  font-size: 28px;
  margin: 0 0 12px;
  color: #fff;
}
.ui-modal-body {
  color: rgba(255,255,255,0.88);
  line-height: 1.9;
  font-size: 16px;
}
.ui-modal-body .leaderboard-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.ui-modal-body .leaderboard-item,
.ui-modal-body .choice-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
}
.ui-modal-body .leaderboard-rank {
  min-width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  background: rgba(255,215,0,0.16);
  color: #FFD86B;
}
.ui-modal-body .leaderboard-meta {
  text-align: left;
  white-space: nowrap;
  color: rgba(255,255,255,0.74);
  font-size: 13px;
}
.ui-modal-body .leaderboard-main {
  flex: 1;
}
.ui-modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}
.ui-modal-actions button {
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
}
.ui-btn-primary { background: linear-gradient(135deg, #0ea45e, #18c174); color: white; }
.ui-btn-secondary { background: rgba(255,255,255,0.1); color: white; }
.ui-btn-gold { background: linear-gradient(135deg, #c79a2b, #f0c96d); color: #1f1600; }
.story-quick-fact {
  margin-top: 10px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,215,0,0.10);
  border: 1px solid rgba(255,215,0,0.16);
  color: #FFE08A;
  font-size: 13px;
}
.quiz-slim-note {
  margin-top: 10px;
  font-size: 13px;
  color: rgba(255,255,255,0.74);
}
.stage-complete-box::after,
.ui-modal-box::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}


/* ===== إضافات v15: الرحلة والإنجاز ===== */
.stage-summary-strip{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  width:min(100%,720px);
  margin:14px auto 8px;
}
.summary-pill{
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.14);
  border-radius:16px;
  padding:12px 10px;
  text-align:center;
  box-shadow:0 8px 24px rgba(0,0,0,.18);
}
.summary-pill strong{display:block;font-size:18px;color:#fff;margin-top:4px}
.summary-pill span{font-size:12px;color:rgba(255,255,255,.74)}
.achievement-panel{
  display:flex; flex-wrap:wrap; gap:10px; justify-content:center;
  margin:8px auto 4px; width:min(100%,760px);
}
.achievement-chip{
  background:linear-gradient(135deg, rgba(255,215,0,.15), rgba(255,255,255,.06));
  border:1px solid rgba(255,215,0,.28);
  color:#fff; border-radius:999px; padding:10px 14px; font-size:13px; font-weight:700;
}
.achievement-chip.locked{
  border-color:rgba(255,255,255,.12); color:rgba(255,255,255,.62);
  background:rgba(255,255,255,.05);
}
.journey-map-wrap{display:grid;gap:12px}
.journey-era{background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.1);border-radius:18px;padding:12px}
.journey-era h4{margin-bottom:8px;font-size:16px}
.journey-track{display:flex;flex-wrap:wrap;gap:8px}
.journey-node{min-width:56px;padding:8px 10px;border-radius:14px;text-align:center;font-weight:800;background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.12)}
.journey-node.done{background:rgba(34,197,94,.18);border-color:rgba(34,197,94,.4)}
.journey-node.current{background:rgba(255,215,0,.16);border-color:rgba(255,215,0,.45);box-shadow:0 0 0 2px rgba(255,215,0,.14) inset}
.journey-node.locked{opacity:.55}
.menu-footer{display:flex;justify-content:center;align-items:center;gap:10px;flex-wrap:wrap}
#menu-footer-slogan{display:inline-block}
.menu-micro-badge{padding:6px 10px;border-radius:999px;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12);font-size:12px}
@media (max-width:680px){
  .stage-summary-strip{grid-template-columns:1fr}
}


/* ===== v16 Rewards & Rank ===== */
.reward-spotlight{display:grid;gap:10px;margin:14px 0 8px}
.reward-card{display:flex;align-items:center;gap:12px;background:linear-gradient(135deg, rgba(200,168,75,.18), rgba(255,255,255,.06));border:1px solid rgba(200,168,75,.35);border-radius:18px;padding:12px 14px;box-shadow:0 8px 20px rgba(0,0,0,.18)}
.reward-icon{width:52px;height:52px;border-radius:16px;display:flex;align-items:center;justify-content:center;font-size:28px;background:rgba(255,255,255,.1);flex:0 0 auto}
.reward-copy{display:grid;gap:2px;flex:1}
.reward-title{font-weight:900;font-size:16px;color:#fff}
.reward-desc{font-size:13px;color:rgba(255,255,255,.82);line-height:1.6}
.reward-meta{display:flex;flex-wrap:wrap;gap:8px;margin-top:4px}
.reward-pill{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border-radius:999px;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12);font-size:12px;font-weight:700;color:#F7F1D0}
.rank-ribbon{display:inline-flex;align-items:center;gap:8px;background:rgba(255,215,0,.12);border:1px solid rgba(255,215,0,.28);padding:8px 12px;border-radius:999px;font-weight:800;color:#F7E6A1}
.rank-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:12px}
.rank-box{background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.1);border-radius:16px;padding:12px;text-align:center}
.rank-box strong{display:block;font-size:18px;margin-top:4px;color:#fff}
.surprise-note{font-size:13px;color:rgba(255,255,255,.8);margin-top:6px}
@media (max-width: 700px){.rank-grid{grid-template-columns:1fr}.reward-card{align-items:flex-start}}

.quiz-dynamics{display:grid;gap:10px;margin:10px 0 14px}
.mission-banner,.surprise-banner{display:none;align-items:center;gap:10px;padding:10px 14px;border-radius:16px;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12);box-shadow:0 10px 24px rgba(0,0,0,.14);backdrop-filter:blur(10px)}
.mission-banner.show,.surprise-banner.show{display:flex;animation:fadeSlideIn .45s ease}
.mission-banner{background:linear-gradient(135deg, rgba(37,99,235,.18), rgba(255,255,255,.05));border-color:rgba(96,165,250,.35)}
.surprise-banner{background:linear-gradient(135deg, rgba(234,179,8,.18), rgba(255,255,255,.05));border-color:rgba(250,204,21,.35)}
.dynamic-icon{font-size:24px;line-height:1}
.dynamic-copy{display:flex;flex-direction:column;gap:2px;min-width:0}
.dynamic-title{font-weight:900;color:#fff;font-size:15px}
.dynamic-desc{font-size:13px;color:rgba(255,255,255,.82)}
.dynamic-pill{margin-inline-start:auto;white-space:nowrap;padding:7px 10px;border-radius:999px;background:rgba(255,255,255,.12);font-size:12px;font-weight:800;color:#fff}
.dynamic-pill.done{background:rgba(16,185,129,.18);color:#D1FAE5;border:1px solid rgba(16,185,129,.35)}
.momentum-wrap{display:grid;gap:6px;padding:8px 12px;border-radius:14px;background:rgba(8,18,44,.38);border:1px solid rgba(255,255,255,.08)}
.momentum-label{font-size:12px;font-weight:800;color:rgba(255,255,255,.82)}
.momentum-bar{height:10px;border-radius:999px;background:rgba(255,255,255,.1);overflow:hidden;box-shadow:inset 0 1px 2px rgba(0,0,0,.25)}
.momentum-fill{height:100%;width:0%;border-radius:999px;background:linear-gradient(90deg, #22c55e, #facc15, #f97316);transition:width .35s ease, transform .25s ease}
.momentum-fill.pop{transform:scaleY(1.35)}
.question-card.surprise-glow{box-shadow:0 0 0 1px rgba(250,204,21,.28), 0 18px 45px rgba(250,204,21,.12), 0 20px 45px rgba(0,0,0,.22)}
@keyframes fadeSlideIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
@media (max-width:700px){.dynamic-pill{margin-inline-start:0}.mission-banner,.surprise-banner{align-items:flex-start;flex-wrap:wrap}}


/* ===== هوية اللاعب ===== */
.player-identity-card, .stage-hero-card {
  width: min(92vw, 560px);
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 10px 24px rgba(0,0,0,0.16), inset 0 1px 0 rgba(255,255,255,0.05);
  border-radius: 18px;
  padding: 10px 12px;
  backdrop-filter: blur(8px);
}
.stage-hero-card { margin-top: 10px; margin-bottom: 4px; }
.identity-avatar-wrap, .stage-hero-avatar-wrap {
  position: relative;
  width: 58px; height: 58px;
  flex: 0 0 58px;
  display: grid; place-items: center;
}
.identity-avatar, .stage-hero-avatar {
  position: relative;
  width: 48px; height: 48px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 24px;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.20), rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.03), 0 8px 20px rgba(0,0,0,0.14);
}
.identity-orbit, .stage-hero-aura {
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  border: 1px dashed rgba(255,255,255,0.10);
  animation: spinOrbit 18s linear infinite;
}
.orbit-2 { inset: 9px; animation-duration: 13s; animation-direction: reverse; }
.stage-hero-aura {
  inset: -2px;
  border-style: solid;
  border-color: rgba(255,215,0,0.16);
  box-shadow: 0 0 16px rgba(255,215,0,0.10);
}
.identity-copy, .stage-hero-copy { display:flex; flex-direction:column; gap:3px; min-width:0; flex:1; }
.identity-topline, .stage-hero-top { font-size: 11px; color: rgba(255,255,255,0.56); }
.identity-rank, .stage-hero-rank { font-size: 16px; font-weight: 900; color: #fff; line-height: 1.15; }
.identity-title, .stage-hero-title { font-size: 12px; color: #f6e7ac; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.identity-meta {
  display:flex; flex-wrap:wrap; gap:6px; margin-top:2px;
}
.identity-chip {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color:#fff; border-radius:999px; padding:4px 8px; font-size:11px;
}
@keyframes spinOrbit { from{ transform:rotate(0deg);} to{transform:rotate(360deg);} }

/* ===== صندوق المكافآت ===== */
.chest-box { position: relative; overflow: hidden; text-align:center; min-width:min(92vw,520px); }
.chest-glow {
  position:absolute; inset:auto 50% 18% auto; transform:translateX(50%);
  width:220px; height:220px; border-radius:50%;
  background: radial-gradient(circle, rgba(255,215,0,0.22), transparent 68%);
  filter: blur(8px); pointer-events:none;
}
.chest-wrap { position: relative; display:grid; place-items:center; margin:10px auto 14px; }
.reward-chest {
  width:120px; height:120px; border-radius:28px; display:grid; place-items:center;
  font-size:58px; background: linear-gradient(135deg, rgba(200,168,75,0.24), rgba(255,255,255,0.08));
  border: 1px solid rgba(255,255,255,0.16); box-shadow: 0 18px 44px rgba(0,0,0,0.32);
  animation: chestFloat 2.6s ease-in-out infinite;
}
.reward-chest.opened { animation: chestBurst 0.85s ease both; }
.chest-subtitle { color: rgba(255,255,255,0.72); margin-bottom: 16px; }
.chest-reward-list { display:flex; flex-wrap:wrap; gap:10px; justify-content:center; margin-bottom: 10px; }
.chest-pill {
  background: rgba(255,255,255,0.08);
  border:1px solid rgba(255,255,255,0.12);
  color:#fff; border-radius:999px; padding:10px 14px; font-weight:700; font-size:14px;
}
@keyframes chestFloat { 0%,100%{ transform:translateY(0) scale(1);}50%{transform:translateY(-8px) scale(1.03);} }
@keyframes chestBurst {
  0%{ transform:scale(1) rotate(0deg);} 35%{ transform:scale(1.14) rotate(-8deg);} 60%{ transform:scale(0.96) rotate(8deg);} 100%{ transform:scale(1.08) rotate(0deg);} }

@media (max-width: 680px) {
  .player-identity-card, .stage-hero-card { width: min(94vw, 100%); padding: 9px 10px; gap: 10px; border-radius: 16px; }
  .identity-avatar-wrap, .stage-hero-avatar-wrap { width: 52px; height: 52px; flex-basis: 52px; }
  .identity-avatar, .stage-hero-avatar { width: 42px; height: 42px; font-size: 21px; }
  .identity-topline, .stage-hero-top { font-size: 10px; }
  .identity-rank, .stage-hero-rank { font-size: 14px; }
  .identity-title, .stage-hero-title { font-size: 11px; }
  .identity-chip { font-size: 10px; padding: 4px 7px; }
}


.question-points {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.question-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.14);
  color: #fff;
}
.question-mode-badge.mode-duel { background: rgba(249, 115, 22, 0.18); border-color: rgba(249, 115, 22, 0.35); }
.question-mode-badge.mode-tf { background: rgba(34, 197, 94, 0.18); border-color: rgba(34, 197, 94, 0.35); }
.question-mode-badge.mode-standard { background: rgba(59, 130, 246, 0.18); border-color: rgba(59, 130, 246, 0.35); }
.options-grid.mode-duel { grid-template-columns: 1fr; }
.options-grid.mode-tf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.option-btn-duel {
  min-height: 74px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.18);
}
.option-btn-tf {
  min-height: 88px;
  font-size: 24px;
  font-weight: 900;
}
.option-btn-tf .opt-text { font-size: 24px; }
@media (max-width: 700px) {
  .options-grid.mode-tf { grid-template-columns: 1fr; }
}

.question-mode-badge.mode-sequence { background: rgba(14, 165, 233, 0.18); border-color: rgba(14, 165, 233, 0.35); }
.question-mode-badge.mode-match { background: rgba(168, 85, 247, 0.18); border-color: rgba(168, 85, 247, 0.35); }
.options-grid.mode-sequence,
.options-grid.mode-match { grid-template-columns: 1fr; }
.option-btn-sequence,
.option-btn-match {
  min-height: 92px;
  align-items: flex-start;
}
.opt-sequence {
  line-height: 1.9;
  font-size: 17px;
}
.opt-match {
  display: block;
  width: 100%;
  line-height: 1.6;
}
.pair-clue {
  display: inline;
  color: #eaf6ff;
  font-weight: 700;
}
.pair-link {
  display: inline;
  color: #facc15;
  font-weight: 900;
  font-size: 13px;
  margin: 0 4px;
}
.pair-answer {
  display: inline;
  color: #fde68a;
  font-weight: 900;
}
.option-btn-sequence,
.option-btn-match {
  min-height: auto !important;
  padding: 10px 14px;
}
@media (max-width: 700px) {
  .option-btn-sequence,
  .option-btn-match { min-height: auto !important; }
  .opt-sequence { font-size: 15px; }
  .opt-match { gap: 6px; }
}


.question-mode-badge.mode-timed { background: rgba(249, 115, 22, 0.18); border-color: rgba(249, 115, 22, 0.4); }
.quiz-timer-chip {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  font-weight: 800;
}
.quiz-timer-chip.active { display: inline-flex; }
.quiz-timer-chip.danger {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.4);
  color: #fecaca;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.08);
}
.path-inline-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-inline-start: 8px;
  color: #fde68a;
  font-weight: 800;
}
.path-status-banner {
  display: none;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 10px 14px;
  color: #fff;
}
.path-status-banner strong { display: block; color: #fde68a; font-size: 14px; }
.path-status-banner span { display: block; font-size: 12px; color: rgba(255,255,255,0.82); }
.path-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: rgba(250,204,21,0.14);
  font-size: 18px;
}
.checkpoint-path-panel {
  margin: 18px 0 10px;
  padding: 16px;
  border-radius: 22px;
  background: rgba(10,20,55,0.35);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
}
.checkpoint-path-title {
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 6px;
}
.checkpoint-path-sub {
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  margin-bottom: 12px;
}
.checkpoint-path-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.checkpoint-path-option {
  text-align: right;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #fff;
  padding: 14px;
  cursor: pointer;
  transition: .25s ease;
  font-family: var(--font-main);
}
.checkpoint-path-option:hover {
  transform: translateY(-2px);
  border-color: rgba(250,204,21,0.45);
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}
.checkpoint-path-option.selected {
  border-color: rgba(250,204,21,0.55);
  background: rgba(250,204,21,0.12);
}
.cpo-head {
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:8px;
}
.cpo-icon {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background: rgba(255,255,255,0.08);
  font-size: 18px;
}
.cpo-name { font-size: 16px; font-weight: 900; color: #fde68a; }
.cpo-desc { font-size: 13px; line-height: 1.7; color: rgba(255,255,255,0.88); }
@media (max-width: 700px) {
  .checkpoint-path-options { grid-template-columns: 1fr; }
}


/* ===== إضافات v22 ===== */
.story-condense-toggle {
  align-self: flex-start;
  margin: 8px 0 10px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(12,20,56,0.55);
  color: #fff;
  padding: 8px 12px;
  border-radius: 999px;
  font-family: var(--font-main);
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.story-condense-toggle.active {
  background: linear-gradient(135deg, rgba(245,158,11,.25), rgba(139,92,246,.28));
  border-color: rgba(250,204,21,.45);
}
.midstage-fact {
  display:inline-block;
  padding:10px 14px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(250,204,21,0.28);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
.stage-choice-panel {
  display:none;
  width:100%;
  background: rgba(10, 18, 40, 0.52);
  border:1px solid rgba(255,255,255,.1);
  border-radius: 18px;
  padding: 12px;
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
}
.stage-choice-title { font-weight: 800; margin-bottom: 10px; color:#fff; }
.stage-choice-options { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.stage-choice-btn {
  border:none; border-radius:16px; padding:12px 14px; color:#fff; font-family:var(--font-main); font-weight:800; cursor:pointer;
  background: linear-gradient(135deg, rgba(30,41,59,.95), rgba(71,85,105,.95));
}
.stage-choice-btn.insight { background: linear-gradient(135deg, rgba(14,116,144,.95), rgba(59,130,246,.92)); }
.stage-choice-btn.resolve { background: linear-gradient(135deg, rgba(127,29,29,.95), rgba(234,88,12,.92)); }
.stage-choice-picked {
  text-align:center; padding:12px 14px; font-weight:800; border-radius:14px; background:rgba(17,24,39,.78); color:#fff;
}
@media (max-width: 640px) { .stage-choice-options { grid-template-columns:1fr; } }


/* v23 interludes + question skins */
.stage-interlude-modal{position:fixed;inset:0;background:rgba(3,7,18,.72);backdrop-filter:blur(10px);display:none;align-items:center;justify-content:center;z-index:4000;padding:24px}
.stage-interlude-modal.show{display:flex}
.stage-interlude-box{position:relative;max-width:620px;width:min(92vw,620px);background:linear-gradient(180deg,rgba(10,20,48,.96),rgba(8,14,34,.98));border:1px solid rgba(250,204,21,.22);border-radius:28px;padding:30px 28px;text-align:center;box-shadow:0 22px 80px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.06);overflow:hidden}
.stage-interlude-glow{position:absolute;inset:auto -8% -40% -8%;height:220px;background:radial-gradient(circle at center, rgba(250,204,21,.18), transparent 65%);pointer-events:none}
.stage-interlude-kicker{display:inline-flex;padding:6px 12px;border-radius:999px;background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.08);font-size:13px;color:#dbe7ff;margin-bottom:14px}
.stage-interlude-icon{font-size:56px;line-height:1;margin-bottom:10px}
.stage-interlude-title{font-size:31px;margin:0 0 12px;color:#fff;font-weight:900}
.stage-interlude-text{font-size:18px;line-height:1.95;color:#d9e4ff;margin:0 auto 16px;max-width:520px}
.stage-interlude-reward{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:10px 16px;border-radius:16px;background:rgba(250,204,21,.12);border:1px solid rgba(250,204,21,.28);color:#fde68a;font-weight:800;margin-bottom:18px}
.question-mode-flavor{display:flex;align-items:center;gap:12px;margin-bottom:12px;padding:10px 12px;border-radius:16px;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.08)}
.question-mode-flavor .qmf-icon{font-size:24px;line-height:1}
.question-mode-flavor .qmf-copy{display:flex;flex-direction:column;gap:2px}
.question-mode-flavor .qmf-copy strong{font-size:14px;color:#fff}
.question-mode-flavor .qmf-copy span{font-size:12px;color:#cdd8f6}
.question-card.mode-standard,
.question-card.mode-duel,
.question-card.mode-tf,
.question-card.mode-timed,
.question-card.mode-sequence,
.question-card.mode-match,
.question-card.mode-taporder {
  background: rgba(13,26,74,0.92);
  border-color: rgba(200,168,75,0.4);
  box-shadow: var(--shadow-card);
}
.options-grid.mode-duel .option-btn{min-height:88px}
.options-grid.mode-timed .option-btn{box-shadow:inset 0 0 0 1px rgba(251,146,60,.12)}
.options-grid.mode-sequence .option-btn{border-style:dashed}
.options-grid.mode-match .option-btn{background:linear-gradient(180deg,rgba(255,255,255,.07),rgba(255,255,255,.03))}


/* v24 - interactive tap order */
.question-mode-badge.mode-taporder { background: linear-gradient(135deg, #0f766e, #14b8a6); color: #fff; }
.options-grid.mode-taporder {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.option-btn-taporder {
  position: relative;
  min-height: 110px;
  border: 2px dashed rgba(20,184,166,.35);
  background: linear-gradient(180deg, rgba(20,184,166,.08), rgba(15,118,110,.12));
}
.option-btn-taporder .tap-rank-slot {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.88);
  color: #0f766e;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(15,118,110,.16);
}
.option-btn-taporder.tap-picked {
  border-style: solid;
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 12px 28px rgba(20,184,166,.18);
}
.option-btn-taporder.tap-picked .tap-rank-slot {
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  color: #fff;
}


.story-visual-meta {
  margin: 10px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.16);
  color: #E9F4FF;
  font-size: 0.92rem;
  backdrop-filter: blur(8px);
}
.story-visual-meta::before {
  content: '🖼️';
}
#story-scene.story-mood-foundation::before,
#story-scene.story-mood-battle::before,
#story-scene.story-mood-expansion::before,
#story-scene.story-mood-sacred::before,
#story-scene.story-mood-kingdom::before,
#story-scene.story-mood-vision::before,
#story-scene.story-mood-civic::before,
#story-scene.story-mood-generic::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
#story-scene.story-mood-foundation::before {
  background: linear-gradient(180deg, rgba(66,36,14,0.35) 0%, rgba(20,10,4,0.28) 35%, rgba(6,8,18,0.72) 100%);
}
#story-scene.story-mood-battle::before {
  background: linear-gradient(180deg, rgba(85,28,12,0.40) 0%, rgba(49,17,10,0.28) 35%, rgba(7,8,18,0.78) 100%);
}
#story-scene.story-mood-expansion::before {
  background: linear-gradient(180deg, rgba(10,68,43,0.34) 0%, rgba(10,45,27,0.24) 35%, rgba(6,10,18,0.74) 100%);
}
#story-scene.story-mood-sacred::before {
  background: linear-gradient(180deg, rgba(118,92,20,0.28) 0%, rgba(54,64,22,0.20) 30%, rgba(5,10,20,0.76) 100%);
}
#story-scene.story-mood-kingdom::before {
  background: linear-gradient(180deg, rgba(18,36,90,0.34) 0%, rgba(16,25,54,0.24) 35%, rgba(6,8,18,0.76) 100%);
}
#story-scene.story-mood-vision::before {
  background: linear-gradient(180deg, rgba(0,123,182,0.24) 0%, rgba(5,58,113,0.18) 35%, rgba(5,8,20,0.78) 100%);
}
#story-scene.story-mood-civic::before {
  background: linear-gradient(180deg, rgba(0,97,90,0.22) 0%, rgba(25,73,112,0.16) 35%, rgba(5,8,20,0.78) 100%);
}
#story-scene .story-background,
#story-scene .story-content,
#story-scene .story-panel,
#story-scene .character-container {
  position: relative;
  z-index: 1;
}
.story-era {
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}
.story-panel {
  border-top: 1px solid rgba(255,255,255,0.08);
}


@media (min-width: 900px) {
  #story-scene {
    justify-content: flex-end;
  }
  .story-panel {
    width: min(760px, 100%);
    margin-inline: 0 auto;
    border-top-right-radius: 24px;
    border-top-left-radius: 24px;
    padding-inline: 28px;
  }
  .character-container {
    width: 40%;
    right: 2%;
    opacity: 0.92;
  }
}
@media (max-width: 768px) {
  .character-container {
    width: 54%;
    right: -2%;
    opacity: 0.52;
  }
  .character-group {
    opacity: 0.38;
    left: -18%;
  }
  .story-panel {
    background: linear-gradient(to top, rgba(4,8,22,0.995) 0%, rgba(8,16,50,0.98) 60%, rgba(8,16,50,0.92) 84%, rgba(8,16,50,0.28) 100%);
    max-height: 58vh;
    margin-top: -20px;
    padding: 20px 16px 18px;
  }
  .story-text {
    max-height: 160px;
    font-size: 15px;
    line-height: 1.85;
  }
  .story-title {
    font-size: 22px;
  }
  .story-visual-meta {
    font-size: 12px;
    padding: 7px 10px;
  }
}

.reward-chest-screen-enter { animation: rewardScreenFade .35s ease both; }
@keyframes rewardScreenFade { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: scale(1); } }


/* ===== إصلاح شامل: منع اقتطاع المحتوى خلف شريط المتصفح على الجوال ===== */
/* المشكلة: شريط المتصفح (Safari/Chrome) يأخذ ~80px في الأسفل ويخفي المحتوى */
/* الحل: scene-container overflow:visible + story-scene overflow-y:auto + padding-bottom */

/* 1. story-panel: إضافة padding كافٍ في الأسفل لشريط المتصفح */
.story-panel {
  padding-bottom: max(env(safe-area-inset-bottom, 24px), 24px) !important;
  margin-bottom: 0 !important;
}

/* 2. زر التالي في القصة: التأكد من ظهوره */
.btn-story-next {
  margin-bottom: 8px;
}

/* 3. شاشة الأسئلة: padding في الأسفل */
#quiz-scene .quiz-container {
  padding-bottom: max(80px, calc(env(safe-area-inset-bottom, 20px) + 60px));
}

/* 4. شاشة الرؤية (مشاريع التنمية): padding في الأسفل */
.projects-grid {
  padding-bottom: max(80px, calc(env(safe-area-inset-bottom, 20px) + 60px));
}

/* 5. شاشة لعبة البناء: padding في الأسفل */
.lego-container {
  padding-bottom: max(80px, calc(env(safe-area-inset-bottom, 20px) + 60px));
}

/* 6. شاشة المعركة (battle-footer): padding في الأسفل */
.battle-footer {
  padding-bottom: max(80px, calc(env(safe-area-inset-bottom, 20px) + 60px)) !important;
}

/* 7. شاشة إدخال الاسم */
.name-screen-inner {
  padding-bottom: max(80px, calc(env(safe-area-inset-bottom, 20px) + 60px));
}

/* 8. الشاشة الرئيسية */
#main-screen .screen-inner,
#main-screen > div {
  padding-bottom: max(80px, calc(env(safe-area-inset-bottom, 20px) + 60px));
}

/* 9. شاشة لعبة الصيد (hunting) */
#hunting-game-screen .battle-footer {
  padding-bottom: max(80px, calc(env(safe-area-inset-bottom, 20px) + 60px)) !important;
}

/* 10. على الشاشات الكبيرة (ليست جوال) نعيد القيم الطبيعية */
@media (min-width: 768px) {
  .story-panel {
    padding-bottom: max(24px, env(safe-area-inset-bottom, 24px)) !important;
  }
  #quiz-scene .quiz-container {
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
  .projects-grid {
    padding-bottom: 10px;
  }
  .lego-container {
    padding-bottom: 10px;
  }
  .battle-footer {
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px)) !important;
  }
  .name-screen-inner {
    padding-bottom: 30px;
  }
  #main-screen .screen-inner,
  #main-screen > div {
    padding-bottom: 0;
  }
  #hunting-game-screen .battle-footer {
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px)) !important;
  }
}
