/* FormyDog v30 · header móvil compacto + menú popup estable */

#fdMenu .fd-card{width:min(520px,94vw)!important;max-height:min(720px,90dvh)!important;overflow:auto!important}
#fdMenu .fd-menu{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:10px!important;margin-top:14px!important}
#fdMenu .fd-menu button{min-width:0!important;min-height:104px!important;display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:8px!important;padding:12px 8px!important;border:1px solid #a9ddf6!important;border-radius:16px!important;background:linear-gradient(180deg,#fff,#edf9ff)!important;color:#14527f!important;font-size:10px!important;font-weight:1000!important;line-height:1.1!important;text-align:center!important;box-shadow:0 3px 0 #79bddd,0 8px 18px rgba(7,77,126,.08)!important;overflow:hidden!important;cursor:pointer!important}
#fdMenu .fd-menu button img{display:block!important;width:42px!important;height:42px!important;max-width:42px!important;max-height:42px!important;object-fit:contain!important;flex:0 0 42px!important}
#fdMenu .fd-menu button.is-on{border-color:#7dd7aa!important;background:linear-gradient(180deg,#f4fff8,#def7ea)!important;color:#1e6d4c!important}
#fdMenu .fd-menu button.is-on::after{content:'ACTIVO';padding:3px 7px;border-radius:999px;background:#1d8b60;color:#fff;font-size:6px;font-weight:1000;letter-spacing:.08em}
#fdMenu #fdMenuCare{border-color:#9eddbd!important;background:linear-gradient(180deg,#f7fff9,#e9faef)!important;color:#247557!important}

/* Resultado: siempre por encima del canvas y táctil. */
#result:not([hidden]){z-index:80!important;pointer-events:auto!important}
#result:not([hidden]) #restart{position:relative!important;z-index:90!important;pointer-events:auto!important;touch-action:manipulation!important;min-height:44px!important}
html.fd-retrying-level #result{pointer-events:none!important}

@media(max-width:900px){
  html body .app>.topbar{min-height:58px!important;padding:4px!important;grid-template-columns:minmax(0,1fr) auto!important;grid-template-rows:34px 24px!important;gap:2px 4px!important}
  html body .app>.topbar .brand{grid-column:1!important;grid-row:1!important;min-width:0!important}
  html body .app>.topbar .fd-level-chip{grid-column:2!important;grid-row:1!important;height:28px!important;min-height:28px!important;padding:2px 6px!important}
  html body .app>.topbar .resources{display:none!important}
  html body .app>.topbar .fd-header-tools{grid-column:1/-1!important;grid-row:2!important;display:grid!important;grid-template-columns:repeat(4,36px)!important;justify-content:center!important;gap:7px!important;width:100%!important;margin:0!important;padding:0!important}
  html body .app>.topbar .fd-header-tools button{width:36px!important;min-width:36px!important;height:24px!important;min-height:24px!important;padding:0!important;border-radius:8px!important;font-size:0!important;line-height:1!important;display:grid!important;place-items:center!important;overflow:hidden!important}
  html body .app>.topbar .fd-header-tools button::before{margin:0!important;font-size:13px!important;line-height:1!important}
  html body .app>.topbar #fdHeaderInstructions::before{content:'?';display:grid!important;place-items:center!important;width:16px!important;height:16px!important;border-radius:50%!important;background:#e1f1ff!important;color:#0757b8!important;font-family:Arial,sans-serif!important;font-size:11px!important;font-weight:1000!important}
  html body .app>.topbar #fdHeaderProfile::before{content:'🐾'!important}
  html body .app>.topbar #fdHeaderCare::before{content:'♥'!important}
  html body .app>.topbar #fdHeaderEmergency::before{content:'+'!important}

  #fdMenu{padding:8px!important;align-items:center!important}
  #fdMenu .fd-card{width:min(96vw,480px)!important;max-height:90dvh!important;padding:16px!important;border-radius:20px!important}
  #fdMenu .fd-menu{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:7px!important}
  #fdMenu .fd-menu button{min-height:86px!important;padding:8px 5px!important;border-radius:13px!important;font-size:8px!important;gap:5px!important}
  #fdMenu .fd-menu button img{width:34px!important;height:34px!important;max-width:34px!important;max-height:34px!important;flex-basis:34px!important}

  /* La barra inferior admite 5 o 7 controles sin deformarse. */
  html body .app>.game-layout>.boosters{height:auto!important;min-height:44px!important;grid-template-columns:repeat(auto-fit,minmax(38px,1fr))!important;grid-auto-rows:40px!important;overflow:visible!important}
}

@media(max-width:430px){
  html body .app>.topbar .brand h1{font-size:10px!important;max-width:110px!important}
  html body .app>.topbar .fd-header-tools{grid-template-columns:repeat(4,34px)!important;gap:5px!important}
  html body .app>.topbar .fd-header-tools button{width:34px!important;min-width:34px!important}
  #fdMenu .fd-menu{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  #fdMenu .fd-menu button{min-height:78px!important}
}
