/* v0.9.9c: remove web-like stretched buttons and in-screen scrolling from core management views. */

/* Shared equal-size tabs/buttons */
#heroDetails .detail-sections,
#bookDialog .book-mode,
#missionDialog .mission-tabs{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(clamp(92px,12vw,108px),clamp(108px,14vw,132px)));
  justify-content:start;
  gap:6px;
}
#heroDetails .detail-sections button,
#bookDialog .book-mode button,
#missionDialog .mission-tabs button{
  flex:none!important;
  width:100%;
  min-width:0;
  max-width:132px;
  min-height:36px;
  padding:6px 8px;
  white-space:normal;
  line-height:1.12;
  text-align:center;
  justify-self:start;
}

/* Detail screen: no inner scrolling, use compact one-screen layout */
#heroDetails,
#bookDialog,
#missionDialog,
#facilityShop,
#plazaInventory,
#facilityPanel,
#recipeBook{
  overflow:hidden;
}
#heroDetails .detail-body{
  overflow:hidden!important;
}
#heroDetails .detail-data{
  display:flex;
  flex-direction:column;
  min-height:0;
}
#heroDetails .detail-pane-scroll{
  overflow:visible!important;
  scrollbar-width:none;
  padding:2px 4px 4px;
}
#heroDetails .detail-pane-scroll::-webkit-scrollbar{display:none}
#heroDetails .detail-stats{gap:3px;margin:3px 0 6px}
#heroDetails .detail-stat{padding:3px 5px}
#heroDetails .detail-skill,
#heroDetails .growth-card,
#heroDetails .strength-card,
#heroDetails .bond-card{
  margin:0 0 4px;
}
#heroDetails .detail-data p,
#heroDetails .detail-data .detail-muted,
#heroDetails .bond-card p{
  line-height:1.3;
}

/* Detail motion buttons and bottom actions should keep shoulders intact */
#detailMotions{
  grid-template-columns:repeat(4,minmax(0,96px));
  justify-content:center;
  max-width:420px;
}
#detailMotions button.secondary,
#heroDetails #shardBuy{
  background-size:100% 100%;
  min-width:0;
  max-width:180px;
  justify-self:center;
}
#heroDetails #shardBuy{
  width:min(100%,180px);
  align-self:flex-start;
}

/* Facility shop: 4 cards in a stable 2x2 grid, buttons fixed width */
#facilityShop{
  padding:clamp(6px,1.7vmin,16px);
}
#facilityShop[open]{
  display:grid;
  grid-template-rows:auto auto auto minmax(0,1fr);
  gap:6px;
}
#facilityShop .facility-head,
#facilityShop .shop-wallet,
#facilityShop .shop-hint,
#facilityShop .shop-grid{
  width:min(100%,1200px);
  margin-inline:auto;
}
#facilityShop .shop-grid{
  grid-template-columns:repeat(2,minmax(0,1fr));
  align-content:center;
  gap:10px 18px;
}
#facilityShop .shop-card{
  grid-template-rows:auto auto auto auto;
  align-content:start;
  justify-items:center;
  min-height:0;
  padding:4px 6px 8px;
}
#facilityShop .shop-card button{
  width:min(100%,168px);
  max-width:168px;
  min-height:34px;
  padding:5px 10px;
  white-space:normal;
}

/* Inventory / recipe / facility panels: avoid long vertical scrolling by using fixed grids */
#plazaInventory,
#facilityPanel,
#recipeBook{
  padding:clamp(6px,1.7vmin,16px);
}
#plazaInventory[open],
#facilityPanel[open],
#recipeBook[open]{
  display:flex;
  flex-direction:column;
  gap:6px;
}
#recipeBook .recipe-book-list,
#plazaInventory .inventory-list,
#facilityPanel .facility-content,
#bookDialog .book-scroll,
#missionDialog #missionList{
  overflow:hidden!important;
  scrollbar-width:none;
}
#recipeBook .recipe-book-list::-webkit-scrollbar,
#plazaInventory .inventory-list::-webkit-scrollbar,
#facilityPanel .facility-content::-webkit-scrollbar,
#bookDialog .book-scroll::-webkit-scrollbar,
#missionDialog #missionList::-webkit-scrollbar{display:none}

/* Book mode buttons also should not span the full row awkwardly */
#bookDialog .book-mode{
  justify-content:center;
}
#bookDialog .book-mode button{
  justify-self:center;
}

/* Compact small landscape */
@media (orientation:landscape) and (max-height:540px){
  #heroDetails .detail-sections,
  #bookDialog .book-mode,
  #missionDialog .mission-tabs{
    gap:4px;
    grid-template-columns:repeat(auto-fit,minmax(84px,108px));
  }
  #heroDetails .detail-sections button,
  #bookDialog .book-mode button,
  #missionDialog .mission-tabs button{
    max-width:108px;
    min-height:30px;
    font-size:10px;
    padding:4px 5px;
  }
  #heroDetails .detail-layout{gap:4px;grid-template-columns:minmax(124px,.85fr) minmax(0,1.4fr)}
  #heroDetails .detail-name h3{font-size:13px}
  #heroDetails .detail-name p{font-size:9px}
  #heroDetails .detail-data h3{font-size:12px;margin:1px 0 2px}
  #heroDetails .detail-data p,
  #heroDetails .detail-data .detail-muted,
  #heroDetails .bond-card p{font-size:10px;line-height:1.18;margin:2px 0}
  #heroDetails .detail-stat dt,
  #heroDetails .detail-stat dd{font-size:10px}
  #heroDetails .detail-stat dt img{width:12px;height:12px}
  #heroDetails .detail-meter{height:5px}
  #detailMotions{grid-template-columns:repeat(4,minmax(0,88px));gap:2px}
  #detailMotions button.secondary{min-height:24px;font-size:9px;padding:3px 2px}
  #heroDetails #shardBuy{max-width:148px;min-height:30px;font-size:10px}
  #facilityShop .shop-grid{gap:8px 12px}
  #facilityShop .shop-card{font-size:11px}
  #facilityShop .shop-card button{max-width:150px;min-height:30px;font-size:10px}
}

@media (max-width:740px){
  #facilityShop .shop-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
}
