/* ===== H5（手机 / 平板）适配：只在 h5-touch / h5-compact 下生效，PC 版式不变 =====
   舞台宽度改为变量（手机横屏按短边缩放并铺满长边，不留黑边）；--u 在缩小舞台上 = 屏幕 1px。 */
.stage{width:var(--stage-width,1920px)}
#apparatus{width:100%}
html,body{overscroll-behavior:none}
body{position:fixed;inset:0;-webkit-text-size-adjust:100%;text-size-adjust:100%}
html.h5-touch{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
html.h5-touch .stage{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
html.h5-touch #apparatus{touch-action:none;cursor:default}
html.h5-touch input,html.h5-touch select,html.h5-touch textarea{font-size:16px}
/* 底栏收起按钮仅手机显示 */
.bar-toggle{display:none}
#boot.boot-old span{max-width:30em;padding:0 24px;text-align:center;line-height:1.6;font-size:18px;color:#8a2a12}

/* ---------- 触控平板：按钮命中区 ≥40px ---------- */
html.h5-touch .round{width:calc(48 * var(--u));height:calc(48 * var(--u))}
html.h5-touch .site-views button{min-height:calc(40 * var(--u))}
html.h5-touch .panel-foot button{min-height:calc(42 * var(--u))}
html.h5-touch .panel-head .icon-btn{min-width:calc(44 * var(--u));min-height:calc(44 * var(--u))}
html.h5-touch #steps .group-tabs button{min-height:calc(40 * var(--u))}
html.h5-touch #steps .device-steps button{min-height:calc(44 * var(--u))}
html.h5-touch .panel-body{-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
html.h5-touch #steps .device-steps,html.h5-touch #steps .group-tabs{overscroll-behavior-x:contain}

/* ---------- 手机（短边 ≤540）：紧凑版式 ---------- */
html.h5-compact .stage{
  --m:calc(10 * var(--u));--sl:calc(env(safe-area-inset-left,0px) / var(--scale,1));--sr:calc(env(safe-area-inset-right,0px) / var(--scale,1));--sb:calc(env(safe-area-inset-bottom,0px) / var(--scale,1));
  --pw:min(calc(380 * var(--u)),calc(var(--stage-width,1920px) - 2 * var(--m)))}
/* 标题卡：保留徽章 + 标题 + 主句，去掉细节行和操作提示 */
html.h5-compact .scene-header{left:calc(var(--m) + var(--sl));top:var(--m)}
html.h5-compact .course-title-card{font-size:calc(12 * var(--u));padding:.5em .9em .55em}
html.h5-compact .scene-header h1{font-size:calc(24 * var(--u))!important;margin:.08em 0 0}
html.h5-compact .subtitle{font-size:calc(13 * var(--u))}
html.h5-compact .subtitle-detail,html.h5-compact .scene-hint{display:none}
html.h5-compact .header-meta{font-size:calc(11 * var(--u))}
html.h5-compact .site-views{gap:calc(6 * var(--u));margin-top:calc(6 * var(--u))}
html.h5-compact .site-views button{font-size:calc(14 * var(--u))!important;padding:0 calc(14 * var(--u));min-height:calc(40 * var(--u));border-radius:calc(20 * var(--u))}
/* 3D 标注缩小一档 */
html.h5-compact .labels{--floor:calc(12 * var(--u))}
html.h5-compact .scene-label.unit{font-size:calc(13 * var(--u))}
html.h5-compact .labels.overview .scene-label.unit{font-size:calc(12 * var(--u))}
html.h5-compact .scene-label{padding:calc(3 * var(--u)) calc(7 * var(--u));border-radius:calc(7 * var(--u))}
html.h5-compact .formula{font-size:calc(14 * var(--u))}
/* 底栏：一行工段 + 一行设备，横向滑动；可收起 */
html.h5-compact .stagebar{left:calc(var(--m) + var(--sl));bottom:calc(8 * var(--u) + var(--sb));gap:calc(6 * var(--u));align-items:flex-end}
html.h5-compact .stage.panel-collapsed .stagebar{right:calc(64 * var(--u) + 2 * var(--m) + var(--sr))}
html.h5-compact .stage .views#steps{padding:calc(5 * var(--u)) calc(10 * var(--u))!important;gap:calc(8 * var(--u))!important;border-radius:calc(16 * var(--u))!important;display:flex!important;width:auto;min-width:0;flex:0 1 auto}
html.h5-compact #steps .overview-btn{font-size:calc(16 * var(--u))!important;padding:0 calc(10 * var(--u))!important;min-height:calc(40 * var(--u))}
html.h5-compact #steps .process-nav{gap:calc(2 * var(--u))}
html.h5-compact #steps .group-tabs{gap:calc(12 * var(--u));padding-bottom:0;overflow-x:auto;scrollbar-width:none}
html.h5-compact #steps .group-tabs::-webkit-scrollbar,html.h5-compact #steps .device-steps::-webkit-scrollbar{display:none}
html.h5-compact #steps .group-tabs button{font-size:calc(15 * var(--u))!important;min-height:calc(36 * var(--u));padding:0 calc(3 * var(--u))!important;flex:none}
html.h5-compact #steps .device-steps{grid-template-rows:auto!important;gap:0 calc(6 * var(--u))!important;scrollbar-width:none}
html.h5-compact #steps .device-steps button{font-size:calc(16 * var(--u))!important;min-height:calc(40 * var(--u));padding:0 calc(8 * var(--u))!important;gap:calc(5 * var(--u))!important}
html.h5-compact #steps .device-steps i{font-size:calc(11 * var(--u))!important;min-width:calc(21 * var(--u))!important;height:calc(21 * var(--u))!important}
html.h5-compact .round{width:calc(40 * var(--u));height:calc(40 * var(--u));font-size:calc(22 * var(--u))}
html.h5-compact .bar-toggle{display:flex;flex:none;align-items:center;gap:calc(4 * var(--u));min-height:calc(40 * var(--u));min-width:calc(40 * var(--u));justify-content:center;padding:0 calc(10 * var(--u));
  border-radius:calc(20 * var(--u));border:1px solid rgba(255,255,255,.75);background:rgba(236,244,250,.94);color:#164a86;font-size:calc(14 * var(--u));font-weight:600;white-space:nowrap;box-shadow:0 calc(4 * var(--u)) calc(14 * var(--u)) rgba(18,48,90,.16)}
html.h5-compact .bar-toggle .bt-ic{font-size:calc(14 * var(--u))}
html.h5-bar-min .stage .stagebar .views#steps,html.h5-bar-min .stage .stagebar #prev,html.h5-bar-min .stage .stagebar #next{display:none!important}
/* 收起时只留一个「当前工序」胶囊，3D 视野完全空出 */
html.h5-bar-min .bar-toggle{background:rgba(16,32,51,.78);color:#fff;border-color:rgba(255,255,255,.35)}
/* 知识看板：默认收起，展开时作为右侧抽屉覆盖在 3D 上；正文字号回到 16px */
html.h5-compact .panel{--pf:1;right:calc(var(--m) + var(--sr));top:var(--m);bottom:calc(var(--m) + var(--sb));border-radius:calc(16 * var(--u));box-shadow:0 calc(8 * var(--u)) calc(30 * var(--u)) rgba(18,48,90,.28)}
html.h5-compact .panel-head{padding:calc(6 * var(--u)) calc(6 * var(--u)) calc(4 * var(--u)) calc(14 * var(--u))}
html.h5-compact .panel-title{font-size:calc(17 * var(--u))!important}
html.h5-compact .panel-step{font-size:calc(13 * var(--u))!important}
html.h5-compact .panel-body{padding:0 calc(14 * var(--u))}
html.h5-compact .live-chips small{font-size:calc(12 * var(--u))}
html.h5-compact .live-chips b,html.h5-compact #chip-a,html.h5-compact #chip-b,html.h5-compact #chip-c{font-size:calc(15 * var(--u))}
html.h5-compact .hstats b{font-size:calc(16 * var(--u))}
html.h5-compact .hstats small{font-size:calc(12 * var(--u))}
html.h5-compact .flow-legend{font-size:calc(14 * var(--u));gap:calc(8 * var(--u))}
html.h5-compact .run-dock{padding:calc(8 * var(--u)) calc(12 * var(--u)) 0}
html.h5-compact .run-btn{min-height:calc(46 * var(--u))!important;font-size:calc(17 * var(--u))!important}
html.h5-compact .auto-mini{font-size:calc(14 * var(--u))!important;min-height:calc(46 * var(--u))}
html.h5-compact .panel-foot{padding:calc(8 * var(--u)) calc(10 * var(--u)) calc(10 * var(--u))!important;gap:calc(5 * var(--u))!important}
html.h5-compact .panel-foot button{font-size:calc(13 * var(--u))!important;min-height:calc(40 * var(--u))}
html.h5-compact .panel-tab{right:calc(var(--sr));padding:calc(12 * var(--u)) calc(9 * var(--u));font-size:calc(14 * var(--u));border-radius:calc(14 * var(--u)) 0 0 calc(14 * var(--u));min-width:calc(42 * var(--u));letter-spacing:.12em}
html.h5-compact .panel-tab span{font-size:calc(16 * var(--u))}
html.h5-compact .run-fab{width:calc(58 * var(--u));height:calc(58 * var(--u));right:calc(var(--m) + var(--sr));bottom:calc(8 * var(--u) + var(--sb))}
html.h5-compact .run-fab .fab-ic{font-size:calc(20 * var(--u))}
html.h5-compact .run-fab .fab-t{font-size:calc(11 * var(--u))}
/* 手机竖屏（用户选择「继续竖屏」）：标题收窄，底栏占满宽 */
html.h5-compact.h5-portrait .scene-header{max-width:calc(100% - 2 * var(--m))}
html.h5-compact.h5-portrait .stage.panel-collapsed .stagebar{right:calc(74 * var(--u) + var(--m))}
/* 竖屏宽度不够：工序条单独占一行，翻页 / 收起按钮放到下一行 */
html.h5-compact.h5-portrait .stagebar{flex-wrap:wrap;row-gap:calc(6 * var(--u))}
html.h5-compact.h5-portrait .stage .stagebar .views#steps{order:-1;flex:1 1 100%}

/* ---------- 竖屏提示（触控设备竖持时） ---------- */
.rotate-tip{display:none;position:fixed;inset:0;z-index:120;align-items:center;justify-content:center;padding:24px;
  background:radial-gradient(90% 70% at 50% 35%,rgba(246,250,255,.97),rgba(214,228,240,.97));font-family:var(--font);color:#09235d;text-align:center}
html.h5-rotate .rotate-tip{display:flex}
.rt-card{display:flex;flex-direction:column;align-items:center;gap:14px;max-width:320px}
.rt-card b{font-size:22px;font-weight:800;letter-spacing:.04em}
.rt-card span{font-size:15px;line-height:1.6;color:#3d5a7a}
.rt-card button{margin-top:10px;min-height:44px;padding:0 22px;border-radius:22px;border:1px solid #9fc4ea;background:#fff;color:#0a63d8;font-size:16px;font-weight:600}
.rt-phone{width:56px;height:92px;border:4px solid #1479ef;border-radius:12px;position:relative;animation:rtTurn 2.4s ease-in-out infinite}
.rt-phone i{position:absolute;left:50%;bottom:6px;width:14px;height:4px;margin-left:-7px;border-radius:2px;background:#1479ef}
@keyframes rtTurn{0%,20%{transform:rotate(0)}50%,75%{transform:rotate(-90deg)}100%{transform:rotate(0)}}
@media (prefers-reduced-motion:reduce){.rt-phone{animation:none;transform:rotate(-90deg)}}
