/* ══════════════════════════════════════════════════════════════════════
   SKORA — Mobile Redesign (Phase-by-Phase)
   Strategy: Override only. Desktop rules in learning.css stay untouched.
   
   Phase 1: Navigation Shell ✅
   Phase 2: Dashboard ✅
   Phase 3: Hub / Skill Tree ✅
   Phase 4: Secondary Pages ✅
   Phase 5: Polish ✅
   ══════════════════════════════════════════════════════════════════════ */

/* ─── 0. Mobile Design Tokens ───────────────────────────────────────── */
:root {
  --m-pad: 16px;
  --m-gap-sm: 8px;
  --m-gap-md: 12px;
  --m-gap-lg: 16px;
  --m-gap-xl: 24px;
  --m-card-r: 16px;
  --m-card-pad: 16px;
  --m-touch-min: 48px;
  --m-bottomnav-h: 64px;
}

/* ─── 1. Bottom Nav — Hidden on Desktop ─────────────────────────────── */
.bottom-nav {
  display: none;
}

/* ─── Materias View — Base Styles (all viewports) ───────────────────── */
.materias-container {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.materias-header {
  margin-bottom: 8px;
}

.materias-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 4px;
}

.materias-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin: 0;
}

.materias-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.materia-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #FFF;
  border: 1px solid #EDF0F5;
  border-radius: 20px;
  padding: 0;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.materia-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.materia-card-gradient {
  width: 88px;
  min-width: 88px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.materia-card-icon-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.materia-card-icon-ring .material-symbols-outlined {
  font-size: 26px;
  color: #FFF;
  font-variation-settings: 'wght' 500, 'FILL' 1;
}

.materia-card-bg-emoji {
  position: absolute;
  right: -8px;
  bottom: -8px;
  font-size: 42px;
  opacity: 0.12;
  pointer-events: none;
  z-index: 0;
}

.materia-card-body {
  flex: 1;
  min-width: 0;
  padding: 16px 0;
}

.materia-card-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.materia-card-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.materia-card-dot {
  opacity: 0.4;
}

.materia-card-progress-bg {
  height: 6px;
  background: #EDF0F5;
  border-radius: 3px;
  overflow: hidden;
  width: 92%;
}

.materia-card-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.materia-card-arrow {
  color: var(--text-secondary);
  font-size: 22px;
  opacity: 0.4;
  padding-right: 16px;
  flex-shrink: 0;
}

.materias-footer {
  margin-top: 8px;
}

.materias-quick-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--violet-light, rgba(108, 43, 255, 0.06));
  border: 1px solid rgba(108, 43, 255, 0.1);
  border-radius: 16px;
  text-decoration: none;
  color: var(--violet);
  font-size: 0.92rem;
  font-weight: 600;
  transition: background 0.2s ease;
}

.materias-quick-link:hover {
  background: rgba(108, 43, 255, 0.1);
}

.materias-quick-link .material-symbols-outlined:first-child {
  font-size: 22px;
}

/* ═══════════════════════════════════════════════════════════════════════
   PHASE 1: NAVIGATION SHELL
   
   Pattern: Duolingo mobile — NO top navbar, bottom nav is the ONLY
   fixed navigation element. Content starts immediately.
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── 1a. Sidebar Hide (≤ 1024px) ───────────────────────────────────── */
@media (max-width: 1024px) {

  .sidebar,
  #canonical-sidebar {
    display: none !important;
  }
}

/* ─── 1b. Mobile Shell (≤ 768px) ────────────────────────────────────── */
@media (max-width: 768px) {

  /* ── Content Spacing — No topbar, just breathing room ── */
  .main-content {
    padding: 8px var(--m-pad) calc(var(--m-bottomnav-h) + var(--m-pad) + env(safe-area-inset-bottom, 0px)) var(--m-pad) !important;
    max-width: 100% !important;
  }

  /* ── Bottom Navigation Bar — Glassmorphism, iOS-style ── */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--m-bottomnav-h);
    /* Glass effect */
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    /* Ultra-thin top border */
    border-top: 0.5px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 -1px 12px rgba(0, 0, 0, 0.03);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* ── Nav Items ── */
  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #9CA3AF;
    flex: 1;
    height: 100%;
    min-height: var(--m-touch-min);
    gap: 2px;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
  }

  /* Icon styling */
  .bottom-nav-item .material-symbols-outlined {
    font-size: 22px;
    font-variation-settings: 'wght' 300, 'FILL' 0;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    line-height: 1;
  }

  /* Label — hidden to only show icons */
  .bottom-nav-label {
    display: none;
  }

  .bottom-nav-item img {
    margin-bottom: 0 !important;
  }

  /* ── Active State ── */
  .bottom-nav-item.active {
    color: var(--violet, #6C2BFF);
  }

  .bottom-nav-item.active .material-symbols-outlined {
    font-variation-settings: 'wght' 500, 'FILL' 1;
    transform: translateY(-1px);
    font-size: 24px;
  }

  .bottom-nav-item.active .bottom-nav-label {
    font-weight: 700;
  }

  /* Active indicator dot */
  .bottom-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 6px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--violet, #6C2BFF);
  }

  /* ── Tap Feedback ── */
  .bottom-nav-item:active {
    transform: scale(0.92);
    transition: transform 0.1s ease;
  }

  .bottom-nav-item:active .material-symbols-outlined {
    transition: transform 0.1s ease;
  }


  /* ── Hide Fox Mascot on Mobile (user feedback) ── */
  .coach-mascot-container {
    display: none !important;
  }

  /* ── Keep Topbar structure for bottom sheets but hide visual elements ── */
  .learn-tabs,
  .learn-stat {
    display: none !important;
  }

  .learn-topbar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    pointer-events: none;
    z-index: 2000;
    border: none !important;
    background: transparent !important;
  }

  .learn-area-header {
    margin: 0 0 8px 0 !important;
    border-radius: 20px !important;
    padding: 24px 20px !important;
    touch-action: pan-y !important;
    /* Enable vertical scroll, capture horizontal */
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08) !important;
    position: relative;
    overflow: hidden;
  }

  /* Area Dots */
  .learn-area-dots {
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-bottom: 24px;
  }

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

  .learn-area-dot.active {
    width: 16px;
    border-radius: 4px;
    background: 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,
  .learn-side-legal {
    display: none !important;
  }



  /* ═════════════════════════════════════════════════════════════════════
     MATERIAS VIEW — Premium Subject Grid
     ═════════════════════════════════════════════════════════════════════ */

  .materias-container {
    display: flex;
    flex-direction: column;
    gap: var(--m-gap-xl);
  }

  .materias-header {
    text-align: center;
    padding-top: 8px;
  }

  .materias-title {
    font-size: 1.5rem !important;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
  }

  .materias-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
  }

  .materias-grid {
    display: flex;
    flex-direction: column;
    gap: var(--m-gap-md);
  }

  /* ── Subject Card ── */
  .materia-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #FFF;
    border: 1px solid #EDF0F5;
    border-radius: 18px;
    padding: 0;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .materia-card:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  }

  /* Gradient left strip */
  .materia-card-gradient {
    width: 72px;
    min-width: 72px;
    min-height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
  }

  .materia-card-icon-ring {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
  }

  .materia-card-icon-ring .material-symbols-outlined {
    font-size: 22px;
    color: #FFF;
    font-variation-settings: 'wght' 500, 'FILL' 1;
  }

  .materia-card-bg-emoji {
    display: none !important;
  }

  /* Card body */
  .materia-card-body {
    flex: 1;
    min-width: 0;
    padding: 14px 0;
  }

  .materia-card-name {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 3px;
    color: var(--text-primary);
  }

  .materia-card-meta {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
  }

  .materia-card-dot {
    opacity: 0.4;
  }

  .materia-card-progress-bg {
    height: 5px;
    background: #EDF0F5;
    border-radius: 3px;
    overflow: hidden;
    width: 90%;
  }

  .materia-card-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  }

  /* Arrow */
  .materia-card-arrow {
    color: var(--text-secondary);
    font-size: 20px;
    opacity: 0.4;
    padding-right: 14px;
    flex-shrink: 0;
  }

  /* ── Quick Access Footer ── */
  .materias-footer {
    margin-top: 4px;
  }

  .materias-quick-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--violet-light, rgba(108, 43, 255, 0.06));
    border: 1px solid rgba(108, 43, 255, 0.1);
    border-radius: 14px;
    text-decoration: none;
    color: var(--violet);
    font-size: 0.88rem;
    font-weight: 600;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .materias-quick-link:active {
    background: rgba(108, 43, 255, 0.12);
  }

  .materias-quick-link .material-symbols-outlined:first-child {
    font-size: 20px;
  }


  /* ═════════════════════════════════════════════════════════════════════
     PHASE 2: DASHBOARD
     Compact, single-column, breathing room — app-native feel.
     ═════════════════════════════════════════════════════════════════════ */

  /* ── Dashboard Header Premium Mobile Hero ── */
  .dashboard-header {
    background: linear-gradient(135deg, #FF2A85 0%, #8A2BE2 100%) !important;
    border-radius: 28px !important;
    padding: 32px 24px !important;
    color: #FFFFFF !important;
    margin-top: 16px !important;
    margin-bottom: 24px !important;
    box-shadow: 0 16px 32px rgba(138, 43, 226, 0.25) !important;
    text-align: left !important;
    position: relative;
    overflow: hidden;
    flex-direction: column !important;
  }

  .dashboard-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
    pointer-events: none;
  }

  .dashboard-header>div {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    z-index: 1;
    position: relative;
    width: 100%;
  }

  .dashboard-title {
    color: #FFFFFF !important;
    font-size: 1.8rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.5px !important;
    margin-bottom: 8px !important;
    justify-content: flex-start !important;
    width: 100% !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .dashboard-title span.material-symbols-outlined {
    color: #FFD700 !important;
  }

  .dashboard-header div[style*="color: var(--text-secondary)"] {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 1rem !important;
  }

  .dashboard-header div[style*="color: var(--text-secondary)"] span {
    color: #FFFFFF !important;
    background: rgba(255, 255, 255, 0.2) !important;
    padding: 2px 8px !important;
    border-radius: 12px !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
  }

  /* ── Streak Badge Premium Inline ── */
  .streak-visual {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 20px !important;
    padding: 16px !important;
    margin-top: 24px !important;
    width: 100% !important;
    z-index: 1;
    position: relative;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05) !important;
  }

  .streak-badge {
    background: transparent !important;
    border: none !important;
    color: #FFFFFF !important;
    padding: 0 !important;
    font-size: 1.15rem !important;
    font-weight: 800 !important;
    margin-bottom: 12px !important;
    box-shadow: none !important;
    justify-content: flex-start !important;
  }

  .streak-badge .streak-pulse {
    color: #FFB020 !important;
    font-size: 24px !important;
  }

  .streak-visual-bar-bg {
    background: rgba(255, 255, 255, 0.2) !important;
    height: 6px !important;
    border-radius: 4px !important;
    margin-bottom: 8px !important;
  }

  .streak-visual-bar-fill {
    background: #FFFFFF !important;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8) !important;
    border-radius: 4px !important;
  }

  .streak-visual-text {
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    text-align: left !important;
    display: block !important;
  }

  /* ── Dashboard Grid — Single column ── */
  .dashboard-grid {
    grid-template-columns: 1fr !important;
    gap: var(--m-gap-lg) !important;
    margin-bottom: var(--m-gap-xl) !important;
  }

  .side-cards-stack {
    gap: var(--m-gap-lg);
  }

  /* ── Mission Card — Compact Mobile Premium ── */
  .mission-card {
    padding: 24px !important;
    border-radius: 24px !important;
    background: #FFFFFF !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05), 0 2px 8px rgba(0, 0, 0, 0.02) !important;
    border: 1px solid rgba(0, 0, 0, 0.03) !important;
    gap: var(--m-gap-lg) !important;
  }

  .mission-header {
    font-size: 1.05rem;
    gap: 8px;
  }

  .mission-content {
    gap: var(--m-gap-md);
  }

  .coach-mascot-img {
    height: 72px;
  }

  .coach-bubble {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
  }

  .coach-bubble::before {
    width: 10px;
    height: 10px;
    left: -5px;
  }

  .mission-progress {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-top: 4px;
  }

  .mission-progress-text {
    font-size: 0.8rem;
  }

  /* ── Stats Cards — Compact Mobile Premium ── */
  .stats-card {
    padding: 24px !important;
    border-radius: 24px !important;
    background: #FFFFFF !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05), 0 2px 8px rgba(0, 0, 0, 0.02) !important;
    border: 1px solid rgba(0, 0, 0, 0.03) !important;
  }

  .stats-header {
    font-size: 1.1rem !important;
    font-weight: 800 !important;
    margin-bottom: var(--m-gap-lg);
    color: var(--text-primary) !important;
    letter-spacing: -0.2px !important;
  }

  .stats-score-main {
    font-size: 2.2rem !important;
    font-weight: 800 !important;
    letter-spacing: -1px !important;
  }

  /* ── Score Ring — Optimized ── */
  .score-ring {
    width: 120px !important;
    height: 120px !important;
    margin: 16px auto 24px auto !important;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.02) !important;
  }

  .score-ring::after {
    width: 96px !important;
    height: 96px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
  }

  .score-ring-value {
    font-size: 1.8rem !important;
    font-weight: 800 !important;
  }

  /* ── Areas Grid — 2 tight columns ── */
  .areas-section-header {
    margin-bottom: var(--m-gap-lg);
    flex-direction: column;
    gap: 2px;
  }

  .areas-section-title {
    font-size: 1.05rem;
  }

  .areas-section-sub {
    font-size: 0.78rem;
  }

  .areas-grid-container {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--m-gap-md) !important;
  }

  .area-mini-card {
    padding: 14px !important;
    border-radius: 14px !important;
  }

  .area-icon-box {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    margin-bottom: 10px;
  }

  .area-icon-box .material-symbols-outlined {
    font-size: 18px;
  }

  .area-name {
    font-size: 0.82rem;
  }

  .area-progress-text {
    font-size: 0.7rem;
    margin-bottom: 8px;
  }

  /* ── Upsell Card — Compact ── */
  .upsell-card {
    padding: 14px !important;
    border-radius: var(--m-card-r) !important;
    gap: var(--m-gap-md);
  }

  .upsell-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 10px;
  }

  .upsell-title {
    font-size: 0.88rem;
  }

  .upsell-text {
    font-size: 0.75rem;
  }

  /* ── Coach Float — Above bottom nav ── */
  .coach-float-anchor {
    bottom: calc(var(--m-bottomnav-h) + 12px) !important;
    right: var(--m-pad) !important;
  }

  /* ── Quick Actions Pills — Scrollable ── */
  .dashboard-pills {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-wrap: nowrap !important;
    gap: var(--m-gap-sm);
    padding-bottom: 4px;
  }

  .dashboard-pills::-webkit-scrollbar {
    display: none;
  }

  .dashboard-pills .pill-tag {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 0.78rem;
    padding: 6px 12px;
  }


  /* ═════════════════════════════════════════════════════════════════════
     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;
  }

  /* ── Skill Tree — Premium Duolingo Mobile Style ── */
  .skill-tree-container {
    padding: 24px 0 !important;
    overflow-x: hidden;
  }

  /* Mobile path lanes: keep lessons centered, branches compact */
  .skill-node {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .skill-node[data-zigzag="1"] {
    justify-content: center !important;
    padding-left: 0 !important;
  }

  .skill-node[data-zigzag="3"] {
    justify-content: center !important;
    padding-right: 0 !important;
  }

  .skill-tree {
    --lane-offset: 70px;
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  .skill-node[data-path-lane="right"]::before,
  .skill-node[data-path-lane="left"]::before {
    width: 34px !important;
  }

  /* Premium 3D Button Resizing */
  .skill-node-circle {
    width: 72px !important;
    height: 72px !important;
  }

  .skill-node-circle .material-symbols-outlined {
    font-size: 28px !important;
  }

  .skill-node.is-active .skill-node-circle::after {
    inset: -12px !important;
  }

  /* Active Node Gentle Float */
  .skill-node.is-active .skill-node-circle {
    animation: mobileNodeFloat 3s ease-in-out infinite !important;
  }

  @keyframes mobileNodeFloat {

    0%,
    100% {
      transform: translateY(0);
    }

    50% {
      transform: translateY(-4px);
    }
  }

  /* Playful Thicker Connectors */
  .skill-connector {
    height: 26px !important;
    width: 12px !important;
    border-radius: 6px !important;
    margin: 4px 0 !important;
  }

  .skill-node-info {
    text-align: center;
    max-width: 140px;
  }

  .skill-node-title {
    font-size: 0.85rem !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;
  }

  /* ── Hub Cards ── */
  .hub-card,
  .module-card {
    border-radius: var(--m-card-r) !important;
    padding: var(--m-card-pad) !important;
  }


  /* ═════════════════════════════════════════════════════════════════════
     PHASE 4: SECONDARY PAGES (Quizzes, Simulacros, Progress, Profile)
     World-class mobile app standards (iOS/Android native feel).
     ═════════════════════════════════════════════════════════════════════ */

  /* ── Universal Native Card Touch State ── */
  .quiz-card,
  .challenge-card,
  .progress-card,
  .progress-stat-card {
    border-radius: var(--m-card-r) !important;
    padding: var(--m-card-pad) !important;
    background: var(--bg-white, #FFFFFF) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important;
    border: 1px solid rgba(0, 0, 0, 0.03) !important;
    transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.2s ease !important;
    -webkit-tap-highlight-color: transparent;
  }

  .quiz-card:active,
  .challenge-card:active {
    transform: scale(0.97) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
  }

  /* ── Quizzes Page ── */
  .quizzes-container,
  .quiz-container {
    padding: 0 !important;
    gap: var(--m-gap-lg) !important;
  }

  .quiz-list {
    gap: var(--m-gap-md) !important;
  }

  /* Pills bar — horizontal scroll with gradient mask for scroll hint */
  .pills-bar-wrapper {
    position: relative;
    margin: 0 calc(-1 * var(--m-pad));
  }

  .pills-bar-wrapper::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 32px;
    background: linear-gradient(to left, var(--bg-body, #FAFAFC), transparent);
    pointer-events: none;
  }

  .pills-bar,
  .filter-pills {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap !important;
    gap: var(--m-gap-sm) !important;
    padding: 4px var(--m-pad) 12px var(--m-pad) !important;
  }

  .pills-bar::-webkit-scrollbar,
  .filter-pills::-webkit-scrollbar {
    display: none;
  }

  .pills-bar .pill-tag,
  .filter-pills .pill-tag,
  .filter-pill {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    padding: 8px 18px !important;
    border-radius: 20px !important;
    min-height: 38px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  }

  /* ── Simulacros / Arena (Premium Redesign) ── */
  .arena-container {
    gap: var(--m-gap-xl) !important;
  }

  /* Hero / Chart Card */
  .arena-hero {
    background: linear-gradient(145deg, #FFFFFF, #F8F9FB) !important;
    border: none !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.02) !important;
    border-radius: 28px !important;
    padding: 24px 20px !important;
  }

  .arena-hero-title {
    font-size: 1.1rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.3px !important;
  }

  .arena-hero-best {
    background: rgba(234, 179, 8, 0.15) !important;
    padding: 6px 16px !important;
    font-size: 0.9rem !important;
  }

  .arena-split {
    flex-direction: column !important;
    gap: var(--m-gap-xl) !important;
  }

  .arena-left,
  .arena-right {
    width: 100% !important;
    max-width: 100% !important;
  }

  .arena-section-label {
    font-size: 1rem !important;
    font-weight: 800 !important;
    color: var(--text-primary) !important;
    margin-bottom: 14px !important;
    letter-spacing: -0.2px !important;
    text-transform: none !important;
  }

  /* Evolution Chart */
  .arena-chart-container {
    min-height: 180px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 var(--m-pad) 12px var(--m-pad) !important;
    margin: 0 calc(-1 * var(--m-pad));
    scrollbar-width: none;
  }

  .arena-chart-container::-webkit-scrollbar {
    display: none;
  }

  .arena-chart-bars {
    height: 140px !important;
    gap: 16px !important;
    align-items: flex-end !important;
  }

  .arena-chart-bar-wrap {
    min-width: 36px !important;
  }

  .arena-chart-bar {
    border-radius: 8px 8px 8px 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
  }

  .arena-chart-val {
    font-size: 0.75rem !important;
    margin-bottom: 2px !important;
  }

  .arena-chart-label {
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    margin-top: 6px !important;
  }

  .arena-title {
    font-size: 1.45rem !important;
    letter-spacing: -0.5px !important;
    font-weight: 800 !important;
  }

  .arena-desc {
    font-size: 0.95rem !important;
    line-height: 1.4 !important;
    color: var(--text-secondary) !important;
  }

  /* Challenge Cards */
  .arena-challenge {
    background: color-mix(in srgb, var(--challenge-color, var(--violet)) 3%, #fff) !important;
    border: 1px solid color-mix(in srgb, var(--challenge-color, var(--violet)) 10%, transparent) !important;
    border-radius: 24px !important;
    padding: 18px !important;
    gap: 16px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.02) !important;
  }

  .arena-challenge-icon {
    width: 52px !important;
    height: 52px !important;
    border-radius: 16px !important;
    font-size: 26px !important;
    background: color-mix(in srgb, var(--challenge-color, var(--violet)) 12%, transparent) !important;
  }

  .arena-challenge-title {
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    letter-spacing: -0.2px !important;
    margin-bottom: 2px !important;
  }

  .arena-challenge-meta {
    font-size: 0.85rem !important;
    font-weight: 500 !important;
  }

  .arena-challenge-btn {
    padding: 10px 20px !important;
    font-size: 0.85rem !important;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--challenge-color, var(--violet)) 25%, transparent) !important;
  }

  /* History Cards */
  .arena-history-item {
    background: #FFFFFF !important;
    border: 1px solid rgba(0, 0, 0, 0.03) !important;
    border-radius: 20px !important;
    padding: 16px !important;
    gap: 14px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02) !important;
  }

  .arena-history-dot {
    width: 12px !important;
    height: 12px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
  }

  .arena-history-title {
    font-size: 0.95rem !important;
    font-weight: 700 !important;
  }

  .arena-history-date {
    font-size: 0.8rem !important;
    margin-top: 2px !important;
  }

  .arena-history-score {
    font-size: 0.95rem !important;
    padding: 6px 14px !important;
  }

  /* ── Progress Page ── */
  .progress-container {
    gap: var(--m-gap-xl) !important;
  }

  .progress-radar-container {
    min-height: 260px !important;
    padding: 8px 0;
  }

  .progress-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--m-gap-md) !important;
  }

  /* ── Profile Page ── */
  .profile-layout {
    grid-template-columns: 1fr !important;
    gap: var(--m-gap-lg) !important;
  }

  .profile-hero {
    border-radius: var(--m-card-r) !important;
    padding: var(--m-gap-xl) var(--m-card-pad) !important;
    flex-direction: column !important;
    text-align: center !important;
  }

  .profile-hero-avatar {
    width: 72px !important;
    height: 72px !important;
    font-size: 1.8rem !important;
  }

  .profile-hero-since {
    justify-content: center;
  }

  .profile-hero-badges {
    justify-content: center;
  }

  .profile-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--m-gap-md) !important;
  }

  .profile-stat-value {
    font-size: 1.25rem !important;
    font-weight: 800 !important;
  }

  .profile-stat-label {
    font-size: 0.75rem !important;
  }

  .profile-achievements-grid {
    justify-content: center;
  }

  .profile-section-card {
    border-radius: var(--m-card-r) !important;
    padding: var(--m-card-pad) !important;
  }

  .profile-upgrade-card {
    border-radius: var(--m-card-r) !important;
  }

  /* ── Settings Page ── */
  .settings-main {
    padding: var(--m-pad) var(--m-pad) calc(var(--m-bottomnav-h) + var(--m-pad) + env(safe-area-inset-bottom, 0px)) var(--m-pad) !important;
  }


  /* ═════════════════════════════════════════════════════════════════════
     PHASE 5: POLISH
     No-hover, reduced motion, safe areas, smooth scroll.
     ═════════════════════════════════════════════════════════════════════ */

  /* ── Kill hover transforms on touch devices ── */
  .area-mini-card:hover,
  .stats-card:hover,
  .mission-card:hover,
  .upsell-card:hover,
  .challenge-card:hover,
  .quiz-item:hover,
  .skill-node-circle:hover {
    transform: none !important;
    box-shadow: inherit;
  }

  /* ── Active press feedback instead of hover ── */
  .area-mini-card:active,
  .challenge-card:active,
  .quiz-item:active,
  .upsell-card:active {
    transform: scale(0.97);
    transition: transform 0.1s ease;
  }

  /* ── Smooth scroll ── */
  html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--m-pad);
  }

  /* ── Safe area awareness ── */
  body {
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  /* ── Page titles — Compact for all pages ── */
  .page-title,
  .section-title {
    font-size: 1.35rem !important;
    margin-bottom: var(--m-gap-lg) !important;
  }

  /* ═════════════════════════════════════════════════════════════════════
     PROGRESS VIEW — DONUT HERO (MOBILE ONLY)
     ═════════════════════════════════════════════════════════════════════ */
  #progress-donut-hero {
    display: flex !important;
    margin-top: 16px;
    margin-bottom: 24px;
    justify-content: center;
  }

  #progress-global-title,
  #progress-global-stats {
    display: none !important;
  }

  .donut-hero-card {
    background: #fff;
    border-radius: var(--m-card-r);
    padding: var(--m-card-pad);
    width: 100%;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .donut-hero-bg {
    position: absolute;
    top: -50px;
    left: -50px;
    right: -50px;
    height: 180px;
    background: linear-gradient(135deg, rgba(255, 42, 133, 0.1), rgba(138, 43, 226, 0.15));
    border-radius: 50%;
    filter: blur(40px);
    z-index: 0;
  }

  .donut-hero-content {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .donut-hero-header {
    text-align: center;
    margin-bottom: 16px;
  }

  .donut-hero-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .donut-hero-accuracy {
    font-size: 2.2rem;
    font-weight: 900;
    line-height: 1;
    margin-top: 4px;
  }

  .donut-chart-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
  }

  .donut-chart {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
  }

  .donut-bg {
    fill: none;
    stroke: #EDF0F5;
    stroke-width: 8;
  }

  .donut-progress {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  .donut-mascot {
    position: absolute;
    width: 70px;
    height: 70px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }

  .donut-mascot img {
    width: 85%;
    height: 85%;
    object-fit: contain;
  }

  .donut-hero-footer {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }

  .donut-hero-advice {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--violet);
    text-align: center;
    background: rgba(108, 43, 255, 0.08);
    padding: 8px 16px;
    border-radius: 20px;
  }

  .donut-hero-stats {
    display: flex;
    width: 100%;
    justify-content: space-around;
    background: #F8FAFC;
    border-radius: 12px;
    padding: 12px 0;
  }

  .donut-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
  }

  .donut-stat-val {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
  }

  .donut-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
  }

}

/* end @media 768px — ALL PHASES */


/* ═══════════════════════════════════════════════════════════════════════
   GLOBAL MOBILE SAFETY (applies to all sizes)
   ═══════════════════════════════════════════════════════════════════════ */
html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

/* Anti-web: remove tap highlight on all interactive elements */
@media (max-width: 768px) {

  a,
  button,
  input,
  select,
  textarea,
  [role="button"],
  [tabindex] {
    -webkit-tap-highlight-color: transparent;
  }

  /* ── Evaluar Action Sheet (Mobile Bottom Nav) ── */
  .evaluar-action-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 200;
    background: var(--bg-white, #FFFFFF);
    border-radius: 28px 28px 0 0;
    padding: 12px 24px 32px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
    pointer-events: none;
  }

  .evaluar-action-sheet.visible {
    transform: translateY(0);
    pointer-events: auto;
  }

  .evaluar-sheet-drag-handle {
    width: 40px;
    height: 5px;
    background: #E5E7EB;
    border-radius: 4px;
    margin: 0 auto 16px;
  }

  .evaluar-sheet-title {
    font-size: 1.15rem;
    font-weight: 800;
    text-align: center;
    color: var(--text-primary);
    margin: 0 0 20px;
    letter-spacing: -0.3px;
  }

  .evaluar-sheet-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .evaluar-sheet-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-primary, #F9FAFB);
    border: 1px solid var(--border-subtle, #F3F4F6);
    border-radius: 20px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .evaluar-sheet-option:active {
    transform: scale(0.97);
    background: #F3F4F6;
  }

  .evaluar-sheet-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: #FFFFFF;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .evaluar-sheet-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
  }

  .evaluar-sheet-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .evaluar-sheet-opt-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
  }

  .evaluar-sheet-opt-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
  }

  [data-theme="dark"] .evaluar-action-sheet {
    background: #1F2937;
  }

  [data-theme="dark"] .evaluar-sheet-option {
    background: #111827;
    border-color: #374151;
  }

  [data-theme="dark"] .evaluar-sheet-icon {
    background: #374151;
  }

  /* ── Mobile Streak Bottom Sheet ── */
  .streak-hover-card {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    min-height: auto !important;
    max-height: 85vh !important;
    border-radius: 24px 24px 0 0 !important;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15) !important;
    transform: translateY(100%) scale(1) !important;
    opacity: 1 !important;
    visibility: hidden;
    z-index: 2100 !important;
    padding-bottom: env(safe-area-inset-bottom, 24px) !important;
    overflow-y: auto !important;
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.4s !important;
    background: var(--bg-white, #fff) !important;
    pointer-events: auto !important;
  }

  .streak-hover-card.open {
    transform: translateY(0) scale(1) !important;
    visibility: visible !important;
  }

  .streak-hover-handle {
    display: block !important;
    width: 40px;
    height: 5px;
    background: #E5E7EB;
    border-radius: 3px;
    margin: 12px auto 8px;
  }

  /* Prevent rubber-band overscroll (feels more native) */
  html {
    overscroll-behavior: none;
  }

  /* Touch-optimized buttons */
  .btn-primary,
  .btn-secondary,
  .btn-outline,
  button {
    touch-action: manipulation;
  }

  /* ── Mobile Subject Swipe (Cambio 2) ── */
  .learn-topbar {
    padding: 0 !important;
    gap: 0 !important;
  }

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

  .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));
  }
}

/* ── Reduced motion preference ── */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}