/* Mobile navigation first-paint stability.
   Asteria's main navigation starts in the header and is moved to the drawer
   by a single existing navigation script. Never paint it in the mobile header
   before that move; the same nodes and native handlers remain untouched. */
@media (max-width:1679px) {
  body .asteria-header > #globalNavigation {
    display:none!important;
  }
  body #settingsPanel #mobileNavigationSlot #globalNavigation {
    display:flex!important;
    position:static!important;
    left:auto!important;
    top:auto!important;
    transform:none!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    flex-direction:column;
    align-items:stretch;
    gap:12px;
    margin:0 0 18px;
  }
}

/* Logo, account and menu form ONE fixed-height mobile row. Compendium,
   Character Forge and Campaign Forge belong only in the slide-out drawer. */
@media (max-width:720px) {
  body .topbar.asteria-header {
    box-sizing:border-box!important;
    display:flex!important;
    flex-wrap:nowrap!important;
    justify-content:space-between!important;
    align-items:center!important;
    align-content:center!important;
    gap:6px!important;
    padding:0 6px!important;
    width:100%!important;
    min-width:0!important;
    overflow:visible!important;
  }
  body .asteria-header .asteria-header-brand {
    flex:1 1 0!important;
    width:auto!important;
    max-width:166px!important;
    min-width:0!important;
    margin:0!important;
  }
  body .asteria-header .asteria-header-wordmark {
    display:block;
    width:100%!important;
    height:auto!important;
    max-width:100%!important;
    max-height:calc(var(--core-header-height) - 4px)!important;
  }
  body .asteria-header .top-actions {
    position:static!important;
    top:auto!important;
    right:auto!important;
    transform:none!important;
    flex:0 0 auto!important;
    min-width:0!important;
    height:var(--core-header-height)!important;
    align-self:center!important;
    display:flex!important;
    flex-wrap:nowrap!important;
    align-items:center!important;
    justify-content:flex-end!important;
    gap:4px!important;
    margin:0!important;
  }
  body .asteria-header #accountControls {
    display:flex!important;
    flex:0 0 auto!important;
    flex-direction:row!important;
    align-items:center!important;
    justify-content:flex-end!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    gap:0!important;
    border:0!important;
  }
  body .asteria-header #accountControls .asteria-account-menu-wrap {
    min-width:0!important;
  }
  body .asteria-header #accountControls #loginToggle {
    box-sizing:border-box!important;
    display:inline-flex!important;
    width:clamp(66px,19vw,92px)!important;
    min-width:0!important;
    max-width:92px!important;
    height:44px!important;
    min-height:44px!important;
    padding-inline:8px!important;
    font-size:clamp(.69rem,2.7vw,.83rem)!important;
    white-space:nowrap!important;
  }
  body .asteria-header #settingsToggle {
    box-sizing:border-box!important;
    flex:0 0 44px!important;
    width:44px!important;
    min-width:44px!important;
    height:44px!important;
    min-height:44px!important;
    padding:8px 10px!important;
    margin:0!important;
  }
  body .asteria-header .asteria-header-profile:not([hidden]) {
    flex:0 0 var(--core-header-height)!important;
    width:var(--core-header-height)!important;
    max-width:var(--core-header-height)!important;
    min-width:var(--core-header-height)!important;
    height:var(--core-header-height)!important;
    min-height:var(--core-header-height)!important;
    margin:0!important;
  }

  /* Image-backed button classes are in the markup on the first paint.
     Keep their authored long shape, but never let the home CTAs overflow. */
  #home .asteria-home-introduction .hero-actions {
    width:100%;
    max-width:100%;
  }
  #home .asteria-home-introduction .hero-actions .asteria-menu-button {
    box-sizing:border-box!important;
    width:min(360px,100%)!important;
    max-width:100%!important;
    min-width:0!important;
  }
}
@media (max-width:380px) {
  body .topbar.asteria-header {gap:4px!important;padding-inline:4px!important;}
  body .asteria-header .top-actions {gap:3px!important;}
  body .asteria-header #accountControls #loginToggle {
    width:66px!important;
    font-size:.7rem!important;
  }
  body .asteria-header #settingsToggle {
    flex-basis:42px!important;
    width:42px!important;
    min-width:42px!important;
  }
}
