/* =====================================================
   THERAPY QUEST — GAMIFICATION MAP CSS
   Re-Mind Client Portal — رحلة التعافي
   ===================================================== */

/* ── Quest Page Layout & Dynamic Emotional Gradient Background ── */
#page-quest {
  min-height: 100vh;
  background: transparent !important;
  color: #fff !important;
}

.quest-page-container {
  padding: 10px 5px 120px;
  max-width: 600px;
  margin: 0 auto;
}

/* Ensure bright contrast over dark emotional background */
#page-quest .quest-header-title,
#page-quest .quest-world-title,
#page-quest .quest-level-label,
#page-quest .quest-badges-title {
  color: #ffffff !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

#page-quest .quest-world-progress-text {
  color: rgba(255, 255, 255, 0.8) !important;
}

#page-quest .quest-badge {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #fff !important;
}
#page-quest .quest-badge-name {
  color: #ffffff !important;
}

#page-quest .quest-stat-chip {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
  backdrop-filter: blur(10px);
}

/* ── Quest Entry Card (Dashboard) ── */
.quest-entry-card {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  padding: 24px 22px;
  margin-bottom: 25px;
  cursor: pointer;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
  border: 1.5px solid rgba(251, 191, 36, 0.25);
  box-shadow: none !important;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s ease;
  color: #fff;
  direction: rtl;
  text-align: right;
}
.quest-entry-card:hover {
  transform: translateY(-5px) scale(1.01);
  box-shadow: none !important;
  border-color: rgba(251, 191, 36, 0.5);
}
.quest-entry-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -25%;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.2), transparent 70%);
  pointer-events: none;
  animation: questCardGlow 6s ease-in-out infinite alternate;
}
.quest-entry-card::after {
  content: '';
  position: absolute;
  bottom: -40%;
  left: -20%;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.15), transparent 70%);
  pointer-events: none;
}
@keyframes questCardGlow {
  0% { transform: scale(1) translate(0, 0); opacity: 0.8; }
  100% { transform: scale(1.2) translate(-10px, 10px); opacity: 1; }
}

.quest-entry-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  position: relative;
  z-index: 2;
}
.quest-entry-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.25), rgba(245, 158, 11, 0.1));
  border: 2px solid rgba(251, 191, 36, 0.5);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #fbbf24;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(251, 191, 36, 0.25);
  position: relative;
}
.quest-icon-sparkle {
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 14px;
  animation: questSparkle 2s ease-in-out infinite alternate;
}
@keyframes questSparkle {
  0% { transform: scale(0.8) rotate(0deg); }
  100% { transform: scale(1.2) rotate(15deg); }
}

.quest-entry-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #fbbf24;
  font-size: 10px;
  font-weight: 900;
  margin-bottom: 4px;
}
.quest-entry-title {
  font-size: 20px;
  font-weight: 950;
  line-height: 1.2;
  color: #ffffff;
  letter-spacing: -0.3px;
}
.quest-entry-subtitle {
  font-size: 11px;
  opacity: 0.75;
  font-weight: 700;
  margin-top: 3px;
  color: #cbd5e1;
}

/* Progress bar inside card */
.quest-entry-progress-bar-wrap {
  position: relative;
  z-index: 2;
  margin-bottom: 18px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.quest-entry-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 6px;
}
.quest-entry-progress-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
}
.quest-entry-progress-fill {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, #fbbf24, #10b981);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.5);
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.quest-entry-stats {
  display: flex;
  gap: 10px;
  position: relative;
  z-index: 2;
}
.quest-entry-stat {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 10px 8px;
  text-align: center;
  transition: all 0.3s ease;
}
.quest-entry-stat:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}
.quest-entry-stat-val {
  font-size: 17px;
  font-weight: 950;
  color: #fbbf24;
  line-height: 1.2;
}
.quest-entry-stat-label {
  font-size: 9px;
  opacity: 0.7;
  font-weight: 800;
  margin-top: 2px;
  color: #e2e8f0;
}
.quest-entry-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #1e1b4b;
  font-weight: 950;
  font-size: 15px;
  padding: 14px;
  border-radius: 18px;
  margin-top: 18px;
  position: relative;
  z-index: 2;
  box-shadow: 0 10px 25px rgba(251, 191, 36, 0.35);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.quest-entry-card:hover .quest-entry-cta {
  transform: scale(1.02);
  box-shadow: 0 14px 35px rgba(251, 191, 36, 0.5);
}
.quest-entry-hidden {
  display: none !important;
}

/* ── Redesigned Clean & Uncluttered Therapy Quest Card (Light & Dark Mode) ── */
.quest-entry-card.korix-minimal-card {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 16px 18px 14px 18px;
  margin-bottom: 20px;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 249, 255, 0.9)) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(56, 189, 248, 0.2) !important;
  box-shadow: 0 10px 30px rgba(56, 189, 248, 0.06), 0 0 0 1px rgba(255, 255, 255, 0.8) !important;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  color: var(--text-main);
  direction: rtl;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

[dir="ltr"] .quest-entry-card.korix-minimal-card {
  direction: ltr;
  text-align: left;
}

.quest-entry-card.korix-minimal-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 45px rgba(56, 189, 248, 0.15), 0 0 0 1px rgba(56, 189, 248, 0.35) !important;
  border-color: rgba(56, 189, 248, 0.35) !important;
}

[data-theme="dark"] .quest-entry-card.korix-minimal-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.85)) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.45), 0 0 25px rgba(56, 189, 248, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  color: #ffffff;
}

[data-theme="dark"] .quest-entry-card.korix-minimal-card:hover {
  border-color: rgba(56, 189, 248, 0.35) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 35px rgba(56, 189, 248, 0.18) !important;
}

.korix-glow-top {
  position: absolute;
  top: -60px;
  right: -30px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.14), transparent 70%);
  pointer-events: none;
}

/* Header */
.korix-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: relative;
  z-index: 2;
}

.korix-card-main-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.korix-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  box-shadow: 0 5px 14px rgba(2, 132, 199, 0.25);
  transition: transform 0.3s ease;
}

.quest-entry-card.korix-minimal-card:hover .korix-card-icon {
  transform: scale(1.08) rotate(-4deg);
}

.korix-card-titles {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.korix-card-tag {
  font-size: 10px;
  font-weight: 850;
  color: var(--primary);
  display: inline-block;
  line-height: 1.2;
}

[data-theme="dark"] .korix-card-tag {
  color: #38bdf8;
}

.korix-card-title {
  font-size: 14.5px;
  font-weight: 950;
  color: var(--text-main);
  letter-spacing: -0.3px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="dark"] .korix-card-title {
  color: #f8fafc;
}

.korix-card-xp-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #d97706;
  font-size: 11.5px;
  font-weight: 900;
  flex-shrink: 0;
}

[data-theme="dark"] .korix-card-xp-badge {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.25);
  color: #fbbf24;
}

/* Stats Row */
.korix-card-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(0, 0, 0, 0.025);
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 12px;
  padding: 7px 10px;
  position: relative;
  z-index: 2;
}

[data-theme="dark"] .korix-card-stats-row {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(255, 255, 255, 0.06);
}

.korix-card-stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 850;
  color: var(--text-main);
}

[data-theme="dark"] .korix-card-stat-item {
  color: #cbd5e1;
}

.korix-stat-emoji {
  font-size: 12px;
}

.korix-card-stat-divider {
  width: 1px;
  height: 12px;
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .korix-card-stat-divider {
  background: rgba(255, 255, 255, 0.1);
}

/* Launch Button */
.korix-card-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #ffffff;
  font-weight: 900;
  font-size: 12.5px;
  height: 38px;
  border-radius: 12px;
  position: relative;
  z-index: 2;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.25);
  transition: all 0.25s ease;
}

.quest-entry-card.korix-minimal-card:hover .korix-card-cta {
  background: linear-gradient(135deg, #0369a1, #0284c7);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.4);
}

.korix-card-cta i {
  font-size: 10px;
  transition: transform 0.2s ease;
}

[dir="ltr"] .korix-card-cta i {
  transform: rotate(180deg);
}

@media (max-width: 480px) {
  .quest-entry-card.korix-minimal-card {
    padding: 14px 14px 12px 14px;
    gap: 10px;
    border-radius: 20px;
  }
  .korix-card-icon {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }
  .korix-card-title {
    font-size: 13px;
  }
  .korix-card-stat-item {
    font-size: 10px;
    gap: 3px;
  }
  .korix-card-cta {
    height: 35px;
    font-size: 11.5px;
  }
}

/* Top Bar */
.korix-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  position: relative;
  z-index: 3;
}

.korix-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.korix-logo-icon {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, rgba(255, 60, 110, 0.25), rgba(255, 31, 86, 0.1));
  border: 1.5px solid rgba(255, 60, 110, 0.5);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #ff3c6e;
  box-shadow: 0 8px 20px rgba(255, 60, 110, 0.3);
}

.korix-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255, 60, 110, 0.15);
  border: 1px solid rgba(255, 60, 110, 0.35);
  color: #ff3c6e;
  font-size: 10px;
  font-weight: 900;
  margin-bottom: 3px;
}

.korix-title {
  font-size: 18px;
  font-weight: 950;
  color: #ffffff;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.korix-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.korix-action-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 900;
  color: #cbd5e1;
  backdrop-filter: blur(10px);
}

.korix-avatar-ring {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff3c6e, #7c3aed);
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.korix-avatar-ring i {
  width: 100%;
  height: 100%;
  background: #0f172a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
}

/* Hero Area */
.korix-hero-area {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 3;
  margin-bottom: 18px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px 14px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Avatar Selection Cluster */
.korix-avatar-cluster {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.korix-avatar-thumb {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #cbd5e1;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.korix-avatar-thumb.active {
  width: 44px;
  height: 44px;
  border: 2.5px solid #ff3c6e;
  box-shadow: 0 0 18px rgba(255, 60, 110, 0.6);
  color: #ff3c6e;
  background: rgba(255, 60, 110, 0.15);
  transform: scale(1.05);
}

/* Mascot Graphic */
.korix-mascot-container {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 140px;
}

.korix-pedestal-light {
  position: absolute;
  bottom: 0;
  width: 100px;
  height: 20px;
  background: radial-gradient(ellipse at center, rgba(0, 210, 255, 0.4), rgba(255, 60, 110, 0.25), transparent 70%);
  border-radius: 50%;
  filter: blur(4px);
}

.korix-mascot-img {
  width: 110px;
  height: auto;
  max-height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.5));
  transition: transform 0.4s ease;
}

.quest-entry-card.korix-style-card:hover .korix-mascot-img {
  transform: translateY(-5px) scale(1.05);
}

/* Radial Gauges Cluster */
.korix-gauges-cluster {
  display: flex;
  gap: 8px;
  align-items: center;
}

.korix-gauge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.korix-gauge-ring-wrap {
  position: relative;
  width: 46px;
  height: 46px;
  margin-bottom: 3px;
}

.korix-gauge-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.korix-gauge-svg .circle-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 3.5;
}

.korix-gauge-svg .circle-fill {
  fill: none;
  stroke-width: 3.8;
  stroke-linecap: round;
  transition: stroke-dasharray 1s ease;
}

.korix-gauge-svg .gold-stroke {
  stroke: #ffb800;
  filter: drop-shadow(0 0 6px rgba(255, 184, 0, 0.6));
}

.korix-gauge-svg .lime-stroke {
  stroke: #00ff88;
  filter: drop-shadow(0 0 6px rgba(0, 255, 136, 0.6));
}

.korix-gauge-svg .cyan-stroke {
  stroke: #00d2ff;
  filter: drop-shadow(0 0 6px rgba(0, 210, 255, 0.6));
}

.korix-gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.korix-gauge-val {
  font-size: 12px;
  font-weight: 950;
  color: #ffffff;
  line-height: 1.1;
}

.korix-gauge-lbl {
  font-size: 9px;
  font-weight: 800;
  color: #94a3b8;
  margin-top: 1px;
}

/* Hot Pink / Coral Launch CTA Button */
.korix-cta-launch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #ff3c6e 0%, #ff1f56 100%);
  color: #ffffff;
  font-weight: 950;
  font-size: 15px;
  padding: 13px 20px;
  border-radius: 18px;
  position: relative;
  z-index: 3;
  box-shadow: 0 10px 28px rgba(255, 60, 110, 0.45);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  letter-spacing: -0.2px;
}

.quest-entry-card.korix-style-card:hover .korix-cta-launch-btn {
  transform: scale(1.02);
  box-shadow: 0 14px 38px rgba(255, 60, 110, 0.65);
  background: linear-gradient(135deg, #ff4d7b 0%, #ff2b61 100%);
}

@media (max-width: 480px) {
  .korix-hero-area {
    gap: 6px;
    padding: 10px 8px;
  }
  .korix-gauges-cluster {
    gap: 4px;
  }
  .korix-gauge-ring-wrap {
    width: 40px;
    height: 40px;
  }
  .korix-mascot-img {
    width: 90px;
    max-height: 100px;
  }
}

/* Complete isolation for Immersive Game View - Hides top bar & bottom nav completely */
.quest-bar-hidden,
body.quest-active-portal .top-bar,
body.quest-active-portal .bottom-nav,
#main-app.quest-active-portal .top-bar,
#main-app.quest-active-portal .bottom-nav,
body:has(#page-quest.active) .top-bar,
body:has(#page-quest.active) .bottom-nav,
.app-container:has(#page-quest.active) .top-bar,
.app-container:has(#page-quest.active) .bottom-nav,
#page-quest.active ~ .bottom-nav,
#page-quest.active ~ .top-bar,
#main-app:has(#page-quest.active) .top-bar,
#main-app:has(#page-quest.active) .bottom-nav {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ── Quest Background Layer (GPU Composited, CSS Gradient, Zero Jank) ── */
#quest-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 99990;
  pointer-events: none;
  background: #09090b;
  /* CSS handles the smooth color transition natively on the GPU */
  transition: background 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: background;
  transform: translateZ(0);
  backface-visibility: hidden;
}

body.quest-active-portal,
#main-app.quest-active-portal,
body:has(#page-quest.active),
#main-app:has(#page-quest.active) {
  background: #09090b !important;
}

/* ── Fullscreen Immersive Game View ── */
#page-quest.active {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 10px 10px 120px !important;
  margin: 0 !important;
  /* Fully transparent — quest-bg div handles all background rendering */
  background: transparent !important;
  -webkit-overflow-scrolling: touch !important;
  /* GPU compositing for scroll — critical for mobile smoothness */
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform;
}

/* Floating Sticky Header Exit Bar */
.quest-top-sticky-bar {
  position: sticky;
  top: 10px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  margin-bottom: 20px;
}

.quest-exit-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.35), rgba(220, 38, 38, 0.2));
  border: 1.5px solid rgba(239, 68, 68, 0.6);
  color: #fca5a5;
  font-weight: 950;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.quest-exit-btn:hover {
  background: rgba(239, 68, 68, 0.65);
  color: #ffffff;
  transform: scale(1.05);
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.5);
}

/* ── Quest Launcher / Splash Screen Styles (Calm & Uncluttered) ── */
.quest-launcher-container {
  max-width: 520px;
  margin: 0 auto;
  padding: 8px 6px 36px;
  direction: rtl;
}

[dir="ltr"] .quest-launcher-container {
  direction: ltr;
}

.quest-top-sticky-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 4px 12px;
  margin-bottom: 8px;
}

.quest-top-info-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.quest-top-app-icon {
  width: 34px;
  height: 34px;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fbbf24;
  font-size: 15px;
  flex-shrink: 0;
}

.quest-top-app-title {
  font-size: 13.5px;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.2;
}

.quest-top-app-subtitle {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 600;
}

.quest-top-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.quest-hdr-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.quest-hdr-icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.quest-exit-btn {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.quest-exit-btn:hover {
  background: rgba(239, 68, 68, 0.35);
  color: #ffffff;
}

/* Compact Profile & Stats Card */
.quest-launcher-hero {
  position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.04) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quest-launcher-profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quest-launcher-avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.quest-launcher-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #1e1b4b;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.9);
}

.quest-launcher-badge-ring {
  position: absolute;
  bottom: -1px;
  right: -1px;
  background: #10b981;
  color: #fff;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  border: 1.5px solid #0f172a;
}

.quest-launcher-user-info {
  flex: 1;
  min-width: 0;
}

.quest-launcher-name {
  font-size: 15px;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.2;
  margin-bottom: 2px;
}

.quest-launcher-subtitle {
  font-size: 11px;
  color: #fbbf24;
  font-weight: 700;
}

.quest-launcher-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 6px 8px;
}

.quest-launcher-stat-chip {
  display: flex;
  align-items: center;
  gap: 5px;
}

.quest-stat-icon {
  font-size: 12px;
}

.quest-stat-val {
  font-size: 11px;
  font-weight: 850;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
}

.quest-launcher-stat-divider {
  width: 1px;
  height: 12px;
  background: rgba(255, 255, 255, 0.1);
}

/* Program Selector Title */
.quest-program-selector-title {
  font-size: 13px;
  font-weight: 850;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quest-tracks-badge {
  font-size: 10px;
  font-weight: 800;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Program Selector Cards List */
.quest-program-cards-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quest-program-card {
  position: relative;
  background: rgba(15, 35, 30, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 11px 13px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: right;
}

[dir="ltr"] .quest-program-card {
  text-align: left;
}

.quest-program-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(15, 35, 30, 0.65);
}

.quest-program-card.selected {
  border-color: rgba(56, 189, 248, 0.45);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(14, 165, 233, 0.15) 100%);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25), 0 0 15px rgba(56, 189, 248, 0.1);
}

.quest-program-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #38bdf8;
  transition: transform 0.25s ease;
}

.quest-program-card.cbt .quest-program-card-icon { color: #38bdf8; background: rgba(56, 189, 248, 0.12); border-color: rgba(56, 189, 248, 0.25); }
.quest-program-card.dbt .quest-program-card-icon { color: #c084fc; background: rgba(192, 132, 252, 0.12); border-color: rgba(192, 132, 252, 0.25); }
.quest-program-card.act .quest-program-card-icon { color: #34d399; background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.25); }
.quest-program-card.emdr .quest-program-card-icon { color: #22d3ee; background: rgba(34, 211, 238, 0.12); border-color: rgba(34, 211, 238, 0.25); }
.quest-program-card.cft .quest-program-card-icon { color: #fb7185; background: rgba(251, 113, 133, 0.12); border-color: rgba(251, 113, 133, 0.25); }
.quest-program-card.rel .quest-program-card-icon { color: #c084fc; background: rgba(192, 132, 252, 0.12); border-color: rgba(192, 132, 252, 0.25); }

.quest-program-card.selected .quest-program-card-icon {
  transform: scale(1.05);
}

.quest-program-card-info {
  flex: 1;
  min-width: 0;
}

.quest-program-card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.quest-program-card-title {
  font-size: 13.5px;
  font-weight: 850;
  color: #ffffff;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quest-track-code {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
}

.quest-program-card-radio {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.quest-program-card.selected .quest-program-card-radio {
  color: #38bdf8;
}

.quest-program-card-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 600;
  line-height: 1.35;
  margin: 2px 0 6px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quest-program-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.quest-program-progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.quest-program-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.quest-program-progress-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9.5px;
  font-weight: 800;
}

.quest-prog-count {
  color: rgba(255, 255, 255, 0.7);
}

.quest-prog-pct {
  color: #fbbf24;
}

/* Launch Button */
.quest-launch-btn {
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #ffffff;
  font-weight: 900;
  font-size: 13.5px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
  transition: all 0.25s ease;
  margin-top: 14px;
}

.quest-launch-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
}

.quest-launch-btn i {
  font-size: 11px;
}

[dir="ltr"] .quest-launch-btn i {
  transform: rotate(180deg);
}

/* ── Quest Stats Bar ── */
.quest-stats-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}
.quest-stat-chip {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 900;
}
.quest-stat-xp {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(245, 158, 11, 0.05));
  color: #f59e0b;
  border: 1.5px solid rgba(251, 191, 36, 0.15);
}
.quest-stat-streak {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
  color: #ef4444;
  border: 1.5px solid rgba(239, 68, 68, 0.15);
}
.quest-stat-stars {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(99, 102, 241, 0.05));
  color: #6366f1;
  border: 1.5px solid rgba(99, 102, 241, 0.15);
}

/* ── Program Tabs (CBT/DBT) ── */
.quest-program-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: rgba(0, 0, 0, 0.03);
  padding: 5px;
  border-radius: 16px;
}
.quest-program-tab {
  flex: 1;
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  font-family: 'Cairo', sans-serif;
  font-weight: 900;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  color: #94a3b8;
}
.quest-program-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 15px rgba(var(--primary-rgb), 0.25);
}
.quest-program-tab:not(.active):hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-main);
}
.quest-program-tab.locked {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Quest Map (Winding Path) ── */
.quest-map {
  position: relative;
  padding: 30px 0 0;
}

/* World Section */
.quest-world {
  position: relative;
  margin-bottom: 30px;
}
.quest-world-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px 18px;
  border-radius: 18px;
  position: relative;
  overflow: hidden;
}
.quest-world-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: inherit;
  opacity: 0.06;
  border-radius: inherit;
}
.quest-world-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.quest-world-info {
  flex: 1;
  position: relative;
  z-index: 1;
}
.quest-world-title {
  font-size: 15px;
  font-weight: 950;
  color: var(--text-main);
}
.quest-world-progress-text {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 800;
  margin-top: 2px;
}
.quest-world-progress-bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 8px;
  position: relative;
  z-index: 1;
}
.quest-world-progress-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Level Nodes ── */
.quest-levels-path {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* Connecting Line */
.quest-level-connector {
  width: 3px;
  height: 30px;
  border-radius: 2px;
  background: #e2e8f0;
  transition: background 0.5s ease;
}
.quest-level-connector.completed {
  background: linear-gradient(180deg, var(--quest-color, #6366f1), var(--quest-color, #6366f1));
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

/* Level Row — zigzag positioning */
.quest-level-row {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0 10px;
}
.quest-level-row:nth-child(4n+1) {
  justify-content: flex-start;
  padding-right: 25%;
}
.quest-level-row:nth-child(4n+3) {
  justify-content: flex-end;
  padding-left: 25%;
}
.quest-level-row:nth-child(even) {
  justify-content: center;
}

/* Level Node */
.quest-level-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  -webkit-tap-highlight-color: transparent;
}
.quest-level-node:hover {
  transform: scale(1.05);
}
.quest-level-node:active {
  transform: scale(0.95);
}

.quest-level-circle {
  width: 64px;
  height: 64px;
  aspect-ratio: 1 / 1;
  border-radius: 50% !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 950;
  position: relative;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
  flex-shrink: 0;
}

/* Level States */
.quest-level-node.locked .quest-level-circle {
  background: #f1f5f9;
  color: #cbd5e1;
  border: 3px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}
.quest-level-node.locked {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

.quest-level-node.available .quest-level-circle {
  background: linear-gradient(135deg, var(--quest-color, #6366f1), var(--quest-color-dark, #4f46e5));
  color: #fff;
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 0 0 4px var(--quest-color, #6366f1),
    0 8px 25px rgba(99, 102, 241, 0.4);
  animation: questPulse 2s ease-in-out infinite;
}

.quest-level-node.completed .quest-level-circle {
  background: linear-gradient(135deg, var(--quest-color, #6366f1), var(--quest-color-dark, #4f46e5));
  color: #fff;
  border: 3px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.25);
}

.quest-level-node.boss .quest-level-circle {
  width: 76px;
  height: 76px;
  font-size: 28px;
  border-radius: 20px;
}

/* Level Label */
.quest-level-label {
  margin-top: 8px;
  font-size: 10px;
  font-weight: 900;
  color: var(--text-main);
  text-align: center;
  max-width: 90px;
  line-height: 1.3;
}
.quest-level-node.locked .quest-level-label {
  color: #cbd5e1;
}

/* Stars Display */
.quest-level-stars {
  display: flex;
  gap: 2px;
  margin-top: 4px;
}
.quest-level-stars i {
  font-size: 10px;
  color: #e2e8f0;
  transition: all 0.3s ease;
}
.quest-level-stars i.earned {
  color: #fbbf24;
  filter: drop-shadow(0 1px 3px rgba(251, 191, 36, 0.5));
}

/* Lock Icon */
.quest-lock-icon {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  background: #94a3b8;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  z-index: 3;
  border: 2px solid #fff;
}

/* Checkmark for completed */
.quest-check-icon {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  background: #10b981;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  z-index: 3;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

/* ── Boss Level ── */
.quest-boss-node {
  margin: 15px 0;
}
.quest-boss-node .quest-level-circle {
  background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
  color: #1e1b4b !important;
  border: 3px solid rgba(255, 255, 255, 0.9) !important;
}
.quest-boss-node.locked .quest-level-circle {
  background: #f1f5f9 !important;
  color: #cbd5e1 !important;
  border: 3px solid #e2e8f0 !important;
  box-shadow: none !important;
}

/* ── Pulse Animation ── */
@keyframes questPulse {
  0%, 100% {
    box-shadow:
      0 0 0 4px var(--quest-color, #6366f1),
      0 8px 25px rgba(99, 102, 241, 0.4);
  }
  50% {
    box-shadow:
      0 0 0 8px rgba(99, 102, 241, 0.15),
      0 12px 35px rgba(99, 102, 241, 0.5);
  }
}

/* ── Badges Section ── */
.quest-badges-section {
  margin-top: 30px;
  padding: 0 5px;
}
.quest-badges-title {
  font-size: 15px;
  font-weight: 950;
  color: var(--text-main);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.quest-badges-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.quest-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
  border: 1.5px solid rgba(0, 0, 0, 0.04);
  transition: all 0.3s ease;
}
.quest-badge.earned {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(245, 158, 11, 0.04));
  border-color: rgba(251, 191, 36, 0.2);
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.1);
}
.quest-badge.locked {
  opacity: 0.35;
  filter: grayscale(1);
}
.quest-badge-emoji {
  font-size: 28px;
  line-height: 1;
}
.quest-badge-name {
  font-size: 9px;
  font-weight: 900;
  color: var(--text-main);
  text-align: center;
  line-height: 1.3;
}

/* ── XP Popup Animation ── */
.quest-xp-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10010;
  pointer-events: none;
  animation: xpPopup 1.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.quest-xp-popup-inner {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1e1b4b;
  font-size: 28px;
  font-weight: 950;
  padding: 16px 32px;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(251, 191, 36, 0.5);
  white-space: nowrap;
}
@keyframes xpPopup {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
  40% {
    transform: translate(-50%, -50%) scale(1);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -70%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -120%) scale(0.8);
  }
}

/* ── Level Up Celebration ── */
.quest-level-up-overlay {
  position: fixed;
  inset: 0;
  z-index: 10009;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.quest-level-up-overlay.show {
  opacity: 1;
  pointer-events: auto;
}
.quest-level-up-card {
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  border: 2px solid rgba(251, 191, 36, 0.3);
  border-radius: 30px;
  padding: 40px;
  text-align: center;
  color: #fff;
  max-width: 350px;
  width: 90%;
  animation: levelUpBounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.quest-level-up-emoji {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 16px;
}
.quest-level-up-title {
  font-size: 24px;
  font-weight: 950;
  color: #fbbf24;
  margin-bottom: 8px;
}
.quest-level-up-desc {
  font-size: 14px;
  opacity: 0.8;
  font-weight: 700;
  line-height: 1.6;
  margin-bottom: 20px;
}
.quest-level-up-xp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 16px;
  font-weight: 950;
  margin-bottom: 20px;
  border: 1px solid rgba(251, 191, 36, 0.2);
}
.quest-level-up-stars {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}
.quest-level-up-stars i {
  font-size: 28px;
  color: #fbbf24;
  filter: drop-shadow(0 2px 6px rgba(251, 191, 36, 0.6));
  animation: starSpin 0.8s ease backwards;
}
.quest-level-up-stars i:nth-child(2) { animation-delay: 0.2s; }
.quest-level-up-stars i:nth-child(3) { animation-delay: 0.4s; }

.quest-level-up-btn {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1e1b4b;
  border: none;
  padding: 14px 40px;
  border-radius: 16px;
  font-family: 'Cairo', sans-serif;
  font-size: 15px;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(251, 191, 36, 0.4);
  transition: all 0.3s ease;
}
.quest-level-up-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px rgba(251, 191, 36, 0.5);
}

@keyframes levelUpBounce {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes starSpin {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ── Confetti Canvas ── */
#quest-confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 10011;
  pointer-events: none;
}

/* ── Music Toggle ── */
.quest-music-btn {
  position: fixed;
  bottom: 80px;
  left: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(var(--primary-rgb), 0.1);
  border: 1.5px solid rgba(var(--primary-rgb), 0.15);
  color: var(--primary);
  font-size: 16px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
}
.quest-music-btn.visible {
  display: flex;
}
.quest-music-btn:hover {
  transform: scale(1.1);
  background: rgba(var(--primary-rgb), 0.15);
}
.quest-music-btn.muted {
  opacity: 0.5;
}

/* ── No Program Assigned Message ── */
.quest-no-program {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.quest-no-program-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}
.quest-no-program-title {
  font-size: 18px;
  font-weight: 950;
  color: var(--text-main);
  margin-bottom: 8px;
}
.quest-no-program-text {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.8;
}

/* ── Responsive ── */
@media (max-width: 400px) {
  .quest-badges-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .quest-level-circle {
    width: 56px;
    height: 56px;
    font-size: 18px;
  }
  .quest-level-node.boss .quest-level-circle {
    width: 66px;
    height: 66px;
    font-size: 24px;
  }
  .quest-entry-stats {
    flex-wrap: wrap;
  }
  .quest-entry-stat {
    min-width: calc(50% - 6px);
  }
}

@media (min-width: 600px) {
  .quest-level-circle {
    width: 72px;
    height: 72px;
    font-size: 26px;
  }
  .quest-level-node.boss .quest-level-circle {
    width: 86px;
    height: 86px;
    font-size: 32px;
  }
  .quest-level-label {
    font-size: 11px;
    max-width: 110px;
  }
}

/* ── Level Quest Wizard & Exercise Overlays (Always Render Above Game View) ── */
#quest-wizard-modal,
#imagery-overlay,
#breathing-overlay,
.breathing-overlay,
.mood-modal-overlay,
.cbt-modal-overlay,
.interactive-modal,
.swal2-container.swal2-dark-custom,
.swal2-container,
body.quest-active-portal #quest-wizard-modal,
body.quest-active-portal #imagery-overlay,
body.quest-active-portal #breathing-overlay,
body.quest-active-portal .swal2-container,
body:has(#page-quest.active) #quest-wizard-modal,
body:has(#page-quest.active) #imagery-overlay,
body:has(#page-quest.active) #breathing-overlay,
body:has(#page-quest.active) .swal2-container {
  z-index: 999999 !important;
}

#quest-wizard-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(9, 19, 29, 0.88) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  align-items: center !important;
  justify-content: center !important;
}

#quest-wizard-modal .quest-wizard-card,
#quest-wizard-modal .quest-wizard-card:hover,
#quest-wizard-modal .quest-wizard-card:focus,
#quest-wizard-modal .quest-wizard-card:active,
.quest-wizard-card,
.quest-wizard-card:hover {
  background: #0f172a !important;
  background-color: #0f172a !important;
  background-image: linear-gradient(135deg, #0f172a, #1e1b4b) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1.5px solid rgba(251, 191, 36, 0.35) !important;
  border-radius: 28px !important;
  padding: 28px !important;
  color: #ffffff !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7) !important;
  transform: none !important;
}

#quest-wizard-modal .qw-tutorial-box,
#quest-wizard-modal .qw-tutorial-box:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

#quest-wizard-modal .qw-tutorial-text,
#quest-wizard-modal .qw-tutorial-text * {
  color: rgba(255, 255, 255, 0.9) !important;
}

#quest-wizard-modal .qw-bullet-item,
#quest-wizard-modal .qw-bullet-item:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  border-right-color: #fbbf24 !important;
  color: #ffffff !important;
}

#quest-wizard-modal .qw-bullet-item span {
  color: rgba(255, 255, 255, 0.9) !important;
}

#quest-wizard-modal .qw-quiz-question {
  color: #ffffff !important;
}

#quest-wizard-modal .qw-quiz-opt {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
}

#quest-wizard-modal .qw-quiz-opt:hover {
  background: rgba(251, 191, 36, 0.25) !important;
  border-color: #fbbf24 !important;
  color: #ffffff !important;
}

#quest-wizard-modal .qw-mission-box,
#quest-wizard-modal .qw-mission-box:hover {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(251, 191, 36, 0.4) !important;
  color: #ffffff !important;
}

#quest-wizard-modal .qw-mission-counter {
  color: #ffffff !important;
}

/* Unified Embedded Game Exercise Form Styles */
.qw-embedded-form {
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(251, 191, 36, 0.35);
  border-radius: 20px;
  padding: 18px;
  margin-top: 15px;
  text-align: right;
  direction: rtl;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.qw-form-intro {
  font-size: 14.5px;
  font-weight: 950;
  color: #fbbf24;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px dashed rgba(251, 191, 36, 0.25);
  padding-bottom: 8px;
}

.qw-field-group {
  margin-bottom: 12px;
}

.qw-field-group label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: #e2e8f0;
  margin-bottom: 5px;
}

.qw-input,
.qw-textarea,
.qw-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.4) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 12px !important;
  color: #ffffff !important;
  padding: 9px 12px !important;
  font-size: 12.5px !important;
  font-family: 'Cairo', sans-serif !important;
  direction: rtl !important;
  transition: all 0.25s ease !important;
  box-sizing: border-box !important;
}

.qw-input:focus,
.qw-textarea:focus,
.qw-select:focus {
  outline: none !important;
  border-color: #fbbf24 !important;
  background: rgba(0, 0, 0, 0.55) !important;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.3) !important;
}

.qw-textarea {
  min-height: 70px;
  resize: vertical;
}

.qw-submit-btn {
  width: 100%;
  background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
  color: #1e1b4b !important;
  font-weight: 950 !important;
  font-size: 14px !important;
  padding: 12px 18px !important;
  border-radius: 14px !important;
  border: none !important;
  cursor: pointer !important;
  margin-top: 10px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.3) !important;
  transition: all 0.25s ease !important;
}

.qw-submit-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 12px 25px rgba(245, 158, 11, 0.45) !important;
}

.quest-wizard-tabs {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px;
  border-radius: 16px;
  margin-bottom: 24px;
}
.quest-wizard-tab {
  flex: 1;
  text-align: center;
  padding: 10px 4px;
  font-size: 11px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.quest-wizard-tab span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}
.quest-wizard-tab.active {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1e1b4b;
  font-weight: 950;
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.3);
}
.quest-wizard-tab.active span {
  background: #1e1b4b;
  color: #fbbf24;
}

.qw-step-pane {
  display: none;
  animation: qwFade 0.3s ease-out forwards;
}
.qw-step-pane.active {
  display: block;
}
@keyframes qwFade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.qw-tutorial-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 16px;
  text-align: right;
  direction: rtl;
}
.qw-tutorial-title {
  font-size: 17px;
  font-weight: 950;
  color: #fbbf24;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.qw-tutorial-text {
  font-size: 13px;
  line-height: 1.8;
  opacity: 0.88;
  margin-bottom: 14px;
}
.qw-bullet-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.qw-bullet-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 1.6;
  opacity: 0.85;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  border-radius: 12px;
  border-right: 3px solid #fbbf24;
}

/* Quiz Styles */
.qw-quiz-box {
  margin-bottom: 16px;
  text-align: right;
  direction: rtl;
}
.qw-quiz-question {
  font-size: 14px;
  font-weight: 900;
  color: #fff;
  margin-bottom: 12px;
}
.qw-quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.qw-quiz-opt {
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: right;
}
.qw-quiz-opt:hover {
  background: rgba(251, 191, 36, 0.2) !important;
  border-color: #fbbf24 !important;
  color: #ffffff !important;
}
.quest-program-tab:not(.active):hover {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
}
.quest-wizard-tab:not(.active):hover {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
}
.quest-level-node:hover .quest-level-circle {
  transform: scale(1.1);
  box-shadow: 0 10px 30px rgba(251, 191, 36, 0.5) !important;
}
.quest-level-node:hover .quest-level-label {
  color: #fbbf24 !important;
}
.quest-badge:hover {
  background: rgba(251, 191, 36, 0.15) !important;
  border-color: #fbbf24 !important;
  color: #ffffff !important;
}
.qw-quiz-opt.correct {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: #10b981 !important;
  color: #10b981 !important;
}
.qw-quiz-opt.incorrect {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: #ef4444 !important;
  color: #ef4444 !important;
}
.qw-quiz-feedback {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
  display: none;
  animation: qwFade 0.3s ease;
  color: #ffffff;
}
.qw-quiz-feedback.show {
  display: block;
}
.qw-quiz-feedback.correct {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399 !important;
}
.qw-quiz-feedback.incorrect {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171 !important;
}

/* Mission Progress */
.qw-mission-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px dashed rgba(251, 191, 36, 0.3);
  border-radius: 20px;
  padding: 20px;
  text-align: center;
  margin-bottom: 20px;
}
.qw-mission-title {
  font-size: 16px;
  font-weight: 950;
  color: #fbbf24;
  margin-bottom: 6px;
}
.qw-mission-subtitle {
  font-size: 12px;
  opacity: 0.7;
  margin-bottom: 16px;
}
.qw-mission-counter {
  font-size: 32px;
  font-weight: 950;
  color: #fff;
  line-height: 1;
  margin-bottom: 10px;
}
.qw-mission-bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}
.qw-mission-fill {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, #fbbf24, #10b981);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.4);
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Interactive Bullet Action Buttons (فهمت / لم أفهم) ── */
.qw-bullet-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.qw-bullet-card.understood {
  border-color: rgba(16, 185, 129, 0.5) !important;
  background: rgba(16, 185, 129, 0.08) !important;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.15);
}
.qw-bullet-text-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.7;
  color: #fff;
  font-weight: 700;
}
.qw-bullet-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}
.qw-action-btn {
  padding: 7px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Cairo', sans-serif;
}
.qw-action-btn:hover {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #fff !important;
}
.qw-action-btn.btn-understand.active {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #fff !important;
  border-color: #10b981 !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}
.qw-action-btn.btn-not-understand.active {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #fff !important;
  border-color: #f59e0b !important;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}
.qw-elaboration-box {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  font-size: 12px;
  line-height: 1.7;
  font-weight: 800;
  animation: qwFade 0.3s ease-out;
}

/* Tab badges for step status */
.qw-tab-badge-done {
  color: #10b981;
  font-weight: 900;
  margin-right: 3px;
}
.qw-tab-badge-doing {
  color: #fbbf24;
  font-weight: 900;
  margin-right: 3px;
}
.qw-quiz-followup-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(99, 102, 241, 0.1);
  border: 1.5px dashed rgba(99, 102, 241, 0.4);
  animation: qwFade 0.3s ease-out;
}
.qw-quiz-followup-title {
  font-size: 13px;
  font-weight: 900;
  color: #818cf8;
  margin-bottom: 10px;
}

/* ── COMPREHENSIVE RESPONSIVE STYLES FOR MOBILE & SMALL SCREENS ── */
@media (max-width: 640px) {
  #page-quest.active {
    padding: 6px 8px 100px !important;
  }

  .quest-top-sticky-bar {
    top: 6px;
    padding: 8px 10px;
    margin-bottom: 14px;
    border-radius: 16px;
    gap: 6px;
  }

  .quest-music-toggle-btn,
  .quest-exit-btn {
    padding: 6px 10px !important;
    font-size: 11px !important;
    border-radius: 10px !important;
    gap: 4px !important;
  }

  .quest-launcher-container {
    padding: 6px 4px 30px;
  }

  .quest-launcher-hero {
    padding: 18px 14px;
    border-radius: 22px;
    margin-bottom: 16px;
  }

  .quest-launcher-avatar-wrap {
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
  }

  .quest-launcher-avatar {
    font-size: 28px;
  }

  .quest-launcher-name {
    font-size: 18px;
  }

  .quest-launcher-subtitle {
    font-size: 11px;
    margin-bottom: 12px;
  }

  .quest-launcher-stats-grid {
    gap: 6px;
    margin-top: 10px;
  }

  .quest-launcher-stat-box {
    padding: 10px 4px;
    border-radius: 14px;
  }

  .quest-launcher-stat-val {
    font-size: 13px;
    font-weight: 900;
  }

  .quest-launcher-stat-lbl {
    font-size: 9px;
    margin-top: 2px;
  }

  .quest-program-selector-title {
    font-size: 13px;
    margin-bottom: 10px;
  }

  .quest-program-card {
    padding: 14px 12px;
    gap: 12px;
    border-radius: 20px;
    margin-bottom: 10px;
  }

  .quest-program-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    font-size: 20px;
  }

  .quest-program-card-title {
    font-size: 14px;
  }

  .quest-program-card-desc {
    font-size: 10px;
    line-height: 1.35;
    margin-bottom: 4px;
  }

  .quest-program-card-radio {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }

  .quest-launch-btn {
    padding: 14px;
    font-size: 14px;
    border-radius: 16px;
  }

  /* Map & Level Nodes on Mobile */
  .quest-level-node {
    width: auto;
    height: auto;
    max-width: 100px;
  }

  .quest-level-circle {
    width: 58px !important;
    height: 58px !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
    font-size: 20px;
  }

  .quest-level-node.boss .quest-level-circle {
    width: 68px !important;
    height: 68px !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 18px !important;
    flex-shrink: 0 !important;
    font-size: 24px;
  }

  .quest-level-label {
    font-size: 11px;
  }

  .quest-world-header {
    padding: 10px 12px;
    border-radius: 16px;
  }

  .quest-world-title {
    font-size: 13px;
  }

  .quest-world-icon {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
}

@media (max-width: 420px) {
  .quest-top-sticky-bar {
    padding: 6px 8px;
  }

  .quest-music-toggle-btn .music-btn-text,
  .quest-exit-btn .exit-btn-text {
    font-size: 10px;
  }

  .quest-launcher-stat-val {
    font-size: 12px;
  }

  .quest-launcher-stat-lbl {
    font-size: 8px;
  }

  .quest-program-card-title {
    font-size: 13px;
  }

  .quest-program-card-desc {
    font-size: 9.5px;
  }
}

