/* ============================================================
   BIOVERSE - Main Stylesheet
   Arabic RTL, Scientific Color Palette, Animated
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&family=Cairo:wght@300;400;600;700;900&display=swap');

/* ─── CSS Variables ─────────────────────────────────────── */
:root {
  --primary: #7B2FBE;
  --secondary: #4A00E0;
  --accent: #FFD700;
  --bg-dark: #0A0A1A;
  --bg-card: #12122A;
  --bg-panel: #1A1A35;
  --text-primary: #FFFFFF;
  --text-secondary: #B0B0C8;
  --text-muted: #6B6B8A;
  --border: rgba(255,255,255,0.1);
  --success: #06D6A0;
  --error: #E63946;
  --warning: #F77F00;
  --glow-purple: 0 0 40px rgba(123,47,190,0.5);
  --glow-blue: 0 0 40px rgba(74,0,224,0.5);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --font-arabic: 'Cairo', 'Tajawal', sans-serif;
}

/* ─── Base Reset ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  direction: rtl;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-arabic);
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.7;
}

/* ─── Animated Background ─────────────────────────────────── */
.bg-animated {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(123,47,190,0.15) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 20%, rgba(74,0,224,0.1) 0%, transparent 50%),
              radial-gradient(ellipse at 60% 80%, rgba(6,214,160,0.08) 0%, transparent 50%);
  animation: bgShift 8s ease-in-out infinite alternate;
}

@keyframes bgShift {
  from { background-size: 200% 200%; background-position: 0% 50%; }
  to { background-size: 200% 200%; background-position: 100% 50%; }
}

/* Floating particles */
.particles {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  animation: float linear infinite;
  opacity: 0.15;
}

@keyframes float {
  0% { transform: translateY(110vh) rotate(0deg); opacity: 0; }
  10% { opacity: 0.15; }
  90% { opacity: 0.15; }
  100% { transform: translateY(-10vh) rotate(720deg); opacity: 0; }
}

/* ─── Layout ─────────────────────────────────────────────── */
#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.screen {
  display: none;
  min-height: 100vh;
  flex-direction: column;
  animation: screenIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen.active {
  display: flex;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Loading Screen ─────────────────────────────────────── */
#loading-screen {
  justify-content: center;
  align-items: center;
  background: var(--bg-dark);
}

.loading-content {
  text-align: center;
}

.loading-logo {
  font-size: 6rem;
  animation: logoPulse 1.5s ease-in-out infinite;
  display: block;
  margin-bottom: 1rem;
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 20px rgba(123,47,190,0.7)); }
  50% { transform: scale(1.1) rotate(5deg); filter: drop-shadow(0 0 40px rgba(123,47,190,1)); }
}

.loading-title {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, #7B2FBE, #4A00E0, #06D6A0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 3px;
  margin-bottom: 0.5rem;
}

.loading-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.loading-bar-container {
  width: 300px;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  margin: 0 auto 1rem;
  overflow: hidden;
}

.loading-bar {
  height: 100%;
  background: linear-gradient(90deg, #7B2FBE, #06D6A0);
  border-radius: 10px;
  animation: loadingFill 2.5s ease forwards;
}

@keyframes loadingFill {
  from { width: 0%; }
  to { width: 100%; }
}

.loading-text {
  color: var(--text-muted);
  font-size: 0.9rem;
  animation: loadingBlink 1s ease-in-out infinite;
}

@keyframes loadingBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ─── Header / Navbar ────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,10,26,0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 900;
  font-size: 1.4rem;
  background: linear-gradient(135deg, #7B2FBE, #06D6A0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  cursor: pointer;
}

.header-logo span { font-size: 1.6rem; -webkit-text-fill-color: initial; }

.header-player {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.player-xp {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,215,0,0.1);
  border: 1px solid rgba(255,215,0,0.3);
  border-radius: 20px;
  padding: 0.3rem 0.8rem;
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 700;
}

.player-level {
  background: linear-gradient(135deg, #7B2FBE, #4A00E0);
  border-radius: 50%;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900;
  font-size: 0.9rem;
  box-shadow: var(--glow-purple);
}

/* ─── Home Screen ────────────────────────────────────────── */
#home-screen {
  flex-direction: column;
}

.hero-section {
  padding: 3rem 2rem 2rem;
  text-align: center;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(123,47,190,0.2);
  border: 1px solid rgba(123,47,190,0.4);
  border-radius: 20px;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  color: #B084F0;
  margin-bottom: 1.5rem;
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(123,47,190,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(123,47,190,0); }
}

.hero-title {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.hero-title .gradient-text {
  background: linear-gradient(135deg, #7B2FBE, #4A00E0, #06D6A0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.8;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
}

.hero-stat-value {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, #06D6A0, #7B2FBE);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
}

.hero-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ─── World Map ──────────────────────────────────────────── */
.worlds-section {
  padding: 2rem;
  flex: 1;
}

.section-header {
  text-align: center;
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.worlds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.world-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.world-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 4px;
  background: var(--world-gradient, linear-gradient(90deg, #7B2FBE, #4A00E0));
}

.world-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.world-card-icon {
  font-size: 3rem;
  margin-bottom: 0.8rem;
  display: block;
  animation: iconFloat 3s ease-in-out infinite;
}

@keyframes iconFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.world-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: var(--text-primary);
}

.world-card-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.world-card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.world-card-progress {
  margin-bottom: 1rem;
}

.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 0.4rem;
}

.progress-fill {
  height: 100%;
  border-radius: 10px;
  background: var(--world-gradient, linear-gradient(90deg, #7B2FBE, #4A00E0));
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.world-card-btn {
  width: 100%;
  padding: 0.7rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-arabic);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--world-gradient, linear-gradient(90deg, #7B2FBE, #4A00E0));
  color: white;
  transition: var(--transition);
}

.world-card-btn:hover {
  opacity: 0.85;
  transform: scale(0.98);
}

/* ─── Lesson Screen ──────────────────────────────────────── */
#lesson-screen .lesson-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-back {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-arabic);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-back:hover { background: rgba(255,255,255,0.15); }

.lesson-title-area { flex: 1; }
.lesson-screen-title { font-size: 1.3rem; font-weight: 700; }
.lesson-screen-subtitle { font-size: 0.85rem; color: var(--text-muted); }

/* Lesson Progress Steps */
.lesson-steps {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1.5rem 1.5rem;
  flex-wrap: wrap;
}

.step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  flex: 1;
  min-width: 70px;
  max-width: 100px;
  cursor: pointer;
}

.step-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  border: 2px solid rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: var(--transition);
}

.step-dot.active {
  background: var(--world-color, #7B2FBE);
  border-color: var(--world-color, #7B2FBE);
  box-shadow: 0 0 20px var(--world-color, rgba(123,47,190,0.6));
  transform: scale(1.1);
}

.step-dot.completed {
  background: var(--success);
  border-color: var(--success);
}

.step-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
}

/* ─── Scene View ─────────────────────────────────────────── */
.scene-container {
  flex: 1;
  padding: 1.5rem;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.scene-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
  animation: cardSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cardSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.scene-character-area {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.scene-avatar {
  font-size: 2.5rem;
  background: rgba(255,255,255,0.05);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  min-width: 60px;
  text-align: center;
  animation: avatarBob 2s ease-in-out infinite;
}

@keyframes avatarBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.scene-text-bubble {
  background: rgba(123,47,190,0.1);
  border: 1px solid rgba(123,47,190,0.3);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  flex: 1;
  position: relative;
}

.scene-text-bubble::before {
  content: '';
  position: absolute;
  top: 15px;
  right: -8px;
  width: 0; height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 8px solid rgba(123,47,190,0.3);
}

.scene-character-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: #B084F0;
  margin-bottom: 0.4rem;
}

.scene-text {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.scene-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Key Facts Grid */
.key-facts {
  margin-top: 1.5rem;
  padding: 1.2rem;
  background: rgba(6,214,160,0.05);
  border: 1px solid rgba(6,214,160,0.2);
  border-radius: var(--radius-md);
}

.key-facts-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.key-facts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.fact-item {
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.fact-item::before { content: '✦'; color: var(--success); font-size: 0.7rem; }

/* Navigation Buttons */
.scene-nav {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-top: 1rem;
}

.btn-primary {
  background: linear-gradient(135deg, #7B2FBE, #4A00E0);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.5rem;
  font-family: var(--font-arabic);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(123,47,190,0.4);
}

.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.5rem;
  font-family: var(--font-arabic);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover { background: rgba(255,255,255,0.12); }

/* ─── Games ──────────────────────────────────────────────── */
.game-container {
  display: none;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.game-container.active { display: flex; }

.game-header-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
}

.game-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.5rem; }
.game-instruction { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.6; }

/* Drag & Drop Game */
.dragdrop-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.drag-items-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.drag-item {
  background: rgba(255,255,255,0.05);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.2rem;
  cursor: grab;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.95rem;
  user-select: none;
}

.drag-item:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(123,47,190,0.5);
  transform: scale(1.01);
}

.drag-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
  transform: rotate(2deg) scale(1.02);
  border-color: #7B2FBE;
}

.drag-item.correct {
  border-color: var(--success);
  background: rgba(6,214,160,0.1);
}

.drag-item.wrong {
  border-color: var(--error);
  background: rgba(230,57,70,0.1);
}

.drag-slot {
  background: rgba(255,255,255,0.03);
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  min-height: 55px;
  display: flex;
  align-items: center;
  transition: var(--transition);
  color: var(--text-muted);
  font-size: 0.85rem;
  gap: 0.5rem;
}

.drag-slot.drag-over {
  border-color: #7B2FBE;
  background: rgba(123,47,190,0.1);
}

.drag-slot.filled { border-style: solid; border-color: rgba(255,255,255,0.2); color: var(--text-primary); }

/* Simulation Game */
.simulation-steps {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.sim-step {
  background: rgba(255,255,255,0.04);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sim-step:hover { background: rgba(255,255,255,0.08); }

.sim-step.activated {
  border-color: var(--success);
  background: rgba(6,214,160,0.1);
}

.sim-step-num {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.sim-step.activated .sim-step-num {
  background: var(--success);
}

.sim-step-icon { font-size: 1.5rem; }
.sim-step-label { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.2rem; }
.sim-step-desc { font-size: 0.8rem; color: var(--text-muted); }

/* Balance Game */
.balance-game-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.glucose-meter {
  margin-bottom: 1.5rem;
  text-align: center;
}

.glucose-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.glucose-value {
  font-size: 2.5rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
}

.glucose-bar-container {
  height: 20px;
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.glucose-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #06D6A0, #FFD700, #E63946);
  border-radius: 10px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.glucose-normal-zone {
  position: absolute;
  top: 0;
  height: 100%;
  border-left: 2px solid rgba(255,255,255,0.5);
  border-right: 2px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.1);
}

.situation-card {
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  margin-bottom: 1.2rem;
  font-size: 1rem;
  border: 1px solid var(--border);
}

.hormone-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.hormone-btn {
  padding: 1rem;
  border: 2px solid;
  border-radius: var(--radius-md);
  font-family: var(--font-arabic);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.hormone-btn.insulin {
  border-color: #2AB7CA;
  background: rgba(42,183,202,0.1);
  color: #2AB7CA;
}

.hormone-btn.glucagon {
  border-color: #F77F00;
  background: rgba(247,127,0,0.1);
  color: #F77F00;
}

.hormone-btn:hover { transform: scale(1.03); }

/* Timeline Game */
.timeline-area {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.timeline-source {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
}

.timeline-source-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
  font-weight: 600;
}

.timeline-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.timeline-item {
  background: rgba(255,255,255,0.05);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  cursor: grab;
  transition: var(--transition);
  font-size: 0.9rem;
}

.timeline-item:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,107,157,0.5); }
.timeline-item.dragging { opacity: 0.5; }

.timeline-target {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
}

.timeline-slots {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}

.timeline-slots::before {
  content: '';
  position: absolute;
  right: 20px;
  top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, #FF6B9D, #C9184A);
  opacity: 0.4;
}

.timeline-slot {
  background: rgba(255,255,255,0.03);
  border: 2px dashed rgba(255,107,157,0.3);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  min-height: 55px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: 40px;
  transition: var(--transition);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.timeline-slot.filled { border-style: solid; border-color: rgba(255,107,157,0.5); color: var(--text-primary); }
.timeline-slot.drag-over { border-color: #FF6B9D; background: rgba(255,107,157,0.1); }
.timeline-slot.correct { border-color: var(--success); background: rgba(6,214,160,0.1); }
.timeline-slot.wrong { border-color: var(--error); background: rgba(230,57,70,0.1); }

/* Puzzle Game (DNA) */
.dna-puzzle-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.dna-strand {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dna-pair {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
}

.dna-base {
  width: 50px; height: 50px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.2rem;
  border: 2px solid rgba(255,255,255,0.2);
  cursor: pointer;
  transition: var(--transition);
  color: white;
}

.dna-base:hover { transform: scale(1.1); }
.dna-base.correct { box-shadow: 0 0 15px currentColor; border-color: rgba(255,255,255,0.6); }
.dna-base.wrong { animation: shake 0.4s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.dna-bond {
  flex: 1;
  height: 2px;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  position: relative;
}

.dna-slot {
  width: 50px; height: 50px;
  border-radius: var(--radius-sm);
  border: 2px dashed rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.2rem;
}

.dna-option-btns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 1rem;
}

.dna-opt-btn {
  padding: 0.6rem;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  font-family: var(--font-arabic);
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  transition: var(--transition);
  color: white;
}

.dna-opt-btn:hover { transform: scale(1.05); border-color: rgba(255,255,255,0.5); }

/* Classification Game */
.classification-area {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.classif-source {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
}

.classif-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
}

.classif-item {
  background: rgba(255,255,255,0.05);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  text-align: center;
  cursor: grab;
  font-size: 0.85rem;
  transition: var(--transition);
}

.classif-item:hover { background: rgba(255,255,255,0.1); }
.classif-item.dragging { opacity: 0.4; }

.classif-categories {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}

.classif-category {
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  min-height: 130px;
  transition: var(--transition);
}

.classif-category.drag-over { border-color: white; background: rgba(255,255,255,0.05); }

.classif-cat-header {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.classif-dropped-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.classif-dropped {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
}

.classif-dropped.correct { border-color: var(--success); background: rgba(6,214,160,0.1); }
.classif-dropped.wrong { border-color: var(--error); background: rgba(230,57,70,0.1); }

/* ─── Game Result ────────────────────────────────────────── */
.game-result {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  display: none;
}

.game-result.visible { display: block; animation: cardSlideIn 0.4s ease; }

.result-emoji { font-size: 3rem; display: block; margin-bottom: 0.5rem; }
.result-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.5rem; }
.result-text { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.6; }

/* ─── Quiz ───────────────────────────────────────────────── */
#quiz-screen {
  flex-direction: column;
}

.quiz-container {
  flex: 1;
  padding: 1.5rem;
  max-width: 750px;
  margin: 0 auto;
  width: 100%;
}

.quiz-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.quiz-progress-text {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.quiz-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  margin: 0 1rem;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7B2FBE, #06D6A0);
  border-radius: 10px;
  transition: width 0.4s ease;
  width: 0%;
}

.quiz-score-display {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
}

.quiz-question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
  animation: cardSlideIn 0.4s ease;
}

.quiz-q-num {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.quiz-question {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.7;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.quiz-option {
  background: rgba(255,255,255,0.04);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.95rem;
  text-align: right;
}

.quiz-option:hover:not(.locked) {
  background: rgba(255,255,255,0.08);
  border-color: rgba(123,47,190,0.5);
}

.quiz-option.selected {
  border-color: #7B2FBE;
  background: rgba(123,47,190,0.15);
}

.quiz-option.correct {
  border-color: var(--success);
  background: rgba(6,214,160,0.15);
}

.quiz-option.wrong {
  border-color: var(--error);
  background: rgba(230,57,70,0.15);
}

.quiz-option.locked { cursor: not-allowed; }

.option-letter {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.quiz-option.correct .option-letter { background: var(--success); }
.quiz-option.wrong .option-letter { background: var(--error); }
.quiz-option.selected .option-letter { background: #7B2FBE; }

.quiz-explanation {
  background: rgba(6,214,160,0.08);
  border: 1px solid rgba(6,214,160,0.25);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1.5rem;
  display: none;
}

.quiz-explanation.visible { display: block; animation: cardSlideIn 0.3s ease; }
.quiz-explanation-label { font-weight: 700; color: var(--success); font-size: 0.85rem; margin-bottom: 0.3rem; }

/* ─── Quiz Result Screen ──────────────────────────────────── */
.quiz-result-container {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.quiz-result-container.active { display: flex; animation: cardSlideIn 0.5s ease; }

.quiz-result-icon {
  font-size: 5rem;
  margin-bottom: 1rem;
  animation: resultBounce 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.2s backwards;
}

@keyframes resultBounce {
  from { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); }
  to { transform: scale(1); opacity: 1; }
}

.quiz-result-title { font-size: 2rem; font-weight: 900; margin-bottom: 0.5rem; }
.quiz-result-score {
  font-size: 3.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #7B2FBE, #06D6A0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.quiz-result-msg {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.xp-gained {
  background: rgba(255,215,0,0.1);
  border: 1px solid rgba(255,215,0,0.3);
  border-radius: var(--radius-md);
  padding: 0.8rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.result-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ─── Progress Screen ────────────────────────────────────── */
#progress-screen { flex-direction: column; }

.progress-content {
  padding: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.overall-progress-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.overall-xp-circle {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: conic-gradient(#7B2FBE 0deg, rgba(255,255,255,0.05) 0deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  border: 4px solid rgba(255,255,255,0.07);
  position: relative;
}

.xp-circle-inner {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: absolute;
}

.xp-circle-value { font-size: 1.8rem; font-weight: 900; color: var(--accent); }
.xp-circle-label { font-size: 0.7rem; color: var(--text-muted); }

.progress-worlds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.progress-world-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.progress-world-icon {
  font-size: 2rem;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  min-width: 52px;
  text-align: center;
}

.progress-world-info { flex: 1; }
.progress-world-name { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.3rem; }
.progress-world-status { font-size: 0.8rem; color: var(--text-muted); }

/* ─── Notifications / Toast ──────────────────────────────── */
.toast-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.8rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  pointer-events: auto;
  min-width: 250px;
  text-align: center;
  justify-content: center;
}

.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--error); color: var(--error); }
.toast.info { border-color: #7B2FBE; color: #B084F0; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-10px); }
}

/* ─── Confetti ───────────────────────────────────────────── */
.confetti-piece {
  position: fixed;
  width: 10px; height: 10px;
  border-radius: 2px;
  z-index: 9998;
  pointer-events: none;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ─── Bottom Nav ─────────────────────────────────────────── */
.bottom-nav {
  position: sticky;
  bottom: 0;
  background: rgba(10,10,26,0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.7rem 0.5rem;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-arabic);
  font-size: 0.65rem;
}

.nav-item:hover { color: var(--text-primary); }
.nav-item.active { color: #B084F0; }
.nav-item-icon { font-size: 1.3rem; }

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(123,47,190,0.4); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(123,47,190,0.7); }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .worlds-grid { grid-template-columns: 1fr; }
  .key-facts-grid { grid-template-columns: 1fr; }
  .hormone-btns { grid-template-columns: 1fr; }
  .classif-categories { grid-template-columns: 1fr; }
  .dna-option-btns { grid-template-columns: repeat(2, 1fr); }
  .quiz-result-score { font-size: 2.5rem; }
  .loading-title { font-size: 2rem; }
  .hero-title { font-size: 1.8rem; }
  .result-actions { flex-direction: column; }
}

/* ─── Utility ────────────────────────────────────────────── */
.text-center { text-align: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.hidden { display: none !important; }
.bold { font-weight: 700; }
.full-width { width: 100%; }
