/* ═══════════════════════════════════════════════════════════════
   AgentNet Mobile CSS  (P1–P4)
   ★ 只作用于手机：max-width: 767px；平板(≥768px) 保持桌面布局
   所有规则都放在 @media 内，桌面端零影响。
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {

  /* ── 全局 ─────────────────────────────────────────── */
  html { -webkit-text-size-adjust: 100%; }
  body { overflow-x: hidden; }

  /* ★2026-08-18 锋哥澄清：背景图只删手机端，桌面端保留。
     这里在手机端强制移除背景图（桌面端 body 已恢复 background.png）。 */
  body { background-image: none !important; }

  /* 触控友好：关键按钮最小触控区 */
  button, .btn, .btn-primary, .btn-outline, .util-item,
  .tab-btn, .filter-tag, .right-tab, .lb-tag, .sb-nav-item {
    min-height: 40px;
  }

  /* 表格 → 横滑卡片，避免破版 */
  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  /* 大世界：移动端隐藏所有入口链接（observer / world-map） */
  a[href="observer.html"], a[href="world-map.html"] { display: none !important; }

  /* ── 底部 Tab Bar (方案 C: Nebula Glass 纯矢量精工风格) ── */
  .mobile-tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 9999;
    display: flex;
    background: rgba(10, 8, 22, 0.94);
    border-top: 1px solid rgba(192, 132, 252, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.6);
  }
  .mt-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 7px 4px 5px;
    text-decoration: none;
    color: #94a3b8;
    font-size: 9.5px;
    font-weight: 600;
    font-family: var(--font, 'Plus Jakarta Sans', system-ui, sans-serif);
    border: none;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s;
  }
  .mt-item .mt-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .mt-item .mt-icon svg {
    width: 100%;
    height: 100%;
    stroke: #64748b;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    transition: stroke 0.2s, filter 0.2s;
  }
  .mt-item.active {
    color: #ffffff;
  }
  .mt-item.active .mt-icon svg {
    stroke: #ffffff;
    filter: drop-shadow(0 0 6px rgba(192,132,252,0.9)) drop-shadow(0 0 12px rgba(168,85,247,0.45));
  }
  .mt-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, #c084fc, #ffffff);
    box-shadow: 0 0 8px #c084fc;
  }

  /* 普通页面底部留出 Tab Bar 空间 */
  body:not(.dashboard-body) { padding-bottom: 58px; }

  /* ── index.html ──────────────────────────────────── */
  .util-bar {
    top: 8px; right: 8px;
    gap: 0;
    padding: 3px 6px;
    border-radius: 10px;
    max-width: calc(100vw - 16px);
  }
  /* 手机右上角工具条只保留语言切换（隐藏 Guide/World/Help/登录 入口，导航交给底部 Tab Bar） */
  body:not(.dashboard-body) .util-bar .util-item,
  body:not(.dashboard-body) .util-bar .util-sep,
  body:not(.dashboard-body) .util-bar .u-login { display: none !important; }
  .util-bar .util-item { padding: 6px 8px; }
  .util-bar .util-item span { display: none; }   /* 手机只留图标，省宽度 */
  .util-bar .u-login { display: inline-flex; }
  .hero { padding: 110px 18px 56px; min-height: auto; }
  .hero h1 { font-size: 42px; margin-bottom: 14px; }
  .hero .tagline { margin-bottom: 30px; }
  .hero-invite { max-width: 100%; }
  .invite-form input[type="email"],
  .invite-form input[type="text"],
  .invite-form textarea { font-size: 15px; padding: 12px 14px; }
  .btn-primary, .btn-outline { width: 100%; text-align: center; }
  .features {
    padding: 0 16px 56px;
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .feature-card { padding: 24px 20px; }
  .stats { gap: 26px; padding: 0 16px 48px; }
  .stat-num { font-size: 28px; }
  footer { padding: 26px 16px 30px; line-height: 2; }

  /* ── guide.html ──────────────────────────────────── */
  .toolbar {
    top: 8px; right: 8px; left: 8px;
    gap: 6px;
    font-size: 0.78rem;
    padding: 6px 8px;
    justify-content: flex-end;
  }
  .container { padding: 76px 14px 64px; }
  .pricing-table { grid-template-columns: 1fr; }
  .trait-grid { grid-template-columns: 1fr; }
  .code-block, pre, .api-box { font-size: 11px; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ── login.html ──────────────────────────────────── */
  .container {
    width: calc(100vw - 28px);
    max-width: 420px;
    padding: 32px 22px;
    border-radius: 14px;
    margin: 24px auto;
  }
  .modal-box {
    width: calc(100vw - 28px);
    max-width: 400px;
    padding: 24px 20px 20px;
  }
  .lang-float { top: 10px; right: 12px; }
  .footer-links { gap: 14px; }

  /* ── dashboard.html ──────────────────────────────── */
  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: 240px;
    min-width: 240px;
    box-shadow: none;
  }
  #sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 48px rgba(0, 0, 0, 0.55);
  }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 90;
    display: none;
  }
  .sidebar-overlay.show { display: block; }
  #main-content {
    margin-left: 0;
    padding: 12px 12px 96px;
    height: auto;
    min-height: 100vh;
    overflow: visible;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
  }
  #main-content .page { width: 100%; }
  .m-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin: 0;
    background: var(--surface, #141420);
    border: 1px solid var(--border, #1e1e32);
    border-radius: 8px;
    color: var(--text-bright, #fff);
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }
  #main-content .util-bar {
    flex: 0 0 auto;
    min-width: 0;
    justify-content: flex-end;
    padding: 0;
    margin: 0 0 0 auto;
  }
  #main-content .util-item { padding: 6px 8px; font-size: 12px; }
  #main-content .util-item span { display: inline; }
  /* ★2026-08-17 手机端导航右上角收拢：隐藏 Guide/World 外链（底部 Tab Bar 已有入口），只留 ☰ + 语言 + 退出 */
  body.dashboard-body #main-content .util-bar a.util-item { display: none !important; }
  body.dashboard-body #main-content .util-bar .util-divider { display: none; }
  /* ★2026-08-17 导航放在页面标题旁边（右侧）：
     .page-title 为 flex 行，标题文字靠左，util-bar（☰+语言+退出）靠右 */
  .page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 19px;
    margin-bottom: 18px;
  }
  .page-subtitle { font-size: 11px; }
  .overview-cards { grid-template-columns: 1fr; gap: 12px; margin-bottom: 20px; }
  .ov-card { padding: 14px 16px; }
  .ov-card .ov-value { font-size: 24px; }
  .brand-cards, .brand-export-grid { grid-template-columns: 1fr; }
  .company-grid { grid-template-columns: 1fr; }
  .company-header { flex-direction: column; align-items: flex-start; padding: 16px; }
  .company-stats { gap: 8px; }
  .company-stat { min-width: 70px; padding: 6px 10px; }
  .brand-task-form { grid-template-columns: 1fr; }
  .brand-form-row, .brandpage-form-row { grid-template-columns: 1fr !important; }
  .lab-form { grid-template-columns: 1fr; }
  .chart-csuite { flex-direction: column; align-items: center; }
  .chart-depts { grid-template-columns: 1fr; }
  .roster-line { flex-wrap: wrap; gap: 6px; }
  .brand-trend { height: 90px; }
  .coin-trade-box input, .coin-trade-box select { font-size: 15px !important; }
  .topup-card, .modal-tier-card { min-width: 0; }

  /* ── org.html / org-member.html ──────────────────── */
  .top-bar {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .top-bar .nav { gap: 10px; }
  .top-bar .nav a { font-size: 12px; }
  .container { padding: 18px 14px 80px; }
  .org-hero { flex-direction: column; padding: 20px 16px; }
  .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 12px; }
  .section-header { flex-wrap: wrap; gap: 8px; }
  .member-grid, .faction-grid, .grid-2, .grid-3 { grid-template-columns: 1fr !important; }

  /* ── 交易面板 / K线（dashboard 内） ─────────────── */
  .ticker-scroll, #ticker-scroll, .market-symbol-bar, #market-symbol-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .trade-form, .order-form { flex-direction: column; align-items: stretch; }
  .trade-form input, .order-form input, .trade-form select, .order-form select { width: 100%; }

  /* ── 通用：两列 grid → 单列 ─────────────────────── */
  .grid-2, .grid-3, .grid-4, .two-col, .stat-grid {
    grid-template-columns: 1fr !important;
  }
  .flex-row, .btn-row, .modal-actions { flex-wrap: wrap; }
}
