/* v54 - Mobile UI */
:root{
  --mobile-panel-bg: color-mix(in srgb,var(--bd-panel) 96%,transparent);
  --mobile-border: color-mix(in srgb,var(--bd-border-soft) 58%,transparent);
  --mobile-safe-top: env(safe-area-inset-top, 0px);
  --mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (max-width: 860px), (pointer: coarse){
  html, body{
    overscroll-behavior:none;
    -webkit-tap-highlight-color:transparent;
  }

  #gameRoot{
    height:100dvh;
    width:100vw;
  }

  .hudTop{
    position:fixed !important;
    top:var(--mobile-safe-top) !important;
    left:6px !important;
    right:6px !important;
    padding:6px !important;
    gap:5px !important;
    border-radius:0 0 14px 14px;
    max-width:calc(100vw - 12px) !important;
    overflow-x:auto !important;
    overflow-y:hidden !important;
    scrollbar-width:none;
    z-index:var(--rrm-z-hud) !important;
  }
  .hudTop::-webkit-scrollbar{display:none;}

  .iconPill{
    min-width:44px !important;
    height:34px !important;
    padding:5px 7px !important;
    font-size:12px !important;
    flex:0 0 auto;
  }
  .iconPill .ico{font-size:16px !important;}
  .iconPill .num{font-size:12px !important;}

  button:not(#startScreen button):not([data-ui-sprite="button_close"]),
  .iconOnly:not(#startScreen .iconOnly):not([data-ui-sprite="button_close"]){
    min-width:46px !important;
    min-height:46px !important;
    border-radius:14px !important;
    font-size:18px !important;
    touch-action:manipulation !important;
  }

  #pauseBtn,
  #speedBtn{
    min-width:46px !important;
    height:34px !important;
    min-height:34px !important;
    font-size:14px !important;
  }

  .hudBottom{
    position:fixed !important;
    left:6px !important;
    right:6px !important;
    bottom:calc(6px + var(--mobile-safe-bottom)) !important;
    padding:6px !important;
    border-radius:18px !important;
    background:linear-gradient(to top, color-mix(in srgb,var(--bd-panel) 98%,transparent), color-mix(in srgb,var(--bd-panel) 76%,transparent)) !important;
    border:1px solid var(--mobile-border);
    box-shadow:0 12px 30px rgba(0,0,0,.42);
    z-index:var(--rrm-z-hud) !important;
  }

  .hudBottom .buttons{
    width:100% !important;
    display:grid !important;
    grid-template-columns:repeat(7, minmax(42px, 1fr));
    gap:5px !important;
    overflow:visible !important;
  }

  .hudBottom .buttons .iconOnly{
    width:100% !important;
    height:46px !important;
    padding:0 !important;
  }

  .hudBottom .help{display:none !important;}

  .hudBottom .gameVersionLabel{
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    min-width:44px !important;
    height:28px !important;
    margin-left:4px !important;
    padding:3px 7px !important;
    border-radius:999px !important;
    background:rgba(250,204,21,.18) !important;
    border:1px solid rgba(250,204,21,.48) !important;
    color:var(--bd-title) !important;
    font-size:11px !important;
    font-weight:800 !important;
    white-space:nowrap !important;
    flex:0 0 auto !important;
  }


  /* Mantém na barra apenas ações frequentes; o resto vai para o menu móvel. */
  body.mobile-ui #balanceBtn,
  body.mobile-ui #eventsBtn,
  body.mobile-ui #storyBtn,
  body.mobile-ui #visitorsBtn,
  body.mobile-ui #debugBtn{
    display:none !important;
  }

  .buildMenu,
  .panel,
  .sidePanel,
  .objectPopup,
  #stockPanel,
  #craftPanel,
  #schedulePopup,
  #balancePanel,
  #productionPanel,
  #researchPanel,
  #eventsPanel,
  #storyPanel,
  #savePanel,
  #visitorsPanel,
  #farmPanel,
  #debugPanel{









    border-radius:18px !important;
    z-index:var(--rrm-z-modal) !important;
    background:var(--mobile-panel-bg) !important;
  }

  .sidePanel.open{
    display:block !important;
  }

  .workPanel,
  #workPanel{








    z-index:var(--rrm-z-modal) !important;
    border-radius:18px !important;
  }

  #workPanel table,
  .workPanel table{
    min-width:720px !important;
    font-size:12px !important;
  }

  #workPanel th,
  #workPanel td,
  .workPanel th,
  .workPanel td{
    padding:8px 7px !important;
  }

  .buildOptions{
    display:grid !important;
    grid-template-columns:repeat(4, minmax(48px, 1fr));
    gap:7px !important;
  }

  .buildOptions .iconOnly,
  .buildOptions > button{
    width:100% !important;
    height:48px !important;
  }

  .panelTabs button{
    min-height:42px !important;
  }

  .statRow,
  .objectInfoLine{
    font-size:13px !important;
    padding:7px 0 !important;
  }

  input[type=checkbox]{
    width:22px !important;
    height:22px !important;
  }

  select,
  input{
    min-height:42px !important;
    font-size:16px !important;
  }

  .eventAlert{






    z-index:var(--rrm-z-critical-alert) !important;
    border-radius:18px !important;
  }
}

.mobileMenuBtn{
  position:fixed;
  right:10px;
  bottom:calc(68px + var(--mobile-safe-bottom));
  z-index:var(--rrm-z-hud);
  width:52px;
  height:52px;
  border-radius:18px;
  background:color-mix(in srgb,var(--bd-surface) 97%,transparent);
  border:1px solid color-mix(in srgb,var(--bd-border-soft) 70%,transparent);
  box-shadow:0 10px 25px rgba(0,0,0,.35);
}

.mobileDrawer{
  position:fixed;
  left:8px;
  right:8px;
  bottom:calc(126px + var(--mobile-safe-bottom));
  z-index:var(--rrm-z-drawer);
  display:none;
  padding:10px;
  border-radius:20px;
  background:color-mix(in srgb,var(--bd-panel) 98%,transparent);
  border:1px solid color-mix(in srgb,var(--bd-border-soft) 64%,transparent);
  box-shadow:0 18px 50px rgba(0,0,0,.46);
  backdrop-filter:blur(8px);
}
.mobileDrawer.open{display:block;}
.mobileDrawerTitle{
  font-weight:700;
  font-size:13px;
  margin:0 0 8px 2px;
  opacity:.9;
}
.mobileDrawerGrid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(148px, 1fr));
  gap:7px;
}
.mobileDrawerGrid button{
  width:100%;
  min-height:54px;
  padding:6px 9px;
  font-size:16px;
  display:flex;
  flex-direction:row;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  text-align:right;
}
.mobileDrawerGrid small{
  display:block;
  font-size:9px;
  flex:1 1 auto;
  min-width:0;
  opacity:.78;
  line-height:1.1;
  text-align:right;
  white-space:normal;
  overflow-wrap:anywhere;
}

@media (min-width: 861px) and (pointer: fine){
  .mobileMenuBtn,
  .mobileDrawer{display:none !important;}
}

.popupCloseX{
  position:absolute;
  top:8px;
  right:8px;
  width:34px;
  height:34px;
  z-index:var(--rrm-z-tooltip);
  border-radius:10px;
  border:1px solid rgba(255,255,255,.25);
  background:rgba(20,24,28,.92);
  color:#fff;
  font-size:22px;
  line-height:28px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.popupCloseX:active{ transform:scale(.96); }
.buildMenu h3,.panel h3{ padding-right:42px; }
@media (max-width: 720px){
  .popupCloseX{ width:40px;height:40px;font-size:25px; }
  .buildMenu,.panel,.objectPopup,.sidePanel{ }
}

/* v60 - full screen mobile refinements */
@media (max-width: 860px), (pointer: coarse){
  .hudTop .widePill{font-size:12px;}
  #fullscreenBtn{min-width:44px;}
  body.fullscreen-active{overscroll-behavior:none;touch-action:auto;}
  body.fullscreen-active canvas{touch-action:none;}
}

/* v62 override: do not hide bottom menu in fullscreen; buttons 10% smaller */
@media (max-width: 860px), (pointer: coarse){
  .hudBottom{display:flex!important;visibility:visible!important;opacity:1!important;}
  body.fullscreen-active .hudBottom{display:flex!important;visibility:visible!important;opacity:1!important;bottom:calc(6px + env(safe-area-inset-bottom,0px))!important;z-index:var(--rrm-z-hud)!important;}
  button:not(#startScreen button):not([data-bd-quantity-delta]):not([data-bd-quantity-bound]):not([data-bd-kbd-char]):not([data-bd-kbd-action]):not([data-bd-kbd-layout]):not([data-ui-sprite="button_close"]),.iconOnly:not(#startScreen .iconOnly):not([data-ui-sprite="button_close"]){min-width:41px!important;min-height:41px!important;font-size:16px!important;}
  #pauseBtn,#speedBtn,#saveBtn,#fullscreenBtn,#zoomIn,#zoomOut{min-width:34px!important;min-height:31px!important;height:31px!important;font-size:12px!important;}
}

/* v69 - mobile final override: square icon buttons */
:root{
  --ui-square-btn-mobile:36px;
}
@media (max-width: 860px), (pointer: coarse){
  .iconOnly,
  .hudTop.compactHudTop .iconOnly,
  .hudBottom .buttons .iconOnly,
  .panel .iconOnly,
  .buildMenu .iconOnly,
  .objectPopup .iconOnly,
  .sidePanel .iconOnly,
  .workPanel .iconOnly,
  #workPanel .iconOnly,
  #stockPanel .iconOnly,
  #craftPanel .iconOnly,
  #farmPanel .iconOnly,
  #productionPanel .iconOnly,
  #researchPanel .iconOnly,
  #eventsPanel .iconOnly,
  #storyPanel .iconOnly,
  #savePanel .iconOnly,
  #visitorsPanel .iconOnly,
  #debugPanel .iconOnly,
  #pauseBtn,#speedBtn,#saveBtn,#fullscreenBtn,#zoomIn,#zoomOut,#infoBtn{
    width:var(--ui-square-btn-mobile)!important;
    height:var(--ui-square-btn-mobile)!important;
    min-width:var(--ui-square-btn-mobile)!important;
    min-height:var(--ui-square-btn-mobile)!important;
    max-width:var(--ui-square-btn-mobile)!important;
    max-height:var(--ui-square-btn-mobile)!important;
    padding:0!important;
    flex:0 0 var(--ui-square-btn-mobile)!important;
    aspect-ratio:1/1!important;
    border-radius:10px!important;
    font-size:14px!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    line-height:1!important;
  }

  .hudBottom .buttons{
    display:flex!important;
    grid-template-columns:none!important;
    justify-content:flex-start!important;
    overflow-x:auto!important;
    gap:5px!important;
  }

  .buildOptions .iconOnly,
  .buildOptions button.iconOnly{
    width:var(--ui-square-btn-mobile)!important;
    height:var(--ui-square-btn-mobile)!important;
  }

  ,
  .titleBtn,.startBtn,.recipeButton,.objectActionRow button,.eventAlertActions button,.panelTabs button,.mobileDrawerGrid button{
    font-size:10px!important;
    line-height:1.15!important;
  }

  select,input,textarea,label,.panel,.buildMenu,.objectPopup,.sidePanel,.workPanel,table,th,td,.statRow,.objectInfoLine,.recipeButton,.logLine{
    font-size:10px!important;
  }
}


/* v72 bottom hidden on title/setup */
body:not(.game-active) .hudBottom{display:none!important;visibility:hidden!important;opacity:0!important;pointer-events:none!important;}


/* v74: remove botão flutuante; tudo fica na barra inferior */
.mobileMenuBtn,.mobileDrawer{display:none!important;visibility:hidden!important;pointer-events:none!important;}
#workPanel .wpTableWrap{overflow-y:auto!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch!important;touch-action:pan-x pan-y!important;}


/* v134 UI fix - save only in topbar; research remains visible in bottombar */
#saveBottomBtn{display:none!important;}
body.mobile-ui #researchBtn{display:inline-flex!important;}
@media(max-width:860px), (pointer:coarse){
  body.mobile-ui .hudBottom .buttons{
    display:flex!important;
    flex-wrap:nowrap!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    -webkit-overflow-scrolling:touch!important;
  }
  body.mobile-ui .hudBottom .buttons .iconOnly{
    flex:0 0 42px!important;
    width:42px!important;
    min-width:42px!important;
  }
}


/* P1.4 mobile version label fix */
@media (max-width: 860px), (pointer: coarse){
  .hudBottom{display:flex!important;align-items:center!important;gap:6px!important;}
  .hudBottom .buttons{width:auto!important;flex:1 1 auto!important;min-width:0!important;}
  .hudBottom .gameVersionLabel{display:flex!important;}
  .mobileVersionLabel{
    display:flex!important;
    position:fixed!important;
    right:10px!important;
    bottom:calc(68px + var(--mobile-safe-bottom, env(safe-area-inset-bottom, 0px)))!important;
    z-index:var(--rrm-z-tooltip)!important;
    align-items:center!important;
    justify-content:center!important;
    min-width:44px!important;
    height:26px!important;
    padding:3px 8px!important;
    border-radius:999px!important;
    background:color-mix(in srgb,var(--bd-panel) 92%,transparent)!important;
    border:1px solid rgba(250,204,21,.55)!important;
    color:var(--bd-title)!important;
    font-size:11px!important;
    font-weight:900!important;
    box-shadow:0 8px 20px rgba(0,0,0,.35)!important;
    pointer-events:none!important;
  }
}


/* P1.4 - version label locked inside bottombar on desktop and mobile */
.hudBottom #gameVersionLabel.gameVersionLabel{
  display:flex!important;
  flex:0 0 auto!important;
  align-items:center!important;
  justify-content:center!important;
  align-self:center!important;
  min-width:42px!important;
  height:28px!important;
  margin-left:6px!important;
  padding:3px 8px!important;
  border-radius:999px!important;
  background:rgba(250,204,21,.18)!important;
  border:1px solid rgba(250,204,21,.55)!important;
  color:var(--bd-title)!important;
  font-size:11px!important;
  line-height:1!important;
  font-weight:900!important;
  letter-spacing:.02em!important;
  white-space:nowrap!important;
  position:static!important;
  right:auto!important;
  bottom:auto!important;
  z-index:auto!important;
}
@media (max-width:860px), (pointer:coarse){
  .hudBottom{align-items:center!important;}
  .hudBottom .buttons{flex:1 1 auto!important;min-width:0!important;}
  .hudBottom #gameVersionLabel.gameVersionLabel{
    display:flex!important;
    min-width:38px!important;
    height:24px!important;
    margin-left:4px!important;
    padding:2px 6px!important;
    font-size:10px!important;
    position:static!important;
  }
  #gameVersionLabelMobile{display:none!important;}
}

/* P1.5 - animal care panel mobile */
.animalBarP15{height:8px;border-radius:999px;background:color-mix(in srgb,var(--bd-panel) 65%,transparent);border:1px solid color-mix(in srgb,var(--bd-border-soft) 50%,transparent);overflow:hidden;margin:4px 0 8px 0}
.animalBarP15>div{height:100%;border-radius:999px;background:linear-gradient(90deg,var(--bd-danger),var(--bd-warning),var(--bd-success))}

/* P2.5 - Popup compacto mobile */
#objectPopup .compactInfoGridP25{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin:4px 0 8px 0;}
#objectPopup .objectInfoLine{display:flex;justify-content:space-between;align-items:flex-start;gap:8px;min-width:0;padding:5px 7px;border:1px solid color-mix(in srgb,var(--bd-border-soft) 34%,transparent);background:color-mix(in srgb,var(--bd-panel) 30%,transparent);border-radius:8px;box-sizing:border-box;}
#objectPopup .objectInfoLine span:first-child{flex:1 1 0;min-width:0;opacity:.76;white-space:normal;overflow-wrap:anywhere;line-height:1.25;}
#objectPopup .objectInfoLine span:last-child{flex:1 1 0;min-width:0;text-align:right;overflow:visible;text-overflow:clip;white-space:normal;overflow-wrap:anywhere;line-height:1.25;}
#objectPopupBody > .objectInfoLine{width:calc(50% - 3px);display:inline-flex;margin:0 3px 6px 0;vertical-align:top;}
#objectPopup .animalBarP15,#objectPopup .objectActionRow{clear:both;}
#objectPopup .compactButtonsP25{display:flex;flex-wrap:wrap;gap:6px;}
#objectPopup .compactButtonsP25 button{flex:1 1 calc(50% - 6px);min-width:112px;}
@media (max-width:420px){#objectPopup .compactInfoGridP25{grid-template-columns:1fr;}#objectPopupBody > .objectInfoLine{width:100%;display:flex;margin-right:0;}#objectPopup .compactButtonsP25 button{flex-basis:100%;}}

/* v271 - clareza dos popups mobile */
.popupQuickGridP271,.popupDetailsGridP271{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin:4px 0 8px 0;}
.popupQuickGridP271 .objectInfoLine{min-height:42px;align-items:flex-start!important;flex-direction:column;justify-content:center!important;gap:2px!important;background:color-mix(in srgb,var(--bd-surface) 58%,transparent)!important;}
.popupDisclosureP271{clear:both;border:1px solid color-mix(in srgb,var(--bd-border-soft) 42%,transparent);background:color-mix(in srgb,var(--bd-panel) 30%,transparent);border-radius:8px;margin:7px 0;overflow:hidden;}
.popupDisclosureP271 summary{cursor:pointer;list-style:none;padding:8px 9px;color:var(--bd-title);font-size:12px;font-weight:900;}
.popupDisclosureBodyP271{padding:0 8px 8px 8px;}
@media (max-width:420px){.popupQuickGridP271,.popupDetailsGridP271{grid-template-columns:1fr;}}

/* v276 - mobile panel scroll polish */
@media (max-width:860px), (pointer:coarse){
  :root{
    --ui-mobile-panel-max:calc(var(--app-height, 100dvh) - var(--topbar-height, 44px) - var(--bottombar-height, 58px) - var(--safe-top, 0px) - var(--safe-bottom, 0px) - 32px);
  }

  .buildMenu,
  .panel,
  .sidePanel,
  .objectPopup,
  #stockPanel,
  #craftPanel,
  #schedulePopup,
  #balancePanel,
  #productionPanel,
  #researchPanel,
  #eventsPanel,
  #storyPanel,
  #savePanel,
  #visitorsPanel,
  #farmPanel,
  #debugPanel{





    border-radius:12px!important;





    scrollbar-width:thin!important;
  }

  .buildMenu,
  .objectPopup,
  #workPanel{

  }

  .panel:not(#workPanel),
  #sidePanel{

  }

  #sidePanel.sidePanel,
  #sidePanel.sidePanel.open{




    padding:0!important;
  }

  #sidePanel .sidePanelHeader{
    padding:9px 10px!important;
    margin:0!important;
  }

  #sidePanel .panelTabs{
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:6px!important;
    padding:7px 10px!important;
    margin:0!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    scrollbar-width:none!important;
  }

  #sidePanel .panelTabs button{
    flex:0 0 auto!important;
    min-width:70px!important;
    min-height:36px!important;
  }

  #sidePanel #panelContent{
    padding:9px!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch!important;
  }

  #objectPopup.objectPopup{





  }

  #objectPopup.objectPopupOpenV276{
    display:flex!important;
    flex-direction:column!important;
    padding:0!important;
  }

  #objectPopup.objectPopupOpenV276 .objectPopupHeader{
    margin:0!important;
    padding:9px 10px!important;
  }

  #objectPopup.objectPopupOpenV276 #objectPopupBody{
    flex:1 1 auto!important;
    min-height:0!important;
    padding:9px 9px 12px 9px!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch!important;
  }

  #workPanel{

  }

  #workPanel .wpTableWrap{
    max-height:calc(min(70dvh, var(--ui-mobile-panel-max)) - 86px)!important;
    overflow-y:auto!important;
    overflow-x:auto!important;
    -webkit-overflow-scrolling:touch!important;
  }

  .panelSection,
  .researchCard,
  .eventCard,
  .visitorCard{
    margin:5px 0!important;
    padding:7px!important;
  }

  .objectActionRow,
  .compactButtonsP25{
    gap:5px!important;
  }

  .objectActionRow button,
  .compactButtonsP25 button,
  .recipeButton{
    min-height:34px!important;
  }
}

/* P3.10 - Mobile Popup Native Sheet Final Override
   Importante: este arquivo carrega depois de style.css, então as regras críticas ficam aqui. */
#rrmPopupBackdropP310{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.22);
  z-index:var(--rrm-z-modal-backdrop);
  pointer-events:auto;
}

@media (max-width:760px), (pointer:coarse) and (max-width:920px){
  body.rrmPopupOpenP310{
    overflow:hidden!important;
    overscroll-behavior:none!important;
  }

  .rrmMobileSheetP310[style*="display: none"],
  #objectPopup.rrmMobileSheetP310[style*="display: none"],
  #sidePanel.rrmMobileSheetP310[style*="display: none"],
  #workPanel.rrmMobileSheetP310[style*="display: none"]{
    display:none!important;
    pointer-events:none!important;
  }

  .rrmMobileSheetP310,
  #objectPopup.rrmMobileSheetP310,
  #sidePanel.rrmMobileSheetP310,
  #workPanel.rrmMobileSheetP310,
  #buildMenu.rrmMobileSheetP310,
  #stockPanel.rrmMobileSheetP310,
  #craftPanel.rrmMobileSheetP310,
  #researchPanel.rrmMobileSheetP310,
  #eventsPanel.rrmMobileSheetP310,
  #storyPanel.rrmMobileSheetP310,
  #savePanel.rrmMobileSheetP310,
  #visitorsPanel.rrmMobileSheetP310,
  #farmPanel.rrmMobileSheetP310,
  #balancePanel.rrmMobileSheetP310,
  #productionPanel.rrmMobileSheetP310,
  #debugPanel.rrmMobileSheetP310,
  #schedulePopup.rrmMobileSheetP310{
    position:fixed!important;
    left:0!important;
    right:0!important;
    top:auto!important;
    bottom:0!important;
    width:100vw!important;
    min-width:0!important;
    max-width:100vw!important;
    height:min(82dvh, calc(var(--app-height, 100dvh) - var(--safe-top, 0px) - 18px))!important;
    max-height:min(82dvh, calc(var(--app-height, 100dvh) - var(--safe-top, 0px) - 18px))!important;
    margin:0!important;
    border-radius:18px 18px 0 0!important;
    box-sizing:border-box!important;
    padding:6px max(10px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left))!important;
    z-index:var(--rrm-z-modal)!important;
    pointer-events:auto!important;
    overflow:hidden!important;
    overscroll-behavior:contain!important;
    touch-action:auto!important;
    -webkit-overflow-scrolling:touch!important;
  }

  #objectPopup.rrmMobileSheetP310,
  #sidePanel.rrmMobileSheetP310,
  #workPanel.rrmMobileSheetP310,
  .rrmMobileSheetP310{
    display:flex!important;
    flex-direction:column!important;
  }

  .rrmSheetGripP310{
    flex:0 0 auto!important;
    width:42px!important;
    height:4px!important;
    border-radius:999px!important;
    background:rgba(255,255,255,.28)!important;
    margin:0 auto 5px!important;
    pointer-events:none!important;
  }

  .rrmMobileSheetP310 .objectPopupHeader,
  .rrmMobileSheetP310 .sidePanelHeader,
  .rrmMobileSheetP310 .wpHeader{
    position:relative!important;
    top:auto!important;
    z-index:3!important;
    flex:0 0 auto!important;
    min-height:0!important;
    max-height:none!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:8px!important;
    padding:2px 0 6px!important;
    margin:0 0 4px!important;
    background:inherit!important;
  }

  .rrmMobileSheetP310 h1,
  .rrmMobileSheetP310 h2,
  .rrmMobileSheetP310 h3,
  .rrmMobileSheetP310 h4,
  .rrmMobileSheetP310 #objectPopupTitle,
  .rrmMobileSheetP310 .wpHeader h3,
  .rrmMobileSheetP310 .sidePanelHeader h3{
    min-height:0!important;
    max-height:none!important;
    height:auto!important;
    display:block!important;
    padding:0!important;
    margin:0 0 6px!important;
    font-size:16px!important;
    line-height:1.18!important;
    white-space:normal!important;
  }

  .rrmMobileSheetP310 #objectPopupTitle,
  .rrmMobileSheetP310 .wpHeader h3,
  .rrmMobileSheetP310 .sidePanelHeader h3{
    margin:0!important;
    flex:1 1 auto!important;
  }

  .rrmMobileSheetP310 #objectPopupBody,
  .rrmMobileSheetP310 #panelContent,
  .rrmMobileSheetP310 .wpTableWrap,
  .rrmMobileSheetP310 .rrmMobileScrollP310,
  .rrmMobileSheetP310 .stockRulesBody,
  .rrmMobileSheetP310 .tradeStockpileBodyP35,
  .rrmMobileSheetP310 .tradePostBodyP35,
  .rrmMobileSheetP310 .scrollablePopup,
  .rrmMobileSheetP310 .panelContent{
    flex:1 1 auto!important;
    min-height:0!important;
    max-height:none!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch!important;
    overscroll-behavior:contain!important;
    touch-action:pan-y!important;
    padding-bottom:18px!important;
    pointer-events:auto!important;
  }

  #workPanel.rrmMobileSheetP310 .wpTableWrap{
    overflow-x:auto!important;
    overflow-y:auto!important;
    touch-action:pan-x pan-y!important;
  }

  .rrmMobileSheetP310 button,
  .rrmMobileSheetP310 a,
  .rrmMobileSheetP310 input,
  .rrmMobileSheetP310 select,
  .rrmMobileSheetP310 textarea,
  .rrmMobileSheetP310 label,
  .rrmMobileSheetP310 [role="button"],
  .rrmMobileSheetP310 [onclick],
  .rrmMobileSheetP310 [data-action],
  .rrmMobileSheetP310 [tabindex],
  .rrmMobileSheetP310 .wpPrioBox,
  .rrmMobileSheetP310 .iconOnly,
  .rrmMobileSheetP310 .popupCloseX,
  .rrmMobileSheetP310 .tradeActionBtnP35,
  .rrmMobileSheetP310 .tradeItemCardP35,
  .rrmMobileSheetP310 .tradeAnimalCardP35,
  .rrmMobileSheetP310 .objectActionRow,
  .rrmMobileSheetP310 .objectActions,
  .rrmMobileSheetP310 .recipeButton,
  .rrmMobileSheetP310 summary{
    pointer-events:auto!important;
    touch-action:manipulation!important;
  }

  .rrmMobileSheetP310 button:not(.iconOnly):not(.wpPrioBox),
  .rrmMobileSheetP310 input,
  .rrmMobileSheetP310 select,
  .rrmMobileSheetP310 textarea,
  .rrmMobileSheetP310 .objectActionRow button,
  .rrmMobileSheetP310 .tradeActionBtnP35{
    min-height:40px!important;
    font-size:15px!important;
    border-radius:11px!important;
  }

  .rrmMobileSheetP310 .iconOnly,
  .rrmMobileSheetP310 .popupCloseX,
  .rrmMobileSheetP310 #objectPopupClose,
  .rrmMobileSheetP310 #sideCloseBtn,
  .rrmMobileSheetP310 #wpClose{
    min-width:38px!important;
    min-height:38px!important;
    width:38px!important;
    height:38px!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    border-radius:11px!important;
    flex:0 0 auto!important;
    z-index:5!important;
  }

  .rrmMobileSheetP310 input,
  .rrmMobileSheetP310 select,
  .rrmMobileSheetP310 textarea{
    -webkit-user-select:text!important;
    user-select:text!important;
  }
}


/* P3.11 - Mobile Popup Safe Mode
   Reverte o bottom sheet agressivo e prioriza interacao dos controles. */
#rrmPopupBackdropP38,
#rrmPopupBackdropP310{
  display:none!important;
  pointer-events:none!important;
  visibility:hidden!important;
}

body.rrmPopupOpenP38,
body.rrmPopupOpenP310{
  overflow:auto!important;
  overscroll-behavior:auto!important;
}

@media (max-width:760px), (pointer:coarse) and (max-width:920px){
  .rrmMobileSheetP38,
  .rrmMobileSheetP310{
    display:revert!important;
    flex-direction:revert!important;
  }

  .rrmMobilePopupSafeP311,
  #objectPopup.rrmMobilePopupSafeP311,
  #sidePanel.rrmMobilePopupSafeP311,
  #workPanel.rrmMobilePopupSafeP311,
  #stockPanel.rrmMobilePopupSafeP311,
  #buildMenu.rrmMobilePopupSafeP311,
  #craftPanel.rrmMobilePopupSafeP311,
  #researchPanel.rrmMobilePopupSafeP311,
  #eventsPanel.rrmMobilePopupSafeP311,
  #storyPanel.rrmMobilePopupSafeP311,
  #savePanel.rrmMobilePopupSafeP311,
  #visitorsPanel.rrmMobilePopupSafeP311,
  #farmPanel.rrmMobilePopupSafeP311,
  #balancePanel.rrmMobilePopupSafeP311,
  #productionPanel.rrmMobilePopupSafeP311,
  #debugPanel.rrmMobilePopupSafeP311,
  #schedulePopup.rrmMobilePopupSafeP311{
    pointer-events:auto!important;
    touch-action:auto!important;
  }

  .rrmMobilePopupSafeP311 #objectPopupBody,
  .rrmMobilePopupSafeP311 #panelContent,
  .rrmMobilePopupSafeP311 .wpTableWrap,
  .rrmMobilePopupSafeP311 .rrmMobileScrollP311,
  .rrmMobilePopupSafeP311 .stockRulesBody,
  .rrmMobilePopupSafeP311 .tradeStockpileBodyP35,
  .rrmMobilePopupSafeP311 .tradePostBodyP35,
  .rrmMobilePopupSafeP311 .scrollablePopup,
  .rrmMobilePopupSafeP311 .panelContent{
    overflow-y:auto!important;
    -webkit-overflow-scrolling:touch!important;
    overscroll-behavior:contain!important;
    touch-action:pan-y!important;
    pointer-events:auto!important;
  }

  #workPanel.rrmMobilePopupSafeP311 .wpTableWrap{
    overflow-x:auto!important;
    overflow-y:auto!important;
    touch-action:pan-x pan-y!important;
  }

  .rrmMobilePopupSafeP311 button,
  .rrmMobilePopupSafeP311 a,
  .rrmMobilePopupSafeP311 input,
  .rrmMobilePopupSafeP311 select,
  .rrmMobilePopupSafeP311 textarea,
  .rrmMobilePopupSafeP311 label,
  .rrmMobilePopupSafeP311 [role="button"],
  .rrmMobilePopupSafeP311 [onclick],
  .rrmMobilePopupSafeP311 [data-action],
  .rrmMobilePopupSafeP311 [tabindex],
  .rrmMobilePopupSafeP311 .wpPrioBox,
  .rrmMobilePopupSafeP311 summary{
    pointer-events:auto!important;
    touch-action:manipulation!important;
  }

  .rrmMobilePopupSafeP311 input,
  .rrmMobilePopupSafeP311 select,
  .rrmMobilePopupSafeP311 textarea{
    touch-action:auto!important;
    -webkit-user-select:text!important;
    user-select:text!important;
  }
}

/* P3.12 - Mobile Popup Scroll Assist
   Scroll melhorado sem listener global e sem capture:true.
   Controles continuam recebendo toque nativo. */
@media (max-width:760px), (pointer:coarse) and (max-width:920px){
  .rrmMobilePopupScrollAssistP312{
    pointer-events:auto!important;
    touch-action:auto!important;
    overscroll-behavior:contain!important;
    -webkit-overflow-scrolling:touch!important;
    max-height:calc(var(--app-height, 100dvh) - var(--topbar-height, 44px) - var(--bottombar-height, 58px) - var(--safe-top, 0px) - var(--safe-bottom, 0px) - 24px)!important;
    box-sizing:border-box!important;
  }

  #objectPopup.rrmMobilePopupScrollAssistP312,
  #sidePanel.rrmMobilePopupScrollAssistP312,
  #workPanel.rrmMobilePopupScrollAssistP312{
  }

  #buildMenu.rrmMobilePopupScrollAssistP312,
  #productionPanel.rrmMobilePopupScrollAssistP312,
  #balancePanel.rrmMobilePopupScrollAssistP312,
  #stockPanel.rrmMobilePopupScrollAssistP312,
  #craftPanel.rrmMobilePopupScrollAssistP312,
  #researchPanel.rrmMobilePopupScrollAssistP312,
  #eventsPanel.rrmMobilePopupScrollAssistP312,
  #storyPanel.rrmMobilePopupScrollAssistP312,
  #savePanel.rrmMobilePopupScrollAssistP312,
  #visitorsPanel.rrmMobilePopupScrollAssistP312,
  #farmPanel.rrmMobilePopupScrollAssistP312,
  #schedulePopup.rrmMobilePopupScrollAssistP312,
  #debugPanel.rrmMobilePopupScrollAssistP312{




  }

  .rrmMobilePopupScrollAssistP312 #objectPopupBody,
  .rrmMobilePopupScrollAssistP312 #panelContent,
  .rrmMobilePopupScrollAssistP312 .wpTableWrap,
  .rrmMobilePopupScrollAssistP312 .rrmMobileScrollP312,
  .rrmMobilePopupScrollAssistP312 .stockRulesBody,
  .rrmMobilePopupScrollAssistP312 .tradeStockpileBodyP35,
  .rrmMobilePopupScrollAssistP312 .tradePostBodyP35,
  .rrmMobilePopupScrollAssistP312 .scrollablePopup,
  .rrmMobilePopupScrollAssistP312 .panelContent,
  .rrmMobilePopupScrollAssistP312 .popupBody,
  .rrmMobilePopupScrollAssistP312 .popupContent,
  .rrmMobilePopupScrollAssistP312 .sidePanelContent,
  .rrmMobilePopupScrollAssistP312 .settingsBody,
  .rrmMobilePopupScrollAssistP312 .listBody{
    min-height:0!important;
    max-height:calc(var(--app-height, 100dvh) - var(--topbar-height, 44px) - var(--bottombar-height, 58px) - var(--safe-top, 0px) - var(--safe-bottom, 0px) - 112px)!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    touch-action:pan-y!important;
    overscroll-behavior:contain!important;
    -webkit-overflow-scrolling:touch!important;
    padding-bottom:18px!important;
  }

  #workPanel.rrmMobilePopupScrollAssistP312 .wpTableWrap{
    overflow-x:auto!important;
    overflow-y:auto!important;
    touch-action:pan-x pan-y!important;
    max-height:calc(var(--app-height, 100dvh) - var(--topbar-height, 44px) - var(--bottombar-height, 58px) - var(--safe-top, 0px) - var(--safe-bottom, 0px) - 132px)!important;
  }

  .rrmMobilePopupScrollAssistP312 .objectPopupHeader,
  .rrmMobilePopupScrollAssistP312 .sidePanelHeader,
  .rrmMobilePopupScrollAssistP312 .wpHeader{
    min-height:0!important;
    max-height:none!important;
    height:auto!important;
    padding:2px 0 6px!important;
    margin:0 0 4px!important;
    flex:0 0 auto!important;
  }

  .rrmMobilePopupScrollAssistP312 h1,
  .rrmMobilePopupScrollAssistP312 h2,
  .rrmMobilePopupScrollAssistP312 h3,
  .rrmMobilePopupScrollAssistP312 h4,
  .rrmMobilePopupScrollAssistP312 #objectPopupTitle{
    min-height:0!important;
    max-height:none!important;
    height:auto!important;
    line-height:1.18!important;
    margin:0 0 6px!important;
    padding:0!important;
    white-space:normal!important;
  }

  .rrmMobilePopupScrollAssistP312 button,
  .rrmMobilePopupScrollAssistP312 a,
  .rrmMobilePopupScrollAssistP312 input,
  .rrmMobilePopupScrollAssistP312 select,
  .rrmMobilePopupScrollAssistP312 textarea,
  .rrmMobilePopupScrollAssistP312 label,
  .rrmMobilePopupScrollAssistP312 summary,
  .rrmMobilePopupScrollAssistP312 [role="button"],
  .rrmMobilePopupScrollAssistP312 [onclick],
  .rrmMobilePopupScrollAssistP312 [data-action],
  .rrmMobilePopupScrollAssistP312 [tabindex],
  .rrmMobilePopupScrollAssistP312 .wpPrioBox,
  .rrmMobilePopupScrollAssistP312 .iconOnly,
  .rrmMobilePopupScrollAssistP312 .popupCloseX,
  .rrmMobilePopupScrollAssistP312 .tradeActionBtnP35,
  .rrmMobilePopupScrollAssistP312 .tradeItemCardP35,
  .rrmMobilePopupScrollAssistP312 .tradeAnimalCardP35,
  .rrmMobilePopupScrollAssistP312 .objectActionRow,
  .rrmMobilePopupScrollAssistP312 .objectActions,
  .rrmMobilePopupScrollAssistP312 .recipeButton{
    pointer-events:auto!important;
    touch-action:manipulation!important;
  }

  .rrmMobilePopupScrollAssistP312 input,
  .rrmMobilePopupScrollAssistP312 select,
  .rrmMobilePopupScrollAssistP312 textarea{
    touch-action:auto!important;
    -webkit-user-select:text!important;
    user-select:text!important;
  }
}

/* P4.20 - UI mobile: popups em largura total com cards compactos
   Mantém botões compactos; informações em cards responsivos e scroll vertical. */
@media (max-width: 860px), (pointer: coarse){
  body.rrmMobileWidePopupsP420{
    --p420-popup-left: 8px;
    --p420-popup-right: 8px;
    --p420-popup-width: calc(100vw - 16px);
    --p420-popup-max-h: calc(var(--app-height, 100dvh) - var(--topbar-height, 44px) - var(--bottombar-height, 58px) - var(--safe-top, 0px) - var(--safe-bottom, 0px) - 18px);
    --p420-popup-top: calc(var(--topbar-height, 44px) + var(--safe-top, 0px) + 6px);
    --p420-popup-bottom: calc(var(--bottombar-height, 58px) + var(--safe-bottom, 0px) + 6px);
  }

  body.rrmMobileWidePopupsP420 .panel,
  body.rrmMobileWidePopupsP420 .buildMenu,
  body.rrmMobileWidePopupsP420 .objectPopup,
  body.rrmMobileWidePopupsP420 .sidePanel,
  body.rrmMobileWidePopupsP420 #sidePanel.sidePanel,
  body.rrmMobileWidePopupsP420 #sidePanel.sidePanel.open,
  body.rrmMobileWidePopupsP420 #workPanel,
  body.rrmMobileWidePopupsP420 #productionPanel,
  body.rrmMobileWidePopupsP420 #balancePanel,
  body.rrmMobileWidePopupsP420 #stockPanel,
  body.rrmMobileWidePopupsP420 #craftPanel,
  body.rrmMobileWidePopupsP420 #researchPanel,
  body.rrmMobileWidePopupsP420 #eventsPanel,
  body.rrmMobileWidePopupsP420 #storyPanel,
  body.rrmMobileWidePopupsP420 #savePanel,
  body.rrmMobileWidePopupsP420 #visitorsPanel,
  body.rrmMobileWidePopupsP420 #farmPanel,
  body.rrmMobileWidePopupsP420 #debugPanel,
  body.rrmMobileWidePopupsP420 .popupClarityPanelP271{
    position:fixed!important;
    left:var(--p420-popup-left)!important;
    right:var(--p420-popup-right)!important;
    width:var(--p420-popup-width)!important;
    max-width:var(--p420-popup-width)!important;
    min-width:0!important;
    box-sizing:border-box!important;
    max-height:var(--p420-popup-max-h)!important;
    border-radius:14px!important;
    overflow:hidden!important;
    z-index:var(--rrm-z-modal)!important;
    box-shadow:0 14px 34px rgba(0,0,0,.42)!important;
  }

  body.rrmMobileWidePopupsP420 .panel:not(#workPanel),
  body.rrmMobileWidePopupsP420 #sidePanel.sidePanel,
  body.rrmMobileWidePopupsP420 #sidePanel.sidePanel.open,
  body.rrmMobileWidePopupsP420 #stockPanel,
  body.rrmMobileWidePopupsP420 #craftPanel,
  body.rrmMobileWidePopupsP420 #researchPanel,
  body.rrmMobileWidePopupsP420 #eventsPanel,
  body.rrmMobileWidePopupsP420 #storyPanel,
  body.rrmMobileWidePopupsP420 #savePanel,
  body.rrmMobileWidePopupsP420 #visitorsPanel,
  body.rrmMobileWidePopupsP420 #farmPanel,
  body.rrmMobileWidePopupsP420 #debugPanel{

  }

  body.rrmMobileWidePopupsP420 .objectPopup,
  body.rrmMobileWidePopupsP420 #objectPopup.objectPopup,
  body.rrmMobileWidePopupsP420 .buildMenu,
  body.rrmMobileWidePopupsP420 #buildMenu,
  body.rrmMobileWidePopupsP420 #productionPanel,
  body.rrmMobileWidePopupsP420 #balancePanel,
  body.rrmMobileWidePopupsP420 #workPanel{

  }

  body.rrmMobileWidePopupsP420 #sidePanel.sidePanel,
  body.rrmMobileWidePopupsP420 #objectPopup.objectPopup,
  body.rrmMobileWidePopupsP420 #workPanel{
    flex-direction:column!important;
  }

  /* P4.20.4: nunca forçar popups ocultos a aparecerem no mobile.
     A P4.20 podia exibir #workPanel sobre a tela inicial por causa de display:flex!important. */
  body.rrmMobileWidePopupsP420 #sidePanel:not(.open){display:none!important;}
  body.rrmMobileWidePopupsP420 #objectPopup[style*="display: none"]{display:none!important;}
  body.rrmMobileWidePopupsP420 #workPanel[style*="display:none"],
  body.rrmMobileWidePopupsP420 #workPanel[style*="display: none"]{display:none!important;}

  body.rrmMobileWidePopupsP420 .sidePanelHeader,
  body.rrmMobileWidePopupsP420 .objectPopupHeader,
  body.rrmMobileWidePopupsP420 .panel>h3,
  body.rrmMobileWidePopupsP420 .buildMenu>h3,
  body.rrmMobileWidePopupsP420 .wpHeader{
    flex:0 0 auto!important;
    position:sticky!important;
    top:0!important;
    z-index:5!important;
    margin:0!important;
    padding:10px 44px 8px 10px!important;
    background:color-mix(in srgb,var(--bd-panel) 98%,transparent)!important;
    border-bottom:1px solid color-mix(in srgb,var(--bd-border-soft) 42%,transparent)!important;
    line-height:1.2!important;
  }

  body.rrmMobileWidePopupsP420 #panelContent,
  body.rrmMobileWidePopupsP420 #objectPopupBody,
  body.rrmMobileWidePopupsP420 .panelContent,
  body.rrmMobileWidePopupsP420 .popupBody,
  body.rrmMobileWidePopupsP420 .popupContent,
  body.rrmMobileWidePopupsP420 .stockRulesBody,
  body.rrmMobileWidePopupsP420 .tradeStockpileBodyP35,
  body.rrmMobileWidePopupsP420 .tradePostBodyP35,
  body.rrmMobileWidePopupsP420 .scrollablePopup,
  body.rrmMobileWidePopupsP420 .settingsBody,
  body.rrmMobileWidePopupsP420 .listBody{
    flex:1 1 auto!important;
    min-height:0!important;
    max-height:calc(var(--p420-popup-max-h) - 56px)!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch!important;
    overscroll-behavior:contain!important;
    touch-action:pan-y!important;
    padding:10px!important;
    box-sizing:border-box!important;
  }

  body.rrmMobileWidePopupsP420 .panel:not(#workPanel),
  body.rrmMobileWidePopupsP420 .buildMenu:not(#buildMenu),
  body.rrmMobileWidePopupsP420 #stockPanel,
  body.rrmMobileWidePopupsP420 #craftPanel,
  body.rrmMobileWidePopupsP420 #researchPanel,
  body.rrmMobileWidePopupsP420 #eventsPanel,
  body.rrmMobileWidePopupsP420 #storyPanel,
  body.rrmMobileWidePopupsP420 #savePanel,
  body.rrmMobileWidePopupsP420 #visitorsPanel,
  body.rrmMobileWidePopupsP420 #farmPanel,
  body.rrmMobileWidePopupsP420 #debugPanel{



    padding:0 10px 12px!important;
  }

  body.rrmMobileWidePopupsP420 .panelSection,
  body.rrmMobileWidePopupsP420 .objectInfoLine,
  body.rrmMobileWidePopupsP420 .statRow,
  body.rrmMobileWidePopupsP420 .recipeButton,
  body.rrmMobileWidePopupsP420 .researchCard,
  body.rrmMobileWidePopupsP420 .eventCard,
  body.rrmMobileWidePopupsP420 .visitorCard,
  body.rrmMobileWidePopupsP420 .tradeItemCardP35,
  body.rrmMobileWidePopupsP420 .tradeAnimalCardP35,
  body.rrmMobileWidePopupsP420 .contractCardP329,
  body.rrmMobileWidePopupsP420 .recreationCardP419{
    border-radius:12px!important;
    background:color-mix(in srgb,var(--bd-surface) 62%,transparent)!important;
    border:1px solid color-mix(in srgb,var(--bd-border-soft) 42%,transparent)!important;
    box-shadow:0 5px 16px rgba(0,0,0,.16)!important;
  }

  body.rrmMobileWidePopupsP420 .popupQuickGridP271,
  body.rrmMobileWidePopupsP420 .popupDetailsGridP271,
  body.rrmMobileWidePopupsP420 .stockRulesGrid,
  body.rrmMobileWidePopupsP420 .buildOptions,
  body.rrmMobileWidePopupsP420 .tradeGridP35,
  body.rrmMobileWidePopupsP420 .visitorGrid,
  body.rrmMobileWidePopupsP420 .eventGrid,
  body.rrmMobileWidePopupsP420 .contractGridP329,
  body.rrmMobileWidePopupsP420 .recreationGridP419,
  body.rrmMobileWidePopupsP420 .panelCardGridP420{
    display:grid!important;
    grid-template-columns:repeat(auto-fit,minmax(132px,1fr))!important;
    gap:8px!important;
    align-items:stretch!important;
  }

  body.rrmMobileWidePopupsP420 .panelSection,
  body.rrmMobileWidePopupsP420 .researchCard,
  body.rrmMobileWidePopupsP420 .eventCard,
  body.rrmMobileWidePopupsP420 .visitorCard,
  body.rrmMobileWidePopupsP420 .tradeItemCardP35,
  body.rrmMobileWidePopupsP420 .tradeAnimalCardP35{
    margin:6px 0!important;
    padding:9px!important;
  }

  body.rrmMobileWidePopupsP420 .statRow,
  body.rrmMobileWidePopupsP420 .objectInfoLine{
    min-height:42px!important;
    padding:7px 8px!important;
    display:flex!important;
    flex-direction:column!important;
    justify-content:center!important;
    align-items:flex-start!important;
    gap:3px!important;
  }

  body.rrmMobileWidePopupsP420 .statRow span:first-child,
  body.rrmMobileWidePopupsP420 .objectInfoLine span:first-child{
    opacity:.78!important;
    font-size:11px!important;
  }

  body.rrmMobileWidePopupsP420 .statRow span:last-child,
  body.rrmMobileWidePopupsP420 .objectInfoLine span:last-child{
    font-size:13px!important;
    font-weight:800!important;
  }

  /* Botões compactos: não forçar width total no mobile. */
  body.rrmMobileWidePopupsP420 button:not(.iconOnly):not(.popupCloseX):not([data-bd-quantity-delta]):not([data-bd-quantity-bound]):not([data-bd-kbd-char]):not([data-bd-kbd-action]):not([data-bd-kbd-layout]):not(.titleBtn):not(.startBtn),
  body.rrmMobileWidePopupsP420 .recipeButton,
  body.rrmMobileWidePopupsP420 .tradeActionBtnP35,
  body.rrmMobileWidePopupsP420 .objectActionRow button{
    width:auto!important;
    max-width:100%!important;
    min-height:34px!important;
    padding:7px 10px!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    white-space:normal!important;
    border-radius:10px!important;
  }

  body.rrmMobileWidePopupsP420 .objectActionRow,
  body.rrmMobileWidePopupsP420 .objectActions,
  body.rrmMobileWidePopupsP420 .popupActions,
  body.rrmMobileWidePopupsP420 .tradeFooterP35,
  body.rrmMobileWidePopupsP420 .stockFooter,
  body.rrmMobileWidePopupsP420 .compactButtonsP25{
    display:flex!important;
    flex-wrap:wrap!important;
    gap:7px!important;
    justify-content:flex-start!important;
    align-items:center!important;
  }

  body.rrmMobileWidePopupsP420 .iconOnly,
  body.rrmMobileWidePopupsP420 .popupCloseX,
  body.rrmMobileWidePopupsP420 #sideCloseBtn,
  body.rrmMobileWidePopupsP420 #objectPopupClose,
  body.rrmMobileWidePopupsP420 #wpClose{
    flex:0 0 auto!important;
    width:38px!important;
    height:38px!important;
    min-width:38px!important;
    min-height:38px!important;
  }

  body.rrmMobileWidePopupsP420 table{
    width:100%!important;
    min-width:680px!important;
  }

  body.rrmMobileWidePopupsP420 .wpTableWrap,
  body.rrmMobileWidePopupsP420 .tableWrap,
  body.rrmMobileWidePopupsP420 .wideTableWrap{
    overflow-x:auto!important;
    overflow-y:auto!important;
    -webkit-overflow-scrolling:touch!important;
    touch-action:pan-x pan-y!important;
  }

  @media (max-width:380px){
    body.rrmMobileWidePopupsP420 .popupQuickGridP271,
    body.rrmMobileWidePopupsP420 .popupDetailsGridP271,
    body.rrmMobileWidePopupsP420 .stockRulesGrid,
    body.rrmMobileWidePopupsP420 .buildOptions,
    body.rrmMobileWidePopupsP420 .tradeGridP35,
    body.rrmMobileWidePopupsP420 .visitorGrid,
    body.rrmMobileWidePopupsP420 .eventGrid,
    body.rrmMobileWidePopupsP420 .contractGridP329,
    body.rrmMobileWidePopupsP420 .recreationGridP419,
    body.rrmMobileWidePopupsP420 .panelCardGridP420{
      grid-template-columns:repeat(auto-fit,minmax(118px,1fr))!important;
    }
  }
}


/* P4.20.4 - segurança da tela inicial: título e ajuste de mapa sempre acima dos popups mobile. */
.startScreen, .mapSetupScreen{z-index:var(--rrm-z-screen)!important;}
.eventAlert{z-index:var(--rrm-z-critical-alert)!important;}

/* P4.20.5 - mobile popup width enforcement without depending only on body class.
   Applies on real mobile/coarse pointer; does not force hidden panels to appear. */
@media (max-width: 860px), (pointer: coarse){
  :root{
    --p4205-left: 6px;
    --p4205-right: 6px;
    --p4205-width: calc(100vw - 12px);
    --p4205-top: calc(var(--topbar-height, 44px) + env(safe-area-inset-top, 0px) + 6px);
    --p4205-bottom: calc(var(--bottombar-height, 58px) + env(safe-area-inset-bottom, 0px) + 6px);
    --p4205-max-h: calc(100dvh - var(--topbar-height, 44px) - var(--bottombar-height, 58px) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 18px);
  }

  #objectPopup,
  #sidePanel,
  #workPanel,
  #buildMenu,
  .buildMenu,
  .panel,
  #productionPanel,
  #balancePanel,
  #stockPanel,
  #craftPanel,
  #researchPanel,
  #eventsPanel,
  #storyPanel,
  #savePanel,
  #visitorsPanel,
  #farmPanel,
  #debugPanel,
  #recreationPanel,
  #researchGatePanelP417,
  .popupClarityPanelP271{
    position:fixed!important;
    left:var(--p4205-left)!important;
    right:var(--p4205-right)!important;
    width:var(--p4205-width)!important;
    min-width:0!important;
    max-width:var(--p4205-width)!important;
    box-sizing:border-box!important;
    max-height:var(--p4205-max-h)!important;
    overflow:hidden!important;
    z-index:var(--rrm-z-modal)!important;
  }

  #objectPopup,
  #buildMenu,
  .buildMenu,
  #workPanel,
  #productionPanel,
  #balancePanel{

  }

  #sidePanel,
  .panel:not(#workPanel):not(#productionPanel):not(#balancePanel),
  #stockPanel,
  #craftPanel,
  #researchPanel,
  #eventsPanel,
  #storyPanel,
  #savePanel,
  #visitorsPanel,
  #farmPanel,
  #debugPanel,
  #recreationPanel,
  #researchGatePanelP417{

  }

  #sidePanel:not(.open),
  #objectPopup[style*="display: none"],
  #workPanel[style*="display:none"],
  #workPanel[style*="display: none"]{
    display:none!important;
  }

  #objectPopupBody,
  #panelContent,
  .panelContent,
  .popupBody,
  .popupContent,
  .stockRulesBody,
  .tradeStockpileBodyP35,
  .tradePostBodyP35,
  .scrollablePopup,
  .listBody{
    max-height:calc(var(--p4205-max-h) - 56px)!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch!important;
    touch-action:pan-y!important;
  }

  #objectPopupBody,
  #panelContent{
    display:block!important;
  }

  .popupQuickGridP271,
  .popupDetailsGridP271,
  .stockRulesGrid,
  .buildOptions,
  .tradeGridP35,
  .visitorGrid,
  .eventGrid,
  .contractGridP329,
  .recreationGridP419,
  .panelCardGridP420{
    display:grid!important;
    grid-template-columns:repeat(auto-fit,minmax(132px,1fr))!important;
    gap:8px!important;
  }

  .panelSection,
  .objectInfoLine,
  .statRow,
  .recipeButton,
  .researchCard,
  .eventCard,
  .visitorCard,
  .tradeItemCardP35,
  .tradeAnimalCardP35,
  .contractCardP329,
  .recreationCardP419{
    border-radius:12px!important;
    margin:6px 0!important;
  }

  button:not(.iconOnly):not(.popupCloseX):not([data-bd-quantity-delta]):not([data-bd-quantity-bound]):not([data-bd-kbd-char]):not([data-bd-kbd-action]):not([data-bd-kbd-layout]):not(.titleBtn):not(.startBtn),
  .recipeButton,
  .tradeActionBtnP35,
  .objectActionRow button{
    width:auto!important;
    max-width:100%!important;
    min-height:34px!important;
    padding:7px 10px!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    white-space:normal!important;
  }

  .objectActionRow,
  .objectActions,
  .popupActions,
  .tradeFooterP35,
  .stockFooter,
  .compactButtonsP25{
    display:flex!important;
    flex-wrap:wrap!important;
    gap:7px!important;
    justify-content:flex-start!important;
  }
}


/* P4.20.6 - origem real dos popups: largura mobile forçada e cards compactos. */
@media (max-width: 900px), (pointer: coarse){
  :root{
    --p4206-left:6px;
    --p4206-right:6px;
    --p4206-width:calc(100vw - 12px);
    --p4206-top:calc(var(--topbar-height, 44px) + env(safe-area-inset-top, 0px) + 6px);
    --p4206-bottom:calc(var(--bottombar-height, 58px) + env(safe-area-inset-bottom, 0px) + 6px);
    --p4206-max-h:calc(100dvh - var(--topbar-height, 44px) - var(--bottombar-height, 58px) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 18px);
  }
  body.rrmMobileWidePopupsP420 #objectPopup,
  body.rrmMobileWidePopupsP420 #sidePanel,
  body.rrmMobileWidePopupsP420 #workPanel,
  body.rrmMobileWidePopupsP420 #buildMenu,
  body.rrmMobileWidePopupsP420 .buildMenu,
  body.rrmMobileWidePopupsP420 .panel,
  body.rrmMobileWidePopupsP420 .rrmWidePopupPanelP4206{
    position:fixed!important;
    left:var(--p4206-left)!important;
    right:var(--p4206-right)!important;
    width:var(--p4206-width)!important;
    min-width:0!important;
    max-width:var(--p4206-width)!important;
    box-sizing:border-box!important;
    max-height:var(--p4206-max-h)!important;
    z-index:var(--rrm-z-modal)!important;
  }
  body.rrmMobileWidePopupsP420 #objectPopup,
  body.rrmMobileWidePopupsP420 #buildMenu,
  body.rrmMobileWidePopupsP420 #productionPanel,
  body.rrmMobileWidePopupsP420 #balancePanel{

  }
  body.rrmMobileWidePopupsP420 #sidePanel,
  body.rrmMobileWidePopupsP420 #workPanel,
  body.rrmMobileWidePopupsP420 .panel:not(#objectPopup):not(#buildMenu):not(#productionPanel):not(#balancePanel){

  }
  body.rrmMobileWidePopupsP420 #objectPopup,
  body.rrmMobileWidePopupsP420 #sidePanel.open,
  body.rrmMobileWidePopupsP420 #workPanel{
    display:flex!important;
    flex-direction:column!important;

  }
  body.rrmMobileWidePopupsP420 #objectPopup[style*="display: none"],
  body.rrmMobileWidePopupsP420 #workPanel[style*="display: none"],
  body.rrmMobileWidePopupsP420 #sidePanel:not(.open){
    display:none!important;
  }
  body.rrmMobileWidePopupsP420 #objectPopupBody,
  body.rrmMobileWidePopupsP420 #panelContent,
  body.rrmMobileWidePopupsP420 .panelContent,
  body.rrmMobileWidePopupsP420 .popupBody,
  body.rrmMobileWidePopupsP420 .popupContent,
  body.rrmMobileWidePopupsP420 .stockRulesBody,
  body.rrmMobileWidePopupsP420 .tradeStockpileBodyP35,
  body.rrmMobileWidePopupsP420 .tradePostBodyP35,
  body.rrmMobileWidePopupsP420 .scrollablePopup,
  body.rrmMobileWidePopupsP420 .listBody{
    max-height:calc(var(--p4206-max-h) - 58px)!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch!important;
    touch-action:pan-y!important;
  }
  body.rrmMobileWidePopupsP420 #objectPopupBody > .objectInfoLine,
  body.rrmMobileWidePopupsP420 #objectPopupBody > .statRow{
    display:inline-flex!important;
    width:calc(50% - 6px)!important;
    margin:0 3px 6px 0!important;
    vertical-align:top!important;
    border-radius:12px!important;
    padding:7px 8px!important;
    background:color-mix(in srgb,var(--bd-panel) 28%,transparent)!important;
    border:1px solid color-mix(in srgb,var(--bd-border-soft) 34%,transparent)!important;
  }
  body.rrmMobileWidePopupsP420 .popupQuickGridP271,
  body.rrmMobileWidePopupsP420 .popupDetailsGridP271,
  body.rrmMobileWidePopupsP420 .stockRulesGrid,
  body.rrmMobileWidePopupsP420 .buildOptions,
  body.rrmMobileWidePopupsP420 .tradeGridP35,
  body.rrmMobileWidePopupsP420 .visitorGrid,
  body.rrmMobileWidePopupsP420 .eventGrid,
  body.rrmMobileWidePopupsP420 .contractGridP329,
  body.rrmMobileWidePopupsP420 .recreationGridP419,
  body.rrmMobileWidePopupsP420 .panelCardGridP420{
    display:grid!important;
    grid-template-columns:repeat(auto-fit, minmax(132px, 1fr))!important;
    gap:8px!important;
  }
  body.rrmMobileWidePopupsP420 .objectActionRow,
  body.rrmMobileWidePopupsP420 .objectActions,
  body.rrmMobileWidePopupsP420 .popupActions,
  body.rrmMobileWidePopupsP420 .tradeFooterP35,
  body.rrmMobileWidePopupsP420 .stockFooter,
  body.rrmMobileWidePopupsP420 .compactButtonsP25{
    display:flex!important;
    flex-wrap:wrap!important;
    gap:7px!important;
    justify-content:flex-start!important;
  }
  body.rrmMobileWidePopupsP420 .objectActionRow button,
  body.rrmMobileWidePopupsP420 .objectActions button,
  body.rrmMobileWidePopupsP420 .popupActions button,
  body.rrmMobileWidePopupsP420 .compactButtonsP25 button,
  body.rrmMobileWidePopupsP420 .recipeButton{
    width:auto!important;
    max-width:100%!important;
    min-height:34px!important;
    padding:7px 10px!important;
  }
  @media (max-width:380px){
    body.rrmMobileWidePopupsP420 #objectPopupBody > .objectInfoLine,
    body.rrmMobileWidePopupsP420 #objectPopupBody > .statRow{width:100%!important;margin-right:0!important;}
  }
}


/* P4.20.7 - Refinamento interno dos popups mobile
   Cards pequenos ficam na mesma linha; cards longos ocupam mais espaço. */
@media (max-width:860px), (pointer:coarse){
  body.rrmMobileWidePopupsP420 #objectPopupBody > .objectInfoLine,
  body.rrmMobileWidePopupsP420 #objectPopupBody > .statRow,
  body.rrmMobileWidePopupsP420 .popupQuickGridP271 .objectInfoLine,
  body.rrmMobileWidePopupsP420 .popupDetailsGridP271 .objectInfoLine,
  body.rrmMobileWidePopupsP420 .compactInfoGridP25 .objectInfoLine,
  body.rrmMobileWidePopupsP420 .panelCardGridP420 .objectInfoLine,
  body.rrmMobileWidePopupsP420 .panelCardGridP420 .statRow{
    display:inline-flex!important;
    flex-direction:row!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:8px!important;
    min-height:34px!important;
    padding:6px 8px!important;
    margin:0 4px 7px 0!important;
    width:auto!important;
    max-width:100%!important;
    vertical-align:top!important;
    box-sizing:border-box!important;
  }

  body.rrmMobileWidePopupsP420 .objectInfoLine span:first-child,
  body.rrmMobileWidePopupsP420 .statRow span:first-child{
    white-space:normal!important;
    overflow:visible!important;
    text-overflow:clip!important;
    flex:0 1 auto!important;
    min-width:0!important;
    font-size:11px!important;
    opacity:.78!important;
  overflow-wrap:anywhere;}

  body.rrmMobileWidePopupsP420 .objectInfoLine span:last-child,
  body.rrmMobileWidePopupsP420 .statRow span:last-child{
    white-space:normal!important;
    overflow:visible!important;
    text-overflow:clip!important;
    text-align:right!important;
    flex:0 1 auto!important;
    min-width:0!important;
    font-size:13px!important;
    font-weight:800!important;
  overflow-wrap:anywhere;}

  body.rrmMobileWidePopupsP420 .rrmInfoTinyP4207{min-width:92px!important;max-width:calc(33.333% - 8px)!important;}
  body.rrmMobileWidePopupsP420 .rrmInfoCompactP4207{min-width:118px!important;max-width:calc(50% - 8px)!important;}
  body.rrmMobileWidePopupsP420 .rrmInfoMediumP4207{min-width:150px!important;max-width:calc(50% - 8px)!important;}
  body.rrmMobileWidePopupsP420 .rrmInfoWideP4207{width:100%!important;max-width:100%!important;}

  body.rrmMobileWidePopupsP420 .popupQuickGridP271,
  body.rrmMobileWidePopupsP420 .popupDetailsGridP271,
  body.rrmMobileWidePopupsP420 .compactInfoGridP25,
  body.rrmMobileWidePopupsP420 .panelCardGridP420,
  body.rrmMobileWidePopupsP420 .rrmAdaptiveInfoGridP4207{
    display:grid!important;
    grid-template-columns:repeat(auto-fit,minmax(108px,1fr))!important;
    gap:6px!important;
    align-items:stretch!important;
  }

  body.rrmMobileWidePopupsP420 .popupQuickGridP271 .objectInfoLine,
  body.rrmMobileWidePopupsP420 .popupDetailsGridP271 .objectInfoLine,
  body.rrmMobileWidePopupsP420 .compactInfoGridP25 .objectInfoLine,
  body.rrmMobileWidePopupsP420 .panelCardGridP420 .objectInfoLine,
  body.rrmMobileWidePopupsP420 .panelCardGridP420 .statRow{
    width:auto!important;
    max-width:100%!important;
    margin:0!important;
  }

  body.rrmMobileWidePopupsP420 .popupQuickGridP271 .rrmInfoWideP4207,
  body.rrmMobileWidePopupsP420 .popupDetailsGridP271 .rrmInfoWideP4207,
  body.rrmMobileWidePopupsP420 .compactInfoGridP25 .rrmInfoWideP4207,
  body.rrmMobileWidePopupsP420 .panelCardGridP420 .rrmInfoWideP4207{
    grid-column:1 / -1!important;
  }

  /* Primeira linha dos popups: os cards curtos ficam densos e em uma linha só. */
  body.rrmMobileWidePopupsP420 #objectPopupBody > .objectInfoLine.rrmInfoTinyP4207,
  body.rrmMobileWidePopupsP420 #objectPopupBody > .statRow.rrmInfoTinyP4207,
  body.rrmMobileWidePopupsP420 #objectPopupBody > .objectInfoLine.rrmInfoCompactP4207,
  body.rrmMobileWidePopupsP420 #objectPopupBody > .statRow.rrmInfoCompactP4207{
    flex-direction:row!important;
    justify-content:space-between!important;
  }

  @media (max-width:380px){
    body.rrmMobileWidePopupsP420 .rrmInfoTinyP4207{min-width:calc(50% - 8px)!important;max-width:calc(50% - 8px)!important;}
    body.rrmMobileWidePopupsP420 .rrmInfoCompactP4207,
    body.rrmMobileWidePopupsP420 .rrmInfoMediumP4207{min-width:calc(50% - 8px)!important;max-width:calc(50% - 8px)!important;}
    body.rrmMobileWidePopupsP420 .rrmInfoWideP4207{width:100%!important;max-width:100%!important;}
  }
}


/* P4.20.8 - Popup de colono: cards internos responsivos por tamanho de informação.
   O painel de colono usa #panelContent direto, não os grids genéricos do objectPopup. */
@media (max-width:860px), (pointer:coarse){
  body.rrmMobileWidePopupsP420 #sidePanel.rrmColonistPanelMobileP4208 #panelContent,
  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208{
    padding:8px!important;
    display:block!important;
  }

  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .panelSection.rrmColonistSectionP4208{
    display:grid!important;
    grid-template-columns:repeat(auto-fit,minmax(118px,1fr))!important;
    gap:6px!important;
    align-items:stretch!important;
    margin:6px 0!important;
    padding:8px!important;
  }

  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .panelSection.rrmColonistMainSectionP4208{
    grid-template-columns:repeat(auto-fit,minmax(112px,1fr))!important;
  }

  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .panelSection > b,
  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .panelSection > label,
  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .panelSection > select,
  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .panelSection > button,
  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .rrmColonistFullRowP4208,
  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .rrmColonistMetricBarP4208{
    grid-column:1 / -1!important;
  }

  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .statRow,
  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .rrmColonistStatCardP4208{
    display:inline-flex!important;
    flex-direction:row!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:8px!important;
    min-height:32px!important;
    padding:6px 8px!important;
    margin:0!important;
    width:auto!important;
    max-width:100%!important;
    box-sizing:border-box!important;
    border-radius:10px!important;
  }

  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .statRow span:first-child{
    white-space:normal!important;
    overflow:visible!important;
    text-overflow:clip!important;
    min-width:0!important;
    flex:0 1 auto!important;
    font-size:11px!important;
  overflow-wrap:anywhere;}

  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .statRow span:last-child{
    white-space:normal!important;
    overflow:visible!important;
    text-overflow:clip!important;
    text-align:right!important;
    min-width:0!important;
    flex:0 1 auto!important;
    font-size:13px!important;
  overflow-wrap:anywhere;}

  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .statRow.rrmInfoTinyP4207,
  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .statRow.rrmInfoCompactP4207{
    min-width:0!important;
  }

  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .statRow.rrmInfoWideP4207{
    grid-column:1 / -1!important;
  }
}


/* P4.20.9 - Popup de colono legível: sem corte de texto e controles compactos. */
@media (max-width:860px), (pointer:coarse){
  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .panelSection.rrmColonistSectionP4208{
    grid-template-columns:repeat(auto-fit,minmax(160px,1fr))!important;
    gap:8px!important;
  }

  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .statRow,
  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .rrmColonistStatCardP4208{
    min-height:36px!important;
    padding:7px 9px!important;
    overflow:visible!important;
    white-space:normal!important;
    width:auto!important;
    max-width:100%!important;
  }

  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .statRow span,
  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .rrmColonistStatCardP4208 span{
    overflow:visible!important;
    text-overflow:clip!important;
    white-space:normal!important;
    line-height:1.25!important;
    word-break:normal!important;
    overflow-wrap:anywhere!important;
  }

  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .statRow span:first-child{
    white-space:nowrap!important;
    max-width:48%!important;
    flex:0 0 auto!important;
  }

  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .statRow span:last-child{
    max-width:58%!important;
    flex:1 1 auto!important;
    text-align:right!important;
  }

  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .statRow.rrmColonistWideP4209{
    grid-column:1 / -1!important;
  }

  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .statRow.rrmColonistWideP4209 span:first-child,
  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .statRow.rrmColonistWideP4209 span:last-child{
    max-width:none!important;
  }

  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 select,
  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 button:not(.iconOnly):not(.popupCloseX):not([data-bd-quantity-delta]):not([data-bd-quantity-bound]):not([data-bd-kbd-char]):not([data-bd-kbd-action]):not([data-bd-kbd-layout]):not(.titleBtn){
    width:auto!important;
    min-width:0!important;
    max-width:100%!important;
    flex:0 0 auto!important;
    justify-self:start!important;
    display:inline-flex!important;
  }

  body.rrmMobileWidePopupsP420 #panelContent.rrmColonistContentMobileP4208 .rrmColonistControlP4209{
    grid-column:auto!important;
    width:auto!important;
    justify-self:start!important;
  }
}

/* P4.21 - Configurações mobile */
@media (max-width: 760px), (pointer: coarse){
  .settingsScreen{align-items:stretch;justify-content:center;overflow:auto;}
  .settingsCard{
    width:calc(100vw - max(12px, env(safe-area-inset-left)) - max(12px, env(safe-area-inset-right)))!important;
    max-height:calc(100dvh - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)))!important;
    margin:max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
    padding:18px;
  }
  .settingsGrid{grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;}
  .settingsWideRow{grid-column:1/-1;}
  .settingsActions .startBtn{width:auto!important;min-width:120px;}
}


/* P4.21.1 - Settings screen mobile scroll hotfix */
@media (max-width: 760px), (pointer: coarse){
  #settingsScreen.settingsScreen{
    display:block!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    height:100dvh!important;
    max-height:100dvh!important;
    -webkit-overflow-scrolling:touch!important;
    touch-action:pan-y!important;
    overscroll-behavior:contain!important;
    padding:max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom))!important;
    box-sizing:border-box!important;
  }
  #settingsScreen.settingsScreen.hidden{display:none!important;}
  #settingsScreen .settingsCard{
    width:calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right))!important;
    max-width:none!important;
    height:auto!important;
    max-height:calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom))!important;
    margin:0 auto!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch!important;
    touch-action:pan-y!important;
    overscroll-behavior:contain!important;
    box-sizing:border-box!important;
  }
  #settingsScreen .settingsBackdrop{position:fixed!important;}
}
