/* P10.25.20 — Map Setup runtime breakpoint correction.
 * Presentation only: preserves the canonical controls and their runtime behavior.
 */

#mapSetupScreen.mapSetupScreen:not(.hidden){
  align-items:flex-start!important;
  justify-content:center!important;
  padding:max(14px,var(--safe-top,0px)) max(14px,var(--safe-right,0px)) max(18px,var(--safe-bottom,0px)) max(14px,var(--safe-left,0px))!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
}

#mapSetupScreen .mapSetupCard{
  box-sizing:border-box!important;
  width:min(1180px,calc(100vw - 28px))!important;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  margin:0 auto!important;
  padding:24px!important;
  overflow:visible!important;
}

#mapSetupScreen .mapSetupCard h1{
  margin-right:150px!important;
}

#mapSetupScreen .mapSetupCard>p{
  max-width:760px!important;
  margin-bottom:16px!important;
}

#mapSetupScreen .mapSetupOptions{
  display:grid!important;
  grid-template-columns:1fr!important;
  gap:16px!important;
  margin:14px 0!important;
  padding:0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
}

#mapSetupScreen .mapSetupTopGrid{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
  gap:14px!important;
  align-items:stretch!important;
}

#mapSetupScreen .mapSetupSectionCard,
#mapSetupScreen .mapSetupResourcesCard{
  box-sizing:border-box!important;
  min-width:0!important;
  padding:18px!important;
  border:1px solid var(--bd-border-soft)!important;
  border-radius:16px!important;
  background:linear-gradient(180deg,var(--bd-panel-alt),var(--bd-panel))!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04)!important;
}

/* Colony name occupies the left half of the top row. */
#mapSetupScreen .colonyNameField{
  grid-column:auto!important;
  width:100%!important;
  align-content:start!important;
  gap:12px!important;
}

#mapSetupScreen .colonyNameField #newColonyName{
  width:100%!important;
  min-height:54px!important;
  margin-top:4px!important;
  border-radius:14px!important;
  font-weight:800!important;
  font-size:clamp(22px,2.1vw,28px)!important;
  line-height:1.1!important;
  text-align:center!important;
}

#mapSetupScreen .colonyNameField small{
  margin-top:2px!important;
}

/* Map size and terrain balance form one card beside Colony name. */
#mapSetupScreen .mapSetupWorldCard{
  display:grid!important;
  grid-template-columns:1fr!important;
  gap:16px!important;
  align-content:start!important;
}

#mapSetupScreen .mapSetupWorldCard>label,
#mapSetupScreen .mapSetupBottomGrid>label,
#mapSetupScreen .mapSetupResourcesCard>label{
  display:grid!important;
  gap:7px!important;
  min-width:0!important;
  color:var(--bd-text)!important;
  font-weight:750!important;
  font-size:13px!important;
  line-height:1.25!important;
}

#mapSetupScreen .mapSetupWorldCard select,
#mapSetupScreen .mapSetupBottomGrid select{
  width:100%!important;
  min-height:46px!important;
  margin:0!important;
  padding:9px 12px!important;
  border-radius:12px!important;
  font-size:14px!important;
}

/* Starting values: 2 x 2 grid, no Min/Max shortcuts in this popup. */
#mapSetupScreen .startGrid3.mapSetupResourcesCard{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:18px 24px!important;
  padding:18px 22px!important;
}

#mapSetupScreen .mapSetupResourcesCard > label{
  align-content:start!important;
}

#mapSetupScreen .mapSetupResourcesCard .bdQuantitySelector{
  display:inline-grid!important;
  grid-template-columns:48px 48px 48px!important;
  grid-template-rows:48px!important;
  gap:8px!important;
  width:max-content!important;
  max-width:100%!important;
  margin-top:2px!important;
  align-items:stretch!important;
}

#mapSetupScreen .mapSetupResourcesCard .bdQuantitySelector>button[data-bd-quantity-delta],
#mapSetupScreen .mapSetupResourcesCard .bdQuantitySelector>output{
  box-sizing:border-box!important;
  width:48px!important;
  min-width:48px!important;
  max-width:48px!important;
  height:48px!important;
  min-height:48px!important;
  padding:0!important;
  border-radius:12px!important;
  font-size:18px!important;
  font-weight:900!important;
}

#mapSetupScreen .mapSetupResourcesCard .bdQuantitySelector>output{
  display:grid!important;
  place-items:center!important;
  font-size:14px!important;
  font-variant-numeric:tabular-nums!important;
}

#mapSetupScreen .mapSetupResourcesCard .bdQuantitySelector>.shortcut,
#mapSetupScreen .mapSetupResourcesCard .bdQuantityShortcuts{
  display:none!important;
}

/* Mobile popup controls keep a real touch hit-area, including close buttons,
   category tabs, compact action buttons, and icon-only controls. */
html[data-bd-theme] body.rrmModernUiP485.rrmUiShellP475.rrmUiMobileP475
:is(#workPanel,#buildMenu,#researchPanel,#eventsPanel,#storyPanel,#visitorsPanel,
    #balancePanel,#farmPanel,#savePanel,#saveLoadPanel,#objectPopup,#sidePanel,
    #schedulePopup,.pm-popup,.pm-modal,.settingsCard,#mobileDrawer) button{
  box-sizing:border-box!important;
  min-width:44px!important;
  min-height:44px!important;
  height:auto!important;
}


/* Difficulty and storyteller share the same horizontal row. */
#mapSetupScreen .mapSetupBottomGrid{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:40px!important;
}

#mapSetupScreen .startActions{
  margin-top:14px!important;
  gap:12px!important;
}

#mapSetupScreen .startActions .startBtn{
  min-height:46px!important;
  padding:10px 18px!important;
  border-radius:13px!important;
  font-size:14px!important;
}

@media (max-width:1100px){
  #mapSetupScreen.mapSetupScreen:not(.hidden){
    padding:max(8px,var(--safe-top,0px)) max(8px,var(--safe-right,0px)) max(10px,var(--safe-bottom,0px)) max(8px,var(--safe-left,0px))!important;
  }
  #mapSetupScreen .mapSetupCard{
    width:100%!important;
    padding:16px!important;
    border-radius:14px!important;
  }
  #mapSetupScreen .startGrid3.mapSetupResourcesCard{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:16px 24px!important;
  }
}

@media (max-width:640px){
  #mapSetupScreen .mapSetupTopGrid,
  #mapSetupScreen .mapSetupBottomGrid{
    grid-template-columns:1fr!important;
  }
  #mapSetupScreen .mapSetupCard h1{
    margin-right:104px!important;
  }
  #mapSetupScreen .mapSetupSectionCard,
  #mapSetupScreen .mapSetupResourcesCard{
    padding:13px!important;
  }
  #mapSetupScreen .startGrid3.mapSetupResourcesCard{
    grid-template-columns:1fr!important;
  }
  #mapSetupScreen .mapSetupResourcesCard>label{
    grid-template-columns:minmax(0,1fr) auto!important;
    align-items:center!important;
    gap:10px!important;
  }
  #mapSetupScreen .mapSetupResourcesCard .bdQuantitySelector{
    margin-top:0!important;
  }
}
