/* ============================================================
   阳光量化 · 手机端适配（自动识别手机 / 窄屏）
   ============================================================ */

/* ---------- 1. 全局防溢出与栅格收缩 ---------- */
html, body { max-width: 100%; overflow-x: hidden; }
img, svg, video, canvas { max-width: 100%; }
.grid, .grid-2, .grid-3, .grid-4, .split, .with-side { min-width: 0; }
.grid > *, .grid-2 > *, .grid-3 > *, .grid-4 > *, .split > *, .with-side > *, .card, .split-copy, .split-media { min-width: 0; }
.with-side { grid-template-columns: 230px minmax(0, 1fr); }
.table-wrap, .code-block, .prose, .row-list, .media-card { max-width: 100%; }
.table-wrap { -webkit-overflow-scrolling: touch; }
.code-block { -webkit-overflow-scrolling: touch; }
.prose, .card p, .row-item p, .timeline, .faq-body { overflow-wrap: anywhere; word-break: break-word; }
table.data { min-width: 560px; }

/* ---------- 2. 平板 / 手机公共收紧 ---------- */
@media (max-width: 920px) {
  .with-side { display: block; }
  .side-nav { display: flex; flex-wrap: wrap; gap: 6px; border-left: 0; border-bottom: 1px solid var(--line); padding: 0 0 14px; margin-bottom: 8px; position: static; }
  .side-nav .sn-title { width: 100%; margin: 0 0 4px; }
  .side-nav .sn-group { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
  .side-nav a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 12px; }
  .side-nav a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
  .split { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- 3. 手机端 ---------- */
@media (max-width: 820px) {
  body { padding-bottom: 70px; }
  .container { padding: 0 16px; }

  /* 导航 */
  .topbar .container { min-height: 34px; }
  .topbar { font-size: 11.5px; }
  .nav-inner { height: 58px; }
  .brand-name { font-size: 17px; }
  .brand-en { font-size: 8.5px; letter-spacing: .2em; }
  .brand-mark { width: 34px; height: 34px; }
  .nav-toggle { width: 44px; height: 44px; }
  .nav-drawer-links a { padding: 15px 8px; font-size: 15.5px; }
  .nav-drawer-contact { margin-top: 18px; }

  /* 首屏 */
  .hero { padding: 42px 0 52px; }
  .hero-eyebrow { font-size: 11.5px; margin-bottom: 16px; padding: 5px 12px; }
  .hero h1 { font-size: clamp(27px, 8vw, 34px); line-height: 1.22; }
  .hero-sub { margin-top: 14px; font-size: 14.5px; line-height: 1.85; }
  .hero-actions { margin-top: 22px; gap: 10px; }
  .hero-actions .btn { width: 100%; flex: none; padding: 13px 18px; }
  .hero-meta { margin-top: 22px; flex-direction: column; gap: 9px; }
  .hero-meta-item { font-size: 12.5px; }
  .hero-visual { margin-top: 8px; }
  .chart-card { padding: 16px 16px 14px; border-radius: 18px; animation: none; }
  .chart-price { font-size: 27px; margin-top: 8px; }
  .chart-svg { height: 118px; }
  .chart-foot { gap: 6px; margin-top: 10px; padding-top: 10px; }
  .chart-foot span { font-size: 9.5px; }
  .chart-foot b { font-size: 11.5px; }
  .chart-badge { font-size: 9px; padding: 3px 6px; }
  .float-chip { display: none !important; }
  .chart-delta { font-size: 12px; }

  /* 行情条 */
  .ticker-inner { height: 44px; gap: 22px; }
  .tick { font-size: 11.5px; }
  .tick-tag { font-size: 9.5px; }

  /* 区块与标题 */
  .section { padding: 48px 0; }
  .section.tight { padding: 38px 0; }
  .section-head { margin-bottom: 28px; }
  .eyebrow { font-size: 10.5px; letter-spacing: .18em; margin-bottom: 10px; }
  h2.section-title { font-size: 23px; line-height: 1.32; }
  .section-head p { font-size: 13.5px; margin-top: 10px; line-height: 1.8; }
  .page-head { padding: 40px 0 44px; }
  .page-head h1 { font-size: 27px; }
  .page-head p { font-size: 13.5px; margin-top: 10px; line-height: 1.8; }
  .head-chips { gap: 7px; margin-top: 16px; }
  .head-chip { padding: 6px 10px; font-size: 11px; }
  .crumbs { font-size: 11px; margin-bottom: 12px; }

  /* 卡片 */
  .grid { gap: 14px; }
  .card { padding: 22px 20px; border-radius: 14px; }
  .card h3 { font-size: 16.5px; }
  .card p { font-size: 13.5px; line-height: 1.75; }
  .card-icon { width: 44px; height: 44px; margin-bottom: 14px; border-radius: 12px; }
  .tag { font-size: 11px; }
  .btn { min-height: 44px; font-size: 14px; padding: 11px 20px; }
  .btn-sm { min-height: 34px; font-size: 12.5px; padding: 7px 13px; }

  /* 数据 / 分栏 / 表格 */
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 16px 12px; }
  .stat .num { font-size: 23px; }
  .stat .lbl { font-size: 11px; }
  .split { gap: 26px; }
  .split-copy h3 { font-size: 21px; }
  .split-copy p { font-size: 13.5px; }
  .table-wrap { border-radius: 12px; }
  table.data { min-width: 560px; font-size: 12.5px; }
  table.data th { padding: 10px 12px; font-size: 11px; }
  table.data td { padding: 10px 12px; }
  .code-block { font-size: 11.5px; padding: 16px; border-radius: 12px; line-height: 1.7; }
  .prose p { font-size: 14px; }
  .prose h2 { font-size: 21px; margin: 26px 0 10px; }
  .prose h3 { font-size: 18px; }
  .row-item { padding: 16px 16px; gap: 12px; }
  .row-item h4 { font-size: 14.5px; }
  .row-item p { font-size: 12.5px; }
  .timeline { padding-left: 24px; }
  .tl-item h4 { font-size: 16px; }
  .tl-item p { font-size: 13px; }
  .steps { gap: 12px; }
  .step { padding: 20px 18px; }
  .callout { padding: 15px 16px; font-size: 12.5px; gap: 10px; }
  .callout .cta { margin-left: 0; margin-top: 8px; }
  .accordion details.faq summary { padding: 15px 16px; font-size: 14px; }
  .faq-body { padding: 0 16px 16px; font-size: 13px; }

  /* 金评 / 联系 / 表单 */
  .note-grid { grid-template-columns: minmax(0, 1fr); }
  .note-card { padding: 18px; min-height: 0; }
  .contact-grid { grid-template-columns: minmax(0, 1fr); }
  .contact-card { padding: 22px 20px; }
  .contact-value { font-size: 21px; }
  .form-card { padding: 22px 18px; }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .field input, .field select, .field textarea { font-size: 16px; } /* 防 iOS 自动放大 */
  .field label { font-size: 12px; }
  .tool-card { padding: 20px 16px; }
  .result-row b { font-size: 17px; }
  .pill-tabs { gap: 7px; margin-bottom: 24px; }
  .pill { padding: 8px 13px; font-size: 12px; min-height: 38px; }

  /* 页脚 */
  .footer { padding-top: 42px; }
  .foot-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px 18px; padding-bottom: 30px; }
  .foot-brand { grid-column: 1 / -1; }
  .foot-desc { font-size: 12.5px; }
  .foot-col h5 { font-size: 11px; margin-bottom: 10px; }
  .foot-col a { font-size: 12.5px; padding: 5px 0; }
  .foot-cta { padding: 16px; }
  .foot-cta .v { font-size: 20px; }
  .foot-bottom { flex-direction: column; gap: 8px; font-size: 10.5px; padding: 18px 0 24px; }
  .foot-risk { font-size: 10px; }

  /* 悬浮联系换成底部操作栏 */
  .dock { display: none !important; }
}

/* ---------- 4. 手机底部操作栏（由 main.js 注入） ---------- */
.m-bar { display: none; }
@media (max-width: 820px) {
  .m-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 86;
    background: rgba(9, 18, 33, .97); border-top: 1px solid rgba(255, 255, 255, .09);
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, .25);
  }
  .m-bar a, .m-bar button {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: rgba(255, 255, 255, .62); background: transparent; border: 0; font-size: 10.5px;
    font-family: inherit; min-height: 44px; border-radius: 10px; cursor: pointer; text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .m-bar a:active, .m-bar button:active { background: rgba(255, 255, 255, .07); }
  .m-bar .i { width: 21px; height: 21px; color: var(--gold); }
  .m-bar .active { color: var(--gold-2); font-weight: 700; }
  .m-bar .active .i { color: var(--gold-2); }
}

/* ---------- 4.5 手机端宽表格转卡片 ---------- */
@media (max-width: 820px) {
  .table-wrap { overflow: visible; border: 0; background: transparent; box-shadow: none; border-radius: 0; }
  table.data { display: block; width: 100%; min-width: 0; border-collapse: separate; }
  table.data thead { display: none; }
  table.data tbody { display: block; }
  table.data tr { display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 4px 0; overflow: hidden; box-shadow: var(--shadow-sm); }
  table.data td { display: block; border: 0; padding: 7px 14px; font-size: 13px; line-height: 1.7; color: var(--muted); }
  table.data td::before { content: attr(data-label); display: block; font-size: 10px; letter-spacing: .08em; color: var(--muted-2); font-weight: 800; margin-bottom: 1px; }
  table.data td:first-child { background: #FBF9F4; border-bottom: 1px solid var(--line-2); padding: 10px 14px; }
  table.data td:first-child::before { display: none; }
  table.data td:first-child strong { font-size: 14.5px; color: var(--text); }
  table.data td:last-child { border-bottom: 0; }
  table.data tr:hover td { background: transparent; }
  table.data tr:hover td:first-child { background: #FBF9F4; }
  .code-block { white-space: pre-wrap !important; overflow-wrap: anywhere; word-break: break-word; font-size: 11px; }
}

/* ---------- 5. 超小屏（≤ 380px） ---------- */
@media (max-width: 380px) {
  .container { padding: 0 13px; }
  .hero h1 { font-size: 25px; }
  .card { padding: 19px 16px; }
  .contact-value { font-size: 19px; }
  .page-head h1 { font-size: 25px; }
  .foot-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- 6. 触摸设备：去掉 hover 位移，避免点按后卡住 ---------- */
@media (hover: none), (pointer: coarse) {
  .card:hover, .contact-card:hover, .note-card:hover { transform: none; }
  .btn:hover { transform: none; }
  .float-chip { display: none !important; }
}

/* ---------- 7. 手机端只使用识别结果做增强 ---------- */
.is-mobile .hero-sun { opacity: .55; }
.is-mobile .chart-card { animation: none; }
