/* ========================================================
   مختبر العالم الصغير - التربية العلمية والتكنولوجية
   THE LITTLE SCIENTIST LAB: Science Educational Game
   ======================================================== */

:root {
  --primary: #0288d1;
  --primary-d: #01579b;
  --accent: #26a69a;
  --gold: #fbc02d;
  --amber: #f57f17;
  --green: #2e7d32;
  --dark: #1b262c;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--dark);
  background-color: #0d47a1;
  background-image: url('assets/bg.jpg');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

#app {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* ==================== الشاشات ==================== */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: 16px 24px;
  overflow-y: auto;
  overflow-x: hidden;
}
.screen.active {
  display: flex;
}

/* ==================== أزرار وعناصر عامة ==================== */
.btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  border: none;
  border-radius: 18px;
  padding: 12px 24px;
  cursor: pointer;
  background: linear-gradient(180deg, #0288d1, var(--primary-d));
  box-shadow: 0 5px 0 #00376d, 0 8px 18px rgba(0,0,0,0.25);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #00376d; }

.btn-primary {
  background: linear-gradient(180deg, #fbc02d, #f57f17);
  box-shadow: 0 5px 0 #bc5c00, 0 8px 18px rgba(245, 127, 23, 0.3);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.btn-primary:active { box-shadow: 0 2px 0 #bc5c00; }

.btn-secondary {
  background: linear-gradient(180deg, #2e7d32, #1b5e20);
  box-shadow: 0 5px 0 #0f3b14, 0 8px 18px rgba(0,0,0,0.2);
}
.btn-secondary:active { box-shadow: 0 2px 0 #0f3b14; }

.btn-ghost {
  background: #ffffff;
  color: #0288d1;
  box-shadow: 0 4px 0 #cfd8dc, 0 8px 18px rgba(0,0,0,0.12);
  border: 2px solid #b3e5fc;
}
.btn-ghost:active { box-shadow: 0 1px 0 #cfd8dc; }

.icon-btn {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 2px solid #81d4fa;
  background: #ffffff;
  cursor: pointer;
  font-size: 1.3rem;
  font-family: inherit;
  font-weight: 900;
  color: var(--dark);
  box-shadow: 0 4px 0 #4fc3f7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s;
  flex-shrink: 0;
}
.icon-btn:hover { filter: brightness(1.04); }
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #4fc3f7; }
.icon-btn.off { opacity: 0.55; }

.speaker-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #ffffff;
  border: 2px solid #fbc02d;
  color: #f57f17;
  font-size: 1.3rem;
  box-shadow: 0 3px 0 #f57f17;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s;
  flex-shrink: 0;
}
.speaker-btn:active { transform: translateY(2px); }

.stars-pill {
  background: linear-gradient(180deg, #fffde7, #fff59d);
  color: #e65100;
  font-weight: 900;
  border: 2px solid #fbc02d;
  border-radius: 999px;
  padding: 6px 18px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  white-space: nowrap;
}

/* ==================== حاوية الزجاج الشفاف (Glassmorphism) ==================== */
.glass {
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 28px;
  border: 3.5px solid #fbc02d;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25), inset 0 0 0 2px rgba(255, 255, 255, 0.6);
}

/* ==================== القائمة الرئيسية (Menu) بدون سكرول ==================== */
#scr-menu {
  display: none;
  justify-content: center;
  align-items: center;
  padding: 10px 20px;
  overflow: hidden;
}
#scr-menu.active {
  display: flex;
}

.top-controls {
  position: fixed;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 8px;
  align-items: center;
  z-index: 1000;
}

.menu-card {
  width: 100%;
  max-width: 960px;
  max-height: 96vh;
  margin: auto;
  padding: 14px 28px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.mascot-badge {
  position: relative;
  margin-top: -6px;
  margin-bottom: 2px;
}
.mascot-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  object-fit: cover;
  background: #fff;
  animation: floatMascot 3s ease-in-out infinite;
}
@keyframes floatMascot {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
.crest-sparkle {
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 1.4rem;
}

.menu-card .stars-pill {
  position: absolute;
  top: 14px;
  left: 18px;
}

.logo {
  font-size: 2.1rem;
  font-weight: 900;
  color: #01579b;
  text-shadow: 0 2px 4px rgba(255,255,255,0.7);
  letter-spacing: -0.5px;
  margin: 2px 0 2px;
}
.logo span {
  color: #2e7d32;
  position: relative;
}

.tagline {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1b262c;
  background: rgba(255, 255, 255, 0.9);
  padding: 4px 16px;
  border-radius: 999px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.modes-selection {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
  margin-bottom: 12px;
}

.mode-card {
  background: #ffffff;
  border-radius: 20px;
  border: 3.5px solid var(--mc, #0288d1);
  padding: 14px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  box-shadow: 0 8px 0 rgba(0,0,0,0.12), 0 12px 24px rgba(0,0,0,0.15);
  transition: transform 0.12s, box-shadow 0.12s;
  font-family: inherit;
  position: relative;
}
.mode-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 0 rgba(0,0,0,0.14), 0 18px 30px rgba(0,0,0,0.2);
}
.mode-card:active {
  transform: translateY(2px);
}
.mode-experiments { --mc: #0288d1; }
.mode-body { --mc: #d81b60; }
.mode-nature { --mc: #2e7d32; }

.mode-icon {
  font-size: 2.8rem;
  line-height: 1;
}
.mode-info h3 {
  font-size: 1.15rem;
  font-weight: 900;
  color: #01579b;
  margin-bottom: 2px;
}
.mode-info p {
  font-size: 0.85rem;
  font-weight: 600;
  color: #455a64;
  line-height: 1.25;
}
.arrow-badge {
  display: inline-block;
  background: #e1f5fe;
  color: #0288d1;
  font-weight: 900;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  line-height: 28px;
  font-size: 1rem;
}

.menu-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ==================== الشريط العلوي HUD ==================== */
.hud, .topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2.5px solid rgba(251, 192, 45, 0.6);
  border-radius: 20px;
  padding: 10px 18px;
  margin-bottom: 14px;
}
.hud-title, .topbar h2 {
  font-size: 1.35rem;
  font-weight: 900;
  color: #01579b;
}

.dots {
  display: flex;
  gap: 8px;
  align-items: center;
}
.dots .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  border: 2px solid #b0bec5;
  transition: all 0.2s;
}
.dots .dot.current {
  width: 18px;
  height: 18px;
  background: #ffffff;
  border: 4px solid #f57f17;
  transform: scale(1.15);
}
.dots .dot.perfect { background: #2ecc71; border-color: #27ae60; }

/* ==================== قائمة المستويات ==================== */
.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 10px;
}
.level-card {
  background: #ffffff;
  border-radius: 22px;
  padding: 20px;
  border: 3.5px solid var(--c, #0288d1);
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0,0,0,0.12), 0 12px 24px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  text-align: right;
  transition: transform 0.12s;
}
.level-card:hover { transform: translateY(-4px); }
.level-card.locked { filter: grayscale(1); opacity: 0.6; cursor: not-allowed; }
.lc-icon { font-size: 3rem; }
.lc-title { font-size: 1.3rem; font-weight: 900; color: #01579b; }
.lc-desc { font-size: 0.95rem; font-weight: 600; color: #546e7a; }
.lc-stars { font-size: 1.3rem; letter-spacing: 4px; color: #fbc02d; }
.lc-stars .off { color: #cfd8dc; }

/* ==================== النمط 1: مختبر التجارب التفاعلي ==================== */
.exp-stage {
  max-width: 980px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 3.5px solid #fbc02d;
  border-radius: 30px;
  box-shadow: 0 16px 44px rgba(0,0,0,0.25), inset 0 0 0 2px rgba(255, 255, 255, 0.6);
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.task-banner {
  background: rgba(255, 255, 255, 0.92);
  border: 2.5px solid #fbc02d;
  border-radius: 20px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.task-badge {
  background: #0288d1;
  color: #fff;
  font-weight: 900;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.95rem;
}
.task-banner h3 {
  flex: 1;
  font-size: 1.25rem;
  font-weight: 900;
  color: #01579b;
}

.exp-workspace-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
}

.lab-simulation-box {
  background: rgba(255, 255, 255, 0.88);
  border: 3px solid #0288d1;
  border-radius: 24px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 280px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
  position: relative;
}

.sim-display-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  flex: 1;
}

.sim-status-pill {
  background: #e1f5fe;
  color: #01579b;
  border: 2px solid #81d4fa;
  border-radius: 999px;
  padding: 6px 18px;
  font-size: 0.95rem;
  font-weight: 800;
  text-align: center;
  width: 100%;
}

.lab-toolbox {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
  border: 2.5px solid #fbc02d;
  border-radius: 24px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.toolbox-header {
  display: flex;
  flex-direction: column;
}
.toolbox-header span {
  font-size: 1.15rem;
  font-weight: 900;
  color: #01579b;
}
.toolbox-header small {
  font-size: 0.85rem;
  font-weight: 700;
  color: #546e7a;
}

.tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tool-item-btn {
  background: #ffffff;
  border: 2.5px solid #cfd8dc;
  border-radius: 16px;
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: 0 4px 0 #b0bec5, 0 6px 14px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: right;
  transition: transform 0.1s, border-color 0.1s;
  font-family: inherit;
}
.tool-item-btn:hover {
  transform: translateY(-2px);
  border-color: #0288d1;
}
.tool-item-btn.selected {
  background: #e1f5fe;
  border-color: #0288d1;
  box-shadow: 0 4px 0 #01579b, 0 0 0 2px rgba(2, 136, 209, 0.25);
}
.tool-icon { font-size: 2rem; }
.tool-label { font-size: 0.95rem; font-weight: 800; color: #1b262c; }

.exp-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding-top: 10px;
  border-top: 1.5px solid rgba(255, 255, 255, 0.4);
}

/* ==================== النمط 2: جسم الإنسان ==================== */
.body-stage {
  max-width: 960px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 3.5px solid #fbc02d;
  border-radius: 30px;
  box-shadow: 0 16px 44px rgba(0,0,0,0.25), inset 0 0 0 2px rgba(255, 255, 255, 0.6);
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.body-quest-header {
  background: rgba(255, 255, 255, 0.92);
  border: 2.5px solid #d81b60;
  border-radius: 20px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.quest-tag {
  background: #d81b60;
  color: #fff;
  font-weight: 900;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.95rem;
}
.body-quest-header h3 {
  flex: 1;
  font-size: 1.25rem;
  font-weight: 900;
  color: #880e4f;
}

.body-interactive-container {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
  align-items: center;
}

.body-model-frame {
  background: rgba(255, 255, 255, 0.85);
  border: 3px solid #81d4fa;
  border-radius: 24px;
  height: 440px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 12px 30px rgba(0,0,0,0.15);
  overflow: hidden;
  background: linear-gradient(180deg, #f0f7ff, #ffffff);
}

.torso-3d-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
}

.body-silhouette {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.organ-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  background: #ffffff;
  border: 3px solid #d81b60;
  border-radius: 999px;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(216, 27, 96, 0.4), 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  z-index: 10;
  white-space: nowrap;
}
.organ-hotspot:hover {
  transform: translate(-50%, -50%) scale(1.1);
  border-color: #fbc02d;
  box-shadow: 0 6px 18px rgba(251, 192, 45, 0.5);
}
.organ-hotspot.active {
  border-color: #f57f17;
  background: #fff8e1;
  box-shadow: 0 0 0 5px rgba(245, 127, 23, 0.4), 0 6px 20px rgba(0,0,0,0.2);
  transform: translate(-50%, -50%) scale(1.15);
}
.hotspot-pin {
  font-size: 1.4rem;
  line-height: 1;
}
.hotspot-label {
  font-size: 0.9rem;
  font-weight: 900;
  color: #880e4f;
  pointer-events: none;
}

.heart-beating {
  animation: heartPulse 1.1s ease-in-out infinite;
}
@keyframes heartPulse {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.22); }
  40% { transform: scale(1.05); }
  60% { transform: scale(1.28); }
}

.lung-breathing {
  animation: lungBreath 2.6s ease-in-out infinite;
}
@keyframes lungBreath {
  0%, 100% { transform: scale(0.9); }
  50% { transform: scale(1.18); }
}

.organ-info-card {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.organ-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
}
.organ-big-emoji {
  font-size: 3.5rem;
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  background: #ffffff;
  border: 2px solid #fbc02d;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  flex-shrink: 0;
}
.organ-card-header h4 {
  font-size: 1.4rem;
  font-weight: 900;
  color: #880e4f;
}
.organ-system {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0288d1;
}
.organ-card-body {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1b262c;
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.9);
  padding: 14px 18px;
  border-radius: 18px;
  border: 1.5px solid #eceff1;
}

/* ==================== النمط 3: سلاسل الحياة ==================== */
.nature-stage {
  max-width: 980px;
  width: 100%;
  margin: 0 auto 24px auto;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 3.5px solid #fbc02d;
  border-radius: 30px;
  box-shadow: 0 16px 44px rgba(0,0,0,0.25), inset 0 0 0 2px rgba(255, 255, 255, 0.6);
  padding: 16px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.food-chain-track {
  background: linear-gradient(135deg, rgba(232, 245, 233, 0.95), rgba(200, 230, 201, 0.95));
  border: 3px solid #43a047;
  border-radius: 28px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  box-shadow: 0 10px 24px rgba(46, 125, 50, 0.18), inset 0 2px 4px rgba(255,255,255,0.8);
  overflow-x: auto;
}

.chain-slot {
  flex: 1;
  max-width: 250px;
  min-width: 180px;
  height: 110px;
  background: #ffffff;
  border: 3px solid #a5d6a7;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  text-align: center;
  position: relative;
  box-shadow: 0 6px 14px rgba(0,0,0,0.08);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.chain-slot:hover {
  transform: translateY(-2px);
  border-color: #2e7d32;
}
.chain-slot.filled {
  background: linear-gradient(180deg, #ffffff, #f1f8e9);
  border: 3px solid #2e7d32;
  box-shadow: 0 8px 18px rgba(46, 125, 50, 0.22);
  cursor: pointer;
}
.chain-slot .slot-title {
  position: absolute;
  top: 6px;
  font-size: 0.8rem;
  font-weight: 900;
  color: #2e7d32;
  background: #e8f5e9;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid #c8e6c9;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chain-slot .slot-content {
  font-size: 0.88rem;
  font-weight: 800;
  color: #78909c;
  margin-top: 20px;
}
.chain-arrow {
  font-size: 2rem;
  color: #2e7d32;
  font-weight: 900;
  text-shadow: 0 2px 4px rgba(0,0,0,0.12);
  user-select: none;
}

.nature-pool-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pool-hint {
  font-size: 0.95rem;
  font-weight: 800;
  color: #1b5e20;
  background: rgba(255, 255, 255, 0.95);
  padding: 5px 16px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border: 2px solid #a5d6a7;
  align-self: flex-start;
}
.nature-cards-pool {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.creature-card {
  background: #ffffff;
  border: 3px solid #81c784;
  border-radius: 18px;
  padding: 10px 14px;
  cursor: pointer;
  box-shadow: 0 5px 0 #388e3c, 0 8px 16px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: right;
  transition: transform 0.12s, box-shadow 0.12s;
}
.creature-card:hover {
  transform: translateY(-3px);
  border-color: #2e7d32;
  box-shadow: 0 9px 0 #2e7d32, 0 14px 24px rgba(0,0,0,0.15);
}
.creature-card:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 #2e7d32;
}
.creature-card.used {
  opacity: 0.4;
  pointer-events: none;
  border-color: #cfd8dc;
  box-shadow: none;
  background: #f5f5f5;
}
.creature-icon {
  font-size: 2.8rem;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  background: #f1f8e9;
  border-radius: 16px;
  border: 2px solid #c8e6c9;
  flex-shrink: 0;
}
.creature-title {
  font-size: 1.15rem;
  font-weight: 900;
  color: #1b5e20;
}
.creature-role {
  font-size: 0.88rem;
  font-weight: 700;
  color: #558b2f;
}

.nature-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding-top: 10px;
  border-top: 1.5px solid rgba(255, 255, 255, 0.4);
}

/* ==================== معرض الأوسمة ==================== */
.trophies-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}
.trophies-desc {
  font-size: 1.1rem;
  font-weight: 800;
  color: #01579b;
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 18px;
  border-radius: 999px;
  margin-bottom: 20px;
  display: inline-block;
}
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.badge-card {
  background: #ffffff;
  border-radius: 20px;
  border: 3px solid #fbc02d;
  padding: 16px;
  text-align: center;
  box-shadow: 0 6px 14px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.badge-card.locked {
  filter: grayscale(1);
  opacity: 0.5;
}
.badge-icon { font-size: 3rem; }
.badge-title { font-size: 1.1rem; font-weight: 900; color: #01579b; }
.badge-desc { font-size: 0.85rem; color: #546e7a; font-weight: 600; }

/* ==================== النوافذ المنبثقة ==================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal.hidden { display: none; }

.modal-box {
  width: 100%;
  max-width: 620px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.95);
  border: 3.5px solid #fbc02d;
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-header h3 {
  font-size: 1.35rem;
  font-weight: 900;
  color: #01579b;
}
.modal-close {
  background: #f5f5f5;
  border: none;
  font-size: 1.3rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 900;
}
.curriculum-list {
  list-style: none;
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 1rem;
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.win-card {
  max-width: 520px;
  width: 100%;
  text-align: center;
  padding: 32px 24px;
  background: rgba(255, 255, 255, 0.95);
  border: 4px solid #fbc02d;
  border-radius: 32px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.win-stars { font-size: 3.5rem; letter-spacing: 6px; }
.win-card h2 { font-size: 1.8rem; font-weight: 900; color: #01579b; }
.win-card p { font-size: 1.1rem; font-weight: 700; color: #455a64; }
.win-btns { display: flex; gap: 12px; margin-top: 10px; }

/* التجاوب */
@media (max-width: 768px) {
  .modes-selection { grid-template-columns: 1fr; }
  .exp-workspace-grid { grid-template-columns: 1fr; }
  .menu-card { max-height: 98vh; padding: 12px 16px; }
}

/* زر العودة لأكاديمية النابغة الصغير (مدمج في الركن الأيمن والبطاقة) */
.btn-academy-hub {
  background: linear-gradient(135deg, #1b4332, #2d6a4f);
  color: #ffffff !important;
  border: 2px solid #ffca28;
  border-radius: 999px;
  padding: 8px 16px;
  font-family: 'Cairo', sans-serif;
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn-academy-hub:hover, .btn-academy-hub:active {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  background: linear-gradient(135deg, #2d6a4f, #1b4332);
}
.btn-academy-hub .hub-arrow {
  font-size: 1.1rem;
  color: #ffca28;
}

.btn-home-hub {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 100%);
  color: #fff !important;
  border: 2px solid #ffca28;
  border-radius: 18px;
  padding: 12px 24px;
  font-size: 1.05rem;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(27, 67, 50, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
.btn-home-hub:hover, .btn-home-hub:active {
  transform: translateY(-2px);
  box-shadow: 0 7px 20px rgba(27, 67, 50, 0.55);
}

@media (max-width: 640px) {
  .top-controls {
    top: 10px;
    right: 10px;
    gap: 6px;
  }
  .btn-academy-hub {
    padding: 6px 12px;
    font-size: 0.82rem;
    gap: 4px;
  }
}

