/* ============================================================
   mobile.css — 手机适配（在 site.css / cheat.css 之后加载）
   目标：390px 宽也能正常看，不横向滚动、按钮够大、动画减负
   ============================================================ */

html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }

/* 触屏设备：隐藏自定义光标、关掉重特效 */
@media (hover: none), (pointer: coarse) {
  .cur, #cur, #curCore { display: none !important; }
  .aura, .grain { display: none !important; }
  #fx { display: none !important; }
  * { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
}

/* ---------- 通用：更小的边距、可换行 ---------- */
@media (max-width: 860px) {
  .wrap { padding-left: 16px !important; padding-right: 16px !important; }
  body { font-size: 15px; }

  /* 导航：横向可滚动，不再挤成一团 */
  header .hd { flex-wrap: wrap; gap: 10px; height: auto !important; padding: 10px 0 !important; }
  header nav, #nav {
    display: flex !important;
    gap: 8px !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    order: 3;
    padding: 4px 0 6px;
    scrollbar-width: none;
  }
  header nav::-webkit-scrollbar,
  #nav::-webkit-scrollbar { display: none; }
  header nav a, #nav a {
    white-space: nowrap;
    font-size: 13px !important;
    padding: 7px 12px !important;
    border-radius: 99px;
    border: 1px solid rgba(150,120,255,.25);
  }

  /* 所有两栏/多栏布局 → 单栏 */
  .grid, .cards, .cards-grid, .cols, .split, .row2, .pricing, .plans-grid,
  .feature-grid, .cap-grid, .stat-row, .steps, .faq-grid {
    display: block !important;
  }
  .grid > *, .cards > *, .cards-grid > *, .cols > *, .split > *,
  .row2 > *, .pricing > *, .plans-grid > *, .feature-grid > *,
  .cap-grid > *, .stat-row > *, .steps > *, .faq-grid > * {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 14px !important;
  }

  /* 标题字号收一下 */
  h1, .hero h1, .h1 { font-size: clamp(30px, 9vw, 44px) !important; line-height: 1.18 !important; }
  h2, .h2 { font-size: clamp(22px, 6.4vw, 30px) !important; }
  .hero p, .lead { font-size: 14px !important; }

  /* 按钮：够大、可点 */
  .btn, button, a.btn, .cta {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px !important;
    padding: 12px 18px !important;
  }
  .btn-row, .actions, .cta-row { display: flex; flex-direction: column; gap: 10px; width: 100%; }
  .btn-row > *, .actions > *, .cta-row > * { width: 100% !important; }

  /* 代码块/终端面板：允许横向滚动，不撑破页面 */
  pre, code, .terminal, .code, .cmd, .mono {
    overflow-x: auto !important;
    max-width: 100%;
    font-size: 11.5px !important;
    word-break: break-all;
  }

  /* 表格：横向滚动而不是挤压 */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  table td, table th { padding: 9px 8px !important; font-size: 12px !important; }

  /* 图片/二维码不溢出 */
  img, canvas, video { max-width: 100% !important; height: auto !important; }
  .qr, .qr-img { width: 200px !important; height: 200px !important; margin: 0 auto; display: block; }

  /* 页脚 */
  footer, .foot { flex-direction: column !important; gap: 10px !important; text-align: center; font-size: 11.5px !important; }
}

/* ---------- 超小屏（iPhone SE 等） ---------- */
@media (max-width: 400px) {
  h1, .hero h1 { font-size: 27px !important; }
  .wrap { padding-left: 12px !important; padding-right: 12px !important; }
  .btn, button { font-size: 13.5px !important; }
}

/* ---------- 横屏手机 ---------- */
@media (max-width: 900px) and (orientation: landscape) {
  .hero { min-height: auto !important; padding: 40px 0 30px !important; }
}

/* ---------- 溢出收尾（首屏实测补丁） ---------- */
@media (max-width: 860px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  main, section, .wrap, .hero, .hero-in, .container { max-width: 100% !important; min-width: 0 !important; overflow-x: hidden; }
  .hero-in, .hero > .wrap { display: block !important; }
  .hero-in > * { width: 100% !important; min-width: 0 !important; }
  p, li, span, h1, h2, h3, h4 { overflow-wrap: anywhere; word-break: break-word; }

  /* 顶栏右侧按钮：单独一行、占满宽度 */
  header .hd > .btn, header .hd > a.btn, #hd .btn {
    order: 4; width: 100% !important; margin: 4px 0 0 !important;
  }
  header .hd { align-items: center; }

  /* 右侧/左侧浮动装饰不要让页面变宽 */
  .aura, .vgrid, .grain, .float, .side-deco, .deco { display: none !important; }

  /* 面板/窗口示意图：等比缩放，不横向溢出 */
  .panel, .win, .mock, .preview, .shot { transform: none !important; width: 100% !important; max-width: 100% !important; }
}

/* ---------- 二次收尾：文字换行 + 隐藏过宽示意图 ---------- */
@media (max-width: 860px) {
  /* 宣传用的"面板示意图"在手机上直接隐藏（它是固定宽度，必然溢出） */
  .panel, .win, .mock, .preview, .shot, .cheat-panel, .demo-panel { display: none !important; }

  /* 所有文字强制换行 */
  * { white-space: normal !important; }
  pre, code, .terminal, .code, .cmd {
    white-space: pre-wrap !important;
    word-break: break-all !important;
    overflow-x: auto !important;
  }
  .hero p, .hero .lead, .hero .desc, .hero-in p { max-width: 100% !important; padding-right: 0 !important; }

  /* 任何固定宽度块都改成自适应 */
  [style*="width: 5"], [style*="width:5"], [style*="width: 6"], [style*="width:6"],
  [style*="width: 7"], [style*="width:7"], [style*="width: 8"], [style*="width:8"] {
    max-width: 100% !important;
  }
}

/* ---------- 三次收尾：首屏那行文案 ---------- */
@media (max-width: 860px) {
  .lede, .hero .lede, p.lede {
    display: block !important;
    width: auto !important;
    max-width: calc(100vw - 40px) !important;
    font-size: 13.5px !important;
    line-height: 1.85 !important;
    padding-right: 8px !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }
  .lede b { font-weight: 800; }
}

/* ---------- 最终收尾：终端块是撑宽页面的元凶 ---------- */
@media (max-width: 860px) {
  body, html { min-width: 0 !important; width: 100% !important; }
  .term, .terminal, .code, pre {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow-x: auto !important;
    white-space: pre-wrap !important;
    word-break: break-all !important;
    font-size: 11px !important;
  }
  .lede { max-width: 100% !important; }
}

/* ---------- 终极覆盖：优先级压过 cheat.css ---------- */
@media (max-width: 860px) {
  body .hero .lede, body .hero-in .lede, html body p.lede {
    width: auto !important;
    max-width: 92vw !important;
    margin: 12px 0 !important;
    font-size: 13.5px !important;
    line-height: 1.9 !important;
    letter-spacing: 0 !important;
    text-align: left !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }
}

/* ---------- 购买页 / 通用卡片：不许超出屏幕 ---------- */
@media (max-width: 860px) {
  .card, .plan, .pkg, .price, .item, .box, .panel-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .pay, .payrow, .pay-row, .paytypes, .pay-types {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
  }
  .pay > *, .payrow > *, .pay-row > *, .paytypes > *, .pay-types > * {
    width: 100% !important;
    max-width: 100% !important;
  }
  .wrap, .container, .buy-wrap { padding-left: 14px !important; padding-right: 14px !important; }
  .buy-wrap, .buy { max-width: 100% !important; }
}

/* ---------- 兜底：任何直接子容器都不许超过视口 ---------- */
@media (max-width: 860px) {
  body > *, body > div, main, section, .page, .buy, .buy-wrap, .wrap, .container {
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }
  body { padding: 0 !important; }
  .buy, .buy-wrap, .wrap, .container, main, section { padding-left: 14px !important; padding-right: 14px !important; }
}

/* ---------- 最后一刀：所有块级容器不得超过视口 ---------- */
@media (max-width: 860px) {
  div, section, main, article, aside, header, footer, nav, ul, ol, dl, figure {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* ============================================================
   卡密后台（admin.html）专用手机布局
   ============================================================ */
@media (max-width: 860px) {

  /* 整体：侧栏改成顶部横条 */
  #app { display: block !important; }
  #app .side {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    flex: none !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 10px 12px !important;
    border-right: 0 !important;
    border-bottom: 1px solid var(--line) !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #app .side .brand { padding: 0 10px 0 0 !important; flex: none; }
  #app .side .brand b { font-size: 13px !important; }
  #app .side .brand span { display: none !important; }
  #app .side .spacer,
  #app .side .ver { display: none !important; }
  #app .nav {
    flex-direction: row !important;
    gap: 6px !important;
    margin: 0 !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    scrollbar-width: none;
  }
  #app .nav::-webkit-scrollbar { display: none; }
  #app .nav button {
    padding: 7px 12px !important;
    white-space: nowrap;
    font-size: 12px !important;
    border-radius: 99px !important;
    width: auto !important;
  }
  #app .nav button .ico { display: none; }

  /* 主区域 */
  #app .main { padding: 14px 12px 34px !important; }
  #app .top { gap: 8px !important; margin-bottom: 14px !important; }
  #app .top h1 { font-size: 17px !important; }
  #app .sub { font-size: 11px !important; }
  #app .grow { display: none !important; }
  #app .search {
    min-width: 0 !important;
    width: 100% !important;
    order: 5;
    padding: 8px 10px !important;
  }
  #app .top > .btn { order: 6; flex: 1; }
  #app .top > .btn.ghost { flex: 0 0 auto; }

  /* 统计：两列 */
  #app .stats { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  #app .stat { padding: 11px 12px !important; border-radius: 12px !important; }
  #app .stat .k { font-size: 9.5px !important; letter-spacing: .12em !important; }
  #app .stat .v { font-size: 20px !important; margin-top: 5px !important; }

  /* 筛选条：可横滑 */
  #app .toolbar {
    gap: 6px !important;
    overflow-x: auto;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  #app .toolbar::-webkit-scrollbar { display: none; }
  #app .chip { flex: none; font-size: 11.5px !important; padding: 6px 11px !important; }

  /* 表格：横向滚动 + 更紧凑 */
  #app .tablebox { border-radius: 12px !important; }
  #app .scroll {
    max-height: none !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  #app table { display: table !important; min-width: 720px; white-space: nowrap; }
  #app thead th { font-size: 9.5px !important; padding: 9px 7px !important; }
  #app tbody td { padding: 9px 7px !important; font-size: 11.5px !important; }
  #app td.key { font-size: 11px !important; }
  #app .badge { font-size: 9.5px !important; padding: 2px 7px !important; }
  #app .btn.sm { font-size: 10.5px !important; padding: 5px 8px !important; }
  #app .rowact { gap: 3px !important; }

  /* 抽屉：整屏宽 */
  #app ~ .drawer, .drawer {
    width: 100vw !important;
    max-width: 100vw !important;
    padding: 18px 16px !important;
    border-left: 0 !important;
  }
  .drawer .plans { grid-template-columns: 1fr 1fr !important; }

  /* 登录卡片 */
  .login-card {
    margin: 8vh 14px 0 !important;
    max-width: 100% !important;
    padding: 22px 18px !important;
    border-radius: 16px !important;
  }

  /* toast 别挡住按钮 */
  .toasts { right: 12px !important; left: 12px !important; bottom: 14px !important; }
  .toast { max-width: 100% !important; font-size: 12px !important; }
}

/* ---------- 后台手机：按钮与表格微调 ---------- */
@media (max-width: 860px) {
  #app .top { flex-wrap: wrap !important; }
  #app .top > .btn,
  #app .top > .btn.ghost { flex: 1 1 120px !important; min-width: 0 !important; }
  #app .top > .btn:last-child { flex: 1 1 140px !important; }

  #app table { min-width: 860px !important; }
  #app td.key { white-space: nowrap !important; }
  #app tbody td { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
  #app .rowact { flex-wrap: nowrap !important; }
}

/* ---------- 后台顶部按钮：严格不越界 ---------- */
@media (max-width: 860px) {
  #app .top { display: flex !important; flex-wrap: wrap !important; gap: 8px !important; box-sizing: border-box !important; }
  #app .top > .btn, #app .top > .btn.ghost {
    flex: 1 1 calc(50% - 4px) !important;
    max-width: calc(50% - 4px) !important;
    min-width: 0 !important;
    margin: 0 !important;
  }
  #app .main { box-sizing: border-box !important; }
}

/* ---------- 后台宽度硬约束（表格不许把页面撑宽） ---------- */
@media (max-width: 860px) {
  html, body { width: 100% !important; max-width: 100vw !important; overflow-x: hidden !important; }
  #app, #app .wrap, #app .main, #app .tablebox {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }
  #app .scroll {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: auto !important;
    display: block !important;
  }
  #app table { width: 860px !important; min-width: 860px !important; }
}
