/* ═══════════════════════════════════════════════════════════════
   Veyrun 悦跑 · App 外壳（侧栏 + 全屏地图 + 底部卡片轮播）
   ───────────────────────────────────────────────────────────────
   版式来自用户手绘稿：
     左上品牌 + 右侧登录/注册 · 左侧竖栏可折叠 · 地图占满
     底部正中 5 张小卡片，左右拖动即切页 · 下面一排分页点
   加载顺序在 style.css / home.css 之后，只覆盖桌面壳层。
   ═══════════════════════════════════════════════════════════════ */

:root {
  --rail: 232px;          /* 侧栏展开宽度 */
  --rail-mini: 76px;      /* 侧栏收起宽度 */
  --rail-w: var(--rail);  /* 当前生效宽度，由 body.rail-mini 改写 */
  --dock-h: 96px;
  --panel-zone: 400px;    /* 首页左侧控制面板占掉的宽度，dock 用它避让 */
}

/* 手机屏窄：展开 232px 会吃掉一半画面，所以窄屏的展开宽度也收一档 */
@media (max-width: 1023px) {
  :root { --rail: 196px; --rail-mini: 64px; }
}

body.rail-mini { --rail-w: var(--rail-mini); }

/* 窄屏侧栏展开时的遮罩（节点由 bindRail 插入）。
   基础态必须是"不可见 + 不接收点击" —— 这个 div 在桌面宽度下也躺在 DOM 里，
   只靠 @media 里的规则兜底的话，宽屏就会变成一层看不见却能吃点击的膜。 */
.rail-mask {
  position: fixed; inset: 0 0 0 var(--rail); z-index: 69;
  background: rgba(4, 2, 10, .52);
  opacity: 0; pointer-events: none;
  transition: opacity 300ms var(--ease-ios, cubic-bezier(.32, .72, 0, 1));
}
body:not(.rail-mini) > .rail-mask { opacity: 1; pointer-events: auto; }
/* 宽屏侧栏本身就是页面的一部分，不需要遮罩 */
@media (min-width: 1024px) {
  .rail-mask { display: none; }
}

/* ───────────── 壳层骨架 ───────────── */

.vrail {
  position: fixed; inset: 0 auto 0 0; z-index: 70;
  width: var(--rail-w);
  display: flex; flex-direction: column;
  padding: 18px 12px 14px;
  background:
    linear-gradient(180deg, rgba(30, 19, 58, .92), rgba(11, 8, 22, .96) 62%, rgba(8, 6, 16, .98));
  backdrop-filter: saturate(170%) blur(26px);
  -webkit-backdrop-filter: saturate(170%) blur(26px);
  border-right: 1px solid rgba(198, 166, 234, .10);
  box-shadow: 1px 0 0 rgba(255, 255, 255, .03), 24px 0 60px -46px rgba(0, 0, 0, 1);
  transition: width 460ms var(--ease-ios, cubic-bezier(.32, .72, 0, 1));
  overflow: visible;   /* 折叠手柄要伸出右缘，不能被裁掉 */
}
/* 侧栏右缘一线紫光，收起时也保留，作为「这是一块玻璃」的边界 */
.vrail::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 1px;
  background: linear-gradient(180deg, rgba(198, 166, 234, .34), rgba(110, 69, 186, .06) 40%, transparent);
  pointer-events: none;
}

/* ── 品牌行：logo 在左，登录/注册紧贴它右边（稿子明确要求） ── */
.vrail-top {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 6px 16px;
  flex: none;
}
.vlogo { display: flex; align-items: center; gap: 9px; min-width: 0; flex: none; }
.vlogo-mark {
  width: 34px; height: 34px; border-radius: 11px; flex: none; overflow: hidden;
  background: linear-gradient(140deg, #af85e5, #2c1f5c 62%, #2e1065);
  box-shadow: 0 4px 16px rgba(110, 69, 186, .5), 0 0 0 1px rgba(198, 166, 234, .22),
              inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: box-shadow 260ms var(--ease-out, ease), transform 220ms var(--spring, ease);
}
.vlogo-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vlogo:hover .vlogo-mark { box-shadow: 0 6px 22px rgba(139, 92, 246, .68), 0 0 0 1px rgba(196, 181, 253, .4), inset 0 1px 0 rgba(255,255,255,.4); }
.vlogo:active .vlogo-mark { transform: scale(.94); }
.vlogo-txt { display: flex; flex-direction: column; line-height: 1.02; white-space: nowrap; }
.vlogo-txt b {
  font-size: 15.5px; font-weight: 800; letter-spacing: -.02em;
  background: linear-gradient(100deg, #fff, #ddd0ff 48%, #af85e5);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.vlogo-txt i { font-size: 9px; font-style: normal; letter-spacing: .3em; color: var(--ink-3); font-weight: 700; margin-top: 1px; }

/* 登录 / 注册：贴着品牌右边的袖珍胶囊 */
.vauth {
  margin-left: 2px; flex: none;
  padding: 7px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap;
  color: #f3ecff;
  background: linear-gradient(180deg, rgba(139, 92, 246, .92), rgba(91, 33, 182, .92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .34), 0 6px 18px -8px rgba(139, 92, 246, .9);
  transition: transform 180ms var(--spring, ease), box-shadow 220ms var(--ease-out, ease), filter 220ms;
}
.vauth:hover { filter: brightness(1.08); box-shadow: inset 0 1px 0 rgba(255,255,255,.44), 0 8px 24px -8px rgba(167, 139, 250, 1); }
.vauth:active { transform: scale(.955); }
.vauth.ghosted {
  background: rgba(255, 255, 255, .07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 0 0 1px rgba(198, 166, 234, .16);
  color: var(--ink-2);
}

/* ── 侧栏导航（分组，照参考站） ── */
.vnav { display: flex; flex-direction: column; flex: 1; overflow-y: auto; overflow-x: hidden; padding: 2px 0 10px; }
.vnav::-webkit-scrollbar { width: 0; }
.vgrp { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.vgrp-t {
  padding: 10px 12px 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .16em;
  color: rgba(196, 166, 234, .40);
  white-space: nowrap;
  transition: opacity 200ms var(--ease-out, ease);
}
.vsep { height: 1px; margin: 10px 10px; background: linear-gradient(90deg, transparent, rgba(198, 166, 234, .18), transparent); flex: none; }
.vnav a {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  height: 42px; padding: 0 11px; border-radius: 13px;
  color: var(--ink-2); font-size: 13.5px; font-weight: 600; letter-spacing: -.005em;
  white-space: nowrap;
  transition: background 240ms var(--ease-out, ease), color 180ms var(--ease-out, ease), transform 180ms var(--spring, ease);
}
/* NEW 小徽标 */
.vnav a .vb {
  flex: none; padding: 3px 6px; border-radius: 7px;
  font-size: 9px; font-weight: 800; letter-spacing: .04em;
  color: #0f0a1e; background: linear-gradient(180deg, #f1e7f9, #c6a6ea);
  box-shadow: 0 4px 12px -6px rgba(198, 166, 234, .9);
  transition: opacity 200ms var(--ease-out, ease);
}
.vnav a .vi {
  width: 20px; flex: none; text-align: center; font-size: 15px; line-height: 1;
  opacity: .9; transition: transform 260ms var(--spring, ease), opacity 200ms;
}
.vnav a .vt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; transition: opacity 220ms var(--ease-out, ease); }
.vnav a:hover { background: rgba(255, 255, 255, .055); color: #fff; }
.vnav a:hover .vi { transform: translateY(-1px) scale(1.06); opacity: 1; }
.vnav a:active { transform: scale(.985); }
/* 选中：紫色渐层胶囊 + 左缘一道竖光，跟 iOS 侧边栏同一套语言 */
.vnav a.on {
  color: #fff;
  background: linear-gradient(100deg, rgba(110, 69, 186, .48), rgba(110, 69, 186, .16) 78%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10), 0 8px 26px -18px rgba(139, 92, 246, 1);
  text-shadow: 0 0 18px rgba(198, 166, 234, .5);
}
.vnav a.on::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 2.5px; height: 17px; border-radius: 2px;
  background: linear-gradient(180deg, #e9dcff, #a855f7);
  box-shadow: 0 0 12px rgba(168, 85, 247, .95);
}
.vnav a.on .vi { opacity: 1; }

/* ── 侧栏底部：剩余额度卡 + 用户行 ── */
.vrail-bot { flex: none; padding-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.vbal {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 13px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .03));
  box-shadow: inset 0 0 0 1px rgba(198, 166, 234, .14), inset 0 1px 0 rgba(255, 255, 255, .07);
  color: var(--ink-2); font-size: 12px; font-weight: 600;
  transition: background 220ms, box-shadow 220ms;
}
.vbal:hover { background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1px rgba(198, 166, 234, .26); }
.vbal b { font-size: 15px; font-weight: 800; letter-spacing: -.02em; color: #fff; }
.vbal b em { font-style: normal; font-size: 10px; font-weight: 600; color: var(--ink-3); margin-left: 3px; }

.vuser {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 2px 2px;
}
.vava {
  width: 26px; height: 26px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: #fff;
  background: linear-gradient(140deg, #a877f0, #4a2f8c);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3);
}
.vuname {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px; font-weight: 650; color: var(--ink-1);
  transition: opacity 200ms;
}
.vacts { display: flex; align-items: center; gap: 1px; flex: none; }
.vacts button {
  width: 24px; height: 24px; border-radius: 8px;
  display: grid; place-items: center;
  background: transparent; border: 0; padding: 0;
  color: var(--ink-3);
  transition: background 180ms, color 180ms, transform 160ms var(--spring, ease);
}
.vacts button svg { display: block; }
.vacts button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.vacts button:active { transform: scale(.9); }

/* 折叠手柄：贴在侧栏右缘中间，伸出来半个圆，收起时也不会遮住导航 */
.vfold {
  position: absolute; right: -13px; top: 50%; transform: translateY(-50%);
  z-index: 3;
  width: 26px; height: 44px; border-radius: 0 13px 13px 0;
  display: grid; place-items: center;
  background: rgba(30, 20, 52, .92);
  box-shadow: inset 0 0 0 1px rgba(198, 166, 234, .16), inset 0 1px 0 rgba(255, 255, 255, .07), 8px 0 20px -14px rgba(0, 0, 0, 1);
  color: var(--ink-2);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: background 200ms, color 200ms, width 200ms, right 200ms;
}
.vfold:hover { background: rgba(60, 40, 100, .95); color: #fff; width: 30px; right: -15px; }
.vfold:active { transform: translateY(-50%) scale(.94); }
/* 折叠箭头：一道 chevron，收起时转 180° */
.vfold i {
  width: 8px; height: 8px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); margin-left: 2px;
  transition: transform 420ms var(--ease-ios, ease);
}
body.rail-mini .vfold i { transform: rotate(225deg); margin-left: -2px; }

/* ── 收起态：只留图标 ── */
body.rail-mini .vrail { padding-left: 10px; padding-right: 10px; }
body.rail-mini .vlogo-txt,
body.rail-mini .vnav a .vt,
body.rail-mini .vnav a .vb,
body.rail-mini .vgrp-t,
body.rail-mini .vuname,
body.rail-mini .vacts,
body.rail-mini .vbal span,
body.rail-mini .vbal b { opacity: 0; pointer-events: none; }
body.rail-mini .vgrp-t { height: 0; padding: 2px 0; overflow: hidden; }
body.rail-mini .vbal { justify-content: center; padding: 9px 0; }
body.rail-mini .vuser { justify-content: center; }
body.rail-mini .vrail-top { flex-direction: column; align-items: flex-start; gap: 12px; padding-left: 8px; }
body.rail-mini .vauth {
  margin-left: 0; width: 34px; height: 30px; padding: 0;
  display: grid; place-items: center; font-size: 0;
  background: rgba(255, 255, 255, .07);
  box-shadow: inset 0 0 0 1px rgba(198, 166, 234, .16), inset 0 1px 0 rgba(255, 255, 255, .07);
  color: var(--ink-2);
}
body.rail-mini .vauth::after { content: "⇥"; font-size: 14px; font-weight: 800; }
body.rail-mini .vauth:hover { background: rgba(255, 255, 255, .12); color: #fff; }
body.rail-mini .vnav a { justify-content: center; padding: 0; gap: 0; }

/* ───────────── 主区域 ───────────── */

/* 页面里的多列卡片栅格（之前只有 .grid 类名、没有规则，卡片会一列到底） */
.grid { display: grid; gap: 16px; }
.grid.g2 { grid-template-columns: repeat(auto-fit, minmax(288px, 1fr)); }
.grid.g3 { grid-template-columns: repeat(auto-fit, minmax(238px, 1fr)); }

.vmain {
  margin-left: var(--rail-w);
  min-height: 100vh;
  transition: margin-left 460ms var(--ease-ios, cubic-bezier(.32, .72, 0, 1));
}

/* 桌面壳层生效时，老顶栏与底部 tabbar 都退场（窄屏仍然用它们导航） */
@media (min-width: 1024px) {
  body.shell .top,
  body.shell .tabbar { display: none; }
}
/* 手机上也是电脑网页：侧栏在，老顶栏和 tabbar 就都退场 */
@media (max-width: 1023px) {
  body.shell .top,
  body.shell .tabbar { display: none; }
  /* 但 .mtop 要留着：☰ 就是"工作栏"的入口（参考 Cyber悦跑 的顶栏） */
}

/* 首页 = 地图铺满，不再有文档流长度 */
body.shell.page-map { overflow: hidden; }
body.shell.page-map .vmain { height: 100vh; overflow: hidden; }
body.shell.page-map .foot { display: none; }

/* 首页把 route.js 的舞台拉满整块主区 */
body.shell.page-map .run-stage {
  height: 100%; width: 100%; max-width: none; margin: 0;
  border-radius: 0; border: 0; box-shadow: none;
}
body.shell.page-map .run-stage .run-map { border-radius: 0; height: 100%; }
body.shell.page-map .hv-lead { display: none; }

/* 地图之上的暗角：让底部的卡片轮播与右上面板压得住画面 */
body.shell.page-map .vmain::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 5;
  background:
    linear-gradient(180deg, rgba(8, 6, 16, .34) 0%, transparent 22%, transparent 62%, rgba(8, 6, 16, .72) 100%),
    radial-gradient(120% 70% at 50% 118%, rgba(88, 44, 168, .30), transparent 62%);
}

/* ───────────── 非首页：内容不满屏时页脚贴底 ───────────── */
body.shell:not(.page-map) .vmain {
  display: flex; flex-direction: column;
  min-height: 100vh; min-height: 100dvh;
}
body.shell:not(.page-map) .vmain > .foot { margin-top: auto; }

/* 窄屏：商品卡改单列，角标不再压标题 */
@media (max-width: 460px) {
  .prods { grid-template-columns: 1fr; gap: 12px; }
  .prod h3 { padding-right: 56px; }
}

/* ───────────── 非首页：底部只留一点呼吸位 ───────────── */
body.shell:not(.page-map) .vmain { padding-bottom: 40px; }
body.shell:not(.page-map) .foot { padding-bottom: 34px; }

/* ───────────── 首页：把 route.js 的舞台彻底铺满（只给桌面） ───────────── */
/* 这一段全是"铺满整屏 + 让开左侧面板"的桌面定位，窄屏必须整套作废，
   否则 route.css 里 @media(max-width:860px) 的自然流布局会被它们按在地上打。 */
@media (min-width: 1024px) {
body.page-map .vmain { position: relative; }
body.page-map .hv-top.hv-full {
  position: absolute; inset: 0; margin: 0; padding: 0; width: 100%; height: 100%;
  background: none;
}
body.page-map .hv-top.hv-full::before,
body.page-map .hv-top.hv-full::after { display: none; }
body.page-map .hv-top .run-stage {
  height: 100%; width: 100%; max-width: none; margin: 0;
  border-radius: 0; border: 0; box-shadow: none; background: #08060f;
}
body.page-map .hv-top .run-stage > * { border-radius: 0; }
body.page-map .run-note { display: none; }

/* 舞台里的路线卡：地图铺满后靠左上，避开底部 dock */
body.page-map .run-panel {
  margin: 18px 0 0 18px;
  max-height: calc(100% - 36px);
}
/* 底部统计条压在法务条之上，横向让开左侧控制面板 */
body.page-map .run-stage .run-stats {
  bottom: 40px;
  left: calc(50% + var(--panel-zone) / 2);
}
/* 右侧浮动工具条与三条候选路线错开 */
body.page-map .run-stage .run-tools { bottom: 210px; top: auto; }
}

/* ───────────── 移动端顶部条（侧栏收起后的替代） ───────────── */
.mtop { display: none; }
@media (max-width: 1023px) {
  .mtop {
    display: flex; align-items: center; justify-content: space-between;
    height: 54px; padding: 0 14px;
    position: sticky; top: 0; z-index: 70;
    background: rgba(10, 7, 20, .78);
    backdrop-filter: saturate(180%) blur(22px);
    -webkit-backdrop-filter: saturate(180%) blur(22px);
    border-bottom: 1px solid rgba(196, 181, 253, .10);
  }
  .mtop-brand { display: flex; align-items: center; gap: 9px; }
  .mtop-brand img {
    width: 30px; height: 30px; border-radius: 10px; display: block;
    box-shadow: 0 0 0 1px rgba(196, 181, 253, .18), 0 6px 18px -8px rgba(168, 85, 247, .8);
  }
  .mtop-brand b {
    display: block; font: 750 15px/1 ui-rounded, -apple-system, "SF Pro Display", sans-serif;
    letter-spacing: .2px; color: #f6f1fc;
  }
  .mtop-brand i {
    display: block; margin-top: 2px; font-style: normal;
    font-size: 9.5px; letter-spacing: .32em; color: rgba(196, 181, 253, .55);
  }
  .mtop-r { display: flex; align-items: center; gap: 8px; margin-left: auto; }
  /* ☰：网站图标左边那个三条横线，点了出工作栏 */
  .mtop-menu {
    flex: none;
    width: 38px; height: 38px; margin-right: 6px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    padding: 0; border: 0; background: none; border-radius: 12px;
    color: inherit; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mtop-menu i {
    display: block; width: 18px; height: 2px; border-radius: 2px;
    background: currentColor; opacity: .82;
    transition: transform 200ms var(--ease-out, ease);
  }
  .mtop-menu:active { background: rgba(196, 181, 253, .12); }
  .mtop-bal {
    display: inline-flex; align-items: baseline; gap: 2px;
    height: 30px; padding: 0 11px; border-radius: 999px;
    background: rgba(124, 58, 237, .16); border: 1px solid rgba(168, 85, 247, .3);
    color: #e9dcff; font-size: 12.5px;
  }
  .mtop-bal b { font-weight: 750; }
  .mtop-bal em { font-style: normal; font-size: 9.5px; color: rgba(196, 181, 253, .6); }
  .mtop-av {
    width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
    background: linear-gradient(150deg, #7c3aed, #a855f7);
    color: #fff; font-size: 12.5px; font-weight: 750;
    box-shadow: 0 6px 18px -8px rgba(168, 85, 247, .9);
  }
  .mtop-login {
    height: 30px; padding: 0 13px; border-radius: 999px;
    display: inline-flex; align-items: center;
    background: linear-gradient(150deg, #7c3aed, #a855f7);
    color: #fff; font-size: 12.5px; font-weight: 700;
    box-shadow: 0 8px 20px -10px rgba(168, 85, 247, .95);
  }
  .mtop-login:active, .mtop-av:active { transform: scale(.95); }
}

/* 手机上的侧栏是一层浮面板：展开时盖住内容，收起时完全让出画面。
   手机屏只有 390px，常驻 64px 图标条会把内容挤成 326px —— 那不叫"电脑网页"，
   那叫"手机网页少了一条边"。所以窄屏改成 overlay，逻辑跟桌面一致：默认收起，点把手滑出。 */
@media (max-width: 1023px) {
  .vrail {
    display: flex;
    width: var(--rail);
    transform: translateX(-100%);
    transition: transform 420ms var(--ease-ios, cubic-bezier(.32, .72, 0, 1));
    box-shadow: 0 0 64px -8px rgba(0, 0, 0, .7);
  }
  body:not(.rail-mini) .vrail,
  body.rail-open .vrail { transform: translateX(0); }
  /* 顶栏常驻之后（☰ 就在里面），抽屉从顶栏下沿开始，
     否则抽屉自己的品牌行会和顶栏的 logo 叠成一团。 */
  .vrail { top: 54px; padding-top: 14px; }
  body > .rail-mask { top: 54px; }
  /* 内容区不再给侧栏让位，铺满整个宽度 */
  .vmain { margin-left: 0; }

  /* 把手不能放在 .vrail 里 —— 侧栏 translateX(-100%) 会把它一起带走，
     收起后就再也点不到（实测 foldLeft=-196，屏幕外）。挪到 body 下，用 fixed 定位。 */
  body > .vfold {
    position: fixed; left: 0; top: 50%; right: auto;
    transform: translateY(-50%);
    border-radius: 0 13px 13px 0;
    z-index: 71;
  }
  body:not(.rail-mini) > .vfold { left: calc(var(--rail) - 13px); }
  body > .vfold:hover { left: 0; width: 30px; }
  body:not(.rail-mini) > .vfold:hover { left: calc(var(--rail) - 15px); }

  /* 展开时的遮罩（基础样式在上面全局段，这里只补窄屏的模糊效果） */
  .rail-mask {
    backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  }

  /* 页脚沉底后正好压在 tabbar 下面，给它留出 tabbar 的高度 */
  body.shell:not(.page-map) .vmain { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  body.shell.page-map { overflow: auto; }
  body.shell.page-map .vmain {
    height: auto; overflow: visible;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));  /* 给底部 tabbar 让位 */
  }
  body.shell.page-map .vmain::after { display: none; }
  body.shell.page-map .hv-top.hv-full { position: static; height: auto; padding: 10px 0 16px; }

  /* 首页顶栏是浮在地图上的，给地图让出这 54px */
  body.shell.page-map .mtop {
    position: fixed; left: 0; right: 0; top: 0;
    background: linear-gradient(180deg, rgba(8, 6, 16, .9) 0%, rgba(8, 6, 16, .55) 60%, transparent 100%);
    border-bottom: 0; backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  body.shell.page-map .hv-top.hv-full { padding-top: 58px; }

  /* 手机上让 route.css 的窄屏规则说了算：
     这里一旦写死宽高，就会和那边的 clamp(320px,52vh,460px) 打架，
     而且 width:100% 再叠 margin 会把整页撑宽，浏览器只好缩放显示，看着"全是乱的"。 */
  body.shell.page-map .hv-top .run-stage {
    width: auto; height: auto; margin: 0; border-radius: 0; background: transparent;
  }
  /* 桌面那条 height:100% 是给铺满布局用的，手机上是 auto 父级，会算成 0 */
  body.shell.page-map .run-stage .run-map {
    position: relative;
    height: clamp(300px, 46vh, 430px);
    border-radius: 0 0 26px 26px;
  }
  body.page-map .run-panel { margin: -28px 14px 0; max-height: none; }
}

/* 登录 / 注册这类独立页不套壳 */
body.shell-bare .vrail { display: none; }
body.shell-bare .vmain { margin-left: 0; }

/* ═══════════════════════════════════════════════════════════════
   窄屏"电脑网页版"补丁：把上面为了手机上排版而放宽的规则收回来，
   让 status / 首页两条主页面在 1024px 以下也按桌面的双栏版式渲染。
   放在最后，靠顺序压过前面的 @media(max-width:860px) 自然流规则。
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1023px) {
  /* 首页：地图重新铺满，面板重新浮在左上角 */
  body.shell.page-map { overflow: hidden; }
  body.shell.page-map .vmain {
    height: 100dvh; overflow: hidden; padding-bottom: 0;
    position: relative;
  }
  body.shell.page-map .vmain::after { display: block; }
  body.shell.page-map .hv-top.hv-full {
    position: absolute; inset: 0; margin: 0; padding: 0; width: 100%; height: 100%; background: none;
  }
  body.shell.page-map .hv-top.hv-full::before,
  body.shell.page-map .hv-top.hv-full::after { display: none; }
  body.shell.page-map .hv-top .run-stage {
    position: static;
    height: 100%; width: 100%; max-width: none; margin: 0;
    border-radius: 0; border: 0; box-shadow: none; background: #08060f;
  }
  body.shell.page-map .run-stage .run-map {
    position: absolute; inset: 0;
    height: 100%; border-radius: 0; overflow: hidden;
  }
  body.shell.page-map .run-note { display: none; }
  /* 底图铺满整屏后，页脚与 tabbar 让位（tabbar 已在上面隐藏） */
  body.shell.page-map .foot { display: none; }

  /* 鼠标 / 触屏都保留浮层手感，不再掉进文档流 */
  body.shell.page-map .run-panel {
    position: absolute;
    left: 14px; top: 14px;
    margin: 0;
    width: min(376px, calc(100% - 28px));
    max-height: calc(100% - 28px);
    border-radius: 22px;
  }
  /* 收起态：面板压成一条 56px 的头条，只留标题和按钮 */
  body.run-panel-closed .run-panel {
    width: auto; max-width: calc(100% - 28px);
    border-radius: 18px;
  }
  body.run-panel-closed .run-panel .run-pb { display: none; }
  body.run-panel-closed .run-panel .run-ph { border-bottom: 0; padding: 12px 14px; }
  body.run-panel-closed .run-panel .run-ph h1 { font-size: 14px; }
  body.run-panel-closed .run-panel .run-ph .sub { display: none; }

  /* 统计条、工具条、候选路线回到绝对定位 */
  body.shell.page-map .run-stage .run-stats {
    position: absolute;
    left: 14px; right: 14px; bottom: 14px;
    transform: none;
    margin: 0;
    border-radius: 16px;
  }
  body.shell.page-map .run-stage .run-tools {
    position: absolute;
    right: 12px; top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    flex-direction: column;
  }
  body.shell.page-map .run-stage .run-alts {
    position: absolute; right: 12px; bottom: 92px;
    left: auto; top: auto;
    margin: 0;
    flex-direction: column; flex-wrap: nowrap;
  }
  body.shell.page-map .run-stage .run-legal { display: none; }
  body.shell.page-map .run-stage .run-cred { display: none; }

  /* 非首页：内容区照常滚动，页脚贴底，不再给 tabbar 留 84px */
  body.shell:not(.page-map) .vmain { padding-bottom: 40px; }
}

/* 手机竖屏仍旧太窄（≤560px）时，面板占满宽度，别挤成一条缝 */
@media (max-width: 560px) {
  body.shell.page-map .run-panel {
    left: 10px; top: 10px;
    width: calc(100% - 20px);
    max-height: calc(100% - 20px);
  }
  body.run-panel-closed .run-panel { width: auto; max-width: calc(100% - 20px); }
  body.shell.page-map .run-stage .run-stats { left: 10px; right: 10px; bottom: 10px; }
  body.shell.page-map .run-stage .run-stats .s { padding: 8px 6px; min-width: 0; }
  body.shell.page-map .run-stage .run-stats .s b { font-size: 14px; }
  body.shell.page-map .run-stage .run-alts {
    right: 10px; bottom: 84px;
  }
  body.shell.page-map .run-stage .run-alt { font-size: 11px; padding: 6px 9px; }
}

/* 降噪：用户开了减少动态就全关掉位移 */
@media (prefers-reduced-motion: reduce) {
  .vrail, .vmain { transition-duration: 1ms !important; }
}

/* ═══════════════════════════════════════════════════════════════
   首页「跑步设置」= 底部抽屉：从页面下沿往上拉，不是浮在顶上。
   收起态只露一条把手 + "跑步设置 / 上滑或点击展开"，跟参考 App 一致。
   放在最后，靠顺序压过上面那批 left/top 定位。
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1023px) {
  body.shell.page-map .run-panel {
    left: 0; right: 0;
    top: auto; bottom: 0;
    width: 100%; max-width: 100%;
    margin: 0;
    max-height: 84dvh;
    border-radius: 22px 22px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -26px 70px -34px rgba(0, 0, 0, .95), inset 0 1px 0 rgba(255, 255, 255, .07);
    animation: none;
    transition: transform 380ms var(--ease-ios, cubic-bezier(.32, .72, 0, 1));
    /* 地图上的统计条 / 工具条 / 候选路线都是 z-index 6~7，抽屉得压过它们，
       否则它们会穿到抽屉上面来（实测整块盖在选择器上） */
    z-index: 20;
  }
  body.run-panel-closed .run-panel {
    width: 100%; max-width: 100%;
    border-radius: 22px 22px 0 0;
  }
  /* 收起时面板只剩把手那一截，别把地图挤掉 */
  body.run-panel-closed .run-panel .run-ph,
  body.run-panel-closed .run-panel .run-pb { display: none; }

  .run-grab {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    width: 100%; padding: 9px 0 11px;
    border: 0; background: none; cursor: pointer; touch-action: none;
    -webkit-tap-highlight-color: transparent;
  }
  .run-grab i { width: 40px; height: 4px; border-radius: 999px; background: rgba(196, 181, 253, .34); }
  .run-grab span { font-size: 13.5px; font-weight: 700; color: var(--ink, #f6f1fc); }
  .run-grab em { font-style: normal; font-size: 11px; color: var(--ink-3, #8b7da6); }
  /* 展开后把手只留一条横杠 */
  body:not(.run-panel-closed) .run-grab span,
  body:not(.run-panel-closed) .run-grab em { display: none; }
  body:not(.run-panel-closed) .run-grab { padding: 8px 0 4px; }

  /* 底部统计条与候选路线整体上移，别被抽屉压住 */
  body.shell.page-map .run-stage .run-stats {
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }
  body.shell.page-map .run-stage .run-alts {
    bottom: calc(158px + env(safe-area-inset-bottom, 0px));
  }
}
@media (max-width: 560px) {
  body.shell.page-map .run-stage .run-stats {
    left: 10px; right: 10px;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }
  body.shell.page-map .run-stage .run-alts {
    bottom: calc(152px + env(safe-area-inset-bottom, 0px));
  }
}
@media (min-width: 1024px) {
  .run-grab { display: none; }
}

