/* 极点 · 移动端整体美化与优化 (2026)
   提升可读性、触控体验、间距与视觉层次 */

/* 基础移动端改进 */
@media (max-width: 900px) {
  body {
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
  }

  .container {
    margin-left: 16px !important;
    margin-right: 16px !important;
    padding-top: 16px !important;
    padding-bottom: 80px; /* 为可能的底部操作留空 */
  }

  /* 导航栏 */
  .nav {
    height: 64px !important;
    padding: 0 16px !important;
    gap: 10px !important;
    background: rgba(255,255,255,0.92) !important;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,0.06) !important;
    box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset;
  }

  .brand {
    font-size: 20px !important;
    gap: 8px !important;
    font-weight: 750 !important;
  }
  .brand img {
    width: 32px !important;
    height: 32px !important;
    border-radius: 10px;
  }
  .brand small { display: none !important; }

  .burger {
    width: 40px !important;
    height: 40px !important;
    border-radius: 12px !important;
    background: #f4f6f8 !important;
  }
  .burger i {
    height: 2px !important;
    background: #333 !important;
  }

  /* 抽屉菜单美化 */
  .drawer {
    width: min(88vw, 340px) !important;
    border-radius: 0 24px 24px 0 !important;
    padding: 20px 18px 30px !important;
    box-shadow: 20px 0 60px rgba(0,0,0,0.15) !important;
  }
  .drawer-head {
    margin-bottom: 12px !important;
  }
  .drawer .search {
    margin: 12px 0 16px !important;
    padding: 12px 14px !important;
    border-radius: 14px !important;
    background: #f5f7fa !important;
  }
  .drawer .dlist {
    gap: 4px;
  }
  .drawer .dditem, .drawer .dgroup {
    padding: 12px 10px !important;
    border-radius: 10px;
    font-size: 15px !important;
  }
  .drawer .dditem:hover, .drawer .dditem.active {
    background: #f0f4f8;
  }
  .drawer .dfoot {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #eee;
  }
  .drawer .ucard {
    margin-bottom: 12px;
  }

  /* 英雄区 */
  .hero-v2, .hero {
    border-radius: 20px !important;
    min-height: 280px !important;
    height: auto !important;
    padding: 28px 22px !important;
  }
  .hero-v2 h1, .hero h1 {
    font-size: 28px !important;
    line-height: 1.3 !important;
    max-width: 100% !important;
    margin: 12px 0 10px !important;
  }
  .hero-v2 p, .hero p {
    font-size: 14px !important;
    line-height: 1.6 !important;
    max-width: 100% !important;
    color: rgba(255,255,255,0.9) !important;
  }
  .hero-actions {
    gap: 10px !important;
    margin-top: 16px !important;
  }
  .hero-actions .btn, .hero-actions .primary {
    padding: 12px 18px !important;
    font-size: 14px !important;
    border-radius: 12px !important;
    min-height: 44px;
  }

  /* 卡片与内容 */
  .card, .article-card, .product-card {
    border-radius: 16px !important;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04) !important;
  }
  .card-body, .content-grid .card-body {
    padding: 16px !important;
  }
  .card h3, .article-card h3 {
    font-size: 16px !important;
    line-height: 1.45 !important;
    min-height: auto !important;
    margin: 0 0 8px !important;
  }
  .card-excerpt, .card p {
    font-size: 13px !important;
    line-height: 1.6 !important;
    color: #555 !important;
    -webkit-line-clamp: 3;
  }
  .cover, .card .cover {
    height: 160px !important;
  }

  /* 主题/分类网格 */
  .topics {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  .topic {
    padding: 16px 14px !important;
    border-radius: 14px !important;
  }
  .topic strong {
    font-size: 14px !important;
  }
  .topic small {
    font-size: 12px !important;
  }

  /* 分区标题 */
  .section-head {
    margin: 28px 0 16px !important;
  }
  .section-head h2 {
    font-size: 20px !important;
  }
  .section-head .more {
    font-size: 13px !important;
    padding: 6px 10px;
  }

  /* 按钮通用 */
  .btn, .primary, .ghost, .small {
    min-height: 40px;
    padding: 10px 16px !important;
    font-size: 14px !important;
    border-radius: 12px !important;
  }
  .btn.small {
    min-height: 36px;
    padding: 8px 12px !important;
    font-size: 13px !important;
  }

  /* 功能卡片等 */
  .qy-functions-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
  }
  .qy-function-card {
    padding: 16px !important;
    border-radius: 16px !important;
  }
  .qy-function-card h3 {
    font-size: 15px !important;
  }
  .qy-function-card p {
    font-size: 12px !important;
    line-height: 1.55 !important;
  }

  /* 页脚 */
  .footer {
    margin-left: 16px !important;
    margin-right: 16px !important;
    padding: 24px 0 40px !important;
    font-size: 13px !important;
  }

  /* 表单与输入 */
  input, select, textarea, .search input {
    font-size: 15px !important;
    min-height: 44px;
  }
  .search {
    border-radius: 12px !important;
    padding: 8px 12px !important;
  }

  /* 公告条 */
  .announcement {
    padding: 12px 14px !important;
    border-radius: 12px !important;
    font-size: 13px !important;
  }

  /* 资料页等 */
  .profile-hero, .profile-identity {
    padding: 20px 16px !important;
  }
  .profile-identity h1 {
    font-size: 22px !important;
  }
}

/* 更小屏幕进一步优化 */
@media (max-width: 480px) {
  .container {
    margin-left: 12px !important;
    margin-right: 12px !important;
  }

  .hero-v2 h1, .hero h1 {
    font-size: 26px !important;
  }
  .hero-v2 p {
    font-size: 13.5px !important;
  }

  .topics {
    gap: 10px !important;
  }
  .topic {
    padding: 14px 12px !important;
  }

  .card h3 {
    font-size: 15.5px !important;
  }
  .card-excerpt {
    font-size: 12.5px !important;
  }

  .qy-functions-intro h2 {
    font-size: 22px !important;
  }
  .qy-function-card h3 {
    font-size: 14px !important;
  }

  /* 文章列表单列更舒适 */
  .articles, .content-grid .articles {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .navtools .btn {
    padding: 8px 10px !important;
    font-size: 12px !important;
  }
}

/* 深色模式适配 */
@media (max-width: 900px) {
  .dark .nav {
    background: rgba(20, 28, 36, 0.92) !important;
  }
  .dark .burger {
    background: #1e2a36 !important;
  }
  .dark .burger i {
    background: #e0e0e0 !important;
  }
  .dark .drawer {
    background: #1a242e !important;
  }
  .dark .drawer .search {
    background: #243040 !important;
  }
}

/* 触控优化 */
@media (hover: none) and (pointer: coarse) {
  .btn, button, a.card, .topic, .dditem {
    transition: transform 0.15s ease, background 0.15s ease;
  }
  .btn:active, button:active, .topic:active {
    transform: scale(0.97);
  }
}

/* 安全区域（刘海屏） */
@supports (padding: env(safe-area-inset-bottom)) {
  @media (max-width: 900px) {
    .footer {
      padding-bottom: calc(40px + env(safe-area-inset-bottom)) !important;
    }
    .drawer {
      padding-bottom: calc(30px + env(safe-area-inset-bottom)) !important;
    }
  }
}

/* 更多组件优化 */
@media (max-width: 900px) {
  /* 帖子列表 */
  .post-row {
    padding: 14px 0 !important;
    gap: 12px !important;
  }
  .post-row h3 {
    font-size: 15px !important;
    line-height: 1.4 !important;
  }
  .post-summary small {
    font-size: 12px !important;
  }
  .post-row > .avatar {
    width: 36px !important;
    height: 36px !important;
  }

  /* 价格与商品 */
  .product-price {
    font-size: 18px !important;
  }
  .product-price > small {
    font-size: 13px !important;
  }

  /* 侧栏卡片在移动端隐藏或优化（已有 display none 的话） */
  .inspiration-sidebar, .widget-zone {
    display: none; /* 移动端通常隐藏侧栏 */
  }

  /* 加载状态 */
  .loading {
    font-size: 15px;
    padding: 40px 20px;
  }

  /* 模态框 */
  .modal {
    margin: 16px !important;
    border-radius: 20px !important;
    max-width: calc(100vw - 32px) !important;
  }
  .modal h2 {
    font-size: 20px !important;
  }

  /* 表格与列表在移动端更好滚动 */
  .table-wrap, .overflow-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* 轻微全局美化（不限移动端） */
.btn {
  transition: all 0.2s ease !important;
}
.card, .topic, .qy-function-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
@media (hover: hover) {
  .card:hover, .topic:hover, .qy-function-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08) !important;
  }
}
