:root { --divider:96; --grid:4 } #grid>div{ height:1vh; height:calc(var(--divider)/var(--grid)*1vh); } @media screen and (max-width:600px) { :root { --divider:86; } .timer{ flex-direction: row; } .top-bar{ grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr; } #main{ grid-template-columns: 1fr; grid-template-rows:1fr 9fr; } .top-bar { width: 95%; height: auto; } }