/* ============================================================
   陌笑技术分享 · 移动端样式（<=820px 自动生效）
   桌面端不受影响；本文件在所有页面 </head> 前引入
   ============================================================ */

/* ---------- 移动端底部导航（仅手机注入，桌面不显示） ---------- */
.mox-tabbar,
.mox-sheet-mask,
.mox-sheet,
.mox-progress,
.mox-top { display: none; }

@media (max-width: 820px) {

  /* ===== 基础 ===== */
  html { -webkit-text-size-adjust: 100%; }
  body {
    overscroll-behavior-y: contain;
    -webkit-tap-highlight-color: transparent;
  }
  a, button, .logo, .card, .g-list li { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  img { max-width: 100%; height: auto; }

  /* 给底部导航让位 */
  body.mox-has-tab { padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)) !important; }

  /* ===== 底部 Tab 栏 ===== */
  .mox-tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 400;
    background: rgba(15, 20, 25, .96);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    border-top: 1px solid var(--border, #2a323c);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mox-tabbar .mox-tab {
    flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; padding: 8px 0 7px; color: var(--text-secondary, #8b8e96);
    text-decoration: none; font-size: 11px; line-height: 1; cursor: pointer;
    transition: color .15s;
  }
  .mox-tabbar .mox-tab svg { width: 21px; height: 21px; display: block; opacity: .85; }
  .mox-tabbar .mox-tab.on { color: var(--accent, #4ecdc4); }
  .mox-tabbar .mox-tab.on svg { opacity: 1; }
  .mox-tabbar .mox-tab:active { transform: scale(.94); }

  /* ===== 分类面板（底部升起） ===== */
  .mox-sheet-mask {
    display: block; position: fixed; inset: 0; z-index: 500;
    background: rgba(0, 0, 0, .55); opacity: 0; pointer-events: none;
    transition: opacity .22s ease;
  }
  .mox-sheet-mask.open { opacity: 1; pointer-events: auto; }
  .mox-sheet {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 501;
    background: #141a21; border-radius: 18px 18px 0 0;
    border-top: 1px solid var(--border, #2a323c);
    padding: 8px 18px calc(20px + env(safe-area-inset-bottom, 0px));
    transform: translateY(102%); transition: transform .26s cubic-bezier(.32,.72,0,1);
    box-shadow: 0 -12px 40px rgba(0, 0, 0, .45);
  }
  .mox-sheet.open { transform: translateY(0); }
  .mox-sheet-handle {
    width: 38px; height: 4px; border-radius: 4px; background: #3a434e; margin: 8px auto 14px;
  }
  .mox-sheet h4 {
    font-size: 15px; font-weight: 600; color: var(--text, #e8e6e3);
    margin: 0 0 4px; font-family: 'Noto Serif SC', 'PingFang SC', serif;
  }
  .mox-sheet .mox-sheet-sub { font-size: 12px; color: var(--text-secondary, #8b8e96); margin-bottom: 14px; }
  .mox-sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
  .mox-sheet-grid a {
    display: flex; align-items: center; gap: 7px;
    padding: 12px 12px; border-radius: 10px; text-decoration: none;
    background: #1a2028; border: 1px solid var(--border, #2a323c);
    color: var(--text, #e8e6e3); font-size: 13.5px;
  }
  .mox-sheet-grid a:active { transform: scale(.97); }
  .mox-sheet-grid a span.mox-dot {
    width: 6px; height: 6px; border-radius: 50%; background: var(--accent, #4ecdc4); flex: 0 0 auto;
  }
  .mox-sheet-foot {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border, #2a323c);
    font-size: 12px; color: var(--text-secondary, #8b8e96);
  }
  .mox-sheet-foot a { color: var(--text-secondary, #8b8e96); text-decoration: none; }
  .mox-sheet-foot .mox-pc-btn {
    border: 1px solid var(--border, #2a323c); border-radius: 999px;
    padding: 6px 12px; color: var(--accent, #4ecdc4);
  }

  /* ===== 文章页阅读进度 ===== */
  .mox-progress {
    display: block; position: fixed; top: 0; left: 0; height: 2.5px; width: 0;
    z-index: 402; background: linear-gradient(90deg, var(--accent-dim, #3a9e97), var(--accent, #4ecdc4));
    transition: width .08s linear;
  }

  /* ===== 回到顶部 ===== */
  .mox-top {
    display: flex; align-items: center; justify-content: center;
    position: fixed; right: 14px; bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    width: 40px; height: 40px; border-radius: 50%; z-index: 401;
    background: rgba(26, 32, 40, .92); border: 1px solid var(--border, #2a323c);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    color: var(--text-secondary, #8b8e96); opacity: 0; pointer-events: none;
    transform: translateY(8px); transition: opacity .2s, transform .2s;
  }
  .mox-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
  .mox-top:active { transform: scale(.92); }
  .mox-top svg { width: 18px; height: 18px; }

  /* =========================================================
     一、首页
     ========================================================= */
  .nav { padding: 0; }
  .nav-inner {
    height: 54px; padding: 0 16px; max-width: none;
  }
  .logo { font-size: 16px; gap: 8px; }
  .logo-mark { width: 28px; height: 28px; border-radius: 6px; }
  .nav-links { display: none; }

  .hero { padding: 26px 18px 20px; text-align: left; }
  .hero-title {
    font-size: 27px; line-height: 1.35; margin-bottom: 12px; letter-spacing: -.2px;
  }
  .hero-desc { font-size: 13.5px; line-height: 1.75; margin: 0 0 20px; max-width: none; }
  .hero-stats { justify-content: flex-start; gap: 30px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
  .stat { text-align: left; }
  .stat-num { font-size: 24px; }
  .stat-label { font-size: 11.5px; margin-top: 2px; }

  .content { padding: 0 16px 34px; }

  /* 分类标签横向滑动 */
  .cat-chips {
    flex-wrap: nowrap; overflow-x: auto; gap: 8px;
    margin: 0 -16px 18px; padding: 0 16px 6px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .cat-chips::-webkit-scrollbar { display: none; }
  .cat-chips a { flex: 0 0 auto; padding: 7px 13px; font-size: 12.5px; }

  .section-header { margin-bottom: 12px; }
  .section-title { font-size: 18px; }
  .view-more-btn { font-size: 12.5px; padding: 6px 11px; }

  /* 卡片单列，封面 16:9 */
  .card-grid { grid-template-columns: 1fr; gap: 14px; margin-bottom: 24px; }
  .card { border-radius: 14px; }
  .card:hover { transform: none; background: var(--bg-card); border-color: var(--border); }
  .card:active { transform: scale(.982); background: var(--bg-card-hover); }
  .card-cover { height: auto; aspect-ratio: 16 / 9; }
  .card-cover svg { width: 40px; height: 40px; }
  .card-body { padding: 14px 15px 15px; }
  .card-tag { font-size: 11px; padding: 2px 8px; margin-bottom: 9px; }
  .card-title { font-size: 16px; line-height: 1.45; margin-bottom: 8px; }
  .card-excerpt { font-size: 12.5px; line-height: 1.62; margin-bottom: 12px; -webkit-line-clamp: 3; }
  .card-meta { font-size: 11.5px; }

  /* 关于 / 软件 / 列表视图 */
  .about-card { padding: 26px 18px; border-radius: 14px; }
  .about-name { font-size: 20px; }
  .about-desc { font-size: 13.5px; }
  .about-avatar { width: 64px; height: 64px; font-size: 26px; }
  .about-qr { width: 148px; height: 148px; }
  .detail-view { padding: 20px 16px 40px; }
  .detail-title { font-size: 21px; line-height: 1.42; }
  .detail-header { margin-bottom: 20px; }
  .back-btn { margin-bottom: 20px; padding: 7px 13px; font-size: 13px; }
  .coming-soon-title { font-size: 21px; }
  .coming-soon-desc { font-size: 13.5px; }

  .footer { padding: 22px 16px 10px; font-size: 12px; }
  .footer-links { line-height: 2; }

  /* =========================================================
     二、栏目页 / 归档页（.wrap + .g-list）
     ========================================================= */
  body > .wrap { padding: 0 16px 34px; }
  .wrap header { padding: 20px 0 6px; margin-bottom: 18px; }
  .wrap h1 { font-size: 22px; line-height: 1.35; }
  .wrap .lead { font-size: 12.5px; margin-top: 6px; }
  .wrap .intro { font-size: 13px; line-height: 1.8; margin-top: 12px; }
  .wrap .intro p { margin-bottom: 8px; }
  .wrap .cats {
    flex-wrap: nowrap; overflow-x: auto; gap: 7px;
    margin: 16px -16px 0; padding: 0 16px 4px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .wrap .cats::-webkit-scrollbar { display: none; }
  .wrap .cats a { flex: 0 0 auto; padding: 5px 11px; font-size: 12px; white-space: nowrap; }
  .wrap .g-title { font-size: 15px; margin: 22px 0 10px; }
  .wrap .g-num { font-size: 12px; }
  .wrap .g-list li { padding: 12px 13px; border-radius: 12px; margin-bottom: 9px; }
  .wrap .a-title { font-size: 14.5px; line-height: 1.5; }
  .wrap .a-meta { font-size: 11.5px; margin-top: 3px; }
  .wrap .a-desc {
    font-size: 12.5px; line-height: 1.62; margin-top: 7px;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  }
  .wrap footer { margin-top: 28px; padding-top: 16px; font-size: 12px; }

  /* AI 栏目专题卡 */
  .wrap .feature { padding: 14px 15px; border-radius: 13px; margin-bottom: 18px; }
  .wrap .f-title { font-size: 15.5px; }
  .wrap .f-desc { font-size: 12.5px; }
  .wrap .f-meta { font-size: 11.5px; }

  /* =========================================================
     三、文章页
     ========================================================= */
  .post-nav { padding: 10px 16px; }
  .post-nav-brand { font-size: 14.5px; }
  .post-nav-back { font-size: 12.5px; }
  .post-container { padding: 20px 16px 30px; max-width: none; }
  .breadcrumb { font-size: 11.5px; line-height: 1.7; margin-bottom: 12px; }
  .post-header { margin-bottom: 18px; }
  .post-category { font-size: 11.5px; padding: 3px 10px; margin-bottom: 10px; }
  .post-title { font-size: 22px; line-height: 1.45; margin-bottom: 10px; letter-spacing: -.2px; }
  .post-meta { font-size: 12px; gap: 12px; }

  .post-cover {
    height: auto; aspect-ratio: 3 / 1; border-radius: 10px; margin-bottom: 20px;
    background-size: cover !important;
  }

  .post-content { font-size: 16px; line-height: 1.95; }
  .post-content h2, .post-content h3 { font-size: 18px; margin: 26px 0 12px; padding-left: 10px; border-left-width: 3px; }
  .post-content p { margin: 12px 0; }
  .post-content ol, .post-content ul { margin: 12px 0 12px 20px; }
  .post-content blockquote { padding: 9px 13px; font-size: 13.5px; margin: 14px 0; }

  /* 代码块：横向滚动 + 更紧凑 */
  .post-content pre {
    font-size: 12.5px; line-height: 1.7; padding: 11px 12px; border-radius: 8px;
    margin: 14px -2px; -webkit-overflow-scrolling: touch;
  }
  .post-content pre code { white-space: pre; }
  .post-content p code { font-size: 13.5px; padding: 1px 5px; }

  /* 表格：横向滚动，不挤成竖排 */
  .post-content table {
    display: block; overflow-x: auto; -webkit-overflow-scrolling: touch;
    font-size: 12.5px; margin: 14px -2px; border: 0;
  }
  .post-content table thead, .post-content table tr { display: table-row-group; }
  .post-content th, .post-content td { padding: 7px 9px; white-space: nowrap; }
  .post-content th { position: sticky; top: 0; }

  .post-related { margin-top: 34px; padding-top: 20px; }
  .related-title { font-size: 15.5px; }
  .related-item { padding: 11px 13px; border-radius: 9px; }
  .related-tag { font-size: 11px; }
  .related-name { font-size: 13.5px; line-height: 1.5; }
  .post-footer { margin-top: 30px; padding-top: 18px; }
  .post-footer-back { font-size: 14px; }
  .site-footer { padding: 20px 16px; font-size: 11.5px; }
}

/* 平板：821–1024 保持桌面布局，仅收紧留白 */
@media (min-width: 821px) and (max-width: 1024px) {
  .nav-inner, .hero, .content { max-width: 100%; }
  .hero { padding: 56px 24px 40px; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}
