/* =========================================================================
 * JEWEL MONSTER · 手机屏自适应（mobile.css v1）
 * 全站最后加载，覆盖同选择器。只做「手机端可用性与版式」，不动结构。
 * 断点：≤720px 手机 / ≤420px 小屏。平板(721-1024)沿用原有断点。
 * 注意：studio.html 是深色工作台主题，本表只做通用的点击区/输入/安全区，
 *      不翻它的配色，避免破坏深色 UI。
 * ========================================================================= */

/* ---------- ≤720px：手机 ---------- */
@media (max-width: 720px) {
  /* 顶栏：压缩留白，品牌字缩小 */
  .topbar .wrap { padding-left: 12px; padding-right: 12px; min-height: 54px; gap: 8px; }
  .topbar .logo img { height: 30px !important; }
  .topbar .brand-text { font-size: 14px; line-height: 1.1; }
  .topbar .brand-text small { display: none; }

  /* 导航：图标模式（文字视觉隐藏但保留给读屏），全部项在 360px 宽也能排下，无需横滑 */
  .topbar .nav {
    display: flex !important;
    flex: 1 1 auto;
    justify-content: space-between;
    gap: 0;
    overflow: visible !important;
    padding: 0;
  }
  .topbar .nav a {
    flex: 0 0 auto;
    min-width: 40px;
    min-height: 44px;
    padding: 0 6px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0;
    font-size: 0;
  }
  .topbar .nav a span {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .topbar .nav a svg { width: 21px; height: 21px; }
  .topbar .nav a.nav-home svg { width: 22px; height: 22px; }

  /* 我的 / 语言：同样图标化并压缩；「我的」推到右侧，与语言切换同侧成组 */
  .topbar .acct-btn { padding: 0 8px !important; min-height: 40px; font-size: 0; gap: 0; margin-left: auto !important; }
  .topbar .acct-btn svg { width: 20px; height: 20px; }
  .topbar .acct-btn span {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .topbar .lang-sel { font-size: 12px; padding: 6px 4px; min-height: 36px; max-width: 62px; }

  /* HERO：字号与留白收敛 */
  .hero { padding: 26px 0 20px !important; }
  .hero h1 { font-size: 26px !important; line-height: 1.25 !important; }
  .hero .lead, .hero p { font-size: 14.5px !important; line-height: 1.65 !important; }
  .pg-hero h1 { font-size: 24px !important; }
  .pg-hero .lead { font-size: 14.5px !important; }

  /* 通用块：左右留白统一，段间距收紧 */
  .wrap, .pg-block .wrap, section > .wrap { padding-left: 14px !important; padding-right: 14px !important; }
  .pg-block, section { padding-top: 20px !important; padding-bottom: 20px !important; }
  h2 { font-size: 20px !important; }
  h3 { font-size: 16.5px !important; }

  /* 栅格一律单列（卡片 / 会员档位 / 页脚 / 统计两列） */
  .acct-grid, .acct-tiers, .footer-grid, .cards, .grid-3, .grid-2, .grid-4,
  .benefit-grid, .maker-grid, .shop-grid, .story-grid {
    grid-template-columns: 1fr !important;
  }
  .acct-stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .footer-grid { gap: 16px !important; }
  .footer-col a { padding: 5px 0; }

  /* 会员中心标签页：换行而不是横滑（8 个页签必须都能一眼看到） */
  .acct-tabs { flex-wrap: wrap !important; gap: 6px !important; overflow: visible !important; }
  .acct-tab { flex: 1 1 auto !important; min-height: 38px; padding: 8px 10px !important; font-size: 13px !important; }
  .acct-head { flex-direction: column; align-items: flex-start !important; gap: 12px; }
  .acct-head-acts { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
  .acct-head-acts .btn, .acct-head-acts a { flex: 1 1 auto; min-height: 42px; }
  .acct-wallet-top { flex-direction: column; }
  .acct-member-top { flex-direction: column; }
  .acct-panel { padding: 14px; }

  /* 表单：16px 防止 iOS 聚焦自动放大；按钮满足 44px 点击区 */
  input, select, textarea, button { font-size: 16px !important; }
  .btn, .btn-primary, .btn-cream, .acct-mini { min-height: 44px; }
  .code-row { flex-wrap: nowrap; }
  .code-row input { flex: 1 1 auto; min-width: 0; }
  .code-row .btn { flex: 0 0 auto; white-space: nowrap; padding-left: 12px; padding-right: 12px; }
  .field { margin-bottom: 12px; }

  /* 社区头像圈里的字太小（实测 <11px），抬到 12px */
  .fc-ava, .fc-ava.mk { font-size: 12px !important; }

  /* 过小字号统一抬到 12px（时间戳 / meta / small 在手机上看不清） */
  small, .meta, .cm-meta, time, .foot-src, .acct-stat span, .pg-meta { font-size: 12px !important; }

  /* 按钮类点击区至少 40px（导航与「我的」键另有规则，不受影响） */
  a.btn:not(.acct-mini), .btn:not(.acct-mini) { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }

  /* 轮播箭头放大到 44px 点击区（圆点指示器保持原尺寸，属装饰件） */
  .jmc-arrow, .carousel-arrow, .spark-arrow { min-width: 44px !important; min-height: 44px !important; }

  /* 图片与媒体不溢出 */
  img, video, canvas, svg, table { max-width: 100% !important; }
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* 地址行 / 列表行在窄屏改为上下堆叠，避免右侧按钮被挤没 */
  .addr-row, .acct-row { flex-wrap: wrap; gap: 8px; }
  .addr-acts, .acct-row .acct-amt { margin-left: auto; }

  /* 刘海屏 / 手势条安全区 */
  .topbar { padding-top: env(safe-area-inset-top); }
  .footer { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  body { padding-bottom: env(safe-area-inset-bottom); }
}

/* ---------- ≤420px：小屏再收紧 ---------- */
@media (max-width: 420px) {
  .topbar .wrap { padding-left: 8px; padding-right: 8px; gap: 4px; }
  .topbar .brand-text { display: none; }
  .topbar .nav a { min-width: 34px; padding: 0 4px; }
  .topbar .nav a svg { width: 19px; height: 19px; }
  .topbar .lang-sel { max-width: 54px; font-size: 11px; }
  .hero h1 { font-size: 22px !important; }
  .pg-hero h1 { font-size: 21px !important; }
  .acct-stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .acct-stat b { font-size: 17px; }
  .acct-stat span { font-size: 11.5px; }
  .acct-tab { font-size: 12px !important; padding: 7px 8px !important; }
  .acct-member-card b, .acct-wallet-bal b { font-size: 22px !important; }
}

/* ---------- 横屏矮屏：避免顶栏吃掉半屏 ---------- */
@media (max-height: 460px) and (orientation: landscape) {
  .topbar .wrap { min-height: 44px; }
  .hero { padding: 14px 0 !important; }
  .hero h1 { font-size: 20px !important; }
}

/* ---------- 减少动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
