/* ===================================================
   POTENCIA DIGITAL — Global Styles
   Inspired by Canva / Lienzo Creativo reference
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700;800;900&family=Nunito+Sans:wght@300;400;500;600;700;800&display=swap');

/* --- Variables --- */
:root {
  --bg: #F8F7F4;
  --bg-soft: #F1EFE9;
  --white: #FFFFFF;
  --border: #E8E6E1;
  --shadow: 0 1px 4px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.1), 0 2px 6px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);

  --text: #1A1817;
  --text-muted: #6B6460;
  --text-light: #A09890;

  --primary: #7C3AED;
  --primary-soft: #EDE9FE;
  --primary-dark: #5B21B6;

  --pink: #EC4899;
  --pink-soft: #FDF2F8;
  --amber: #F59E0B;
  --amber-soft: #FFFBEB;
  --cyan: #06B6D4;
  --cyan-soft: #ECFEFF;
  --emerald: #10B981;
  --emerald-soft: #ECFDF5;
  --violet: #8B5CF6;
  --violet-soft: #F5F3FF;
  --orange: #F97316;
  --orange-soft: #FFF7ED;

  --radius: 14px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --radius-pill: 999px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* --- Typography --- */
h1, h2, h3, h4 { font-family: 'Nunito', sans-serif; }
h1 { font-size: 2rem; font-weight: 800; line-height: 1.2; }
h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.3; }
h3 { font-size: 1.125rem; font-weight: 700; line-height: 1.4; }
h4 { font-size: 1rem; font-weight: 700; }
p  { color: var(--text-muted); }

/* --- Navbar --- */
.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text);
}
.navbar-brand .brand-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.navbar-spacer { flex: 1; }
.navbar-right { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--primary), var(--pink));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.btn-ghost {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(124,58,237,0.3); }
.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: var(--white);
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-soft); }

.btn-soft {
  background: var(--primary-soft);
  color: var(--primary);
}
.btn-soft:hover { background: #DDD6FE; }

.btn-white {
  background: var(--white);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-white:hover { background: var(--bg-soft); }

.btn-lg { padding: 14px 28px; font-size: 15px; border-radius: var(--radius); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-full { width: 100%; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* --- Cards --- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-clickable { cursor: pointer; }
.card-clickable:hover { transform: translateY(-2px); }

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge::before { content: '●'; font-size: 8px; }

.badge-pink    { background: var(--pink-soft);    color: var(--pink); }
.badge-amber   { background: var(--amber-soft);   color: #B45309; }
.badge-cyan    { background: var(--cyan-soft);    color: #0E7490; }
.badge-violet  { background: var(--violet-soft);  color: var(--violet); }
.badge-emerald { background: var(--emerald-soft); color: #065F46; }
.badge-orange  { background: var(--orange-soft);  color: #C2410C; }
.badge-primary { background: var(--primary-soft); color: var(--primary); }

/* --- Progress Bar --- */
.progress-wrap {
  height: 6px;
  background: var(--bg-soft);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--primary), var(--pink));
  transition: width 0.5s ease;
}

/* --- Form Inputs --- */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text); }
.form-input {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}
.form-input::placeholder { color: var(--text-light); }
.form-textarea {
  resize: vertical;
  min-height: 100px;
}
.form-hint { font-size: 12px; color: var(--text-muted); }
.form-error { font-size: 12px; color: #EF4444; }

/* --- Alert / Toast --- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-success { background: var(--emerald-soft); color: #065F46; border: 1px solid #A7F3D0; }
.alert-info    { background: var(--primary-soft); color: var(--primary-dark); border: 1px solid #DDD6FE; }

/* --- Loading Spinner --- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.spinner-dark {
  border-color: rgba(124,58,237,0.3);
  border-top-color: var(--primary);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Section / Layout --- */
.page-wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { padding: 32px 0; }

/* --- Dashboard Grid --- */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

/* --- Course Card --- */
.course-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.course-card:hover { }

.course-card-header {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  position: relative;
}
.course-card-body { padding: 18px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.course-card-footer { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }

.course-meta { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-muted); }
.course-meta span { display: flex; align-items: center; gap: 4px; }

/* --- Lesson Sidebar --- */
.lesson-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 60px);
}
.lesson-sidebar {
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}
.lesson-sidebar-header { padding: 0 20px 16px; border-bottom: 1px solid var(--border); }
.lesson-sidebar-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.lesson-sidebar-sub { font-size: 12px; color: var(--text-muted); }

.lesson-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  cursor: pointer;
  transition: background 0.1s;
  border-left: 3px solid transparent;
  font-size: 14px;
  color: var(--text-muted);
}
.lesson-nav-item:hover { background: var(--bg); }
.lesson-nav-item.active {
  background: var(--primary-soft);
  border-left-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.lesson-nav-item.completed { color: var(--emerald); }

.lesson-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: transparent;
  transition: all 0.2s;
}
.lesson-check.done {
  background: var(--emerald);
  border-color: var(--emerald);
  color: white;
}
.lesson-check.current {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

/* --- Lesson Content --- */
.lesson-content { padding: 40px; max-width: 760px; }
.lesson-content h1 { margin-bottom: 8px; }
.lesson-content h2 { margin: 28px 0 12px; color: var(--text); }
.lesson-content h3 { margin: 20px 0 8px; color: var(--text); }
.lesson-content p  { margin-bottom: 16px; font-size: 15px; line-height: 1.7; }
.lesson-content ul, .lesson-content ol {
  padding-left: 20px;
  margin-bottom: 16px;
}
.lesson-content li { margin-bottom: 6px; color: var(--text-muted); font-size: 15px; }

/* --- Step Navigator (within lesson) --- */
.step-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
}
.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.2s;
}
.step-dot.active { background: var(--primary); width: 24px; border-radius: 4px; }
.step-dot.done   { background: var(--emerald); }

/* --- Exercise Box --- */
.exercise-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 24px 0;
}
.exercise-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.exercise-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.exercise-desc  { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }

/* Multiple choice */
.options-list { display: flex; flex-direction: column; gap: 10px; }
.option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
  font-weight: 500;
}
.option-item:hover  { border-color: var(--primary); background: var(--primary-soft); }
.option-item.selected { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.option-item.correct  { border-color: var(--emerald); background: var(--emerald-soft); color: #065F46; }
.option-item.wrong    { border-color: #EF4444; background: #FEF2F2; color: #991B1B; }
.option-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: all 0.15s;
}
.option-item.selected .option-radio { border-color: var(--primary); background: var(--primary); }
.option-item.correct .option-radio  { border-color: var(--emerald); background: var(--emerald); }

/* Feedback */
.feedback-box {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  margin-top: 12px;
  display: none;
}
.feedback-box.show { display: block; animation: fadeIn 0.3s ease; }
.feedback-correct { background: var(--emerald-soft); color: #065F46; border: 1px solid #A7F3D0; }
.feedback-wrong   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }

/* Fill blank */
.fill-wrap { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.fill-blank {
  border: none;
  border-bottom: 2px solid var(--primary);
  background: transparent;
  padding: 2px 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  min-width: 120px;
  text-align: center;
}
.fill-blank:focus { outline: none; }

/* Prompt builder */
.prompt-builder {
  background: #1A1817;
  border-radius: var(--radius-sm);
  padding: 20px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #E2E8F0;
  line-height: 1.8;
}
.prompt-var {
  display: inline-block;
  background: rgba(124,58,237,0.3);
  border: 1px solid var(--primary);
  border-radius: 4px;
  padding: 1px 8px;
  color: #C4B5FD;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.1s;
}
.prompt-var:hover { background: rgba(124,58,237,0.5); }

/* Tooltip */
.tooltip-wrap { position: relative; display: inline-flex; }
.tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.tooltip-wrap:hover .tooltip { opacity: 1; }

/* --- Stat Card --- */
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 4px;
}
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--text); }
.stat-label { font-size: 13px; color: var(--text-muted); }

/* --- Welcome Banner --- */
.welcome-banner {
  background: linear-gradient(135deg, var(--primary) 0%, #6D28D9 40%, var(--pink) 100%);
  border-radius: var(--radius);
  padding: 28px 32px;
  color: white;
  position: relative;
  overflow: hidden;
  margin-bottom: 32px;
}
.welcome-banner::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.welcome-banner::before {
  content: '';
  position: absolute;
  right: 80px;
  bottom: -60px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.welcome-banner h2 { color: white; font-size: 1.4rem; margin-bottom: 4px; }
.welcome-banner p  { color: rgba(255,255,255,0.85); margin-bottom: 16px; }

/* --- Section Header --- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-header h2 { color: var(--text); font-size: 1.1rem; }

/* --- Divider --- */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* --- Chip / Tag --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-soft);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* --- Login / Auth page --- */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #F8F7F4 0%, #EDE9FE 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--white);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.auth-logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.auth-logo-name { font-size: 1.2rem; font-weight: 800; }
.auth-logo-tagline { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.auth-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 4px; }
.auth-sub { font-size: 14px; color: var(--text-muted); margin-bottom: 28px; }
.auth-footer { margin-top: 20px; text-align: center; font-size: 13px; color: var(--text-muted); }
.auth-footer a { color: var(--primary); font-weight: 600; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-light);
  font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}

/* --- Admin page --- */
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg); }

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-fade { animation: fadeIn 0.3s ease forwards; }
.animate-slide { animation: slideUp 0.4s ease forwards; }

/* --- Completion overlay --- */
.completion-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  animation: fadeIn 0.3s ease;
}
.completion-card {
  background: var(--white);
  border-radius: 20px;
  padding: 48px 40px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.4s ease;
}
.completion-icon { font-size: 64px; margin-bottom: 16px; }
.completion-card h2 { font-size: 1.6rem; margin-bottom: 8px; }
.completion-card p { margin-bottom: 24px; }

/* --- Empty state --- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { color: var(--text); margin-bottom: 6px; }

/* --- Responsive --- */
@media (max-width: 900px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .lesson-content { padding: 24px; }
}
@media (max-width: 640px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  .auth-card { padding: 28px 20px; }
  .welcome-banner { padding: 20px; }
  .courses-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-wrap { padding: 0 16px; }
  .lesson-content { padding: 20px 16px; }
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

/* ============================================================
   GAMIFICACIÓN — Avatares, XP, Niveles, Celebraciones
   ============================================================ */

/* ── Avatar gem ── */
.gem {
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 3px solid rgba(255,255,255,0.6);
}
.gem:hover { transform: scale(1.1); box-shadow: 0 6px 20px rgba(0,0,0,0.2); }
.gem-sm  { width: 38px;  height: 38px;  font-size: 20px; border-width: 2px; }
.gem-md  { width: 56px;  height: 56px;  font-size: 30px; }
.gem-lg  { width: 80px;  height: 80px;  font-size: 44px; border-width: 4px; }
.gem-xl  { width: 100px; height: 100px; font-size: 56px; border-width: 4px; }

/* ── Level badge ── */
.lvl-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px; font-weight: 700; color: white;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  white-space: nowrap;
}

/* ── XP bar ── */
.xp-bar-wrap {
  display: flex; align-items: center; gap: 10px;
}
.xp-bar-track {
  flex: 1; height: 8px;
  background: rgba(255,255,255,0.25);
  border-radius: 999px; overflow: hidden;
}
.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #FCD34D, #F59E0B);
  border-radius: 999px;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.xp-label {
  font-size: 12px; font-weight: 700;
  color: rgba(255,255,255,0.9); white-space: nowrap;
}

/* ── Stars ── */
.stars { display: flex; gap: 2px; }
.stars .s { font-size: 14px; transition: transform 0.2s; }
.stars .s.lit { filter: none; }
.stars .s.dim { filter: grayscale(1) opacity(0.35); }
.stars.lg .s { font-size: 28px; }

/* ── Module path ── */
.module-path {
  display: flex; align-items: center;
  padding: 8px 4px; gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.module-node {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-width: 76px; text-align: center;
  cursor: pointer; text-decoration: none; color: inherit;
}
.module-node.locked { cursor: not-allowed; pointer-events: none; }
.module-connector {
  flex: 1; min-width: 16px; max-width: 48px;
  height: 3px; border-top: 3px dashed var(--border);
  margin-bottom: 30px; flex-shrink: 0;
}
.module-connector.done { border-color: var(--emerald); border-style: solid; }

.module-circle {
  width: 58px; height: 58px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  border: 3px solid var(--border);
  background: var(--bg-soft);
  transition: all 0.25s;
  position: relative;
}
.module-circle.done {
  background: var(--emerald); border-color: #059669;
  box-shadow: 0 4px 14px rgba(16,185,129,0.35);
}
.module-circle.current {
  background: white; border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(124,58,237,0.15), 0 4px 20px rgba(124,58,237,0.25);
  animation: nodePulse 2.5s ease-in-out infinite;
}
.module-circle.locked { filter: grayscale(1) opacity(0.4); }
@keyframes nodePulse {
  0%,100% { box-shadow: 0 0 0 4px rgba(124,58,237,0.15), 0 4px 20px rgba(124,58,237,0.25); }
  50%      { box-shadow: 0 0 0 8px rgba(124,58,237,0.1),  0 4px 28px rgba(124,58,237,0.4); }
}
.module-label {
  font-size: 11px; font-weight: 600; line-height: 1.3;
  color: var(--text-muted); max-width: 70px;
}
.module-label.done    { color: #059669; }
.module-label.current { color: var(--primary); }

/* ── XP popup ── */
@keyframes xpFloat {
  0%   { opacity:1; transform:translateX(-50%) translateY(0) scale(1); }
  60%  { opacity:1; transform:translateX(-50%) translateY(-28px) scale(1.15); }
  100% { opacity:0; transform:translateX(-50%) translateY(-52px) scale(0.9); }
}

/* ── Confetti ── */
@keyframes confettiFall {
  0%   { top:-10px; opacity:1; transform:rotate(0deg) translateX(0); }
  100% { top:110vh; opacity:0.6; transform:rotate(720deg) translateX(80px); }
}

/* ── Celebration modal ── */
.celebrate-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 24px; animation: fadeIn 0.2s ease;
}
.celebrate-card {
  background: white; border-radius: 28px;
  padding: 44px 32px; text-align: center;
  max-width: 390px; width: 100%;
  box-shadow: 0 24px 60px rgba(0,0,0,0.2);
  animation: bounceIn 0.45s cubic-bezier(0.175,0.885,0.32,1.275);
}
@keyframes bounceIn {
  from { opacity:0; transform:scale(0.4) translateY(40px); }
  to   { opacity:1; transform:scale(1) translateY(0); }
}
.celebrate-icon { font-size: 72px; display: block; margin-bottom: 8px; }
.celebrate-card h2 { font-size: 1.7rem; margin-bottom: 4px; }
.celebrate-card .sub { font-size: 15px; margin-bottom: 14px; }
.celebrate-stars { font-size: 40px; letter-spacing: 6px; margin: 10px 0 16px; }
.xp-earned-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: #FFFBEB; color: #92400E;
  padding: 7px 18px; border-radius: 999px;
  font-weight: 800; font-size: 16px; margin-bottom: 22px;
  border: 1px solid #FCD34D;
}

/* ── Avatar selector ── */
.avatar-modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 24px; animation: fadeIn 0.2s ease;
}
.avatar-modal-card {
  background: white; border-radius: 20px; padding: 28px;
  max-width: 420px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: slideUp 0.3s ease;
}
.avatar-grid {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 10px;
  margin: 16px 0;
}
.avatar-opt {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 6px; border-radius: 12px; cursor: pointer;
  border: 2.5px solid transparent; transition: all 0.15s;
}
.avatar-opt:hover { border-color: var(--primary); background: var(--primary-soft); }
.avatar-opt.sel   { border-color: var(--primary); background: var(--primary-soft); }
.avatar-opt-name  { font-size: 11px; font-weight: 600; color: var(--text-muted); }

/* ── Lesson step (gamified) ── */
.step-card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
  animation: fadeIn 0.3s ease;
}
.step-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  margin-bottom: 12px;
}
.chip-read  { background: var(--primary-soft); color: var(--primary); }
.chip-quiz  { background: var(--amber-soft);   color: #92400E; }
.chip-apply { background: var(--emerald-soft); color: #065F46; }

.option-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer; font-size: 14px; font-weight: 500;
  transition: all 0.15s;
  text-align: left;
}
.option-card:hover  { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.option-card.picked { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.option-card.correct{ border-color: var(--emerald); background: var(--emerald-soft); color: #065F46; }
.option-card.wrong  { border-color: #EF4444;        background: #FEF2F2;             color: #991B1B; }
.option-card.disabled { pointer-events: none; }

.option-idx {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--border); color: var(--text-muted);
  font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.15s;
}
.option-card.picked .option-idx  { background: var(--primary); color: white; }
.option-card.correct .option-idx { background: var(--emerald); color: white; }
.option-card.wrong .option-idx   { background: #EF4444; color: white; }

/* ── Panel de notificaciones: oculto por defecto desde CSS global ── */
.notif-panel {
  position: fixed;
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(-8px);
  transition: opacity .17s ease, transform .17s ease;
}
.notif-panel.open {
  opacity: 1 !important;
  pointer-events: all !important;
  transform: translateY(0);
}

.quiz-feedback {
  border-radius: var(--radius-sm); padding: 13px 16px;
  font-size: 14px; font-weight: 600;
  margin-top: 12px; display: none;
}
.quiz-feedback.show { display: block; animation: fadeIn 0.3s ease; }
.qf-ok  { background: var(--emerald-soft); color: #065F46; border:1px solid #A7F3D0; }
.qf-err { background: #FEF2F2; color: #991B1B; border:1px solid #FECACA; }

/* ── Botón de navegación "Volver" global ───────────────── */
.btn-nav-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px 7px 10px;
  border-radius: 999px;
  background: white;
  border: 1.5px solid #E5E7EB;
  color: #6B7280;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s, color .15s, box-shadow .15s, transform .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  line-height: 1;
  white-space: nowrap;
}
.btn-nav-back:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 2px 10px rgba(124,58,237,.13);
  transform: translateX(-2px);
}
.btn-nav-back svg {
  flex-shrink: 0;
  transition: transform .15s;
}
.btn-nav-back:hover svg { transform: translateX(-2px); }

/* ── Progress header (lesson) ── */
.lesson-top-bar {
  background: white; border-bottom: 1px solid var(--border);
  padding: 12px 24px; display: flex; align-items: center; gap: 16px;
}
.lesson-progress-track {
  flex: 1; height: 8px; background: var(--bg-soft);
  border-radius: 999px; overflow: hidden;
}
.lesson-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--pink));
  border-radius: 999px;
  transition: width 0.5s ease;
}
.xp-counter {
  position: relative;
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 800;
  height: 34px; padding: 0 12px 0 8px;
  border-radius: 999px; white-space: nowrap;
  background:
    linear-gradient(#fdf4ff, #fff5fb) padding-box,
    linear-gradient(135deg, #7C3AED 0%, #EC4899 55%, #F59E0B 100%) border-box;
  border: 1.5px solid transparent;
  overflow: hidden;
}
.xp-counter::after {
  content:''; position:absolute; inset:0; border-radius:999px;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.55) 50%, transparent 80%);
  background-size: 220% 100%; pointer-events:none;
  animation: xpShimmer 3.5s linear infinite;
}
@keyframes xpShimmer {
  0%   { background-position: 220% center; }
  100% { background-position: -20% center; }
}
.xp-counter .xp-bolt-ico { flex-shrink:0; filter:drop-shadow(0 0 3px rgba(236,72,153,.45)); }
.xp-counter .xp-val-grad {
  background: linear-gradient(135deg, #7C3AED 0%, #EC4899 60%, #F59E0B 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; font-weight: 800;
}

/* ── Hero dashboard ── */
.dash-hero {
  background: linear-gradient(135deg, #4C1D95 0%, #7C3AED 45%, #DB2777 100%);
  border-radius: var(--radius);
  padding: 28px 32px;
  color: white;
  position: relative; overflow: hidden;
  margin-bottom: 28px;
}
.dash-hero::before {
  content:''; position:absolute; right:-60px; top:-60px;
  width:220px; height:220px; border-radius:50%;
  background: rgba(255,255,255,0.05);
}
.dash-hero::after {
  content:''; position:absolute; right:60px; bottom:-80px;
  width:180px; height:180px; border-radius:50%;
  background: rgba(255,255,255,0.04);
}
.dash-hero > * { position: relative; z-index: 1; }
.dash-hero h2 { color:white; font-size:1.5rem; margin-bottom:2px; }
.dash-hero p  { color:rgba(255,255,255,0.8); font-size:14px; margin-bottom:16px; }

/* ── Responsive gamification ── */
@media (max-width:640px) {
  .module-path { padding: 8px 0; }
  .module-circle { width:48px; height:48px; font-size:22px; }
  .module-label  { font-size:10px; max-width:56px; }
  .module-connector { min-width:10px; max-width:28px; }
  .celebrate-card { padding: 32px 20px; }
  .celebrate-icon { font-size: 56px; }
  .gem-xl { width:72px; height:72px; font-size:40px; }
}
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }
