@media (max-width: 980px) {
  .topbar-inner,
  .container,
  .footer-inner {
    width: min(100% - 24px, 1220px);
  }

  .nav-links {
    display: none;
  }

  .mobile-nav-toggle {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    border: 1px solid var(--rfa-line);
    background: var(--rfa-surface-muted);
    color: var(--rfa-text);
    cursor: pointer;
  }

  .mobile-drawer {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(360px, 100vw);
    max-width: 100%;
    padding: 22px;
    box-sizing: border-box;
    display: grid;
    align-content: start;
    gap: 18px;
    background: linear-gradient(180deg, rgba(8, 16, 28, 0.98), rgba(13, 24, 42, 0.98));
    border-right: 1px solid var(--rfa-line);
    box-shadow: var(--rfa-shadow-strong);
    transform: translateX(calc(-100% - 2px));
    transition: transform var(--rfa-transition);
    z-index: 60;
  }

  :root[data-theme='light'] .mobile-drawer {
    background: linear-gradient(180deg, rgba(248, 251, 255, 0.98), rgba(238, 245, 252, 0.98));
  }

  .mobile-drawer.is-open {
    transform: translateX(0);
  }

  .mobile-drawer-head,
  .mobile-drawer-nav,
  .mobile-drawer-actions {
    display: grid;
    gap: 12px;
  }

  .mobile-drawer-head {
    grid-template-columns: 1fr auto;
    align-items: start;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--rfa-line);
  }

  .mobile-drawer-nav a,
  .mobile-drawer-actions a {
    min-height: 44px;
    border-radius: 0;
    border: 1px solid var(--rfa-line);
    background: var(--rfa-surface-muted);
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 700;
  }

  .mobile-close-btn,
  .mobile-overlay {
    border: 0;
  }

  .mobile-close-btn {
    width: 42px;
    height: 42px;
    border-radius: 0;
    background: var(--rfa-surface-muted);
    color: var(--rfa-text);
    cursor: pointer;
  }

  .mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 8, 18, 0.58);
    z-index: 50;
  }

  .card-grid,
  .stat-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 981px) {
  .mobile-nav-toggle,
  .mobile-drawer,
  .mobile-overlay {
    display: none !important;
  }
}

@media (max-width: 720px) {
  html {
    scroll-padding-top: 84px;
  }

  .mobile-drawer,
  .home-mobile-menu,
  .teacher-mobile-menu,
  .mobile-sidebar {
    width: min(100vw, 360px);
    max-width: 100%;
    box-sizing: border-box;
    padding: 18px;
  }

  .mobile-drawer-head,
  .sidebar-brand,
  .mobile-sidebar-brand {
    gap: 10px;
  }

  .mobile-drawer-nav a,
  .mobile-drawer-actions a,
  .nav-item,
  .mobile-menu-close-btn {
    min-height: 42px;
    padding: 10px 12px;
  }

  .section {
    padding: 38px 0 42px;
  }

  .feature-card,
  .stat-card,
  .cta-shell {
    padding: 18px;
  }
}

@media (max-width: 480px) {
  .mobile-drawer,
  .home-mobile-menu,
  .teacher-mobile-menu,
  .mobile-sidebar {
    width: 100vw;
    max-width: 100%;
    box-sizing: border-box;
    padding: 14px;
  }

  .mobile-drawer-nav a,
  .mobile-drawer-actions a,
  .nav-item,
  .mobile-menu-close-btn {
    min-height: 40px;
    padding: 9px 10px;
    font-size: 0.92rem;
  }
}