/* ==========================================================
   移动端适配 · 纵向滚动单栏
   ----------------------------------------------------------
   桌面端保持三栏一屏；≤780px 时改为从上到下依次排列，
   允许整页滚动，图表/场景给定可读高度，顶部收紧、导航横向滑动。
   ========================================================== */
@media (max-width:780px){
  html,body{height:auto!important;min-height:100%;overflow-x:hidden!important;overflow-y:auto!important;
    -webkit-overflow-scrolling:touch}
  body{background-attachment:scroll}
  #fui-stars{position:fixed}
  .app{height:auto!important;min-height:100vh;display:block!important;overflow:visible!important}

  /* 顶部：两行紧凑，项目名可换行，导航可横向滑动 */
  .topbar{position:relative;padding:0 12px 8px}
  .top-frame{display:flex;flex-direction:column;gap:8px;padding:10px 0 8px!important;
    align-items:stretch!important;height:auto!important;min-height:0!important;position:static!important}
  .top-left,.top-center,.top-right{margin:0!important;padding:0!important;flex:none!important;
    width:100%!important;max-width:none!important;justify-content:flex-start!important}
  .top-left .tl-txt b{font-size:14px!important;white-space:normal!important}
  .top-center{order:2}
  .top-title{min-width:0!important;width:100%!important}
  .top-title h1,#stage-project{font-size:16px!important;white-space:normal!important;
    text-align:left!important;line-height:1.35!important}
  .top-wing{display:none}
  .top-right{order:3;flex-wrap:wrap;gap:8px}
  .project-pick label{display:none}
  .project-pick select{min-width:0!important;width:100%;font-size:13px;padding:8px}
  .sys-meta{flex:0 0 100%!important;flex-wrap:wrap;white-space:normal!important;font-size:11px;
    justify-content:flex-start!important;margin-top:2px;line-height:1.5}
  .top-clock-sep{display:none}

  .l1,.l2{display:flex!important;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;height:auto!important;min-height:42px;
    -webkit-overflow-scrolling:touch;white-space:nowrap;gap:6px;padding:6px 12px;
    scrollbar-width:none}
  .l1::-webkit-scrollbar,.l2::-webkit-scrollbar{display:none}
  .l1-btn,.l2-btn{flex:0 0 auto;font-size:12px!important;padding:8px 12px!important}
  #l1-hint,.l2-tail{display:none!important}

  /* 主体：三栏拆单栏，全部自然高度 */
  .rt-scope{display:block!important}
  .board{display:block!important;padding:10px!important;height:auto!important;overflow:visible!important}
  .pane,.stage,.pane-sim,.pane-right{width:100%!important;height:auto!important;
    min-height:0!important;margin:0 0 12px;overflow:visible!important;display:block!important;
    border:1px solid var(--line-2)!important}
  .pane-head,.stage-head{position:sticky;top:0;z-index:6;background:rgba(4,18,34,.96)!important}
  .stage-sub{display:none}
  .stage-badge{margin-left:auto}
  .pane-body,.stage-body{padding:10px!important;overflow:visible!important;height:auto!important}

  /* 面板：不再绝对定位堆叠，逐个显示 */
  .panel{position:relative!important;inset:auto!important;height:auto!important;
    min-height:0!important;padding:10px!important;overflow:visible!important}
  .panel[hidden]{display:none!important}
  .panel-grid,.panel-grid.g2,.panel-grid.g1,.panel-grid.g-p4,
  .panel[data-panel="p4"] .panel-grid{display:block!important}
  .mini{height:300px!important;margin-bottom:10px;min-height:300px!important}
  .mini h3{font-size:12px!important}
  .kpi-strip{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px}
  .kpi-item{min-height:64px}
  .kpi-strip .kpi-item .k-v{font-size:20px!important}
  .side-table table{font-size:12px!important}

  /* 能量流向图与侧栏 */
  .flow-wrap{height:320px!important;min-height:320px!important}
  .flow-side{display:block!important}
  .flow-side .fs-block{margin-bottom:10px;padding:10px!important}
  .flow-side h4{font-size:14px!important;line-height:1.3!important}
  .flow-side li{font-size:13px!important;line-height:1.4!important;padding:4px 0!important}
  .flow-side li small{font-size:11px!important;line-height:1.3!important;display:block!important;text-align:left!important}
  .flow-foot{margin-top:8px}
  .flow-list{gap:6px!important}
  .flow-list .fl-item{min-height:56px!important}

  /* 实时测算：完全竖排 */
  .sim-body{padding:10px!important;height:auto!important;gap:12px!important;overflow:visible!important}
  .sim-main{display:block!important}
  .sim-hero{padding:14px!important;min-height:200px!important}
  .rt-result-figure{font-size:44px!important}
  .rt-mix-bar{height:12px!important}
  .rt-mix-keys li,.rt-mix-keys b{font-size:11px!important}
  .rt-kpis{display:grid!important;grid-auto-flow:row!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-template-rows:none!important;gap:8px!important}
  .rt-kpis>div{min-height:78px;padding:10px!important}
  .rt-kpis dt{font-size:12px!important}
  .rt-kpi-value{font-size:22px!important}
  .rt-kpi-note{font-size:11px!important;line-height:1.35!important}
  .rt-policy-wrap{margin-top:8px}
  .rt-policy-row{font-size:11px!important;padding:8px!important;line-height:1.5!important}

  /* 数智孪生：场景给定高度，浮层收窄 */
  .twin-box{display:block!important;height:auto!important}
  .twin-visual{height:360px!important;min-height:360px!important}
  .twin-hud{width:min(220px,70%)!important;left:10px!important;top:10px!important;padding:9px 10px!important}
  .twin-hud h3{font-size:16px!important}
  .twin-hud p{font-size:10px!important;line-height:1.5!important}

  /* 右栏图表 */
  .right-body{display:block!important}
  .right-metrics{grid-template-columns:repeat(3,1fr)!important;margin-bottom:10px}
  .right-metrics .rm{padding:8px 6px!important}
  .right-metrics .rm b{font-size:18px!important}
  .right-body .mini{height:280px!important;min-height:280px!important}
  .ent-table{height:auto!important;min-height:0!important;overflow:visible!important}
  .ent-table table{font-size:12px!important}

  /* 底部版权条 */
  .icp-bar{position:relative!important;height:auto!important;padding:10px 14px!important;
    font-size:10px!important;line-height:1.6!important;flex-wrap:wrap}
  .icp-left{display:block!important}

  /* 隐藏纯装饰 */
  .fui-edge,.fui-nodes,.fui-dot{display:none!important}
}

@media (max-width:480px){
  .mini{height:260px!important;min-height:260px!important}
  .flow-wrap{height:270px!important;min-height:270px!important}
  .twin-visual{height:300px!important;min-height:300px!important}
  .rt-result-figure{font-size:38px!important}
  .rt-kpis{grid-template-columns:1fr 1fr!important}
  .top-title h1,#stage-project{font-size:15px!important}
}

/* 移动端也需要 reduced-motion */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.001ms!important;transition-duration:.001ms!important}
}

/* 宝武项目移动端：stage 占满，参考站原生布局在 iframe 内自适应 */
@media (max-width:780px){
  body.is-bomi .board{display:block!important;padding:0!important}
  body.is-bomi .pane-left,body.is-bomi .pane-sim,body.is-bomi .pane-right{display:none!important}
  body.is-bomi .stage{width:100%!important;height:calc(100vh - 200px)!important;min-height:420px!important;
    margin:0!important;border:0!important}
  body.is-bomi .stage-body{padding:0!important;overflow:hidden!important;height:100%!important}
  body.is-bomi .panel-bomi{position:absolute!important;inset:0!important;height:100%!important}
  body.is-bomi .bomi-frame{width:100%;height:100%}
}
