/* STELLAR EMPIRE 0.5.5 – mobile dashboard repair.
 * Keep all 10 resources, all five actionable status chips, the panorama,
 * and all five command actions fully accessible. Desktop untouched.
 */
@media (max-width:760px) {
  :root {
    --resource-strip-height:142px;
  }
  /* Two compact rows of five, with all values AND production visible. */
  .game .resource-strip {
    box-sizing:border-box!important;
    height:142px!important;
    min-height:142px!important;
    max-height:142px!important;
    flex:0 0 142px!important;
    display:flex!important;
    flex-direction:column!important;
    padding:5px 7px 6px!important;
    gap:4px!important;
    overflow:hidden!important;
  }
  .game .resource-strip-head{
    min-height:28px!important;
    height:28px!important;
    max-height:28px!important;
    flex:0 0 28px!important;
    padding:0!important;
    gap:4px!important;
  }
  .game .strip-heading{
    min-width:0!important;
    gap:5px!important;
    align-items:center!important;
  }
  .game .strip-heading strong{font-size:10px!important;line-height:1.05!important;}
  .game .strip-heading small{
    font-size:8px!important;
    line-height:1.12!important;
    white-space:nowrap!important;
    text-overflow:ellipsis!important;
    overflow:hidden!important;
  }
  .game .strip-heading .resource-orbit{font-size:15px!important;}
  .game .resource-scope{min-width:105px!important;}
  .game .resource-scope button{padding:5px 7px!important;font-size:9px!important;}
  .game .resource-expand{
    width:27px!important;
    min-width:27px!important;
    height:27px!important;
    font-size:15px!important;
  }
  .game .resource-rail{
    display:grid!important;
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
    grid-template-rows:repeat(2,minmax(0,1fr))!important;
    gap:3px!important;
    flex:1 1 0!important;
    min-height:0!important;
    min-width:0!important;
    overflow:hidden!important;
  }
  .game .resource-tile{
    min-width:0!important;
    min-height:0!important;
    width:100%!important;
    height:100%!important;
    padding:3px 1px!important;
    gap:1px!important;
    border-radius:7px!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    overflow:hidden!important;
  }
  .game .resource-tile .res-symbol{
    font-size:12px!important;
    height:13px!important;
    line-height:13px!important;
  }
  .game .resource-tile .res-data{
    display:flex!important;
    flex-direction:column!important;
    gap:1px!important;
    min-width:0!important;
    width:100%!important;
    align-items:center!important;
  }
  .game .resource-tile .res-name{
    font-size:9px!important;
    line-height:1.05!important;
    font-weight:750!important;
    width:100%!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  .game .resource-tile .res-amount{
    font-size:clamp(9px,2.76vw,12px)!important;
    line-height:1.08!important;
    letter-spacing:-.22px!important;
    max-width:100%!important;
    overflow:hidden!important;
    text-overflow:clip!important;
    font-variant-numeric:tabular-nums!important;
  }
  .game .resource-tile .res-rate{
    font-size:8.5px!important;
    line-height:1.08!important;
    white-space:nowrap!important;
  }

  /* Respect the true height occupied by the top strip.
     The bottom navigation is fixed, so reserve its space once (not twice). */
  .game .layout{
    display:block!important;
    box-sizing:border-box!important;
    min-height:0!important;
    flex:1 1 auto!important;
    height:auto!important;
    padding-bottom:64px!important;
    overflow:hidden!important;
  }
  .game .main,
  .game .main:has(>.screen.empire-dashboard){
    box-sizing:border-box!important;
    min-height:0!important;
    max-height:100%!important;
    height:100%!important;
    padding:0!important;
    overflow:hidden!important;
  }
  .game .screen.empire-dashboard{
    box-sizing:border-box!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    height:100%!important;
    min-height:0!important;
    padding:6px 7px 7px!important;
    display:flex!important;
    flex-direction:column!important;
    gap:6px!important;
    overflow:hidden!important;
  }
  /* This MUST be CSS grid: mobile flex-wrap from old styles was still
     letting the metric group overflow the entire phone width. */
  .game .screen.empire-dashboard>.home-planetline{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    flex:0 0 auto!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    grid-template-rows:auto auto!important;
    grid-template-areas:"planet controls" "hud hud"!important;
    align-items:center!important;
    column-gap:5px!important;
    row-gap:6px!important;
    flex-wrap:unset!important;
    box-sizing:border-box!important;
    padding:7px 8px!important;
    margin:0!important;
    height:auto!important;
    min-height:0!important;
    max-height:120px!important;
    overflow:hidden!important;
  }
  .game .screen.empire-dashboard>.home-planetline>.home-planet-title{
    grid-area:planet!important;
    width:auto!important;
    min-width:0!important;
    max-width:100%!important;
    flex:none!important;
    gap:8px!important;
    margin:0!important;
  }
  .game .screen.empire-dashboard .home-planet-title .compact-planet-icon{
    flex:0 0 29px!important;
    width:29px!important;height:29px!important;
  }
  .game .screen.empire-dashboard .home-planet-copy{
    display:flex!important;
    flex-direction:column!important;
    min-width:0!important;
    max-width:100%!important;
    overflow:hidden!important;
  }
  .game .screen.empire-dashboard .home-planet-copy small{
    min-width:0!important;
    max-width:100%!important;
    font-size:9px!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  .game .screen.empire-dashboard .home-planet-copy h2{
    font-size:18px!important;
    line-height:1.12!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  .game .screen.empire-dashboard>.home-planetline>.home-planet-controls{
    grid-area:controls!important;
    justify-self:end!important;
    align-self:center!important;
    width:auto!important;
    margin:0!important;
    order:unset!important;
    flex:none!important;
    min-width:0!important;
  }
  .game .screen.empire-dashboard .home-planet-controls .soft-btn{
    display:grid!important;
    place-items:center!important;
    width:35px!important;
    height:35px!important;
    min-width:35px!important;
    padding:0!important;
    font-size:0!important;
    line-height:1!important;
    border-radius:9px!important;
  }
  .game .screen.empire-dashboard .home-planet-controls .soft-btn:after{
    content:"✎";
    font-size:17px;
    line-height:1;
    color:#dfecf9;
  }
  .game .screen.empire-dashboard .home-planet-controls .pill,
  .game .screen.empire-dashboard .home-planet-controls .home-survey-count{
    display:none!important;
  }
  .game .screen.empire-dashboard>.home-planetline>.home-command-hud{
    grid-area:hud!important;
    display:grid!important;
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
    grid-template-rows:minmax(0,1fr)!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    height:47px!important;
    min-height:47px!important;
    max-height:47px!important;
    flex:none!important;
    order:unset!important;
    gap:4px!important;
    margin:0!important;
    overflow:hidden!important;
  }
  .game .screen.empire-dashboard .home-command-hud>.hud-chip{
    box-sizing:border-box!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    min-width:0!important;
    width:100%!important;
    max-width:100%!important;
    height:47px!important;
    min-height:0!important;
    padding:4px 1px!important;
    gap:2px!important;
    border-radius:8px!important;
    overflow:hidden!important;
  }
  .game .screen.empire-dashboard .hud-chip-icon{
    font-size:12px!important;
    line-height:1!important;
    display:block!important;
  }
  .game .screen.empire-dashboard .hud-chip-data{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    align-items:center!important;
    text-align:center!important;
    gap:2px!important;
    overflow:hidden!important;
  }
  .game .screen.empire-dashboard .hud-chip-data small{
    font-size:8px!important;
    line-height:1!important;
    max-width:100%!important;
    letter-spacing:0!important;
    white-space:nowrap!important;
  }
  .game .screen.empire-dashboard .hud-chip-data strong{
    font-size:clamp(9px,2.55vw,11px)!important;
    line-height:1.07!important;
    font-variant-numeric:tabular-nums!important;
    max-width:100%!important;
    white-space:nowrap!important;
    text-overflow:clip!important;
    overflow:hidden!important;
  }
  /* The title already appears in the planet bar: allow the artwork to breathe. */
  .game .screen.empire-dashboard .colony-scene .scene-overlay{
    display:none!important;
  }
  .game .screen.empire-dashboard>.colony-scene{
    width:100%!important;
    flex:1 1 0!important;
    min-height:70px!important;
    max-height:none!important;
    height:auto!important;
    margin:0!important;
    overflow:hidden!important;
    border-radius:10px!important;
  }
  .game .screen.empire-dashboard>.colony-scene .scene-bottom{
    z-index:6;
  }
  /* Three large actions, then two wide ones: legible and easier to tap. */
  .game .screen.empire-dashboard>.home-action-grid{
    flex:0 0 auto!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    display:grid!important;
    grid-template-columns:repeat(6,minmax(0,1fr))!important;
    grid-auto-rows:55px!important;
    gap:5px!important;
    margin:0!important;
    padding:0!important;
  }
  .game .screen.empire-dashboard>.home-action-grid>.home-action{
    grid-column:span 2!important;
    display:grid!important;
    grid-template-columns:22px minmax(0,1fr)!important;
    grid-template-rows:minmax(0,1fr)!important;
    align-items:center!important;
    justify-items:stretch!important;
    column-gap:6px!important;
    row-gap:0!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    min-height:55px!important;
    height:55px!important;
    padding:7px 8px!important;
    border-radius:9px!important;
    text-align:left!important;
    overflow:hidden!important;
  }
  .game .screen.empire-dashboard>.home-action-grid>.home-action:nth-child(n+4){
    grid-column:span 3!important;
  }
  .game .screen.empire-dashboard .home-action .home-action-icon{
    grid-column:1!important;
    grid-row:1!important;
    font-size:20px!important;
    line-height:1!important;
  }
  .game .screen.empire-dashboard .home-action strong{
    grid-column:2!important;
    grid-row:1!important;
    min-width:0!important;
    max-width:100%!important;
    font-size:clamp(10px,2.88vw,12px)!important;
    line-height:1.18!important;
    text-align:left!important;
    white-space:normal!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    display:-webkit-box!important;
    -webkit-line-clamp:2!important;
    -webkit-box-orient:vertical!important;
  }
  .game .screen.empire-dashboard .home-action small,
  .game .screen.empire-dashboard .home-action .home-action-arrow{
    display:none!important;
  }
  /* Folded notice arrow sits beside the upper HUD, not across the planet. */
  .game.messages-collapsed .activity-bar{
    top:clamp(128px,22dvh,190px)!important;
    width:22px!important;
    height:40px!important;
    border-radius:8px 0 0 8px!important;
  }
  .game.messages-collapsed .activity-heading button,
  .game.messages-collapsed .messages-fold-icon{
    width:21px!important;
    height:39px!important;
    font-size:14px!important;
  }
  .game .mobile-nav{
    min-height:64px;
    height:64px;
    z-index:20;
  }
}
@media(max-width:760px) and (max-height:700px){
  :root{--resource-strip-height:130px;}
  .game .resource-strip{
    height:130px!important;min-height:130px!important;
    max-height:130px!important;flex-basis:130px!important;
  }
  .game .screen.empire-dashboard>.home-planetline{padding:5px 7px!important;row-gap:3px!important;}
  .game .screen.empire-dashboard>.home-planetline>.home-command-hud{
    height:41px!important;min-height:41px!important;max-height:41px!important;
  }
  .game .screen.empire-dashboard .home-command-hud>.hud-chip{height:41px!important;}
  .game .screen.empire-dashboard>.home-action-grid{grid-auto-rows:45px!important;}
  .game .screen.empire-dashboard>.home-action-grid>.home-action{
    min-height:45px!important;height:45px!important;padding:4px 6px!important;
  }
}
@media(max-width:760px) and (max-height:530px){
  :root{--resource-strip-height:110px;}
  .game .resource-strip{
    height:110px!important;min-height:110px!important;
    max-height:110px!important;flex-basis:110px!important;
  }
  .game .resource-strip-head{
    height:24px!important;min-height:24px!important;max-height:24px!important;flex-basis:24px!important;
  }
  .game .resource-tile .res-symbol{display:none!important;}
  .game .screen.empire-dashboard .home-planet-copy small{display:none!important;}
  .game .screen.empire-dashboard>.home-action-grid{grid-auto-rows:37px!important;}
  .game .screen.empire-dashboard>.home-action-grid>.home-action{height:37px!important;min-height:37px!important;}
  .game .screen.empire-dashboard .home-action strong{font-size:9px!important;}
}
