/* ============================================================
   grammar/mobile-app.css — 语法端移动端 M3 皮肤（≤767px）
   桌面端（≥768px，含平板）完全不受影响，现有样式原样保留。
   因内联样式/已有媒体查询特异性较高，本层覆盖统一使用 !important，
   且仅作用于移动端断点内。
   ============================================================ */
@media (max-width: 767px) {
  /* ========== 基础 ========== */
  * {
    -webkit-tap-highlight-color: transparent;
  }
  body {
    padding: 0 12px calc(20px + env(safe-area-inset-bottom, 0px)) !important;
  }
  input, select, textarea, button {
    font-size: 16px !important;
  }
  button, a, .topic-item, .category-item-header, .category-toggle {
    touch-action: manipulation;
  }

  /* ========== 顶部导航 → AppBar ========== */
  .unified-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: calc(env(safe-area-inset-top, 0px) + 6px) 4px 6px !important;
    margin: 0 -12px 12px !important;
    background: rgba(249, 250, 251, 0.92) !important;
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  }
  .header-card {
    max-width: none !important;
    padding: 4px 8px !important;
    gap: 8px !important;
  }
  .header-brand {
    gap: 6px !important;
  }
  .header-brand img, .header-brand svg {
    width: 28px !important;
    height: 28px !important;
  }
  .header-nav {
    border-radius: 999px !important;
  }
  .nav-pill {
    padding: 5px 12px !important;
    font-size: 0.75rem !important;
  }

  /* ========== 标题层级 ========== */
  h1 {
    font-size: 1.35rem !important;
  }

  /* ========== 知识点列表 → M3 卡片 ========== */
  .category-list {
    gap: 8px !important;
  }
  .category-item-header {
    border-radius: 14px !important;
    padding: 12px 14px !important;
    min-height: 48px;
    gap: 8px !important;
  }
  .category-checkbox {
    width: 20px !important;
    height: 20px !important;
  }
  .category-toggle {
    font-size: 0.7rem !important;
  }
  .category-topics {
    gap: 6px !important;
    margin-top: 6px !important;
  }
  .topic-item {
    border-radius: 12px !important;
    padding: 10px 14px !important;
    min-height: 44px;
    gap: 8px !important;
  }
  .topic-count {
    font-size: 0.68rem !important;
  }

  /* ========== 练习区 ========== */
  .section {
    margin-top: 14px !important;
  }
  .stats-grid, .stat-item {
    border-radius: 14px !important;
  }
  .progress-bar {
    height: 8px !important;
    border-radius: 999px !important;
  }

  /* ========== 登录遮罩 → App 风格 ========== */
  .auth-gate {
    padding: 16px !important;
  }
  .auth-gate-card {
    border-radius: 20px !important;
    padding: 28px 20px !important;
    width: 100% !important;
    max-width: 360px !important;
  }
  .auth-gate-logo {
    width: 64px !important;
    height: 64px !important;
    font-size: 2rem !important;
    border-radius: 20px !important;
  }
  .auth-gate-actions {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .auth-gate-btn {
    width: 100% !important;
    min-height: 46px !important;
    border-radius: 999px !important;
    font-size: 0.9rem !important;
  }

  /* ========== 弹窗 → 底部抽屉化（主弹窗） ========== */
  #upgradeModal, #webtestingModal, #authModal, [class*="modal"] {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  #upgradeModal > div, #webtestingModal > div, [class*="modal"] > div:not([class*="gate"]) {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: 85vh !important;
  }

  /* ========== 隐藏桌面滚动条 ========== */
  ::-webkit-scrollbar {
    width: 4px;
    height: 4px;
  }
}
