/* ============================================================
 * ranking-m.css — 仅 ranking.html 引用
 * 移动端排行榜（≤767px）：m-* 专用结构，桌面零改动
 * 依赖：ranking.css（桌面布局）、pagination-common.css（分页）
 * ============================================================ */

.m-top, .m-hero, .m-chips, .m-sec--rank, .m-footer, .m-tabbar, .m-drawer { display: none; }

@media (max-width: 767px) {
  /* 隐藏桌面结构（本文件仅排行榜页加载） */
  .ag-header,
  .ag-main,
  .game-footer { display: none !important; }

  body.ag-page { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }

  .m-top { display: block; }
  .m-hero, .m-chips, .m-sec--rank { display: block; }
  .m-tabbar { display: flex; }

  /* ---------- 顶栏 ---------- */
  .m-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 8px;
  }
  .m-logo { display: flex; align-items: center; gap: 8px; text-decoration: none; }
  .m-logo img { height: 40px; }
  .m-logo-text { display: flex; flex-direction: column; line-height: 1.15; }
  .m-logo-text b {
    font-size: 19px; color: #ffcc00; letter-spacing: 2px; font-weight: 800;
    text-shadow: 0 0 14px rgba(255, 204, 0, .45);
  }
  .m-logo-text i { font-style: normal; font-size: 9.5px; color: #9a93a8; letter-spacing: 2.5px; }
  .m-topbar-actions { display: flex; gap: 8px; }
  .m-ico-btn {
    width: 40px; height: 40px; border-radius: 11px;
    background: #17171f; border: 1px solid #2b2b36; color: #e8e8f0;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
  }
  .m-ico-btn--gold {
    background: linear-gradient(160deg, #ffd54a, #ffaa00);
    border-color: transparent; color: #1a1206;
    box-shadow: 0 2px 10px rgba(255, 170, 0, .35);
  }

  /* ---------- 搜索框 ---------- */
  .m-search {
    display: flex; align-items: center; gap: 8px;
    margin: 2px 14px 10px; padding: 0 12px;
    height: 38px; border-radius: 11px;
    background: #14141b; border: 1px solid #2b2b36; color: #8a8a96;
  }
  .m-search input {
    flex: 1; min-width: 0; background: transparent; border: 0; outline: none;
    color: #f0f0f5; font-size: 14px;
  }
  .m-search input::placeholder { color: #6b6b78; }
  .m-search button {
    background: transparent; border: 0; color: #ffcc00;
    font-size: 14px; font-weight: 700; cursor: pointer; padding: 4px 2px;
  }

  /* ---------- 分类导航条 ---------- */
  .m-catnav {
    display: flex; align-items: stretch;
    padding: 6px 10px 10px; gap: 4px;
    border-bottom: 1px solid #1d1d26;
  }
  .m-catnav a {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 7px 0; border-radius: 11px; text-decoration: none;
    color: #c9c9d4; font-size: clamp(10.5px, 3.1vw, 12px); font-weight: 600;
  }
  .m-catnav a span { white-space: nowrap; }
  .m-catnav a svg { width: 21px; height: 21px; }
  .m-catnav a.active {
    background: linear-gradient(160deg, #ffd54a, #ffaa00);
    color: #1a1206; font-weight: 800;
    box-shadow: 0 2px 10px rgba(255, 170, 0, .3);
  }

  /* ---------- 抽屉菜单 ---------- */
  .m-drawer {
    display: none;
    position: fixed; z-index: 90;
    top: 64px; right: 14px; min-width: 148px;
    background: #17171f; border: 1px solid #2b2b36; border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .6);
    overflow: hidden;
  }
  .m-drawer.open { display: block; }
  .m-drawer a {
    display: block; padding: 11px 18px; color: #d8d8e2;
    font-size: 14px; text-decoration: none; border-bottom: 1px solid #22222c;
  }
  .m-drawer a:last-child { border-bottom: 0; }
  .m-drawer a:active { background: #20202b; color: #ffcc00; }

  /* ---------- Banner（经典游戏热度排行榜） ---------- */
  .m-hero--rank {
    display: block;
    margin: 12px 12px 0;
    aspect-ratio: 808 / 148;
    border-radius: 14px; overflow: hidden;
    border: 1px solid rgba(255, 170, 0, .3);
    background: url('../images/common/rank-hero.jpg') center / 100% 100% no-repeat, #0a0a0f;
  }

  /* ---------- 排序芯片（人气/收藏/下载/通关） ---------- */
  .m-chips {
    display: flex; gap: 8px;
    margin: 12px 12px 0;
    overflow-x: auto; padding-bottom: 2px;
    scrollbar-width: none;
  }
  .m-chips::-webkit-scrollbar { display: none; }
  .m-chip {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 15px; border-radius: 10px;
    background: #14141b; border: 1px solid #2b2b36;
    color: #c9c9d4; font-size: 13.5px; font-weight: 600;
    cursor: pointer; white-space: nowrap;
  }
  .m-chip svg { width: 15px; height: 15px; }
  .m-chip.active {
    background: linear-gradient(160deg, #ffd54a, #ffaa00);
    border-color: transparent; color: #1a1206; font-weight: 800;
    box-shadow: 0 2px 10px rgba(255, 170, 0, .3);
  }

  /* ---------- 榜单 ---------- */
  .m-sec--rank { margin: 14px 12px 0; }
  .m-rank-empty {
    padding: 30px 0; text-align: center; color: #7d7d8a; font-size: 13px;
  }

  /* —— 开始游戏 金色按钮（TOP3 大按钮 / 行内小按钮共用） —— */
  .m-play-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    background: linear-gradient(160deg, #ffd54a, #ffaa00);
    color: #1a1206; font-weight: 800; text-decoration: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(255, 170, 0, .3);
  }
  .m-play-btn::after { content: '▶'; font-size: .82em; }

  /* —— TOP 3 大卡 —— */
  .m-rtop {
    display: flex; align-items: center; gap: 8px;
    padding: 11px; margin-bottom: 10px;
    border-radius: 14px; text-decoration: none;
    background: linear-gradient(150deg, #16161e, #101016);
    position: relative;
  }
  .m-rtop--1 { border: 1px solid rgba(255, 204, 0, .55); box-shadow: 0 0 16px rgba(255, 170, 0, .12); }
  .m-rtop--2 { border: 1px solid rgba(190, 205, 230, .45); }
  .m-rtop--3 { border: 1px solid rgba(230, 140, 70, .5); }
  .m-rtop-crown {
    width: 34px; height: 34px; flex: 0 0 34px;
    display: flex; align-items: center; justify-content: center;
  }
  .m-rtop-crown img { width: 100%; height: 100%; object-fit: contain; }
  .m-rtop-thumb {
    width: 70px; height: 56px; flex: 0 0 70px;
    border-radius: 9px; overflow: hidden; background: #14141b;
    border: 1px solid #2a2a34;
  }
  .m-rtop--1 .m-rtop-thumb { border-color: rgba(255, 204, 0, .5); }
  .m-rtop--2 .m-rtop-thumb { border-color: rgba(190, 205, 230, .4); }
  .m-rtop--3 .m-rtop-thumb { border-color: rgba(230, 140, 70, .45); }
  .m-rtop-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .m-rtop-info { flex: 1; min-width: 0; }
  .m-rtop-name {
    display: block; color: #f2f2f5; font-size: 14.5px; font-weight: 800;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .m-rtop-tags { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
  .m-rtop-tags i { font-style: normal; font-size: 11px; color: #b8b8c4; }
  .m-rtop-tags i.plat { color: #ffcc00; font-weight: 700; }
  .m-rtop-stats { display: flex; align-items: center; gap: 12px; margin-top: 5px; font-size: 12px; color: #8a8a96; }
  .m-rtop-stats b { color: #c9c9d4; font-weight: 700; }
  .m-rtop-stats .lk { color: #ff6b7a; }
  .m-rtop .m-play-btn { flex: 0 0 auto; height: 32px; padding: 0 9px; font-size: 11.5px; border-radius: 9px; }

  /* —— 第 4 名起的紧凑行 —— */
  .m-rrow {
    display: flex; align-items: center; gap: 9px;
    padding: 9px 10px; margin-bottom: 8px;
    border-radius: 12px; text-decoration: none;
    background: linear-gradient(150deg, #15151d, #101016);
    border: 1px solid #23232d;
  }
  .m-rrow-num {
    width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800;
    background: #20202a; color: #9a9aa6;
  }
  .m-rrow-thumb {
    width: 48px; height: 48px; flex: 0 0 48px;
    border-radius: 9px; overflow: hidden; background: #14141b;
    border: 1px solid #2a2a34;
  }
  .m-rrow-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .m-rrow-info { flex: 1; min-width: 0; }
  .m-rrow-name {
    display: block; color: #f2f2f5; font-size: 14px; font-weight: 700;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .m-rrow-tags { display: flex; gap: 5px; margin-top: 3px; }
  .m-rrow-tags i {
    font-style: normal; font-size: 10.5px; color: #9a9aa6;
    padding: 1px 7px; border-radius: 6px;
    background: #1d1d26; border: 1px solid #2b2b36;
  }
  .m-rrow .m-play-btn { flex: 0 0 auto; height: 30px; padding: 0 11px; font-size: 11.5px; border-radius: 8px; }

  /* 分页 */
  .m-sec--rank .pg-pagination { margin-top: 14px; }

  /* ---------- 简化页脚 ---------- */
  .m-footer {
    display: block;
    margin-top: 22px; padding: 16px 14px 18px;
    border-top: 1px solid #1d1d26; text-align: center;
  }
  .m-footer p { margin: 0 0 6px; }
  .m-footer-copy { color: #7d7d8a; font-size: 11.5px; }
  .m-footer-links { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 !important; }
  .m-footer-links a { color: #9a9aa6; font-size: 11.5px; text-decoration: none; }
  .m-footer-links span { color: #33333e; }

  /* ---------- 底部 TabBar（首页/排行榜/主机/我的） ---------- */
  .m-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    height: calc(58px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(14, 14, 20, .96);
    border-top: 1px solid #23232d;
    backdrop-filter: blur(10px);
  }
  .m-tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: #8a8a96; font-size: 11px; text-decoration: none;
  }
  .m-tabbar a svg { width: 22px; height: 22px; }
  .m-tabbar a.active { color: #ffcc00; font-weight: 700; }
}
