/* ══════════════════════════════════════════════════════════════════════
   PAGE: /learn (Hub + Skill Tree page)
   Prefijos en este archivo: .hub-* (hub topbar + body + cards + super
   upsell + premium badge + unlock row)

   El skill tree mismo está en features/skill-tree.css.
   Las clases .learn-* (topbar, side card, etc.) se añadirán en Round 3.3.

   Notas:
   - Algunas reglas hub residuales quedan en learning.css (selectores
     compuestos mixtos hub+module). Se consolidarán en Round 6.

   Extraído de learning.css y responsive.css en Round 3.2.
   ══════════════════════════════════════════════════════════════════════ */

/* ─── 1. Desktop (from learning.css 653-1276) ──────────────────────── */
/* ══ Hub & Module ══════════════════════════════════════════════ */

/* ── Compact Topbar (Duolingo-style) ── */
.hub-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-lg);
  padding: 16px 24px;
  background: var(--bg-white);
  border-bottom: 2px solid var(--hub-color, var(--violet));
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-xl);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.hub-topbar-left {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}

.hub-topbar-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-primary);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
}

.hub-topbar-back:hover {
  background: var(--hub-color, var(--violet));
  color: #fff;
  transform: scale(1.08);
}

.hub-topbar-title {
  font-size: 1.3rem;
  font-weight: var(--fw-extra);
  color: var(--hub-color, var(--violet));
  line-height: 1.15;
  letter-spacing: -0.3px;
  margin: 0;
}

.hub-topbar-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.3;
  margin: 0;
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hub-topbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-lg);
}

.hub-topbar-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hub-topbar-pct {
  font-size: 0.85rem;
  font-weight: var(--fw-bold);
  color: var(--hub-color, var(--violet));
  min-width: 32px;
  text-align: right;
}

.hub-topbar-progress-track {
  width: 100px;
  height: 10px;
  background: var(--bg-secondary);
  border-radius: var(--r-full);
  overflow: hidden;
}

.hub-topbar-progress-fill {
  height: 100%;
  background: var(--hub-color, var(--violet));
  border-radius: var(--r-full);
  transition: width 0.6s var(--ease);
}

.hub-topbar-icon {
  font-size: 28px;
  color: var(--hub-color, var(--violet));
  opacity: 0.7;
}

/* ── Skeleton Loading System ── */
@keyframes skeleton-shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.skeleton-text {
  color: transparent !important;
  background: linear-gradient(90deg, #e8e8ee 25%, #f4f4f8 37%, #e8e8ee 63%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease infinite;
  border-radius: 6px;
  pointer-events: none;
  user-select: none;
}

.skeleton-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 32px 0;
}

.skeleton-node {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(90deg, #e8e8ee 25%, #f4f4f8 37%, #e8e8ee 63%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease infinite;
  position: relative;
  transition: margin 0.3s ease;
}

.skeleton-connector {
  width: 3px;
  height: 32px;
  background: linear-gradient(90deg, #e0e0e6 25%, #ececf0 37%, #e0e0e6 63%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease infinite;
  border-radius: 2px;
}

/* ── Hub Body Layout ── */
.hub-body {
  display: flex;
  gap: var(--sp-2xl);
  flex-wrap: wrap;
}

.hub-modules-col {
  flex: 2;
  min-width: 300px;
}

.hub-sidebar-col {
  flex: 1;
  min-width: 280px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  position: sticky;
  top: 88px;
  align-self: flex-start;
}

/* ── Skora Super Upsell Card (Duolingo Style) ── */
.hub-card-super {
  background: var(--bg-white);
  border: 2px solid var(--border);
  border-radius: var(--r-xl);
  padding: 22px 24px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 260px;
  width: 100%;
  box-sizing: border-box;
  gap: 18px;
  box-shadow: 0 4px 0 var(--border);
  overflow: hidden;
}

.hub-card-super-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.hub-card-super-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hub-super-logo-badge {
  height: 24px;
  width: auto;
  display: block;
  margin-bottom: 12px;
}

.hub-card-super-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.2;
  letter-spacing: 0;
}

.hub-card-super-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

.hub-super-illustration {
  width: 86px;
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.08));
  margin-top: -10px;
  margin-right: -5px;
}

.btn-super-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
  min-height: 58px;
  padding: 0 20px;
  background: #6C2BFF;
  /* Primary Skora color */
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--r-lg);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.1s var(--ease), box-shadow 0.1s var(--ease);
  box-shadow: 0 4px 0 #4a1bb5;
}

.btn-super-cta:hover {
  background: #7940ff;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #4a1bb5;
}

.btn-super-cta:active {
  transform: translateY(2px);
  box-shadow: 0 0px 0 #4a1bb5;
}

/* ── Premium Referral Card Variant ── */
.hub-card-super--premium {
  border-color: #00C853;
  box-shadow: 0 4px 0 #00A044;
  background: var(--bg-white);
}

.hub-card-super--free {
  border-color: var(--violet);
  box-shadow: 0 4px 0 #4A1BB5;
  background: var(--bg-white);
}

.hub-card-super--free .hub-card-super-title {
  max-width: 210px;
  font-size: 1.18rem;
}

.hub-card-super--free .hub-card-super-desc {
  max-width: 220px;
}


.hub-card-super--premium .hub-card-super-title {
  color: #00A044;
}

.hub-super-title-icon {
  font-size: 1.05em;
  vertical-align: -3px;
  color: #00C853;
}

.btn-super-cta--referral {
  background: linear-gradient(135deg, #00C853, #00B44A);
  box-shadow: 0 4px 0 #008537;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-super-cta--referral:hover {
  background: linear-gradient(135deg, #00E676, #00C853);
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #008537;
}

.btn-super-cta--referral:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 #008537;
}

/* ── Compact Action Cards ── */
.hub-card-action {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: all 0.2s var(--ease);
}

.hub-card-action:hover {
  border-color: var(--hub-color, var(--violet));
  box-shadow: 0 4px 16px color-mix(in srgb, var(--hub-color, var(--violet)) 12%, transparent);
}

.hub-card-action-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--hub-color, var(--violet)) 12%, transparent);
  color: var(--hub-color, var(--violet));
}

.hub-card-action-icon--secondary {
  background: var(--bg-primary);
  color: var(--text-secondary);
}

.hub-card-action-icon .material-symbols-outlined {
  font-size: 22px;
}

.hub-card-action-body {
  flex: 1;
  min-width: 0;
}

.hub-card-action-title {
  font-size: 0.88rem;
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  margin: 0 0 2px;
}

.hub-card-action-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.3;
}

.hub-card-action-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid var(--border);
  background: var(--bg-white);
  color: var(--hub-color, var(--violet));
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s var(--ease);
}

.hub-card-action-btn .material-symbols-outlined {
  font-size: 18px;
}

.hub-card-action-btn:hover {
  background: var(--hub-color, var(--violet));
  border-color: var(--hub-color, var(--violet));
  color: #fff;
  transform: scale(1.1);
}




/* Fox mascot removed — replaced by EMPEZAR label + popover */

/* ── Legacy hub module classes (kept for backward compat if needed) ── */
.hub-topic-group {
  margin-bottom: var(--sp-2xl);
}

.hub-topic-title {
  margin-bottom: var(--sp-md);
  font-size: 1.1rem;
  font-weight: var(--fw-bold);
  color: var(--text-primary);
}

.hub-topic-modules {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

/* --- Hub Utility Cards (Right Column) --- */
.hub-utility-card {
  padding: var(--sp-xl);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.hub-utility-card--accent {
  border-color: rgba(108, 43, 255, 0.15);
}

.hub-utility-card--dark {
  background: #1a1a2e;
  border-color: transparent;
  color: var(--text-inverse);
}

.hub-utility-card--dark h3,
.hub-utility-card--dark p {
  color: rgba(255, 255, 255, 0.85);
}

.hub-utility-icon {
  display: inline-flex;
  padding: 8px;
  background: var(--violet-light);
  border-radius: var(--r-md);
  color: var(--violet);
  margin-bottom: var(--sp-md);
}

.hub-utility-card--dark .hub-utility-icon {
  background: rgba(108, 43, 255, 0.2);
}

.hub-utility-title {
  font-size: 1.15rem;
  font-weight: var(--fw-bold);
  margin-bottom: var(--sp-xs);
}

.hub-utility-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: var(--sp-lg);
  line-height: 1.5;
}

.hub-utility-card--dark .hub-utility-desc {
  color: rgba(255, 255, 255, 0.6);
}

.hub-premium-badge {
  font-size: 0.65rem;
  font-weight: var(--fw-bold);
  background: var(--magenta);
  color: white;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hub-unlock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--violet-light);
  border: 1px solid rgba(108, 43, 255, 0.15);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.hub-unlock-row:hover {
  background: rgba(108, 43, 255, 0.15);
}

.hub-unlock-label {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: 0.85rem;
  font-weight: var(--fw-bold);
  color: var(--violet);
}

/* --- Sidebar User Panel (replaces inline styles) --- */
.sidebar-user-panel {
  padding: var(--sp-lg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--violet-light);
  color: var(--violet);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--fw-bold);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.sidebar-user-plan {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* --- Hub Responsive --- */
@media (max-width: 900px) {
  .hub-hero {
    flex-direction: column;
    text-align: center;
  }

  .hub-hero-content {
    padding-right: 0;
  }

  .hub-hero-desc {
    margin-left: auto;
    margin-right: auto;
  }

  .hub-progress-box {
    margin: 0 auto;
  }

  .hub-next-objective {
    margin: 0 auto var(--sp-lg);
    max-width: 100%;
  }

  .hub-body {
    flex-direction: column;
  }

  .hub-hero-visual {
    display: none;
  }

}

/* --- Legacy classes (kept for other views) --- */
.hub-header {
  padding: var(--sp-2xl);
  border-radius: var(--r-lg);
  color: var(--text-inverse);
  margin-bottom: var(--sp-xl);
  position: relative;
  overflow: hidden;
}

.hub-header h1 {
  color: var(--text-inverse);
  margin-bottom: var(--sp-xs);
}

.hub-header p {
  color: rgba(255, 255, 255, 0.8);
}

/* ─── 2. Mobile @media (max-width: 768px) (from responsive.css 571-634) ─ */
@media (max-width: 768px) {
  /* ═════════════════════════════════════════════════════════════════════
     PHASE 3: HUB / SKILL TREE
     Single column, compact nodes, reduced zigzag.
     ═════════════════════════════════════════════════════════════════════ */

  /* ── Hub Topbar — Full-width, compact ── */
  .hub-topbar {
    padding: 10px var(--m-pad) !important;
    border-radius: 0 !important;
    margin: 0 calc(-1 * var(--m-pad)) !important;
    width: calc(100% + 2 * var(--m-pad)) !important;
    gap: var(--m-gap-sm);
  }

  .hub-topbar-desc {
    display: none !important;
  }

  .hub-topbar-title {
    font-size: 0.95rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
  }

  .hub-topbar-progress-track {
    width: 64px !important;
    height: 6px !important;
  }

  .hub-topbar-back {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  /* ── Hub Body — Stack vertically ── */
  .hub-body {
    flex-direction: column !important;
    gap: var(--m-gap-lg) !important;
  }

  .hub-sidebar-col {
    max-width: 100% !important;
    width: 100% !important;
    position: static !important;
    order: -1;
    flex-shrink: 0;
  }

  .hub-main-col {
    width: 100% !important;
    min-width: 0 !important;
  }


  /* ── Module Info Panel — Full width ── */
  .module-info-panel,
  .hub-info-panel {
    max-width: 100% !important;
    border-radius: var(--m-card-r) !important;
    padding: var(--m-card-pad) !important;
  }
}

/* ─── 3. Dark mode (from learning.css 4253-4266) ───────────────────── */
/* ── Hub Upsell Card (Skora Super) ── */
[data-theme="dark"] .hub-card-super {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(108, 43, 255, 0.06) 100%);
  border-color: var(--border);
  box-shadow: 0 4px 0 var(--border);
}

[data-theme="dark"] .hub-card-super-title {
  color: var(--text-primary);
}

[data-theme="dark"] .hub-card-super-desc {
  color: var(--text-secondary);
}


/* ─── 4. Learn page topbar/sidecards desktop (from learning.css 2813-3386) ─ */
.learn-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 16px 0;
  margin-bottom: 20px;
  overflow: visible;
  position: relative;
  z-index: 1000;
  flex-shrink: 0;
}

.learn-topbar::-webkit-scrollbar {
  display: none;
}

/* Subject tabs inside the topbar */
.learn-topbar .learn-tabs {
  display: flex;
  gap: 6px;
  flex-shrink: 1;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.learn-topbar .learn-tabs::-webkit-scrollbar {
  display: none;
}

.learn-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 3px solid var(--border-subtle);
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  flex-shrink: 0;
  white-space: nowrap;
}

.learn-tab:hover {
  border-color: var(--tab-color, #6C2BFF);
  color: var(--tab-color, #6C2BFF);
  background: color-mix(in srgb, var(--tab-color, #6C2BFF) 6%, var(--bg-white));
}

.learn-tab.active {
  border-width: 3px;
  border-color: var(--tab-color, #6C2BFF);
  background: transparent;
  color: var(--tab-color, #6C2BFF);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--tab-color, #6C2BFF) 15%, transparent);
}

.learn-tab-icon {
  font-size: 18px;
}

.learn-tab-label {
  font-size: 0.85rem;
}

/* Stats group (right side of topbar) */
.learn-stats-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.learn-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-primary);
  text-decoration: none;
}

.learn-stat:hover {
  background: var(--bg-elevated);
  border-color: var(--border);
}

.stat-streak-stat {
  background: transparent;
  border: none;
  box-shadow: none;
  display: flex;
  align-items: center;
  padding: 6px 12px;
  gap: 6px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.stat-streak-stat:hover {
  background: rgba(0, 0, 0, 0.06);
  border: none;
}

.learn-stat-icon {
  font-size: 19px;
}

.learn-stat-icon--streak {
  color: #9CA3AF;
}

.learn-stat-icon--streak.active {
  color: #F59E0B;
}

/* SVG icon override for streak */
.learn-stat-icon--svg {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.learn-stat-icon--diamond {
  color: #3B82F6;
}

.learn-stat-icon--league {
  color: #6C2BFF;
}

/* League stat — special layout with rank */
.learn-stat--league {
  gap: 6px;
}

.learn-league-info {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.learn-league-rank {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-primary);
}

.learn-league-tier {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Premium running icon button */
.stat-premium-run-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 4px;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
}

.stat-premium-run-btn:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

.stat-premium-run-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

/* League trend indicator */
.learn-league-trend {
  display: inline-flex;
  align-items: center;
}

.learn-trend-icon {
  font-size: 16px;
}

.trend-up .learn-trend-icon {
  color: #22C55E;
}

.trend-down .learn-trend-icon {
  color: #EF4444;
}

/* ══════════════════════════════════════════════════════════════════════
   ── Main Body Layout: Tree + Side Cards ──
   Layout fix (Round 14): grid layout en .main-content para que el
   skill tree ocupe TODA la altura restante, evitando la barra blanca
   inferior. .learn-tree-col es el único scroller vertical.
   Usa 100dvh (dynamic viewport) para mejor manejo en mobile.
   ══════════════════════════════════════════════════════════════════════ */
.dashboard-layout:has(.learn-body) {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

.dashboard-layout:has(.learn-body) .main-content:has(.learn-body) {
  --learn-scroll-height: calc(100dvh - 154px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  padding-bottom: 0;
}

/* Móvil: las tabs (.learn-topbar) están OCULTAS (solo-slide) → los hijos
   visibles del main-content son 2: el topbar del shell (racha/avatar) y
   .learn-body. El grid base de 2 filas (auto minmax(0,1fr)) ya encaja: shell
   topbar arriba y el árbol ocupando el resto como único scroller vertical. */

.learn-body {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 28px;
  align-items: start;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

.learn-tree-col {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  /* clip (no hidden): prohíbe también el scroll horizontal PROGRAMÁTICO
     (scrollIntoView podía correr scrollLeft en device real → todo cortado
     por la izquierda). */
  overflow-x: clip;
  overscroll-behavior-x: none;
  overscroll-behavior-y: auto;
  /* El card de materia (.learn-area-header) es sticky DENTRO de este scroller y
     al colapsar cambia su altura (~100px). El scroll anchoring del navegador
     reajusta scrollTop para "compensar" ese cambio, y como el empujón (~100px)
     es mayor que la banda de histéresis (24→64px) cruza el umbral de golpe:
     colapsa → anchoring mueve scrollTop → expande → … = titileo. Desactivarlo
     rompe ese bucle de realimentación. */
  overflow-anchor: none;
  scroll-gutter: stable;
  padding-right: 0;
  padding-bottom: 0;
  background: transparent;
  /* Defensive: ensure no mask/fade applied accidentally */
  -webkit-mask-image: none;
  mask-image: none;
  /* Hide scrollbar but keep functionality (Round 13 feature) */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.learn-tree-col::-webkit-scrollbar {
  display: none;
}

.learn-side-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 0;
  height: fit-content;
  max-height: calc(100vh - 120px);
  overflow: visible;
}

/* ── Area Header ── Sticky on scroll (Round 13 feature) */
.learn-area-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--hub-color, var(--violet));
  border-radius: 14px;
  margin-bottom: 20px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  will-change: transform, opacity;
  /* Subtle elevation when sticky */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  transition: box-shadow 200ms ease, background-color 220ms ease-out;
}

/* Drag + atomic swap utility classes — JS sets these inline-ish */
.learn-area-header.is-dragging,
.learn-area-header.is-swapping {
  transition: none !important;
}
.learn-area-header.is-swapping .learn-area-progress-fill {
  transition: none !important;
}

.learn-area-header.is-stuck {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

/* Barra compacta: solo existe en móvil (ver sección 5) */
.learn-area-bar {
  display: none;
}

/* Title + description fade transition on sticky-header swap */
.learn-area-title,
.learn-area-desc {
  transition: opacity 180ms ease;
}

.learn-area-title.is-fading,
.learn-area-desc.is-fading {
  opacity: 0.5;
}

.learn-area-title {
  /* Una línea reservada aunque el nombre aún no haya llegado (CLS). */
  min-height: 1.2em;
  font-size: 1.15rem;
  font-weight: 800;
  color: #FFFFFF;
  margin: 0;
}

.learn-area-desc {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.85);
  margin: 2px 0 0 0;
  /* Reserva la línea aunque la descripción llegue con la red: si la card
     crece al recibirla, empuja el árbol (salto de layout). */
  min-height: 1.6em;
}

.learn-area-progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  /* Move with the card opacity so the rail never floats alone mid-transition */
  transition: opacity 140ms ease-out;
}

.learn-area-pct {
  font-size: 0.85rem;
  font-weight: 700;
  color: #FFFFFF;
}

.learn-area-progress-track {
  width: 100px;
  height: 8px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  overflow: hidden;
}

.learn-area-progress-fill {
  height: 100%;
  border-radius: 10px;
  background: var(--bg-white) !important;
  transition: width 0.5s ease;
}

/* ── Empty State ── */
.learn-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  color: var(--text-secondary);
  gap: 12px;
}

.learn-empty-state p {
  max-width: 280px;
  font-size: 0.92rem;
  line-height: 1.5;
}

/* ── Side Cards (Duolingo-style) ── */
.learn-side-card {
  display: block;
  background: var(--bg-white);
  border: 1.5px solid var(--border-subtle);
  border-radius: 14px;
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.learn-side-card:hover {
  border-color: #D1D5DB;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.learn-side-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.learn-side-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.learn-side-card-link {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--violet);
  text-decoration: none;
}

.learn-side-card-link:hover {
  text-decoration: underline;
}

.learn-side-card-body {
  display: flex;
  align-items: center;
  gap: 14px;
}

.learn-side-card-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.learn-side-card-icon--league {
  background: linear-gradient(135deg, #C0C0C0, #8e8e8e);
  color: white;
}

.learn-side-card-icon--league .material-symbols-outlined {
  font-size: 22px;
}

.learn-side-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

/* ── Daily Challenge Item (compact) ── */
.learn-challenge-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.learn-challenge-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #F59E0B, #EAB308);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.learn-challenge-icon .material-symbols-outlined {
  font-size: 20px;
}

.learn-challenge-info {
  flex: 1;
  min-width: 0;
}

.learn-challenge-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
  margin-bottom: 6px;
}

.learn-challenge-bar-bg {
  width: 100%;
  height: 10px;
  background: var(--border-subtle);
  border-radius: 10px;
  overflow: hidden;
}

.learn-challenge-bar-fill {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, #F59E0B, #22C55E);
  transition: width 0.5s ease;
}

.learn-challenge-progress-text {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ── Legal Links (in side column) ── */
.learn-side-legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 12px 0 0;
}

.learn-side-legal a {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

.learn-side-legal a:hover {
  color: var(--violet);
  text-decoration: underline;
}

.learn-side-legal-sep {
  color: var(--text-secondary);
  opacity: 0.3;
  font-size: 0.72rem;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .learn-body {
    grid-template-columns: 1fr;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .learn-tree-col {
    height: 100%;
    max-height: 100%;
    overflow-y: auto;
  }

  .learn-side-col {
    display: none;
  }
}

/* Mobile scroll height: viewport menos bottom-nav y padding (Round 14) */
@media (max-width: 768px) {
  .dashboard-layout:has(.learn-body) .main-content:has(.learn-body) {
    --learn-scroll-height: calc(100dvh - var(--m-bottomnav-h, 64px) - var(--m-pad, 16px) - var(--m-pad, 16px));
  }
}

@media (max-width: 768px) {
  /* Móvil = SOLO SLIDE para cambiar de materia (decisión usuario 2026-07-11):
     el gesto sobre la card + los puntitos ES el switcher. La barra de tabs con
     iconos era redundante con el slide y saturaba la pantalla → se oculta.
     (Desktop conserva las tabs.) Con el topbar oculto, el grid del main-content
     vuelve a sus 2 filas naturales: topbar del shell (auto) + árbol (1fr).
     SCOPE learn: /quizzes y /simulacros también usan .learn-topbar para sus
     propios selectores — NO tocarlos. */
  body[data-route="learn"] .learn-topbar {
    display: none !important;
  }

  .learn-stat {
    padding: 5px 10px;
    font-size: 0.82rem;
  }

  .learn-tab {
    padding: 7px 12px;
    font-size: 0.8rem;
    scroll-snap-align: start;
  }

  .learn-area-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .learn-area-progress-track {
    width: 80px;
  }

  .learn-side-col {
    flex-direction: column;
  }

  .learn-side-col>* {
    flex: none;
  }

  .learn-side-legal {
    justify-content: center;
  }
}

/* ════════════════════════════════════════════════════════════

/* ─── 5. Learn page mobile (from responsive.css 312-396) ─ */
@media (max-width: 768px) {


  .learn-stat {
    display: none !important;
  }

  /* ── Card de materia en móvil: colapso SIN cambiar de tamaño ──
     Antes el colapso animaba padding/margin/max-height/font-size: cada cuadro
     recalculaba el layout de todo el árbol y el contenido saltaba ~100px bajo
     el dedo → trabado en device real (en DevTools, con CPU de escritorio, no se
     notaba). Ahora la caja de la card mide siempre lo mismo: el fondo vive en
     ::before y se funde, y la barra compacta aparece encima. Solo opacity y
     transform (GPU), como pide la skill de Emil. */
  .learn-area-header {
    margin: 0 0 16px 0 !important;
    border-radius: 20px !important;
    padding: 22px 20px !important;
    touch-action: pan-y !important;
    /* Enable vertical scroll, capture horizontal */
    background: transparent !important;
    box-shadow: none !important;
    transition: none !important;
    /* Recorta por los lados el contenido que se desliza en el swipe (antes
       overflow:hidden), pero deja ver la sombra por arriba y por abajo. */
    overflow: visible;
    clip-path: inset(-32px 0 -32px 0);
  }

  .learn-area-header::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: var(--hub-color, var(--violet));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transition:
      opacity 200ms cubic-bezier(0.23, 1, 0.32, 1),
      background-color 220ms ease-out;
  }

  .learn-area-header.is-collapsed::before {
    opacity: 0;
  }

  /* Colapsada, la zona transparente de la card no debe tapar los toques al
     árbol que pasa por debajo: solo la barra recibe eventos. */
  .learn-area-header.is-collapsed {
    pointer-events: none;
  }

  /* El contenido grande se funde hacia arriba (gana al --swap-x/--swap-o del
     swipe por especificidad; la transición la pone `.learn-area-header > *`). */
  .learn-area-header.is-collapsed > :not(.learn-area-bar) {
    opacity: 0;
    transform: translateY(-6px);
  }

  /* La descripción se limita a dos líneas en la card expandida. */
  .learn-area-desc {
    max-height: 3.2em;
    overflow: hidden;
  }

  /* ── Barra compacta — al bajar en el árbol ── */
  .learn-area-header > .learn-area-bar {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    border-radius: 20px;
    background: var(--hub-color, var(--violet));
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    opacity: 0;
    pointer-events: none;
    /* La cáscara de la barra no se mueve en el swipe; se mueve su interior. */
    transform: none;
    transition:
      opacity 180ms ease-out,
      background-color 220ms ease-out;
  }

  .learn-area-header.is-collapsed > .learn-area-bar {
    opacity: 1;
    pointer-events: auto;
  }

  .learn-area-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 100%;
    padding: 0 16px;
    transform: translateX(var(--swap-x, 0px));
    opacity: var(--swap-o, 1);
    transition:
      transform 220ms cubic-bezier(0.23, 1, 0.32, 1),
      opacity 180ms ease-out;
  }

  .learn-area-header.is-dragging .learn-area-bar-inner,
  .learn-area-header.is-swapping .learn-area-bar-inner {
    transition: none !important;
  }

  .learn-area-bar-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1rem;
    font-weight: 800;
    color: #FFFFFF;
  }

  .learn-area-bar .learn-area-progress-wrap {
    flex-shrink: 0;
  }

  /* ── Puntitos mini dentro de la barra ── */
  .learn-area-bar .learn-area-mini-dots {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
  }

  .learn-area-mini-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transition: width 220ms cubic-bezier(0.23, 1, 0.32, 1), background-color 200ms ease;
  }

  .learn-area-mini-dot.active {
    width: 14px;
    border-radius: 3px;
    background: #fff;
  }

  @media (prefers-reduced-motion: reduce) {
    .learn-area-header::before,
    .learn-area-header > .learn-area-bar,
    .learn-area-mini-dot {
      transition: opacity 120ms ease !important;
    }

    .learn-area-header.is-collapsed > :not(.learn-area-bar) {
      transform: none !important;
    }
  }

  /* Swipe de materia: la CÁSCARA no se mueve nunca (así no destapa el fondo
     — el "marco blanco"). Solo el contenido interno se desliza/funde vía
     --swap-x/--swap-o, clipeado por el overflow:hidden de la card. */
  .learn-area-header > * {
    transform: translateX(var(--swap-x, 0px));
    opacity: var(--swap-o, 1);
    transition:
      transform 220ms cubic-bezier(0.23, 1, 0.32, 1),
      opacity 180ms ease-out;
    will-change: transform, opacity;
  }

  .learn-area-header.is-dragging > *,
  .learn-area-header.is-swapping > * {
    transition: none !important;
  }

  @media (prefers-reduced-motion: reduce) {
    .learn-area-header > * {
      transition: opacity 120ms ease !important;
      transform: none !important;
    }
  }

  /* Prevent layout collapse mid-transition: tree keeps its footprint */
  #learn-skill-tree {
    min-height: 60vh;
    transition: opacity 220ms ease-out;
  }

  /* Area Dots */
  .learn-area-dots {
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-bottom: 24px;
    /* Alto de un puntito reservado: nacen vacíos y se rellenan con JS. */
    min-height: 6px;
  }

  .learn-area-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.15);
    transition: width 280ms cubic-bezier(0.22, 1, 0.36, 1),
                background-color 220ms ease-out,
                border-radius 280ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .learn-area-dot.active {
    width: 18px;
    border-radius: 4px;
    background: var(--hub-color, var(--violet, #6C2BFF));
  }

  .learn-area-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
  }

  .learn-area-title {
    margin-bottom: 0 !important;
  }

  .mobile-integrated-streak {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    background: #FFF;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--violet);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  /* Hide Side Cards on Mobile */
  #learn-upsell-card,
  .learn-side-card--coming-soon,
  .nov-side-card,
  .learn-side-legal {
    display: none !important;
  }


}

/* ─── 6. Learn subject swipe mobile (from responsive.css 1101-1143) ─ */
@media (max-width: 768px) {
  /* ── Mobile Subject Swipe (Cambio 2) ──
     Las tabs ya no se ocultan (ver decisión 2026-07-11 arriba): la barra
     sticky de materias convive con el swipe de la card. */
  .learn-stats-group {
    display: none !important;
  }

  .learn-area-header {
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    will-change: transform, opacity;
  }

  .learn-area-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 8px;
  }

  .learn-area-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--border, #E5E7EB);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .learn-area-dot.active {
    width: 20px;
    border-radius: 4px;
    background-color: var(--dot-color, var(--violet));
  }
}


/* ══════════════════════════════════════════════════════════════════════
   DARK MODE — /learn page (extracted from learning.css in Round 11)
   ══════════════════════════════════════════════════════════════════════ */
/* ── Hover Card wrapper ── */
.learn-stat-wrap {
  position: relative;
}

/* ── Learn Topbar ── */
[data-theme="dark"] .learn-topbar {
  background: var(--bg-white);
  border-bottom-color: var(--border);
}

[data-theme="dark"] .learn-tab {
  color: var(--text-secondary);
}

[data-theme="dark"] .learn-tab.active {
  color: var(--text-primary);
}

/* ── Side Cards ── */
[data-theme="dark"] .learn-side-card {
  background: var(--bg-white);
  border-color: var(--border);
}

[data-theme="dark"] .learn-side-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .learn-side-card-title {
  color: var(--text-primary);
}

[data-theme="dark"] .learn-side-card-desc {
  color: var(--text-secondary);
}

[data-theme="dark"] .learn-side-card-link {
  color: #A78BFA;
}

/* Challenge items */
[data-theme="dark"] .learn-challenge-label {
  color: var(--text-primary);
}

[data-theme="dark"] .learn-challenge-bar-bg {
  background: var(--bg-secondary);
}

[data-theme="dark"] .learn-challenge-progress-text {
  color: var(--text-secondary);
}



/* ── Side widget legal links ── */
/* ── Side widget legal links ── */
[data-theme="dark"] .learn-side-legal a {
  color: var(--text-secondary);
}

/* ── Area Header ── */
/* ── Area Header ── */
/* Area header has a colored bg (cyan, green etc.) — text stays white in dark mode */
[data-theme="dark"] .learn-area-title {
  color: #FFFFFF;
}

[data-theme="dark"] .learn-area-desc {
  color: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] .learn-area-progress-track {
  background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .learn-area-progress-fill {
  background: #FFFFFF !important;
}

[data-theme="dark"] .learn-area-pct {
  color: #FFFFFF;
}

/* ── Empty State ── */
[data-theme="dark"] .learn-empty-state p {
  color: var(--text-secondary);
}




/* ─── Hub card mobile (Round 12, from responsive.css compound) ────── */
@media (max-width: 768px) {
  .hub-card {
    border-radius: var(--m-card-r) !important;
    padding: var(--m-card-pad) !important;
  }
}


/* ══════════════════════════════════════════════════════════════════════
   ICFES Countdown Widget (topbar) — Days until student's ICFES exam.
   Sourced from profile.icfes_date (migration 66). Auto-tints by urgency:
     default → violet · ≤30d → amber · ≤7d → red.
   ══════════════════════════════════════════════════════════════════════ */
.icfes-countdown {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  height: 40px;
  background: var(--violet-light);
  border: 1.5px solid color-mix(in srgb, var(--violet), transparent 70%);
  border-radius: var(--r-full);
  color: var(--violet);
  font-weight: var(--fw-semi);
  font-size: 0.9rem;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 160ms cubic-bezier(0.23, 1, 0.32, 1),
    background-color 200ms cubic-bezier(0.4, 0, 0.2, 1),
    border-color 200ms cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.icfes-countdown[hidden] { display: none; }

@media (hover: hover) and (pointer: fine) {
  .icfes-countdown:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-violet-sm);
  }
}

.icfes-countdown:active { transform: scale(0.97); }

.icfes-countdown-icon {
  font-size: 18px;
  line-height: 1;
}

.icfes-countdown-num {
  font-size: 1rem;
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.icfes-countdown-unit {
  font-size: 0.78rem;
  font-weight: var(--fw-medium);
  opacity: 0.85;
  line-height: 1;
}

/* Urgency tints */
.icfes-countdown.is-soon {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.4);
  color: #B45309;
}

.icfes-countdown.is-urgent {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--red);
  animation: icfesPulse 2.5s ease-in-out infinite;
}

@keyframes icfesPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
  50%      { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.12); }
}

[data-theme="dark"] .icfes-countdown {
  background: color-mix(in srgb, var(--violet), transparent 75%);
  border-color: color-mix(in srgb, var(--violet), transparent 50%);
  color: #C7B0FF;
}

[data-theme="dark"] .icfes-countdown.is-soon {
  background: rgba(245, 158, 11, 0.18);
  color: #FBBF24;
}

[data-theme="dark"] .icfes-countdown.is-urgent {
  background: rgba(239, 68, 68, 0.2);
  color: #FCA5A5;
}

@media (max-width: 768px) {
  .icfes-countdown {
    height: 36px;
    padding: 6px 10px;
    font-size: 0.82rem;
  }
  .icfes-countdown-unit { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .icfes-countdown.is-urgent { animation: none; }
  .icfes-countdown:hover { transform: none; }
}


/* ══════════════════════════════════════════════════════════════════════
   "Para ti ahora" (#learn-foryou, sql/148)
   La lección que más le conviene estudiar, con su porqué en una frase.
   Columna del árbol de ≥ 816 px (.has-foryou-rail): en el hueco
   izquierdo del árbol, fija bajo el encabezado. Si no cabe: botón "Para ti"
   en el encabezado del área → hoja. Ni encima del árbol (el auto-scroll al
   nodo activo la dejaba fuera de vista) ni en la columna derecha (desplazaba
   la racha y cortaba lo de abajo).
   Un solo acento: el violeta. El color del área solo como punto.
   --fy-muted y --fy-accent existen porque --text-secondary (3.22:1) y el
   violeta crudo sobre fondo oscuro (3.05:1) no llegan a 4.5:1 como texto.
   ══════════════════════════════════════════════════════════════════════ */
.learn-foryou {
  --fy-muted: #5F5B57;
  --fy-accent: var(--violet, #6C2BFF);
  --fy-line: var(--border-subtle, #EDF0F5);
  margin: 0 0 16px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--bg-white);
  border: 1px solid var(--fy-line);
  box-shadow: var(--shadow-sm);
}
.learn-foryou[hidden] { display: none; }

/* Riel: contenedor de altura 0 y sticky, así no empuja el árbol; la tarjeta
   cuelga de él en absoluto. Solo existe con .has-foryou-rail (learn.js). */
.learn-foryou-rail { display: none; }
.learn-tree-col.has-foryou-rail .learn-foryou-rail {
  display: block;
  position: sticky;
  top: var(--foryou-top, 116px);
  height: 0;
  z-index: 4;
}
.learn-foryou--rail {
  position: absolute;
  top: 0;
  left: 0;
  width: 230px;
  margin: 0;
  padding: 14px 16px;
  max-height: calc(var(--learn-scroll-height, 80vh) - var(--foryou-top, 116px) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.learn-foryou--rail .learn-foryou-lesson { font-size: 1rem; }
/* Con el riel, el árbol se corre a la derecha lo justo para que su caja quede
   a 24 px de la tarjeta (sus títulos van 56 px más adentro). En columnas
   anchas sigue centrado. */
.learn-tree-col.has-foryou-rail .skill-tree {
  margin-left: max(254px, calc((100% - 560px) / 2));
  margin-right: auto;
}
.learn-foryou--rail .learn-foryou-why { font-size: 0.875rem; }
/* En el riel (230 px) y en la hoja: una sola columna, botón a lo ancho. */
.learn-foryou--rail .learn-foryou-item,
.learn-foryou--sheet .learn-foryou-item { grid-template-columns: 1fr; }
.learn-foryou--rail .learn-foryou-item .learn-foryou-btn,
.learn-foryou--sheet .learn-foryou-item.is-main .learn-foryou-btn { width: 100%; margin-top: 4px; }
.learn-foryou--sheet {
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}
[data-theme="dark"] .learn-foryou {
  --fy-muted: #A5A3B4;
  --fy-accent: #9D86FF;
}

.learn-foryou-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.learn-foryou-title .material-symbols-outlined {
  font-size: 20px;
  color: var(--fy-accent);
  font-variation-settings: 'FILL' 1;
}

.learn-foryou-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 16px;
}
.learn-foryou-more .learn-foryou-item {
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--fy-line);
}
.learn-foryou-text { min-width: 0; }

.learn-foryou-area {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--fy-muted);
}
.learn-foryou-area::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--area, var(--fy-accent));
}
.learn-foryou-lesson {
  display: block;
  margin-top: 2px;
  font-size: 1.0625rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-primary);
  text-wrap: balance;
}
.learn-foryou-item:not(.is-main) .learn-foryou-lesson { font-size: 0.9375rem; }
.learn-foryou-why {
  margin: 4px 0 0;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--fy-muted);
}
.learn-foryou-skill {
  margin: 6px 0 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--fy-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.learn-foryou-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  background: var(--violet, #6C2BFF);
  color: #FFFFFF;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 800;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms cubic-bezier(0.23, 1, 0.32, 1), background-color 150ms ease, opacity 150ms ease;
}
.learn-foryou-btn:active:not(:disabled) { transform: scale(0.97); }
.learn-foryou-btn:disabled { opacity: 0.55; cursor: progress; }
.learn-foryou-btn--ghost {
  background: transparent;
  color: var(--fy-accent);
  border-color: color-mix(in srgb, var(--fy-accent) 35%, transparent);
}
.learn-foryou-btn:focus-visible,
.learn-foryou-more summary:focus-visible,
.learn-foryou-diag:focus-visible {
  outline: 3px solid var(--fy-accent);
  outline-offset: 3px;
}
@media (hover: hover) {
  .learn-foryou-btn:not(.learn-foryou-btn--ghost):hover:not(:disabled) { background: var(--violet-dark, #581BE5); }
  .learn-foryou-btn--ghost:hover { background: color-mix(in srgb, var(--fy-accent) 10%, transparent); }
}

.learn-foryou-more { margin-top: 12px; }
.learn-foryou-more summary {
  display: inline-block;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--fy-accent);
  list-style: none;
}
.learn-foryou-more summary::-webkit-details-marker { display: none; }
.learn-foryou-more summary::after { content: ' ›'; }
.learn-foryou-more[open] summary::after { content: ' ‹'; }

.learn-foryou-diag {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--fy-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.learn-foryou-error {
  margin: 10px 0 0;
  font-size: 0.875rem;
  font-weight: 700;
  color: #B91C1C;
}
[data-theme="dark"] .learn-foryou-error { color: #FCA5A5; }

@media (max-width: 520px) {
  .learn-foryou { padding: 14px; }
  .learn-foryou-item { grid-template-columns: 1fr; }
  .learn-foryou-item.is-main .learn-foryou-btn { width: 100%; }
}

/* Botón "Para ti" del encabezado del área: aparece cuando el riel no cabe.
   Blanco sobre el color del área: se lee igual en las cinco materias
   (#2B2B2B sobre blanco = 14:1). Mide 36 px y su zona de toque llega a 44. */
.learn-foryou-chip {
  display: none;
  position: relative;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  height: 36px;
  padding: 0 12px 0 10px;
  border: 0;
  border-radius: 999px;
  background: #FFFFFF;
  color: #2B2B2B;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  transition: transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
.learn-foryou-chip::after { content: ''; position: absolute; inset: -4px; }
.learn-foryou-chip .material-symbols-outlined {
  font-size: 18px;
  color: var(--violet, #6C2BFF);
  font-variation-settings: 'FILL' 1;
}
.learn-foryou-chip:active { transform: scale(0.97); }
.learn-foryou-chip:focus-visible { outline: 3px solid #FFFFFF; outline-offset: 2px; }
.learn-foryou-chip.is-pending { visibility: hidden; }
.learn-foryou-chip--mini { height: 32px; padding: 0 10px 0 8px; }
.learn-foryou-chip:not([hidden]) { display: inline-flex; }
.learn-tree-col.has-foryou-rail .learn-foryou-chip { display: none; }

/* ── Tutorial: deslizar para cambiar de materia (learn.js) ──
   Capa sin toques (pointer-events: none) para que el gesto llegue a la tarjeta.
   El desenfoque tiene un hueco recto; el oscurecido lo pone la sombra del anillo,
   que sí sigue las esquinas redondas de la tarjeta. */
.swipe-tuto {
  --tuto-ease: cubic-bezier(0.23, 1, 0.32, 1);
  --tuto-dim: rgba(15, 12, 30, 0.6);
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
}
.swipe-tuto-blur,
.swipe-tuto-ring,
.swipe-tuto-hand,
.swipe-tuto-card {
  opacity: 0;
  transition: opacity 240ms var(--tuto-ease), transform 240ms var(--tuto-ease);
}
.swipe-tuto.is-open .swipe-tuto-blur,
.swipe-tuto.is-open .swipe-tuto-ring,
.swipe-tuto.is-open .swipe-tuto-hand,
.swipe-tuto.is-open .swipe-tuto-card { opacity: 1; }
/* Entrada escalonada: primero el foco, luego el globo, al final la mano. */
.swipe-tuto.is-open .swipe-tuto-card { transition-delay: 60ms; }
.swipe-tuto.is-open .swipe-tuto-hand { transition-delay: 180ms; }
/* Salida rápida y sin escalonar. */
.swipe-tuto.is-closing .swipe-tuto-blur,
.swipe-tuto.is-closing .swipe-tuto-ring,
.swipe-tuto.is-closing .swipe-tuto-hand,
.swipe-tuto.is-closing .swipe-tuto-card {
  transition-duration: 160ms;
  transition-delay: 0ms;
}
/* Demostración: el contenido de la tarjeta acompaña a la mano (learn.js). */
.learn-area-header.is-tuto-demo > *,
.learn-area-header.is-tuto-demo .learn-area-bar-inner {
  transition:
    transform 900ms cubic-bezier(0.77, 0, 0.175, 1),
    opacity 900ms cubic-bezier(0.77, 0, 0.175, 1);
}
/* El estudiante ya está deslizando: la mano se aparta. */
.swipe-tuto.is-touching .swipe-tuto-hand { opacity: 0; transition-delay: 0ms; }

.swipe-tuto-blur {
  position: absolute;
  inset: 0;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  -webkit-mask-image: linear-gradient(#000 0 0), linear-gradient(#000 0 0);
  mask-image: linear-gradient(#000 0 0), linear-gradient(#000 0 0);
  -webkit-mask-position: 0 0, var(--hx) var(--hy);
  mask-position: 0 0, var(--hx) var(--hy);
  -webkit-mask-size: 100% 100%, var(--hw) var(--hh);
  mask-size: 100% 100%, var(--hw) var(--hh);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
.swipe-tuto-ring {
  position: absolute;
  left: var(--hx);
  top: var(--hy);
  width: var(--hw);
  height: var(--hh);
  border-radius: var(--hr);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 0 0 9999px var(--tuto-dim);
}
.swipe-tuto-hand {
  position: absolute;
  left: calc(var(--hx) + var(--hw) / 2);
  top: calc(var(--hy) + var(--hh) / 2);
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  display: grid;
  place-items: center;
}
.swipe-tuto-hand .material-symbols-outlined {
  font-size: 52px;
  color: #FFFFFF;
  font-variation-settings: 'FILL' 1;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
  animation: swipe-tuto-hand 1.9s var(--tuto-ease) infinite;
}
@keyframes swipe-tuto-hand {
  0%   { transform: translateX(48px) rotate(-8deg); opacity: 0; }
  15%  { transform: translateX(48px) rotate(-8deg); opacity: 1; }
  65%  { transform: translateX(-48px) rotate(-8deg); opacity: 1; }
  85%, 100% { transform: translateX(-48px) rotate(-8deg); opacity: 0; }
}
.swipe-tuto-card {
  position: absolute;
  left: 16px;
  right: 16px;
  top: calc(var(--hy) + var(--hh) + 16px);
  padding: 18px 18px 16px;
  border-radius: 20px;
  background: var(--bg-white);
  color: var(--text-primary);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  pointer-events: auto;
  transform: translateY(8px);
}
.swipe-tuto.is-open .swipe-tuto-card { transform: none; }
/* Pico hacia la tarjeta: el globo señala lo que se desliza. */
.swipe-tuto-card::before {
  content: '';
  position: absolute;
  top: -6px;
  left: calc(var(--hx) + var(--hw) / 2 - 16px - 7px);
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: inherit;
  transform: rotate(45deg);
}
.swipe-tuto-title {
  margin: 0 0 6px;
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
}
.swipe-tuto-text {
  margin: 0 0 14px;
  color: var(--text-primary);
  font-size: 14.5px;
  line-height: 1.45;
}
.swipe-tuto-btn {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 14px;
  background: var(--violet);
  color: #FFFFFF;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms var(--tuto-ease);
}
.swipe-tuto-btn:active { transform: scale(0.97); }
.swipe-tuto-btn:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  .swipe-tuto-hand .material-symbols-outlined { animation: none; }
}

/* ── Recorrido de bienvenida (js/utils/tour.js) ──
   Mismo lenguaje que el tutorial de deslizar, pero esta capa SÍ recibe los
   toques (se los traga: durante el recorrido no se abre nada por accidente).
   Sin desenfoque: el hueco se mueve de un paso a otro y una máscara no se
   puede animar; el oscurecido lo pone la sombra del anillo, que sí se mueve.
   Contraste: título y texto en --text-primary sobre --bg-white (el gris
   --text-secondary no pasa AA); "Saltar" también en --text-primary. */
.welcome-tour {
  --tuto-ease: cubic-bezier(0.23, 1, 0.32, 1);
  --tuto-move: cubic-bezier(0.77, 0, 0.175, 1);
  --tuto-dim: rgba(15, 12, 30, 0.62);
  position: fixed;
  inset: 0;
  z-index: 10000;
}
.welcome-tour-ring,
.welcome-tour-card {
  position: absolute;
  opacity: 0;
  transition: opacity 240ms var(--tuto-ease), transform 240ms var(--tuto-ease);
}
.welcome-tour.is-open .welcome-tour-ring,
.welcome-tour.is-open .welcome-tour-card { opacity: 1; }
.welcome-tour.is-open .welcome-tour-card { transition-delay: 60ms; }
.welcome-tour.is-closing .welcome-tour-ring,
.welcome-tour.is-closing .welcome-tour-card {
  transition-duration: 160ms;
  transition-delay: 0ms;
}

/* El anillo viaja de un paso al siguiente: movimiento en pantalla, ease-in-out. */
.welcome-tour-ring {
  left: var(--hx);
  top: var(--hy);
  width: var(--hw);
  height: var(--hh);
  border-radius: var(--hr);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.95), 0 0 0 9999px var(--tuto-dim);
  transition:
    opacity 240ms var(--tuto-ease),
    left 320ms var(--tuto-move),
    top 320ms var(--tuto-move),
    width 320ms var(--tuto-move),
    height 320ms var(--tuto-move),
    border-radius 320ms var(--tuto-move);
}
/* Sin nada que iluminar (p.ej. 769-1024 px, sin barra lateral ni de abajo):
   todo oscuro, solo la tarjeta. */
.welcome-tour:not(.has-hole) .welcome-tour-ring {
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  box-shadow: 0 0 0 9999px var(--tuto-dim);
}

.welcome-tour-card {
  width: min(340px, calc(100vw - 32px));
  padding: 18px 18px 16px;
  border-radius: 20px;
  background: var(--bg-white);
  color: var(--text-primary);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  transform: translateY(8px);
  transition:
    opacity 240ms var(--tuto-ease),
    transform 240ms var(--tuto-ease),
    left 320ms var(--tuto-move),
    top 320ms var(--tuto-move);
}
.welcome-tour.is-open .welcome-tour-card { transform: none; }

.welcome-tour-count {
  margin: 0 0 6px;
  color: var(--violet);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.2px;
}
[data-theme="dark"] .welcome-tour-count { color: #B79BFF; }
.welcome-tour-title {
  margin: 0 0 6px;
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
}
.welcome-tour-text {
  margin: 0 0 16px;
  color: var(--text-primary);
  font-size: 14.5px;
  line-height: 1.45;
}
.welcome-tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.welcome-tour-skip,
.welcome-tour-next {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms var(--tuto-ease);
}
.welcome-tour-skip {
  padding: 0 6px;
  background: none;
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.welcome-tour-next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 20px;
  background: var(--violet);
  color: #FFFFFF;
}
/* Último paso: "Empezar mi primera clase" no cabe al lado de "Ahora no" en un
   celular de 375 px (se partía en dos líneas). Va solo y a lo ancho; la
   salida, debajo. */
.welcome-tour-actions:has(.is-final) {
  flex-direction: column-reverse;
  align-items: stretch;
  gap: 6px;
}
.welcome-tour-actions:has(.is-final) .welcome-tour-skip { align-self: center; }
.welcome-tour-next .material-symbols-outlined {
  font-size: 20px;
  font-variation-settings: 'FILL' 1;
}
.welcome-tour-skip:active,
.welcome-tour-next:active { transform: scale(0.97); }
.welcome-tour.uses-keys .welcome-tour-skip:focus-visible,
.welcome-tour.uses-keys .welcome-tour-next:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; }
/* Con dedo o mouse, el foco que pone tour.js en cada paso no se pinta: se
   veía como un borde doble en el botón. */
.welcome-tour:not(.uses-keys) .welcome-tour-skip:focus,
.welcome-tour:not(.uses-keys) .welcome-tour-next:focus { outline: none; }

@media (prefers-reduced-motion: reduce) {
  .welcome-tour-ring,
  .welcome-tour-card { transition: opacity 160ms linear; }
}

/* ══════════════════════════════════════════════════════════════════════
   7. NAVEGACIÓN POR MÓDULOS (Duolingo: "← Etapa 1, Sección 1")
   El mapa muestra un módulo a la vez. La línea de la cabecera dice en qué
   módulo y tema estás y abre la pantalla de módulos (js/controllers/learn.js).

   Contraste medido:
   - Texto de la pantalla de módulos en --text-primary, o en --lm-muted
     (#5F5B57 = 6.6:1 sobre blanco; #A5A3B4 = 6.1:1 sobre #1C1C26). El gris
     --text-secondary (3.22:1) no se usa para leer.
   - El botón de cada módulo lleva tinta oscura (#16161D) sobre el color de la
     materia: ≥ 5.4:1 en las cinco. Blanco sobre esos colores no llega a 3:1.
   - La línea de la cabecera hereda el blanco sobre el color de la materia de
     toda la tarjeta (decisión de marca previa; no pasa AA en Matemáticas).
   ══════════════════════════════════════════════════════════════════════ */

/* Título y línea de módulo comparten fila: la tarjeta no crece. Si no caben
   (móvil angosto, nombre largo), la línea baja sola a la siguiente. */
.learn-area-header-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 10px;
  row-gap: 4px;
  min-width: 0;
}
.learn-area-header-left > .learn-area-desc {
  flex-basis: 100%;
}

.learn-module-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 28px;
  margin: 0;
  padding: 3px 6px 3px 10px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.14);
  color: #FFFFFF;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 160ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)), background-color 160ms ease;
}
.learn-module-nav[hidden] { display: none; }
.learn-module-nav .material-symbols-outlined { font-size: 18px; }
.learn-module-nav:active { transform: scale(0.97); }
.learn-module-nav:focus-visible {
  outline: 2px solid #FFFFFF;
  outline-offset: 2px;
}
@media (hover: hover) {
  .learn-module-nav:hover { background: rgba(0, 0, 0, 0.22); }
}

/* La barra compacta (móvil, al bajar) también abre la pantalla de módulos. */
.learn-area-bar-title {
  border: 0;
  padding: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* Mientras la pantalla de módulos está abierta, el mapa se aparta. */
.learn-tree-col.is-modules-open > .learn-area-header,
.learn-tree-col.is-modules-open > .learn-area-dots,
.learn-tree-col.is-modules-open > .learn-foryou-rail,
.learn-tree-col.is-modules-open > .skill-tree {
  display: none !important;
}

.learn-modules {
  --lm-muted: #5F5B57;
  --lm-done: #15803D;
  max-width: 640px;
  margin: 0 auto;
  padding: 4px 0 32px;
  animation: lm-enter 220ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}
[data-theme="dark"] .learn-modules {
  --lm-muted: #A5A3B4;
  --lm-done: #4ADE80;
}
.learn-modules[hidden] { display: none; }
@keyframes lm-enter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.learn-modules-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 8px 0 2px;
  border: 0;
  background: none;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 10px;
  transition: transform 160ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}
.learn-modules-back:active { transform: scale(0.97); }
.learn-modules-back:focus-visible { outline: 2px solid var(--hub-color, var(--violet)); outline-offset: 2px; }

.learn-modules-title {
  margin: 8px 0 4px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
}
.learn-modules-intro {
  margin: 0 0 20px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--lm-muted);
}

.learn-modules-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.learn-module-card {
  padding: 18px 20px;
  border: 1.5px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--bg-white);
}
.learn-module-card.is-current {
  border-color: var(--hub-color, var(--violet));
}

.learn-module-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.learn-module-name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-primary);
}
.learn-module-meta {
  margin: 2px 0 0;
  font-size: 0.8125rem;
  color: var(--lm-muted);
}
.learn-module-state {
  font-size: 24px;
  color: var(--lm-muted);
}
.learn-module-card.is-done .learn-module-state { color: var(--lm-done); }

.learn-module-desc {
  margin: 10px 0 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--lm-muted);
}

.learn-module-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.learn-module-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-secondary);
  overflow: hidden;
}
.learn-module-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--hub-color, var(--violet));
}
.learn-module-pct {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.learn-module-temas {
  list-style: none;
  margin: 14px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.learn-tema {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}
.learn-tema:active { transform: scale(0.98); }
.learn-tema:focus-visible { outline: 2px solid var(--hub-color, var(--violet)); outline-offset: 1px; }
@media (hover: hover) {
  .learn-tema:hover { background: var(--bg-hover); }
}
.learn-tema > .material-symbols-outlined {
  flex: none;
  font-size: 20px;
  color: var(--lm-muted);
}
.learn-tema.is-done > .material-symbols-outlined { color: var(--lm-done); }
.learn-tema.is-current > .material-symbols-outlined { color: var(--hub-color, var(--violet)); }
.learn-tema.is-current { font-weight: 700; }
.learn-tema-name {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}
.learn-tema-num {
  font-weight: 700;
  margin-right: 6px;
}
.learn-tema-count {
  flex: none;
  font-size: 0.8125rem;
  color: var(--lm-muted);
  font-variant-numeric: tabular-nums;
}

.learn-module-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  margin-top: 14px;
  padding: 10px 20px;
  border: 0;
  border-radius: 14px;
  background: var(--hub-color, var(--violet));
  color: #16161D;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)), filter 160ms ease;
}
.learn-module-cta .material-symbols-outlined { font-size: 20px; }
.learn-module-cta:active { transform: scale(0.97); }
.learn-module-cta:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }
@media (hover: hover) {
  .learn-module-cta:hover { filter: brightness(1.06); }
}
/* Un módulo bloqueado se puede mirar, pero el botón no grita. */
.learn-module-card.is-locked .learn-module-cta {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

@media (max-width: 768px) {
  /* El árbol pasa bajo la barra de navegación de abajo (glass); la lista
     necesita ese espacio para que el último botón no quede tapado. */
  .learn-modules { padding: 0 0 calc(112px + env(safe-area-inset-bottom, 0px)); }
  .learn-module-card { padding: 16px; }
  .learn-module-nav { min-height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .learn-modules { animation: none; }
  .learn-module-nav,
  .learn-modules-back,
  .learn-tema,
  .learn-module-cta { transition: none; }
}
.learn-modules-title:focus { outline: none; }

/* ── Próximamente (plan de la materia: shared/plan-modulos.json) ──
   Lo que viene se lee, pero no se toca: sin botón, sin color de materia. */
.learn-tema.is-soon {
  cursor: default;
}
.learn-tema.is-soon:active { transform: none; }
@media (hover: hover) {
  .learn-tema.is-soon:hover { background: none; }
}
.learn-tema-soon {
  flex: none;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--lm-muted);
}
.learn-module-card.is-soon {
  border-style: dashed;
  border-color: rgba(43, 43, 43, 0.22);
  background: transparent;
}
[data-theme="dark"] .learn-module-card.is-soon,
[data-theme="dark"] .skill-upcoming {
  border-color: rgba(232, 230, 240, 0.22);
}
.learn-module-soon-tag {
  flex: none;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 700;
}
.learn-module-soon-list {
  margin-top: 12px;
}
.learn-module-soon-list > summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
}
.learn-module-soon-list > summary:focus-visible {
  outline: 2px solid var(--hub-color, var(--violet));
  outline-offset: 2px;
  border-radius: 6px;
}
.learn-module-soon-list > .learn-module-temas { margin-top: 4px; }

/* Aviso al final del último módulo publicado. */
.skill-upcoming {
  --lm-muted: #5F5B57;
  max-width: 340px;
  margin: 40px auto 24px;
  padding: 20px;
  border: 1.5px dashed rgba(43, 43, 43, 0.22);
  border-radius: 14px;
  background: var(--bg-white);
  text-align: center;
}
[data-theme="dark"] .skill-upcoming { --lm-muted: #A5A3B4; }
.skill-upcoming-icon {
  font-size: 28px;
  color: var(--hub-color, var(--violet));
}
.skill-upcoming-title {
  margin: 6px 0 4px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
}
.skill-upcoming-text {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--lm-muted);
}
.skill-upcoming-btn {
  min-height: 44px;
  margin-top: 12px;
  padding: 8px 16px;
  border: 1.5px solid var(--hub-color, var(--violet));
  border-radius: 14px;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}
.skill-upcoming-btn:active { transform: scale(0.97); }
.skill-upcoming-btn:focus-visible { outline: 2px solid var(--hub-color, var(--violet)); outline-offset: 2px; }
.learn-modules-loading {
  padding: 24px 0;
  font-size: 0.9rem;
  color: var(--lm-muted);
}

/* Módulo oculto (sql/156): solo lo ven los admins. */
.learn-module-card.is-hidden {
  border-style: dashed;
}
.learn-module-hidden-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.learn-module-hidden-tag .material-symbols-outlined { font-size: 16px; }
