html{--rb-w88-hud-h:32px}
.rb-w88-hud{box-sizing:border-box;display:flex;align-items:center;justify-content:space-between;gap:8px;
 height:var(--rb-w88-hud-h);padding:0 10px;background:#0b131a;color:#ffe0a6;border-bottom:1px solid #3a4952;
 font:600 12px/1.15 system-ui,sans-serif;margin:0}
.rb-w88-chip{display:none;align-items:center;gap:2px;white-space:nowrap;color:#e4edf5;background:#233648;
 border:1px solid #526676;border-radius:20px;padding-left:9px}
.rb-w88-close{min-width:34px;min-height:34px;padding:0;border:0;margin:0;background:transparent;
 color:#e4edf5;font:700 20px/1 system-ui,sans-serif;cursor:pointer}
.rb-w88-close:focus-visible{outline:2px solid #82daf2;outline-offset:-3px;border-radius:50%}
html.rb-w88-four #rbW88Hud{position:fixed;top:var(--rbH,0px);left:0;right:0;z-index:50}
html.rb-w88-four #view,html.rb-w88-four #panel,html.rb-w88-four #hmi,
html.rb-w88-four #fgmap,html.rb-w88-four #wpAgent{top:var(--rb-w88-hud-h)!important}
html.rb-w88-four #tools{top:calc(var(--rb-w88-hud-h) + 8px)!important}
html.rb-w88-four #hud,html.rb-w88-four #brand{top:calc(var(--rb-w88-hud-h) + 12px)!important}
html.rb-w88-four #gauges,html.rb-w88-four #democtl{top:calc(var(--rb-w88-hud-h) + 6px)!important}
html.rb-w88-four body.rec #tools{top:auto!important}
html.rb-w88-four body.rec #rbW88Hud,html.rb-w88-whole body.rec #rbW88Hud{display:none}
html.rb-w88-four:has(body.rec){--rb-w88-hud-h:0px}
html #rbmNote,html .rbx-badge{display:none!important}
@media(max-width:768px){
 html{--rb-w88-hud-h:44px}
 .rb-w88-chip{display:inline-flex}
 html.rb-w88-four #tools{top:calc(var(--rb-w88-hud-h) + 4px)!important}
 html.rb-w88-four body:not(.rbm-plant) #tools{visibility:hidden}
 html.rb-w88-four.rbph-tabs #view{top:var(--rb-w88-hud-h)!important}
 html.rb-w88-four.rbph-tabs body.rbm-controls #panel,
 html.rb-w88-four.rbph-tabs body.rbm-hmi #hmi,
 html.rb-w88-four.rbph-tabs body.rbm-assistant #wpAgent{top:calc(var(--rbH,0px) + var(--rb-w88-hud-h))!important}
 html.rb-w88-whole body.plat header .wib-line{display:none}
 html.rb-w88-whole body.plat #rig{height:clamp(290px,calc(100dvh - 268px),690px)}
}

/* Keep tools inside the plant viewport, including separation's HMI view. */
@media(min-width:769px){
 html.rb-w88-separation #tools{right:calc(var(--panelw) + 10px);max-width:none;flex-wrap:wrap}
 html.rb-w88-separation #tools button{flex:0 0 auto;white-space:nowrap}
}
@media(max-width:768px){
 html.rb-w88-four #tools{box-sizing:border-box;flex-wrap:nowrap!important;overflow-x:auto;overflow-y:hidden;
  scroll-padding-inline:30px;scroll-snap-type:x proximity;overscroll-behavior-inline:contain;scrollbar-width:thin;padding-inline:30px}
 html.rb-w88-four #tools button{box-sizing:border-box;flex:none;width:max-content;min-width:44px;min-height:44px;
  max-width:none;white-space:nowrap;overflow:visible;text-overflow:clip;scroll-snap-align:start}
}

@media(max-width:768px){
 html.rb-w88-four #tools button.rb-w88-partial{opacity:0;pointer-events:none}
}

/* Reserve 28px at each inner edge for the cue, outside the visible buttons. */
.rb-w88-tools-cue{display:none}
@media(max-width:768px){
 .rb-w88-tools-cue:not([hidden]){display:block;position:fixed;z-index:4;pointer-events:none}
 .rb-w88-tools-cue::before{position:absolute;inset:0;display:grid;place-items:center;
  color:#e4edf5;font:700 20px/1 system-ui,sans-serif;text-shadow:0 1px 3px #000,0 0 3px #000}
 .rb-w88-tools-cue--left::before{content:'‹';background:linear-gradient(90deg,#0b131af5,transparent)}
 .rb-w88-tools-cue--right::before{content:'›';background:linear-gradient(90deg,transparent,#0b131af5)}
}

/* Actual 200% reflow widths, not only the unzoomed phone viewport. */
@media(max-width:240px){
 .rb-w88-hud{padding-inline:8px;gap:4px}
 .rb-w88-disclaimer{min-width:0;overflow-wrap:break-word}
 .rb-w88-chip{flex:none;padding:0;font-size:0}
 .rb-w88-close{display:block;min-width:34px;min-height:34px}
 html :is(.rbx-dock){left:6px!important;right:6px!important;max-width:none!important;display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr) 40px;align-items:stretch;gap:4px}
 html .rbx-dock button{box-sizing:border-box;min-width:0!important;min-height:40px!important;
  white-space:normal!important;padding:2px 3px!important;line-height:1.12;text-align:center}
 html.rb-w88-separation #rbmTabs button{min-width:0!important;min-height:44px;padding:0 1px;font-size:10px}
}

/* Whole-train's existing viewport-width overflow came from intrinsic grid minima. */
@media(max-width:760px){
 html.rb-w88-whole :is(.grid,.rack,.fps,.ovtg,.tsg,.ann,.esd){grid-template-columns:minmax(0,1fr)}
 html.rb-w88-whole :is(.blk,.fp,.gcard,.card,fieldset,#logw){min-width:0;overflow-wrap:anywhere}
 html.rb-w88-whole :is(#rigchips,#riginfo,#rigttl){min-width:0;overflow-wrap:anywhere}
 html.rb-w88-whole #rigttl #rigexp{height:auto;min-width:0;white-space:normal}
 html.rb-w88-whole body.plat #rig{height:clamp(290px,calc(100dvh - 324px),690px)}
 html.rb-w88-whole #rig #riginfo{max-height:calc(100% - 68px);max-height:min(55%,calc(100% - 68px));scrollbar-width:thin}
}

/* Use the rig’s own compact breakpoint for the camera strip and cue. */
@media(max-width:760px){
 html.rb-w88-whole body:not(.proc) #rig::after{content:none}
 html.rb-w88-whole body:not(.proc) #rig #rigchips{left:0;right:0;top:0;box-sizing:border-box;
  flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;padding:0 30px;gap:6px;
  scroll-padding-inline:30px;scroll-snap-type:none;overscroll-behavior-inline:contain;scrollbar-width:thin}
 html.rb-w88-whole body:not(.proc) #rig #rigchips button{flex:none;margin:0;
  min-width:44px;min-height:44px;white-space:nowrap;scroll-snap-align:start}
 #rigchips button.rb-w88-partial{opacity:0;pointer-events:none}
 .rb-w88-tools-cue[data-strip="rigchips"]:not([hidden]){z-index:6}
}
/* Desktop: reserve only the HUD height, retaining the live dock, log and inset. */
@media(min-width:761px){
 html.rb-w88-whole body.plat #rig{height:max(calc(440px - var(--rb-w88-hud-h)),calc(100vh - 250px - var(--rb-w88-hud-h)))}
}
/* At the end of the compact page, leave the log above the fixed button strip. */
@media(max-width:760px){
 html.rb-w88-whole.rbph-page:not(.rbph-guide) body{padding-bottom:calc(var(--rbF,0px) + var(--rbB,46px) + 26px)!important}
}
