/* ============================================
   mobile.css — 移动端专属 UI/UE（≤960px 生效）
   桌面端规则拆分为「默认隐藏」与「透传」两类，
   均在本文件顶部与桌面 media 内声明，桌面视觉零影响
   ============================================ */

/* ---------- 桌面默认隐藏：移动端专属组件 ---------- */
.m-progress,
.m-tabbar,
.m-totop,
.m-mobile-link {
  display: none;
}

/* ---------- 桌面：details 目录透传，侧栏与改前完全一致 ---------- */
.m-toc {
  display: contents;
}

.m-toc > summary {
  display: none;
}

/* ---------- 动效降级（减少动态偏好，全视口生效） ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   以下为 ≤960px（手机 / 平板竖屏）规则
   ============================================ */
@media (max-width: 960px) {

  /* ---------- 全局 ---------- */
  body {
    /* 底部标签栏留位（56px 内容 + 1px 发丝线 + iPhone 底部安全区） */
    padding-bottom: calc(57px + env(safe-area-inset-bottom, 0px));
    /* 移动端画布：浅灰底 + 白卡（对齐小程序视觉语言） */
    background-color: #f5f6f7;
    -webkit-tap-highlight-color: rgba(15, 81, 50, 0.08);
  }

  a,
  button {
    touch-action: manipulation;
  }

  /* 内容区让出画布底色，卡片保持白色 */
  .features,
  .tournament-types,
  .contact-strip,
  .stats-band,
  .legal-layout,
  .contact-layout {
    background: transparent;
  }

  /* ---------- 阅读进度条 ---------- */
  .m-progress {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 120;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-gold) 100%);
    pointer-events: none;
  }

  /* ---------- 底部标签栏（对齐小程序 tabBar） ---------- */
  .m-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    display: flex;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-top: 1px solid var(--color-border);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .m-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 56px;
    padding: var(--sp-1) 0;
    font-size: 10px;
    line-height: 1.2;
    color: var(--color-text-muted);
    text-decoration: none;
    -webkit-user-select: none;
    user-select: none;
  }

  .m-tab svg {
    width: 22px;
    height: 22px;
  }

  .m-tab.is-active {
    color: var(--color-primary);
    font-weight: var(--fw-semibold);
  }

  .m-tab:active {
    background: var(--color-primary-bg);
  }

  /* ---------- 返回顶部 ---------- */
  .m-totop {
    position: fixed;
    right: var(--sp-4);
    bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--r-full);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    color: var(--color-primary);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity var(--t-base), transform var(--t-base), visibility var(--t-base);
  }

  .m-totop.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .m-totop:active {
    background: var(--color-primary-bg);
  }

  .m-totop svg {
    width: 20px;
    height: 20px;
  }

  /* ---------- 切回移动版入口（窄视口显示） ---------- */
  .m-mobile-link {
    position: fixed;
    left: var(--sp-4);
    bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    z-index: 90;
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    height: 44px;
    padding: 0 var(--sp-4);
    border-radius: var(--r-full);
    background: var(--color-primary);
    border: 1px solid var(--color-primary);
    box-shadow: var(--shadow-md);
    color: var(--color-bg);
    font-size: 13px;
    font-weight: var(--fw-semibold);
    text-decoration: none;
  }

  .m-mobile-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  .m-mobile-link:active {
    background: var(--color-primary-dark);
  }

  /* ---------- Hero：装饰卡片改横向滑动 ---------- */
  .hero-visual {
    display: flex;
    gap: var(--sp-4);
    max-width: none;
    margin: 0;
    padding: var(--sp-2) 0 var(--sp-3);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .hero-visual::-webkit-scrollbar {
    display: none;
  }

  .hero-visual .hero-card {
    position: relative;
    flex: 0 0 auto;
    width: 82% !important;
    max-width: 320px;
    scroll-snap-align: center;
  }

  .hero-visual .hero-card-3 {
    max-width: 240px;
  }

  .hero-visual .hero-card,
  .hero-visual .hero-card-1,
  .hero-visual .hero-card-2 {
    animation: none !important;
  }

  /* ---------- 核心功能：2×2 紧凑卡 ---------- */
  @media (max-width: 640px) {
    .features-grid {
      grid-template-columns: 1fr 1fr;
      gap: var(--sp-3);
    }

    .features-grid .card-feature {
      padding: var(--sp-4);
      border-radius: var(--r-lg);
    }

    .features-grid .card-icon {
      width: 40px;
      height: 40px;
      margin-bottom: var(--sp-3);
      border-radius: var(--r-md);
    }

    .features-grid .card-icon img,
    .features-grid .card-icon svg {
      width: 22px;
      height: 22px;
    }

    .features-grid .card-title {
      font-size: var(--fs-base);
      margin-bottom: var(--sp-2);
    }

    .features-grid .card-desc {
      font-size: var(--fs-sm);
      line-height: 1.6;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
  }

  /* ---------- 赛事类型：横向滑动卡片 ---------- */
  .tournament-grid {
    display: flex;
    gap: var(--sp-4);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--sp-2);
    scrollbar-width: none;
  }

  .tournament-grid::-webkit-scrollbar {
    display: none;
  }

  .tournament-grid .tournament-card {
    flex: 0 0 auto;
    width: 82%;
    max-width: 340px;
    scroll-snap-align: center;
  }

  .tournament-grid .tournament-card-banner {
    height: 100px;
  }

  .tournament-grid .tournament-card-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .tournament-grid .tournament-card-meta {
    flex-wrap: wrap;
    gap: var(--sp-2) var(--sp-4);
  }

  /* ---------- 长文页目录：折叠面板 ---------- */
  .legal-sidebar {
    padding: 0;
    background: transparent;
    border-radius: 0;
  }

  .m-toc {
    display: block;
    background: var(--color-bg-soft);
    border-radius: var(--r-lg);
    overflow: hidden;
  }

  .m-toc > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    min-height: 44px;
    padding: var(--sp-3) var(--sp-4);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--color-text-secondary);
    cursor: pointer;
    list-style: none;
  }

  .m-toc > summary::-webkit-details-marker {
    display: none;
  }

  .m-toc > summary::after {
    content: "";
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform var(--t-fast);
  }

  .m-toc[open] > summary::after {
    transform: rotate(-135deg);
  }

  /* 桌面标题行由 summary 取代，移动端隐藏 */
  .m-toc .legal-sidebar-title {
    display: none;
  }

  .m-toc .legal-toc {
    padding: 0 var(--sp-4) var(--sp-4);
  }

  /* ---------- 触控与按压反馈 ---------- */
  .footer-links a {
    display: flex;
    align-items: center;
    min-height: 44px;
  }

  .card,
  .card-feature,
  .tournament-card,
  .contact-card,
  .contact-info-card,
  .requirement-card,
  .benefit-card {
    transition: transform var(--t-fast), box-shadow var(--t-base), border-color var(--t-fast);
  }

  .card:active,
  .card-feature:active,
  .tournament-card:active,
  .contact-card:active,
  .contact-info-card:active,
  .requirement-card:active,
  .benefit-card:active {
    transform: scale(0.98);
  }

  .btn:active {
    transform: scale(0.97);
  }

  .legal-content p,
  .merchant-section-desc {
    text-wrap: pretty;
  }
}

/* ============================================
   小屏手机（≤480px）微调
   ============================================ */
@media (max-width: 480px) {
  .hero-visual .hero-card {
    width: 86% !important;
  }

  .tournament-grid .tournament-card {
    width: 86%;
  }
}

/* ============================================
   移动端内容排版与密度（≤960px）
   目标：字号阶梯与留白按手机阅读密度重排，
   内容与信息层级不变
   ============================================ */
@media (max-width: 960px) {

  /* ---- Hero ---- */
  .hero {
    padding: var(--sp-10) 0 var(--sp-12);
  }

  .hero-title {
    font-size: clamp(28px, 9vw, 34px);
    margin-bottom: var(--sp-4);
  }

  .hero-subtitle {
    font-size: var(--fs-base);
    line-height: var(--lh-normal);
    max-width: none;
    margin-bottom: var(--sp-6);
  }

  .hero-cta {
    gap: var(--sp-3);
  }

  /* 信任点与下方数据带重复，手机上让位给数据带 */
  .hero-trust {
    display: none;
  }

  /* ---- 数据带：仪表盘密度 ---- */
  .stats-band {
    padding: var(--sp-8) 0;
  }

  .stats-grid {
    padding: var(--sp-5);
    gap: var(--sp-4);
  }

  .stat-num {
    font-size: var(--fs-2xl);
    margin-bottom: var(--sp-1);
  }

  .stat-num-suffix {
    font-size: var(--fs-md);
  }

  .stat-label {
    font-size: var(--fs-xs);
    line-height: 1.4;
  }

  /* ---- 区块间距与标题阶梯 ---- */
  .features,
  .tournament-types,
  .contact-strip,
  .merchant-cta {
    padding: var(--sp-12) 0;
  }

  .section-header {
    margin-bottom: var(--sp-8);
  }

  .section-header .heading-2,
  .merchant-cta-text h2 {
    font-size: var(--fs-xl);
  }

  .section-header .lead {
    font-size: var(--fs-base);
  }

  .merchant-cta-text h2 {
    margin-bottom: var(--sp-3);
  }

  .merchant-cta-text p {
    font-size: var(--fs-base);
    line-height: var(--lh-normal);
    margin-bottom: var(--sp-6);
  }

  /* ---- 卡片内密度 ---- */
  .card {
    padding: var(--sp-5);
  }

  .tournament-card-body {
    padding: var(--sp-5);
  }

  .merchant-step {
    padding: var(--sp-3) var(--sp-4);
    gap: var(--sp-3);
  }

  .merchant-step-num {
    width: 36px;
    height: 36px;
    font-size: var(--fs-base);
  }

  .merchant-step-title {
    font-size: var(--fs-base);
  }

  .merchant-step-desc {
    font-size: var(--fs-sm);
  }

  /* ---- 按钮 ---- */
  .btn-lg {
    padding: var(--sp-3) var(--sp-6);
    font-size: var(--fs-base);
    min-height: 48px;
  }

  /* ---- 子页 Page Hero ---- */
  .page-hero {
    padding: var(--sp-12) 0 var(--sp-8);
  }

  .page-hero h1 {
    font-size: var(--fs-2xl);
    margin-bottom: var(--sp-3);
  }

  .page-hero-meta {
    margin-top: var(--sp-4);
  }

  /* ---- 长文页 ---- */
  .legal-layout {
    padding: var(--sp-8) 0 var(--sp-12);
  }

  .legal-content h2 {
    font-size: var(--fs-xl);
    margin: var(--sp-8) 0 var(--sp-3);
    padding-top: var(--sp-4);
  }

  .legal-content h3 {
    font-size: var(--fs-md);
    margin: var(--sp-6) 0 var(--sp-2);
  }

  .legal-content p {
    line-height: 1.7;
  }

  .legal-content ol,
  .legal-content ul {
    margin-left: var(--sp-5);
  }

  .legal-content li {
    margin-bottom: var(--sp-2);
  }

  .callout {
    padding: var(--sp-4);
  }

  .merchant-section-title {
    font-size: var(--fs-xl);
  }

  .legal-content .merchant-section-title .num {
    width: 32px;
    height: 32px;
    font-size: var(--fs-base);
  }

  .merchant-section-desc {
    font-size: var(--fs-base);
    line-height: var(--lh-normal);
  }

  .requirement-card {
    padding: var(--sp-4);
  }

  .benefit-card {
    padding: var(--sp-5);
  }

  .benefit-card-title {
    font-size: var(--fs-base);
  }

  /* 时间线：60px 圆点对手机过重，收敛为 44px */
  .timeline-item {
    grid-template-columns: 44px 1fr;
    gap: var(--sp-3);
  }

  .timeline-dot {
    width: 44px;
    height: 44px;
    font-size: var(--fs-md);
  }

  .timeline-item:not(:last-child)::before {
    left: 21px;
  }

  /* ---- 联系页 ---- */
  .contact-layout {
    padding: var(--sp-8) 0 var(--sp-12);
  }

  .company-block {
    padding: var(--sp-6);
  }

  .company-block-content h2 {
    font-size: var(--fs-xl);
  }

  .contact-info-card {
    padding: var(--sp-4);
    gap: var(--sp-3);
  }

  .contact-info-icon {
    width: 48px;
    height: 48px;
  }

  .contact-info-value {
    font-size: var(--fs-md);
  }

  /* ---- 页脚 ---- */
  .footer {
    padding: var(--sp-12) 0 var(--sp-6);
  }

  .footer-desc {
    max-width: none;
  }
}
